1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2634],{6158:function(e,i,r){var a,n=r(34155);a=function(){"use strict";var e,i,r;function a(a,n){if(e){if(i){var o="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 = {}; ("+e+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",s={};e(s),r=n(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else i=n}else e=n}return a(["exports"],function(e){let i,r,a,o,s,l;var h,u="3.3.0";let c={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==i){let e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{i=null!=n.env.API_URL_REGEX?new RegExp(n.env.API_URL_REGEX):e}catch(r){i=e}}return i},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(!c.API_URL)return null;try{let e=new URL(c.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/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",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"};function d(e){return c.API_URL_REGEX.test(e)}function p(e){return 0===e.indexOf("mapbox:")}function f(e){return c.API_CDN_URL_REGEX.test(e)}function m(e){return c.API_SPRITE_REGEX.test(e)}function _(e){return c.API_STYLE_REGEX.test(e)&&!m(e)}let g={create:"create",load:"load",fullLoad:"fullLoad"};function y(e){let i=e.name.split("?")[0];return f(i)&&i.includes("mapbox-gl.js")?"javascript":f(i)&&i.includes("mapbox-gl.css")?"css":c.API_FONTS_REGEX.test(i)?"fontRange":m(i)?"sprite":_(i)?"style":c.API_TILEJSON_REGEX.test(i)?"tilejson":"other"}function x(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function v(e,i,r,a){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=a}v.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,i){if(void 0===i&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,a=0;a<8;a++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<i)return r;var o=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(o))break;r-=n/o}var s=0,l=1;for(r=e,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-e)<i);a++)e>n?s=r:l=r,r=.5*(l-s)+s;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}};var b=x(v);function w(e,i){this.x=e,this.y=i}w.prototype={clone:function(){return new w(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)}
1,rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},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&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,r=e.y-this.y;return i*i+r*r},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,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,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 i=Math.cos(e),r=Math.sin(e),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround:function(e,i){var r=Math.cos(e),a=Math.sin(e),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},w.convert=function(e){return e instanceof w?e:Array.isArray(e)?new w(e[0],e[1]):e};var T=x(w);let M=Math.PI/180,E=180/Math.PI,S=[[0,0],[1,0],[1,1],[0,1]];function A(e){if(e<=0)return 0;if(e>=1)return 1;let i=e*e,r=i*e;return 4*(e<.5?r:3*(e-i)+r-.75)}function I(e,i,r,a){let n=new b(e,i,r,a);return function(e){return n.solve(e)}}let C=I(.25,.1,.25,1);function P(e,i,r){return Math.min(r,Math.max(i,e))}function z(e,i,r){return(r=P((r-e)/(i-e),0,1))*r*(3-2*r)}function D(e,i,r){let a=r-i,n=((e-i)%a+a)%a+i;return n===i?r:n}function L(e,i,r){if(!e.length)return r(null,[]);let a=e.length,n=Array(e.length),o=null;e.forEach((e,s)=>{i(e,(e,i)=>{e&&(o=e),n[s]=i,0==--a&&r(o,n)})})}function R(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}let k=1;function O(){return k++}function B(){return function e(i){return i?(i^Math.random()*(16>>i/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function F(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function N(e){return!!e&&/^[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 V(e,i){e.forEach(e=>{i[e]&&(i[e]=i[e].bind(i))})}function U(e,i){return -1!==e.indexOf(i,e.length-i.length)}function j(e,i,r){let a={};for(let n in e)a[n]=i.call(r||this,e[n],n,e);return a}function G(e,i,r){let a={};for(let n in e)i.call(r||this,e[n],n,e)&&(a[n]=e[n]);return a}function Z(e){return Array.isArray(e)?e.map(Z):"object"==typeof e&&e?j(e,Z):e}let q={};function $(e){q[e]||("undefined"!=typeof console&&console.warn(e),q[e]=!0)}function W(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function H([e,i,r]){let a=(i+90)*M,n=r*M;return{x:e*Math.cos(a)*Math.sin(n),y:e*Math.sin(a)*Math.sin(n),z:e*Math.cos(n),azimuthal:i,polar:r}}function X(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function Y(e){let i={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,a,n)=>{let o=a||n;return i[r]=!o||o.toLowerCase(),""}),i["max-age"]){let e=parseInt(i["max-age"],10);isNaN(e)?delete i["max-age"]:i["max-age"]=e}return i}let K,J,Q,ee,et,ei,er=null;function ea(e){try{let i=self[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function en(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function eo(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<a?i=n+1:r=n}return i}function es(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<=a?i=n+1:r=n}return i}function el(){return null==K&&(K=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),K}let eh={now:()=>void 0!==ee?ee:performance.now(),setNow(e){ee=e},restoreNow(){ee=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;et||(et=document.createElement("canvas"));let n=et.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>et.width||a>et.height)&&(et.width=r,et.height=a),n.clearRect(-i,-i,r+2*i,a+2*i),n.drawImage(e,0,0,r,a),n.getImageData(-i,-i,r+2*i,a+2*i)},resolveURL:e=>(J||(J=document.createElement("a")),J.href=e,J.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==Q&&(Q=window.matchMedia("(prefers-reduced-motion: reduce)")),Q.matches)},hasCanvasFingerprintNoise(){if(void 0!==ei)return ei;if(!el())return ei=!1,!1;let e=new OffscreenCanvas(85,1),i=e.getContext("2d",{willReadFrequently:!0}),r=0;for(let a=0;a<e.width;++a)i.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,i.fillRect(a,0,1,1);let a=i.getImageData(0,0,e.width,e.height);r=0;for(let e=0;e<a.data.length;++e)if(e%4!=3&&r++!==a.data[e])return ei=!0,!0;return ei=!1,!1}},eu="mapbox-tiles",ec=500,ed=50;function ep(){try{return caches}catch(e){}}function ef(){let e=ep();e&&!r&&(r=e.open(eu))}function em(e){let i=e.indexOf("?");if(i<0)return e;let r=new URLSearchParams,a=new URLSearchParams(e.slice(i));for(let e of["language","worldview"]){let i=a.get(e);i&&r.set(e,i)}return`${e.slice(0,i)}?${r.toString()}`}function e_(e,i){let r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(i).toString()}`;let a=new URLSearchParams(e.slice(r));for(let e in i)a.set(e,i[e]);return`${e.slice(0,r)}?${a.toString()}`}let eg=1/0,ey={supported:!1,testSupport:function(e){!eb&&ev&&(ew?eM(e):ex=e)}},ex,ev,eb=!1,ew=!1,eT="undefined"!=typeof self?self:{};function eM(e){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,ev),e.isContextLost())return;ey.supported=!0}
1catch(e){}e.deleteTexture(i),eb=!0}eT.document&&((ev=eT.document.createElement("img")).onload=function(){ex&&eM(ex),ex=null,ew=!0},ev.onerror=function(){eb=!0,ex=null},ev.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let eE={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(eE);class eS extends Error{constructor(e,i,r){401===i&&d(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let eA=X()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,eI=function(e,i){var n;if(!(/^file:/.test(n=e.url)||/^file:/.test(eA())&&!/^\w+:/.test(n))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,i){var n;let o=new AbortController,s=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:eA(),referrerPolicy:e.referrerPolicy,signal:o.signal}),l=!1,h=!1,u=(n=s.url).indexOf("sku=")>0&&d(n);"json"===e.type&&s.headers.set("Accept","application/json");let c=(r,a,n)=>{if(h)return;if(r&&"SecurityError"!==r.message&&$(r.toString()),a&&n)return p(a);let o=Date.now();fetch(s).then(r=>{if(r.ok){let e=u?r.clone():null;return p(r,e,o)}return i(new eS(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},p=(n,o,u)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then(e=>{h||(o&&u&&function(e,i,n){if(ef(),!r)return;let o=Y(i.headers.get("Cache-Control")||"");if(o["no-store"])return;let s={status:i.status,statusText:i.statusText,headers:new Headers};i.headers.forEach((e,i)=>s.headers.set(i,e)),o["max-age"]&&s.headers.set("Expires",new Date(n+1e3*o["max-age"]).toUTCString());let l=s.headers.get("Expires");if(!l||new Date(l).getTime()-n<42e4)return;let h=em(e.url);if(206===i.status){let i=e.headers.get("Range");if(!i)return;s.status=200,h=e_(h,{range:i})}!function(e,i){if(void 0===a)try{new Response(new ReadableStream),a=!0}catch(e){a=!1}a?i(e.body):e.blob().then(i)}(i,e=>{let i=new Response(e,s);ef(),r&&r.then(e=>e.put(h,i)).catch(e=>$(e.message))})}(s,o,u),l=!0,i(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(e=>{h||i(Error(e.message))})};return u?function(e,i){if(ef(),!r)return i(null);r.then(r=>{let a=em(e.url),n=e.headers.get("Range");n&&(a=e_(a,{range:n})),r.match(a).then(e=>{let n=function(e){if(!e)return!1;let i=new Date(e.headers.get("Expires")||0),r=Y(e.headers.get("Cache-Control")||"");return i>Date.now()&&!r["no-cache"]}(e);r.delete(a),n&&r.put(a,e.clone()),i(null,e,n)}).catch(i)}).catch(i)}(s,c):c(null,null),{cancel:()=>{h=!0,l||o.abort()}}}(e,i);if(X()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}return function(e,i){let r=new XMLHttpRequest;for(let i in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{i(Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let a=r.response;if("json"===e.type)try{a=JSON.parse(r.response)}catch(e){return i(e)}i(null,a,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new eS(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,i)},eC=function(e,i){return eI(R(e,{type:"arrayBuffer"}),i)},eP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";o=[],s=0;let ez=function(e,i){if(ey.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),s>=c.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return o.push(r),r}s++;let r=!1,a=()=>
1{if(!r)for(r=!0,s--;o.length&&s<c.MAX_PARALLEL_IMAGE_REQUESTS;){let e=o.shift(),{requestParameters:i,callback:r,cancelled:a}=e;a||(e.cancel=ez(i,r).cancel)}},n=eC(e,(e,r,n,o)=>{a(),e?i(e):r&&(self.createImageBitmap?function(e,i){createImageBitmap(new Blob([new Uint8Array(e)],{type:"image/png"})).then(e=>{i(null,e)}).catch(e=>{i(Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(r,(e,r)=>i(e,r,n,o)):function(e,i){let r=new Image;r.onload=()=>{i(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame(()=>{r.src=eP})},r.onerror=()=>i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(a):eP}(r,(e,r)=>i(e,r,n,o)))});return{cancel:()=>{n.cancel(),a()}}},eD="NO_ACCESS_TOKEN",eL=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function eR(e){let i=e.match(eL);if(!i)throw Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function ek(e){let i=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${i}`}let eO="mapbox.eventData";function eB(e){if(!e)return null;let i=e.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(decodeURIComponent(atob(i[1]).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(e){return null}}class eF{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){let i=eB(c.ACCESS_TOKEN),r="";return r=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(Number("0x"+i)))):c.ACCESS_TOKEN||"",e?`${eO}.${e}:${r}`:`${eO}:${r}`}fetchEventData(){let e=ea("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(e)try{let e=localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));let a=localStorage.getItem(r);a&&(this.anonId=a)}catch(e){$("Unable to read from LocalStorage")}}saveEventData(){let e=ea("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid"),a=this.anonId;if(e&&a)try{localStorage.setItem(r,a),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch(e){$("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,r,a){var n;if(!c.EVENTS_URL)return;let o=eR(c.EVENTS_URL);o.params.push(`access_token=${a||c.ACCESS_TOKEN||""}`);let s={event:this.type,created:new Date(e).toISOString()},l=i?R(s,i):s,h={url:ek(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=(n=e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(a)},eI(R(h,{method:"POST"}),n))}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}let eN=new class extends eF{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,i){c.EVENTS_URL&&c.ACCESS_TOKEN&&Array.isArray(e)&&e.some(e=>p(e)||d(e))&&this.queueRequest(Date.now(),i)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let i=eB(c.ACCESS_TOKEN),r=i?i.u:c.ACCESS_TOKEN,a=r!==this.eventData.tokenU;N(this.anonId)||(this.anonId=B(),a=!0);let n=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),i=new Date(n),r=(n-this.eventData.lastSuccess)/864e5;a=a||r>=1||r<-1||e.getDate()!==i.getDate()}else a=!0;a?this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:"01","enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=n,this.eventData.tokenU=r)},e):this.processRequests()}},eV=eN.postTurnstileEvent.bind(eN),eU=new class extends eF{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,i,r,a){this.skuToken=i,this.errorCb=a,c.EVENTS_URL&&(r||c.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},r):this.errorCb(Error(eD)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r}=this.queue.shift();i&&this.success[i]||(this.anonId||this.fetchEventData(),N(this.anonId)||(this.anonId=B()),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:"01",skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):i&&(this.success[i]=!0)},e))}remove(){this.errorCb=null}},ej=eU.postMapLoadEvent.bind(eU),eG=new class extends eF{constructor(){super("gljs.performance")}postPerformanceEvent(e,i){c.EVENTS_URL&&(e||c.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,performanceData:r}=this.queue.shift(),a=function(e){let i=performance.getEntriesByType("resource"),r=performance.getEntriesByType("mark"),a=function(e){let i={};if(e){for(let r in e)if("other"!==r)for(let a of e[r]){let e=`${r}ResolveRangeMin`,n=`${r}ResolveRangeMax`,o=`${r}RequestCount`,s=`${r}RequestCachedCount`;i[e]=Math.min(i[e]||1/0,a.startTime),i[n]=Math.max(i[n]||-1/0,a.responseEnd);let l=e=>{void 0===i[e]&&(i[e]=0),++i[e]};void 0!==a.transferSize&&0===a.transferSize&&l(s),l(o)}}return i}(function(e,i){let r={};if(e)for(let a of e){let e=i(a);void 0===r[e]&&(r[e]=[]),r[e].push(a)}return r}(i,y)),n=window.devicePixelRatio,o=navigator.connection||navigator.mozConnection||navigator.webkitConnection,s=o?o.effectiveType:void 0,l={counters:[],metadata:[],attributes:[]},h=(e,i,r)=>{null!=r&&e.push({name:i,value:r.toString()})};for(let e in a)h(l.counters,e,a[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(h(l.counters,"interactionRangeMin",e.interactionRange[0]),h(l.counters,"interactionRangeMax",e.interactionRange[1])),r)for(let e of Object.keys(g)){let i=g[e],a=r.find(e=>e.name===i);a&&h(l.counters,i,a.startTime)}return h(l.counters,"visibilityHidden",e.visibilityHidden),h(l.attributes,"style",function(e){if(e)for(let i of e){let e=i.name.split("?")[0];if(_(e)){let i=e.split("/").slice(-2);if(2===i.length)return`mapbox://styles/${i[0]}/${i[1]}`}}}(i)),h(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),h(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),h(l.attributes,"projection",e.projection),h(l.attributes,"zoom",e.zoom),h(l.metadata,"devicePixelRatio",n),h(l.metadata,"connectionEffectiveType",s),h(l.metadata,"navigatorUserAgent",navigator.userAgent),h(l.metadata,"screenWidth",window.screen.width),h(l.metadata,"screenHeight",window.screen.height),h(l.metadata,"windowWidth",window.innerWidth),h(l.metadata,"windowHeight",window.innerHeight),h(l.metadata,"mapWidth",e.width/n),h(l.metadata,"mapHeight",e.height/n),h(l.metadata,"webglRenderer",e.renderer),h(l.metadata,"webglVendor",e.vendor),h(l.metadata,"sdkVersion",u),h(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(r);for(let e of a.metadata);for(let e of a.counters);for(let e of a.attributes);this.postEvent(i,a,()=>{},e)}},eZ=eG.postPerformanceEvent.bind(eG),eq=new class extends eF{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,i,r,a){var n;if(!c.API_URL||!c.SESSION_PATH)return;let o=eR(c.API_URL+c.SESSION_PATH);o.params.push(`sku=${i||""}`),o.params.push(`access_token=${a||c.ACCESS_TOKEN||""}`);let s={url:ek(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=(n=e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(a)},eI(R(s,{method:"GET"}),n))}getSessionAPI(e,i,r,a){this.skuToken=i,this.errorCb=a,c.SESSION_PATH&&c.API_URL&&(r||c.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},r):this.errorCb(Error(eD)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r}=this.queue.shift();
1i&&this.success[i]||this.getSession(r,this.skuToken,e=>{e?this.errorCb(e):i&&(this.success[i]=!0)},e)}remove(){this.errorCb=null}},e$=eq.getSessionAPI.bind(eq),eW=new Set;function eH(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function eX(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class eY{constructor(e,i={}){R(this,i),this.type=e}}class eK extends eY{constructor(e,i={}){super("error",R({error:e},i))}}class eJ{on(e,i){return this._listeners=this._listeners||{},eH(e,i,this._listeners),this}off(e,i){return eX(e,i,this._listeners),eX(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},eH(e,i,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,i){"string"==typeof e&&(e=new eY(e,i||{}));let r=e.type;if(this.listens(r)){for(let i of(e.target=this,this._listeners&&this._listeners[r]?this._listeners[r].slice():[]))i.call(this,e);for(let i of this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[])eX(r,i,this._oneTimeListeners),i.call(this,e);let i=this._eventedParent;i&&(R(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof eK&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}e.y=void 0;var eQ={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 e0(e){return(e=Math.round(e))<0?0:e>255?255:e}function e1(e){return e0("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function e2(e){var i;return(i="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:i>1?1:i}function e3(e,i,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(i-e)*r*6:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e}try{e.y=({}).parseCSSColor=function(e){var i,r=e.replace(/ /g,"").toLowerCase();if(r in eQ)return eQ[r].slice();if("#"===r[0])return 4===r.length?(i=parseInt(r.substr(1),16))>=0&&i<=4095?[(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1]:null:7===r.length&&(i=parseInt(r.substr(1),16))>=0&&i<=16777215?[(16711680&i)>>16,(65280&i)>>8,255&i,1]:null;var a=r.indexOf("("),n=r.indexOf(")");if(-1!==a&&n+1===r.length){var o=r.substr(0,a),s=r.substr(a+1,n-(a+1)).split(","),l=1;switch(o){case"rgba":if(4!==s.length)break;l=e2(s.pop());case"rgb":return 3!==s.length?null:[e1(s[0]),e1(s[1]),e1(s[2]),l];case"hsla":if(4!==s.length)break;l=e2(s.pop());case"hsl":if(3!==s.length)break;var h=(parseFloat(s[0])%360+360)%360/360,u=e2(s[1]),c=e2(s[2]),d=c<=.5?c*(u+1):c+u-c*u,p=2*c-d;return[e0(255*e3(p,d,h+1/3)),e0(255*e3(p,d,h)),e0(255*e3(p,d,h-1/3)),l]}}return null}}catch(e){}class e5{constructor(e,i,r,a=1){this.r=e,this.g=i,this.b=r,this.a=a}static parse(i){if(!i)return;if(i instanceof e5)return i;if("string"!=typeof i)return;let r=e.y(i);return r?new e5(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[e,i,r,a]=this.toArray();return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(r)},${a})`}toArray(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*i/a,255*r/a,a]}toArray01(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[e/a,i/a,r/a,a]}toArray01Scaled(e){let{r:i,g:r,b:a,a:n}=this;return 0===n?[0,0,0]:[i/n*e,r/n*e,a/n*e]}toArray01PremultipliedAlpha(){let{r:e,g:i,b:r,a:a}=this;return[e,i,r,a]}toArray01Linear(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(r/a,2.2),a]}}function e4(e,i,r){return e*(1-r)+i*r}function e6(e,i,r){return e.map((e,a)=>e4(e,i[a],r))}e5.black=new e5(0,0,0,1),e5.white=new e5(1,1,1,1),e5.transparent=new e5(0,0,0,0),e5.red=new e5(1,0,0,1),e5.blue=new e5(0,0,1,1);var e8=Object.freeze({__proto__:null,array:e6,color:function(e,i,r){return new e5(e4(e.r,i.r,r),e4(e.g,i.g,r),e4(e.b,i.b,r),e4(e.a,i.a,r))},number:e4});function e9(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}
1class e7 extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class te{constructor(e,i=[]){for(let[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new te(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let tt={kind:"null"},ti={kind:"number"},tr={kind:"string"},ta={kind:"boolean"},tn={kind:"color"},to={kind:"object"},ts={kind:"value"},tl={kind:"collator"},th={kind:"formatted"},tu={kind:"resolvedImage"};function tc(e,i){return{kind:"array",itemType:e,N:i}}function td(e){if("array"===e.kind){let i=td(e.itemType);return"number"==typeof e.N?`array<${i}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${i}>`}return e.kind}let tp=[tt,ti,tr,ta,tn,th,to,tc(ts),tu];function tf(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!tf(e.itemType,i.itemType))&&("number"!=typeof e.N||e.N===i.N))return null}else{if(e.kind===i.kind)return null;if("value"===e.kind){for(let e of tp)if(!tf(e,i))return null}}return`Expected ${td(e)} but found ${td(i)} instead.`}function tm(e,i){return i.some(i=>i.kind===e.kind)}function t_(e,i){return i.some(i=>"null"===i?null===e:"array"===i?Array.isArray(e):"object"===i?e&&!Array.isArray(e)&&"object"==typeof e:i===typeof e)}class tg{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ty{constructor(e,i,r,a,n){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n}}class tx{constructor(e){this.sections=e}static fromString(e){return new tx([new ty(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.namePrimary.length)}static factory(e){return e instanceof tx?e:tx.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){let e=["format"];for(let i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);let r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toArray())),e.push(r)}return e}}class tv{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new tv({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function tb(e,i,r,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,i,r,a]:[e,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function tw(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof e5||e instanceof tg||e instanceof tx||e instanceof tv)return!0;if(Array.isArray(e)){for(let i of e)if(!tw(i))return!1;return!0}if("object"==typeof e){for(let i in e)if(!tw(e[i]))return!1;return!0}return!1}function tT(e){if(null===e)return tt;if("string"==typeof e)return tr;if("boolean"==typeof e)return ta;if("number"==typeof e)return ti;if(e instanceof e5)return tn;if(e instanceof tg)return tl;if(e instanceof tx)return th;if(e instanceof tv)return tu;if(Array.isArray(e)){let i;let r=e.length;for(let r of e){let e=tT(r);if(i){if(i===e)continue;i=ts;break}i=e}return tc(i||ts,r)}return to}function tM(e){let i=typeof e;return null===e?"":"string"===i||"number"===i||"boolean"===i?String(e):e instanceof e5||e instanceof tx||e instanceof tv?e.toString():JSON.stringify(e)}class tE{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(2!==e.length)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!tw(e[1]))return i.error("invalid value");let r=e[1],a=tT(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new tE(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof e5?["rgba"].concat(this.value.toArray()):this.value instanceof tx?this.value.serialize():this.value}}var tS=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};let tA={string:tr,number:ti,boolean:ta,object:to};class tI{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,a=1,n=e[0];if("array"===n){let n,o;
1if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in tA)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=tA[r],a++}else n=ts;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);o=e[2],a++}r=tc(n,o)}else r=tA[n];let o=[];for(;a<e.length;a++){let r=i.parse(e[a],a,ts);if(!r)return null;o.push(r)}return new tI(r,o)}evaluate(e){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(e);if(!tf(this.type,tT(r)))return r;if(i===this.args.length-1)throw new tS(`Expected value to be of type ${td(this.type)}, but found ${td(tT(r))} instead.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=this.type,i=[e.kind];if("array"===e.kind){let r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){i.push(r.kind);let a=e.N;("number"==typeof a||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(e=>e.serialize()))}}class tC{constructor(e){this.type=th,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=e.length-1;++r){let o=e[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&!(e=i.parse(o["font-scale"],1,ti)))return null;let r=null;if(o["text-font"]&&!(r=i.parse(o["text-font"],1,tc(tr))))return null;let s=null;if(o["text-color"]&&!(s=i.parse(o["text-color"],1,tn)))return null;let l=a[a.length-1];l.scale=e,l.font=r,l.textColor=s}else{let o=i.parse(e[r],1,ts);if(!o)return null;let s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:o,scale:null,font:null,textColor:null})}}return new tC(a)}evaluate(e){return new tx(this.sections.map(i=>{let r=i.content.evaluate(e);return tT(r)===tu?new ty("",r,null,null,null):new ty(tM(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){let e=["format"];for(let i of this.sections){e.push(i.content.serialize());let r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class tP{constructor(e,i){this.type=tu,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=i.parse(e[1],1,tr);if(!r)return i.error("No image name provided.");if(2===e.length)return new tP(r);let a=i.parse(e[2],1,tr);return a?new tP(r,a):i.error("Secondary image variant is not a string.")}evaluate(e){let i=tv.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function tz(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}let tD={"to-boolean":ta,"to-color":tn,"to-number":ti,"to-string":tr};class tL{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[0],a=[],n=tt;if("to-array"===r){if(!Array.isArray(e[1]))return null;let r=e[1].length;if(i.expectedType){if("array"!==i.expectedType.kind)return i.error(`Expected ${i.expectedType.kind} but found array.`);n=tc(i.expectedType.itemType,r)}else{if(!(r>0&&tw(e[1][0])))return null;n=tc(tT(e[1][0]),r)}for(let o=0;o<r;o++){let r;let s=e[1][o];if("array"===tz(s))r=i.parse(s,void 0,n.itemType);else{let e=tz(s);if(e!==n.itemType.kind)return i.error(`Expected ${n.itemType.kind} but found ${e}.`);r=i.registry.literal.parse(["literal",void 0===s?null:s],i)}if(!r)return null;a.push(r)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return i.error("Expected one argument.");n=tD[r];for(let r=1;r<e.length;r++){let n=i.parse(e[r],r,ts);if(!n)return null;a.push(n)}}return new tL(n,a)}evaluate(e){if("boolean"===this.type.kind)return!!this.args[0].evaluate(e);if("color"===this.type.kind){let i,r;for(let a of this.args){if(i=a.evaluate(e),r=null,i instanceof e5)return i;if("string"==typeof i){let r=e.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:tb(i[0],i[1],i[2],i[3])))return new e5(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new tS(r||`Could not parse color from value '${"string"==typeof i?i:String(JSON.stringify(i))}'`)}if("number"===this.type.kind){let i=null;for(let r of this.args){if(null===(i=r.evaluate(e)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new tS(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?tx.fromString(tM(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?tv.fromString(tM(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):tM(this.args[0].evaluate(e))}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new tC([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tP(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let tR=["Unknown","Point","LineString","Polygon"];var tk=class{constructor(e,i){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.scope=e,this.options=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tR[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=e5.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}};class tO{constructor(e,i,r,a,n){this.name=e,this.type=i,this._evaluate=r,this.args=a,this._overloadIndex=n}evaluate(e){if(!this._evaluate){let e=tO.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){let r=e[0],a=tO.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,o=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=[],l=null,h=-1;for(let[a,u]of o){if(Array.isArray(a)&&a.length!==e.length-1)continue;s.push(a),h++,l=new iT(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);let o=[],c=!1;for(let i=1;i<e.length;i++){let r=e[i],n=Array.isArray(a)?a[i-1]:a.type,s=l.parse(r,1+o.length,n);if(!s){c=!0;break}o.push(s)}if(!c){if(Array.isArray(a)&&a.length!==o.length)l.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let i=Array.isArray(a)?a[e]:a.type,r=o[e];l.concat(e+1).checkSubtype(i,r.type)}if(0===l.errors.length)return new tO(r,n,u,o,h)}}}if(1===s.length)i.errors.push(...l.errors);else{let r=(s.length?s:o.map(([e])=>e)).map(tB).join(" | "),a=[];for(let r=1;r<e.length;r++){let n=i.parse(e[r],1+a.length);if(!n)return null;a.push(td(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(e,i){for(let r in tO.definitions=i,i)e[r]=tO}}function tB(e){return Array.isArray(e)?`(${e.map(td).join(", ")})`:`(${td(e.type)}...)`}class tF{constructor(e,i,r){this.type=tl,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(2!==e.length)return i.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,ta);if(!a)return null;let n=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,ta);if(!n)return null;let o=null;return!r.locale||(o=i.parse(r.locale,1,tr))?new tF(a,n,o):null}evaluate(e){return new tg(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){let e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}var tN={exports:{}};tN.exports=function(){function e(e,i,r){var a=e[i];e[i]=e[r],e[r]=a}function i(e,i){return e<i?-1:e>i?1:0}return function(r,a,n,o,s){!function i(r,a,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}var p=r[a],f=n,m=o;for(e(r,n,a),s(r[o],p)>0&&e(r,n,o);f<m;){for(e(r,f,m),f++,m--;0>s(r[f],p);)f++;for(;s(r[m],p)>0;)m--}0===s(r[n],p)?e(r,n,m):e(r,++m,o),m<=a&&(n=m+1),a<=m&&(o=m-1)}}(r,a,n||0,o||r.length-1,s||i)}}();
1var tV=x(tN.exports);function tU(e,i){e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[0]),e[3]=Math.max(e[3],i[1])}function tj(e,i){return!(e[0]<=i[0]||e[2]>=i[2]||e[1]<=i[1]||e[3]>=i[3])}function tG(e,i,r=!1){let a=!1;for(let n=0,o=i.length;n<o;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[s],l=o[i];if(function(e,i,r){let a=e[0]-i[0],n=e[1]-i[1],o=e[0]-r[0],s=e[1]-r[1];return a*s-o*n==0&&a*o<=0&&n*s<=0}(e,n,l))return r;n[1]>e[1]!=l[1]>e[1]&&e[0]<(l[0]-n[0])*(e[1]-n[1])/(l[1]-n[1])+n[0]&&(a=!a)}}return a}function tZ(e,i,r,a){let n=a[0]-r[0],o=a[1]-r[1],s=(e[0]-r[0])*o-n*(e[1]-r[1]),l=(i[0]-r[0])*o-n*(i[1]-r[1]);return s>0&&l<0||s<0&&l>0}function tq(e,i,r,a){var n,o;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(o=[i[0]-e[0],i[1]-e[1]])[1]-n[1]*o[0]&&!(!tZ(e,i,r,a)||!tZ(r,a,e,i))}function t$(e,i){for(let r=0;r<e.length;++r)if(!tG(e[r],i))return!1;for(let r=0;r<e.length-1;++r)if(function(e,i,r){for(let a of r)for(let r=0,n=a.length,o=n-1;r<n;o=r++)if(tq(e,i,a[o],a[r]))return!0;return!1}(e[r],e[r+1],i))return!1;return!0}function tW(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=[];for(let a=0;a<e[n].length;a++){let s=function(e,i){let r=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(e[n][a],r);tU(i,s),o.push(s)}a.push(o)}return a}function tH(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=tW(e[n],i,r);a.push(o)}return a}function tX(e,i,r,a){if(e[0]<r[0]||e[0]>r[2]){let i=.5*a,n=e[0]-r[0]>i?-a:r[0]-e[0]>i?a:0;0===n&&(n=e[0]-r[2]>i?-a:r[2]-e[0]>i?a:0),e[0]+=n}tU(i,e)}function tY(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let a of e)for(let e of a){let a=[e.x+o[0],e.y+o[1]];tX(a,i,r,n),s.push(a)}return s}function tK(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let r of e){let e=[];for(let a of r){let r=[a.x+o[0],a.y+o[1]];tU(i,r),e.push(r)}s.push(e)}if(i[2]-i[0]<=n/2)for(let e of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,s))for(let a of e)tX(a,i,r,n);return s}class tJ{constructor(e,i){this.type=ta,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(tw(e[1])){let i=e[1];if("FeatureCollection"===i.type)for(let e=0;e<i.features.length;++e){let r=i.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new tJ(i,i.features[e].geometry)}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new tJ(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new tJ(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=tW(i.coordinates,a,n),s=tY(e.geometry(),r,a,n);if(!tj(r,a))return!1;for(let e of s)if(!tG(e,o))return!1}if("MultiPolygon"===i.type){let o=tH(i.coordinates,a,n),s=tY(e.geometry(),r,a,n);if(!tj(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(tG(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=tW(i.coordinates,a,n),s=tK(e.geometry(),r,a,n);if(!tj(r,a))return!1;for(let e of s)if(!t$(e,o))return!1}if("MultiPolygon"===i.type){let o=tH(i.coordinates,a,n),s=tK(e.geometry(),r,a,n);if(!tj(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(t$(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var tQ={exports:{}};tQ.exports=function(){var e={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},i=1/298.257223563*(2-1/298.257223563),r=Math.PI/180,a=function(a,n){if(void 0===a)throw Error("No latitude given.");if(n&&!e[n])throw Error("Unknown unit "+n+". Use one of: "+Object.keys(e).join(", "));var o=6378.137*r*(n?e[n]:1),s=Math.cos(a*r),l=1/(1-i*(1-s*s)),h=Math.sqrt(l);this.kx=o*h*s,this.ky=o*h*l*(1-i)},n={units:{configurable:!0}};function o(e,i){return e[0]===i[0]&&e[1]===i[1]}function s(e,i,r){var a=l(i[0]-e[0]);return[e[0]+a*r,e[1]+(i[1]-e[1])*r]}function l(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}return a.fromTile=function(e,i,n){var o=Math.PI*(1-2*(e+.5)/Math.pow(2,i));return new a(Math.atan(.5*(Math.exp(o)-Math.exp(-o)))/r,n)},n.units.get=function(){return e},a.prototype.distance=function(e,i){var r=l(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)},a.prototype.bearing=function(e,i){return Math.atan2(l(i[0]-e[0])*this.kx,(i[1]-e[1])*this.ky)/r},a.prototype.destination=function(e,i,a){var n=a*r;return this.offset(e,Math.sin(n)*i,Math.cos(n)*i)},a.prototype.offset=function(e,i,r){return[e[0]+i/this.kx,e[1]+r/this.ky]},a.prototype.lineDistance=function(e){for(var i=0,r=0;r<e.length-1;r++)i+=this.distance(e[r],e[r+1]);return i},a.prototype.area=function(e){for(var i=0,r=0;r<e.length;r++)for(var a=e[r],n=0,o=a.length,s=o-1;n<o;s=n++)i+=l(a[n][0]-a[s][0])*(a[n][1]+a[s][1])*(r?-1:1);return Math.abs(i)/2*this.kx*this.ky},a.prototype.along=function(e,i){var r=0;if(i<=0)return e[0];for(var a=0;a<e.length-1;a++){var n=e[a],o=e[a+1],l=this.distance(n,o);if((r+=l)>i)return s(n,o,(i-(r-l))/l)}return e[e.length-1]},a.prototype.pointToSegmentDistance=function(e,i,r){var a=i[0],n=i[1],o=l(r[0]-a)*this.kx,s=(r[1]-n)*this.ky,h=0;
1return 0===o&&0===s||((h=(l(e[0]-a)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s))>1?(a=r[0],n=r[1]):h>0&&(a+=o/this.kx*h,n+=s/this.ky*h)),Math.sqrt((o=l(e[0]-a)*this.kx)*o+(s=(e[1]-n)*this.ky)*s)},a.prototype.pointOnLine=function(e,i){for(var r,a,n,o,s=1/0,h=0;h<e.length-1;h++){var u=e[h][0],c=e[h][1],d=l(e[h+1][0]-u)*this.kx,p=(e[h+1][1]-c)*this.ky,f=0;0===d&&0===p||((f=(l(i[0]-u)*this.kx*d+(i[1]-c)*this.ky*p)/(d*d+p*p))>1?(u=e[h+1][0],c=e[h+1][1]):f>0&&(u+=d/this.kx*f,c+=p/this.ky*f));var m=(d=l(i[0]-u)*this.kx)*d+(p=(i[1]-c)*this.ky)*p;m<s&&(s=m,r=u,a=c,n=h,o=f)}return{point:[r,a],index:n,t:Math.max(0,Math.min(1,o))}},a.prototype.lineSlice=function(e,i,r){var a=this.pointOnLine(r,e),n=this.pointOnLine(r,i);if(a.index>n.index||a.index===n.index&&a.t>n.t){var s=a;a=n,n=s}var l=[a.point],h=a.index+1,u=n.index;!o(r[h],l[0])&&h<=u&&l.push(r[h]);for(var c=h+1;c<=u;c++)l.push(r[c]);return o(r[u],n.point)||l.push(n.point),l},a.prototype.lineSliceAlong=function(e,i,r){for(var a=0,n=[],o=0;o<r.length-1;o++){var l=r[o],h=r[o+1],u=this.distance(l,h);if((a+=u)>e&&0===n.length&&n.push(s(l,h,(e-(a-u))/u)),a>=i)return n.push(s(l,h,(i-(a-u))/u)),n;a>e&&n.push(h)}return n},a.prototype.bufferPoint=function(e,i){var r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[0]+a,e[1]+r]},a.prototype.bufferBBox=function(e,i){var r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[2]+a,e[3]+r]},a.prototype.insideBBox=function(e,i){return l(e[0]-i[0])>=0&&0>=l(e[0]-i[2])&&e[1]>=i[1]&&e[1]<=i[3]},Object.defineProperties(a,n),a}();var t0=x(tQ.exports),t1={exports:{}};t1.exports=function(){var e=function(e,r){if(void 0===e&&(e=[]),void 0===r&&(r=i),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var a=(this.length>>1)-1;a>=0;a--)this._down(a)};function i(e,i){return e<i?-1:e>i?1:0}return e.prototype.push=function(e){this.data.push(e),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(0!==this.length){var e=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),e}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(e){for(var i=this.data,r=this.compare,a=i[e];e>0;){var n=e-1>>1,o=i[n];if(r(a,o)>=0)break;i[e]=o,e=n}i[e]=a},e.prototype._down=function(e){for(var i=this.data,r=this.compare,a=this.length>>1,n=i[e];e<a;){var o=1+(e<<1),s=i[o],l=o+1;if(l<this.length&&0>r(i[l],s)&&(o=l,s=i[l]),r(s,n)>=0)break;i[e]=s,e=o}i[e]=n},e}();var t2=x(t1.exports);function t3(e,i){return i.dist-e.dist}function t5(e){let i=[1/0,1/0,-1/0,-1/0];if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(i[r]!==e[r])return!1;return!0}function t4(e){return e[1]-e[0]+1}function t6(e,i){let r=e[1]>=e[0]&&e[1]<i;return r||console.warn("Distance Expression: Index is out of range"),r}function t8(e,i){if(e[0]>e[1])return[null,null];let r=t4(e);if(i){if(2===r)return[e,null];let i=Math.floor(r/2);return[[e[0],e[0]+i],[e[0]+i,e[1]]]}{if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}}function t9(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!t6(i,e.length))return r;for(let a=i[0];a<=i[1];++a)tU(r,e[a]);return r}function t7(e){let i=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let a=0;a<e[r].length;++a)tU(i,e[r][a]);return i}function ie(e,i,r){if(t5(e)||t5(i))return NaN;let a=0,n=0;return e[2]<i[0]&&(a=i[0]-e[2]),e[0]>i[2]&&(a=e[0]-i[2]),e[1]>i[3]&&(n=e[1]-i[3]),e[3]<i[1]&&(n=i[1]-e[3]),r.distance([0,0],[a,n])}function it(e,i){let r=Math.pow(2,i.z),a=(e.y/8192+i.y)/r;return[(e.x/8192+i.x)/r*360-180,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90]}function ii(e,i,r){let a=r.pointOnLine(i,e).point;return r.distance(e,a)}function ir(e,i,r,a,n){let o=r.slice(a[0],a[1]+1),s=1/0;for(let r=i[0];r<=i[1];++r)if(0===(s=Math.min(s,ii(e[r],o,n))))return 0;return s}function ia(e,i,r,a,n){return Math.min(Math.min(n.pointToSegmentDistance(e,r,a),n.pointToSegmentDistance(i,r,a)),Math.min(n.pointToSegmentDistance(r,e,i),n.pointToSegmentDistance(a,e,i)))}function io(e,i){for(let r of e)for(let e=0;e<=r.length-1;++e)if(tG(r[e],i,!0))return!0;return!1}
1function is(e,i,r,a,n,o,s){if(null===o||null===s)return;let l=ie(t9(a,o),t9(n,s),r);l<i&&e.push({dist:l,range1:o,range2:s})}function il(e,i,r,a,n,o=1/0){let s=Math.min(o,n.distance(e[0],r[0]));if(0===s)return s;let l=new t2([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],t3),h=i?50:100,u=a?50:100;for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1,d=o.range2;if(t4(c)<=h&&t4(d)<=u){if(!t6(c,e.length)||!t6(d,r.length))return NaN;if(i&&a?s=Math.min(s,function(e,i,r,a,n){if(!t6(i,e.length)||!t6(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<i[1];++s)for(let i=a[0];i<a[1];++i){if(tq(e[s],e[s+1],r[i],r[i+1]))return 0;o=Math.min(o,ia(e[s],e[s+1],r[i],r[i+1],n))}return o}(e,c,r,d,n)):i||a?i&&!a?s=Math.min(s,ir(r,d,e,c,n)):!i&&a&&(s=Math.min(s,ir(e,c,r,d,n))):s=Math.min(s,function(e,i,r,a,n){if(!t6(i,e.length)||!t6(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<=i[1];++s)for(let i=a[0];i<=a[1];++i)if(0===(o=Math.min(o,n.distance(e[s],r[i]))))return o;return o}(e,c,r,d,n)),0===s)break}else{let o=t8(c,i),h=t8(d,a);is(l,s,n,e,r,o[0],h[0]),is(l,s,n,e,r,o[0],h[1]),is(l,s,n,e,r,o[1],h[0]),is(l,s,n,e,r,o[1],h[1])}}return s}function ih(e,i,r,a,n=1/0){let o=n,s=t9(e,[0,e.length-1]);for(let n of r)if(!(o!==1/0&&ie(s,t9(n,[0,n.length-1]),a)>=o)&&0===(o=Math.min(o,il(e,i,n,!0,a,o))))break;return o}function iu(e,i,r,a,n=1/0){let o=n,s=t9(e,[0,e.length-1]);for(let n of r){if(o!==1/0&&ie(s,t7(n),a)>=o)continue;let r=function(e,i,r,a,n=1/0){let o=Math.min(a.distance(e[0],r[0][0]),n);if(0===o)return o;let s=new t2([{dist:0,range1:[0,e.length-1],range2:[0,0]}],t3),l=i?50:100,h=t7(r);for(;s.length;){let n=s.pop();if(n.dist>=o)continue;let u=n.range1;if(t4(u)<=l){if(!t6(u,e.length))return NaN;if(i){if(0===(o=Math.min(o,function(e,i,r,a){if(!t6(i,e.length))return NaN;for(let a=i[0];a<=i[1];++a)if(tG(e[a],r,!0))return 0;let n=1/0;for(let o=i[0];o<i[1];++o)for(let i of r)for(let r=0,s=i.length,l=s-1;r<s;l=r++){if(tq(e[o],e[o+1],i[l],i[r]))return 0;n=Math.min(n,ia(e[o],e[o+1],i[l],i[r],a))}return n}(e,u,r,a))))break}else for(let i=u[0];i<=u[1];++i)if(0===(o=Math.min(o,function(e,i,r){if(tG(e,i,!0))return 0;let a=1/0;for(let n of i){let i=n.length;if(i<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[i-1]&&0===(a=Math.min(a,r.pointToSegmentDistance(e,n[i-1],n[0])))||0===(a=Math.min(a,ii(e,n,r))))break}return a}(e[i],r,a))))return o}else{let r=t8(u,i);if(null!==r[0]){let i=ie(t9(e,r[0]),h,a);i<o&&s.push({dist:i,range1:r[0],range2:[0,0]})}if(null!==r[1]){let i=ie(t9(e,r[1]),h,a);i<o&&s.push({dist:i,range1:r[1],range2:[0,0]})}}}return o}(e,i,n,a,o);if(isNaN(r))return r;if(0===(o=Math.min(o,r)))break}return o}function ic(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class id{constructor(e,i){this.type=ti,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(tw(e[1])){let i=e[1];if("FeatureCollection"===i.type){for(let e=0;e<i.features.length;++e)if(ic(i.features[e].geometry.type))return new id(i,i.features[e].geometry)}else if("Feature"===i.type){if(ic(i.geometry.type))return new id(i,i.geometry)}else if(ic(i.type))return new id(i,i)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){let i=e.geometry(),r=e.canonicalID();if(null!=i&&null!=r){if("Point"===e.geometryType())return function(e,i,r){let a=[];for(let r of e)for(let e of r)a.push(it(e,i));let n=new t0(a[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?il(a,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n):"MultiLineString"===r.type?ih(a,!1,r.coordinates,n):"Polygon"===r.type||"MultiPolygon"===r.type?iu(a,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,n):null}(i,r,this.geometries);if("LineString"===e.geometryType())return function(e,i,r){let a=[];for(let r of e){let e=[];for(let a of r)e.push(it(a,i));a.push(e)}let n=new t0(a[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return ih("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=ih(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let i=0;i<a.length;i++){let o=iu(a[i],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return null}(i,r,this.geometries);if("Polygon"===e.geometryType())return function(e,i,r){let a=[];for(let r of function(e,i){let r,a;let n=e.length;if(n<=1)return[e];let o=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[e[i]]):r.push(e[i]))}return r&&o.push(r),o}(e)){let e=[];for(let a=0;a<r.length;++a)e.push(function(e,i){let r=[];for(let a=0;a<e.length;++a)r.push(it(e[a],i));return r}(r[a],i));a.push(e)}let n=new t0(a[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return iu("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=iu(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,i,r){let a=1/0;for(let n of e)for(let e of i){let i=function(e,i,r,a=1/0){let n=t7(e),o=t7(i);if(a!==1/0&&ie(n,o,r)>=a)return a;
1if(tj(n,o)){if(io(e,i))return 0}else if(io(i,e))return 0;let s=a;for(let a of e)for(let e=0,n=a.length,o=n-1;e<n;o=e++)for(let n of i)for(let i=0,l=n.length,h=l-1;i<l;h=i++){if(tq(a[o],a[e],n[h],n[i]))return 0;s=Math.min(s,ia(a[o],a[e],n[h],n[i],r))}return s}(n,e,r,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}("Polygon"===r.type?[r.coordinates]:r.coordinates,a,n):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]}}function ip(e,i){switch(e){case"string":return tM(i);case"number":return+i;case"boolean":return!!i;case"color":return e5.parse(i);case"formatted":return tx.fromString(tM(i));case"resolvedImage":return tv.fromString(tM(i))}return i}function im(e,i,r,a){return void 0!==a&&(e=a*Math.round(e/a)),void 0!==i&&e<i&&(e=i),void 0!==r&&e>r&&(e=r),e}class i_{constructor(e,i,r){this.type=e,this.key=i,this.scope=r}static parse(e,i){let r=i.expectedType;if(null==r&&(r=ts),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");let a=i.parse(e[1],1);if(!(a instanceof tE))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){let n=i.parse(e[2],2);return n instanceof tE?new i_(r,tM(a.value),tM(n.value)):i.error("Scope of 'config' expression must be a string literal.")}return new i_(r,tM(a.value))}evaluate(e){let i=[this.key,this.scope,e.scope].filter(Boolean).join("\x1f"),r=e.getConfig(i);if(!r)return null;let{type:a,value:n,values:o,minValue:s,maxValue:l,stepValue:h}=r,u=r.default.evaluate(e),c=u;if(n){let i=e.scope;e.scope=(i||"").split("\x1f").slice(1).join("\x1f"),c=n.evaluate(e),e.scope=i}return a&&(c=ip(a,c)),void 0===c||void 0===s&&void 0===l&&void 0===h||("number"==typeof c?c=im(c,s,l,h):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?im(e,s,l,h):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,a&&(c=ip(a,c))),(a&&a!==this.type||void 0!==c&&tT(c)!==this.type)&&(c=ip(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.key),e}}function ig(e){if(e instanceof tO&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof tJ||e instanceof id)return!1;let i=!0;return e.eachChild(e=>{i&&!ig(e)&&(i=!1)}),i}function iy(e){if(e instanceof tO&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!iy(e)&&(i=!1)}),i}function ix(e){if(e instanceof i_)return!1;let i=!0;return e.eachChild(e=>{i&&!ix(e)&&(i=!1)}),i}function iv(e,i){if(e instanceof tO&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!iv(e,i)&&(r=!1)}),r}class ib{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new ib(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(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class iw{constructor(e,i=[],r,a=new te,n=[],o,s){this.registry=e,this.path=i,this.key=i.map(e=>`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._scope=o,this.options=s}parse(e,i,r,a,n={}){return i||r?this.concat(i,r,a)._parse(e,n):this._parse(e,n)}_parse(e,i){function r(e,i,r){return"assert"===r?new tI(i,[e]):"coerce"===r?new tL(i,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a="string"==typeof e[0]?this.registry[e[0]]:void 0;if(a){let n=a.parse(e,this);if(!n)return null;if(this.expectedType){let e=this.expectedType,a=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind){if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(e,a))return null}else n=r(n,e,i.typeAnnotation||"coerce")}else n=r(n,e,i.typeAnnotation||"assert")}if(!(n instanceof tE)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof ib)return e(i.boundExpression);if(i instanceof tO&&"error"===i.name||i instanceof tF||i instanceof tJ||i instanceof id||i instanceof i_)return!1;let r=i instanceof tL||i instanceof tI,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof tE}),!!a&&ig(i)&&iv(i,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}(n)){let e=new tk(this._scope,this.options);
1try{n=new tE(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return tL.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,r){let a="number"==typeof e?this.path.concat(e):this.path,n=r?this.scope.concat(r):this.scope;return new iw(this.registry,a,i||null,n,this.errors,this._scope,this.options)}error(e,...i){let r=`${this.key}${i.map(e=>`[${e}]`).join("")}`;this.errors.push(new e7(r,e))}checkSubtype(e,i){let r=tf(e,i);return r&&this.error(r),r}}var iT=iw;function iM(e,i){let r=e.length-1,a,n,o=0,s=r,l=0;for(;o<=s;)if(a=e[l=Math.floor((o+s)/2)],n=e[l+1],a<=i){if(l===r||i<n)return l;o=l+1}else{if(!(a>i))throw new tS("Input is not a number.");s=l-1}return 0}class iE{constructor(e,i,r){for(let[a,n]of(this.type=e,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(e[1],1,ti);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<e.length;r+=2){let o=1===r?-1/0:e[r],s=e[r+1],l=r,h=r+1;if("number"!=typeof o)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(s,h,n);if(!u)return null;n=n||u.type,a.push([o,u])}return new iE(n,r,a)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(e):r[iM(i,a)].evaluate(e)}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}let iS=4/29,iA=6/29,iI=6/29*3*(6/29),iC=6/29*(6/29)*(6/29),iP=Math.PI/180,iz=180/Math.PI;function iD(e){return e>iC?Math.pow(e,1/3):e/iI+iS}function iL(e){return e>iA?e*e*e:iI*(e-iS)}function iR(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ik(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function iO(e){let i=ik(e.r),r=ik(e.g),a=ik(e.b),n=iD((.4124564*i+.3575761*r+.1804375*a)/.95047),o=iD((.2126729*i+.7151522*r+.072175*a)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-iD((.0193339*i+.119192*r+.9503041*a)/1.08883)),alpha:e.a}}function iB(e){let i=(e.l+16)/116,r=isNaN(e.a)?i:i+e.a/500,a=isNaN(e.b)?i:i-e.b/200;return i=1*iL(i),new e5(iR(3.2404542*(r=.95047*iL(r))-1.5371385*i-.4985314*(a=1.08883*iL(a))),iR(-.969266*r+1.8760108*i+.041556*a),iR(.0556434*r-.2040259*i+1.0572252*a),e.alpha)}let iF={forward:iO,reverse:iB,interpolate:function(e,i,r){return{l:e4(e.l,i.l,r),a:e4(e.a,i.a,r),b:e4(e.b,i.b,r),alpha:e4(e.alpha,i.alpha,r)}}},iN={forward:function(e){let{l:i,a:r,b:a}=iO(e),n=Math.atan2(a,r)*iz;return{h:n<0?n+360:n,c:Math.sqrt(r*r+a*a),l:i,alpha:e.a}},reverse:function(e){let i=e.h*iP,r=e.c;return iB({l:e.l,a:Math.cos(i)*r,b:Math.sin(i)*r,alpha:e.alpha})},interpolate:function(e,i,r){return{h:function(e,i,r){let a=i-e;return e+r*(a>180||a<-180?a-360*Math.round(a/360):a)}(e.h,i.h,r),c:e4(e.c,i.c,r),l:e4(e.l,i.l,r),alpha:e4(e.alpha,i.alpha,r)}}};var iV=Object.freeze({__proto__:null,hcl:iN,lab:iF});class iU{constructor(e,i,r,a,n){for(let[o,s]of(this.type=e,this.operator=i,this.interpolation=r,this.input=a,this.labels=[],this.outputs=[],n))this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,i,r,a){let n=0;if("exponential"===e.name)n=ij(i,e.base,r,a);else if("linear"===e.name)n=ij(i,1,r,a);else if("cubic-bezier"===e.name){let o=e.controlPoints;n=new b(o[0],o[1],o[2],o[3]).solve(ij(i,1,r,a))}return n}static parse(e,i){let[r,a,n,...o]=e;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let e=a[1];if("number"!=typeof e)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,ti)))return null;let s=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=tn:i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType);for(let e=0;e<o.length;e+=2){let r=o[e],a=o[e+1],n=e+3,h=e+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,s.push([r,u])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new iU(l,r,a,n,s):i.error(`Type ${td(l)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(e);let o=iM(i,a),s=iU.interpolationFactor(this.interpolation,a,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);return"interpolate"===this.operator?e8[this.type.kind.toLowerCase()](l,h,s):"interpolate-hcl"===this.operator?iN.reverse(iN.interpolate(iN.forward(l),iN.forward(h),s)):iF.reverse(iF.interpolate(iF.forward(l),iF.forward(h),s))}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let i=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)i.push(this.labels[e],this.outputs[e].serialize());return i}}function ij(e,i,r,a){let n=a-r,o=e-r;return 0===n?0:1===i?o/n:(Math.pow(i,o)-1)/(Math.pow(i,n)-1)}class iG{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of e.slice(1)){let e=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}return new iG(a&&n.some(e=>tf(a,e.type))?ts:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof tv&&!r.available&&(i||(i=r),r=null,a===this.args.length))return i;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class iZ{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let a=1;a<e.length-1;a+=2){let n=e[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let o=i.parse(e[a+1],a+1);if(!o)return null;r.push([n,o])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return a?new iZ(r,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let e=["let"];for(let[i,r]of this.bindings)e.push(i,r.serialize());return e.push(this.result.serialize()),e}}class iq{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,ti),a=i.parse(e[2],2,tc(i.expectedType||ts));return r&&a?new iq(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new tS(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new tS(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new tS(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class i${constructor(e,i){this.type=ta,this.needle=e,this.haystack=i}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,ts),a=i.parse(e[2],2,ts);return r&&a?tm(r.type,[ta,tr,ti,tt,ts])?new i$(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${td(r.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!t_(i,["boolean","string","number","null"]))throw new tS(`Expected first argument to be of type boolean, string, number or null, but found ${td(tT(i))} instead.`);if(!t_(r,["string","array"]))throw new tS(`Expected second argument to be of type array or string, but found ${td(tT(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class iW{constructor(e,i,r){this.type=ti,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,ts),a=i.parse(e[2],2,ts);if(!r||!a)return null;if(!tm(r.type,[ta,tr,ti,tt,ts]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${td(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,ti);return n?new iW(r,a,n):null}return new iW(r,a)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!t_(i,["boolean","string","number","null"]))throw new tS(`Expected first argument to be of type boolean, string, number or null, but found ${td(tT(i))} instead.`);if(!t_(r,["string","array"]))throw new tS(`Expected second argument to be of type array or string, but found ${td(tT(r))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(e);return r.indexOf(i,a)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class iH{constructor(e,i,r,a,n,o){this.inputType=e,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=o}static parse(e,i){let r,a;
1if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},o=[];for(let s=2;s<e.length-1;s+=2){let l=e[s],h=e[s+1];Array.isArray(l)||(l=[l]);let u=i.concat(s);if(0===l.length)return u.error("Expected at least one branch label.");for(let e of l){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,tT(e)))return null}else r=tT(e);if(void 0!==n[String(e)])return u.error("Branch labels must be unique.");n[String(e)]=o.length}let c=i.parse(h,s,a);if(!c)return null;a=a||c.type,o.push(c)}let s=i.parse(e[1],1,ts);if(!s)return null;let l=i.parse(e[e.length-1],e.length-1,a);return l?"value"!==s.type.kind&&i.concat(1).checkSubtype(r,s.type)?null:new iH(r,a,s,n,o,l):null}evaluate(e){let i=this.input.evaluate(e);return(tT(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],a={};for(let e of i){let i=a[this.cases[e]];void 0===i?(a[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[i][1].push(e)}let n=e=>"number"===this.inputType.kind?Number(e):e;for(let[i,a]of r)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[i].serialize());return e.push(this.otherwise.serialize()),e}}class iX{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(e,i){let r;if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<e.length-1;n+=2){let o=i.parse(e[n],n,ta);if(!o)return null;let s=i.parse(e[n+1],n+1,r);if(!s)return null;a.push([o,s]),r=r||s.type}let n=i.parse(e[e.length-1],e.length-1,r);return n?new iX(r,a,n):null}evaluate(e){for(let[i,r]of this.branches)if(i.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[i,r]of this.branches)e(i),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class iY{constructor(e,i,r,a){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,ts),a=i.parse(e[2],2,ti);if(!r||!a)return null;if(!tm(r.type,[tc(ts),tr,ts]))return i.error(`Expected first argument to be of type array or string, but found ${td(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,ti);return n?new iY(r.type,r,a,n):null}return new iY(r.type,r,a)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!t_(i,["string","array"]))throw new tS(`Expected first argument to be of type array or string, but found ${td(tT(i))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(e);return i.slice(r,a)}return i.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function iK(e,i){return"=="===e||"!="===e?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function iJ(e,i,r,a){return 0===a.compare(i,r)}function iQ(e,i,r){let a="=="!==e&&"!="!==e;
1return class n{constructor(e,i,r){this.type=ta,this.lhs=e,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===i.type.kind}static parse(e,i){if(3!==e.length&&4!==e.length)return i.error("Expected two or three arguments.");let r=e[0],o=i.parse(e[1],1,ts);if(!o)return null;if(!iK(r,o.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${td(o.type)}'.`);let s=i.parse(e[2],2,ts);if(!s)return null;if(!iK(r,s.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${td(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error(`Cannot compare types '${td(o.type)}' and '${td(s.type)}'.`);a&&("value"===o.type.kind&&"value"!==s.type.kind?o=new tI(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new tI(o.type,[s])));let l=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(l=i.parse(e[3],3,tl)))return null}return new n(o,s,l)}evaluate(n){let o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=tT(o),r=tT(s);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new tS(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let e=tT(o),r=tT(s);if("string"!==e.kind||"string"!==r.kind)return i(n,o,s)}return this.collator?r(n,o,s,this.collator.evaluate(n)):i(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){let i=[e];return this.eachChild(e=>{i.push(e.serialize())}),i}}}let i0=iQ("==",function(e,i,r){return i===r},iJ),i1=iQ("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!iJ(0,i,r,a)}),i2=iQ("<",function(e,i,r){return i<r},function(e,i,r,a){return 0>a.compare(i,r)}),i3=iQ(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),i5=iQ("<=",function(e,i,r){return i<=r},function(e,i,r,a){return 0>=a.compare(i,r)}),i4=iQ(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0});class i6{constructor(e,i,r,a,n,o){this.type=tr,this.number=e,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,i){if(3!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,ti);if(!r)return null;let a=e[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parse(a.locale,1,tr)))return null;let o=null;if(a.currency&&!(o=i.parse(a.currency,1,tr)))return null;let s=null;if(a.unit&&!(s=i.parse(a.unit,1,tr)))return null;let l=null;if(a["min-fraction-digits"]&&!(l=i.parse(a["min-fraction-digits"],1,ti)))return null;let h=null;return!a["max-fraction-digits"]||(h=i.parse(a["max-fraction-digits"],1,ti))?new i6(r,n,o,s,l,h):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class i8{constructor(e){this.type=ti,this.input=e}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=i.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${td(r.type)} instead.`):new i8(r):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new tS(`Expected value to be of type string or array, but found ${td(tT(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function i9(e){return function(){let i=Math.imul((e=1831565813+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/4294967296}}let i7={"==":i0,"!=":i1,">":i3,"<":i2,">=":i4,"<=":i5,array:tI,at:iq,boolean:tI,case:iX,coalesce:iG,collator:tF,format:tC,image:tP,in:i$,"index-of":iW,interpolate:iU,"interpolate-hcl":iU,"interpolate-lab":iU,length:i8,let:iZ,literal:tE,match:iH,number:tI,"number-format":i6,object:tI,slice:iY,step:iE,string:tI,"to-boolean":tL,"to-color":tL,"to-number":tL,"to-string":tL,var:ib,within:tJ,distance:id,config:i_};function re(e,[i,r,a,n]){i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let o=n?n.evaluate(e):1,s=tb(i,r,a,o);if(s)throw new tS(s);return new e5(i/255*o,r/255*o,a/255*o,o)}function rt(e,[i,r,a,n]){var o,s,l;i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let h=n?n.evaluate(e):1,u=(o=i,s=r,l=a,"number"==typeof o&&o>=0&&o<=360?"number"==typeof s&&s>=0&&s<=100&&"number"==typeof l&&l>=0&&l<=100?void 0===h||"number"==typeof h&&h>=0&&h<=1?null:`Invalid hsla value [${[o,s,l,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 'h' must be between 0 and 360.`);if(u)throw new tS(u);let c=`hsla(${i}, ${r}%, ${a}%, ${h})`,d=e5.parse(c);if(!d)throw new tS(`Failed to parse HSLA color: ${c}`);return d}function ri(e,i){let r=i[e];return void 0===r?null:r}function rr(e){return{type:e}}function ra(e){return{result:"success",value:e}}function rn(e){return{result:"error",value:e}}function ro(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function rs(e){return"data-driven"===e["property-type"]}function rl(e){return ro(e.expression,"measure-light")}function rh(e){return ro(e.expression,"zoom")}function ru(e){return!!e.expression&&e.expression.interpolated}function rc(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function rd(e){return e}function rp(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function rf(e,i,r,a,n){return rp(typeof r===n?a[r]:void 0,e.default,i.default)}function rm(e,i,r){if("number"!==tz(r))return rp(e.default,i.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=iM(e.stops.map(e=>e[0]),r);return e.stops[n][1]}
1function r_(e,i,r){let a=void 0!==e.base?e.base:1;if("number"!==tz(r))return rp(e.default,i.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let o=iM(e.stops.map(e=>e[0]),r),s=function(e,i,r,a){let n=a-r,o=e-r;return 0===n?0:1===i?o/n:(Math.pow(i,o)-1)/(Math.pow(i,n)-1)}(r,a,e.stops[o][0],e.stops[o+1][0]),l=e.stops[o][1],h=e.stops[o+1][1],u=e8[i.type]||rd;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=iV[e.colorSpace];u=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),s))}return"function"==typeof l.evaluate?{evaluate(...e){let i=l.evaluate.apply(void 0,e),r=h.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return u(i,r,s)}}:u(l,h,s)}function rg(e,i,r){return"color"===i.type?r=e5.parse(r):"formatted"===i.type?r=tx.fromString(r.toString()):"resolvedImage"===i.type?r=tv.fromString(r.toString()):tz(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),rp(r,e.default,i.default)}tO.register(i7,{error:[{kind:"error"},[tr],(e,[i])=>{throw new tS(i.evaluate(e))}],typeof:[tr,[ts],(e,[i])=>td(tT(i.evaluate(e)))],"to-rgba":[tc(ti,4),[tn],(e,[i])=>i.evaluate(e).toArray()],rgb:[tn,[ti,ti,ti],re],rgba:[tn,[ti,ti,ti,ti],re],hsl:[tn,[ti,ti,ti],rt],hsla:[tn,[ti,ti,ti,ti],rt],has:{type:ta,overloads:[[[tr],(e,[i])=>i.evaluate(e) in e.properties()],[[tr,to],(e,[i,r])=>i.evaluate(e) in r.evaluate(e)]]},get:{type:ts,overloads:[[[tr],(e,[i])=>ri(i.evaluate(e),e.properties())],[[tr,to],(e,[i,r])=>ri(i.evaluate(e),r.evaluate(e))]]},"feature-state":[ts,[tr],(e,[i])=>ri(i.evaluate(e),e.featureState||{})],properties:[to,[],e=>e.properties()],"geometry-type":[tr,[],e=>e.geometryType()],id:[ts,[],e=>e.id()],zoom:[ti,[],e=>e.globals.zoom],pitch:[ti,[],e=>e.globals.pitch||0],"distance-from-center":[ti,[],e=>e.distanceFromCenter()],"measure-light":[ti,[tr],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[ti,[],e=>e.globals.heatmapDensity||0],"line-progress":[ti,[],e=>e.globals.lineProgress||0],"raster-value":[ti,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[ti,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[ti,[],e=>e.globals.skyRadialProgress||0],accumulated:[ts,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ti,rr(ti),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[ti,rr(ti),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:ti,overloads:[[[ti,ti],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[ti],(e,[i])=>-i.evaluate(e)]]},"/":[ti,[ti,ti],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[ti,[ti,ti],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[ti,[],()=>Math.LN2],pi:[ti,[],()=>Math.PI],e:[ti,[],()=>Math.E],"^":[ti,[ti,ti],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[ti,[ti],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[ti,[ti],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[ti,[ti],(e,[i])=>Math.log(i.evaluate(e))],log2:[ti,[ti],(e,[i])=>Math.log(i.evaluate(e))/Math.LN2],sin:[ti,[ti],(e,[i])=>Math.sin(i.evaluate(e))],cos:[ti,[ti],(e,[i])=>Math.cos(i.evaluate(e))],tan:[ti,[ti],(e,[i])=>Math.tan(i.evaluate(e))],asin:[ti,[ti],(e,[i])=>Math.asin(i.evaluate(e))],acos:[ti,[ti],(e,[i])=>Math.acos(i.evaluate(e))],atan:[ti,[ti],(e,[i])=>Math.atan(i.evaluate(e))],min:[ti,rr(ti),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[ti,rr(ti),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[ti,[ti],(e,[i])=>Math.abs(i.evaluate(e))],round:[ti,[ti],(e,[i])=>{let r=i.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[ti,[ti],(e,[i])=>Math.floor(i.evaluate(e))],ceil:[ti,[ti],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[ta,[tr,ts],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[ta,[ts],(e,[i])=>e.id()===i.value],"filter-type-==":[ta,[tr],(e,[i])=>e.geometryType()===i.value],"filter-<":[ta,[tr,ts],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[ta,[ts],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[ta,[tr,ts],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[ta,[ts],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[ta,[tr,ts],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[ta,[ts],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[ta,[tr,ts],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[ta,[ts],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[ta,[ts],(e,[i])=>i.value in e.properties()],"filter-has-id":[ta,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ta,[tc(tr)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[ta,[tc(ts)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[ta,[tr,tc(ts)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[ta,[tr,tc(ts)],(e,[i,r])=>(function(e,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===e)return!0;
1i[n]>e?a=n-1:r=n+1}return!1})(e.properties()[i.value],r.value,0,r.value.length-1)],all:{type:ta,overloads:[[[ta,ta],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[rr(ta),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ta,overloads:[[[ta,ta],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[rr(ta),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[ta,[ta],(e,[i])=>!i.evaluate(e)],"is-supported-script":[ta,[tr],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[tr,[tr],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[tr,[tr],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[tr,rr(ts),(e,i)=>i.map(i=>tM(i.evaluate(e))).join("")],"resolved-locale":[tr,[tl],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[ti,[ti,ti,ts],(e,i)=>{let r;let[a,n,o]=i.map(i=>i.evaluate(e));if(a>n||a===n)return a;if("string"==typeof o)r=function(e){let i=0;if(0===e.length)return i;for(let r=0;r<e.length;r++)i=(i<<5)-i+e.charCodeAt(r)|0;return i}(o);else{if("number"!=typeof o)throw new tS(`Invalid seed input: ${o}`);r=o}return a+i9(r)()*(n-a)}]});class ry{constructor(e,i,r,a){this.expression=e,this._warningHistory={},this._evaluator=new tk(r,a),this._defaultValue=i?"color"===i.type&&(rc(i.default)||Array.isArray(i.default))?new e5(0,0,0,0):"color"===i.type?e5.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=i&&"enum"===i.type?i.values:null}evaluateWithoutErrorHandling(e,i,r,a,n,o,s,l){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,r,a,n,o,s,l){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new tS(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function rx(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in i7}function rv(e,i,r,a){let n=new iT(i7,[],i?function(e){let i={color:tn,string:tr,number:ti,enum:tr,boolean:ta,formatted:th,resolvedImage:tu};return"array"===e.type?tc(i[e.value]||ts,e.length):i[e.type]}(i):void 0,void 0,void 0,r,a),o=n.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return o?ra(new ry(o,i,r,a)):rn(n.errors)}class rb{constructor(e,i,r){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isStateDependent="constant"!==e&&!iy(i.expression),this.isConfigDependent=!ix(i.expression)}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}}class rw{constructor(e,i,r,a,n){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!iy(i.expression),this.isLightConstant=n,this.isConfigDependent=!ix(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}interpolationFactor(e,i,r){return this.interpolationType?iU.interpolationFactor(this.interpolationType,e,i,r):0}}function rT(e,i,r,a){if("error"===(e=rv(e,i,r,a)).result)return e;let n=e.value.expression,o=ig(n);if(!o&&!rs(i))return rn([new e7("","data expressions not supported")]);let s=iv(n,["zoom","pitch","distance-from-center"]);if(!s&&!rh(i))return rn([new e7("","zoom expressions not supported")]);let l=iv(n,["measure-light"]);if(!l&&!rl(i))return rn([new e7("","measure-light expression not supported")]);let h=i.expression&&i.expression.relaxZoomRestriction,u=function e(i){let r=null;if(i instanceof iZ)r=e(i.result);else if(i instanceof iG){for(let a of i.args)if(r=e(a))break}else(i instanceof iE||i instanceof iU)&&i.input instanceof tO&&"zoom"===i.input.name&&(r=i);return r instanceof e7||i.eachChild(i=>{let a=e(i);a instanceof e7?r=a:r&&a&&r!==a&&(r=new e7("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return u||s||h?u instanceof e7?rn([u]):u instanceof iU&&!ru(i)?rn([new e7("",'"interpolate" expressions cannot be used with this property')]):ra(u?new rw(o?"camera":"composite",e.value,u.labels,u instanceof iU?u.interpolation:void 0,l):new rb(o?"constant":"source",e.value,l)):rn([new e7("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class rM{constructor(e,i){this._parameters=e,this._specification=i,e9(this,function e(i,r){let a,n,o;let s="color"===r.type,l=i.stops&&"object"==typeof i.stops[0][0],h=l||!(l||void 0!==i.property),u=i.type||(ru(r)?"exponential":"interval");if(s&&((i=e9({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],e5.parse(e[1])])),i.default=e5.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!iV[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===u)a=r_;else if("interval"===u)a=rm;else if("categorical"===u){for(let e of(a=rf,n=Object.create(null),i.stops))n[e[0]]=e[1];o=typeof i.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);a=rg}if(l){let a={},n=[];for(let e=0;e<i.stops.length;e++){let r=i.stops[e],o=r[0].zoom;void 0===a[o]&&(a[o]={zoom:o,type:i.type,property:i.property,default:i.default,stops:[]},n.push(o)),a[o].stops.push([r[0].value,r[1]])}let o=[];for(let i of n)o.push([a[i].zoom,e(a[i],r)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:iU.interpolationFactor.bind(void 0,s),zoomStops:o.map(e=>e[0]),evaluate:({zoom:e},a)=>r_({stops:o,base:i.base},r,e).evaluate(e,a)}}if(h){let e="exponential"===u?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:iU.interpolationFactor.bind(void 0,e),zoomStops:i.stops.map(e=>e[0]),evaluate:({zoom:e})=>a(i,r,e,n,o)}}return{kind:"source",evaluate(e,s){let l=s&&s.properties?s.properties[i.property]:void 0;return void 0===l?rp(i.default,r.default):a(i,r,l,n,o)}}}(this._parameters,this._specification))}static deserialize(e){return new rM(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function rE(e,i,r){var a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(i=n[1])+2*(r=n[2]);for(var o=0;o<this.d*this.d;
1o++){var s=n[3+o],l=n[3+o+1];a.push(s===l?null:n.subarray(s,l))}var h=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],h),this.bboxes=n.subarray(h),this.insert=this._insertReadonly}else{this.d=i+2*r;for(var u=0;u<this.d*this.d;u++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=r,this.scale=i/e,this.uid=0;var c=r/i*e;this.min=-c,this.max=e+c}rE.prototype.insert=function(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)},rE.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},rE.prototype._insertCell=function(e,i,r,a,n,o){this.cells[n].push(o)},rE.prototype.query=function(e,i,r,a,n){var o=this.min,s=this.max;if(e<=o&&i<=o&&s<=r&&s<=a&&!n)return Array.prototype.slice.call(this.keys);var l=[];return this._forEachCell(e,i,r,a,this._queryCell,l,{},n),l},rE.prototype._queryCell=function(e,i,r,a,n,o,s,l){var h=this.cells[n];if(null!==h)for(var u=this.keys,c=this.bboxes,d=0;d<h.length;d++){var p=h[d];if(void 0===s[p]){var f=4*p;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&a>=c[f+1])?(s[p]=!0,o.push(u[p])):s[p]=!1}}},rE.prototype._forEachCell=function(e,i,r,a,n,o,s,l){for(var h=this._convertToCellCoord(e),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a),p=h;p<=c;p++)for(var f=u;f<=d;f++){var m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&n.call(this,e,i,r,a,m,o,s,l))return}},rE.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},rE.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},rE.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,i=3+this.cells.length+1+1,r=0,a=0;a<this.cells.length;a++)r+=this.cells[a].length;var n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=i,s=0;s<e.length;s++){var l=e[s];n[3+s]=o,n.set(l,o),o+=l.length}return n[3+e.length]=o,n.set(this.keys,o),n[3+e.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer};var rS=x(rE);let rA={};function rI(e,i,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),rA[i]={klass:e,omit:r.omit||[]}}for(let e in rI(Object,"Object"),rS.serialize=function(e,i){let r=e.toArrayBuffer();return i&&i.add(r),{buffer:r}},rS.deserialize=function(e){return new rS(e.buffer)},Object.defineProperty(rS,"name",{value:"Grid"}),rI(rS,"Grid"),rI(e5,"Color"),rI(Error,"Error"),rI(tx,"Formatted"),rI(ty,"FormattedSection"),rI(eS,"AJAXError"),rI(tv,"ResolvedImage"),rI(rM,"StylePropertyFunction"),rI(ry,"StyleExpression",{omit:["_evaluator"]}),rI(rw,"ZoomDependentExpression"),rI(rb,"ZoomConstantExpression"),rI(tO,"CompoundExpression",{omit:["_evaluate"]}),i7)rA[i7[e]._classRegistryKey]||rI(i7[e],`Expression${e}`);function rC(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function rP(e){return self.ImageBitmap&&e instanceof ImageBitmap}function rz(e,i){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(rC(e)||rP(e))return i&&i.add(e),e;if(ArrayBuffer.isView(e))return i&&i.add(e.buffer),e;if(e instanceof ImageData)return i&&i.add(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let a of e)r.push(rz(a,i));return r}if(e instanceof Map){let i={$name:"Map"};for(let[r,a]of e.entries())i[r]=rz(a);return i}if("object"==typeof e){let r=e.constructor,a=r._classRegistryKey;if(!a)throw Error(`can't serialize object of unregistered class ${a}`);let n=r.serialize?r.serialize(e,i):{};if(!r.serialize){for(let r in e)e.hasOwnProperty(r)&&(rA[a].omit.indexOf(r)>=0||(n[r]=rz(e[r],i)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(n.$name=a),n}throw Error("can't serialize object of type "+typeof e)}function rD(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||rC(e)||rP(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(rD);if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=new Map;for(let r of Object.keys(e))"$name"!==r&&i.set(r,rD(e[r]));return i}let{klass:r}=rA[i];if(!r)throw Error(`can't deserialize unregistered class ${i}`);if(r.deserialize)return r.deserialize(e);let a=Object.create(r.prototype);for(let i of Object.keys(e))"$name"!==i&&(a[i]=rD(e[i]));return a}throw Error("can't deserialize object of type "+typeof e)}let rL={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>
1=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function rR(e){for(let i of e)if(rk(i.charCodeAt(0)))return!0;return!1}function rk(e){return!(746!==e&&747!==e&&(e<4352||!(rL["Bopomofo Extended"](e)||rL.Bopomofo(e)||rL["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||rL["CJK Compatibility Ideographs"](e)||rL["CJK Compatibility"](e)||rL["CJK Radicals Supplement"](e)||rL["CJK Strokes"](e)||!(!rL["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||rL["CJK Unified Ideographs Extension A"](e)||rL["CJK Unified Ideographs"](e)||rL["Enclosed CJK Letters and Months"](e)||rL["Hangul Compatibility Jamo"](e)||rL["Hangul Jamo Extended-A"](e)||rL["Hangul Jamo Extended-B"](e)||rL["Hangul Jamo"](e)||rL["Hangul Syllables"](e)||rL.Hiragana(e)||rL["Ideographic Description Characters"](e)||rL.Kanbun(e)||rL["Kangxi Radicals"](e)||rL["Katakana Phonetic Extensions"](e)||rL.Katakana(e)&&12540!==e||!(!rL["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!rL["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||rL["Unified Canadian Aboriginal Syllabics"](e)||rL["Unified Canadian Aboriginal Syllabics Extended"](e)||rL["Vertical Forms"](e)||rL["Yijing Hexagram Symbols"](e)||rL["Yi Syllables"](e)||rL["Yi Radicals"](e))))}function rO(e){return!(rk(e)||rL["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||rL["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||rL["Letterlike Symbols"](e)||rL["Number Forms"](e)||rL["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||rL["Control Pictures"](e)&&9251!==e||rL["Optical Character Recognition"](e)||rL["Enclosed Alphanumerics"](e)||rL["Geometric Shapes"](e)||rL["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||rL["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||rL["CJK Symbols and Punctuation"](e)||rL.Katakana(e)||rL["Private Use Area"](e)||rL["CJK Compatibility Forms"](e)||rL["Small Form Variants"](e)||rL["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}function rB(e){return e>=1424&&e<=2303||rL["Arabic Presentation Forms-A"](e)||rL["Arabic Presentation Forms-B"](e)}let rF="deferred",rN="loading",rV="loaded",rU=null,rj="unavailable",rG=null,rZ=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(rj="error"),rU&&rU(e)};function rq(){r$.fire(new eY("pluginStateChange",{pluginStatus:rj,pluginURL:rG}))}let r$=new eJ,rW=function(){return rj},rH=function(){if(rj!==rF||!rG)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");rj=rN,rq(),rG&&eC({url:rG},e=>{e?rZ(e):(rj=rV,rq())})},rX={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>rj===rV||null!=rX.applyArabicShaping,isLoading:()=>rj===rN,setState(e){rj=e.pluginStatus,rG=e.pluginURL},isParsed:()=>null!=rX.applyArabicShaping&&null!=rX.processBidirectionalText&&null!=rX.processStyledBidirectionalText,getPluginURL:()=>rG};class rY{constructor(e,i){this.zoom=e,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(e){return function(e,i){for(let a of e){var r;
1if(r=a.charCodeAt(0),!i&&rB(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||rL.Khmer(r))return!1}return!0}(e,rX.isLoaded())}}class rK{constructor(e,i,r,a){this.property=e,this.value=i,this.expression=function(e,i,r,a){if(rc(e))return new rM(e,i);if(rx(e)||Array.isArray(e)&&e.length>0){let n=rT(e,i,r,a);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let r=e;return"string"==typeof e&&"color"===i.type&&(r=e5.parse(e)),{kind:"constant",isConfigDependent:!1,evaluate:()=>r}}}(void 0===i?e.specification.default:i,e.specification,r,a)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,i,r){return this.property.possiblyEvaluate(this,e,i,r)}}class rJ{constructor(e,i,r){this.property=e,this.value=new rK(e,void 0,i,r)}transitioned(e,i){return new r0(this.property,this.value,i,R({},e.transition,this.transition),e.now)}untransitioned(){return new r0(this.property,this.value,null,{},0)}}class rQ{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this.isConfigDependent=!1}getValue(e){return Z(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new rJ(this._values[e].property,this._scope,this._options)),this._values[e].value=new rK(this._values[e].property,null===i?void 0:Z(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].value.expression.isConfigDependent}setTransitionOrValue(e,i){i&&(this._options=i);let r=this._properties.properties;if(e)for(let i in e){let a=e[i];if(U(i,"-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r[i]&&this.setValue(i,a)}}getTransition(e){return Z(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new rJ(this._values[e].property)),this._values[e].transition=Z(i)||void 0}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r);let a=this.getTransition(i);void 0!==a&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){let r=new r1(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(e,i._values[a]);return r}untransitioned(){let e=new r1(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class r0{constructor(e,i,r,a,n){let o=a.delay||0,s=a.duration||0;n=n||0,this.property=e,this.value=i,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){let a=e.now||0,n=this.value.possiblyEvaluate(e,i,r),o=this.prior;if(o){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return o.possiblyEvaluate(e,i,r);{let s=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,i,r),n,A(s))}}return n}}class r1{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){let a=new r5(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class r2{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=r,this.isConfigDependent=!1}getValue(e){return Z(this._values[e].value)}setValue(e,i){this._values[e]=new rK(this._values[e].property,null===i?void 0:Z(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].expression.isConfigDependent}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r)}return e}possiblyEvaluate(e,i,r){let a=new r5(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}}class r3{constructor(e,i,r){this.property=e,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,i,r,a){return this.property.evaluate(this.value,this.parameters,e,i,r,a)}}class r5{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class r4{constructor(e){this.specification=e}
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){let a=e8[this.specification.type];return a?a(e,i,r):e}}class r6{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,a){return new r3(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(i,null,{},r,a)}:e.expression,i)}interpolate(e,i,r){if("constant"!==e.value.kind||"constant"!==i.value.kind)return e;if(void 0===e.value.value||void 0===i.value.value)return new r3(this,{kind:"constant",value:void 0},e.parameters);let a=e8[this.specification.type];return a?new r3(this,{kind:"constant",value:a(e.value.value,i.value.value,r)},e.parameters):e}evaluate(e,i,r,a,n,o){return"constant"===e.kind?e.value:e.evaluate(i,r,a,n,o)}}class r8{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,a){return!!e.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class r9{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let i=new rY(0,{});for(let r in e){let a=e[r];a.specification.overridable&&this.overridableProperties.push(r);let n=this.defaultPropertyValues[r]=new rK(a,void 0),o=this.defaultTransitionablePropertyValues[r]=new rJ(a);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(i)}}}function r7(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function ae(e){if(Array.isArray(e))return e.map(ae);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let i={};for(let r in e)i[r]=ae(e[r]);return i}return r7(e)}rI(r6,"DataDrivenProperty"),rI(r4,"DataConstantProperty"),rI(r8,"ColorRampProperty");var at=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":"*"},"volatile":{"type":"boolean","default":false},"*":{"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}
1,"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":{},"raster-particle":{},"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_raster-particle","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"}
1,"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_raster-particle":{"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,">":1,">=":1,"<":1,"<=":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,"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":{"
1interpolated":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","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_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"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
1-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"}}}');function ai(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let i of e.slice(1))if(!ai(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}function ar(e,i="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};ai(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?as(i[1],i[2],"=="):"!="===r?au(as(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?as(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(e)):"all"===r?["all"].concat(i.slice(1).map(e)):"none"===r?["all"].concat(i.slice(1).map(e).map(au)):"in"===r?al(i[1],i.slice(2)):"!in"===r?au(al(i[1],i.slice(2))):"has"===r?ah(i[1]):"!has"!==r||au(ah(i[1]))}(e));let r=e,a=!0;try{a=function(e){if(!aa(e))return e;let i=ae(e);return function e(i){let r=!1,a=[];if("case"===i[0]){for(let e=1;e<i.length-1;e+=2)r=r||aa(i[e]),a.push(i[e+1]);a.push(i[i.length-1])}else if("match"===i[0]){r=r||aa(i[1]);for(let e=2;e<i.length-1;e+=2)a.push(i[e+1]);a.push(i[i.length-1])}else if("step"===i[0]){r=r||aa(i[1]);for(let e=1;e<i.length-1;e+=2)a.push(i[e+1])}r&&(i.length=0,i.push("any",...a));for(let r=1;r<i.length;r++)e(i[r])}(i),i=function e(i){if(!Array.isArray(i))return i;let r=function(e){if(an.has(e[0])){for(let i=1;i<e.length;i++)if(aa(e[i]))return!0}return e}(i);return!0===r?r:r.map(i=>e(i))}(i)}(r)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(r,null,2)} 7 `)}let n=at[`filter_${i}`],o=rv(a,n),s=null;if("error"===o.result)throw Error(o.value.map(e=>`${e.key}: ${e.message}`).join(", "));s=(e,i,r)=>o.value.evaluate(e,i,{},r);let l=null,h=null;if(a!==r){let e=rv(r,n);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(i,r,a,n,o)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,o),h=!ig(e.value.expression)}return{filter:s,dynamicFilter:l||void 0,needGeometry:function e(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(e(i[r]))return!0;return!1}(a),needFeature:!!h}}function aa(e){var i;if(!Array.isArray(e))return!1;if("pitch"===(i=e[0])||"distance-from-center"===i)return!0;for(let i=1;i<e.length;
7i++)if(aa(e[i]))return!0;return!1}let an=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function ao(e,i){return e<i?-1:e>i?1:0}function as(e,i,r){switch(e){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,e,i]}}function al(e,i){if(0===i.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(e=>typeof e!=typeof i[0])?["filter-in-large",e,["literal",i.sort(ao)]]:["filter-in-small",e,["literal",i]]}}function ah(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function au(e){return["!",e]}function ac(e,i){return i?`${e}�${i}`:e}let ad="-transition";class ap extends eJ{constructor(e,i,r,a){if(super(),this.id=e.id,this.fqid=ac(this.id,r),this.type=e.type,this.scope=r,this.options=a,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new r2(i.layout,this.scope,a),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),i.paint)){for(let r in this._transitionablePaint=new rQ(i.paint,this.scope,a),e.paint)this.setPaintProperty(r,e.paint[r]);for(let i in e.layout)this.setLayoutProperty(i,e.layout[i]);this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new r5(i.paint)}}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if("custom"===this.type&&"visibility"===e)return void(this.visibility=i);let r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.isConfigDependent=this.isConfigDependent||r.isConfigDependent,"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return U(e,ad)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(U(e,ad)){let n=e.slice(0,-11);return a[n]&&r.setTransition(n,i||void 0),!1}if(!a[e])return!1;let n=r._values[e],o=n.value.isDataDriven(),s=n.value;r.setValue(e,i),this.isConfigDependent=this.isConfigDependent||r.isConfigDependent,this._handleSpecialPaintPropertyUpdate(e);let l=r._values[e].value,h=l.isDataDriven(),u=U(e,"pattern")||"line-dasharray"===e;return h||o||u||this._handleOverridablePaintPropertyUpdate(e,s,l)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
7serialize(){return G({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&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(let e in this.paint._values){let i=this.paint.get(e);if(i instanceof r3&&rs(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=ar(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}}let af={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class am{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class a_{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw Error("StructArray#emplaceBack() 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 ag(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=af[e.type].BYTES_PER_ELEMENT,o=r=ay(r,Math.max(i,n)),s=e.components||1;return a=Math.max(a,n),r+=n*s,{name:e.name,type:e.type,components:s,offset:o}}),size:ay(r,Math.max(a,i)),alignment:i}}function ay(e,i){return Math.ceil(e/i)*i}class ax extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.int16[a+0]=i,this.int16[a+1]=r,e}}ax.prototype.bytesPerElement=4,rI(ax,"StructArrayLayout2i4");class av extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}av.prototype.bytesPerElement=6,rI(av,"StructArrayLayout3i6");class ab extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.int16[o+0]=i,this.int16[o+1]=r,this.int16[o+2]=a,this.int16[o+3]=n,e}}ab.prototype.bytesPerElement=8,rI(ab,"StructArrayLayout4i8");class aw extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,this.int16[s+4]=o,e}}aw.prototype.bytesPerElement=10,rI(aw,"StructArrayLayout5i10");class aT extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=6*e,u=12*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=n,this.uint8[u+6]=o,this.uint8[u+7]=s,this.float32[3*e+2]=l,e}}aT.prototype.bytesPerElement=12,rI(aT,"StructArrayLayout2i4ub1f12");class aM extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.float32[o+3]=n,e}}aM.prototype.bytesPerElement=16,rI(aM,"StructArrayLayout4f16");class aE extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=6*e;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.float32[3*e+2]=o,e}}aE.prototype.bytesPerElement=12,rI(aE,"StructArrayLayout4ui1f12");class aS extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.uint16[o+0]=i,this.uint16[o+1]=r,this.uint16[o+2]=a,this.uint16[o+3]=n,e}}aS.prototype.bytesPerElement=8,rI(aS,"StructArrayLayout4ui8");class aA extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=6*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=s,e}}aA.prototype.bytesPerElement=12,rI(aA,"StructArrayLayout6i12");class aI extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,i,r,a,n,o,s,l,h,u,c,d)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=12*e;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,e}}aI.prototype.bytesPerElement=24,rI(aI,"StructArrayLayout4i4ui4i24");class aC extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=10*e,h=5*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}aC.prototype.bytesPerElement=20,rI(aC,"StructArrayLayout3i3f20");class aP extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}aP.prototype.bytesPerElement=4,rI(aP,"StructArrayLayout1ul4");class az extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
7return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=r,e}}az.prototype.bytesPerElement=4,rI(az,"StructArrayLayout2ui4");class aD extends a_{_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(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f){let m=20*e,_=10*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.int16[m+4]=o,this.float32[_+3]=s,this.float32[_+4]=l,this.float32[_+5]=h,this.float32[_+6]=u,this.int16[m+14]=c,this.uint32[_+8]=d,this.uint16[m+18]=p,this.uint16[m+19]=f,e}}aD.prototype.bytesPerElement=40,rI(aD,"StructArrayLayout5i4f1i1ul2ui40");class aL extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=8*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.int16[h+4]=n,this.int16[h+5]=o,this.int16[h+6]=s,this.int16[h+7]=l,e}}aL.prototype.bytesPerElement=16,rI(aL,"StructArrayLayout3i2i2i16");class aR extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=4*e,l=8*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.int16[l+6]=n,this.int16[l+7]=o,e}}aR.prototype.bytesPerElement=16,rI(aR,"StructArrayLayout2f1f2i16");class ak extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=12*e,s=3*e;return this.uint8[o+0]=i,this.uint8[o+1]=r,this.float32[s+1]=a,this.float32[s+2]=n,e}}ak.prototype.bytesPerElement=12,rI(ak,"StructArrayLayout2ub2f12");class aO extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,e}}aO.prototype.bytesPerElement=6,rI(aO,"StructArrayLayout3ui6");class aB extends a_{_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(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=30*e,M=15*e,E=60*e;return this.int16[T+0]=i,this.int16[T+1]=r,this.int16[T+2]=a,this.float32[M+2]=n,this.float32[M+3]=o,this.uint16[T+8]=s,this.uint16[T+9]=l,this.uint32[M+5]=h,this.uint32[M+6]=u,this.uint32[M+7]=c,this.uint16[T+16]=d,this.uint16[T+17]=p,this.uint16[T+18]=f,this.float32[M+10]=m,this.float32[M+11]=_,this.uint8[E+48]=g,this.uint8[E+49]=y,this.uint8[E+50]=x,this.uint32[M+13]=v,this.int16[T+28]=b,this.uint8[E+58]=w,e}}aB.prototype.bytesPerElement=60,rI(aB,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class aF extends a_{_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(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,M,E,S,A,I,C,P,z,D){let L=this.length;return this.resize(L+1),this.emplace(L,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,M,E,S,A,I,C,P,z,D)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,M,E,S,A,I,C,P,z,D,L){let R=20*e,k=40*e;return this.float32[R+0]=i,this.float32[R+1]=r,this.int16[k+4]=a,this.int16[k+5]=n,this.int16[k+6]=o,this.int16[k+7]=s,this.int16[k+8]=l,this.int16[k+9]=h,this.int16[k+10]=u,this.int16[k+11]=c,this.int16[k+12]=d,this.uint16[k+13]=p,this.uint16[k+14]=f,this.uint16[k+15]=m,this.uint16[k+16]=_,this.uint16[k+17]=g,this.uint16[k+18]=y,this.uint16[k+19]=x,this.uint16[k+20]=v,this.uint16[k+21]=b,this.uint16[k+22]=w,this.uint16[k+23]=T,this.uint16[k+24]=M,this.uint16[k+25]=E,this.uint16[k+26]=S,this.uint16[k+27]=A,this.uint32[R+14]=I,this.float32[R+15]=C,this.float32[R+16]=P,this.float32[R+17]=z,this.float32[R+18]=D,this.uint8[80*e+76]=L,e}}aF.prototype.bytesPerElement=80,rI(aF,"StructArrayLayout2f9i15ui1ul4f1ub80");class aN extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}aN.prototype.bytesPerElement=4,rI(aN,"StructArrayLayout1f4");class aV extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,this.float32[s+4]=o,e}}aV.prototype.bytesPerElement=20,rI(aV,"StructArrayLayout5f20");class aU extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=7*e;return this.float32[h+0]=i,this.float32[h+1]=r,this.float32[h+2]=a,this.float32[h+3]=n,this.float32[h+4]=o,this.float32[h+5]=s,this.float32[h+6]=l,e}}aU.prototype.bytesPerElement=28,rI(aU,"StructArrayLayout7f28");class aj extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=6*e;
7return this.uint32[3*e+0]=i,this.uint16[o+2]=r,this.uint16[o+3]=a,this.uint16[o+4]=n,e}}aj.prototype.bytesPerElement=12,rI(aj,"StructArrayLayout1ul3ui12");class aG extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}aG.prototype.bytesPerElement=2,rI(aG,"StructArrayLayout1ui2");class aZ extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,e}}aZ.prototype.bytesPerElement=12,rI(aZ,"StructArrayLayout3f12");class aq extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.float32[a+0]=i,this.float32[a+1]=r,e}}aq.prototype.bytesPerElement=8,rI(aq,"StructArrayLayout2f8");class a$ extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=this.length;return this.resize(g+1),this.emplace(g,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=16*e;return this.float32[y+0]=i,this.float32[y+1]=r,this.float32[y+2]=a,this.float32[y+3]=n,this.float32[y+4]=o,this.float32[y+5]=s,this.float32[y+6]=l,this.float32[y+7]=h,this.float32[y+8]=u,this.float32[y+9]=c,this.float32[y+10]=d,this.float32[y+11]=p,this.float32[y+12]=f,this.float32[y+13]=m,this.float32[y+14]=_,this.float32[y+15]=g,e}}a$.prototype.bytesPerElement=64,rI(a$,"StructArrayLayout16f64");class aW extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=10*e,u=5*e;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,e}}aW.prototype.bytesPerElement=20,rI(aW,"StructArrayLayout4ui3f20");class aH extends a_{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}aH.prototype.bytesPerElement=1,rI(aH,"StructArrayLayout1ub1");class aX extends am{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]}}aX.prototype.size=40;class aY extends aD{get(e){return new aX(this,e)}}rI(aY,"CollisionBoxArray");class aK extends am{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]}
7get 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(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}aK.prototype.size=60;class aJ extends aB{get(e){return new aK(this,e)}}rI(aJ,"PlacedSymbolArray");class aQ extends am{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(e){this._structArray.uint32[this._pos4+14]=e}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(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}aQ.prototype.size=80;class a0 extends aF{get(e){return new aQ(this,e)}}rI(a0,"SymbolInstanceArray");class a1 extends aN{getoffsetX(e){return this.float32[1*e+0]}}rI(a1,"GlyphOffsetArray");class a2 extends ax{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}rI(a2,"SymbolLineVertexArray");class a3 extends am{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]}}a3.prototype.size=12;class a5 extends aj{get(e){return new a3(this,e)}}rI(a5,"FeatureIndexArray");class a4 extends az{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}rI(a4,"FillExtrusionCentroidArray");let a6=ag([{name:"a_pos",components:2,type:"Int16"}],4),a8=ag([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class a9{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>a9.MAX_VERTEX_ARRAY_LENGTH&&$(`Max vertices per segment is ${a9.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>a9.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}prepareSegment(e,i,r,a){return this._prepareSegment(e,i.length,r.length,a)}get(){return this.segments}destroy(){for(let e of this.segments)for(let i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,a){return new a9([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function a7(e,i){return 256*(e=P(Math.floor(e),0,255))+P(Math.floor(i),0,255)}a9.MAX_VERTEX_ARRAY_LENGTH=65535,rI(a9,"SegmentVector");let ne=ag([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),nt=ag([{name:"a_dash",components:4,type:"Uint16"}]);var ni={exports:{}},nr={exports:{}};nr.exports=function(e,i){var r,a,n,o,s,l;for(a=e.length-(r=3&e.length),n=i,l=0;l<a;)s=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,n=27492+(65535&(o=5*(65535&(n=(n^=s=(65535&(s=(s=(65535&s)*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>
7>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(s=0,r){case 3:s^=(255&e.charCodeAt(l+2))<<16;case 2:s^=(255&e.charCodeAt(l+1))<<8;case 1:n^=s=(65535&(s=(s=(65535&(s^=255&e.charCodeAt(l)))*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0};var na=nr.exports,nn={exports:{}};nn.exports=function(e,i){for(var r,a=e.length,n=i^a,o=0;a>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++o;switch(a){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};var no=nn.exports;ni.exports=na,ni.exports.murmur3=na,ni.exports.murmur2=no;var ns=x(ni.exports);class nl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,a){this.ids.push(nh(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=nh(e),a=0,n=this.ids.length-1;for(;a<n;){let e=a+n>>1;this.ids[e]>=r?n=e:a=e+1}for(;this.ids[a]===r;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){let r=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(i,r,a,n){for(;a<n;){let o=i[a+n>>1],s=a-1,l=n+1;for(;;){do s++;while(i[s]<o);do l--;while(i[l]>o);if(s>=l)break;nu(i,s,l),nu(r,3*s,3*l),nu(r,3*s+1,3*l+1),nu(r,3*s+2,3*l+2)}l-a<n-l?(e(i,r,a,l),a=l+1):(e(i,r,l+1,n),n=l)}}(r,a,0,r.length-1),i&&(i.add(r.buffer),i.add(a.buffer)),{ids:r,positions:a}}static deserialize(e){let i;let r=new nl;for(let a of(r.ids=e.ids,r.positions=e.positions,r.ids))a!==i&&r.uniqueIds.push(a),i=a;return r.indexed=!0,r}}function nh(e){let i=+e;return!isNaN(i)&&Number.MIN_SAFE_INTEGER<=i&&i<=Number.MAX_SAFE_INTEGER?i:ns(String(e))}function nu(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}rI(nl,"FeaturePositionMap");class nc{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}}class nd extends nc{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class np extends nc{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class nf extends nc{constructor(e){super(e),this.current=[0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class nm extends nc{constructor(e){super(e),this.current=[0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class n_ extends nc{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class ng extends nc{constructor(e){super(e),this.current=e5.transparent}set(e,i,r){this.fetchUniformLocation(e,i)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}let ny=new Float32Array(16);class nx extends nc{constructor(e){super(e),this.current=ny}set(e,i,r){if(this.fetchUniformLocation(e,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 e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}let nv=new Float32Array(9),nb=new Float32Array(4);class nw extends nc{constructor(e){super(e),this.current=nb}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<4;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function nT(e){return[a7(255*e.r,255*e.g),a7(255*e.b,255*e.a)]}class nM{constructor(e,i,r){this.value=e,this.uniformNames=i.map(e=>`u_${e}`),this.type=r}setUniform(e,i,r,a,n){i.set(e,n,a.constantOr(this.value))}getBinding(e,i){return"color"===this.type?new ng(e):new np(e)}}class nE{constructor(e,i){this.uniformNames=i.map(e=>`u_${e}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,r,a,n){let o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&i.set(e,n,o)}getBinding(e,i){return"u_pattern"===i||"u_dash"===i?new n_(e):new np(e)}}class nS{constructor(e,i,r,a){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,r,a,n,o,s){let l=this.paintVertexArray.length,h=this.expression.evaluate(new rY(0,{brightness:o}),i,{},n,a,s);this.paintVertexArray.resize(e),this._setPaintValue(l,e,h)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:0,brightness:s},r,a,void 0,n);this._setPaintValue(e,i,l)}_setPaintValue(e,i,r){if("color"===this.type){let a=nT(r);for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class nA{constructor(e,i,r,a,n,o){this.expression=e,this.uniformNames=i.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=a,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate(new rY(this.zoom,{brightness:o}),i,{},n,a,s),h=this.expression.evaluate(new rY(this.zoom+1,{brightness:o}),i,{},n,a,s),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,l,h)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:this.zoom,brightness:s},r,a,void 0,n),h=this.expression.evaluate({zoom:this.zoom+1,brightness:s},r,a,void 0,n);this._setPaintValue(e,i,l,h)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=nT(r),o=nT(a);for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[1])}else{for(let n=e;n<i;n++)this.paintVertexArray.emplace(n,r,a);
7this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,r,a,n){let o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,s=P(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);i.set(e,n,s)}getBinding(e,i){return new np(e)}}class nI{constructor(e,i,r,a,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?nt:ne).members;for(let e=0;e<i.length;++e);this.paintVertexArray=new a}populatePaintArray(e,i,r){let a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(a,e,i.patterns&&i.patterns[this.layerId],r)}updatePaintArray(e,i,r,a,n,o,s){this._setPaintValues(e,i,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(e,i,r,a){if(!a||!r)return;let n=a[r];if(!n)return;let{tl:o,br:s,pixelRatio:l}=n;for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,o[0],o[1],s[0],s[1],l)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class nC{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[];let a=[];for(let o in e.paint._values){var n;let s=e.paint.get(o);if(!r(o)||!(s instanceof r3&&rs(s.property.specification)))continue;let l=(n=e.type,nz[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]),h=s.value,u=s.property.specification.type,c=!!s.property.useIntegerZoom,d="line-dasharray"===o||o.endsWith("pattern"),p="line-dasharray"===o&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==h.kind||p){if("source"===h.kind||p||d){let i=nR(o,u,"source");this.binders[o]=d?new nI(h,l,u,i,e.id):new nS(h,l,u,i),a.push(`/a_${o}`)}else{let e=nR(o,u,"composite");this.binders[o]=new nA(h,l,u,c,i,e),a.push(`/z_${o}`)}}else this.binders[o]=d?new nE(h.value,l):new nM(h.value,l,u),a.push(`/u_${o}`)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof nS||i instanceof nA?i.maxValue:0}populatePaintArrays(e,i,r,a,n,o,s){for(let l in this.binders){let h=this.binders[l];(h instanceof nS||h instanceof nA||h instanceof nI)&&h.populatePaintArray(e,i,r,a,n,o,s)}}setConstantPatternPositions(e){for(let i in this.binders){let r=this.binders[i];r instanceof nE&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,i,r,a,n,o,s,l){let h=!1,u=Object.keys(e),c=0!==u.length,d=c?u:i.uniqueIds;for(let u in this.binders){let p=this.binders[u];if((p instanceof nS||p instanceof nA||p instanceof nI)&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){let f=n.paint.get(u);for(let r of(p.expression=f.value,d)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let h=a.feature(e);p.updatePaintArray(i,r,h,n,o,s,l)})}if(!c)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let h=a.feature(e);p.updatePaintArray(i,r,h,n,o,s,l)})}h=!0}}return h}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof nM||r instanceof nE)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof nS||r instanceof nA||r instanceof nI)for(let i=0;i<r.paintVertexAttributes.length;i++)e.push(r.paintVertexAttributes[i].name)}return e}getBinderUniforms(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof nM||r instanceof nE||r instanceof nA)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof nM||a instanceof nE||a instanceof nA)for(let n of a.uniformNames)i.push({name:n,property:r,binding:a.getBinding(e,n)})}return i}setUniforms(e,i,r,a,n){for(let{name:i,property:o,binding:s}of r)this.binders[o].setUniform(e,s,n,a.get(o),i)}updatePaintBuffers(){for(let e in this._buffers=[],this.binders){let i=this.binders[e];(i instanceof nS||i instanceof nA||i instanceof nI)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof nS||r instanceof nA||r instanceof nI)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof nS||i instanceof nA||i instanceof nI)&&i.destroy()}}}class nP{constructor(e,i,r=()=>!0){for(let a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new nC(a,i,r);this.needsUpload=!1,this._featureMap=new nl,this._featureMapWithoutIds=new nl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,a,n,o,s,l){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,i,a,n,o,s,l);void 0!==i.id?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,a,n,o){for(let s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,s,a,n,o||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}let nz={"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":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]},nD={"line-pattern":{source:aE,composite:aE},"fill-pattern":{source:aE,composite:aE},"fill-extrusion-pattern":{source:aE,composite:aE},"line-dasharray":{source:aS,composite:aS}},nL={color:{source:aq,composite:aM},number:{source:aN,composite:aq}};function nR(e,i,r){let a=nD[e];return a&&a[r]||nL[i][r]}rI(nM,"ConstantBinder"),rI(nE,"PatternConstantBinder"),rI(nS,"SourceExpressionBinder"),rI(nI,"PatternCompositeBinder"),rI(nA,"CompositeExpressionBinder"),rI(nC,"ProgramConfiguration",{omit:["_buffers"]}),rI(nP,"ProgramConfigurationSet");let nk=8192/Math.PI/2,nO=[64,32,16],nB=-nk;function nF(e,i,r,a=nk){return[e*Math.sin(r*=M)*a,-i*a,e*Math.cos(r)*a]}function nN(e,i,r){return nF(Math.cos(e*M),Math.sin(e*M),i,r)}let nV=2*Math.PI*6371008.8;class nU{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new nU(D(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let i=Math.PI/180,r=this.lat*i,a=e.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((e.lng-this.lng)*i),1))}toBounds(e=0){let i=360*e/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new nj({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return nN(this.lat,this.lng,nk+e*nk/6371008.8)}static convert(e){if(e instanceof nU)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new nU(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new nU(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class nj{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof nU?new nU(e.lng,e.lat):nU.convert(e),this}setSouthWest(e){return this._sw=e instanceof nU?new nU(e.lng,e.lat):nU.convert(e),this}extend(e){let i,r;let a=this._sw,n=this._ne;if(e instanceof nU)i=e,r=e;else{if(!(e instanceof nj))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(nj.convert(e)):this.extend(nU.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(nU.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new nU(i.lng,i.lat),this._ne=new nU(r.lng,r.lat)),this}getCenter(){return new nU((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 nU(this.getWest(),this.getNorth())}getSouthEast(){return new nU(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:i,lat:r}=nU.convert(e),a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&a}static convert(e){return!e||e instanceof nj?e:new nj(e)}}var nG={};(function(e){function i(e,i,a){var n=r(256*e,256*(i=Math.pow(2,a)-i-1),a),o=r(256*(e+1),256*(i+1),a);return n[0]+","+n[1]+","+o[0]+","+o[1]}function r(e,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[e*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}e.getURL=function(e,r,a,n,o,s){return s=s||{},e+"?"+["bbox="+i(a,n,o),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+r].join("&")},e.getTileBBox=i,e.getMercCoords=r,Object.defineProperty(e,"__esMo
7dule",{value:!0})})(nG);class nZ{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=nW(0,e,e,i,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){let r=nG.getTileBBox(this.x,this.y,this.z),a=function(e,i,r){let a,n="";for(let o=e;o>0;o--)n+=(i&(a=1<<o-1)?1:0)+(r&a?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class nq{constructor(e,i){this.wrap=e,this.canonical=i,this.key=nW(e,i.z,i.z,i.x,i.y)}}class n${constructor(e,i,r,a,n){this.overscaledZ=e,this.wrap=i,this.canonical=new nZ(r,+a,+n),this.key=0===i&&e===r?this.canonical.key:nW(i,e,r,a,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){let i=this.canonical.z-e;return e>this.canonical.z?new n$(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new n$(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return nW(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return nW(this.wrap*+i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;let i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new n$(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new n$(i,this.wrap,i,r,a),new n$(i,this.wrap,i,r+1,a),new n$(i,this.wrap,i,r,a+1),new n$(i,this.wrap,i,r+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new n$(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new n$(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new nq(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function nW(e,i,r,a,n){let o=1<<Math.min(r,22),s=n%o*o+a%o;return e&&r<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*s+r)+(i-r)}let nH=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new n$(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>{let i=e.canonical.x+1,r=e.wrap;return i===1<<e.canonical.z&&(i=0,r++),new n$(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new n$(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new n$(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];function nX(e){return nV*Math.cos(e*Math.PI/180)}function nY(e){return(180+e)/360}function nK(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function nJ(e){return 360*e-180}function nQ(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function n0(e){return Math.cos(P(e,-85.051129,85.051129)*M)}function n1(e,i){let r=Math.pow(2,P(i,0,25.5));return n0(e)*nV/(512*r)}function n2(e){return 1/Math.cos(e*Math.PI/180)}function n3(e,i=0){let r=Math.exp(Math.PI*(1-(e.y+i/8192)/(1<<e.z)*2));return 80150034*r/(r*r+1)/8192/(1<<e.z)}rI(nZ,"CanonicalTileID"),rI(n$,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});class n5{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){let r=nU.convert(e);return new n5(nY(r.lng),nK(r.lat),i/nX(r.lat))}toLngLat(){return new nU(nJ(this.x),nQ(this.y))}toAltitude(){return this.z*nX(nQ(this.y))}meterInMercatorCoordinateUnits(){return 1/nV*n2(nQ(this.y))}}function n4(e,i,r){let a=e[0],n=a.x,o=a.y;i(a);let s=[a];for(let l=1;l<e.length;l++){let h=e[l],{x:u,y:c}=h;i(h),function e(i,r,a,n,o,s,l,h,u){let c=(r+n)/2,d=(a+o)/2,p=new T(c,d);h(p),function(e,i,r,a,n,o){let s=r-n,l=a-o;return Math.abs((a-i)*s-(r-e)*l)/Math.hypot(s,l)}(p.x,p.y,s.x,s.y,l.x,l.y)>=u?(e(i,r,a,c,d,s,p,h,u),e(i,c,d,n,o,p,l,h,u)):i.push(l)}(s,n,o,u,c,a,h,i,r),n=u,o=c,a=h}return s}let n6=-16383-1;function n8(e,i,r){let a=e.loadGeometry(),n=e.extent,o=8192/n;if(i&&r&&r.projection.isReprojectedInTileSpace){let o=1<<i.z,{scale:s,x:l,y:h,projection:u}=r,c=e=>
7{let r=nJ((i.x+e.x/n)/o),a=nQ((i.y+e.y/n)/o),c=u.project(r,a);e.x=(c.x*s-l)*n,e.y=(c.y*s-h)*n};for(let i=0;i<a.length;i++)if(1!==e.type)a[i]=n4(a[i],c,1);else{let e=[];for(let r of a[i])r.x<0||r.x>=n||r.y<0||r.y>=n||(c(r),e.push(r));a[i]=e}}for(let e of a)for(let i of e)!function(e,i){let r=Math.round(e.x*i),a=Math.round(e.y*i);e.x=P(r,n6,16383),e.y=P(a,n6,16383),(r<e.x||r>e.x+1||a<e.y||a>e.y+1)&&$("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,o);return a}function n9(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?n8(e):[]}}function n7(e,i,r,a,n){e.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}function oe(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class ot{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new ax,this.indexArray=new aO,this.segments=new a9,this.programConfigurations=new nP(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,i,r,a){let n=this.layers[0],o=[],s=null;for(let{feature:i,id:l,index:h,sourceLayerIndex:u}of("circle"===n.type&&(s=n.layout.get("circle-sort-key")),e)){let e=this.layers[0]._featureFilter.needGeometry,n=n9(i,e);if(!this.layers[0]._featureFilter.filter(new rY(this.zoom),n,r))continue;let c=s?s.evaluate(n,{},r):void 0,d={id:l,properties:i.properties,type:i.type,sourceLayerIndex:u,index:h,geometry:e?n.geometry:n8(i,r,a),patterns:{},sortKey:c};o.push(d)}s&&o.sort((e,i)=>e.sortKey-i.sortKey);let l=null;for(let n of("globe"===a.projection.name&&(this.globeExtVertexArray=new aA,l=a.projection),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n,h=e[o].feature;this.addFeature(n,a,o,i.availableImages,r,l,i.brightness),i.featureIndex.insert(h,a,o,s,this.index)}}update(e,i,r,a,n){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,a6.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,a8.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,r,a,n,o,s){for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;if(o){let e=o.projectTilePoint(r,a,n),i=o.upVector(n,r,a),s=this.globeExtVertexArray;oe(s,e,i),oe(s,e,i),oe(s,e,i),oe(s,e,i)}let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),l=s.vertexLength;n7(this.layoutVertexArray,r,a,-1,-1),n7(this.layoutVertexArray,r,a,1,-1),n7(this.layoutVertexArray,r,a,1,1),n7(this.layoutVertexArray,r,a,-1,1),this.indexArray.emplaceBack(l,l+1,l+2),this.indexArray.emplaceBack(l,l+2,l+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},a,n,s)}}function oi(e,i){for(let r=0;r<e.length;r++)if(ol(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(ol(e,i[r]))return!0;return!!oa(e,i)}function or(e,i){if(1===e.length)return os(i,e[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(ol(e,a[i]))return!0}for(let r=0;r<e.length;r++)if(os(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(oa(e,i[r]))return!0;return!1}function oa(e,i){if(0===e.length||0===i.length)return!1;for(let n=0;n<e.length-1;n++){let o=e[n],s=e[n+1];for(let e=0;e<i.length-1;e++){var r,a;if(W(o,r=i[e],a=i[e+1])!==W(s,r,a)&&W(o,s,r)!==W(o,s,a))return!0}}return!1}function on(e,i,r){let a=r*r;if(1===i.length)return e.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(oo(e,i[r-1],i[r])<a)return!0;return!1}function oo(e,i,r){let a=i.distSqr(r);if(0===a)return e.distSqr(i);let n=((e.x-i.x)*(r.x-i.x)+(e.y-i.y)*(r.y-i.y))/a;return e.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function os(e,i){let r,a,n,o=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)a=r[e],n=r[s],a.y>i.y!=n.y>i.y&&i.x<(n.x-a.x)*(i.y-a.y)/(n.y-a.y)+a.x&&(o=!o)}return o}function ol(e,i){let r=!1;for(let a=0,n=e.length-1;a<e.length;n=a++){let o=e[a],s=e[n];o.y>i.y!=s.y>i.y&&i.x<(s.x-o.x)*(i.y-o.y)/(s.y-o.y)+o.x&&(r=!r)}return r}function oh(e,i,r,a,n){for(let o of e)if(i<=o.x&&r<=o.y&&a>=o.x&&n>=o.y)return!0;let o=[new T(i,r),new T(i,n),new T(a,n),new T(a,r)];if(e.length>2){for(let i of o)if(ol(e,i))return!0}for(let i=0;i<e.length-1;i++)if(function(e,i,r){let a=r[0],n=r[2];if(e.x<a.x&&i.x<a.x||e.x>n.x&&i.x>n.x||e.y<a.y&&i.y<a.y||e.y>n.y&&i.y>n.y)return!1;let o=W(e,i,r[0]);return o!==W(e,i,r[1])||o!==W(e,i,r[2])||o!==W(e,i,r[3])}(e[i],e[i+1],o))return!0;return!1}function ou(e,i,r,a,n,o){let s=i.y-e.y,l=e.x-i.x;if(o=o||0){let e=s*s+l*l;if(0===e)return!0;let i=Math.sqrt(e);s/=i,l/=i}
7return!((r.x-e.x)*s+(r.y-e.y)*l-o<0||(a.x-e.x)*s+(a.y-e.y)*l-o<0||(n.x-e.x)*s+(n.y-e.y)*l-o<0)}function oc(e,i,r,a,n,o,s){return!(ou(e,i,a,n,o,s)||ou(i,r,a,n,o,s)||ou(r,e,a,n,o,s)||ou(a,n,e,i,r,s)||ou(n,o,e,i,r,s)||ou(o,a,e,i,r,s))}function od(e,i,r){let a=i.paint.get(e).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(e)}function op(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function of(e,i,r,a,n){if(!i[0]&&!i[1])return e;let o=T.convert(i)._mult(n);"viewport"===r&&o._rotate(-a);let s=[];for(let i=0;i<e.length;i++)s.push(e[i].sub(o));return s}function om(e,i,r,a){let n=T.convert(e)._mult(a);return"viewport"===i&&n._rotate(-r),n}rI(ot,"CircleBucket",{omit:["layers"]});let o_=new r9({"circle-sort-key":new r6(at.layout_circle["circle-sort-key"]),visibility:new r4(at.layout_circle.visibility)});var og={paint:new r9({"circle-radius":new r6(at.paint_circle["circle-radius"]),"circle-color":new r6(at.paint_circle["circle-color"]),"circle-blur":new r6(at.paint_circle["circle-blur"]),"circle-opacity":new r6(at.paint_circle["circle-opacity"]),"circle-translate":new r4(at.paint_circle["circle-translate"]),"circle-translate-anchor":new r4(at.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new r4(at.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new r4(at.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new r6(at.paint_circle["circle-stroke-width"]),"circle-stroke-color":new r6(at.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new r6(at.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new r4(at.paint_circle["circle-emissive-strength"])}),layout:o_},oy={},ox={};Object.defineProperty(ox,"__esModule",{value:!0}),ox.setMatrixArrayType=function(e){ox.ARRAY_TYPE=ob=e},ox.toRadian=function(e){return e*ow},ox.equals=function(e,i){return Math.abs(e-i)<=ov*Math.max(1,Math.abs(e),Math.abs(i))},ox.RANDOM=ox.ARRAY_TYPE=ox.EPSILON=void 0;var ov=1e-6;ox.EPSILON=ov;var ob="undefined"!=typeof Float32Array?Float32Array:Array;ox.ARRAY_TYPE=ob,ox.RANDOM=Math.random;var ow=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,i=arguments.length;i--;)e+=arguments[i]*arguments[i];return Math.sqrt(e)});var oT={};function oM(e){return(oM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(oT,"__esModule",{value:!0}),oT.create=function(){var e=new oE.ARRAY_TYPE(4);return oE.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},oT.clone=function(e){var i=new oE.ARRAY_TYPE(4);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i},oT.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},oT.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},oT.fromValues=function(e,i,r,a){var n=new oE.ARRAY_TYPE(4);return n[0]=e,n[1]=i,n[2]=r,n[3]=a,n},oT.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},oT.transpose=function(e,i){if(e===i){var r=i[1];e[1]=i[2],e[2]=r}else e[0]=i[0],e[1]=i[2],e[2]=i[1],e[3]=i[3];return e},oT.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*o-n*a;return s?(e[0]=o*(s=1/s),e[1]=-a*s,e[2]=-n*s,e[3]=r*s,e):null},oT.adjoint=function(e,i){var r=i[0];return e[0]=i[3],e[1]=-i[1],e[2]=-i[2],e[3]=r,e},oT.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},oT.multiply=oA,oT.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+o*l,e[1]=n*h+s*l,e[2]=-(a*l)+o*h,e[3]=-(n*l)+s*h,e},oT.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=r[0],l=r[1];return e[0]=i[0]*s,e[1]=a*s,e[2]=n*l,e[3]=o*l,e},oT.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e},oT.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e},oT.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},oT.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},oT.LDU=function(e,i,r,a){return e[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-e[2]*r[1],[e,i,r]},oT.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},oT.subtract=oI,oT.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},oT.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=i[0],l=i[1],h=i[2],u=i[3];return Math.abs(r-s)<=oE.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(a-l)<=oE.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=oE.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=oE.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},oT.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},oT.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},oT.sub=oT.mul=void 0;
7var oE=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==oM(e)&&"function"!=typeof e)return{default:e};var r=oS(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function oS(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(oS=function(e){return e?r:i})(e)}function oA(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*l+o*h,e[1]=n*l+s*h,e[2]=a*u+o*c,e[3]=n*u+s*c,e}function oI(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}oT.mul=oA,oT.sub=oI;var oC={};function oP(e){return(oP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(oC,"__esModule",{value:!0}),oC.create=function(){var e=new oz.ARRAY_TYPE(6);return oz.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},oC.clone=function(e){var i=new oz.ARRAY_TYPE(6);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i},oC.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e},oC.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},oC.fromValues=function(e,i,r,a,n,o){var s=new oz.ARRAY_TYPE(6);return s[0]=e,s[1]=i,s[2]=r,s[3]=a,s[4]=n,s[5]=o,s},oC.set=function(e,i,r,a,n,o,s){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e},oC.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r*o-a*n;return h?(e[0]=o*(h=1/h),e[1]=-a*h,e[2]=-n*h,e[3]=r*h,e[4]=(n*l-o*s)*h,e[5]=(a*s-r*l)*h,e):null},oC.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},oC.multiply=oL,oC.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=Math.sin(r),c=Math.cos(r);return e[0]=a*c+o*u,e[1]=n*c+s*u,e[2]=-(a*u)+o*c,e[3]=-(n*u)+s*c,e[4]=l,e[5]=h,e},oC.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r[0],u=r[1];return e[0]=i[0]*h,e[1]=a*h,e[2]=n*u,e[3]=o*u,e[4]=s,e[5]=l,e},oC.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=a*u+o*c+l,e[5]=n*u+s*c+h,e},oC.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e[4]=0,e[5]=0,e},oC.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e[4]=0,e[5]=0,e},oC.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=i[0],e[5]=i[1],e},oC.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},oC.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},oC.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e},oC.subtract=oR,oC.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e},oC.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e},oC.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]},oC.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=e[4],l=e[5],h=i[0],u=i[1],c=i[2],d=i[3],p=i[4],f=i[5];return Math.abs(r-h)<=oz.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-u)<=oz.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(n-c)<=oz.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=oz.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(s-p)<=oz.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(l-f)<=oz.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))},oC.sub=oC.mul=void 0;var oz=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==oP(e)&&"function"!=typeof e)return{default:e};var r=oD(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function oD(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(oD=function(e){return e?r:i})(e)}function oL(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1],d=r[2],p=r[3],f=r[4],m=r[5];return e[0]=a*u+o*c,e[1]=n*u+s*c,e[2]=a*d+o*p,e[3]=n*d+s*p,e[4]=a*f+o*m+l,e[5]=n*f+s*m+h,e}function oR(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e}oC.mul=oL,oC.sub=oR;var ok={};function oO(e){return(oO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(ok,"__esModule",{value:!0}),ok.create=function(){var e=new oB.ARRAY_TYPE(9);return oB.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},ok.fromMat4=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[4],e[4]=i[5],e[5]=i[6],e[6]=i[8],e[7]=i[9],e[8]=i[10],e},ok.clone=function(e){var i=new oB.ARRAY_TYPE(9);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i},ok.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},ok.fromValues=function(e,i,r,a,n,o,s,l,h){var u=new oB.ARRAY_TYPE(9);return u[0]=e,u[1]=i,u[2]=r,u[3]=a,u[4]=n,u[5]=o,u[6]=s,u[7]=l,u[8]=h,u},ok.set=function(e,i,r,a,n,o,s,l,h,u){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e},ok.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},ok.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[5];e[1]=i[3],e[2]=i[6],e[3]=r,e[5]=i[7],e[6]=a,e[7]=n}else e[0]=i[0],e[1]=i[3],e[2]=i[6],e[3]=i[1],e[4]=i[4],e[5]=i[7],e[6]=i[2],e[7]=i[5],e[8]=i[8];return e},ok.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=c*s-l*u,p=-c*o+l*h,f=u*o-s*h,m=r*d+a*p+n*f;return m?(e[0]=d*(m=1/m),e[1]=(-c*a+n*u)*m,e[2]=(l*a-n*s)*m,e[3]=p*m,e[4]=(c*r-n*h)*m,e[5]=(-l*r+n*o)*m,e[6]=f*m,e[7]=(-u*r+a*h)*m,e[8]=(s*r-a*o)*m,e):null},ok.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8];return e[0]=s*c-l*u,e[1]=n*u-a*c,e[2]=a*l-n*s,e[3]=l*h-o*c,e[4]=r*c-n*h,e[5]=n*o-r*l,e[6]=o*u-s*h,e[7]=a*h-r*u,e[8]=r*s-a*o,e},ok.determinant=function(e){var i=e[3],r=e[4],a=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*r-a*o)+e[1]*(-s*i+a*n)+e[2]*(o*i-r*n)},ok.multiply=oN,ok.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=p*a+f*s+u,e[7]=p*n+f*l+c,e[8]=p*o+f*h+d,e},ok.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=Math.sin(r),f=Math.cos(r);return e[0]=f*a+p*s,e[1]=f*n+p*l,e[2]=f*o+p*h,e[3]=f*s-p*a,e[4]=f*l-p*n,e[5]=f*h-p*o,e[6]=u,e[7]=c,e[8]=d,e},ok.scale=function(e,i,r){var a=r[0],n=r[1];return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=n*i[3],e[4]=n*i[4],e[5]=n*i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},ok.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=i[0],e[7]=i[1],e[8]=1,e},ok.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=-r,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},ok.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=i[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},ok.fromMat2d=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=0,e[3]=i[2],e[4]=i[3],e[5]=0,e[6]=i[4],e[7]=i[5],e[8]=1,e},ok.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[3]=c-y,e[6]=p+g,e[1]=c+y,e[4]=1-u-m,e[7]=f-_,e[2]=p-g,e[5]=f+_,e[8]=1-u-d,e},ok.normalFromMat4=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,M=n*u-o*h,E=c*_-
7d*m,S=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*S+M*E;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(h*A-s*P-u*S)*z,e[2]=(s*C-l*A+u*E)*z,e[3]=(n*C-a*P-o*I)*z,e[4]=(r*P-n*A+o*S)*z,e[5]=(a*A-r*C-o*E)*z,e[6]=(_*M-g*T+y*w)*z,e[7]=(g*b-m*M-y*v)*z,e[8]=(m*T-_*b+y*x)*z,e):null},ok.projection=function(e,i,r){return e[0]=2/i,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},ok.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},ok.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},ok.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e},ok.subtract=oV,ok.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e},ok.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e},ok.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},ok.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],x=i[7],v=i[8];return Math.abs(r-d)<=oB.EPSILON*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(a-p)<=oB.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(n-f)<=oB.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-m)<=oB.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-_)<=oB.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-g)<=oB.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(h-y)<=oB.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(u-x)<=oB.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-v)<=oB.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))},ok.sub=ok.mul=void 0;var oB=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==oO(e)&&"function"!=typeof e)return{default:e};var r=oF(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function oF(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(oF=function(e){return e?r:i})(e)}function oN(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*a+f*s+m*u,e[1]=p*n+f*l+m*c,e[2]=p*o+f*h+m*d,e[3]=_*a+g*s+y*u,e[4]=_*n+g*l+y*c,e[5]=_*o+g*h+y*d,e[6]=x*a+v*s+b*u,e[7]=x*n+v*l+b*c,e[8]=x*o+v*h+b*d,e}function oV(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e}ok.mul=oN,ok.sub=oV;var oU={};function oj(e){return(oj="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(oU,"__esModule",{value:!0}),oU.create=function(){var e=new oG.ARRAY_TYPE(16);return oG.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},oU.clone=function(e){var i=new oG.ARRAY_TYPE(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},oU.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},oU.fromValues=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){var g=new oG.ARRAY_TYPE(16);return g[0]=e,g[1]=i,g[2]=r,g[3]=a,g[4]=n,g[5]=o,g[6]=s,g[7]=l,g[8]=h,g[9]=u,g[10]=c,g[11]=d,g[12]=p,g[13]=f,g[14]=m,g[15]=_,g},oU.set=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e[9]=c,e[10
7]=d,e[11]=p,e[12]=f,e[13]=m,e[14]=_,e[15]=g,e},oU.identity=oq,oU.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[3],o=i[6],s=i[7],l=i[11];e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=r,e[6]=i[9],e[7]=i[13],e[8]=a,e[9]=o,e[11]=i[14],e[12]=n,e[13]=s,e[14]=l}else e[0]=i[0],e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=i[1],e[5]=i[5],e[6]=i[9],e[7]=i[13],e[8]=i[2],e[9]=i[6],e[10]=i[10],e[11]=i[14],e[12]=i[3],e[13]=i[7],e[14]=i[11],e[15]=i[15];return e},oU.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,M=n*u-o*h,E=c*_-d*m,S=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*S+M*E;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(n*C-a*P-o*I)*z,e[2]=(_*M-g*T+y*w)*z,e[3]=(p*T-d*M-f*w)*z,e[4]=(h*A-s*P-u*S)*z,e[5]=(r*P-n*A+o*S)*z,e[6]=(g*b-m*M-y*v)*z,e[7]=(c*M-p*b+f*v)*z,e[8]=(s*C-l*A+u*E)*z,e[9]=(a*A-r*C-o*E)*z,e[10]=(m*T-_*b+y*x)*z,e[11]=(d*b-c*T-f*x)*z,e[12]=(l*S-s*I-h*E)*z,e[13]=(r*I-a*S+n*E)*z,e[14]=(_*v-m*w-g*x)*z,e[15]=(c*w-d*v+p*x)*z,e):null},oU.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15];return e[0]=l*(p*y-f*g)-d*(h*y-u*g)+_*(h*f-u*p),e[1]=-(a*(p*y-f*g)-d*(n*y-o*g)+_*(n*f-o*p)),e[2]=a*(h*y-u*g)-l*(n*y-o*g)+_*(n*u-o*h),e[3]=-(a*(h*f-u*p)-l*(n*f-o*p)+d*(n*u-o*h)),e[4]=-(s*(p*y-f*g)-c*(h*y-u*g)+m*(h*f-u*p)),e[5]=r*(p*y-f*g)-c*(n*y-o*g)+m*(n*f-o*p),e[6]=-(r*(h*y-u*g)-s*(n*y-o*g)+m*(n*u-o*h)),e[7]=r*(h*f-u*p)-s*(n*f-o*p)+c*(n*u-o*h),e[8]=s*(d*y-f*_)-c*(l*y-u*_)+m*(l*f-u*d),e[9]=-(r*(d*y-f*_)-c*(a*y-o*_)+m*(a*f-o*d)),e[10]=r*(l*y-u*_)-s*(a*y-o*_)+m*(a*u-o*l),e[11]=-(r*(l*f-u*d)-s*(a*f-o*d)+c*(a*u-o*l)),e[12]=-(s*(d*g-p*_)-c*(l*g-h*_)+m*(l*p-h*d)),e[13]=r*(d*g-p*_)-c*(a*g-n*_)+m*(a*p-n*d),e[14]=-(r*(l*g-h*_)-s*(a*g-n*_)+m*(a*h-n*l)),e[15]=r*(l*p-h*d)-s*(a*p-n*d)+c*(a*h-n*l),e},oU.determinant=function(e){var i=e[0],r=e[1],a=e[2],n=e[3],o=e[4],s=e[5],l=e[6],h=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],_=e[14],g=e[15];return(i*s-r*o)*(d*g-p*_)-(i*l-a*o)*(c*g-p*m)+(i*h-n*o)*(c*_-d*m)+(r*l-a*s)*(u*g-p*f)-(r*h-n*s)*(u*_-d*f)+(a*h-n*l)*(u*m-c*f)},oU.multiply=o$,oU.translate=function(e,i,r){var a,n,o,s,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===e?(e[12]=i[0]*_+i[4]*g+i[8]*y+i[12],e[13]=i[1]*_+i[5]*g+i[9]*y+i[13],e[14]=i[2]*_+i[6]*g+i[10]*y+i[14],e[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],e[0]=a=i[0],e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=m,e[12]=a*_+l*g+d*y+i[12],e[13]=n*_+h*g+p*y+i[13],e[14]=o*_+u*g+f*y+i[14],e[15]=s*_+c*g+m*y+i[15]),e},oU.scale=function(e,i,r){var a=r[0],n=r[1],o=r[2];return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=i[3]*a,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=i[7]*n,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=i[11]*o,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},oU.rotate=function(e,i,r,a){var n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,M,E,S,A,I,C=a[0],P=a[1],z=a[2],D=Math.hypot(C,P,z);return D<oG.EPSILON?null:(C*=D=1/D,P*=D,z*=D,n=Math.sin(r),o=Math.cos(r),h=i[1],u=i[2],c=i[3],p=i[5],f=i[6],m=i[7],g=i[9],y=i[10],x=i[11],v=C*C*(s=1-o)+o,T=C*P*s-z*n,M=P*P*s+o,E=z*P*s+C*n,S=C*z*s+P*n,A=P*z*s-C*n,I=z*z*s+o,e[0]=(l=i[0])*v+(d=i[4])*(b=P*C*s+z*n)+(_=i[8])*(w=z*C*s-P*n),e[1]=h*v+p*b+g*w,e[2]=u*v+f*b+y*w,e[3]=c*v+m*b+x*w,e[4]=l*T+d*M+_*E,e[5]=h*T+p*M+g*E,e[6]=u*T+f*M+y*E,e[7]=c*T+m*M+x*E,e[8]=l*S+d*A+_*I,e[9]=h*S+p*A+g*I,e[10]=u*S+f*A+y*I,e[11]=c*S+m*A+x*I,i!==e&&(e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e)},oU.rotateX=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[4],s=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=o*n+u*a,e[5]=s*n+c*a,e[6]=l*n+d*a,e[7]=h*n+p*a,e[8]=u*n-o*a,e[9]=c*n-s*a,e[10]=d*n-l*a,e[11]=p*n-h*a,e},oU.rotateY=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n-u*a,e[1]=s*n-c*a,e[2]=l*n-d*a,e[3]=h*n-p*a,e[8]=o*a+u*n,e[9]=s*a+c*n,e[10
7]=l*a+d*n,e[11]=h*a+p*n,e},oU.rotateZ=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n+u*a,e[1]=s*n+c*a,e[2]=l*n+d*a,e[3]=h*n+p*a,e[4]=u*n-o*a,e[5]=c*n-s*a,e[6]=d*n-l*a,e[7]=p*n-h*a,e},oU.fromTranslation=function(e,i){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]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},oU.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},oU.fromRotation=function(e,i,r){var a,n,o,s=r[0],l=r[1],h=r[2],u=Math.hypot(s,l,h);return u<oG.EPSILON?null:(s*=u=1/u,l*=u,h*=u,a=Math.sin(i),n=Math.cos(i),e[0]=s*s*(o=1-n)+n,e[1]=l*s*o+h*a,e[2]=h*s*o-l*a,e[3]=0,e[4]=s*l*o-h*a,e[5]=l*l*o+n,e[6]=h*l*o+s*a,e[7]=0,e[8]=s*h*o+l*a,e[9]=l*h*o-s*a,e[10]=h*h*o+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},oU.fromXRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},oU.fromYRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},oU.fromZRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=a,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},oU.fromRotationTranslation=oW,oU.fromQuat2=function(e,i){var r=new oG.ARRAY_TYPE(3),a=-i[0],n=-i[1],o=-i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=a*a+n*n+o*o+s*s;return d>0?(r[0]=2*(l*s+c*a+h*o-u*n)/d,r[1]=2*(h*s+c*n+u*a-l*o)/d,r[2]=2*(u*s+c*o+l*n-h*a)/d):(r[0]=2*(l*s+c*a+h*o-u*n),r[1]=2*(h*s+c*n+u*a-l*o),r[2]=2*(u*s+c*o+l*n-h*a)),oW(e,i,r),e},oU.getTranslation=function(e,i){return e[0]=i[12],e[1]=i[13],e[2]=i[14],e},oU.getScaling=oH,oU.getRotation=function(e,i){var r=new oG.ARRAY_TYPE(3);oH(r,i);var a=1/r[0],n=1/r[1],o=1/r[2],s=i[0]*a,l=i[1]*n,h=i[2]*o,u=i[4]*a,c=i[5]*n,d=i[6]*o,p=i[8]*a,f=i[9]*n,m=i[10]*o,_=s+c+m,g=0;return _>0?(g=2*Math.sqrt(_+1),e[3]=.25*g,e[0]=(d-f)/g,e[1]=(p-h)/g,e[2]=(l-u)/g):s>c&&s>m?(g=2*Math.sqrt(1+s-c-m),e[3]=(d-f)/g,e[0]=.25*g,e[1]=(l+u)/g,e[2]=(p+h)/g):c>m?(g=2*Math.sqrt(1+c-s-m),e[3]=(p-h)/g,e[0]=(l+u)/g,e[1]=.25*g,e[2]=(d+f)/g):(g=2*Math.sqrt(1+m-s-c),e[3]=(l-u)/g,e[0]=(p+h)/g,e[1]=(d+f)/g,e[2]=.25*g),e},oU.fromRotationTranslationScale=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3],h=n+n,u=o+o,c=s+s,d=n*h,p=n*u,f=n*c,m=o*u,_=o*c,g=s*c,y=l*h,x=l*u,v=l*c,b=a[0],w=a[1],T=a[2];return e[0]=(1-(m+g))*b,e[1]=(p+v)*b,e[2]=(f-x)*b,e[3]=0,e[4]=(p-v)*w,e[5]=(1-(d+g))*w,e[6]=(_+y)*w,e[7]=0,e[8]=(f+x)*T,e[9]=(_-y)*T,e[10]=(1-(d+m))*T,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},oU.fromRotationTranslationScaleOrigin=function(e,i,r,a,n){var o=i[0],s=i[1],l=i[2],h=i[3],u=o+o,c=s+s,d=l+l,p=o*u,f=o*c,m=o*d,_=s*c,g=s*d,y=l*d,x=h*u,v=h*c,b=h*d,w=a[0],T=a[1],M=a[2],E=n[0],S=n[1],A=n[2],I=(1-(_+y))*w,C=(f+b)*w,P=(m-v)*w,z=(f-b)*T,D=(1-(p+y))*T,L=(g+x)*T,R=(m+v)*M,k=(g-x)*M,O=(1-(p+_))*M;return e[0]=I,e[1]=C,e[2]=P,e[3]=0,e[4]=z,e[5]=D,e[6]=L,e[7]=0,e[8]=R,e[9]=k,e[10]=O,e[11]=0,e[12]=r[0]+E-(I*E+z*S+R*A),e[13]=r[1]+S-(C*E+D*S+k*A),e[14]=r[2]+A-(P*E+L*S+O*A),e[15]=1,e},oU.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[1]=c+y,e[2]=p-g,e[3]=0,e[4]=c-y,e[5]=1-u-m,e[6]=f+_,e[7]=0,e[8]=p+g,e[9]=f-_,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},oU.frustum=function(e,i,r,a,n,o,s){var l=1/(r-i),h=1/(n-a),u=1/(o-s);return e[0]=2*o*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*h,e[6]=0,e[7]=0,e[8]=(r+i)*l,e[9]=(n+a)*h,e[10]=(s+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*u,e[15]=0,e},oU.perspectiveNO=oX,oU.perspectiveZO=function(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(a-n)),e[14]=n*a*o):(e[10]=-1,e[14]=-a),e},oU.perspectiveFromFieldOfView=function(e,i,r,a){var n=Math.tan(i.upDegrees*Math.PI/180),o=Math.tan(i.downDegrees*Math.PI/180),s=Math.tan(i.leftDegrees*Math.PI/180),l=Math.tan(i.rightDegrees*Math.PI/180),h=2/(s+l),u=2/(n+o);return e[0]=h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(s-l)*h*.5,e[9]=(n-o)*u*.5,e[10]=a/(r-a),e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r/(r-a),e[15]=0,e},oU.orthoNO=oY,oU.orthoZO=function(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);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
7]=u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=o*u,e[15]=1,e},oU.lookAt=function(e,i,r,a){var n,o,s,l,h,u,c,d,p,f,m=i[0],_=i[1],g=i[2],y=a[0],x=a[1],v=a[2],b=r[0],w=r[1],T=r[2];return Math.abs(m-b)<oG.EPSILON&&Math.abs(_-w)<oG.EPSILON&&Math.abs(g-T)<oG.EPSILON?oq(e):(c=m-b,d=_-w,p=g-T,(f=Math.hypot(n=x*(p*=f=1/Math.hypot(c,d,p))-v*(d*=f),o=v*(c*=f)-y*p,s=y*d-x*c))?(n*=f=1/f,o*=f,s*=f):(n=0,o=0,s=0),(f=Math.hypot(l=d*s-p*o,h=p*n-c*s,u=c*o-d*n))?(l*=f=1/f,h*=f,u*=f):(l=0,h=0,u=0),e[0]=n,e[1]=l,e[2]=c,e[3]=0,e[4]=o,e[5]=h,e[6]=d,e[7]=0,e[8]=s,e[9]=u,e[10]=p,e[11]=0,e[12]=-(n*m+o*_+s*g),e[13]=-(l*m+h*_+u*g),e[14]=-(c*m+d*_+p*g),e[15]=1,e)},oU.targetTo=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=a[0],h=a[1],u=a[2],c=n-r[0],d=o-r[1],p=s-r[2],f=c*c+d*d+p*p;f>0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var m=h*p-u*d,_=u*c-l*p,g=l*d-h*c;return(f=m*m+_*_+g*g)>0&&(m*=f=1/Math.sqrt(f),_*=f,g*=f),e[0]=m,e[1]=_,e[2]=g,e[3]=0,e[4]=d*g-p*_,e[5]=p*m-c*g,e[6]=c*_-d*m,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},oU.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]+")"},oU.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])},oU.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e[9]=i[9]+r[9],e[10]=i[10]+r[10],e[11]=i[11]+r[11],e[12]=i[12]+r[12],e[13]=i[13]+r[13],e[14]=i[14]+r[14],e[15]=i[15]+r[15],e},oU.subtract=oK,oU.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11]*r,e[12]=i[12]*r,e[13]=i[13]*r,e[14]=i[14]*r,e[15]=i[15]*r,e},oU.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e[9]=i[9]+r[9]*a,e[10]=i[10]+r[10]*a,e[11]=i[11]+r[11]*a,e[12]=i[12]+r[12]*a,e[13]=i[13]+r[13]*a,e[14]=i[14]+r[14]*a,e[15]=i[15]+r[15]*a,e},oU.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},oU.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=e[9],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3],T=i[4],M=i[5],E=i[6],S=i[7],A=i[8],I=i[9],C=i[10],P=i[11],z=i[12],D=i[13],L=i[14],R=i[15];return Math.abs(r-x)<=oG.EPSILON*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=oG.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=oG.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=oG.EPSILON*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-T)<=oG.EPSILON*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-M)<=oG.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(h-E)<=oG.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(u-S)<=oG.EPSILON*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-A)<=oG.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-I)<=oG.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-C)<=oG.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-P)<=oG.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-z)<=oG.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(_-D)<=oG.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(g-L)<=oG.EPSILON*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(y-R)<=oG.EPSILON*Math.max(1,Math.abs(y),Math.abs(R))},oU.sub=oU.mul=oU.ortho=oU.perspective=void 0;var oG=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==oj(e)&&"function"!=typeof e)return{default:e};var r=oZ(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function oZ(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(oZ=function(e){return e?r:i})(e)}function oq(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
7]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function o$(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return e[0]=v*a+b*l+w*d+T*_,e[1]=v*n+b*h+w*p+T*g,e[2]=v*o+b*u+w*f+T*y,e[3]=v*s+b*c+w*m+T*x,e[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,e[5]=v*n+b*h+w*p+T*g,e[6]=v*o+b*u+w*f+T*y,e[7]=v*s+b*c+w*m+T*x,e[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,e[9]=v*n+b*h+w*p+T*g,e[10]=v*o+b*u+w*f+T*y,e[11]=v*s+b*c+w*m+T*x,e[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,e[13]=v*n+b*h+w*p+T*g,e[14]=v*o+b*u+w*f+T*y,e[15]=v*s+b*c+w*m+T*x,e}function oW(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=a+a,h=n+n,u=o+o,c=a*l,d=a*h,p=a*u,f=n*h,m=n*u,_=o*u,g=s*l,y=s*h,x=s*u;return e[0]=1-(f+_),e[1]=d+x,e[2]=p-y,e[3]=0,e[4]=d-x,e[5]=1-(c+_),e[6]=m+g,e[7]=0,e[8]=p+y,e[9]=m-g,e[10]=1-(c+f),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function oH(e,i){var r=i[4],a=i[5],n=i[6],o=i[8],s=i[9],l=i[10];return e[0]=Math.hypot(i[0],i[1],i[2]),e[1]=Math.hypot(r,a,n),e[2]=Math.hypot(o,s,l),e}function oX(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+a)*(o=1/(a-n)),e[14]=2*n*a*o):(e[10]=-1,e[14]=-2*a),e}function oY(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);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*u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=(s+o)*u,e[15]=1,e}function oK(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e[9]=i[9]-r[9],e[10]=i[10]-r[10],e[11]=i[11]-r[11],e[12]=i[12]-r[12],e[13]=i[13]-r[13],e[14]=i[14]-r[14],e[15]=i[15]-r[15],e}oU.perspective=oX,oU.ortho=oY,oU.mul=o$,oU.sub=oK;var oJ={},oQ={};function o0(e){return(o0="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(oQ,"__esModule",{value:!0}),oQ.create=o3,oQ.clone=function(e){var i=new o1.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i},oQ.length=o5,oQ.fromValues=function(e,i,r){var a=new o1.ARRAY_TYPE(3);return a[0]=e,a[1]=i,a[2]=r,a},oQ.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e}
7,oQ.set=function(e,i,r,a){return e[0]=i,e[1]=r,e[2]=a,e},oQ.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e},oQ.subtract=o4,oQ.multiply=o6,oQ.divide=o8,oQ.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e},oQ.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e},oQ.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e},oQ.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e},oQ.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e},oQ.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e},oQ.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e},oQ.distance=o9,oQ.squaredDistance=o7,oQ.squaredLength=se,oQ.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e},oQ.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e},oQ.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=r*r+a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=i[0]*o,e[1]=i[1]*o,e[2]=i[2]*o,e},oQ.dot=st,oQ.cross=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2];return e[0]=n*h-o*l,e[1]=o*s-a*h,e[2]=a*l-n*s,e},oQ.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e},oQ.hermite=function(e,i,r,a,n,o){var s=o*o,l=s*(2*o-3)+1,h=s*(o-2)+o,u=s*(o-1),c=s*(3-2*o);return e[0]=i[0]*l+r[0]*h+a[0]*u+n[0]*c,e[1]=i[1]*l+r[1]*h+a[1]*u+n[1]*c,e[2]=i[2]*l+r[2]*h+a[2]*u+n[2]*c,e},oQ.bezier=function(e,i,r,a,n,o){var s=1-o,l=s*s,h=o*o,u=l*s,c=3*o*l,d=3*h*s,p=h*o;return e[0]=i[0]*u+r[0]*c+a[0]*d+n[0]*p,e[1]=i[1]*u+r[1]*c+a[1]*d+n[1]*p,e[2]=i[2]*u+r[2]*c+a[2]*d+n[2]*p,e},oQ.random=function(e,i){i=i||1;var r=2*o1.RANDOM()*Math.PI,a=2*o1.RANDOM()-1,n=Math.sqrt(1-a*a)*i;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=a*i,e},oQ.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[3]*a+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*a+r[4]*n+r[8]*o+r[12])/(s=s||1),e[1]=(r[1]*a+r[5]*n+r[9]*o+r[13])/s,e[2]=(r[2]*a+r[6]*n+r[10]*o+r[14])/s,e},oQ.transformMat3=function(e,i,r){var a=i[0],n=i[1],o=i[2];return e[0]=a*r[0]+n*r[3]+o*r[6],e[1]=a*r[1]+n*r[4]+o*r[7],e[2]=a*r[2]+n*r[5]+o*r[8],e},oQ.transformQuat=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=i[0],l=i[1],h=i[2],u=n*h-o*l,c=o*s-a*h,d=a*l-n*s,p=n*d-o*c,f=o*u-a*d,m=a*c-n*u,_=2*r[3];return c*=_,d*=_,f*=2,m*=2,e[0]=s+(u*=_)+(p*=2),e[1]=l+c+f,e[2]=h+d+m,e},oQ.rotateX=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),o[2]=n[1]*Math.sin(a)+n[2]*Math.cos(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},oQ.rotateY=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),o[1]=n[1],o[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},oQ.rotateZ=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),o[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),o[2]=n[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},oQ.angle=function(e,i){var r=e[0],a=e[1],n=e[2],o=i[0],s=i[1],l=i[2],h=Math.sqrt(r*r+a*a+n*n)*Math.sqrt(o*o+s*s+l*l);return Math.acos(Math.min(Math.max(h&&st(e,i)/h,-1),1))},oQ.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},oQ.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},oQ.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]},oQ.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=i[0],s=i[1],l=i[2];return Math.abs(r-o)<=o1.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(a-s)<=o1.EPSILON*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(n-l)<=o1.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},oQ.forEach=oQ.sqrLen=oQ.len=oQ.sqrDist=oQ.dist=oQ.div=oQ.mul=oQ.sub=void 0;var o1=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==o0(e)&&"function"!=typeof e)return{default:e};var r=o2(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function o2(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(o2=function(e){return e?r:i})(e)}function o3(){var e=new o1.ARRAY_TYPE(3);return o1.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function o5(e){return Math.hypot(e[0],e[1],e[2])}function o4(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e}function o6(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e}function o8(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e}function o9(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2])}function o7(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2];return r*r+a*a+n*n}function se(e){var i=e[0],r=e[1],a=e[2];return i*i+r*r+a*a}function st(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}oQ.sub=o4,oQ.mul=o6,oQ.div=o8,oQ.dist=o9,oQ.sqrDist=o7,oQ.len=o5,oQ.sqrLen=se;var si,sr=(si=o3(),function(e,i,r,a,n,o){var s,l;for(i||(i=3),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)si[0]=e[s],si[1]=e[s+1],si[2]=e[s+2],n(si,si,o),e[s]=si[0],e[s+1]=si[1],e[s+2]=si[2];return e});
7oQ.forEach=sr;var sa={};function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(sa,"__esModule",{value:!0}),sa.create=sl,sa.clone=function(e){var i=new so.ARRAY_TYPE(4);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i},sa.fromValues=function(e,i,r,a){var n=new so.ARRAY_TYPE(4);return n[0]=e,n[1]=i,n[2]=r,n[3]=a,n},sa.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},sa.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},sa.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},sa.subtract=sh,sa.multiply=su,sa.divide=sc,sa.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e[3]=Math.ceil(i[3]),e},sa.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e[3]=Math.floor(i[3]),e},sa.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e[3]=Math.min(i[3],r[3]),e},sa.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e[3]=Math.max(i[3],r[3]),e},sa.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e[3]=Math.round(i[3]),e},sa.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},sa.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},sa.distance=sd,sa.squaredDistance=sp,sa.length=sf,sa.squaredLength=sm,sa.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=-i[3],e},sa.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e[3]=1/i[3],e},sa.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=a*s,e[2]=n*s,e[3]=o*s,e},sa.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]},sa.cross=function(e,i,r,a){var n=r[0]*a[1]-r[1]*a[0],o=r[0]*a[2]-r[2]*a[0],s=r[0]*a[3]-r[3]*a[0],l=r[1]*a[2]-r[2]*a[1],h=r[1]*a[3]-r[3]*a[1],u=r[2]*a[3]-r[3]*a[2],c=i[0],d=i[1],p=i[2],f=i[3];return e[0]=d*u-p*h+f*l,e[1]=-c*u+p*s-f*o,e[2]=c*h-d*s+f*n,e[3]=-c*l+d*o-p*n,e},sa.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e[3]=l+a*(r[3]-l),e},sa.random=function(e,i){i=i||1;do s=(r=2*so.RANDOM()-1)*r+(a=2*so.RANDOM()-1)*a;while(s>=1);do l=(n=2*so.RANDOM()-1)*n+(o=2*so.RANDOM()-1)*o;while(l>=1);var r,a,n,o,s,l,h=Math.sqrt((1-s)/l);return e[0]=i*r,e[1]=i*a,e[2]=i*n*h,e[3]=i*o*h,e},sa.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3];return e[0]=r[0]*a+r[4]*n+r[8]*o+r[12]*s,e[1]=r[1]*a+r[5]*n+r[9]*o+r[13]*s,e[2]=r[2]*a+r[6]*n+r[10]*o+r[14]*s,e[3]=r[3]*a+r[7]*n+r[11]*o+r[15]*s,e},sa.transformQuat=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2],u=r[3],c=u*a+l*o-h*n,d=u*n+h*a-s*o,p=u*o+s*n-l*a,f=-s*a-l*n-h*o;return e[0]=c*u+-(f*s)+-(d*h)- -(p*l),e[1]=d*u+-(f*l)+-(p*s)- -(c*h),e[2]=p*u+-(f*h)+-(c*l)- -(d*s),e[3]=i[3],e},sa.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},sa.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},sa.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},sa.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=i[0],l=i[1],h=i[2],u=i[3];return Math.abs(r-s)<=so.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(a-l)<=so.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=so.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=so.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},sa.forEach=sa.sqrLen=sa.len=sa.sqrDist=sa.dist=sa.div=sa.mul=sa.sub=void 0;var so=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==sn(e)&&"function"!=typeof e)return{default:e};var r=ss(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function ss(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(ss=function(e){return e?r:i})(e)}function sl(){var e=new so.ARRAY_TYPE(4);return so.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function sh(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}function su(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e[3]=i[3]*r[3],e}function sc(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e[3]=i[3]/r[3],e}function sd(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2],i[3]-e[3])}function sp(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2],o=i[3]-e[3];return r*r+a*a+n*n+o*o}function sf(e){return Math.hypot(e[0],e[1],e[2],e[3])}function sm(e){var i=e[0],r=e[1],a=e[2],n=e[3];return i*i+r*r+a*a+n*n}sa.sub=sh,sa.mul=su,sa.div=sc,sa.dist=sd,sa.sqrDist=sp,sa.len=sf,sa.sqrLen=sm;var s_=(sO=sl(),function(e,i,r,a,n,o){var s,l;for(i||(i=4),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)sO[0]=e[s],sO[1]=e[s+1],sO[2]=e[s+2],sO[3]=e[s+3],n(sO,sO,o),e[s]=sO[0],e[s+1]=sO[1],e[s+2]=sO[2],e[s+3]=sO[3];return e});function sg(e){return(sg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
7sa.forEach=s_,Object.defineProperty(oJ,"__esModule",{value:!0}),oJ.create=sM,oJ.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},oJ.setAxisAngle=sE,oJ.getAxisAngle=function(e,i){var r=2*Math.acos(i[3]),a=Math.sin(r/2);return a>sy.EPSILON?(e[0]=i[0]/a,e[1]=i[1]/a,e[2]=i[2]/a):(e[0]=1,e[1]=0,e[2]=0),r},oJ.getAngle=function(e,i){var r=sD(e,i);return Math.acos(2*r*r-1)},oJ.multiply=sS,oJ.rotateX=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*l,e[1]=n*h+o*l,e[2]=o*h-n*l,e[3]=s*h-a*l,e},oJ.rotateY=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h-o*l,e[1]=n*h+s*l,e[2]=o*h+a*l,e[3]=s*h-n*l,e},oJ.rotateZ=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+n*l,e[1]=n*h-a*l,e[2]=o*h+s*l,e[3]=s*h-o*l,e},oJ.calculateW=function(e,i){var r=i[0],a=i[1],n=i[2];return e[0]=r,e[1]=a,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-a*a-n*n)),e},oJ.exp=sA,oJ.ln=sI,oJ.pow=function(e,i,r){return sI(e,i),sz(e,e,r),sA(e,e),e},oJ.slerp=sC,oJ.random=function(e){var i=sy.RANDOM(),r=sy.RANDOM(),a=sy.RANDOM(),n=Math.sqrt(1-i),o=Math.sqrt(i);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*a),e[3]=o*Math.cos(2*Math.PI*a),e},oJ.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o,l=s?1/s:0;return e[0]=-r*l,e[1]=-a*l,e[2]=-n*l,e[3]=o*l,e},oJ.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e},oJ.fromMat3=sP,oJ.fromEuler=function(e,i,r,a){var n=.5*Math.PI/180;i*=n,r*=n,a*=n;var o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),h=Math.cos(r),u=Math.sin(a),c=Math.cos(a);return e[0]=o*h*c-s*l*u,e[1]=s*l*c+o*h*u,e[2]=s*h*u-o*l*c,e[3]=s*h*c+o*l*u,e},oJ.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},oJ.setAxes=oJ.sqlerp=oJ.rotationTo=oJ.equals=oJ.exactEquals=oJ.normalize=oJ.sqrLen=oJ.squaredLength=oJ.len=oJ.length=oJ.lerp=oJ.dot=oJ.scale=oJ.mul=oJ.add=oJ.set=oJ.copy=oJ.fromValues=oJ.clone=void 0;var sy=sT(ox),sx=sT(ok),sv=sT(oQ),sb=sT(sa);function sw(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(sw=function(e){return e?r:i})(e)}function sT(e,i){if(!i&&e&&e.__esModule)return e;if(null===e||"object"!==sg(e)&&"function"!=typeof e)return{default:e};var r=sw(i);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}function sM(){var e=new sy.ARRAY_TYPE(4);return sy.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function sE(e,i,r){var a=Math.sin(r*=.5);return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=Math.cos(r),e}function sS(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e}function sA(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=Math.exp(o),h=s>0?l*Math.sin(s)/s:0;return e[0]=r*h,e[1]=a*h,e[2]=n*h,e[3]=l*Math.cos(s),e}function sI(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=s>0?Math.atan2(s,o)/s:0;return e[0]=r*l,e[1]=a*l,e[2]=n*l,e[3]=.5*Math.log(r*r+a*a+n*n+o*o),e}function sC(e,i,r,a){var n,o,s,l,h,u=i[0],c=i[1],d=i[2],p=i[3],f=r[0],m=r[1],_=r[2],g=r[3];return(o=u*f+c*m+d*_+p*g)<0&&(o=-o,f=-f,m=-m,_=-_,g=-g),1-o>sy.EPSILON?(s=Math.sin(n=Math.acos(o)),l=Math.sin((1-a)*n)/s,h=Math.sin(a*n)/s):(l=1-a,h=a),e[0]=l*u+h*f,e[1]=l*c+h*m,e[2]=l*d+h*_,e[3]=l*p+h*g,e}function sP(e,i){var r,a=i[0]+i[4]+i[8];if(a>0)r=Math.sqrt(a+1),e[3]=.5*r,e[0]=(i[5]-i[7])*(r=.5/r),e[1]=(i[6]-i[2])*r,e[2]=(i[1]-i[3])*r;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;r=Math.sqrt(i[3*n+n]-i[3*o+o]-i[3*s+s]+1),e[n]=.5*r,e[3]=(i[3*o+s]-i[3*s+o])*(r=.5/r),e[o]=(i[3*o+n]+i[3*n+o])*r,e[s]=(i[3*s+n]+i[3*n+s])*r}return e}oJ.clone=sb.clone,oJ.fromValues=sb.fromValues,oJ.copy=sb.copy,oJ.set=sb.set,oJ.add=sb.add,oJ.mul=sS;var sz=sb.scale;oJ.scale=sz;var sD=sb.dot;oJ.dot=sD,oJ.lerp=sb.lerp;var sL=sb.length;oJ.length=sL,oJ.len=sL;var sR=sb.squaredLength;oJ.squaredLength=sR,oJ.sqrLen=sR;var sk=sb.normalize;
7oJ.normalize=sk,oJ.exactEquals=sb.exactEquals,oJ.equals=sb.equals;var sO,sB,sF,sN,sV=(sB=sv.create(),sF=sv.fromValues(1,0,0),sN=sv.fromValues(0,1,0),function(e,i,r){var a=sv.dot(i,r);return a<-.999999?(sv.cross(sB,sF,i),1e-6>sv.len(sB)&&sv.cross(sB,sN,i),sv.normalize(sB,sB),sE(e,sB,Math.PI),e):a>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(sv.cross(sB,i,r),e[0]=sB[0],e[1]=sB[1],e[2]=sB[2],e[3]=1+a,sk(e,e))});oJ.rotationTo=sV;var sU,sj,sG=(sU=sM(),sj=sM(),function(e,i,r,a,n,o){return sC(sU,i,n,o),sC(sj,r,a,o),sC(e,sU,sj,2*o*(1-o)),e});oJ.sqlerp=sG;var sZ,sq=(sZ=sx.create(),function(e,i,r,a){return sZ[0]=r[0],sZ[3]=r[1],sZ[6]=r[2],sZ[1]=a[0],sZ[4]=a[1],sZ[7]=a[2],sZ[2]=-i[0],sZ[5]=-i[1],sZ[8]=-i[2],sk(e,sP(e,sZ))});oJ.setAxes=sq;var s$={};function sW(e){return(sW="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(s$,"__esModule",{value:!0}),s$.create=function(){var e=new sH.ARRAY_TYPE(8);return sH.ARRAY_TYPE!=Float32Array&&(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},s$.clone=function(e){var i=new sH.ARRAY_TYPE(8);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i},s$.fromValues=function(e,i,r,a,n,o,s,l){var h=new sH.ARRAY_TYPE(8);return h[0]=e,h[1]=i,h[2]=r,h[3]=a,h[4]=n,h[5]=o,h[6]=s,h[7]=l,h},s$.fromRotationTranslationValues=function(e,i,r,a,n,o,s){var l=new sH.ARRAY_TYPE(8);l[0]=e,l[1]=i,l[2]=r,l[3]=a;var h=.5*n,u=.5*o,c=.5*s;return l[4]=h*a+u*r-c*i,l[5]=u*a+c*e-h*r,l[6]=c*a+h*i-u*e,l[7]=-h*e-u*i-c*r,l},s$.fromRotationTranslation=sQ,s$.fromTranslation=function(e,i){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*i[0],e[5]=.5*i[1],e[6]=.5*i[2],e[7]=0,e},s$.fromRotation=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},s$.fromMat4=function(e,i){var r=sX.create();sY.getRotation(r,i);var a=new sH.ARRAY_TYPE(3);return sY.getTranslation(a,i),sQ(e,r,a),e},s$.copy=s0,s$.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},s$.set=function(e,i,r,a,n,o,s,l,h){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e},s$.getDual=function(e,i){return e[0]=i[4],e[1]=i[5],e[2]=i[6],e[3]=i[7],e},s$.setDual=function(e,i){return e[4]=i[0],e[5]=i[1],e[6]=i[2],e[7]=i[3],e},s$.getTranslation=function(e,i){var r=i[4],a=i[5],n=i[6],o=i[7],s=-i[0],l=-i[1],h=-i[2],u=i[3];return e[0]=2*(r*u+o*s+a*h-n*l),e[1]=2*(a*u+o*l+n*s-r*h),e[2]=2*(n*u+o*h+r*l-a*s),e},s$.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=.5*r[0],h=.5*r[1],u=.5*r[2],c=i[4],d=i[5],p=i[6],f=i[7];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=s*l+n*u-o*h+c,e[5]=s*h+o*l-a*u+d,e[6]=s*u+a*h-n*l+p,e[7]=-a*l-n*h-o*u+f,e},s$.rotateX=function(e,i,r){var a=-i[0],n=-i[1],o=-i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=l*s+c*a+h*o-u*n,p=h*s+c*n+u*a-l*o,f=u*s+c*o+l*n-h*a,m=c*s-l*a-h*n-u*o;return sX.rotateX(e,i,r),e[4]=d*(s=e[3])+m*(a=e[0])+p*(o=e[2])-f*(n=e[1]),e[5]=p*s+m*n+f*a-d*o,e[6]=f*s+m*o+d*n-p*a,e[7]=m*s-d*a-p*n-f*o,e},s$.rotateY=function(e,i,r){var a=-i[0],n=-i[1],o=-i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=l*s+c*a+h*o-u*n,p=h*s+c*n+u*a-l*o,f=u*s+c*o+l*n-h*a,m=c*s-l*a-h*n-u*o;return sX.rotateY(e,i,r),e[4]=d*(s=e[3])+m*(a=e[0])+p*(o=e[2])-f*(n=e[1]),e[5]=p*s+m*n+f*a-d*o,e[6]=f*s+m*o+d*n-p*a,e[7]=m*s-d*a-p*n-f*o,e},s$.rotateZ=function(e,i,r){var a=-i[0],n=-i[1],o=-i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=l*s+c*a+h*o-u*n,p=h*s+c*n+u*a-l*o,f=u*s+c*o+l*n-h*a,m=c*s-l*a-h*n-u*o;return sX.rotateZ(e,i,r),e[4]=d*(s=e[3])+m*(a=e[0])+p*(o=e[2])-f*(n=e[1]),e[5]=p*s+m*n+f*a-d*o,e[6]=f*s+m*o+d*n-p*a,e[7]=m*s-d*a-p*n-f*o,e},s$.rotateByQuatAppend=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=i[0],h=i[1],u=i[2],c=i[3];return e[0]=l*s+c*a+h*o-u*n,e[1]=h*s+c*n+u*a-l*o,e[2]=u*s+c*o+l*n-h*a,e[3]=c*s-l*a-h*n-u*o,e[4]=(l=i[4])*s+(c=i[7])*a+(h=i[5])*o-(u=i[6])*n,e[5]=h*s+c*n+u*a-l*o,e[6]=u*s+c*o+l*n-h*a,e[7]=c*s-l*a-h*n-u*o,e},s$.rotateByQuatPrepend=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e[4]=a*(c=r[7])+s*(l=r[4])+n*(u=r[6])-o*(h=r[5]),e[5]=n*c+s*h+o*l-a*u,e[6]=o*c+s*u+a*h-n*l,e[7]=s*c-a*l-n*h-o*u,e}
7,s$.rotateAroundAxis=function(e,i,r,a){if(Math.abs(a)<sH.EPSILON)return s0(e,i);var n=Math.hypot(r[0],r[1],r[2]),o=Math.sin(a*=.5),s=o*r[0]/n,l=o*r[1]/n,h=o*r[2]/n,u=Math.cos(a),c=i[0],d=i[1],p=i[2],f=i[3];e[0]=c*u+f*s+d*h-p*l,e[1]=d*u+f*l+p*s-c*h,e[2]=p*u+f*h+c*l-d*s,e[3]=f*u-c*s-d*l-p*h;var m=i[4],_=i[5],g=i[6],y=i[7];return e[4]=m*u+y*s+_*h-g*l,e[5]=_*u+y*l+g*s-m*h,e[6]=g*u+y*h+m*l-_*s,e[7]=y*u-m*s-_*l-g*h,e},s$.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e},s$.multiply=s1,s$.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e},s$.lerp=function(e,i,r,a){var n=1-a;return 0>s2(i,r)&&(a=-a),e[0]=i[0]*n+r[0]*a,e[1]=i[1]*n+r[1]*a,e[2]=i[2]*n+r[2]*a,e[3]=i[3]*n+r[3]*a,e[4]=i[4]*n+r[4]*a,e[5]=i[5]*n+r[5]*a,e[6]=i[6]*n+r[6]*a,e[7]=i[7]*n+r[7]*a,e},s$.invert=function(e,i){var r=s5(i);return e[0]=-i[0]/r,e[1]=-i[1]/r,e[2]=-i[2]/r,e[3]=i[3]/r,e[4]=-i[4]/r,e[5]=-i[5]/r,e[6]=-i[6]/r,e[7]=i[7]/r,e},s$.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e[4]=-i[4],e[5]=-i[5],e[6]=-i[6],e[7]=i[7],e},s$.normalize=function(e,i){var r=s5(i);if(r>0){r=Math.sqrt(r);var a=i[0]/r,n=i[1]/r,o=i[2]/r,s=i[3]/r,l=i[4],h=i[5],u=i[6],c=i[7],d=a*l+n*h+o*u+s*c;e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=(l-a*d)/r,e[5]=(h-n*d)/r,e[6]=(u-o*d)/r,e[7]=(c-s*d)/r}return e},s$.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},s$.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]},s$.equals=function(e,i){var r=e[0],a=e[1],n=e[2],o=e[3],s=e[4],l=e[5],h=e[6],u=e[7],c=i[0],d=i[1],p=i[2],f=i[3],m=i[4],_=i[5],g=i[6],y=i[7];return Math.abs(r-c)<=sH.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(a-d)<=sH.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(n-p)<=sH.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=sH.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-m)<=sH.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=sH.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(h-g)<=sH.EPSILON*Math.max(1,Math.abs(h),Math.abs(g))&&Math.abs(u-y)<=sH.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))},s$.sqrLen=s$.squaredLength=s$.len=s$.length=s$.dot=s$.mul=s$.setReal=s$.getReal=void 0;var sH=sJ(ox),sX=sJ(oJ),sY=sJ(oU);function sK(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(sK=function(e){return e?r:i})(e)}function sJ(e,i){if(!i&&e&&e.__esModule)return e;if(null===e||"object"!==sW(e)&&"function"!=typeof e)return{default:e};var r=sK(i);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}function sQ(e,i,r){var a=.5*r[0],n=.5*r[1],o=.5*r[2],s=i[0],l=i[1],h=i[2],u=i[3];return e[0]=s,e[1]=l,e[2]=h,e[3]=u,e[4]=a*u+n*h-o*l,e[5]=n*u+o*s-a*h,e[6]=o*u+a*l-n*s,e[7]=-a*s-n*l-o*h,e}function s0(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e}function s1(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[4],h=r[5],u=r[6],c=r[7],d=i[4],p=i[5],f=i[6],m=i[7],_=r[0],g=r[1],y=r[2],x=r[3];return e[0]=a*x+s*_+n*y-o*g,e[1]=n*x+s*g+o*_-a*y,e[2]=o*x+s*y+a*g-n*_,e[3]=s*x-a*_-n*g-o*y,e[4]=a*c+s*l+n*u-o*h+d*x+m*_+p*y-f*g,e[5]=n*c+s*h+o*l-a*u+p*x+m*g+f*_-d*y,e[6]=o*c+s*u+a*h-n*l+f*x+m*y+d*g-p*_,e[7]=s*c-a*l-n*h-o*u+m*x-d*_-p*g-f*y,e}s$.getReal=sX.copy,s$.setReal=sX.copy,s$.mul=s1;var s2=sX.dot;s$.dot=s2;var s3=sX.length;s$.length=s3,s$.len=s3;var s5=sX.squaredLength;s$.squaredLength=s5,s$.sqrLen=s5;var s4={};function s6(e){return(s6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
7Object.defineProperty(s4,"__esModule",{value:!0}),s4.create=s7,s4.clone=function(e){var i=new s8.ARRAY_TYPE(2);return i[0]=e[0],i[1]=e[1],i},s4.fromValues=function(e,i){var r=new s8.ARRAY_TYPE(2);return r[0]=e,r[1]=i,r},s4.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e},s4.set=function(e,i,r){return e[0]=i,e[1]=r,e},s4.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e},s4.subtract=le,s4.multiply=lt,s4.divide=li,s4.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e},s4.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e},s4.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e},s4.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e},s4.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e},s4.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e},s4.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e},s4.distance=lr,s4.squaredDistance=la,s4.length=ln,s4.squaredLength=lo,s4.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e},s4.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e},s4.normalize=function(e,i){var r=i[0],a=i[1],n=r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=i[0]*n,e[1]=i[1]*n,e},s4.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]},s4.cross=function(e,i,r){var a=i[0]*r[1]-i[1]*r[0];return e[0]=e[1]=0,e[2]=a,e},s4.lerp=function(e,i,r,a){var n=i[0],o=i[1];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e},s4.random=function(e,i){i=i||1;var r=2*s8.RANDOM()*Math.PI;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e},s4.transformMat2=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n,e[1]=r[1]*a+r[3]*n,e},s4.transformMat2d=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n+r[4],e[1]=r[1]*a+r[3]*n+r[5],e},s4.transformMat3=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[3]*n+r[6],e[1]=r[1]*a+r[4]*n+r[7],e},s4.transformMat4=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e},s4.rotate=function(e,i,r,a){var n=i[0]-r[0],o=i[1]-r[1],s=Math.sin(a),l=Math.cos(a);return e[0]=n*l-o*s+r[0],e[1]=n*s+o*l+r[1],e},s4.angle=function(e,i){var r=e[0],a=e[1],n=i[0],o=i[1],s=Math.sqrt(r*r+a*a)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(r*n+a*o)/s,-1),1))},s4.zero=function(e){return e[0]=0,e[1]=0,e},s4.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},s4.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]},s4.equals=function(e,i){var r=e[0],a=e[1],n=i[0],o=i[1];return Math.abs(r-n)<=s8.EPSILON*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(a-o)<=s8.EPSILON*Math.max(1,Math.abs(a),Math.abs(o))},s4.forEach=s4.sqrLen=s4.sqrDist=s4.dist=s4.div=s4.mul=s4.sub=s4.len=void 0;var s8=function(e,i){if(e&&e.__esModule)return e;if(null===e||"object"!==s6(e)&&"function"!=typeof e)return{default:e};var r=s9(void 0);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}(ox);function s9(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(s9=function(e){return e?r:i})(e)}function s7(){var e=new s8.ARRAY_TYPE(2);return s8.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function le(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e}function lt(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e}function li(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e}function lr(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1])}function la(e,i){var r=i[0]-e[0],a=i[1]-e[1];return r*r+a*a}function ln(e){return Math.hypot(e[0],e[1])}function lo(e){var i=e[0],r=e[1];return i*i+r*r}s4.len=ln,s4.sub=le,s4.mul=lt,s4.div=li,s4.dist=lr,s4.sqrDist=la,s4.sqrLen=lo;var ls=(h=s7(),function(e,i,r,a,n,o){var s,l;for(i||(i=2),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)h[0]=e[s],h[1]=e[s+1],n(h,h,o),e[s]=h[0],e[s+1]=h[1];return e});function ll(e){return(ll="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}s4.forEach=ls,Object.defineProperty(oy,"__esModule",{value:!0}),e.a7=oy.vec4=e.N=oy.vec3=oy.vec2=oy.quat2=e.bi=oy.quat=e.a6=oy.mat4=e.co=oy.mat3=oy.mat2d=e.b4=oy.mat2=oy.glMatrix=void 0;var lh=lv(ox);oy.glMatrix=lh;var lu=lv(oT);e.b4=oy.mat2=lu;var lc=lv(oC);oy.mat2d=lc;var ld=lv(ok);e.co=oy.mat3=ld;var lp=lv(oU);e.a6=oy.mat4=lp;var lf=lv(oJ);e.bi=oy.quat=lf;var lm=lv(s$);oy.quat2=lm;var l_=lv(s4);oy.vec2=l_;var lg=lv(oQ);e.N=oy.vec3=lg;var ly=lv(sa);function lx(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(lx=function(e){return e?r:i})(e)}
7function lv(e,i){if(!i&&e&&e.__esModule)return e;if(null===e||"object"!==ll(e)&&"function"!=typeof e)return{default:e};var r=lx(i);if(r&&r.has(e))return r.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}return a.default=e,r&&r.set(e,a),a}e.a7=oy.vec4=ly;class lb{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(i,r,a){let n=e.N.dot(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,a[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,a){if(e.N.equals(this.pos,i)||0===r)return a[0]=a[1]=a[2]=0,!1;let[n,o,s]=this.dir,l=this.pos[0]-i[0],h=this.pos[1]-i[1],u=this.pos[2]-i[2],c=n*n+o*o+s*s,d=2*(l*n+h*o+u*s),p=d*d-4*c*(l*l+h*h+u*u-r*r);if(p<0){let e=Math.max(-d/2,0),i=l+n*e,c=h+o*e,p=u+s*e,f=Math.hypot(i,c,p);return a[0]=i*r/f,a[1]=c*r/f,a[2]=p*r/f,!1}{let e=(-d-Math.sqrt(p))/(2*c);if(e<0){let e=Math.hypot(l,h,u);return a[0]=l*r/e,a[1]=h*r/e,a[2]=u*r/e,!1}return a[0]=l+n*e,a[1]=h+o*e,a[2]=u+s*e,!0}}}class lw{constructor(e,i,r,a,n){this.TL=e,this.TR=i,this.BR=r,this.BL=a,this.horizon=n}static fromInvProjectionMatrix(i,r,a){let n=[-1,1,1],o=[1,1,1],s=[1,-1,1],l=[-1,-1,1],h=e.N.transformMat4(n,n,i);return new lw(h,e.N.transformMat4(o,o,i),e.N.transformMat4(s,s,i),e.N.transformMat4(l,l,i),r/a)}}function lT(i,r,a){let n=1/0,o=-1/0,s=[];for(let l of i){e.N.sub(s,l,r);let i=e.N.dot(s,a);n=Math.min(n,i),o=Math.max(o,i)}return[n,o]}function lM(i,r){let a=!0;for(let n=0;n<i.planes.length;n++){let o=i.planes[n],s=0;for(let i=0;i<r.length;i++)s+=e.N.dot(o,r[i])+o[3]>=0;if(0===s)return 0;s!==r.length&&(a=!1)}return a?2:1}function lE(e,i){for(let r of e.projections){let a=lT(i,e.points[0],r.axis);if(r.projection[1]<a[0]||r.projection[0]>a[1])return 0}return 1}function lS(i,r){let a=0,n=[0,0,0,0];for(let o=0;o<i.length;o++)n[0]=i[o][0],n[1]=i[o][1],n[2]=i[o][2],n[3]=1,e.a7.dot(n,r)>=0&&a++;return a}class lA{constructor(i,r){for(let a of(this.points=i||Array(8).fill([0,0,0]),this.planes=r||Array(6).fill([0,0,0,0]),this.bounds=lI.fromPoints(this.points),this.projections=[],this.frustumEdges=[e.N.sub([],this.points[2],this.points[3]),e.N.sub([],this.points[0],this.points[3]),e.N.sub([],this.points[4],this.points[0]),e.N.sub([],this.points[5],this.points[1]),e.N.sub([],this.points[6],this.points[2]),e.N.sub([],this.points[7],this.points[3])],this.frustumEdges)){let e=[0,-a[2],a[1]],i=[a[2],0,-a[0]];this.projections.push({axis:e,projection:lT(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:lT(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(i,r,a,n){let o=Math.pow(2,a),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(a=>{let s=e.a7.transformMat4([],a,i),l=1/s[3]/r*o;return e.a7.mul(s,s,[l,l,n?1/s[3]:l,l])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=e.N.sub([],s[i[0]],s[i[1]]),a=e.N.sub([],s[i[2]],s[i[1]]),n=e.N.normalize([],e.N.cross([],r,a)),o=-e.N.dot(n,s[i[1]]);return n.concat(o)}),h=[];for(let e=0;e<s.length;e++)h.push([s[e][0],s[e][1],s[e][2]]);return new lA(h,l)}intersectsPrecise(i,r,a){for(let e=0;e<r.length;e++)if(!lS(i,r[e]))return 0;for(let e=0;e<this.planes.length;e++)if(!lS(i,this.planes[e]))return 0;for(let r of a)for(let a of this.frustumEdges){let n=e.N.cross([],r,a),o=e.N.length(n);if(0===o)continue;e.N.scale(n,n,1/o);let s=lT(this.points,this.points[0],n),l=lT(i,this.points[0],n);if(s[0]>l[1]||l[0]>s[1])return 0}return 1}}class lI{static fromPoints(i){let r=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let n of i)e.N.min(r,r,n),e.N.max(a,a,n);return new lI(r,a)}static fromTileIdAndHeight(e,i,r){let a=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new lI([n/a,o/a,i],[(n+1)/a,(o+1)/a,r])}static applyTransform(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)e.N.transformMat4(a[i],a[i],r);return lI.fromPoints(a)}static projectAabbCorners(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)e.N.transformMat4(a[i],a[i],r);return a}constructor(i,r){this.min=i,this.max=r,this.center=e.N.scale([],e.N.add([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=e.N.clone(this.min),n=e.N.clone(this.max);for(let e=0;e<r.length;e++)a[e]=r[e]?this.min[e]:this.center[e],n[e]=r[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new lI(a,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){let e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?lM(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?lM(e,[[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(e,i){return i||this.intersects(e)?lE(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?lE(e,[[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(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}rI(lI,"Aabb");let{members:lC}=ag([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),lP=ag([{name:"a_pos_3",components:3,type:"Int16"}]);var lz=ag([{name:"a_pos",type:"Int16",components:2}]);function lD(e){return e*nk/6371008.8}let lL=[new lI([nB,nB,nB],[nk,nk,nk]),new lI([nB,nB,nB],[0,0,nk]),new lI([0,nB,nB],[nk,0,nk]),new lI([nB,0,nB],[0,nk,nk]),new lI([0,0,nB],[nk,nk,nk])];function lR(i,r,a,n=!0){let o=e.N.scale([],i._camera.position,i.worldSize),s=[r,a,1,1];e.a7.transformMat4(s,s,i.pixelMatrixInverse),e.a7.scale(s,s,1/s[3]);let l=e.N.sub([],s,o),h=e.N.normalize([],l),u=i.globeMatrix,c=[u[12],u[13],u[14]],d=e.N.sub([],c,o),p=e.N.length(d),f=e.N.normalize([],d),m=i.worldSize/(2*Math.PI),_=e.N.dot(f,h),g=Math.asin(m/p);
7if(g<Math.acos(_)){if(!n)return null;let i=[],r=[];e.N.scale(i,h,p/_),e.N.normalize(r,e.N.sub(r,i,d)),e.N.normalize(h,e.N.add(h,d,e.N.scale(h,r,Math.tan(g)*p)))}let y=[];new lb(o,h).closestPointOnSphere(c,m,y);let x=e.N.normalize([],en(u,0)),v=e.N.normalize([],en(u,1)),b=e.N.normalize([],en(u,2)),w=e.N.dot(x,y),T=e.N.dot(v,y),M=Math.atan2(w,e.N.dot(b,y))*E;return new n5(nY(M=i.center.lng+function(e,i){let r=(i-e+180)%360-180;return r<-180?r+360:r}(i.center.lng,M)),P(nK(Math.asin(-T/m)*E),0,1))}class lk{constructor(i,r,a){this.a=e.N.sub([],i,a),this.b=e.N.sub([],r,a),this.center=a;let n=e.N.normalize([],this.a),o=e.N.normalize([],this.b);this.angle=Math.acos(e.N.dot(n,o))}}function lO(e,i){let r;return 0===e.angle?null:(r=0===e.a[i]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[i]/e.a[i]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||r>1?null:function(e,i,r,a){let n=Math.sin(r);return Math.sin((1-a)*r)/n*e+Math.sin(a*r)/n*i}(e.a[i],e.b[i],e.angle,P(r,0,1))+e.center[i]}function lB(e){if(e.z<=1)return lL[e.z+2*e.y+e.x];let i=lj(lU(e));return lI.fromPoints(i)}function lF(i,r,a){return e.N.scale(i,i,1-a),e.N.scaleAndAdd(i,i,r,a)}function lN(i,r,a){for(let n of i)e.N.transformMat4(n,n,r),e.N.scale(n,n,a)}function lV(i,r,a,n){let o=r/i.worldSize,s=i.globeMatrix;if(a.z<=1){let e=lB(a).getCorners();return lN(e,s,o),lI.fromPoints(e)}let l=lU(a,n),h=lj(l,nk+lD(i._tileCoverLift));lN(h,s,o);let u=Number.MAX_VALUE,c=[-u,-u,-u],d=[u,u,u];if(l.contains(i.center)){for(let i of h)e.N.min(d,d,i),e.N.max(c,c,i);c[2]=0;let r=i.point,a=[r.x*o,r.y*o,0];return e.N.min(d,d,a),e.N.max(c,c,a),new lI(d,c)}if(i._tileCoverLift>0){for(let i of h)e.N.min(d,d,i),e.N.max(c,c,i);return new lI(d,c)}let p=[s[12]*o,s[13]*o,s[14]*o],f=l.getCenter(),m=P(i.center.lat,-85.051129,85.051129),_=P(f.lat,-85.051129,85.051129),g=nY(i.center.lng),y=nK(m),x=g-nY(f.lng),v=y-nK(_);x>.5?x-=1:x<-.5&&(x+=1);let b=0;if(Math.abs(x)>Math.abs(v))b=x>=0?1:3;else{b=v>=0?0:2;let i=[s[4]*o,s[5]*o,s[6]*o],r=-Math.sin((v>=0?l.getSouth():l.getNorth())*M)*nk;e.N.scaleAndAdd(p,p,i,r)}let w=h[b],T=h[(b+1)%4],E=new lk(w,T,p),S=[lO(E,0)||w[0],lO(E,1)||w[1],lO(E,2)||w[2]],A=lK(i.zoom);if(A>0){let n=function({x:e,y:i,z:r},a,n,o,s){let l=1/(1<<r),h=e*l,u=h+l,c=i*l,d=c+l,p=0,f=(h+u)/2-o;return f>.5?p=-1:f<-.5&&(p=1),h=((h+p)*a-(o*=a))*n+o,u=((u+p)*a-o)*n+o,c=(c*a-(s*=a))*n+s,[[h,d=(d*a-s)*n+s,0],[u,d,0],[u,c,0],[h,c,0]]}(a,r,i._pixelsPerMercatorPixel,g,y);for(let e=0;e<h.length;e++)lF(h[e],n[e],A);let o=e.N.add([],n[b],n[(b+1)%4]);e.N.scale(o,o,.5),lF(S,o,A)}for(let i of h)e.N.min(d,d,i),e.N.max(c,c,i);return d[2]=Math.min(w[2],T[2]),e.N.min(d,d,S),e.N.max(c,c,S),new lI(d,c)}function lU({x:e,y:i,z:r},a=!1){let n=1/(1<<r);return new nj(new nU(nJ(e*n),i===(1<<r)-1&&a?-90:nQ((i+1)*n)),new nU(nJ((e+1)*n),0===i&&a?90:nQ(i*n)))}function lj(e,i=nk){let r=e.getNorth()*M,a=e.getSouth()*M,n=Math.cos(r),o=Math.cos(a),s=Math.sin(r),l=Math.sin(a),h=e.getWest(),u=e.getEast();return[nF(o,l,h,i),nF(o,l,u,i),nF(n,s,u,i),nF(n,s,h,i)]}function lG(e,i,r,a){let n=1<<r.z,o=(e/8192+r.x)/n;return nN(nQ((i/8192+r.y)/n),nJ(o),a)}function lZ({min:e,max:i}){return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}let lq=new Float64Array(16);function l$(i){let r=lZ(i),a=e.a6.fromScaling(lq,[r,r,r]);return e.a6.translate(a,a,e.N.negate([],i.min))}function lW(i){let r=e.a6.fromTranslation(lq,i.min),a=1/lZ(i);return e.a6.scale(r,r,[a,a,a])}function lH(e){return e/(2*Math.PI)/(8192/(2*Math.PI))}function lX(e,i){return 8192/(512*Math.pow(2,e))*lZ(lB(i))}function lY(i,r,a,n,o){let s=lH(a),l=[i,r,-a/(2*Math.PI)],h=e.a6.identity(new Float64Array(16));return e.a6.translate(h,h,l),e.a6.scale(h,h,[s,s,s]),e.a6.rotateX(h,h,-o*M),e.a6.rotateY(h,h,-n*M),h}function lK(e){return z(5,6,e)}function lJ(i,r){let a=nN(r.lat,r.lng),n=function(i){let r=nN(i._center.lat,i._center.lng),a=e.N.fromValues(0,1,0),n=e.N.cross([],a,r),o=e.a6.fromRotation([],-i.angle,r);n=e.N.transformMat4(n,n,o),e.a6.fromRotation(o,-i._pitch,n);let s=e.N.normalize([],r);return e.N.scale(s,s,lD(i.cameraToCenterDistance/i.pixelsPerMeter)),e.N.transformMat4(s,s,o),e.N.add([],r,s)}(i),o=e.N.subtract([],n,a);return e.N.angle(o,a)}function lQ(e,i){return lJ(e,i)>Math.PI/2*1.01}let l0=85*M,l1=Math.cos(l0),l2=Math.sin(l0),l3=e.a6.create(),l5=e=>{let i=[];return"map"===e.paint.get("circle-pitch-alignment")&&i.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&i.push("SCALE_WITH_MAP"),i};function l4(i,r,a,n,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,d=a.projection.upVectorScale(c,a.center.lat,a.worldSize).metersToTile;for(let f of r)for(let r of f){var p;let f=r.add(h),m=o&&a.elevation?a.elevation.exaggeration()*o.getElevationAt(f.x,f.y,!0):0,_=a.projection.projectTilePoint(f.x,f.y,c);if(m>0){let e=a.projection.upVector(c,f.x,f.y);_.x+=e[0]*d*m,_.y+=e[1]*d*m,_.z+=e[2]*d*m}let g=s?f:function(i,r,a,n){let o=e.a7.transformMat4([],[i,r,a,1],n);return new T(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,n),y=s?i.tilespaceRays.map(i=>(function(i,r){let a=e.N.create();return l6[2]=r,i.intersectsPlane(l6,l8,a),new T(a[0],a[1])})(i,m)):i.queryGeometry.screenGeometry,x=e.a7.transformMat4([],[_.x,_.y,_.z,1],n);if(!l&&s?u*=x[3]/a.cameraToCenterDistance:l&&!s&&(u*=a.cameraToCenterDistance/x[3]),s){let e=nQ((r.y/8192+c.y)/(1<<c.z));u/=a.projection.pixelsPerMeter(e,1)/(1/nX(e))}if(p=u,ol(y,g)||on(g,y,p))return!0}return!1}let l6=e.N.fromValues(0,0,0),l8=e.N.fromValues(0,0,1);class l9 extends ot{}function l7(e,{width:i,height:r}
7,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError("mismatched image size")}else n=new Uint8Array(i*r*a);return e.width=i,e.height=r,e.data=n,e}function he(e,i,r){let{width:a,height:n}=i;a===e.width&&n===e.height||(ht(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,a),height:Math.min(e.height,n)},r),e.width=a,e.height=n,e.data=i.data)}function ht(e,i,r,a,n,o,s){if(0===n.width||0===n.height)return i;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let l=e.data,h=i.data,u=4===o&&s;for(let s=0;s<n.height;s++){let c=((r.y+s)*e.width+r.x)*o,d=((a.y+s)*i.width+a.x)*o;if(u)for(let e=0;e<n.width;e++){let i=c+e*o+3,r=d+e*o;h[r+0]=255,h[r+1]=255,h[r+2]=255,h[r+3]=l[i]}else for(let e=0;e<n.width*o;e++)h[d+e]=l[c+e]}return i}rI(l9,"HeatmapBucket",{omit:["layers"]});class hi{constructor(e,i){l7(this,e,1,i)}resize(e){he(this,new hi(e),1)}clone(){return new hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n){ht(e,i,r,a,n,1)}}class hr{constructor(e,i){l7(this,e,4,i)}resize(e){he(this,new hr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new hr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n,o){ht(e,i,r,a,n,4,o)}}class ha{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}rI(hi,"AlphaImage"),rI(hr,"RGBAImage");let hn=new r9({visibility:new r4(at.layout_heatmap.visibility)});var ho={paint:new r9({"heatmap-radius":new r6(at.paint_heatmap["heatmap-radius"]),"heatmap-weight":new r6(at.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new r4(at.paint_heatmap["heatmap-intensity"]),"heatmap-color":new r8(at.paint_heatmap["heatmap-color"]),"heatmap-opacity":new r4(at.paint_heatmap["heatmap-opacity"])}),layout:hn};function hs(e){let i={},r=e.resolution||256,a=e.clips?e.clips.length:1,n=e.image||new hr({width:r,height:a}),o=(r,a,o)=>{i[e.evaluationKey]=o;let s=e.expression.evaluate(i);s&&(n.data[r+a+0]=Math.floor(255*s.r/s.a),n.data[r+a+1]=Math.floor(255*s.g/s.a),n.data[r+a+2]=Math.floor(255*s.b/s.a),n.data[r+a+3]=Math.floor(255*s.a))};if(e.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1),{start:h,end:u}=e.clips[i];o(n,s,h*(1-l)+u*l)}else for(let e=0,i=0;e<r;e++,i+=4)o(0,i,e/(r-1));return n}let hl=new r9({visibility:new r4(at.layout_hillshade.visibility)});var hh={paint:new r9({"hillshade-illumination-direction":new r4(at.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new r4(at.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new r4(at.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new r4(at.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new r4(at.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new r4(at.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new r4(at.paint_hillshade["hillshade-emissive-strength"])}),layout:hl};let{members:hu}=ag([{name:"a_pos",components:2,type:"Int16"}],4);var hc={exports:{}};function hd(e,i,r){r=r||2;var a,n,o,s,l,h,u,c=i&&i.length,d=c?i[0]*r:e.length,p=hp(e,0,d,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(e,i,r,a){var n,o,s,l=[];for(n=0,o=i.length;n<o;n++)(s=hp(e,i[n]*a,n<o-1?i[n+1]*a:e.length,a,!1))===s.next&&(s.steiner=!0),l.push(function(e){var i=e,r=e;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==e);return r}(s));for(l.sort(hm),n=0;n<l.length;n++)r=function(e,i){var r=function(e,i){var r,a,n,o=i,s=e.x,l=e.y,h=-1/0;do{if(l<=o.y&&l>=o.next.y&&o.next.y!==o.y){var u=o.x+(l-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(u<=s&&u>h&&(h=u,n=o.x<o.next.x?o:o.next,u===s))return n}o=o.next}while(o!==i);if(!n)return null;var c,d=n,p=n.x,f=n.y,m=1/0;o=n;do s>=o.x&&o.x>=p&&s!==o.x&&hg(l<f?s:h,l,p,f,l<f?h:s,l,o.x,o.y)&&(c=Math.abs(l-o.y)/(s-o.x),hT(o,e)&&(c<m||c===m&&(o.x>n.x||o.x===n.x&&(r=n,a=o,0>hy(r.prev,r,a.prev)&&0>hy(a.next,r,r.next))))&&(n=o,m=c)),o=o.next;while(o!==d);return n}(e,i);if(!r)return i;var a=hM(r,e);return hf(a,a.next),hf(r,r.next)}(l[n],r);return r}(e,i,p,r)),e.length>80*r){a=o=e[0],n=s=e[1];for(var m=r;m<d;m+=r)(l=e[m])<a&&(a=l),(h=e[m+1])<n&&(n=h),l>o&&(o=l),h>s&&(s=h);u=0!==(u=Math.max(o-a,s-n))?32767/u:0}return function e(i,r,a,n,o,s,l){if(i){!l&&s&&function(e,i,r,a){var n=e;do 0===n.z&&(n.z=h_(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var i,r,a,n,o,s,l,h,u=1;do{for(r=e,e=null,o=null,s=0;r;){for(s++,a=r,l=0,i=0;i<u&&(l++,a=a.nextZ);i++);for(h=u;l>0||h>0&&a;)0!==l&&(0===h||!a||r.z<=a.z)?(n=r,r=r.nextZ,l--):(n=a,a=a.nextZ,h--),o?o.nextZ=n:e
7=n,n.prevZ=o,o=n;r=a}o.nextZ=null,u*=2}while(s>1)}(n)}(i,n,o,s);for(var h,u,c=i;i.prev!==i.next;)if(h=i.prev,u=i.next,s?function(e,i,r,a){var n=e.prev,o=e.next;if(hy(n,e,o)>=0)return!1;for(var s=n.x,l=e.x,h=o.x,u=n.y,c=e.y,d=o.y,p=s<l?s<h?s:h:l<h?l:h,f=u<c?u<d?u:d:c<d?c:d,m=s>l?s>h?s:h:l>h?l:h,_=u>c?u>d?u:d:c>d?c:d,g=h_(p,f,i,r,a),y=h_(m,_,i,r,a),x=e.prevZ,v=e.nextZ;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&hg(s,u,l,c,h,d,x.x,x.y)&&hy(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&hg(s,u,l,c,h,d,v.x,v.y)&&hy(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&hg(s,u,l,c,h,d,x.x,x.y)&&hy(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&hg(s,u,l,c,h,d,v.x,v.y)&&hy(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(i,n,o,s):function(e){var i=e.prev,r=e.next;if(hy(i,e,r)>=0)return!1;for(var a=i.x,n=e.x,o=r.x,s=i.y,l=e.y,h=r.y,u=a<n?a<o?a:o:n<o?n:o,c=s<l?s<h?s:h:l<h?l:h,d=a>n?a>
7o?a:o:n>o?n:o,p=s>l?s>h?s:h:l>h?l:h,f=r.next;f!==i;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&hg(a,s,n,l,o,h,f.x,f.y)&&hy(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(h.i/a|0),r.push(i.i/a|0),r.push(u.i/a|0),hS(i),i=u.next,c=u.next;else if((i=u)===c){l?1===l?e(i=function(e,i,r){var a=e;do{var n=a.prev,o=a.next.next;!hx(n,o)&&hv(n,a,a.next,o)&&hT(n,o)&&hT(o,n)&&(i.push(n.i/r|0),i.push(a.i/r|0),i.push(o.i/r|0),hS(a),hS(a.next),a=e=o),a=a.next}while(a!==e);return hf(a)}(hf(i),r,a),r,a,n,o,s,2):2===l&&function(i,r,a,n,o,s){var l=i;do{for(var h,u,c=l.next.next;c!==l.prev;){if(l.i!==c.i&&(h=l,u=c,h.next.i!==u.i&&h.prev.i!==u.i&&!function(e,i){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==i.i&&r.next.i!==i.i&&hv(r,r.next,e,i))return!0;r=r.next}while(r!==e);return!1}(h,u)&&(hT(h,u)&&hT(u,h)&&function(e,i){var r=e,a=!1,n=(e.x+i.x)/2,o=(e.y+i.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==e);return a}(h,u)&&(hy(h.prev,h,u.prev)||hy(h,u.prev,u))||hx(h,u)&&hy(h.prev,h,h.next)>0&&hy(u.prev,u,u.next)>0))){var d=hM(l,c);return l=hf(l,l.next),d=hf(d,d.next),e(l,r,a,n,o,s,0),void e(d,r,a,n,o,s,0)}c=c.next}l=l.next}while(l!==i)}(i,r,a,n,o,s):e(hf(i),r,a,n,o,s,1);break}}}(p,f,r,a,n,u,0),f}function hp(e,i,r,a,n){var o,s;if(n===hI(e,i,r,a)>0)for(o=i;o<r;o+=a)s=hE(o,e[o],e[o+1],s);else for(o=r-a;o>=i;o-=a)s=hE(o,e[o],e[o+1],s);return s&&hx(s,s.next)&&(hS(s),s=s.next),s}function hf(e,i){if(!e)return e;i||(i=e);var r,a=e;do if(r=!1,a.steiner||!hx(a,a.next)&&0!==hy(a.prev,a,a.next))a=a.next;else{if(hS(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function hm(e,i){return e.x-i.x}function h_(e,i,r,a,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function hg(e,i,r,a,n,o,s,l){return(n-s)*(i-l)>=(e-s)*(o-l)&&(e-s)*(a-l)>=(r-s)*(i-l)&&(r-s)*(o-l)>=(n-s)*(a-l)}function hy(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function hx(e,i){return e.x===i.x&&e.y===i.y}function hv(e,i,r,a){var n=hw(hy(e,i,r)),o=hw(hy(e,i,a)),s=hw(hy(r,a,e)),l=hw(hy(r,a,i));return n!==o&&s!==l||!(0!==n||!hb(e,r,i))||!(0!==o||!hb(e,a,i))||!(0!==s||!hb(r,e,a))||!(0!==l||!hb(r,i,a))}function hb(e,i,r){return i.x<=Math.max(e.x,r.x)&&i.x>=Math.min(e.x,r.x)&&i.y<=Math.max(e.y,r.y)&&i.y>=Math.min(e.y,r.y)}function hw(e){return e>0?1:e<0?-1:0}function hT(e,i){return 0>hy(e.prev,e,e.next)?hy(e,i,e.next)>=0&&hy(e,e.prev,i)>=0:0>hy(e,i,e.prev)||0>hy(e,e.next,i)}function hM(e,i){var r=new hA(e.i,e.x,e.y),a=new hA(i.i,i.x,i.y),n=e.next,o=i.prev;return e.next=i,i.prev=e,r.next=n,n.prev=r,a.next=r,r.prev=a,o.next=a,a.prev=o,a}function hE(e,i,r,a){var n=new hA(e,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function hS(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function hA(e,i,r){this.i=e,this.x=i,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hI(e,i,r,a){for(var n=0,o=i,s=r-a;o<r;o+=a)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}hc.exports=hd,hc.exports.default=hd,hd.deviation=function(e,i,r,a){var n=i&&i.length,o=Math.abs(hI(e,0,n?i[0]*r:e.length,r));if(n)for(var s=0,l=i.length;s<l;s++)o-=Math.abs(hI(e,i[s]*r,s<l-1?i[s+1]*r:e.length,r));var h=0;for(s=0;s<a.length;s+=3){var u=a[s]*r,c=a[s+1]*r,d=a[s+2]*r;h+=Math.abs((e[u]-e[d])*(e[c+1]-e[u+1])-(e[u]-e[c])*(e[d+1]-e[u+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},hd.flatten=function(e){for(var i=e[0][0].length,r={vertices:[],holes:[],dimensions:i},a=0,n=0;n<e.length;n++){for(var o=0;o<e[n].length;o++)for(var s=0;s<i;s++)r.vertices.push(e[n][o][s]);n>0&&r.holes.push(a+=e[n-1].length)}return r};var hC=x(hc.exports);function hP(e,i){let r,a;let n=e.length;if(n<=1)return[e];let o=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[e[i]]):r.push(e[i]))}if(r&&o.push(r),i>1)for(let e=0;e<o.length;e++)o[e].length<=i||(tV(o[e],i,1,o[e].length-1,hz),o[e]=o[e].slice(0,i));return o}function hz(e,i){return i.area-e.area}function hD(e,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${e}-pattern`);i.isConstant()||(n=!0);let o=i.constantOr(null);o&&(n=!0,a[o]=!0)}return n}function hL(e,i,r,a,n){let o=n.patternDependencies;for(let s of i){let i=s.paint.get(`${e}-pattern`).value;if("constant"!==i.kind){let e=i.evaluate({zoom:a},r,{},n.availableImages);o[e=e&&e.name?e.name:e]=!0,r.patterns[s.id]=e}}return r}class hR{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ax,this.indexArray=new aO,this.indexArray2=new az,this.programConfigurations=new nP(e.layers,e.zoom),this.segments=new a9,this.segments2=new a9,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection}populate(e,i,r,a){this.hasPattern=hD("fill",this.layers,i);let n=this.layers[0].layout.get("fill-sort-key"),o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=n9(s,e);if(!this.layers[0]._featureFilter.filter(new rY(this.zoom),c,r))continue;let d=n?n.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:e?c.geometry:n8(s,r,a),patterns:{},sortKey:d};o.push(p)}for(let a of(n&&o.sort((e,i)=>
7e.sortKey-i.sortKey),o)){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(this.hasPattern){let e=hL("fill",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,{},i.availableImages,i.brightness);i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,i,r,a,n){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}addFeatures(e,i,r,a,n,o){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,r,a,n,o=[],s){for(let e of hP(i,500)){let i=0;for(let r of e)i+=r.length;let r=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),a=r.vertexLength,n=[],o=[];for(let i of e){if(0===i.length)continue;i!==e[0]&&o.push(n.length/2);let r=this.segments2.prepareSegment(i.length,this.layoutVertexArray,this.indexArray2),a=r.vertexLength;this.layoutVertexArray.emplaceBack(i[0].x,i[0].y),this.indexArray2.emplaceBack(a+i.length-1,a),n.push(i[0].x),n.push(i[0].y);for(let e=1;e<i.length;e++)this.layoutVertexArray.emplaceBack(i[e].x,i[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),n.push(i[e].x),n.push(i[e].y);r.vertexLength+=i.length,r.primitiveLength+=i.length}let s=hC(n,o);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(a+s[e],a+s[e+1],a+s[e+2]);r.vertexLength+=i,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}}rI(hR,"FillBucket",{omit:["layers","patternFeatures"]});let hk=new r9({"fill-sort-key":new r6(at.layout_fill["fill-sort-key"]),visibility:new r4(at.layout_fill.visibility)});var hO={paint:new r9({"fill-antialias":new r4(at.paint_fill["fill-antialias"]),"fill-opacity":new r6(at.paint_fill["fill-opacity"]),"fill-color":new r6(at.paint_fill["fill-color"]),"fill-outline-color":new r6(at.paint_fill["fill-outline-color"]),"fill-translate":new r4(at.paint_fill["fill-translate"]),"fill-translate-anchor":new r4(at.paint_fill["fill-translate-anchor"]),"fill-pattern":new r6(at.paint_fill["fill-pattern"]),"fill-emissive-strength":new r4(at.paint_fill["fill-emissive-strength"])}),layout:hk};let hB=ag([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),hF=ag([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),hN=ag([{name:"a_centroid_pos",components:2,type:"Uint16"}]),hV=ag([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),hU=ag([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:hj}=hB;var hG={};function hZ(e,i,r,a,n){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=n,e.readFields(hq,this,i)}function hq(e,i,r){1==e?i.id=r.readVarint():2==e?function(e,i){for(var r=e.readVarint()+e.pos;e.pos<r;){var a=i._keys[e.readVarint()],n=i._values[e.readVarint()];i.properties[a]=n}}(r,i):3==e?i.type=r.readVarint():4==e&&(i._geometry=r.pos)}function h$(e,i){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(hW,this,i),this.length=this._features.length}function hW(e,i,r){15===e?i.version=r.readVarint():1===e?i.name=r.readString():5===e?i.extent=r.readVarint():2===e?i._features.push(r.pos):3===e?i._keys.push(r.readString()):4===e&&i._values.push(function(e){for(var i=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;i=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return i}(r))}function hH(e,i,r){if(3===e){var a=new h$(r,r.readVarint()+r.pos);a.length&&(i[a.name]=a)}}hZ.types=["Unknown","Point","LineString","Polygon"],hZ.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var i,r=e.readVarint()+e.pos,a=1,n=0,o=0,s=0,l=[];e.pos<r;){if(n<=0){var h=e.readVarint();a=7&h,n=h>>3}if(n--,1===a||2===a)o+=e.readSVarint(),s+=e.readSVarint(),1===a&&(i&&l.push(i),i=[]),i.push(new w(o,s));else{if(7!==a)throw Error("unknown command "+a);i&&i.push(i[0].clone())}}return i&&l.push(i),l},hZ.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var i=e.readVarint()+e.pos,r=1,a=0,n=0,o=0,s=1/0,l=-1/0,h=1/0,u=-1/0;e.pos<i;){if(a<=0){var c=e.readVarint();r=7&c,a=c>>3}if(a--,1===r||2===r)(n+=e.readSVarint())<s&&(s=n),n>l&&(l=n),(o+=e.readSVarint())<h&&(h=o),o>u&&(u=o);else if(7!==r)throw Error("unknown command "+r)}return[s,h,l,u]},hZ.prototype.toGeoJSON=function(e,i,r){var a,n,o=this.extent*Math.pow(2,r),s=this.extent*e,l=this.extent*i,h=this.loadGeometry(),u=hZ.types[this.type];function c(e){for(var i=0;i<e.length;i++){var r=e[i];e[i]=[360*(r.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+l)/o)*Math.PI/180)
7)-90]}}switch(this.type){case 1:var d=[];for(a=0;a<h.length;a++)d[a]=h[a][0];c(h=d);break;case 2:for(a=0;a<h.length;a++)c(h[a]);break;case 3:for(h=function(e){var i=e.length;if(i<=1)return[e];for(var r,a,n=[],o=0;o<i;o++){var s=function(e){for(var i,r,a=0,n=0,o=e.length,s=o-1;n<o;s=n++)a+=((r=e[s]).x-(i=e[n]).x)*(i.y+r.y);return a}(e[o]);0!==s&&(void 0===a&&(a=s<0),a===s<0?(r&&n.push(r),r=[e[o]]):r.push(e[o]))}return r&&n.push(r),n}(h),a=0;a<h.length;a++)for(n=0;n<h[a].length;n++)c(h[a][n])}1===h.length?h=h[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(p.id=this.id),p},h$.prototype.feature=function(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];var i=this._pbf.readVarint()+this._pbf.pos;return new hZ(this._pbf,i,this.extent,this._keys,this._values)};var hX=hG.VectorTile=function(e,i){this.layers=e.readFields(hH,{},i)},hY=hG.VectorTileFeature=hZ;function hK(e,i,r,a){let n=[],o=0===a?(e,i,r,a,n,o)=>{e.push(new T(o,r+(o-i)/(a-i)*(n-r)))}:(e,i,r,a,n,o)=>{e.push(new T(i+(o-r)/(n-r)*(a-i),o))};for(let s of e){let e=[];for(let n of s){if(n.length<=2)continue;let s=[];for(let e=0;e<n.length-1;e++){let l=n[e].x,h=n[e].y,u=n[e+1].x,c=n[e+1].y,d=0===a?l:h,p=0===a?u:c;d<i?p>i&&o(s,l,h,u,c,i):d>r?p<r&&o(s,l,h,u,c,r):s.push(n[e]),p<i&&d>=i&&o(s,l,h,u,c,i),p>r&&d<=r&&o(s,l,h,u,c,r)}let l=n[n.length-1],h=0===a?l.x:l.y;h>=i&&h<=r&&s.push(l),s.length&&(l=s[s.length-1],s[0].x===l.x&&s[0].y===l.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function hJ(e,i){return e.x-i.x||e.y-i.y}function hQ(e,i){return 0===hJ(e.min,i.min)&&0===hJ(e.max,i.max)}function h0(e,i){return!(e.min.x>i.max.x||e.max.x<i.min.x||e.min.y>i.max.y||e.max.y<i.min.y)}function h1(e,i,r){let a=1/(1<<r.canonical.z),n=(1220703125e-13*i.x+r.canonical.x)*a+r.wrap,o=(1220703125e-13*i.y+r.canonical.y)*a;return{min:new T((1220703125e-13*e.x+r.canonical.x)*a+r.wrap,(1220703125e-13*e.y+r.canonical.y)*a),max:new T(n,o)}}function h2(e,i,r,a,n,o,s){let l=e.indices,h=e.vertices,u=[];for(let c=a;c<a+n;c+=3){let a=i[r[c+0]+o],n=i[r[c+1]+o],d=i[r[c+2]+o],p=Math.min(a.x,n.x,d.x),f=Math.max(a.x,n.x,d.x),m=Math.min(a.y,n.y,d.y),_=Math.max(a.y,n.y,d.y);u.length=0,e.grid.query(new T(p,m),new T(f,_),u);for(let e=0;e<u.length;e++){let i=u[e];if(oc(h[l[3*i+0]],h[l[3*i+1]],h[l[3*i+2]],a,n,d,s))return!0}}return!1}hG.VectorTileLayer=h$;class h3{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){let r=this.toIdx(e,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function h5(e,i,r,a){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(1e-15>Math.abs(a[s])){if(r[s]<e[s]||r[s]>i[s])return null}else{let l=1/a[s],h=(e[s]-r[s])*l,u=(i[s]-r[s])*l;if(h>u){let e=h;h=u,u=e}if(h>n&&(n=h),u<o&&(o=u),n>o)return null}return n}function h4(e,i,r,a,n,o,s,l,h,u,c){let d=a-e,p=n-i,f=o-r,m=s-e,_=l-i,g=h-r,y=c[1]*g-c[2]*_,x=c[2]*m-c[0]*g,v=c[0]*_-c[1]*m,b=d*y+p*x+f*v;if(1e-15>Math.abs(b))return null;let w=1/b,T=u[0]-e,M=u[1]-i,E=u[2]-r,S=(T*y+M*x+E*v)*w;if(S<0||S>1)return null;let A=M*f-E*p,I=E*d-T*f,C=T*p-M*d,P=(c[0]*A+c[1]*I+c[2]*C)*w;return P<0||S+P>1?null:(m*A+_*I+g*C)*w}function h6(e,i,r,a,n,o,s,l,h){let u=1<<r,c=o-a,d=s-n;l[0]=(e+0)/u*c+a,l[1]=(i+0)/u*d+n,h[0]=(e+1)/u*c+a,h[1]=(i+1)/u*d+n}class h8{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let i=function(e){let i=Math.ceil(Math.log2(e.dim/8)),r=[],a=Math.ceil(Math.pow(2,i)),n=1/a,o=(e,i,r,a,n)=>{let o=a?1:0;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-o,n[3]=(i+1)*r-o},s=new h3(a),l=[];for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),n,!1,l);let r=h7(l[0],l[1],e),h=h7(l[2],l[1],e),u=h7(l[2],l[3],e),c=h7(l[0],l[3],e);s.minimums.push(Math.min(r,h,u,c)),s.maximums.push(Math.max(r,h,u,c)),s.leaves.push(1)}for(r.push(s),a/=2;a>=1;a/=2){let e=r[r.length-1];s=new h3(a);for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),2,!0,l);let r=e.getElevation(l[0],l[1]),n=e.getElevation(l[2],l[1]),h=e.getElevation(l[2],l[3]),u=e.getElevation(l[0],l[3]),c=e.isLeaf(l[0],l[1]),d=e.isLeaf(l[2],l[1]),p=e.isLeaf(l[2],l[3]),f=e.isLeaf(l[0],l[3]),m=Math.min(r.min,n.min,h.min,u.min),_=Math.max(r.max,n.max,h.max,u.max),g=c&&d&&p&&f;s.maximums.push(_),s.minimums.push(m),s.leaves.push(_-m<=5&&g?1:0)}r.push(s)}return r}(this.dem),r=i.length-1,a=i[r];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,
70,0,r,0)}raycastRoot(e,i,r,a,n,o,s=1){return h5([e,i,-100],[r,a,this.maximums[0]*s],n,o)}raycast(i,r,a,n,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,a,n,o,s,l);if(null==h)return null;let u=[],c=[],d=[],p=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:g,nodex:y,nodey:x,depth:v}=f.pop();if(this.leaves[h]){h6(y,x,v,i,r,a,n,d,p);let h=1<<v,u=(y+0)/h,c=(y+1)/h,f=(x+0)/h,b=(x+1)/h,w=h7(u,f,this.dem)*l,T=h7(c,f,this.dem)*l,M=h7(c,b,this.dem)*l,E=h7(u,b,this.dem)*l,S=h4(d[0],d[1],w,p[0],d[1],T,p[0],p[1],M,o,s),A=h4(p[0],p[1],M,d[0],p[1],E,d[0],d[1],w,o,s),I=Math.min(null!==S?S:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(I!==Number.MAX_VALUE)return I;{var m,_;let i=e.N.scaleAndAdd([],o,s,g);if(h9(w,T,E,M,(i[0]-(m=d[0]))/(p[0]-m),(i[1]-(_=d[1]))/(p[1]-_))>=i[2])return g}continue}let b=0;for(let e=0;e<this._siblingOffset.length;e++){h6((y<<1)+this._siblingOffset[e][0],(x<<1)+this._siblingOffset[e][1],v+1,i,r,a,n,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+e]*l;let f=h5(d,p,o,s);if(null!=f){u[e]=f;let i=!1;for(let r=0;r<b&&!i;r++)f>=u[c[r]]&&(c.splice(r,0,e),i=!0);i||(c[b]=e),b++}}for(let e=0;e<b;e++){let i=c[e];f.push({idx:this.childOffsets[h]+i,t:u[i],nodex:(y<<1)+this._siblingOffset[i][0],nodey:(x<<1)+this._siblingOffset[i][1],depth:v+1})}}return null}_addNode(e,i,r){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,r,a,n){if(1===e[a].isLeaf(i,r))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);let o=a-1,s=e[o],l=0,h=0;for(let e=0;e<this._siblingOffset.length;e++){let a=2*i+this._siblingOffset[e][0],n=2*r+this._siblingOffset[e][1],o=s.getElevation(a,n),u=s.isLeaf(a,n),c=this._addNode(o.min,o.max,u);u&&(l|=1<<e),h||(h=c)}for(let a=0;a<this._siblingOffset.length;a++)l&1<<a||this._construct(e,2*i+this._siblingOffset[a][0],2*r+this._siblingOffset[a][1],o,h+a)}}function h9(e,i,r,a,n,o){return e4(e4(e,r,o),e4(i,a,o),n)}function h7(e,i,r){let a=r.dim,n=P(e*a-.5,0,a-1),o=P(i*a-.5,0,a-1),s=Math.floor(n),l=Math.floor(o),h=Math.min(s+1,a-1),u=Math.min(l+1,a-1);return h9(r.get(s,l),r.get(h,l),r.get(s,u),r.get(h,u),n-s,o-l)}let ue={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ut(e,i,r){return(256*e*256+256*i+r)/10-1e4}function ui(e,i,r){return 256*e+i+r/256-32768}class ur{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,r,a=!1){if(this.uid=e,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return $(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;let n=this.dim=i.height-2,o=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}let s="terrarium"===r?ui:ut;for(let e=0;e<o.length;++e){let i=4*e;this.floatView[e]=s(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}this._timestamp=eh.now()}_buildQuadTree(){this._tree=new h8(this)}get(e,i,r=!1){r&&(e=P(e,-1,this.dim),i=P(i,-1,this.dim));let a=this._idx(e,i);return this.floatView[a]}set(e,i,r){let a=this._idx(e,i),n=this.floatView[a];return this.floatView[a]=r,r-n}static getUnpackVector(e){return ue[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){let r=[0,0,0,0],a=ur.getUnpackVector(i),n=Math.floor((e+a[3])/a[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new ha({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,o=r*this.dim,s=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:o=s-1;break;case 1:s=o+1}let l=-i*this.dim,h=-r*this.dim;for(let i=o;i<s;i++)for(let r=a;r<n;r++){let a=4*this._idx(r,i),n=4*this._idx(r+l,i+h);this.pixels[a+0]=e.pixels[n+0],this.pixels[a+1]=e.pixels[n+1],this.pixels[a+2]=e.pixels[n+2],this.pixels[a+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}rI(ur,"DEMData"),rI(h8,"DemMinMaxQuadTree",{omit:["dem"]});class ua{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){let a=r||e.findDEMTileFor(i);if(!a||!a.dem)return;let n=a.dem,o=a.tileID,s=1<<i.canonical.z-o.canonical.z;return new ua(a,n.dim/8192/s,[(i.canonical.x/s-o.canonical.x)*n.dim,(i.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,i){let r=i*this._scale+this._offset[1];return new T(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,i,r,a){let n=e*this._scale+this._offset[0],o=i*this._scale+this._offset[1],s=Math.floor(n),l=Math.floor(o),h=this._dem;return a=!!a,r?e4(e4(h.get(s,l,a),h.get(s,l+1,a),o-l),e4(h.get(s+1,l,a),h.get(s+1,l+1,a),o-l),n-s):h.get(s,l,a)}getElevationAtPixel(e,i,r){return this._dem.get(e,i,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*(1/nX(e))*this._dem.stride}}let un=hY.types,uo=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius"],us=["fill-extrusion-flood-light-ground-radius"],ul=new T(0,1);function uh(e,i,r,a,n,o,s,l){e.emplaceBack((i<<1)+s,(r<<1)+o,(Math.floor(8192*a)<<1)+n,Math.round(l))}function uu(e,i,r,a,n,o){e.emplaceBack(i.x,i.y,(r.x<<1)+a,(r.y<<1)+n,o)}function uc(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class ud{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class up{constructor(){this.centroidXY=new T(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 T(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new T(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new T(this.max.x-this.min.x,this.max.y-this.min.y)}}class uf{constructor(){this.acc=new T(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,r){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),a&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,e4(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>8192!=e.x>
78192&&this.addBorderIntersection(1,e4(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,e4(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>8192!=e.y>8192&&this.addBorderIntersection(3,e4(i.x,e.x,(8192-i.y)/(e.y-i.y)))}addBorderIntersection(e,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]]);let r=this.borders[e];i<r[0]&&(r[0]=i),i>r[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;let r=0===e.x?0:1;this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{let r=0===e.y?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new T(0,0):new T(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((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function um(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(P(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.x<0?-1:1)}let u_=[e=>e.x<0,e=>e.x>8192,e=>e.y<0,e=>e.y>8192];class ug{constructor(e){this.vertexArray=new aw,this.indexArray=new aO,this.programConfigurations=new nP(e.layers,e.zoom,e=>us.includes(e)),this._segments=new a9,this.hiddenByLandmarkVertexArray=new aH,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new a9}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,i,r,a=!1){let n=e.length;if(n>2){let o,s=Math.max(0,this._segments.get().length-1),l=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{let i=e[0],r=e[1];o=um(i.sub(e[n-1])._perp()._unit(),r.sub(i)._perp()._unit())}for(let h=0;h<n;h++){let u=h===n-1?0:h+1,c=e[h],d=e[u],p=e[u===n-1?0:u+1],f=d.sub(c)._perp()._unit(),m=um(f,p.sub(d)._perp()._unit()),_=o;if(ub(c,d,i)||a&&uw(c,i)&&uw(d,i)){o=m;continue}let g=l.vertexLength;for(let e of(uu(this.vertexArray,c,d,1,1,_),uu(this.vertexArray,c,d,1,0,_),uu(this.vertexArray,c,d,0,1,m),uu(this.vertexArray,c,d,0,0,m),l.vertexLength+=4,function(e,i,r,a){let n=[4];if(0===a)return n;r._mult(a);let o=e.sub(r),s=i.sub(r),l=[e,i,o,s];for(let e=0;e<4;e++)for(let i of l)if(u_[e](i)){n.push(e);break}return n}(c,d,f,r)))this._segmentToGroundQuads[s].push({id:g,region:e}),this._segmentToRegionTriCounts[s][e]+=2,l.primitiveLength+=2;o=m}}}prepareBorderSegments(){if(!this.hasData())return;let e=this._segments.get(),i=e.length;for(let e=0;e<i;e++)this._segmentToGroundQuads[e].sort((e,i)=>e.region-i.region);for(let r=0;r<i;r++){let i=this._segmentToGroundQuads[r],a=e[r],n=this._segmentToRegionTriCounts[r];n.reduce((e,i)=>e+i,0);let o=0;for(let e=0;e<=4;e++){let i=n[e];if(0!==i){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new a9);let n={vertexOffset:a.vertexOffset,primitiveOffset:a.primitiveOffset+o,vertexLength:a.vertexLength,primitiveLength:i};r.get().push(n)}o+=i}for(let e=0;e<i.length;e++){let r=i[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,r,a,n,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,r,a,n,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,hF.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,a,n,o){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,a,n,o)}updateHiddenByLandmark(e){if(!this.hasData())return;let i=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;let r=2147483648&e.flags?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,hV.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){let i=this.regionSegments[e];i&&i.destroy()}}}}class uy{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new aO,this.footprintVertices=new ax,this.footprintSegments=[],this.layoutVertexArray=new ab,this.centroidVertexArray=new a4,this.indexArray=new aO,this.programConfigurations=new nP(e.layers,e.zoom,e=>uo.includes(e)),this.segments=new a9,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new ug(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}populate(e,i,r,a){for(let{feature:n,id:o,index:s,sourceLayerIndex:l}of(this.features=[],this.hasPattern=hD("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=n3(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,e)){let e=this.layers[0]._featureFilter.needGeometry,h=n9(n,e);if(!this.layers[0]._featureFilter.filter(new rY(this.zoom),h,r))continue;let u={id:o,sourceLayerIndex:l,index:s,geometry:e?h.geometry:n8(n,r,a),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(hL("fill-extrusion",this.layers,u,this.zoom,i)):this.addFeature(u,u.geometry,s,r,{},i.availableImages,a,i.brightness),i.featureIndex.insert(n,u.geometry,s,l,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,a,n,o){for(let e of this.features){let{geometry:s}=e;this.addFeature(e,s,e.index,i,r,a,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,i,r,a,n){let o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;let s=o?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,s,r,a,n),this.groundEffect.update(e,i,s,r,a,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hj),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,hU.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,hN.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,r,a,n,o,s,l){var h;let u;let c=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,d=[new T(0,0),new T(8192,8192)],p=s.projection,f="globe"===p.name,m="Polygon"===un[e.type],_=new uf;_.centroidDataIndex=this.centroidData.length;let g=new up,y=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a),x=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);
7g.height=x,g.vertexArrayOffset=this.layoutVertexArray.length,g.groundVertexArrayOffset=this.groundEffect.vertexArray.length,f&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new aA);let v=hP(i,500);for(let e=v.length-1;e>=0;e--){let i=v[e];(0===i.length||(h=i[0]).every(e=>e.x<=0)||h.every(e=>e.x>=8192)||h.every(e=>e.y<=0)||h.every(e=>e.y>=8192))&&v.splice(e,1)}if(f)u=uS(v,d,a);else for(let e of(u=[],v))u.push({polygon:e,bounds:d});let b=m?this.edgeRadius:0,w=b>0&&this.zoom<17,M=(e,i)=>{if(0===e.length)return!1;let r=e[e.length-1];return i.x===r.x&&i.y===r.y};for(let{polygon:e,bounds:i}of u){let r=0,n=0;for(let i of e)m&&!i[0].equals(i[i.length-1])&&i.push(i[0]),n+=m?i.length-1:i.length;let o=this.segments.prepareSegment((m?5:4)*n,this.layoutVertexArray,this.indexArray);g.footprintSegIdx<0&&(g.footprintSegIdx=this.footprintSegments.length),g.polygonSegIdx<0&&(g.polygonSegIdx=this.polygonSegments.length);let s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},l=new ud;if(l.vertexOffset=this.footprintVertices.length,l.indexOffset=3*this.footprintIndices.length,l.ringIndices=[],m){let n=[],s=[];r=o.vertexLength;for(let r=0;r<e.length;r++){let h,u;let d=e[r];d.length&&0!==r&&s.push(n.length/2);let m=[];h=d[1].sub(d[0])._perp()._unit(),l.ringIndices.push(d.length-1);for(let e=1;e<d.length;e++){let i=d[e],r=d[e===d.length-1?1:e+1],s=i.clone();if(b){u=r.sub(i)._perp()._unit();let e=h.add(u)._unit(),a=b*Math.min(4,1/(h.x*e.x+h.y*e.y));s.x+=a*e.x,s.y+=a*e.y,s.x=Math.round(s.x),s.y=Math.round(s.y),h=u}!y||0!==b&&!w||M(m,s)||m.push(s),uh(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),o.vertexLength++,this.footprintVertices.emplaceBack(i.x,i.y),n.push(i.x,i.y),f&&uc(this.layoutVertexExtArray,p.projectTilePoint(s.x,s.y,a),p.upVector(a,s.x,s.y))}y&&(0===b||w)&&(0!==m.length&&M(m,m[0])&&m.pop(),this.groundEffect.addData(m,i,c))}let h=hC(n,s);for(let e=0;e<h.length;e+=3)this.footprintIndices.emplaceBack(l.vertexOffset+h[e+0],l.vertexOffset+h[e+1],l.vertexOffset+h[e+2]),this.indexArray.emplaceBack(r+h[e],r+h[e+2],r+h[e+1]),o.primitiveLength++;l.indexCount+=h.length,l.vertexCount+=this.footprintVertices.length-l.vertexOffset}for(let n=0;n<e.length;n++){let s,l,h;let u=e[n];_.startRing(g,u[0]);let d=u.length>4&&uT(u[u.length-2],u[0],u[1]),x=b?function(e,i,r,a){let n=i.sub(e)._perp()._unit(),o=r.sub(i)._perp()._unit();return uv(e,i,r,ux(n,o),a)}(u[u.length-2],u[0],u[1],b):0,v=[];l=u[1].sub(u[0])._perp()._unit();let w=!0;for(let e=1,n=0;e<u.length;e++){let c=u[e-1],m=u[e],T=u[e===u.length-1?1:e+1];if(_.appendEdge(g,m,c),ub(m,c,i)){b&&(l=T.sub(m)._perp()._unit(),w=!w);continue}let E=m.sub(c)._perp(),S=E.x/(Math.abs(E.x)+Math.abs(E.y)),A=E.y>0?1:0,I=c.dist(m);if(n+I>32768&&(n=0),b){h=T.sub(m)._perp()._unit();let e=uv(c,m,T,ux(l,h),b);isNaN(e)&&(e=0);let i=m.sub(c)._unit();c=c.add(i.mult(x))._round(),m=m.add(i.mult(-e))._round(),x=e,l=h,y&&this.zoom>=17&&(M(v,c)||v.push(c),M(v,m)||v.push(m))}let C=o.vertexLength,P=u.length>4&&uT(c,m,T),z=uM(n,d,w);if(uh(this.layoutVertexArray,c.x,c.y,S,A,0,0,z),uh(this.layoutVertexArray,c.x,c.y,S,A,0,1,z),n+=I,z=uM(n,P,!w),d=P,uh(this.layoutVertexArray,m.x,m.y,S,A,0,0,z),uh(this.layoutVertexArray,m.x,m.y,S,A,0,1,z),o.vertexLength+=4,this.indexArray.emplaceBack(C+0,C+1,C+2),this.indexArray.emplaceBack(C+1,C+3,C+2),o.primitiveLength+=2,b){let a=r+(1===e?u.length-2:e-2),n=1===e?r:a+1;if(this.indexArray.emplaceBack(C+1,a,C+3),this.indexArray.emplaceBack(a,n,C+3),o.primitiveLength+=2,void 0===s&&(s=C),!ub(T,u[e],i)){let i=e===u.length-1?s:o.vertexLength;this.indexArray.emplaceBack(C+2,C+3,i),this.indexArray.emplaceBack(C+3,i+1,i),this.indexArray.emplaceBack(C+3,n,i+1),o.primitiveLength+=3}w=!w}if(f){let e=this.layoutVertexExtArray,i=p.projectTilePoint(c.x,c.y,a),r=p.projectTilePoint(m.x,m.y,a),n=p.upVector(a,c.x,c.y),o=p.upVector(a,m.x,m.y);uc(e,i,n),uc(e,i,n),uc(e,r,o),uc(e,r,o)}}m&&(r+=u.length-1),y&&b&&this.zoom>=17&&(0!==v.length&&M(v,v[0])&&v.pop(),this.groundEffect.addData(v,i,c,b>0))}this.footprintSegments.push(l),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++g.footprintSegLen,++g.polygonSegLen}if(g.vertexCount=this.layoutVertexArray.length-g.vertexArrayOffset,g.groundVertexCount=this.groundEffect.vertexArray.length-g.groundVertexArrayOffset,0!==g.vertexCount){if(g.centroidXY=_.borders?ul:this.encodeCentroid(_,g),this.centroidData.push(g),_.borders){this.featuresOnBorder.push(_);let e=this.featuresOnBorder.length-1;for(let i=0;i<_.borders.length;i++)_.borders[i][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[i].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,l),this.groundEffect.addPaintPropertiesData(e,r,n,o,a,l),this.maxHeight=Math.max(this.maxHeight,x)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,r)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){let e=[];for(let i=0;i<this.centroidData.length;i++){let r=this.centroidData[i],a=+(r.min.y+r.max.y>8192),n=2*a+(+(r.min.x+r.max.x>8192)^a);for(let a=0;a<r.polygonSegLen;a++){let o=r.polygonSegIdx+a;e.push({centroidIdx:i,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}let i=new aO;e.sort((e,i)=>e.triangleSegmentIdx===i.triangleSegmentIdx?e.subtile-i.subtile:e.triangleSegmentIdx-i.triangleSegmentIdx);let r=0,a=0,n=0;
7for(let i of e){if(i.triangleSegmentIdx!==r)break;n++}let o=e.length;for(;a!==e.length;){r=e[a].triangleSegmentIdx;let s=0,l=a,h=a;for(let i=l;i<n&&e[i].subtile===s;i++)h++;for(;l!==n;){let a=e[l];s=a.subtile;let o=this.centroidData[a.centroidIdx].min.clone(),u=this.centroidData[a.centroidIdx].max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=l;r<h;r++){let a=e[r],n=this.polygonSegments[a.polygonSegmentIdx],s=this.centroidData[a.centroidIdx].min,l=this.centroidData[a.centroidIdx].max,h=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)i.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);c.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),u.x=Math.max(u.x,l.x),u.y=Math.max(u.y,l.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:o,max:u}),l=h;for(let i=l;i<n&&e[i].subtile===e[l].subtile;i++)h++}a=n;for(let i=a;i<o&&e[i].triangleSegmentIdx===e[a].triangleSegmentIdx;i++)n++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,r){let a,n=0,o=0,s=1<<e.canonical.z;if(i){let r=i.getMinMaxForTile(e);r&&(n=r.min,o=r.max)}o+=this.maxHeight;let l=e.toUnwrapped(),h=[l.canonical.x/s+l.wrap,l.canonical.y/s],u=[(l.canonical.x+1)/s+l.wrap,(l.canonical.y+1)/s],c=new a9,d=(e,i,r)=>[e[0]*(1-r[0])+i[0]*r[0],e[1]*(1-r[1])+i[1]*r[1]],p=[],f=[];for(let e of this.triangleSubSegments){p[0]=e.min.x/8192,p[1]=e.min.y/8192,f[0]=e.max.x/8192,f[1]=e.max.y/8192;let i=d(h,u,p),s=d(h,u,f);if(0===new lI([i[0],i[1],n],[s[0],s[1],o]).intersectsPrecise(r)){a&&(c.segments.push(a),a=void 0);continue}let l=e.segment;a&&a.vertexOffset!==l.vertexOffset&&(c.segments.push(a),a=void 0),a?(a.vertexLength+=l.vertexLength,a.primitiveLength+=l.primitiveLength):a={vertexOffset:l.vertexOffset,primitiveLength:l.primitiveLength,vertexLength:l.vertexLength,primitiveOffset:l.primitiveOffset,sortKey:void 0,vaos:{}}}return a&&c.segments.push(a),c}encodeCentroid(e,i){let r=e.centroid(),a=i.span(),n=Math.min(7,Math.round(a.x*this.tileToMeter/10)),o=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new T(P(r.x,1,8191)<<3|n,P(r.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new T(0,0);let i=e.borders,r=Number.MAX_VALUE;if(i[0][0]!==r||i[1][0]!==r){let e=i[0][0]!==r?0:1;return new T(6|(i[0][0]!==r?0:65528),(i[e][0]+i[e][1])/2<<3|6)}{let e=i[2][0]!==r?2:3;return new T((i[e][0]+i[e][1])/2<<3|6,6|(i[2][0]!==r?0:65528))}}showCentroid(e){let i=this.centroidData[e.centroidDataIndex];i.flags&=2147483648,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);let i=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,a=2147483648&e.flags?ul:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||n!==a.x){for(let e=i;e<r;++e)this.centroidVertexArray.emplace(e,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let e of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(e)}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped());if(function(e,i){if(e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==i[r].sourceId||!hQ(e[r],i[r]))return!1;return!0}(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let e of this.centroidData)e.flags&=2147483647;let a=[];for(let i of this.activeReplacements){let r=Math.pow(2,i.footprintTileId.canonical.z-e.canonical.z);for(let n of this.centroidData)if(!(2147483648&n.flags||i.min.x>n.max.x||n.min.x>i.max.x||i.min.y>n.max.y||n.min.y>i.max.y))for(let o=0;o<n.footprintSegLen;o++){let s=this.footprintSegments[n.footprintSegIdx+o];if(a.length=0,function(e,i,r,a,n,o){let s=Math.pow(2,a.z-n.z);for(let l=0;l<r;l++){let r=e.int16[2*(l+i)+0],h=e.int16[2*(l+i)+1];r=(r+8192*n.x)*s-8192*a.x,h=(h+8192*n.y)*s-8192*a.y,o.push(new T(r,h))}}(this.footprintVertices,s.vertexOffset,s.vertexCount,i.footprintTileId.canonical,e.canonical,a),h2(i.footprint,a,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,
7-r)){n.flags|=2147483648;break}}}for(let e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,r){let a=!1;for(let n=0;n<r.footprintSegLen;n++){let o=this.footprintSegments[r.footprintSegIdx+n],s=0;for(let r of o.ringIndices){for(let n=s,l=r+s-1;n<r+s;l=n++){let r=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],h=this.footprintVertices.int16[2*(l+o.vertexOffset)+1];s>i!=h>i&&e<(this.footprintVertices.int16[2*(l+o.vertexOffset)+0]-r)*(i-s)/(h-s)+r&&(a=!a)}s=r}}return a}getHeightAtTileCoord(e,i){let r=Number.NEGATIVE_INFINITY,a=!0,n=4*(e+8192)*8192+(i+8192);if(this.partLookup.hasOwnProperty(n)){let e=this.partLookup[n];return e?{height:e.height,hidden:!!(2147483648&e.flags)}:void 0}for(let o of this.centroidData)e>o.max.x||o.min.x>e||i>o.max.y||o.min.y>i||this.footprintContainsPoint(e,i,o)&&o&&o.height>r&&(r=o.height,this.partLookup[n]=o,a=!!(2147483648&o.flags));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:a};this.partLookup[n]=void 0}}function ux(e,i){let r=e.add(i)._unit();return e.x*r.x+e.y*r.y}function uv(e,i,r,a,n){let o=Math.sqrt(1-a*a);return Math.min(e.dist(i)/3,i.dist(r)/3,n*o/a)}function ub(e,i,r){return e.x<r[0].x&&i.x<r[0].x||e.x>r[1].x&&i.x>r[1].x||e.y<r[0].y&&i.y<r[0].y||e.y>r[1].y&&i.y>r[1].y}function uw(e,i){return e.x<i[0].x||e.x>i[1].x||e.y<i[0].y||e.y>i[1].y}function uT(e,i,r){if(e.x<0||e.x>=8192||i.x<0||i.x>=8192||r.x<0||r.x>=8192)return!1;let a=r.sub(i),n=a.perp(),o=e.sub(i);return(a.x*o.x+a.y*o.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function uM(e,i,r){let a=i?2|e:-3&e;return r?1|a:-2&a}function uE(){let e=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*e*e)-6371008.8}function uS(e,i,r){let a=1<<r.z,n=nJ(r.x/a);return function(e,i,r,a,n=0,o){let s=[];if(!e.length||!r||!a)return s;let l=(e,i)=>{for(let r of e)s.push({polygon:r,bounds:i})},h=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(a)),c=h-u,d=[];for(let e=0;e<Math.abs(c);e++)d.push(c>0?0:1);for(let e=0;e<Math.min(h,u);e++)d.push(0),d.push(1);let p=e;if(p=hK(p,i[0].y-n,i[1].y+n,1),!(p=hK(p,i[0].x-n,i[1].x+n,0)).length)return s;let f=[];for(d.length?f.push({polygons:p,bounds:i,depth:0}):l(p,i);f.length;){let e=f.pop(),i=e.depth,r=d[i],a=e.bounds[0],s=e.bounds[1],h=0===r?a.x:a.y,u=0===r?s.x:s.y,c=o?o(r,h,u):.5*(h+u),p=hK(e.polygons,h-n,c+n,r),m=hK(e.polygons,c-n,u+n,r);if(p.length){let e=[a,new T(0===r?c:s.x,1===r?c:s.y)];d.length>i+1?f.push({polygons:p,bounds:e,depth:i+1}):l(p,e)}if(m.length){let e=[new T(0===r?c:a.x,1===r?c:a.y),s];d.length>i+1?f.push({polygons:m,bounds:e,depth:i+1}):l(m,e)}}return s}(e,i,Math.ceil((nJ((r.x+1)/a)-n)/11.25),Math.ceil((nQ(r.y/a)-nQ((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=nQ((r.y+i/8192)/a);return(nK(.5*(nQ((r.y+n/8192)/a)+e))*a-r.y)*8192}})}rI(uy,"FillExtrusionBucket",{omit:["layers","features"]}),rI(up,"PartData"),rI(ud,"FootprintSegment"),rI(uf,"BorderCentroidData"),rI(ug,"GroundEffect");let uA=new r9({visibility:new r4(at["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new r4(at["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var uI={paint:new r9({"fill-extrusion-opacity":new r4(at["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new r6(at["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new r4(at["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new r4(at["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new r6(at["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new r6(at["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new r6(at["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new r4(at["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new r4(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new r4(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new r4(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new r4(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new r4(at["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new r4(at["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new r4(at["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new r6(at["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new r6(at["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new r4(at["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new r4(at["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new r4(at["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new r4(at["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new r4(at["paint_fill-extrusion"]["fill-extrusion-emissive-strength"])}),layout:uA};class uC extends T{constructor(e,i,r){super(e,i),this.z=r}}function uP(e,i){return e.x*i.x+e.y*i.y}function uz(e,i){if(1===e.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let o=i[a],s=e[0],l=r.sub(n),h=o.sub(n),u=s.sub(n),c=uP(l,l),d=uP(l,h),p=uP(h,h),f=uP(u,l),m=uP(u,h),_=c*p-d*d,g=(p*f-d*m)/_,y=(c*m-d*f)/_,x=n.z*(1-g-y)+r.z*g+o.z*y;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let r of i)e=Math.min(e,r.z);return e}}function uD(e,i,r,a,n,o,s,l){let h=s*n.getElevationAt(e,i,!0,!0),u=0!==o[0],c=u?0===o[1]?s*(o[0]/7-450):s*function(e,i,r){var a,n;let o=Math.floor(i[0]/8),s=Math.floor(i[1]/8),l=10*(i[0]-8*o),h=10*(i[1]-8*s),u=e.getElevationAt(o,s,!0,!0),c=e.getMeterToDEM(r),d=Math.floor(.5*(l*c-1)),p=Math.floor(.5*(h*c-1)),f=e.tileCoordToPixel(o,s),m=2*d+1,_=2*p+1,g=(a=f.x-d,n=f.y-p,[e.getElevationAtPixel(a,n,!0),e.getElevationAtPixel(a+_,n,!0),e.getElevationAtPixel(a,n+_,!0),e.getElevationAtPixel(a+m,n+_,!0)]),y=Math.abs(g[0]-g[1]);return u+Math.max(Math.min(.25,.5*c*(y+Math.abs(g[2]-g[3]))/m)*l,Math.min(.25,.5*c*(Math.abs(g[0]-g[2])+Math.abs(g[1]-g[3]))/_)*h)}(n,o,l):h;return{base:h+(0===r)?-1:r,top:u?Math.max(c+a,h+r+2):h+a}}let{members:uL}=ag([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:uR}=ag([{name:"a_packed",components:4,type:"Float32"}]);class uk{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new hi({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){let r=this.getKey(e,i);return this.positions[r]}trim(){let e=this.width,i=this.height=F(this.nextRow);this.image.resize({width:e,height:i})}
7getKey(e,i){return e.join(",")+i}getDashRanges(e,i,r){let a=[],n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,s=!0;a.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let l=e[0];for(let i=1;i<e.length;i++){s=!s;let h=e[i];n=l*r,l+=h,o=l*r,a.push({left:n,right:o,isDash:s,zeroLength:0===h})}return a}addRoundDash(e,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),o=0,s=e[0];for(let l=0;l<this.width;l++){let h;l/s.right>1&&(s=e[++o]);let u=Math.min(Math.abs(l-s.left),Math.abs(l-s.right)),c=i/r*(a+1);if(s.isDash){let e=a-Math.abs(c);h=Math.sqrt(u*u+e*e)}else h=a-Math.sqrt(u*u+c*c);this.image.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,i){for(let i=e.length-1;i>=0;--i){let r=e[i],a=e[i+1];r.zeroLength?e.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,e.splice(i,1))}let r=e[0],a=e[e.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);let n=this.width*this.nextRow,o=0,s=e[0];for(let r=0;r<this.width;r++){r/s.right>1&&(s=e[++o]);let a=Math.min(Math.abs(r-s.left),Math.abs(r-s.right));this.image.data[n+r]=Math.max(0,Math.min(255,(s.isDash?a:-a)+i+128))}}addDash(e,i){let r=this.getKey(e,i);if(this.positions[r])return this.positions[r];let a="round"===i,n=a?7:0,o=2*n+1;if(this.nextRow+o>this.height)return $("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let i=0;i<e.length;i++)e[i]<0&&($("Negative value is found in line dasharray, replacing values with 0"),e[i]=0),s+=e[i];if(0!==s){let r=this.width/s,o=this.getDashRanges(e,this.width,r);a?this.addRoundDash(o,r,n):this.addRegularDash(o,"square"===i?.5*r:0)}let l=this.nextRow+n;this.nextRow+=o;let h={tl:[l,n],br:[s,0]};return this.positions[r]=h,h}}rI(uk,"LineAtlas");let uO=hY.types,uB=Math.cos(Math.PI/180*37.5);class uF{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new aT,this.layoutVertexArray2=new aM,this.indexArray=new aO,this.programConfigurations=new nP(e.layers,e.zoom),this.segments=new a9,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,i,r,a){this.hasPattern=hD("line",this.layers,i);let n=this.layers[0].layout.get("line-sort-key"),o=[];for(let{feature:i,id:s,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=n9(i,e);if(!this.layers[0]._featureFilter.filter(new rY(this.zoom),u,r))continue;let c=n?n.evaluate(u,{},r):void 0,d={id:s,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:n8(i,r,a),patterns:{},sortKey:c};o.push(d)}n&&o.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:s,featureIndex:l}=i,h=this.addConstantDashes(s);for(let a of o){let{geometry:n,index:o,sourceLayerIndex:u}=a;if(h&&this.addFeatureDashes(a,s),this.hasPattern){let e=hL("line",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,s.positions,i.availableImages,i.brightness);l.insert(e[o].feature,n,o,u,this.index)}}addConstantDashes(e){let i=!1;for(let r of this.layers){let a=r.paint.get("line-dasharray").value,n=r.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==n.kind)i=!0;else{let i=n.value,r=a.value;if(!r)continue;e.addDash(r,i)}}return i}addFeatureDashes(e,i){let r=this.zoom;for(let a of this.layers){let n,o;let s=a.paint.get("line-dasharray").value,l=a.layout.get("line-cap").value;if("constant"!==s.kind||"constant"!==l.kind){if("constant"===s.kind){if(!(n=s.value))continue}else n=s.evaluate({zoom:r},e);o="constant"===l.kind?l.value:l.evaluate({zoom:r},e),i.addDash(n,o),e.patterns[a.id]=i.getKey(n,o)}}}update(e,i,r,a,n){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}addFeatures(e,i,r,a,n,o){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,uR)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uL),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,r,a,n,o,s){let l=this.layers[0].layout,h=l.get("line-join").evaluate(e,{}),u=l.get("line-cap").evaluate(e,{}),c=l.get("line-miter-limit"),d=l.get("line-round-limit");for(let r of(this.lineClips=this.lineFeatureClips(e),i))this.addLine(r,e,h,u,c,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}addLine(e,i,r,a,n,o){let s,l,h,u,c;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
7oFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let d="Polygon"===uO[i.type],p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(d?3:2))return;"bevel"===r&&(n=1.05);let m=this.overscaling<=16?122880/(512*this.overscaling):0,_=this.segments.prepareSegment(10*p,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,d&&(s=e[p-2],c=e[f].sub(s)._unit()._perp());for(let i=f;i<p;i++){if((h=i===p-1?d?e[f+1]:void 0:e[i+1])&&e[i].equals(h))continue;c&&(u=c),s&&(l=s),s=e[i],c=h?h.sub(s)._unit()._perp():u;let g=(u=u||c).add(c);0===g.x&&0===g.y||g._unit();let y=u.x*c.x+u.y*c.y,x=g.x*c.x+g.y*c.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<uB&&l&&h,T=u.x*c.y-u.y*c.x>0;if(w&&i>f){let e=s.dist(l);if(e>2*m){let i=s.sub(s.sub(l)._mult(m/e)._round());this.updateDistance(l,i),this.addCurrentVertex(i,u,0,0,_),l=i}}let M=l&&h,E=M?r:d?"butt":a;if(M&&"round"===E&&(v<o?E="miter":v<=2&&(E="fakeround")),"miter"===E&&v>n&&(E="bevel"),"bevel"===E&&(v>2&&(E="flipbevel"),v<n&&(E="miter")),l&&this.updateDistance(l,s),"miter"
7===E)g._mult(v),this.addCurrentVertex(s,g,0,0,_);else if("flipbevel"===E){if(v>100)g=c.mult(-1);else{let e=v*u.add(c).mag()/u.sub(c).mag();g._perp()._mult(e*(T?-1:1))}this.addCurrentVertex(s,g,0,0,_),this.addCurrentVertex(s,g.mult(-1),0,0,_)}else if("bevel"===E||"fakeround"===E){let e=-Math.sqrt(v*v-1),i=T?e:0,r=T?0:e;if(l&&this.addCurrentVertex(s,u,i,r,_),"fakeround"===E){let e=Math.round(180*b/Math.PI/20);for(let i=1;i<e;i++){let r=i/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+y*(y*(3.55645-1.43519*y)-3.2452))*e*e+(.848013+y*(.215638*y-1.06021)))}let a=c.sub(u)._mult(r)._add(u)._unit()._mult(T?-1:1);this.addHalfVertex(s,a.x,a.y,!1,T,0,_)}}h&&this.addCurrentVertex(s,c,-i,-r,_)}else if("butt"===E)this.addCurrentVertex(s,g,0,0,_);else if("square"===E){let e=l?1:-1;l||this.addCurrentVertex(s,g,e,e,_),this.addCurrentVertex(s,g,0,0,_),l&&this.addCurrentVertex(s,g,e,e,_)}else"round"===E&&(l&&(this.addCurrentVertex(s,u,0,0,_),this.addCurrentVertex(s,u,1,1,_,!0)),h&&(this.addCurrentVertex(s,c,-1,-1,_,!0),this.addCurrentVertex(s,c,0,0,_)));if(w&&i<p-1){let e=s.dist(h);if(e>2*m){let i=s.add(h.sub(s)._mult(m/e)._round());this.updateDistance(s,i),this.addCurrentVertex(i,c,0,0,_),s=i}}}}addCurrentVertex(e,i,r,a,n,o=!1){let s=i.y*a-i.x,l=-i.y-i.x*a;this.addHalfVertex(e,i.x+i.y*r,i.y-i.x*r,o,!1,r,n),this.addHalfVertex(e,s,l,o,!0,-a,n)}addHalfVertex({x:e,y:i},r,a,n,o,s,l){this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(i<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*a)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);let h=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),l.primitiveLength++),o?this.e2=h:this.e1=h}updateScaledDistance(){if(this.lineClips){let e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}rI(uF,"LineBucket",{omit:["layers","patternFeatures"]});let uN=new r9({"line-cap":new r6(at.layout_line["line-cap"]),"line-join":new r6(at.layout_line["line-join"]),"line-miter-limit":new r4(at.layout_line["line-miter-limit"]),"line-round-limit":new r4(at.layout_line["line-round-limit"]),"line-sort-key":new r6(at.layout_line["line-sort-key"]),visibility:new r4(at.layout_line.visibility)});var uV={paint:new r9({"line-opacity":new r6(at.paint_line["line-opacity"]),"line-color":new r6(at.paint_line["line-color"]),"line-translate":new r4(at.paint_line["line-translate"]),"line-translate-anchor":new r4(at.paint_line["line-translate-anchor"]),"line-width":new r6(at.paint_line["line-width"]),"line-gap-width":new r6(at.paint_line["line-gap-width"]),"line-offset":new r6(at.paint_line["line-offset"]),"line-blur":new r6(at.paint_line["line-blur"]),"line-dasharray":new r6(at.paint_line["line-dasharray"]),"line-pattern":new r6(at.paint_line["line-pattern"]),"line-gradient":new r8(at.paint_line["line-gradient"]),"line-trim-offset":new r4(at.paint_line["line-trim-offset"]),"line-emissive-strength":new r4(at.paint_line["line-emissive-strength"]),"line-border-width":new r6(at.paint_line["line-border-width"]),"line-border-color":new r6(at.paint_line["line-border-color"])}),layout:uN};function uU(e,i,r){return 8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ))*i}function uj(e,i){return 1/uU(e,1,i.tileZoom)}function uG(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let uZ=e=>{let i=[];uq(e)&&i.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&i.push("RENDER_LINE_GRADIENT");let r=e.paint.get("line-trim-offset");return 0===r[0]&&0===r[1]||i.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&i.push("RENDER_LINE_BORDER"),i};function uq(e){let i=e.paint.get("line-dasharray").value;return i.value||"constant"!==i.kind}let u$=new class extends r6{possiblyEvaluate(e,i){return i=new rY(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=R({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}(uV.paint.properties["line-width"].specification);u$.useIntegerZoom=!0;let uW=ag([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uH=ag([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),uX=ag([{name:"a_projected_pos",components:4,type:"Float32"}],4);ag([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let uY=ag([{name:"a_z_offset",components:1,type:"Float32"}],4),uK=ag([{name:"a_texb",components:2,type:"Uint16"}]),uJ=ag([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),uQ=ag([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);ag([{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"}]);let u0=ag([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),u1=ag([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function u2(e,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new rY(e+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=e;)n++;let o=n=Math.max(0,n-1);for(;o<i.length&&i[o]<e+1;)o++;o=Math.min(i.length-1,o);let s=i[n],l=i[o];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:a}:{kind:"camera",minZoom:s,maxZoom:l,minSize:r.evaluate(new rY(s)),maxSize:r.evaluate(new rY(l)),interpolationType:a}}}function u3(e,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}
vendor: 5,509 bytes, line 7
7){return"source"===e.kind?a/128:"composite"===e.kind?e4(a/128,n/128,r):i}function u5(e,i){let r=0,a=0;if("constant"===e.kind)a=e.layoutSize;else if("source"!==e.kind){let{interpolationType:n,minZoom:o,maxZoom:s}=e,l=n?P(iU.interpolationFactor(n,i,o,s),0,1):0;"camera"===e.kind?a=e4(e.minSize,e.maxSize,l):r=l}return{uSizeT:r,uSize:a}}ag([{name:"triangle",components:3,type:"Uint16"}]),ag([{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"}]),ag([{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"}]),ag([{type:"Float32",name:"offsetX"}]),ag([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var u4=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:128,evaluateSizeForFeature:u3,evaluateSizeForZoom:u5,getSizeData:u2});let u6={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};var u8=function(e,i,r,a,n){var o,s,l=8*n-a-1,h=(1<<l)-1,u=h>>1,c=-7,d=r?n-1:0,p=r?-1:1,f=e[i+d];for(d+=p,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=256*o+e[i+d],d+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=a;c>0;s=256*s+e[i+d],d+=p,c-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,a),o-=u}return(f?-1:1)*s*Math.pow(2,o-a)},u9=function(e,i,r,a,n,o){var s,l,h,u=8*o-n-1,c=(1<<u)-1,d=c>>1,p=23===n?5960464477539062e-23:0,f=a?0:o-1,m=a?1:-1,_=i<0||0===i&&1/i<0?1:0;for(isNaN(i=Math.abs(i))||i===1/0?(l=isNaN(i)?1:0,s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(h=Math.pow(2,-s))<1&&(s--,h*=2),(i+=s+d>=1?p/h:p*Math.pow(2,1-d))*h>=2&&(s++,h/=2),s+d>=c?(l=0,s=c):s+d>=1?(l=(i*h-1)*Math.pow(2,n),s+=d):(l=i*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&l,f+=m,l/=256,n-=8);for(s=s<<n|l,u+=n;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*_};function u7(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}u7.Varint=0,u7.Fixed64=1,u7.Bytes=2,u7.Fixed32=5;var ce="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function ct(e){return e.type===u7.Bytes?e.readVarint()+e.pos:e.pos+1}function ci(e,i,r){var a=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(var n=r.pos-1;n>=e;n--)r.buf[n+a]=r.buf[n]}function cr(e,i){for(var r=0;r<e.length;r++)i.writeVarint(e[r])}function ca(e,i){for(var r=0;r<e.length;r++)i.writeSVarint(e[r])}function cn(e,i){for(var r=0;r<e.length;r++)i.writeFloat(e[r])}function co(e,i){for(var r=0;r<e.length;r++)i.writeDouble(e[r])}function cs(e,i){for(var r=0;r<e.length;r++)i.writeBoolean(e[r])}function cl(e,i){for(var r=0;r<e.length;r++)i.writeFixed32(e[r])}function ch(e,i){for(var r=0;r<e.length;r++)i.writeSFixed32(e[r])}function cu(e,i){for(var r=0;r<e.length;
7r++)i.writeFixed64(e[r])}function cc(e,i){for(var r=0;r<e.length;r++)i.writeSFixed64(e[r])}function cd(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+16777216*e[i+3]}function cp(e,i,r){e[r]=i,e[r+1]=i>>>8,e[r+2]=i>>>16,e[r+3]=i>>>24}function cf(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+(e[i+3]<<24)}u7.prototype={destroy:function(){this.buf=null},readFields:function(e,i,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),n=a>>3,o=this.pos;this.type=7&a,e(n,i,this),this.pos===o&&this.skip(a)}return i},readMessage:function(e,i){return this.readFields(e,i,this.readVarint()+this.pos)},readFixed32:function(){var e=cd(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=cf(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=cd(this.buf,this.pos)+4294967296*cd(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=cd(this.buf,this.pos)+4294967296*cf(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var e=u8(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=u8(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(e,i,r){var a,n,o,s=r.buf;if(n=(112&(o=s[r.pos++]))>>4,o<128||(n|=(127&(o=s[r.pos++]))<<3,o<128)||(n|=(127&(o=s[r.pos++]))<<10,o<128)||(n|=(127&(o=s[r.pos++]))<<17,o<128)||(n|=(127&(o=s[r.pos++]))<<24,o<128)||(n|=(1&(o=s[r.pos++]))<<31,o<128))return a=n,i?4294967296*a+(e>>>0):4294967296*(a>>>0)+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<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,i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&ce?(e=this.buf,ce.decode(e.subarray(r,i))):function(e,i,r){for(var a="",n=i;n<r;){var o,s,l,h=e[n],u=null,c=h>239?4:h>223?3:h>191?2:1;if(n+c>r)break;
71===c?h<128&&(u=h):2===c?128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)<=127&&(u=null):3===c?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((u=(15&h)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[n+2],l=e[n+3],128==(192&(o=e[n+1]))&&128==(192&s)&&128==(192&l)&&((u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&l)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,a+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),a+=String.fromCharCode(u),n+=c}return a}(this.buf,r,i)},readBytes:function(){var e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i},readPackedVarint:function(e,i){if(this.type!==u7.Bytes)return e.push(this.readVarint(i));var r=ct(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(i));return e},readPackedSVarint:function(e){if(this.type!==u7.Bytes)return e.push(this.readSVarint());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==u7.Bytes)return e.push(this.readBoolean());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==u7.Bytes)return e.push(this.readFloat());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==u7.Bytes)return e.push(this.readDouble());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==u7.Bytes)return e.push(this.readFixed32());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==u7.Bytes)return e.push(this.readSFixed32());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==u7.Bytes)return e.push(this.readFixed64());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==u7.Bytes)return e.push(this.readSFixed64());var i=ct(this);for(e=e||[];this.pos<i;)e.push(this.readSFixed64());return e},skip:function(e){var i=7&e;if(i===u7.Varint)for(;this.buf[this.pos++]>127;);else if(i===u7.Bytes)this.pos=this.readVarint()+this.pos;else if(i===u7.Fixed32)this.pos+=4;else{if(i!==u7.Fixed64)throw Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,i){this.writeVarint(e<<3|i)},realloc:function(e){for(var i=this.length||16;i<this.pos+e;)i*=2;if(i!==this.length){var r=new Uint8Array(i);r.set(this.buf),this.buf=r,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),cp(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),cp(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),cp(this.buf,-1&e,this.pos),cp(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),cp(this.buf,-1&e,this.pos),cp(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,i){var r,a,n,o,s;if(e>=0?(r=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),n=r,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,i.buf[i.pos]=127&(n>>>=7),s=(7&(o=a))<<4,i.buf[i.pos++]|=s|((o>>>=3)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<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 i=this.pos;this.pos=function(e,i,r){for(var a,n,o=0;o<i.length;o++){if((a=i.charCodeAt(o))>55295&&a<57344){if(!n){a>
756319||o+1===i.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=a;continue}if(a<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);a<128?e[r++]=a:(a<2048?e[r++]=a>>6|192:(a<65536?e[r++]=a>>12|224:(e[r++]=a>>18|240,e[r++]=a>>12&63|128),e[r++]=a>>6&63|128),e[r++]=63&a|128)}return r}(this.buf,e,this.pos);var r=this.pos-i;r>=128&&ci(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),u9(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),u9(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var i=e.length;this.writeVarint(i),this.realloc(i);for(var r=0;r<i;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,i){this.pos++;var r=this.pos;e(i,this);var a=this.pos-r;a>=128&&ci(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,i,r){this.writeTag(e,u7.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,i){i.length&&this.writeMessage(e,cr,i)},writePackedSVarint:function(e,i){i.length&&this.writeMessage(e,ca,i)},writePackedBoolean:function(e,i){i.length&&this.writeMessage(e,cs,i)},writePackedFloat:function(e,i){i.length&&this.writeMessage(e,cn,i)},writePackedDouble:function(e,i){i.length&&this.writeMessage(e,co,i)},writePackedFixed32:function(e,i){i.length&&this.writeMessage(e,cl,i)},writePackedSFixed32:function(e,i){i.length&&this.writeMessage(e,ch,i)},writePackedFixed64:function(e,i){i.length&&this.writeMessage(e,cu,i)},writePackedSFixed64:function(e,i){i.length&&this.writeMessage(e,cc,i)},writeBytesField:function(e,i){this.writeTag(e,u7.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,u7.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,u7.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,u7.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,u7.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,u7.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,u7.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,u7.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,u7.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,u7.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,i){this.writeVarintField(e,!!i)}};var cm=x(u7);function c_(e,i,r){i.glyphs=[],1===e&&r.readMessage(cg,i)}function cg(e,i,r){if(3===e){let{id:e,bitmap:a,width:n,height:o,left:s,top:l,advance:h}=r.readMessage(cy,{});i.glyphs.push({id:e,bitmap:new hi({width:n+6,height:o+6},a),metrics:{width:n,height:o,left:s,top:l,advance:h}})}else 4===e?i.ascender=r.readSVarint():5===e&&(i.descender=r.readSVarint())}function cy(e,i,r){1===e?i.id=r.readVarint():2===e?i.bitmap=r.readBytes():3===e?i.width=r.readVarint():4===e?i.height=r.readVarint():5===e?i.left=r.readSVarint():6===e?i.top=r.readSVarint():7===e&&(i.advance=r.readVarint())}let cx={horizontal:1,vertical:2,horizontalOnly:3};class cv{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){let r=new cv;return r.scale=e||1,r.fontStack=i,r}static forImage(e){let i=new cv;return i.imageName=e,i}}class cb{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){let r=new cb;for(let a=0;a<e.sections.length;a++){let n=e.sections[a];n.image?r.addImageSection(n):r.addTextSection(n,i)}return r}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,i){let r="";for(let a=0;a<e.length;a++){let n=e.charCodeAt(a+1)||null,o=e.charCodeAt(a-1)||null;r+=!i&&(n&&rO(n)&&!u6[e[a+1]]||o&&rO(o)&&!u6[e[a-1]])||!u6[e[a]]?e[a]:u6[e[a]]}return r}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&cT[this.text.charCodeAt(i)];i++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&cT[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){let r=new cb;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(cv.forText(e.scale,e.fontStack||i));let r=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(r)}addImageSection(e){let i=e.image?e.image.namePrimary:"";if(0===i.length)return void $("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(cv.forImage(i)),this.sectionIndex.push(this.sections.length-1)):$("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cw(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=cb.fromFeature(e,n);d===cx.vertical&&_.verticalizePunctuation(p);let g=[],y=function(e,i,r,a,n,o){if(!e)return[];let s=[],l=function(e,i,r,a,n,o){let s=0;for(let r=0;r<e.length();r++){let l=e.getSection(r);s+=cE(e.getCodePoint(r),l,a,n,i,o)}return s/Math.max(1,Math.ceil(s/r))}(e,i,r,a,n,o),h=e.text.indexOf("â")>=0,u=0;for(let r=0;r<e.length();r++){let c=e.getSection(r),d=e.getCodePoint(r);if(cT[d]||(u+=cE(d,c,a,n,i,o)),r<e.length()-1){let i=!(d<11904||!(rL["Bopomofo Extended"](d)||rL.Bopomofo(d)||rL["CJK Compatibility Forms"](d)||rL["CJK Compatibility Ideographs"](d)||rL["CJK Compatibility"](d)||rL["CJK Radicals Supplement"](d)||rL["CJK Strokes"](d)||rL["CJK Symbols and Punctuation"](d)||rL["CJK Unified Ideographs Extension A"](d)||rL["CJK Unified Ideographs"](d)||rL["Enclosed CJK Letters and Months"](d)||rL["Halfwidth and Fullwidth Forms"](d)||rL.Hiragana(d)||rL["Ideographic Description Characters"](d)||rL["Kangxi Radicals"](d)||rL["Katakana Phonet
7ic Extensions"](d)||rL.Katakana(d)||rL["Vertical Forms"](d)||rL["Yi Radicals"](d)||rL["Yi Syllables"](d)));(cM[d]||i||c.imageName)&&s.push(cA(r+1,u,l,s,function(e,i,r){let a=0;return 10===e&&(a-=1e4),r&&(a+=150),40!==e&&65288!==e||(a+=50),41!==i&&65289!==i||(a+=50),a}(d,e.getCodePoint(r+1),i&&h),!1))}}return function e(i){return i?e(i.priorBreak).concat(i.index):[]}(cA(e.length(),u,l,s,0,!0))}(_,u,o,i,a,f),{processBidirectionalText:x,processStyledBidirectionalText:v}=rX;if(x&&1===_.sections.length)for(let e of x(_.toString(),y)){let i=new cb;i.text=e,i.sections=_.sections;for(let r=0;r<e.length;r++)i.sectionIndex.push(0);g.push(i)}else if(v)for(let e of v(_.text,_.sectionIndex,y)){let i=new cb;i.text=e[0],i.sectionIndex=e[1],i.sections=_.sections,g.push(i)}else g=function(e,i){let r=[],a=e.text,n=0;for(let a of i)r.push(e.substring(n,a)),n=a;return n<a.length&&r.push(e.substring(n,a.length)),r}(_,y);let b=[],w={positionedLines:b,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,i,r,a,n,o,s,l,h,u,c,d){let p=0,f=0,m=0,_="right"===l?1:"left"===l?0:.5,g=!1;for(let e of n){for(let r of e.getSections()){if(r.imageName)continue;let e=i[r.fontStack];if(e&&!(g=void 0!==e.ascender&&void 0!==e.descender))break}if(!g)break}let y=0;for(let s of n){s.trim();let n=s.getMaxScale(),l=(n-1)*24,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=x;let v=x.positionedGlyphs,b=0;if(!s.length()){f+=o,++y;continue}let w=0,T=0;for(let o=0;o<s.length();o++){let l=s.getSection(o),m=s.getSectionIndex(o),_=s.getCodePoint(o),y=l.scale,x=null,M=null,E=null,S=24,A=0,I=!(h===cx.horizontal||!c&&!rk(_)||c&&(cT[_]||rL.Arabic(_)||rL["Arabic Supplement"](_)||rL["Arabic Extended-A"](_)||rL["Arabic Presentation Forms-A"](_)||rL["Arabic Presentation Forms-B"](_)));if(l.imageName){let i=a[l.imageName];if(!i)continue;E=l.imageName,e.iconsInText=e.iconsInText||!0,M=i.paddedRect;let r=i.displaySize;y=24*y/d,x={width:r[0],height:r[1],left:0,top:-3,advance:I?r[1]:r[0],localGlyph:!1},A=g?-x.height*y:24*n-17-r[1]*y,S=x.advance;let o=(I?r[0]:r[1])*y-24*n;o>0&&o>b&&(b=o)}else{let e=r[l.fontStack];if(!e)continue;e[_]&&(M=e[_]);let a=i[l.fontStack];if(!a)continue;let o=a.glyphs[_];if(!o)continue;if(x=o.metrics,S=8203!==_?24:0,g){let e=void 0!==a.ascender?Math.abs(a.ascender):0,i=void 0!==a.descender?Math.abs(a.descender):0,r=(e+i)*y;w<r&&(w=r,T=(e-i)/2*y),A=-e*y}else A=(n-y)*24-17}I?(e.verticalizable=!0,v.push({glyph:_,imageName:E,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:M}),p+=S*y+u):(v.push({glyph:_,imageName:E,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:M}),p+=x.advance*y+u)}0!==v.length&&(m=Math.max(p-u,m),g?cC(v,_,b,T,o*n/2):cC(v,_,b,0,o/2)),p=0;let M=o*n+b;x.lineOffset=Math.max(b,l),f+=M,++y}let x=f,{horizontalAlign:v,verticalAlign:b}=cI(s);(function(e,i,r,a,n,o){let s=(i-r)*n,l=-o*a;for(let i of e)for(let e of i.positionedGlyphs)e.x+=s,e.y+=l})(e.positionedLines,_,v,b,m,x),e.top+=-b*x,e.bottom=e.top+x,e.left+=-v*m,e.right=e.left+m,e.hasBaseline=g}(w,i,r,a,g,s,l,h,d,u,p,m),!function(e){for(let i of e)if(0!==i.positionedGlyphs.length)return!1;return!0}(b)&&w}let cT={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},cM={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 cE(e,i,r,a,n,o){if(i.imageName){let e=a[i.imageName];return e?e.displaySize[0]*i.scale*24/o+n:0}{let a=r[i.fontStack],o=a&&a.glyphs[e];return o?o.metrics.advance*i.scale+n:0}}function cS(e,i,r,a){let n=Math.pow(e-i,2);return a?e<i?n/2:2*n:n+Math.abs(r)*r}function cA(e,i,r,a,n,o){let s=null,l=cS(i,r,n,o);for(let e of a){let a=cS(i-e.x,r,n,o)+e.badness;a<=l&&(s=e,l=a)}return{index:e,x:i,priorBreak:s,badness:l}}function cI(e){let i=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:i,verticalAlign:r}}function cC(e,i,r,a,n){if(!(i||r||a||n))return;let o=e.length-1,s=e[o],l=(s.x+s.metrics.advance*s.scale)*i;for(let i=0;i<=o;i++)e[i].x-=l,e[i].y+=r+a+n}function cP(e,i,r,a,n,o){let s,l,h,u,c;let d=e.imagePrimary;if(d.content){let e=d.content,i=d.pixelRatio||1;s=[e[0]/i,e[1]/i,d.displaySize[0]-e[2]/i,d.displaySize[1]-e[3]/i]}let p=i.left*o,f=i.right*o;"width"===r||"both"===r?(c=n[0]+p-a[3],h=n[0]+f+a[1]):h=(c=n[0]+(p+f-d.displaySize[0])/2)+d.displaySize[0];let m=i.top*o,_=i.bottom*o;return"height"===r||"both"===r?(l=n[1]+m-a[0],u=n[1]+_+a[2]):u=(l=n[1]+(m+_-d.displaySize[1])/2)+d.displaySize[1],{imagePrimary:d,imageSecondary:void 0,top:l,right:h,bottom:u,left:c,collisionPadding:s}}class cz extends T{constructor(e,i,r,a,n){super(e,i),this.angle=a,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new cz(this.x,this.y,this.z,this.angle,this.segment)}}function cD(e,i,r,a,n){if(void 0===i.segment)return!0;let o=i,s=i.segment+1,l=0;for(;l>-r/2;){if(--s<0)return!1;l-=e[s].dist(o),o=e[s]}l+=e[s].dist(e[s+1]),s++;let h=[],u=0;for(;l<r/2;){let i=e[s],r=e[s+1];if(!r)return!1;let o=e[s-1].angleTo(i)-i.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:o}),u+=o;l-h[0].distance>a;)u-=h.shift().angleDelta;if(u>n)return!1;s++,l+=i.dist(r)}return!0}function cL(e){let i=0;for(let r=0;r<e.length-1;r++)i+=e[r].dist(e[r+1]);return i}function cR(e,i){return Math.max(e?e.right-e.left:0,i?i.right-i.left:0)}function ck(e,i,r,a,n){let o=[];for(let s=0;s<e.length;s++){let l;let h=e[s];for(let e=0;e<h.length-1;e++){let s=h[e],u=h[e+1];s.x<i&&u.x<i||(s.x<i?s=new T(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<i&&(u=new T(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<r&&u.y<r||(s.y<r?s=new T(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round():u.y<r&&(u=new T(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round()),s.x>=a&&u.x>=a||(s.x>=a?s=new T(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=a&&(u=new T(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=n&&u.y>=n||(s.y>=n?s=new T(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new T(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(u)))))}}return o}function cO(e){let i=0,r=0;for(let a of e)i+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,i)=>i.h-e.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,o=0;for(let i of e)for(let e=a.length-1;e>=0;e--){let r=a[e];if(!(i.w>r.w||i.h>
7r.h)){if(i.x=r.x,i.y=r.y,o=Math.max(o,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();e<a.length&&(a[e]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:o,fill:i/(n*o)||0}}rI(cz,"Anchor");class cB{constructor(e,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:o}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=o,this.version=r}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class cF{constructor(e,i){let r={},a={};this.haveRenderCallbacks=[];let n=[];this.addImages(e,r,n),this.addImages(i,a,n);let{w:o,h:s}=cO(n),l=new hr({width:o||1,height:s||1});for(let i in e){let a=e[i],n=r[i].paddedRect;hr.copy(a.data,l,{x:0,y:0},{x:n.x+1,y:n.y+1},a.data,a.sdf)}for(let e in i){let r=i[e],n=a[e].paddedRect,o=n.x+1,s=n.y+1,h=r.data.width,u=r.data.height;hr.copy(r.data,l,{x:0,y:0},{x:o,y:s},r.data),hr.copy(r.data,l,{x:0,y:u-1},{x:o,y:s-1},{width:h,height:1}),hr.copy(r.data,l,{x:0,y:0},{x:o,y:s+u},{width:h,height:1}),hr.copy(r.data,l,{x:h-1,y:0},{x:o-1,y:s},{width:1,height:u}),hr.copy(r.data,l,{x:0,y:0},{x:o+h,y:s},{width:1,height:u})}this.image=l,this.iconPositions=r,this.patternPositions=a}addImages(e,i,r){for(let a in e){let n=e[a],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),i[a]=new cB(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(e,i,r){for(let a in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[a],e.getImage(a,r),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a,r),i)}patchUpdatedImage(e,i,r){if(!e||!i||e.version===i.version)return;e.version=i.version;let[a,n]=e.tl,o=!!Object.keys(this.patternPositions).length;r.update(i.data,{useMipmap:o},{x:a,y:n})}}function cN(e,i,r,a,n,o,s,l,h){for(let u=i;u<i+a;u++)cV(e,r*o+u,o,n,s,l,h);for(let u=r;u<r+n;u++)cV(e,u*o+i,1,a,s,l,h)}function cV(e,i,r,a,n,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,n[0]=e[i];for(let l=1,h=0,u=0;l<a;l++){n[l]=e[i+l*r];let a=l*l;do{let e=o[h];u=(n[l]-n[e]+a-e*e)/(l-e)/2}while(u<=s[h]&&--h>-1);o[++h]=l,s[h]=u,s[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;s[h+1]<l;)h++;let a=o[h],u=l-a;e[i+l*r]=n[a]+u*u}}rI(cB,"ImagePosition"),rI(cF,"ImageAtlas");let cU={none:0,ideographs:1,all:2};class cj{constructor(e,i,r){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,r){let a=[],n=this.urls[i]||c.GLYPHS_URL;for(let i in e)for(let r of e[i])a.push({stack:i,id:r});L(a,({stack:e,id:i},r)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=a.glyphs[i];if(void 0!==o)return void r(null,{stack:e,id:i,glyph:o});if(o=this._tinySDF(a,e,i))return a.glyphs[i]=o,void r(null,{stack:e,id:i,glyph:o});let s=Math.floor(i/256);if(256*s>65535)return void r(Error("glyphs > 65535 not supported"));if(a.ranges[s])return void r(null,{stack:e,id:i,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],cj.loadGlyphRange(e,s,n,this.requestManager,(e,i)=>{if(i){for(let e in a.ascender=i.ascender,a.descender=i.descender,i.glyphs)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=i.glyphs[+e]);a.ranges[s]=!0}for(let r of l)r(e,i);delete a.requests[s]})),l.push((a,n)=>{a?r(a):n&&r(null,{stack:e,id:i,glyph:n.glyphs[i]||null})})},(e,i)=>{if(e)r(e);else if(i){let e={};for(let{stack:r,id:a,glyph:n}of i)void 0===e[r]&&(e[r]={}),void 0===e[r].glyphs&&(e[r].glyphs={}),e[r].glyphs[a]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[r].ascender=this.entries[r].ascender,e[r].descender=this.entries[r].descender;r(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==cU.none&&(this.localGlyphMode===cU.all?!!this.localFontFamily:!!this.localFontFamily&&
7(rL["CJK Unified Ideographs"](e)||rL["Hangul Syllables"](e)||rL.Hiragana(e)||rL.Katakana(e)||rL["CJK Symbols and Punctuation"](e)||rL["CJK Unified Ideographs Extension A"](e)||rL["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,r){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let r="400";/bold/i.test(i)?r="900":/medium/i.test(i)?r="500":/light/i.test(i)&&(r="200"),(n=e.tinySDF=new cj.TinySDF({fontFamily:a,fontWeight:r,fontSize:48,buffer:6,radius:16})).fontWeight=r}if(this.localGlyphs[n.fontWeight][r])return this.localGlyphs[n.fontWeight][r];let o=String.fromCodePoint(r),{data:s,width:l,height:h,glyphWidth:u,glyphHeight:c,glyphLeft:d,glyphTop:p,glyphAdvance:f}=n.draw(o);return this.localGlyphs[n.fontWeight][r]={id:r,bitmap:new hi({width:l,height:h},s),metrics:{width:u/2,height:c/2,left:d/2,top:p/2-27,advance:f/2,localGlyph:!0}}}}function cG(e,i,r,a){let n=[],o=e.imagePrimary,s=o.pixelRatio,l=o.paddedRect.w-2,h=o.paddedRect.h-2,u=e.right-e.left,c=e.bottom-e.top,d=o.stretchX||[[0,l]],p=o.stretchY||[[0,h]],f=(e,i)=>e+i[1]-i[0],m=d.reduce(f,0),_=p.reduce(f,0),g=l-m,y=h-_,x=0,v=m,b=0,w=_,M=0,E=g,S=0,A=y;if(o.content&&a){let e=o.content;x=cZ(d,0,e[0]),b=cZ(p,0,e[1]),v=cZ(d,e[0],e[2]),w=cZ(p,e[1],e[3]),M=e[0]-x,S=e[1]-b,E=e[2]-e[0]-v,A=e[3]-e[1]-w}let I=(a,n,l,h)=>{var d,p,f,g;let y=(a.stretch-x)/v*u+e.left,I=(d=a.fixed-M,d-E*a.stretch/m),C=(n.stretch-b)/w*c+e.top,P=(p=n.fixed-S,p-A*n.stretch/_),z=(l.stretch-x)/v*u+e.left,D=(f=l.fixed-M,f-E*l.stretch/m),L=(h.stretch-b)/w*c+e.top,R=(g=h.fixed-S,g-A*h.stretch/_),k=new T(y,C),O=new T(z,C),B=new T(z,L),F=new T(y,L),N=new T(I/s,P/s),V=new T(D/s,R/s),U=i*Math.PI/180;if(U){let e=Math.sin(U),i=Math.cos(U),r=[i,-e,e,i];k._matMult(r),O._matMult(r),F._matMult(r),B._matMult(r)}let j=a.stretch+a.fixed,G=l.stretch+l.fixed,Z=n.stretch+n.fixed,q=h.stretch+h.fixed,$=e.imageSecondary;return{tl:k,tr:O,bl:F,br:B,texPrimary:{x:o.paddedRect.x+1+j,y:o.paddedRect.y+1+Z,w:G-j,h:q-Z},texSecondary:$?{x:$.paddedRect.x+1+j,y:$.paddedRect.y+1+Z,w:G-j,h:q-Z}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:N,pixelOffsetBR:V,minFontScaleX:E/s/u,minFontScaleY:A/s/c,isSDF:r}};if(a&&(o.stretchX||o.stretchY)){let e=cq(d,g,m),i=cq(p,y,_);for(let r=0;r<e.length-1;r++){let a=e[r],o=e[r+1];for(let e=0;e<i.length-1;e++)n.push(I(a,i[e],o,i[e+1]))}}else n.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return n}function cZ(e,i,r){let a=0;for(let n of e)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function cq(e,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of e){let e=a[a.length-1];a.push({fixed:i-e.stretch,stretch:e.stretch}),a.push({fixed:i-e.stretch,stretch:e.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}function c$(e,i){return i.max-e.max}cj.loadGlyphRange=function(e,i,r,a,n){let o=256*i;eC(a.transformRequest(a.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${o}-${o+255}`),eE.Glyphs),(e,i)=>{if(e)n(e);else if(i){let e={},r=new cm(i).readFields(c_,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},cj.TinySDF=class{constructor({fontSize:e=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=i,this.cutoff=a,this.radius=r;let l=this.size=e+4*i,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.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){let i=document.createElement("canvas");return i.width=i.height=e,i}draw(e){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),h=Math.min(this.size-this.buffer,s+Math.ceil(a)),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===h)return f;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;m.clearRect(_,_,l,h),m.fillText(e,_,_+s);let x=m.getImageData(_,_,l,h);y.fill(1e20,0,d),g.fill(0,0,d);for(let e=0;e<h;e++)for(let i=0;i<l;i++){let r=x.data[4*(e*l+i)+3]/255;if(0===r)continue;let a=(e+_)*u+i+_;if(1===r)y[a]=0,g[a]=1e20;else{let e=.5-r;y[a]=e>0?e*e:0,g[a]=e<0?e*e:0}}cN(y,0,0,u,c,u,this.f,this.v,this.z),cN(g,_,_,l,h,u,this.f,this.v,this.z);for(let e=0;e<d;e++){let i=Math.sqrt(y[e])-Math.sqrt(g[e]);p[e]=Math.round(255-255*(i/this.radius+this.cutoff))}return f}};class cW{constructor(e,i,r,a){this.p=new T(e,i),this.h=r,this.d=function(e,i){let r=!1,a=1/0;for(let n=0;n<i.length;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[i],l=o[s];n.y>e.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(r=!r),a=Math.min(a,oo(e,n,l))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}let cH=Number.POSITIVE_INFINITY,cX=Math.sqrt(2);function cY(e,[i,r]){let a=0,n=0;if(r===cH){i<0&&(i=0);let r=i/cX;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-i;break;case"top":n=i-7}switch(e){case"top-right":case"bottom-right":a=-r;break;case"top-left":case"bottom-left":a=r;break;case"left":a=i;break;case"right":a=-i}}else{switch(i=Math.abs(i),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}}return[a,n]}function cK(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 cJ(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=function(e,i,r,a,n,o,s,l){let h=[];if(0===i.positionedLines.length)return h;let u=a.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=function(e){let i=e[0],r=e[1],a=i*r;return a>
70?[i,-r]:a<0?[-i,r]:0===i?[r,i]:[r,-i]}(r),d=Math.abs(i.top-i.bottom);for(let e of i.positionedLines)d-=e.lineOffset;let p=i.positionedLines.length,f=d/p,m=i.top-r[1];for(let e=0;e<p;++e){let a=i.positionedLines[e];for(let o of(m=function(e,i,r,a){let n=i+e.positionedLines[a].lineOffset;return 0===a?r+n/2:r+(n+(i+e.positionedLines[a-1].lineOffset))/2}(i,f,m,e),a.positionedGlyphs)){let e,a,d,p;if(!o.rect)continue;let f=o.rect||{},_=4,g=!0,y=1,x=0;if(o.imageName){let e=s[o.imageName];if(!e)continue;if(e.sdf){$("SDF images are not supported in formatted text and will be ignored.");continue}g=!1,_=1/(y=e.pixelRatio)}let v=(n||l)&&o.vertical,b=o.metrics.advance*o.scale/2,w=o.metrics,M=o.rect;if(null===M)continue;l&&i.verticalizable&&(x=o.imageName?b-o.metrics.width*o.scale/2:0);let E=n?[o.x+b,o.y]:[0,0],S=[0,0],A=[0,0],I=!1;n||(v?(A=[o.x+b+c[0],o.y+c[1]-x],I=!0):S=[o.x+b+r[0],o.y+r[1]-x]);let C=M.w*o.scale/(y*(o.localGlyph?2:1)),P=M.h*o.scale/(y*(o.localGlyph?2:1));if(v){let i=o.y-m,r=new T(-b,b-i),n=-Math.PI/2,s=new T(...A);(e=new T(-b+S[0],S[1]))._rotateAround(n,r)._add(s),e.x+=-i+b,e.y-=(w.left-_)*o.scale;let l=o.imageName?w.advance*o.scale:24*o.scale,h=String.fromCodePoint(o.glyph);"︶"===h||"ï¹"===h||"︸"===h||"ï¹"===h||"ï¹"===h||"︾"===h||"︼"===h||"︺"===h||"ï¸"===h||"ï¹"===h||"ï¸"===h||"ï¸"===h||"ï¸"===h||"ï½"===h||"ï¿£"===h||"ï¸"===h||"ï¸"===h?e.x+=(1-_)*o.scale:"︵"===h||"ï¹"===h||"︷"===h||"ï¹"===h||"ï¹"===h||"︽"===h||"︻"===h||"︹"===h||"ï¸"===h||"︿"===h?e.x+=l-w.height*o.scale+(-_-1)*o.scale:e.x+=o.imageName||w.width+2*_===M.w&&w.height+2*_===M.h?(l-P)/2:(l-(w.height+2*_)*o.scale)/2,a=new T(e.x,e.y-C),d=new T(e.x+P,e.y),p=new T(e.x+P,e.y-C)}else{let i=(w.left-_)*o.scale-b+S[0],r=(-w.top-_)*o.scale+S[1],n=i+C,s=r+P;e=new T(i,r),a=new T(n,r),d=new T(i,s),p=new T(n,s)}if(u){let i;i=n?new T(0,0):I?new T(c[0],c[1]):new T(r[0],r[1]),e._rotateAround(u,i),a._rotateAround(u,i),d._rotateAround(u,i),p._rotateAround(u,i)}let z=new T(0,0),D=new T(0,0);h.push({tl:e,tr:a,bl:d,br:p,texPrimary:f,texSecondary:void 0,writingMode:i.writingMode,glyphOffset:E,sectionIndex:o.sectionIndex,isSDF:g,pixelOffsetTL:z,pixelOffsetBR:D,minFontScaleX:0,minFontScaleY:0})}}return h}(0,a,h,o,s,l,n,e.allowVerticalPlacement),v=e.textSizeData,b=null;for(let a of("source"===v.kind?(b=[128*o.layout.get("text-size").evaluate(l,{},g)])[0]>32640&&$(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((b=[128*m.compositeTextSizes[0].evaluate(l,{},g),128*m.compositeTextSizes[1].evaluate(l,{},g)])[0]>32640||b[1]>32640)&&$(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,x,b,h,s,l,c,i,r,u.lineStartIndex,u.lineLength,f,_,g,y,!1),d))p[a]=e.text.placedSymbolArray.length-1;return 4*x.length}function cQ(e){for(let i in e)return e[i];return null}function c0(e,i,r,a,n,o,s,l,h,u){let c=s.top,d=s.bottom,p=s.left,f=s.right,m=s.collisionPadding;if(m&&(p-=m[0],c-=m[1],f+=m[2],d+=m[3]),h){let e=new T(p,c),i=new T(f,c),r=new T(p,d),a=new T(f,d),n=h*M,o=new T(0,0);u&&(o=new T(u[0],u[1])),e._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),a._rotateAround(n,o),p=Math.min(e.x,i.x,r.x,a.x),f=Math.max(e.x,i.x,r.x,a.x),c=Math.min(e.y,i.y,r.y,a.y),d=Math.max(e.y,i.y,r.y,a.y)}return e.emplaceBack(i.x,i.y,i.z,r.x,r.y,p,c,f,d,l,a,n,o),e.length-1}function c1(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);let i=e.bottom-e.top;return i>0?Math.max(10,i):null}function c2(e,i){let r=e.fovAboveCenter,a=e.elevation?e.elevation.getMinElevationBelowMSL()*i:0,n=(e._camera.position[2]*e.worldSize-a)/Math.cos(e._pitch),o=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01));return Math.min(1.01*(Math.sin(e._pitch)*o+n),1/e._horizonShift*n)}function c3(e,i){if(!i.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:i};let r=Math.pow(2,-e.z),a=e.x*r,n=(e.x+1)*r,o=e.y*r,s=(e.y+1)*r,l=nJ(a),h=nJ(n),u=nQ(o),c=nQ(s),d=i.project(l,u),p=i.project(h,u),f=i.project(h,c),m=i.project(l,c),_=Math.min(d.x,p.x,f.x,m.x),g=Math.min(d.y,p.y,f.y,m.y),y=Math.max(d.x,p.x,f.x,m.x),x=Math.max(d.y,p.y,f.y,m.y),v=r/16;function b(e,r,a,n,o,s){let l=(a+o)/2,h=(n+s)/2,u=i.project(nJ(l),nQ(h)),c=Math.max(0,_-u.x,g-u.y,u.x-y,u.y-x);_=Math.min(_,u.x),y=Math.max(y,u.x),g=Math.min(g,u.y),x=Math.max(x,u.y),c>v&&(b(e,u,a,n,l,h),b(u,r,l,h,o,s))}b(d,p,a,o,n,o),b(p,f,n,o,n,s),b(f,m,n,s,a,s),b(m,d,a,s,a,o),_-=v,g-=v,y+=v,x+=v;let w=1/Math.max(y-_,x-g);return{scale:w,x:_*w,y:g*w,x2:y*w,y2:x*w,projection:i}}function c5(e,{x:i,y:r},a=0){return new T(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let c4=e.a6.identity(new Float32Array(16));class c6{constructor(e){this.spec=e,this.name=e.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(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new nU(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r=!0){return e._coordinatePoint(e.locationCoordinate(i),r)}pixelsPerMeter(e,i){return 1/nX(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return c2(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new T(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new T(i,r);if(e.elevation)return e.elevation.pointCoordinate(a);{let i=this.pointCoordinate(e,a.x,a.y,0);return[i.x,i.y,i.z]}}isPointAboveHorizon(e,i){if(e.elevation)return!this.pointCoordinate3D(e,i.x,i.y);let r=e.horizonLineFromTop();return i.y<r}createInversionMatrix(e,i){return c4}createTileMatrix(i,r,a){let n,o,s;let l=a.canonical,h=e.a6.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=c3(l,this);n=1,o=u.x+a.wrap*u.scale,s=u.y,e.a6.scale(h,h,[n/u.scale,n/u.scale,i.pixelsPerMeter/r])}else n=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*a.wrap)*n,s=l.y*n;return e.a6.translate(h,h,[o,s,0]),e.a6.scale(h,h,[n/8192,n/8192,1]),h}upVector(e,i,r){return[0,0,1]}upVectorScale(e,i,r){return{metersToTile:1}}}class c8 extends c6{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];let[i,r]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(i*M);this.n=(a+Math.sin(r*M))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){let{n:r,c:a,r0:n}=this,o=(e-this.center[0])*M,s=Math.sqrt(a-2*r*Math.sin(i*M))/r;return{x:s*Math.sin(o*r),y:s*Math.cos(o*r)-n,z:0}}unproject(e,i){let{n:r,c:a,r0:n}=this,o=n+i,s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*r<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));let l=this.center[0]*M*r,h=P((s=D(s,-Math.PI-l,Math.PI-l))/r*E+this.center[0],-180,180),u=Math.asin(P((a-(e*e+o*o)*r*r)/(2*r),-1,1));return new nU(h,P(u*E,-85.051129,85.051129))}}let c9=Math.sqrt(3)/2;class c7 extends c6{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;let r=Math.asin(c9*Math.sin(i)),a=r*r,n=a*a*a;return{x:.5*(e*Math.cos(r)/(c9*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a)))/M
7ath.PI+.5),y:1-.5*(r*(1.340264+-.081106*a+n*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=r*r,n=a*a*a;for(let e,o,s=0;s<12&&(o=r*(1.340264+-.081106*a+n*(893e-6+.003796*a))-i,n=(a=(r=P(r-(e=o/(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*r)*a*a,!(1e-12>Math.abs(e)));++s);let o=c9*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),s=Math.asin(Math.sin(r)/c9);return new nU(P(180*o/Math.PI,-180,180),P(180*s/Math.PI,-85.051129,85.051129))}}class de extends c6{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){return new nU(360*(e-.5),P(360*(.5-i),-85.051129,85.051129))}}let dt=Math.PI/2;function di(e){return Math.tan((dt+e)/2)}class dr extends c6{constructor(e){super(e),this.center=e.center||[0,30];let[i,r]=this.parallels=e.parallels||[30,30],a=i*M,n=r*M;this.southernCenter=a+n<0,this.southernCenter&&(a=-a,n=-n);let o=Math.cos(a),s=di(a);this.n=a===n?Math.sin(a):Math.log(o/Math.cos(n))/Math.log(di(n)/s),this.f=o*Math.pow(di(a),this.n)/this.n}project(e,i){i*=M,this.southernCenter&&(i=-i),e=(e-this.center[0])*M;let{n:r,f:a}=this;a>0?i<-dt+1e-6&&(i=-dt+1e-6):i>dt-1e-6&&(i=dt-1e-6);let n=a/Math.pow(di(i),r),o=n*Math.sin(r*e),s=a-n*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i);let{n:r,f:a}=this,n=a-(i=(2*(1-i)-.5)*Math.PI),o=Math.sign(n),s=Math.sign(r)*Math.sqrt(e*e+n*n),l=Math.atan2(e,Math.abs(n))*o;n*r<0&&(l-=Math.PI*Math.sign(e)*o);let h=P(l/r*E+this.center[0],-180,180),u=P((2*Math.atan(Math.pow(a/s,1/r))-dt)*E,-85.051129,85.051129);return new nU(h,this.southernCenter?-u:u)}}class da extends c6{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:nY(e),y:nK(i),z:0}}unproject(e,i){return new nU(nJ(e),nQ(i))}}let dn=85.051129*M;class ds extends c6{project(e,i){let r=(i*=M)*i,a=r*r;return{x:.5*((e*=M)*(.8707-.131979*r+a*(a*(.003971*r-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=25,n=0,o=r*r;do{let e=(o=r*r)*o;n=(r*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-i)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),r=P(r-n,-dn,dn)}while(Math.abs(n)>1e-6&&--a>0);return new nU(P(e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))*E,-180,180),r*E)}}let dl=85.051129*M;class dh extends c6{project(e,i){i*=M,e*=M;let r=Math.cos(i),a=Math.acos(r*Math.cos(e/2)),n=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*e+2*r*Math.sin(e/2)/n)||0)/Math.PI+.5),y:1-.5*((.5*(i+Math.sin(i)/n)||0)/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,n=25,o=0,s=0;do{let n=Math.cos(a),l=Math.sin(a),h=2*l*n,u=l*l,c=n*n,d=Math.cos(r/2),p=Math.sin(r/2),f=2*d*p,m=p*p,_=1-c*d*d,g=_?1/_:0,y=_?Math.acos(n*d)*Math.sqrt(1/_):0,x=.5*(2*y*n*p+2*r/Math.PI)-e,v=.5*(y*l+a)-i,b=.5*g*(c*m+y*n*d*u)+1/Math.PI,w=g*(f*h/4-y*l*p),T=.125*g*(h*p-y*l*c*f),M=.5*g*(u*d+y*m*n)+.5,E=w*T-M*b;o=(v*w-x*M)/E,s=(x*T-v*b)/E,r=P(r-o,-Math.PI,Math.PI),a=P(a-s,-dl,dl)}while((Math.abs(o)>1e-6||Math.abs(s)>1e-6)&&--n>0);return new nU(r*E,a*E)}}class du extends c6{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*M)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){let{scale:r,cosPhi:a}=this;return{x:e*M*a*r+.5,y:-Math.sin(i*M)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=P((e-.5)/r*E/a,-180,180),o=Math.asin(P(-(i-.5)/r*a,-1,1));return new nU(n,P(o*E,-85.051129,85.051129))}}class dc extends da{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(i,r,a){let n=lG(i,r,a),o=l$(lB(a));return e.N.transformMat4(n,n,o),{x:n[0],y:n[1],z:n[2]}}locationPoint(i,r){let a=nN(r.lat,r.lng),n=e.N.normalize([],a),o=i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude,s=1/nX(0)*8192*o;e.N.scaleAndAdd(a,a,n,s);let l=e.a6.identity(new Float64Array(16));return e.a6.multiply(l,i.pixelMatrix,i.globeMatrix),e.N.transformMat4(a,a,l),new T(a[0],a[1])}pixelsPerMeter(e,i){return 1/nX(0)*i}pixelSpaceConversion(e,i,r){let a=1/nX(e)*i,n=e4(1/nX(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(i,r,a){let n=lW(lB(a.canonical));return e.a6.multiply(new Float64Array(16),i.globeMatrix,n)}createInversionMatrix(i,r){let{center:a}=i,n=l$(lB(r));return e.a6.rotateY(n,n,a.lng*M),e.a6.rotateX(n,n,a.lat*M),e.a6.scale(n,n,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,i,r,a){return lR(e,i,r,!0)||new n5(0,0)}pointCoordinate3D(e,i,r){let a=this.pointCoordinate(e,i,r,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!lR(e,i.x,i.y,!1)}farthestPixelDistance(i){let r=function(i,r){let a;let n=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=e.N.add([],e.N.scale([],l,-n),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],d=i.width/i.height,p=Math.tan(i.fovAboveCenter),f=e.N.scale([],s.up(),p),m=e.N.scale([],s.right(),p*d),_=e.
7N.normalize([],e.N.add([],e.N.add([],l,f),m)),g=[];if(new lb(h,_).closestPointOnSphere(c,u,g)){let r=e.N.add([],g,c),n=e.N.sub([],r,h);a=Math.cos(i.fovAboveCenter)*e.N.length(n)}else{let i=e.N.sub([],h,c),r=e.N.sub([],c,h);e.N.normalize(r,r);let n=e.N.length(i)-u,o=Math.acos((a=Math.sqrt(n*(n+2*u)))/(u+n))-Math.acos(e.N.dot(l,r));a*=Math.cos(o)}return 1.01*a}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),a=lK(i.zoom);return a>0?e4(r,c2(i,1/nX(i.center.lat)*i.worldSize)+i.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(i.width,i.height)/i.worldSize*Math.PI)),Math.pow(a,10)):r}upVector(e,i,r){return lG(i,r,e,1)}upVectorScale(e){return{metersToTile:lD(lZ(lB(e)))}}}function dd(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new da(e);case"equirectangular":return new de(e);case"naturalEarth":return new ds(e);case"equalEarth":return new c7(e);case"winkelTripel":return new dh(e);case"albers":return r?new du(e):new c8(e);case"lambertConformalConic":return r?new du(e):new dr(e);case"globe":return new dc(e)}throw Error(`Invalid projection name: ${e.name}`)}let dp=hY.types,df=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dm(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;e.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),o,s,(f<<1)+(h?1:0),m,16*u,16*c,256*d,256*p)}function d_(e,i,r){e.emplaceBack(i,r)}function dg(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,s)}function dy(e,i,r,a,n){e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n)}class dx{constructor(e){this.layoutVertexArray=new aI,this.indexArray=new aO,this.programConfigurations=e,this.segments=new a9,this.dynamicLayoutVertexArray=new aM,this.opacityVertexArray=new aP,this.placedSymbolArray=new aJ,this.iconTransitioningVertexArray=new az,this.globeExtVertexArray=new aC,this.zOffsetVertexArray=new aN}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,i,r,a,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uW.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,uX.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,df,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,uK.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,uH.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,uY.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}rI(dx,"SymbolBuffers");class dv{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new a9,this.collisionVertexArray=new ak,this.collisionVertexArrayExt=new aM}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,uJ.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,uQ.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}rI(dv,"CollisionBuffers");class db{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=e.a6.identity([]),this.placementViewportMatrix=e.a6.identity([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=u2(this.zoom,r["text-size"]),this.iconSizeData=u2(this.zoom,r["icon-size"]);let a=this.layers[0].layout,n=a.get("symbol-sort-key"),o=a.get("symbol-z-order");this.canOverlap=a.get("text-allow-overlap")||a.get("icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=a.get("text-writing-mode").map(e=>cx[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=i.sourceID,this.projection=i.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=a.get("symbol-z-elevate")}createArrays(){this.text=new dx(new nP(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new dx(new nP(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new a1,this.lineVertexArray=new a2,this.symbolInstances=new a0}calculateGlyphDependencies(e,i,r,a,n){for(let r=0;r<e.length;r++){let o=e.codePointAt(r);if(void 0===o)break;if(i[o]=!0,a&&n&&o<=65535){let a=u6[e.charAt(r)];a&&(i[a.charCodeAt(0)]=!0)}}}populate(i,r,a,n){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),d=("constant"!==u.value.kind||u.value.value instanceof tx&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),p="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,f=s.get("symbol-sort-key");if(this.features=[],!d&&!p)return;let m=r.iconDependencies,_=r.glyphDependencies,g=r.availableImages,y=new rY(this.zoom);for(let{feature:r,id:u,index:c,sourceLayerIndex:x}of i){let i,v;let b=o._featureFilter.needGeometry,w=n9(r,b);if(!o._featureFilter.filter(y,w,a))continue;if(b||(w.geometry=n8(r,a,n)),l&&1!==r.type&&a.z<=5){let i=w.geometry,r=(i,r)=>{let n=lG(i.x,i.y,a,1),o=lG(r.x,r.y,a,1);return .98078528056>e.N.dot(n,o)};for(let e=0;e<i.length;e++)i[e]=function(e,i){let r=e[0],a=[r];for(let n=1;n<e.length;n++){let o=e[n];(function e(i,r,a,n){if(n(r,a)){let o=r.add(a)._mult(.5);e(i,r,o,n),e(i,o,a,n)}else i.push(a)})(a,r,o,i),r=o}return a}(i[e],r)}if(d){let e=o.getValueAndResolveTokens("text-field",w,a,g),r=tx.factory(e);(function(e){for(let i of e.sections)if(function(e){for(let i of e)if(rB(i.charCodeAt(0)))return!0;return!1}(i.text))return!0;return!1})(r)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===rW()||this.hasRTLText&&rX.isParsed())&&(i=function(e,i,r){return e.sections.forEach(e=>{e.text=function(e,i,r){let a=i.layout.get("text-transform").evaluate(r,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),rX.applyArabicShaping&&(e=rX.applyArabicShaping(e)),e}(e.text,i,r)}),e}(r,o,w))}if(p){let e=o.getValueAndResolveTokens("icon-image",w,a,g);v=e instanceof tv?e:tv.fromString(e)}if(!i&&!v)continue;let T=this.sortFeaturesByKey?f.evaluate(w,{},a):void 0;if(this.features.push({id:u,text:i,icon:v,index:c,sourceLayerIndex:x,geometry:w.geometry,properties:r.properties,type:dp[r.type],sortKey:T}),v&&(m[v.namePrimary]=!0,v.nameSecondary&&(m[v.nameSecondary]=!0)),i){let e=h.evaluate(w,{},a).join(","),r="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let a of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(cx.vertical)>=0,i.sections))if(a.image)m[a.image.namePrimary]=!0;else{let n=rR(i.toString()),o=a.fontStack||e,s=_[o]=_[o]||{};this.calculateGlyphDependencies(a.text,s,r,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(e){let i={},r={},a=[],n=0;function o(i){a.push(e[i]),n++}function s(e,i,n){let o=r[e];return delete r[e],r[i]=o,a[o].geometry[0].pop(),a[o].geometry[0]=a[o].geometry[0].concat(n[0]),o}function l(e,r,n){let o=i[r];return delete i[r],i[e]=o,a[o].geometry[0].shift(),a[o].geometry[0]=n[0].concat(a[o].geometry[0]),o}function h(e,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${e}:${a.x}:${a.y}`}for(let u=0;u<e.length;u++){let c=e[u],d=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}let f=h(p,d),m=h(p,d,!0);if(f in r&&m in i&&r[f]!==i[m]){let e=l(f,m,d),n=s(f,m,a[e].geometry);delete i[f],delete r[m],r[h(p,a[n].geometry,!0)]=n,a[e].geometry=null}else f in r?s(f,m,d):m in i?l(f,m,d):(o(u),i[f]=n-1,r[m]=n-1)}return a.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,i)=>
7e.sortKey-i.sortKey)}update(e,i,r,a,n){let o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;let s=o?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,s,r,a,n),this.icon.programConfigurations.updatePaintArrays(e,i,s,r,a,n)}updateZOffset(){let e=(e,i,a)=>{(r+=i)>e.length&&e.resize(r);for(let n=-i;n<0;n++)e.emplace(n+r,a)},i=(e,i,r)=>{(a+=i)>e.length&&e.resize(a);for(let n=-i;n<0;n++)e.emplace(n+a,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,a=0;for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:s}=a,l=a.zOffset,h=s>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,l),e(this.text.zOffsetVertexArray,o,l)),h){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=a;e>=0&&i(this.icon.zOffsetVertexArray,s,l),r>=0&&i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,l)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,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=dd(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){let r=this.lineVertexArray.length;if(void 0!==e.segment)for(let{x:e,y:r}of i)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=e.indexArray,y=e.layoutVertexArray,x=e.globeExtVertexArray,v=e.segments.prepareSegment(4*i.length,y,g,this.canOverlap?o.sortKey:void 0),b=this.glyphOffsetArray.length,w=v.vertexLength,T=this.allowVerticalPlacement&&s===cx.vertical?Math.PI/2:0,M=o.text&&o.text.sections;for(let a=0;a<i.length;a++){let{tl:n,tr:s,bl:u,br:c,texPrimary:d,texSecondary:b,pixelOffsetTL:w,pixelOffsetBR:E,minFontScaleX:S,minFontScaleY:A,glyphOffset:I,isSDF:C,sectionIndex:P}=i[a],z=v.vertexLength,D=I[1];if(dm(y,h.x,h.y,n.x,D+n.y,d.x,d.y,r,C,w.x,w.y,S,A),dm(y,h.x,h.y,s.x,D+s.y,d.x+d.w,d.y,r,C,E.x,w.y,S,A),dm(y,h.x,h.y,u.x,D+u.y,d.x,d.y+d.h,r,C,w.x,E.y,S,A),dm(y,h.x,h.y,c.x,D+c.y,d.x+d.w,d.y+d.h,r,C,E.x,E.y,S,A),l){let{x:i,y:r,z:a}=l.anchor,[n,o,s]=l.up;dg(x,i,r,a,n,o,s),dg(x,i,r,a,n,o,s),dg(x,i,r,a,n,o,s),dg(x,i,r,a,n,o,s),dy(e.dynamicLayoutVertexArray,i,r,a,T)}else dy(e.dynamicLayoutVertexArray,h.x,h.y,h.z,T);if(_){let i=b||d;d_(e.iconTransitioningVertexArray,i.x,i.y),d_(e.iconTransitioningVertexArray,i.x+i.w,i.y),d_(e.iconTransitioningVertexArray,i.x,i.y+i.h),d_(e.iconTransitioningVertexArray,i.x+i.w,i.y+i.h)}g.emplaceBack(z,z+1,z+2),g.emplaceBack(z+1,z+2,z+3),v.vertexLength+=4,v.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),a!==i.length-1&&P===i[a+1].sectionIndex||e.programConfigurations.populatePaintArrays(y.length,o,o.index,{},p,f,m,M&&M[P])}let E=l?l.anchor:h;e.placedSymbolArray.emplaceBack(E.x,E.y,E.z,h.x,h.y,b,this.glyphOffsetArray.length-b,w,u,c,h.segment,r?r[0]:0,r?r[1]:0,a[0],a[1],s,0,!1,0,d,0)}_commitLayoutVertex(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,i,r,a,n,o,s){let l=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),h=l.vertexLength,u=s.tileAnchorX,c=s.tileAnchorY;for(let e=0;e<4;e++)r.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,e.padding,s.zOffset),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new T(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new T(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new T(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new T(e.x1,e.y2)),l.vertexLength+=4;let d=r.indexArray;d.emplaceBack(h,h+1),d.emplaceBack(h+1,h+2),d.emplaceBack(h+2,h+3),d.emplaceBack(h+3,h),l.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._addCollisionDebugVertices(a,n,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._addCollisionDebugVertices(a,n,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dv(aL,u0.members,az),this.iconCollisionBox=new dv(aL,u0.members,az);let r=u5(this.iconSizeData,e),a=u5(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(a,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(a,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,e,i,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(e,i,r,a){let n=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),o=u3(this.textSizeData,e,n)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=u3(this.iconSizeData,e,a);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,i,r,a){e.emplaceBack(i,-r,-r,a),e.emplaceBack(i,r,-r,a),e.emplaceBack(i,r,r,a),e.emplaceBack(i,-r,r,a)}_updateTextDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}updateCollisionDebugBuffers(e,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let r=u5(this.iconSizeData,e),a=u5(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(a,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._updateTextDebugCollisionBoxes(a,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._updateIconDebugCollisionBoxes(r,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._updateIconDebugCollisionBoxes(r,e,i,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,r,a,n,o,s,l,h){let u={};if(i<r){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(i);u.textBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.textFeatureIndex=f}if(a<n){let{x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(a);u.verticalTextBox={x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalTextFeatureIndex=f}
7if(o<s){let{x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(o);u.iconBox={x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.iconFeatureIndex=f}if(l<h){let{x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(l);u.verticalIconBox={x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalIconFeatureIndex=f}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){let r=e.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;i+=4)e.indexArray.emplaceBack(i,i+1,i+2),e.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(e),r=Math.cos(e),a=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);let s=this.symbolInstances.get(e);a.push(0|Math.round(i*s.tileAnchorX+r*s.tileAnchorY)),n.push(s.featureIndex)}return o.sort((e,i)=>a[e]-a[i]||n[i]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(i);this.featureSortOrder.push(e.featureIndex);let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:l}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}rI(db,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),db.addDynamicAttributes=dy;let dw=new r9({"symbol-placement":new r4(at.layout_symbol["symbol-placement"]),"symbol-spacing":new r4(at.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new r4(at.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new r6(at.layout_symbol["symbol-sort-key"]),"symbol-z-order":new r4(at.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new r4(at.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new r4(at.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new r4(at.layout_symbol["icon-ignore-placement"]),"icon-optional":new r4(at.layout_symbol["icon-optional"]),"icon-rotation-alignment":new r4(at.layout_symbol["icon-rotation-alignment"]),"icon-size":new r6(at.layout_symbol["icon-size"]),"icon-text-fit":new r6(at.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new r6(at.layout_symbol["icon-text-fit-padding"]),"icon-image":new r6(at.layout_symbol["icon-image"]),"icon-rotate":new r6(at.layout_symbol["icon-rotate"]),"icon-padding":new r4(at.layout_symbol["icon-padding"]),"icon-keep-upright":new r4(at.layout_symbol["icon-keep-upright"]),"icon-offset":new r6(at.layout_symbol["icon-offset"]),"icon-anchor":new r6(at.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new r4(at.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new r4(at.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new r4(at.layout_symbol["text-rotation-alignment"]),"text-field":new r6(at.layout_symbol["text-field"]),"text-font":new r6(at.layout_symbol["text-font"]),"text-size":new r6(at.layout_symbol["text-size"]),"text-max-width":new r6(at.layout_symbol["text-max-width"]),"text-line-height":new r6(at.layout_symbol["text-line-height"]),"text-letter-spacing":new r6(at.layout_symbol["text-letter-spacing"]),"text-justify":new r6(at.layout_symbol["text-justify"]),"text-radial-offset":new r6(at.layout_symbol["text-radial-offset"]),"text-variable-anchor":new r4(at.layout_symbol["text-variable-anchor"]),"text-anchor":new r6(at.layout_symbol["text-anchor"]),"text-max-angle":new r4(at.layout_symbol["text-max-angle"]),"text-writing-mode":new r4(at.layout_symbol["text-writing-mode"]),"text-rotate":new r6(at.layout_symbol["text-rotate"]),"text-padding":new r4(at.layout_symbol["text-padding"]),"text-keep-upright":new r4(at.layout_symbol["text-keep-upright"]),"text-transform":new r6(at.layout_symbol["text-transform"]),"text-offset":new r6(at.layout_symbol["text-offset"]),"text-allow-overlap":new r4(at.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new r4(at.layout_symbol["text-ignore-placement"]),"text-optional":new r4(at.layout_symbol["text-optional"]),visibility:new r4(at.layout_symbol.visibility)});var dT={paint:new r9({"icon-opacity":new r6(at.paint_symbol["icon-opacity"]),"icon-emissive-strength":new r6(at.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new r6(at.paint_symbol["text-emissive-strength"]),"icon-color":new r6(at.paint_symbol["icon-color"]),"icon-halo-color":new r6(at.paint_symbol["icon-halo-color"]),"icon-halo-width":new r6(at.paint_symbol["icon-halo-width"]),"icon-halo-blur":new r6(at.paint_symbol["icon-halo-blur"]),"icon-translate":new r4(at.paint_symbol["icon-translate"]),"icon-translate-anchor":new r4(at.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new r6(at.paint_symbol["icon-image-cross-fade"]),"text-opacity":new r6(at.paint_symbol["text-opacity"]),"text-color":new r6(at.paint_symbol["text-color"],{runtimeType:tn,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new r6(at.paint_symbol["text-halo-color"]),"text-halo-width":new r6(at.paint_symbol["text-halo-width"]),"text-halo-blur":new r6(at.paint_symbol["text-halo-blur"]),"text-translate":new r4(at.paint_symbol["text-translate"]),"text-translate-anchor":new r4(at.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new r4(at.paint_symbol["icon-color-saturation"])}),layout:dw};class dM{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:tt,this.defaultValue=e}evaluate(e){if(e.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}rI(dM,"FormatSectionOverride",{omit:["defaultValue"]});class dE extends ap{constructor(e,i,r){super(e,dT,i,r)}recalculate(e,i){super.recalculate(e,i),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let r=this.layout.get("text-writing-mode");if(r){let e=[];for(let i of r)0>e.indexOf(i)&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,i,r,a){var n;let o=this.layout.get(e).evaluate(i,{},r,a),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||rx(s.value)||!o?o:(n=i.properties,o.replace(/{([^{}]+)}/g,(e,i)=>i in n?String(n[i]):""))}createBucket(e){return new db(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let e of dT.paint.overridableProperties){if(!dE.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new ry(new dM(i),i.property.specification,this.scope,this.options),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new rb("source",r):new rw("composite",r,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new r3(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&dE.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=dT.paint.properties[i],n=!1,o=e=>{for(let i of e)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof tx)o(r.value.value.sections);else if("source"===r.value.kind){let e=i=>
7{n||(i instanceof tE&&tT(i.value)===th?o(i.value.sections):i instanceof tC?o(i.sections):i.eachChild(e))},i=r.value;i._styleExpression&&e(i._styleExpression.expression)}return n}getProgramIds(){let e=0!==this.paint.get("icon-opacity").constantOr(1),i=0!==this.paint.get("text-opacity").constantOr(1),r=[];return e&&r.push("symbolIcon"),i&&r.push("symbolSDF"),r}getDefaultProgramParams(e,i){return{config:new nC(this,i),overrideFog:!1}}}let dS=new r9({visibility:new r4(at.layout_background.visibility)});var dA={paint:new r9({"background-color":new r4(at.paint_background["background-color"]),"background-pattern":new r4(at.paint_background["background-pattern"]),"background-opacity":new r4(at.paint_background["background-opacity"]),"background-emissive-strength":new r4(at.paint_background["background-emissive-strength"])}),layout:dS};let dI=new r9({visibility:new r4(at.layout_raster.visibility)});var dC={paint:new r9({"raster-opacity":new r4(at.paint_raster["raster-opacity"]),"raster-color":new r8(at.paint_raster["raster-color"]),"raster-color-mix":new r4(at.paint_raster["raster-color-mix"]),"raster-color-range":new r4(at.paint_raster["raster-color-range"]),"raster-hue-rotate":new r4(at.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new r4(at.paint_raster["raster-brightness-min"]),"raster-brightness-max":new r4(at.paint_raster["raster-brightness-max"]),"raster-saturation":new r4(at.paint_raster["raster-saturation"]),"raster-contrast":new r4(at.paint_raster["raster-contrast"]),"raster-resampling":new r4(at.paint_raster["raster-resampling"]),"raster-fade-duration":new r4(at.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new r4(at.paint_raster["raster-emissive-strength"]),"raster-array-band":new r4(at.paint_raster["raster-array-band"]),"raster-elevation":new r4(at.paint_raster["raster-elevation"])}),layout:dI},dP=ag([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class dz{constructor(e,i,r,a){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this.update(i,a)}update(e,i,r){let{width:a,height:n}=e,{context:o}=this,{gl:s}=o;if(s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!i||!1!==i.premultiply)),r||this.size&&this.size[0]===a&&this.size[1]===n){let{x:i,y:o}=r||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)s.texSubImage2D(s.TEXTURE_2D,0,i,o,s.RGBA,s.UNSIGNED_BYTE,e);else{let r=this.format,l=s.UNSIGNED_BYTE;this.format===s.R32F&&(r=s.RED,l=s.FLOAT),s.texSubImage2D(s.TEXTURE_2D,0,i,o,a,n,r,l,e.data)}}else if(this.size=[a,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let i=this.format;this.format===s.R8&&(i=s.RED),s.texImage2D(s.TEXTURE_2D,0,this.format,i,s.UNSIGNED_BYTE,e)}else{let i=this.format,r=this.format,o=s.UNSIGNED_BYTE;this.format===s.DEPTH_COMPONENT&&(i=s.DEPTH_COMPONENT16,o=s.UNSIGNED_SHORT),this.format===s.R8&&(r=s.RED),this.format===s.R32F&&(o=s.FLOAT,r=s.RED),s.texImage2D(s.TEXTURE_2D,0,i,a,n,0,r,o,e.data)}this.useMipmap=!!(i&&i.useMipmap),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(e,i,r=!1){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,a){let{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),a!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class dD{constructor(e,i){this.context=e,this.texture=i}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function dL(i,r,a,n,o,s,l,h){let u=[i,r,1,a,n,1,o,s,1],c=[l,h,1],d=e.co.adjoint([],u),[p,f,m]=e.N.transformMat3(c,c,d);return e.co.multiply(u,u,[p,0,0,0,f,0,0,0,m])}function dR(i,r,a,n,o,s,l,h){let u=function(i,r,a,n,o,s,l,h){let u=dL(0,0,1,0,1,1,0,1),c=dL(i,r,a,n,o,s,l,h),d=e.co.adjoint([],u);return e.co.multiply(c,c,d)}(i,r,a,n,o,s,l,h);return[u[2]/u[8]/8192,u[5]/u[8]/8192]}function dk(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class dO extends eJ{constructor(e,i,r,a){super(),this.id=e,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(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new eY("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ez(this.map._requestManager.transformRequest(this.url,eE.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new eK(i)):r&&(this.image=r instanceof HTMLImageElement?eh.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new dD(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new eY("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof dD||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],r=e[0][1];for(let a of e)a[1]>r&&(r=a[1]),a[1]<i&&(i=a[1]);let a=(r+i)/2;if(a>85.051129?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let i=e.map(n5.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;
7for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);let o=Math.max(0,Math.floor(-Math.log(Math.max(a-i,n-r))/Math.LN2)),s=Math.pow(2,o),l=Math.floor((i+a)/2*s);return l>1&&(l-=1),new nZ(o,l,Math.floor((r+n)/2*s))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new eY("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(i){var r;for(let e in this.tiles){let i=this.tiles[e];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let a=c3(new nZ(0,0,0),this.map.transform.projection),n=[a.projection.project(this.coordinates[0][0],this.coordinates[0][1]),a.projection.project(this.coordinates[1][0],this.coordinates[1][1]),a.projection.project(this.coordinates[2][0],this.coordinates[2][1]),a.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){let i=e[1].x-e[0].x,r=e[1].y-e[0].y,a=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,l=e[0].x-e[3].x,h=e[0].y-e[3].y,u=i*n-a*r,c=a*s-o*n,d=o*h-l*s,p=l*r-i*h;return u>0&&c>0&&d>0&&p>0||u<0&&c<0&&d<0&&p<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let o=c3(this.tileID,this.map.transform.projection),[s,l,h,u]=this.coordinates.map(e=>{let i=o.projection.project(e[0],e[1]);return c5(o,i)._round()});this.perspectiveTransform=dR(s.x,s.y,l.x,l.y,h.x,h.y,u.x,u.y);let c=this._boundsArray=new ab;c.emplaceBack(s.x,s.y,0,0),c.emplaceBack(l.x,l.y,8192,0),c.emplaceBack(u.x,u.y,0,8192),c.emplaceBack(h.x,h.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=i.createVertexBuffer(c,dP.members),this.boundsSegments=a9.simpleSegment(0,0,4,2);let d=[],[p,f,m,_]=function(e){let i=e[0][0],r=i,a=e[0][1],n=a;for(let o=1;o<e.length;o++)e[o][0]<i?i=e[o][0]:e[o][0]>r&&(r=e[o][0]),e[o][1]<a?a=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[i,a,r-i,n-a]}([dk((r=this.coordinates)[0]),dk(r[1]),dk(r[2]),dk(r[3])]);{let r=new ab,[o,s,l,h]=function(e){let i=e[0].x,r=i,a=e[0].y,n=a;for(let o=1;o<e.length;o++)e[o].x<i?i=e[o].x:e[o].x>r&&(r=e[o].x),e[o].y<a?a=e[o].y:e[o].y>n&&(n=e[o].y);return[i,a,r-i,n-a]}(n),u=e=>[(e.x-o)/l,(e.y-s)/h],[c,g,y,x]=n.map(u),v=function(i,r,a,n,o,s,l,h){let u=dL(0,0,1,0,1,1,0,1),c=dL(i,r,a,n,o,s,l,h),d=e.co.adjoint([],c);return e.co.multiply(u,u,d)}(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=dR(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);let b=(i,a)=>{d.push(i.lng);let n=Math.round((i.lng-p)/m*8192),o=Math.round((i.lat-f)/_*8192),s=u(a),l=e.N.transformMat3([],[s[0],s[1],1],v),h=Math.round(l[0]/l[2]*8192),c=Math.round(l[1]/l[2]*8192);r.emplaceBack(n,o,h,c)},w=n[3].x-n[0].x,T=n[3].y-n[0].y,M=n[2].x-n[1].x,E=n[2].y-n[1].y;for(let e=0;e<65;e++){let i=e/64,r=[n[0].x+i*w,n[0].y+i*T],o=[n[1].x+i*M,n[1].y+i*E],s=o[0]-r[0],l=o[1]-r[1];for(let e=0;e<65;e++){let i=e/64,n={x:r[0]+s*i,y:r[1]+l*i,z:0};b(a.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=i.createVertexBuffer(r,dP.members)}{this.maxLongitudeTriangleSize=0;let e=[],r=new aO,a=(i,a,n)=>{r.emplaceBack(i,a,n);let o=d[i],s=d[a],l=d[n],h=Math.min(Math.min(o,s),l),u=Math.max(Math.max(o,s),l)-h;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),e.push(h+u/2)};for(let e=0;e<64;e++)for(let i=0;i<64;i++){let r=65*e+i,n=r+1,o=r+65,s=o+1;a(r,o,n),a(n,o,s)}[e,r]=function(e,i){let r=Array.from({length:e.length},(e,i)=>i);r.sort((i,r)=>e[i]-e[r]);let a=[],n=new aO;for(let o=0;o<r.length;o++){let s=r[o];a.push(e[s]);let l=3*s,h=l+1;n.emplaceBack(i.uint16[l],i.uint16[h],i.uint16[h+1])}return[a,n]}(e,r),this.elevatedGlobeTrianglesCenterLongitudes=e,this.elevatedGlobeIndexBuffer=i.createIndexBuffer(r)}this.elevatedGlobeSegments=a9.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/8192,0,_/8192,0,0,f,p,0])}prepare(){let e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;let i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof dD||(this.texture?this.texture.update(this.image):(this.texture=new dz(i,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored",i(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){let i;let r=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!r)return null;let a=this.elevatedGlobeTrianglesCenterLongitudes,n=(i=e+180)+360*Math.round((a[0]-i)/360),o=new a9,s=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:r.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},l=.51*this.maxLongitudeTriangleSize;if(Math.abs(a[0]-n)<=l){let e=es(a,0,a.length,n+l);return e===a.length||s(e,eo(a,e+1,a.length,n+360-l)-e),o}n<a[0]&&(n+=360);let h=eo(a,0,a.length,n-l);if(h===a.length)return s(0,a.length),o;s(0,h-0);let u=es(a,h+1,a.length,n+l);return u!==a.length&&s(u,a.length-u),o}}class dB extends ap{constructor(e,i,r){super(e,dC,i,r),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isLayerDraped(e){return!(e&&e._source instanceof dO&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}
7updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;let i=this._transitionablePaint._values["raster-color"].value.expression,[r,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(a)||r===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=hs({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,a])}}let dF=new r9({visibility:new r4(at["layout_raster-particle"].visibility)});var dN={paint:new r9({"raster-particle-array-band":new r4(at["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new r4(at["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new r8(at["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new r4(at["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new r4(at["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new r4(at["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new r4(at["paint_raster-particle"]["raster-particle-reset-rate-factor"])}),layout:dF};class dV extends ap{constructor(e,i,r){super(e,dN,i,r),this._updateColorRamp(),this.onRemove=e=>{this.colorRampTexture&&this.colorRampTexture.destroy(),this.transformFeedbackObject&&e.painter.context.gl.deleteTransformFeedback(this.transformFeedbackObject),this.tileFramebuffer&&this.tileFramebuffer.destroy()},this.lastInvalidatedAt=eh.now()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isLayerDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=hs({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=eh.now()}}class dU extends ap{constructor(e,i){super(e,{},i),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isLayerDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}let dj=new r9({visibility:new r4(at.layout_sky.visibility)});var dG={paint:new r9({"sky-type":new r4(at.paint_sky["sky-type"]),"sky-atmosphere-sun":new r4(at.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new r4(at.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new r4(at.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new r4(at.paint_sky["sky-gradient-radius"]),"sky-gradient":new r8(at.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new r4(at.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new r4(at.paint_sky["sky-atmosphere-color"]),"sky-opacity":new r4(at.paint_sky["sky-opacity"])}),layout:dj};function dZ(i,r,a){let n=[0,0,1],o=e.bi.identity([]);return e.bi.rotateY(o,o,a?-(i*M)+Math.PI:i*M),e.bi.rotateX(o,o,-(r*M)),e.N.transformQuat(n,n,o),e.N.normalize(n,n)}var dq={paint:new r9({})};function d$(i,r){let a=dH(i.projection,i.zoom,i.width,i.height),n=function(i,r,a,n,o){let s=new nU(a.lng-180*
7dX,a.lat),l=new nU(a.lng+180*dX,a.lat),h=i.project(s.lng,s.lat),u=i.project(l.lng,l.lat),c=-Math.atan2(u.y-h.y,u.x-h.x),d=n5.fromLngLat(a);d.y=P(d.y,-1+dX,1-dX);let p=d.toLngLat(),f=i.project(p.lng,p.lat),m=n5.fromLngLat(p);m.x+=dX;let _=m.toLngLat(),g=i.project(_.lng,_.lat),y=dK(g.x-f.x,g.y-f.y,c),x=n5.fromLngLat(p);x.y+=dX;let v=x.toLngLat(),b=i.project(v.lng,v.lat),w=dK(b.x-f.x,b.y-f.y,c),T=Math.abs(y.x)/Math.abs(w.y),M=e.a6.identity([]);e.a6.rotateZ(M,M,-c*(1-(o?0:n)));let E=e.a6.identity([]);return e.a6.scale(E,E,[1,1-(1-T)*n,1]),E[4]=-w.x/w.y*n,e.a6.rotateZ(E,E,c),e.a6.multiply(E,M,E),E}(i.projection,0,i.center,a,r),o=dW(i);return e.a6.scale(n,n,[o,o,1]),n}function dW(e){let i=e.projection,r=dH(e.projection,e.zoom,e.width,e.height);return Math.pow(2,dY(i,e.center)*r+(1-r)*dY(i,nU.convert(i.center)))}function dH(e,i,r,a,n=1/0){let o=e.range;if(!o)return 0;let s=Math.log(Math.min(n,Math.max(r,a))/1024)/Math.LN2;return z(o[0]+s,o[1]+s,i)}let dX=1/4e4;function dY(e,i){let r=P(i.lat,-85.051129,85.051129),a=new nU(i.lng-180*dX,r),n=new nU(i.lng+180*dX,r),o=e.project(a.lng,r),s=e.project(n.lng,r),l=n5.fromLngLat(a),h=n5.fromLngLat(n),u=s.x-o.x,c=s.y-o.y,d=h.x-l.x,p=h.y-l.y;return Math.log(Math.sqrt((d*d+p*p)/(u*u+c*c)))/Math.LN2}function dK(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function dJ(i,r,a){e.a6.identity(i),e.a6.rotateZ(i,i,r[2]*M),e.a6.rotateX(i,i,r[0]*M),e.a6.rotateY(i,i,r[1]*M),e.a6.scale(i,i,a),e.a6.multiply(i,i,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function dQ(i,r,a,n,o,s,l,h){let u=[a[0]-r[0],a[1]-r[1],0],c=[n[0]-r[0],n[1]-r[1],0];if(1e-12>e.N.length(u)||1e-12>e.N.length(c))return e.bi.identity(i);let d=e.N.cross([],u,c);return e.N.normalize(d,d),e.N.subtract(c,n,r),u[2]=(s-o)*h,c[2]=(l-o)*h,e.N.cross(u,u,c),e.N.normalize(u,u),e.bi.rotationTo(i,d,u)}function d0(i,r,a=!1){let n=lK(r.zoom),o=function(i,r,a){let n=r.worldSize,o=[i[12],i[13],i[14]],s=nQ(o[1]/n),l=nJ(o[0]/n),h=e.a6.identity([]),u=1/nX(s)*n,c=1/nX(0)*n*n1(s,r.zoom),d=1/lH(n),p=c*d;if(a){let e=dH(r.projection,r.zoom,r.width,r.height,1024);p=d*r.projection.pixelSpaceConversion(r.center.lat,n,e)}let f=nN(s,l);e.N.add(f,f,e.N.scale([],e.N.normalize([],f),u*p*o[2]));let m=function(i){let r=[i[0],i[1],i[2]],a=[0,1,0],n=e.N.cross([],a,r);return e.N.cross(a,r,n),0===e.N.squaredLength(a)&&(a=[0,1,0],e.N.cross(n,r,a)),e.N.normalize(n,n),e.N.normalize(a,a),e.N.normalize(r,r),[n[0],n[1],n[2],0,a[0],a[1],a[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],1]}(f);e.a6.scale(h,h,[p,p,p*u]),e.a6.translate(h,h,[-o[0],-o[1],-o[2]]);let _=e.a6.multiply([],r.globeMatrix,m);return e.a6.multiply(_,_,h),e.a6.multiply(_,_,i),_}(i,r,a);return n>0?function(i,r,a){let n=(i,r,a)=>{let n=e.N.length(i),o=e.N.length(r),s=lF(i,r,a);return e.N.scale(s,s,1/e.N.length(s)*e4(n,o,a))},o=n([i[0],i[1],i[2]],[r[0],r[1],r[2]],a),s=n([i[4],i[5],i[6]],[r[4],r[5],r[6]],a),l=n([i[8],i[9],i[10]],[r[8],r[9],r[10]],a),h=lF([i[12],i[13],i[14]],[r[12],r[13],r[14]],a);return[o[0],o[1],o[2],0,s[0],s[1],s[2],0,l[0],l[1],l[2],0,h[0],h[1],h[2],1]}(o,function(i,r){let a=r.worldSize,n=1/nX(0)*a*n1(r.center.lat,r.zoom)/lH(a),o=1/nX(r.center.lat)*a,s=e.a6.identity([]);return e.a6.rotateY(s,s,r.center.lng*M),e.a6.rotateX(s,s,r.center.lat*M),e.a6.translate(s,s,[0,0,nk]),e.a6.scale(s,s,[n,n,n*o]),e.a6.translate(s,s,[r.point.x-.5*a,r.point.y-.5*a,0]),e.a6.multiply(s,s,i),e.a6.multiply(s,r.globeMatrix,s)}(i,r),n):o}function d1(e,i,r,a){let n;let o=lI.projectAabbCorners(a,r),s=Number.MAX_VALUE,l=-1;for(let e=0;e<o.length;++e){let r=o[e];r[0]=(.5*r[0]+.5)*i.width,r[1]=(.5-.5*r[1])*i.height,r[2]<s&&(l=e,s=r[2])}let h=e=>new T(o[e][0],o[e][1]);switch(l){case 0:case 6:n=[h(1),h(5),h(4),h(7),h(3),h(2),h(1)];break;case 1:case 7:n=[h(0),h(4),h(5),h(6),h(2),h(3),h(0)];break;case 3:case 5:n=[h(1),h(0),h(4),h(7),h(6),h(2),h(1)];break;default:n=[h(1),h(5),h(6),h(7),h(3),h(0),h(1)]}if(oi(e,n))return s}let d2=ag([{name:"a_pos_3f",components:3,type:"Float32"}]),d3=ag([{name:"a_color_3f",components:3,type:"Float32"}]),d5=ag([{name:"a_color_4f",components:4,type:"Float32"}]),d4=ag([{name:"a_uv_2f",components:2,type:"Float32"}]),d6=ag([{name:"a_normal_3f",components:3,type:"Float32"}]),d8=ag([{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"}]),d9=ag([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class d7{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class pe{constructor(){this.instancedDataArray=new a$,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class pt{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0}}populate(e,i,r,a){this.tileToMeter=n3(r);let n=this.layers[0]._featureFilter.needGeometry;for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.lookup=new Uint8Array(this.lookupDim*this.lookupDim),e)){let e=n9(o,n);if(!this.layers[0]._featureFilter.filter(new rY(this.zoom),e,r))continue;let u={id:s,sourceLayerIndex:h,index:l,geometry:n?e.geometry:n8(o,r,a),properties:o.properties,type:o.type,patterns:{}},c=this.addFeature(u,u.geometry,e);c&&i.featureIndex.insert(o,u.geometry,l,h,this.index,this.instancesPerModel[c].instancedDataArray.length,256)}this.lookup=null}update(e,i,r,a){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i in e)r.idToFeaturesIndex.hasOwnProperty(i)&&this.evaluate(r.features[r.idToFeaturesIndex[i]],e[i],r,!0)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let i=!1;for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r of a.features){let n=this.layers[0],o=r.feature,s=this.canonical,l=n.paint.get("model-rotation").evaluate(o,{},s),h=n.paint.get("model-scale").evaluate(o,{},s),u=n.paint.get("model-translation").evaluate(o,{},s);e.N.exactEquals(r.rotation,l)&&e.N.exactEquals(r.scale,h)&&e.N.exactEquals(r.translation,u)||(this.evaluate(r,r.featureStates,a,!0),i=!0)}}return i}isEmpty(){for(let e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.
7instancedDataArray,d8.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(let e in this.instancesPerModel){let i=this.instancesPerModel[e];0!==i.instancedDataArray.length&&i.instancedDataBuffer&&i.instancedDataBuffer.destroy()}}addFeature(e,i,r){let a=this.layers[0],n=a.layout.get("model-id").evaluate(r,{},this.canonical);if(!n)return $(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),n;this.instancesPerModel[n]||(this.instancesPerModel[n]=new pe);let o=this.instancesPerModel[n],s=o.instancedDataArray,l=new d7(r,s.length);for(let e of i)for(let i of e){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;let e=(this.lookupDim-1)/8192,r=this.lookupDim*(i.y*e|0)+i.x*e|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}this.instanceCount++;let a=s.length;s.resize(a+1),o.instancesEvaluatedElevation.push(0),s.float32[16*a]=i.x,s.float32[16*a+1]=i.y}return l.instancedDataCount=o.instancedDataArray.length-l.instancedDataOffset,l.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(l),this.evaluate(l,{},o,!1)),n}evaluate(e,i,r,a){let n=this.layers[0],o=e.feature,s=this.canonical,l=e.rotation=n.paint.get("model-rotation").evaluate(o,i,s),h=e.scale=n.paint.get("model-scale").evaluate(o,i,s),u=e.translation=n.paint.get("model-translation").evaluate(o,i,s),c=n.paint.get("model-color").evaluate(o,i,s);c.a=n.paint.get("model-color-mix-intensity").evaluate(o,i,s);let d=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]),this.maxScale=Math.max(Math.max(this.maxScale,h[0]),Math.max(h[1],h[2])),dJ(d,l,h);let p=Math.round(100*c.a)+c.b/1.05;for(let i=0;i<e.instancedDataCount;++i){let n=e.instancedDataOffset+i,o=16*n,l=r.instancedDataArray.float32,h=0;a&&(h=l[o+6]-r.instancesEvaluatedElevation[n]);let f=0|l[o+1];l[o]=(0|l[o])+c.r/1.05,l[o+1]=f+c.g/1.05,l[o+2]=p,l[o+3]=1/(s.z>10?this.tileToMeter:n3(s,f)),l[o+4]=u[0],l[o+5]=u[1],l[o+6]=u[2]+h,l[o+7]=d[0],l[o+8]=d[1],l[o+9]=d[2],l[o+10]=d[4],l[o+11]=d[5],l[o+12]=d[6],l[o+13]=d[8],l[o+14]=d[9],l[o+15]=d[10],r.instancesEvaluatedElevation[n]=u[2]}}}rI(pt,"ModelBucket",{omit:["layers"]}),rI(pe,"PerModelAttributes"),rI(d7,"ModelFeature");let pi=new r9({visibility:new r4(at.layout_model.visibility),"model-id":new r6(at.layout_model["model-id"])});var pr={paint:new r9({"model-opacity":new r4(at.paint_model["model-opacity"]),"model-rotation":new r6(at.paint_model["model-rotation"]),"model-scale":new r6(at.paint_model["model-scale"]),"model-translation":new r6(at.paint_model["model-translation"]),"model-color":new r6(at.paint_model["model-color"]),"model-color-mix-intensity":new r6(at.paint_model["model-color-mix-intensity"]),"model-type":new r4(at.paint_model["model-type"]),"model-cast-shadows":new r4(at.paint_model["model-cast-shadows"]),"model-receive-shadows":new r4(at.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new r4(at.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new r6(at.paint_model["model-emissive-strength"]),"model-roughness":new r6(at.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new r6(at.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new r4(at.paint_model["model-cutoff-fade-range"])}),layout:pi};
7let pa={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function pn(i,r,a,n,o,s,l,h,u,c=!1){let d=a.zoom,p=a.project(n),f=n1(n.lat,d),m=1/f;e.a6.identity(i),e.a6.translate(i,i,[p.x+l[0]*m,p.y+l[1]*m,l[2]]);let _=1,g=1,y=a.worldSize;if(c){if("mercator"===a.projection.name){let i=0;a.elevation&&(i=a.elevation.getAtPointOrZero(new n5(p.x/y,p.y/y),0));let r=e.a7.transformMat4([],[p.x,p.y,i,1],a.projMatrix)[3]/a.cameraToCenterDistance;_=r,g=r*n1(a.center.lat,d)}else if("globe"===a.projection.name){let r=d0(i,a),o=e.a6.multiply([],a.projMatrix,r),s=[0,0,0,1];e.a7.transformMat4(s,s,o);let l=s[3]/a.cameraToCenterDistance,h=lK(d),u=a.projection.pixelsPerMeter(n.lat,y)*n1(n.lat,d),c=a.projection.pixelsPerMeter(a.center.lat,y)*n1(a.center.lat,d);_=l/e4(u,n0(a.center.lat),h),g=l*f/u,_*=c,g*=c}}else _=m;e.a6.scale(i,i,[_,_,g]);let x=[...i],v=r.orientation,b=[];if(dJ(b,[v[0]+o[0],v[1]+o[1],v[2]+o[2]],s),e.a6.multiply(i,x,b),h&&a.elevation){let o=0,s=[];if(u&&a.elevation){o=function(i,r,a,n,o){let s=r.elevation;if(!s)return 0;let l=lI.projectAabbCorners(a,n),h=1/nX(o.lat)*r.worldSize,u=function(i,r){let a=[0,0,1],n=[{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(let o of n){let n=i[o.corners[0]],s=i[o.corners[1]],l=i[o.corners[2]],h=[s[0]-n[0],s[1]-n[1],r*(s[2]-n[2])],u=e.N.cross(h,h,[l[0]-n[0],l[1]-n[1],r*(l[2]-n[2])]);e.N.normalize(u,u),o.dotProductWithUp=e.N.dot(u,a)}return n.sort((e,i)=>e.dotProductWithUp-i.dotProductWithUp),n[0].corners}(l,h),c=l[u[0]],d=l[u[1]],p=l[u[2]],f=l[u[3]],m=s.getAtPointOrZero(new n5(c[0]/r.worldSize,c[1]/r.worldSize),0),_=s.getAtPointOrZero(new n5(d[0]/r.worldSize,d[1]/r.worldSize),0),g=s.getAtPointOrZero(new n5(p[0]/r.worldSize,p[1]/r.worldSize),0),y=s.getAtPointOrZero(new n5(f[0]/r.worldSize,f[1]/r.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?dQ(i,d,f,c,_,y,m,h):dQ(i,p,c,f,g,m,y,h):m<y?dQ(i,c,d,p,m,_,g,h):dQ(i,f,p,d,y,g,_,h),Math.max(x,v)}(s,a,r.aabb,i,n);let l=e.a6.fromQuat([],s),h=e.a6.multiply([],l,b);e.a6.multiply(i,x,h)}else o=a.elevation.getAtPointOrZero(new n5(p.x/y,p.y/y),0);0!==o&&(i[14]+=o)}}function po(e,i,r=!1){e.uploaded||(e.gfxTexture=new dz(i,e.image,r?i.gl.R8:i.gl.RGBA,{useMipmap:e.sampler.minFilter>=i.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function ps(e,i,r){if(e.meshes)for(let a of e.meshes)!function(e,i,r){e.indexBuffer=i.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=i.createVertexBuffer(e.vertexArray,d2.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,d6.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,d4.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?d3:d5).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,d9.members,!0)),e.segments=a9.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&po(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&po(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&po(a.normalTexture,i),a.occlusionTexture&&po(a.occlusionTexture,i,r),a.emissionTexture&&po(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)ps(a,i,r)}function pl(e){if(e.meshes)for(let i of e.meshes)i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy();if(e.children)for(let i of e.children)pl(i)}function ph(e){var i;if(e.meshes)for(let r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.n
7ormalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((i=r.material).pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),i.pbrMetallicRoughness.metallicRoughnessTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),i.normalTexture&&i.normalTexture.gfxTexture&&i.normalTexture.gfxTexture.destroy(),i.emissionTexture&&i.emissionTexture.gfxTexture&&i.emissionTexture.gfxTexture.destroy(),i.occlusionTexture&&i.occlusionTexture.gfxTexture&&i.occlusionTexture.gfxTexture.destroy()));if(e.children)for(let i of e.children)ph(i)}class pu{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class pc{constructor(){this.tasks={},this.taskQueue=[],V(["process"],this),this.invoker=new pu(this.process),this.nextId=0}add(e,i){let r=this.nextId++,a=function({type:e,isSymbolTile:i,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||i?"parseTile"!==e||i?"parseTile"===e&&i?300-r:"maybePrepare"===e&&i?400-r:500:200-r:100-r}(i);return 0===a?(X(),e(),null):(this.tasks[r]={fn:e,metadata:i,priority:a,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}})}process(){X();{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;let e=this.pick();if(null===e)return;let i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let r=0;r<this.taskQueue.length;r++){let a=this.tasks[this.taskQueue[r]];a.priority<i&&(i=a.priority,e=r)}if(null===e)return null;let r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class pd{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},V(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new pc}send(e,i,r,a,n=!1,o){let s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=o,this.callbacks[s]=r);let l=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!r,targetMapId:a,mustQueue:n,sourceMapId:this.mapId,data:rz(i,l)},l),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){let i=e.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId)){if("<cancel>"===i.type){let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(i.mustQueue||X()){let e=this.callbacks[r],a=this.scheduler.add(()=>this.processTask(r,i),e&&e.metadata||{type:"message"});a&&(this.cancelCallbacks[r]=a)}else this.processTask(r,i)}}processTask(e,i){if(delete this.cancelCallbacks[e],"<response>"===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(rD(i.error)):r(null,rD(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:i?rz(i):null,data:rz(a,r)},r)}:e=>{},n=rD(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,n,a);else if(this.parent.getWorkerSource){let e=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,e[0],n.source,n.scope)[e[1]](n,a)}else a(Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class pp{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=O();let r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){let a=new pp.Actor(r[e],i,this.id);a.name=`Worker ${e}`,this.actors.push(a)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){L(this.actors,(r,a)=>{r.send(e,i,a)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
7remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}pp.Actor=pd;var pf={workerUrl:"",workerClass:null,workerParams:void 0};function pm(){return null!=pf.workerClass?new pf.workerClass:new self.Worker(pf.workerUrl,pf.workerParams)}let p_="mapboxgl_preloaded_worker_pool";class pg{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<pg.workerCount;)this.workers.push(new pm);return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[p_]}numActive(){return Object.keys(this.active).length}}function py(){return l||(l=new pg),l}pg.workerCount=2;let px,pv,pb,pw,pT,pM=null;function pE(){return X()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:pv||c.DRACO_URL}function pS(){if(X()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(pw)return pw;let e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return pw=WebAssembly.validate(e)?c.MESHOPT_SIMD_URL:c.MESHOPT_URL}let pA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},pI={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},pC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function pP(e,i,r){let a=r.json.bufferViews.length,n=r.buffers.length;i.bufferView=a,r.json.bufferViews[a]={buffer:n,byteLength:e.byteLength},r.buffers[n]=e}let pz="KHR_draco_mesh_compression",pD="EXT_meshopt_compression",pL=new TextDecoder("utf8");function pR(e,i){return new URL(e,i).href}function pk(e,i){let r=e.json.bufferViews[i];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function pO(e,i=0,r){let a={json:null,images:[],buffers:[]};if(1179937895===new Uint32Array(e,i,1)[0]){let r=new Uint32Array(e,i),n=2,o=(r[n++]>>2)-3,s=r[n++]>>2;if(n++,a.json=JSON.parse(pL.decode(r.subarray(n,n+s))),(n+=s)<o){let o=r[n++],s=i+(++n<<2);a.buffers[0]=e.slice(s,s+o)}}else a.json=JSON.parse(pL.decode(new Uint8Array(e,i)));let{buffers:n,images:o,meshes:s,extensionsUsed:l,bufferViews:h}=a.json,u=Promise.resolve();if(n){let e=[];for(let i=0;i<n.length;i++){let o=n[i];o.uri?e.push(function(e,i,r,a){return fetch(pR(e.uri,a)).then(e=>e.arrayBuffer()).then(e=>{i.buffers[r]=e})}(o,a,i,r)):a.buffers[i]||(a.buffers[i]=null)}u=Promise.all(e)}return u.then(()=>{let e=[],i=l&&l.includes(pz),n=l&&l.includes(pD);if(i&&e.push(function(){if(!pb)return px||(px=function(e){let i,r=null;function a(){i=new Uint8Array(r.buffer)}function n(){throw Error("Unexpected Draco error.")}let o={a:{a:n,d:function(e,r,a){return i.copyWithin(e,r,r+a)},c:function(e){let n=i.length,o=Math.max(e>>>0,Math.ceil(1.2*n));try{return r.grow(Math.ceil((o-n)/65536)),a(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o))).then(e=>{let n,o,s,l;let{Rb:h,Qb:u,P:c,T:d,X:p,Ja:f,La:m,Qa:_,Va:g,Wa:y,eb:x,jb:v,f:b,e:w,yb:T,zb:M,Ab:E,Bb:S,Db:A,Gb:I}=e.instance.exports;r=w;let C=(n=0,o=0,s=0,l=0,e=>{s&&(h(l),h(n),o+=s,s=n=0),n||(o+=128,n=u(o));let r=e.length+7&-8,a=n;r>=o&&(s=r,a=l=u(r));for(let r=0;r<e.length;r++)i[a+r]=e[r];return a});return a(),b(),{memory:w,_free:h,_malloc:u,Mesh:class{constructor(){this.ptr=c()}destroy(){d(this.ptr)}},Decoder:class{constructor(){this.ptr=f()}destroy(){v(this.ptr)}DecodeArrayToMesh(e,i,r){let a=C(e);return!!p(m(this.ptr,a,i,r.ptr))}GetAttributeByUniqueId(e,i){return{ptr:_(this.ptr,e.ptr,i)}}GetTrianglesUInt16Array(e,i,r){g(this.ptr,e.ptr,i,r)}GetTrianglesUInt32Array(e,i,r){y(this.ptr,e.ptr,i,r)}GetAttributeDataArrayForAllPoints(e,i,r,a,n){x(this.ptr,e.ptr,i.ptr,r,a,n)}},DT_INT8:T(),DT_UINT8:M(),DT_INT16:E(),DT_UINT16:S(),DT_UINT32:A(),DT_FLOAT32:I()}})}(fetch(pE()))).then(e=>{pb=e,px=void 0})}()),n&&e.push(function(){if(pT)return;let e=function(e){let i;let r=WebAssembly.instantiateStreaming(e,{}).then(e=>{(i=e.instance).exports.__wasm_call_ctors()}),a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,l,h){!function(e,i,r,a,n,o,s){let l=e.exp
7orts.sbrk,h=a+3&-4,u=l(h*n),c=l(o.length),d=new Uint8Array(e.exports.memory.buffer);d.set(o,c);let p=i(u,a,n,c,o.length);if(0===p&&s&&s(u,h,n),r.set(d.subarray(u,u+a*n)),l(u-l(0)),0!==p)throw Error(`Malformed buffer data: ${p}`)}(i,i.exports[n[l]],e,r,o,s,i.exports[a[h]])}}}(fetch(pS()));return e.ready.then(()=>{pT=e})}()),o)for(let i=0;i<o.length;i++)e.push(function(e,i,r,a){return e.uri?fetch(pR(e.uri,a)).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{i.images[r]=e}):void 0!==e.bufferView?createImageBitmap(new Blob([pk(i,e.bufferView)],{type:e.mimeType})).then(e=>{i.images[r]=e}):void 0}(o[i],a,i,r));return(e.length?Promise.all(e):Promise.resolve()).then(()=>{if(i&&s)for(let{primitives:e}of s)for(let i of e)!function(e,i){let r=e.extensions&&e.extensions[pz];if(!r)return;let a=new pb.Decoder,n=pk(i,r.bufferView),o=new pb.Mesh;if(!a.DecodeArrayToMesh(n,n.byteLength,o))throw Error("Failed to decode Draco mesh");let s=i.json.accessors[e.indices],l=pA[s.componentType],h=s.count*l.BYTES_PER_ELEMENT,u=pb._malloc(h);for(let n of(l===Uint16Array?a.GetTrianglesUInt16Array(o,h,u):a.GetTrianglesUInt32Array(o,h,u),pP(pb.memory.buffer.slice(u,u+h),s,i),pb._free(u),Object.keys(r.attributes))){let s=a.GetAttributeByUniqueId(o,r.attributes[n]),l=i.json.accessors[e.attributes[n]],h=pI[l.componentType],u=l.count*pC[l.type]*pA[l.componentType].BYTES_PER_ELEMENT,c=pb._malloc(u);a.GetAttributeDataArrayForAllPoints(o,s,pb[h],u,c),pP(pb.memory.buffer.slice(c,c+u),l,i),pb._free(c)}a.destroy(),o.destroy(),delete e.extensions[pz]}(i,a);if(n&&s&&h)for(let e of h)!function(e,i){if(!e.extensions||!e.extensions[pD])return;let r=e.extensions[pD],a=new Uint8Array(i.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);pT.decodeGltfBuffer(n,r.count,r.byteStride,a,r.mode,r.filter),e.buffer=i.buffers.length,e.byteOffset=0,i.buffers[e.buffer]=n.buffer,delete e.extensions[pD]}(e,a);return a})})}class pB{constructor(e,i,r){if(this.triangleCount=i.length/3,this.min=new T(0,0),this.max=new T(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length||0===r)return;let a=e.map(e=>e.x),n=e.map(e=>e.y);this.min=new T(Math.min(...a),Math.min(...n)),this.max=new T(Math.max(...a),Math.max(...n));let o=this.max.sub(this.min);o.x=Math.max(o.x,1),o.y=Math.max(o.y,1);let s=Math.max(o.x,o.y)/r;this.cellsX=Math.max(1,Math.ceil(o.x/s)),this.cellsY=Math.max(1,Math.ceil(o.y/s)),this.xScale=1/s,this.yScale=1/s;let l=[];for(let r=0;r<this.triangleCount;r++){let a=e[i[3*r+0]].sub(this.min),n=e[i[3*r+1]].sub(this.min),o=e[i[3*r+2]].sub(this.min),h=pF(Math.floor(Math.min(a.x,n.x,o.x)),this.xScale,this.cellsX),u=pF(Math.floor(Math.max(a.x,n.x,o.x)),this.xScale,this.cellsX),c=pF(Math.floor(Math.min(a.y,n.y,o.y)),this.yScale,this.cellsY),d=pF(Math.floor(Math.max(a.y,n.y,o.y)),this.yScale,this.cellsY),p=new T(0,0),f=new T(0,0),m=new T(0,0),_=new T(0,0);for(let e=c;e<=d;++e){p.y=f.y=e*s,m.y=_.y=(e+1)*s;for(let i=h;i<=u;++i)p.x=m.x=i*s,f.x=_.x=(i+1)*s,(oc(a,n,o,p,f,_)||oc(a,n,o,p,_,m))&&l.push({cellIdx:e*this.cellsX+i,triIdx:r})}}if(0===l.length)return;l.sort((e,i)=>e.cellIdx-i.cellIdx||e.triIdx-i.triIdx);let h=0;for(;h<l.length;){let e=l[h].cellIdx,i={start:this.payload.length,len:0};for(;h<l.length&&l[h].cellIdx===e;)++i.len,this.payload.push(l[h++].triIdx);this.cells[e]=i}}query(e,i,r){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8)));for(let e=0;e<this.lookup.length;e++)this.lookup[e]=0;let a=pF(e.x-this.min.x,this.xScale,this.cellsX),n=pF(i.x-this.min.x,this.xScale,this.cellsX),o=pF(e.y-this.min.y,this.yScale,this.cellsY),s=pF(i.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let i=a;i<=n;i++){let a=this.cells[e*this.cellsX+i];if(a)for(let e=0;e<a.len;e++){let i=this.payload[a.start+e],n=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,r.push(i),r.length===this.triangleCount))return}}}}function pF(e,i,r){return Math.max(0,Math.min(r-1,Math.floor(e*i)))}function pN(e,i){let r=e.json.bufferViews[i.bufferView],a=pA[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==pC[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:pC[i.type]))}function pV(e,i,r,a){let n=pA[i.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[i.bufferView],l=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:pC[i.type],h=r.float32,u=h.length/r.capacity;for(let e=0,r=0;e<i.count*l;e+=l,r+=u)for(let i=0;i<u;i++)h[r+i]=a[e+i]*o;r._trim()}function pU(i){let r=function(e,i){let r=[],a=WebGL2RenderingContext;if(e.json.textures)for(let n of e.json.textures){let o={magFilter:a.LINEAR,minFilter:a.NEAREST,wrapS:a.REPEAT,wrapT:a.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),r.push({image:i[n.source],sampler:o,uploaded:!1})}return r}(i,i.images),a=function(e,i){let r=[];for(let a of e.json.meshes){let n=[];for(let r of a.primitives)n.push(function(e,i,r){let a=e.indices,n=e.attributes,o={};o.indexArray=new aO;let s=i.json.accessors[a],l=s.count/3;o.indexArray.reserve(l);let h=pN(i,s);for(let e=0;e<l;e++)o.indexArray.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);o.indexArray._trim(),o.vertexArray=new aZ;let u=i.json.accessors[n.POSITION];o.vertexArray.reserve(u.count);let c=pN(i,u);for(let e=0;e<u.count;e++)o.vertexArray.emplaceBack(c[3*e],c[3*e+1],c[3*e+2]);if(o.vertexArray._trim(),o.aabb=new lI(u.min,u.max),o.centroid=function(e,i){let r=[
70,0,0],a=e.length;if(a>0){for(let n=0;n<a;n++){let a=3*e[n];r[0]+=i[a],r[1]+=i[a+1],r[2]+=i[a+2]}r[0]/=a,r[1]/=a,r[2]/=a}return r}(h,c),void 0!==n.COLOR_0){let e=i.json.accessors[n.COLOR_0],r=pC[e.type],a=pN(i,e);o.colorArray=3===r?new aZ:new aM,o.colorArray.resize(e.count),pV(i,e,o.colorArray,a)}if(void 0!==n.NORMAL){o.normalArray=new aZ;let e=i.json.accessors[n.NORMAL];o.normalArray.resize(e.count);let r=pN(i,e);pV(i,e,o.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){o.texcoordArray=new aq;let e=i.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);let r=pN(i,e);pV(i,e,o.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){let e=i.json.accessors[n._FEATURE_ID_RGBA4444];i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=pN(i,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(pN(i,i.json.accessors[n._FEATURE_RGBA4444]).buffer));let d=e.material;return o.material=function(e,i){let{emissiveFactor:r=[0,0,0],alphaMode:a="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:l,doubleSided:h}=e,{baseColorFactor:u=[1,1,1,1],metallicFactor:c=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=s?i[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&m){let e=s.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new e5(...u),metallicFactor:c,roughnessFactor:d,baseColorTexture:p?i[p.index]:void 0,metallicRoughnessTexture:f?i[f.index]:void 0},doubleSided:h,emissiveFactor:r,alphaMode:a,alphaCutoff:n,normalTexture:o?i[o.index]:void 0,occlusionTexture:m,emissionTexture:l?i[l.index]:void 0,defined:void 0===e.defined}}(void 0!==d?i.json.materials[d]:{defined:!1},r),o}(r,e,i));r.push(n)}return r}(i,r),{scenes:n,scene:o,nodes:s}=i.json,l=n?n[o||0].nodes:s,h=[];for(let r of l)h.push(function i(r,a,n){let{matrix:o,rotation:s,translation:l,scale:h,mesh:u,extras:c,children:d}=r,p={};if(p.matrix=o||e.a6.fromRotationTranslationScale([],s||[0,0,0,1],l||[0,0,0],h||[1,1,1]),void 0!==u){p.meshes=n[u];let e=p.anchor=[0,0];for(let i of p.meshes){let{min:r,max:a}=i.aabb;e[0]+=r[0]+a[0],e[1]+=r[1]+a[1]}e[0]=Math.floor(e[0]/p.meshes.length/2),e[1]=Math.floor(e[1]/p.meshes.length/2)}if(c&&(c.id&&(p.id=c.id),c.lights&&(p.lights=function(e){if(!e.length)return[];let i=function(e){let i=atob(e),r=new Uint8Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.codePointAt(e);return r}(e),r=[],a=i.length/24,n=new Uint16Array(i.buffer),o=new Float32Array(i.buffer);for(let e=0;e<a;e++){let i=n[2*e*6]/30,a=n[2*e*6+1]/30,s=n[2*e*6+10]/100,l=o[6*e+1],h=o[6*e+2],u=o[6*e+3],c=o[6*e+4],d=u-l,p=c-h,f=Math.hypot(d,p);r.push({pos:[l+.5*d,h+.5*p,a],normal:[p/f,-d/f,0],width:f,height:i,depth:s,points:[l,h,u,c]})}return r}(c.lights))),d){let e=[];for(let r of d)e.push(i(a.json.nodes[r],a,n));p.children=e}return p}(s[r],i,a));return function(e,i,r){let a={},n=new Set;for(let o=0;o<e.length;o++){let e=r[i[o]];if(!e.extras)continue;let s=e.extras["mapbox:footprint:version"],l=e.extras["mapbox:footprint:id"];(s||l)&&n.add(o),"1.0.0"===s&&l&&(a[l]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;let s=e[o],l=r[i[o]];if(!l.extras)continue;let h=null;s.id in a&&(h=function(e){let i=[],r=[],a=0;for(let n of e){a=i.length;let e=n.vertexArray.float32,o=n.indexArray.uint16;for(let r=0;r<n.vertexArray.length;r++)i.push(new T(e[3*r+0],e[3*r+1]));for(let e=0;e<3*n.indexArray.length;e++)r.push(o[e]+a)}if(r.length%3!=0)return null;for(let e=0;e<r.length;e+=3){let a=i[r[e+0]],n=i[r[e+1]],o=i[r[e+2]];(a.x-n.x)*(o.y-n.y)-(o.x-n.x)*(a.y-n.y)>0&&([r[e+1],r[e+2]]=[r[e+2],r[e+1]])}return{vertices:i,indices:r}}(e[a[s.id]].meshes)),h||(h=function(e){if(!e.extras||!e.extras.ground)return null;let i=e.extras.ground;if(!i||!Array.isArray(i)||0===i.length)return null;let r=i[0];if(!r||!Array.isArray(r)||0===r.length)return null;let a=[];for(let e of r){if(!Array.isArray(e)||2!==e.length)continue;let i=e[0],r=e[1];"number"==typeof i&&"number"==typeof r&&a.push(new T(i,r))}
7if(a.length<3)return null;a.length>1&&a[a.length-1].equals(a[0])&&a.pop();let n=0;for(let e=0;e<a.length;e++){let i=a[e],r=a[(e+1)%a.length],o=a[(e+2)%a.length];n+=(i.x-r.x)*(o.y-r.y)-(o.x-r.x)*(i.y-r.y)}n>0&&a.reverse();let o=hC(a.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:a,indices:o}}(l)),h&&(s.footprint=function(e){if(0===e.vertices.length||0===e.indices.length)return null;let[i,r]=[e.vertices[0].clone(),e.vertices[0].clone()];for(let a=1;a<e.vertices.length;++a){let n=e.vertices[a];i.x=Math.min(i.x,n.x),i.y=Math.min(i.y,n.y),r.x=Math.max(r.x,n.x),r.y=Math.max(r.y,n.y)}let a=Math.ceil(Math.max(r.x-i.x,r.y-i.y)/256),n=new pB(e.vertices,e.indices,Math.max(8,a));return{vertices:e.vertices,indices:e.indices,grid:n,min:i,max:r}}(h))}if(n.size>0){let i=Array.from(n.values()).sort((e,i)=>e-i);for(let r=i.length-1;r>=0;r--)e.splice(i[r],1)}}(h,l,i.json.nodes),h}rI(pB,"TriangleGridIndex");class pj{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){let r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}let pG=["tile","layer","source","sourceLayer","state"];class pZ{constructor(e,i,r,a,n){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=a,this.properties=e.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let i of(void 0!==this.id&&(e.id=this.id),pG))void 0!==this[i]&&(e[i]=this[i]);return e}}class pq{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new rS(8192,16,0),this.featureIndexArray=new a5,this.promoteId=i,this.is3DTile=!1}insert(e,i,r,a,n,o=0,s=0){let l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n,o);let h=this.grid;for(let e=0;e<i.length;e++){let r=i[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let i=r[e];a[0]=Math.min(a[0],i.x),a[1]=Math.min(a[1],i.y),a[2]=Math.max(a[2],i.x),a[3]=Math.max(a[3],i.y)}
70!==s&&(a[0]-=s,a[1]-=s,a[2]+=s,a[3]+=s),a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let e in this.vtLayers=new hX(new cm(this.rawTileData)).layers,this.sourceLayerCoder=new pj(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i,r,a){let n;this.loadVTLayers();let o=e.params||{},s=ar(o.filter),l=e.tileResult,h=e.transform,u=l.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(e,i,r,a)=>oh(l.bufferedTilespaceGeometry,e,i,r,a));c.sort(pW);let d=null;h.elevation&&c.length>0&&(d=ua.create(h.elevation,this.tileID));let p={};for(let u=0;u<c.length;u++){let f=c[u];if(f===n)continue;n=f;let m=this.featureIndexArray.get(f),_=null;if(this.is3DTile){let e=this.bucketLayerIDs[0][0],r=i[e];if("model"!==r.type)continue;let{queryFeature:a,intersectionZ:n}=r.queryIntersectsMatchingFeature(l,m.featureIndex,s,h);a&&this.appendToResult(p,e,m.featureIndex,a,n)}else this.loadMatchingFeature(p,m,s,o.layers,o.availableImages,i,r,a,(i,r,a,n=0)=>(_||(_=n8(i,this.tileID.canonical,e.tileTransform)),r.queryIntersectsFeature(l,i,a,_,this.z,e.transform,e.pixelPosMatrix,d,n)))}return p}loadMatchingFeature(e,i,r,a,n,o,s,l,h){let{featureIndex:u,bucketIndex:c,sourceLayerIndex:d,layoutVertexArrayOffset:p}=i,f=this.bucketLayerIDs[c];if(a&&!function(e,i){for(let r=0;r<e.length;r++)if(i.indexOf(e[r])>=0)return!0;return!1}(a,f))return;let m=this.sourceLayerCoder.decode(d),_=this.vtLayers[m].feature(u);if(r.needGeometry){let e=n9(_,!0);if(!r.filter(new rY(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new rY(this.tileID.overscaledZ),_))return;let g=this.getId(_,m);for(let i=0;i<f.length;i++){let r=f[i];if(a&&0>a.indexOf(r))continue;let c=o[r];if(!c)continue;let d={};void 0!==g&&l&&(d=l.getState(c.sourceLayer||"_geojsonTileLayer",g));let m=!h||h(_,c,d,p);if(!m)continue;let y=new pZ(_,this.z,this.x,this.y,g),x=R({},s[r]);x.paint=p$(x.paint,c.paint,_,d,n),x.layout=p$(x.layout,c.layout,_,d,n),y.layer=x,this.appendToResult(e,r,u,y,m)}}appendToResult(e,i,r,a,n){let o=e[i];void 0===o&&(o=e[i]=[]),o.push({featureIndex:r,feature:a,intersectionZ:n})}lookupSymbolFeatures(e,i,r,a,n,o,s,l){let h={};this.loadVTLayers();let u=ar(n);for(let n of e)this.loadMatchingFeature(h,{bucketIndex:r,sourceLayerIndex:a,featureIndex:n,layoutVertexArrayOffset:0},u,o,s,l,i);return h}loadFeature(e){let{featureIndex:i,sourceLayerIndex:r}=e;this.loadVTLayers();let a=this.sourceLayerCoder.decode(r),n=this.vtFeatures[a];if(n[i])return n[i];let o=this.vtLayers[a].feature(i);return n[i]=o,o}hasLayer(e){for(let i of this.bucketLayerIDs)for(let r of i)if(e===r)return!0;return!1}getId(e,i){let r=e.id;if(this.promoteId){let a="string"==typeof this.promoteId?this.promoteId:this.promoteId[i];null!=a&&(r=e.properties[a]),"boolean"==typeof r&&(r=Number(r))}return r}}function p$(e,i,r,a,n){return j(e,(e,o)=>{let s=i instanceof r5?i.get(o):null;return s&&s.evaluate?s.evaluate(r,a,n):s})}function pW(e,i){return i-e}rI(pq,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let pH=new Float32Array(262144),pX=new Uint8Array(262144),pY=["","wall","door","roof","window","lamp","logo"];class pK{constructor(e){this.node=e,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:e.id,geometry:[],properties:{height:function e(i){let r=0;if(i.meshes)for(let e of i.meshes)r=Math.max(r,e.aabb.max[2]);if(i.children)for(let a of i.children)r=Math.max(r,e(a));return r}(e)}}}getLocalBounds(){if(!this.node.meshes)return new lI([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0,i=new lI([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let r of this.node.meshes)this.node.lightMeshIndex!==e&&i.encapsulate(r.aabb),e++;this.aabb=i}return this.aabb}}class pJ{constructor(e,i,r,a,n,o){for(let s of(this.id=i,this.modelTraits|=pa.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=pa.HasMapbox
7MeshFeatures),a&&(this.modelTraits|=pa.HasMeshoptCompression),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,this.nodesInfo=[],e))this.nodesInfo.push(new pK(s)),function e(i,r,a){if(i.meshes)for(let e of i.meshes)e.aabb.min[0]!==1/0&&a.insert(r,e.aabb.min[0],e.aabb.min[1],e.aabb.max[0],e.aabb.max[1]);if(i.children)for(let n of i.children)e(n,r,a)}(s,o.featureIndexArray.length,o.grid),o.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,o.bucketLayerIDs.length-1,0)}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):ps(i,e,!0)}for(let e of i)pl(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(let r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){let a=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;return!!(!this.uploaded||this.dirty||a.name!==this.projection.name||pQ(r.paint.get("model-color").value,o)||pQ(r.paint.get("model-color-mix-intensity").value,o)||pQ(r.paint.get("model-roughness").value,o)||pQ(r.paint.get("model-emissive-strength").value,o)||pQ(r.paint.get("model-height-based-emissive-strength-multiplier").value,o))&&(this.projection=a,this.brightness=n,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;let r=this.getNodesInfo(),a=this.id.canonical;for(let e of r){let r=e.feature;e.evaluatedScale=i.paint.get("model-scale").evaluate(r,{},a)}}evaluate(e){for(let i of this.getNodesInfo()){if(!i.node.meshes)continue;let r=i.feature,a=i.node.meshes&&i.node.meshes[0].featureData,n=i.evaluatedColor[2],o=i.evaluatedRMEA[2],s=this.id.canonical;if(i.hasTranslucentParts=!1,a){for(let a=0;a<pY.length;a++){let n=pY[a];n.length&&(r.properties.part=n);let o=e.paint.get("model-color").evaluate(r,{},s),l=e.paint.get("model-color-mix-intensity").evaluate(r,{},s);i.evaluatedColor[a]=[o.r,o.g,o.b,l],i.evaluatedRMEA[a][0]=e.paint.get("model-roughness").evaluate(r,{},s),i.evaluatedRMEA[a][2]=e.paint.get("model-emissive-strength").evaluate(r,{},s),i.evaluatedRMEA[a][3]=o.a,i.emissionHeightBasedParams[a]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r,{},s),!i.hasTranslucentParts&&o.a<1&&(i.hasTranslucentParts=!0)}delete r.properties.part,function(e,i,r){let a=e.node,n=0,o=r&pa.HasMeshoptCompression;for(let r of a.meshes){if(a.lights&&a.lightMeshIndex===n||!r.featureData)continue;r.featureArray=new aW,r.featureArray.reserve(r.featureData.length);let s=i;for(let i of r.featureData){let n;let l=o?65535&i:i>>16&65535,h=o?i>>16&65535:65535&i,u=(15&h)<8?15&h:0,c=e.evaluatedRMEA[u],d=e.evaluatedColor[u],p=e.emissionHeightBasedParams[u];if(s&&2===u&&a.lights&&(n=new aW).resize(10*a.lights.length),function(e,i,r,a,n,o,s,l){let h,u,c,d,p=(61440&i|(61440&i)>>4)>>8,f=(3840&i|(3840&i)>>4)>>4,m=240&i|(240&i)>>4;r[3]>0&&(p=e4(p,255*r[0],r[3]),f=e4(f,255*r[1],r[3]),m=e4(m,255*r[2],r[3]));let _=p<<8|f,g=m<<8|Math.floor(255*a[3]),y=Math.min(Math.round(.5*P(a[2],0,2)*255),255)<<8|15*a[0]<<4|15*a[1],x=P(n[0],0,1),v=P(n[1],0,1),b=P(n[2],0,1),w=P(n[3],0,1);if(x!==v&&s!==o&&v!==x){let e=s-o;u=1/(e*(v-x)),c=-(o+e*x)/(e*(v-x)),d=Math.pow(10,P(n[4],-1,1)),h=255*b<<8|255*w}else h=65535,u=0,c=1,d=1;if(e.emplaceBack(_,g,y,h,u,c,d),l){let e=l.length;l.clear();for(let i=0;i<e;i++)l.emplaceBack(_,g,y,h,u,c,d)}}(r.featureArray,l,d,c,p,r.aabb.min[2],r.aabb.max[2],n),n&&s){s=!1;let e=a.meshes[a.lightMeshIndex];e.featureArray=n,e.featureArray._trim()}}r.featureArray._trim(),n++}}(i,n!==i.evaluatedColor[2]||o!==i.evaluatedRMEA[2],this.modelTraits)}else i.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(r,{},s);i.evaluatedScale=e.paint.get("model-scale").evaluate(r,{},s),this.updatePbrBuffer(i.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,r,a){let n=e.findDEMTileFor(r);if(n&&(n.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if
7(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;let i=ua.create(e,r,n);if(!i)return;for(let n of(this.modelTraits&pa.HasMapboxMeshFeatures&&this.updateDEM(e,i,r,a),this.getNodesInfo())){let e=n.node;if(!e.footprint||!e.footprint.vertices||!e.footprint.vertices.length)continue;let r=e.footprint.vertices,a=i.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)a=Math.min(a,i.getElevationAt(r[e].x,r[e].y,!0,!0));e.elevation=a}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,r,a){let n=i._dem._modifiedForSources[a];if(void 0===n&&(i._dem._modifiedForSources[a]=[],n=i._dem._modifiedForSources[a]),n.includes(r.canonical))return;let o=i._dem.dim;n.push(r.canonical);let s=!1;for(let e of this.getNodesInfo()){let r=e.node;if(!r.footprint||!r.footprint.grid)continue;let a=r.footprint.grid,n=i.tileCoordToPixel(a.min.x,a.min.y),l=i.tileCoordToPixel(a.max.x,a.max.y),h=Math.min(Math.min(o-l.y,n.x),Math.min(n.y,o-l.x));if(h<0)continue;let u=P(h,2,5),c=Math.max(0,n.x-u),d=Math.max(0,n.y-u),p=Math.min(l.x+u,o-1),f=Math.min(l.y+u,o-1);for(let e=d;e<=f;++e)for(let i=c;i<=p;++i)pX[e*o+i]=255;let m=0,_=0;for(let e=0;e<a.cellsY;++e)for(let r=0;r<a.cellsX;++r){if(!a.cells[e*a.cellsX+r])continue;let n=i.tileCoordToPixel(a.min.x+r/a.xScale,a.min.y+e/a.yScale),s=i.tileCoordToPixel(a.min.x+(r+1)/a.xScale,a.min.y+(e+1)/a.yScale);for(let e=n.y;e<=Math.min(s.y+1,o-1);++e)for(let r=n.x;r<=Math.min(s.x+1,o-1);++r)255===pX[e*o+r]&&(pX[e*o+r]=0,m+=i.getElevationAtPixel(r,e),_++)}let g=m/_;c=Math.max(1,n.x-u),d=Math.max(1,n.y-u),p=Math.min(l.x+u,o-2),f=Math.min(l.y+u,o-2),s=!0;for(let e=d;e<=f;++e)for(let r=c;r<=p;++r)0===pX[e*o+r]&&(pH[e*o+r]=i._dem.set(r,e,g));for(let e=1;e<u;++e){c=Math.max(1,n.x-e),d=Math.max(1,n.y-e),p=Math.min(l.x+e,o-2),f=Math.min(l.y+e,o-2);for(let r=d;r<=f;++r)for(let a=c;a<=p;++a){let n=r*o+a;if(255===pX[n]){let s=0,l=0,h=-1,c=-1;for(let i=-1;i<=1;++i)for(let n=-1;n<=1;++n){let u=(r+i)*o+a+n;if(pX[u]>=e)continue;let d=pH[u],p=Math.abs(d);p>l&&(s=d,l=p,h=n,c=i)}if(l>.1){let o=1-(e+.5*Math.abs(h*c))/u,l=i._dem.get(a,r)+s*o,d=i._dem.get(a+h,r+c),p=i._dem.get(a-h,r-c,!0);(l-d)*(l-p)>0&&(l=(d+p)/2),pH[n]=i._dem.set(a,r,l),pX[n]=e}}}}}s&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=eh.now())}getNodesInfo(){return this.nodesInfo}destroy(){for(let e of this.getNodesInfo())pl(e.node),ph(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){let i=a[e].node;a[e].hiddenByReplacement=!!i.footprint&&!r.find(e=>e.footprint===i.footprint)}}getHeightAtTileCoord(e,i){let r=this.getNodesInfo(),a=[];for(let n=0;n<this.nodesInfo.length;n++){let o=r[n],s=o.node.meshes[0];if(e<s.aabb.min[0]||i<s.aabb.min[1]||e>s.aabb.max[0]||i>s.aabb.max[1])continue;let l=(e-s.aabb.min[0])/(s.aabb.max[0]-s.aabb.min[0])*64|0,h=64*Math.min(63,(i-s.aabb.min[1])/(s.aabb.max[1]-s.aabb.min[1])*64|0)+Math.min(63,l);if(!(s.heightmap[h]<0&&o.node.footprint)){if(o.hiddenByReplacement)return;return{height:s.heightmap[h],maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]}}if(o.node.footprint.grid.query(new T(e,i),new T(e,i),a),a.length>0)return{height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]}}}}function pQ(e,i){return!e.isLightConstant&&i}function p0(e,i,r,a){let n=1<<e.z;i.lat=nQ((a/8192+e.y)/n),i.lng=nJ((r/8192+e.x)/n)}rI(pJ,"Tiled3dModelBucket",{omit:["layers"]}),rI(pK,"Tiled3dModelFeature");let p1={circle:class extends ap{constructor(e,i,r){super(e,og,i,r)}createBucket(e){return new ot(e)}queryRadius(e){return od("circle-radius",this,e)+od("circle-stroke-width",this,e)+op(this.paint.get("circle-translate"))}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=om(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r);return l4(e,a,o,s,l,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,i){let r=l5(this);return{config:new nC(this,i),defines:r,overrideFog:!1}}},heatmap:class extends ap{createBucket(e){return new l9(e)}constructor(e,i,r){super(e,ho,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hs({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return od("heatmap-radius",this,e)}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=this.paint.get("heatmap-radius").evaluate(i,r);return l4(e,a,o,s,l,!0,!0,new T(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,i){return"heatmap"===e?{config:new nC(this,i),overrideFog:!1}:{}}},hillshade:class extends ap{constructor(e,i,r){super(e,hh,i,r)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,i){return{overrideFog:!1}}},fill:class extends ap{constructor(e,i,r){super(e,hO,i,r)}getProgramIds(){let e=this.paint.get("fill-pattern"),i=e&&e.constantOr(1),r=[i?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(i&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,i){return{config:new nC(this,i),overrideFog:!1}}recalculate(e,i){super.recalculate(e,i);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new hR(e)}queryRadius(){return op(this.paint.get("fill-translate"))}queryIntersectsFeature(e,i,r,a,n,o){return!e.queryGeometry.isAboveHorizon&&or(of(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}},"fill-extrusion":class extends ap{constructor(e,i,r){super(e,uI,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new uy(e)}queryRadius(){return op(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(i,r,a,n,o,s,l,h,u){var c,d,p,f;let m=om(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),_=this.paint.get("fill-extrusion-height").evaluate(r,a),g=this.paint.get("fill-extrusion-base").evaluate(r,a),y=[0,0],x=h&&s.elevation,v=s.elevation?s.elevation.exaggeration():1,b=i.tile.getBucket(this);if(x&&b instanceof uy){let e=b.centroidVertexArray,i=u+1;i<e.length&&(y[0]=e.geta_centroid_pos0(i),y[1]=e.geta_centroid_pos1(i))}if(0===y[0]&&1===y[1])return!1;"globe"===s.projection.name&&(n=uS([n],[new T(0,0),new T(8192,8192)],i.tileID.canonical).map(e=>e.polygon).flat());let[w,M]=(c=n,d=x?h:null,p=s.center.lat,f=i.tileID.canonical,"globe"===s.projection.name?function(i,r,a,n,o,s,l,h,u,c,d){let p=[],f=[],m=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(e,i,r,a)=>{e[0]=i,e[1]=r,e[2]=a,e[3]=1},x=uE();for(let v of(a>0&&(a+=x),n+=x,r)){let r=[],x=[];for(let p of v){let f=p.x+o.x,v=p.y+o.y,b=i.projection.projectTilePoint(f,v,d),w=i.projection.upVector(d,p.x,p.y),T=a,M=n;if(l){let e=uD(f,v,a,n,l,h,u,c);T+=e.base,M+=e.top}0!==a?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*M,b.y+w[1]*m*M,b.z+w[2]*m*M),e.N.transformMat4(_,_,s),e.N.transformMat4(g,g,s),r.push(new uC(_[0],_[1],_[2])),x.push(new uC(g[0],g[1],g[2]))}p.push(r),f.push(x)}return[p,f]}(s,c,g,_,m,l,d,y,v,p,f):d?function(i,r,a,n,o,s,l,h,u){let c=[],d=[],p=[0,0,0,1];for(let f of i){let i=[],m=[];for(let c of f){let d=c.x+n.x,f=c.y+n.y,_=uD(d,f,r,a,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,e.a7.transformMat4(p,p,o),p[3]=Math.max(p[3],1e-5);let g=new uC(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,e.a7.transformMat4(p,p,o),p[3]=Math.max(p[3],1e-5);let y=new uC(p[0]/p[3],p[1]/p[3],p[2]/p[3]);i.push(g),m.push(y)}c.push(i),d.push(m)}return[c,d]}(c,g,_,m,l,d,y,v,p):function(e,i,r,a,n){let o=[],s=[],l=n[8]*i,h=n[9]*i,u=n[10]*i,c=n[11]*i,d=n[8]*r,p=n[9]*r,f=n[10]*r,m=n[11]*r;for(let i of e){let e=[],r=[];for(let o of i){let i=o.x+a.x,s=o.y+a.y,_=n[0]*i+n[4]*s+n[12],g=n[1]*i+n[5]*s+n[13],y=n[2]*i+n[6]*s+n[14],x=n[3]*i+n[7]*s+n[15],v=_+l,b=g+h,w=y+u,T=Math.max(x+c,
71e-5),M=_+d,E=g+p,S=y+f,A=Math.max(x+m,1e-5);e.push(new uC(v/T,b/T,w/T)),r.push(new uC(M/A,E/A,S/A))}o.push(e),s.push(r)}return[o,s]}(c,g,_,m,l)),E=i.queryGeometry;return function(e,i,r){let a=1/0;or(r,i)&&(a=uz(r,i[0]));for(let n=0;n<i.length;n++){let o=i[n],s=e[n];for(let e=0;e<o.length-1;e++){let i=o[e],n=[i,o[e+1],s[e+1],s[e],i];oi(r,n)&&(a=Math.min(a,uz(r,n)))}}return a!==1/0&&a}(w,M,E.isPointQuery()?E.screenBounds:E.screenGeometry)}},line:class extends ap{constructor(e,i,r){super(e,uV,i,r),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof iE,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,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=u$.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new uF(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i){let r=uZ(this);return{config:new nC(this,i),defines:r,overrideFog:!1}}queryRadius(e){var i,r;return i=od("line-width",this,e),((r=od("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(od("line-offset",this,e))+op(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,o){var s,l;if(e.queryGeometry.isAboveHorizon)return!1;let h=of(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=e.pixelToTileUnitsFactor/2*(s=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*s:s),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(e,i){let r=[],a=new T(0,0);for(let n=0;n<e.length;n++){let o=e[n],s=[];for(let e=0;e<o.length;e++){let r=o[e],n=o[e+1],l=0===e?a:r.sub(o[e-1])._unit()._perp(),h=e===o.length-1?a:n.sub(r)._unit()._perp(),u=l._add(h)._unit();u._mult(1/(u.x*h.x+u.y*h.y)),s.push(u._mult(i)._add(r))}r.push(s)}return r}(a,c*e.pixelToTileUnitsFactor)),function(e,i,r){for(let a=0;a<i.length;a++){let n=i[a];if(e.length>=3){for(let i=0;i<n.length;i++)if(ol(e,n[i]))return!0}if(function(e,i,r){if(e.length>1){if(oa(e,i))return!0;for(let a=0;a<i.length;a++)if(on(i[a],e,r))return!0}for(let a=0;a<e.length;a++)if(on(e[a],i,r))return!0;return!1}(e,n,r))return!0}return!1}(h,a,u)}isTileClipped(){return!0}},symbol:dE,background:class extends ap{constructor(e,i,r){super(e,dA,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i){return{overrideFog:!1}}},raster:dB,"raster-particle":dV,sky:class extends ap{constructor(e,i,r){super(e,dG,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=hs({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let i=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==i.azimuthal||this._lightPosition.polar!==i.polar}return!1}getCenter(e,i){if("atmosphere"===this.paint.get("sky-type")){let r=this.paint.get("sky-atmosphere-sun"),a=!r,n=e.style.light,o=n.properties.get("position");return a&&"viewport"===n.properties.get("anchor")&&$("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?dZ(o.azimuthal,90-o.polar,i):dZ(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return dZ(r[0],90-r[1],i)}isSky(){return!0}
7markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends ap{constructor(e,i,r){super(e,dq,i)}},model:class extends ap{constructor(e,i,r){super(e,pr,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new pt(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(e){return e instanceof pJ?8191:0}queryIntersectsFeature(i,r,a,n,o,s){if(!this.modelManager)return!1;let l=this.modelManager,h=i.tile.getBucket(this);if(!(h&&h instanceof pt))return!1;for(let a in h.instancesPerModel){let n=h.instancesPerModel[a];if(n.idToFeaturesIndex.hasOwnProperty(r.id)){let o=n.features[n.idToFeaturesIndex[r.id]],u=l.getModel(a,this.scope);if(!u)return!1;let c=e.a6.create(),d=new nU(0,0),p=h.canonical,f=Number.MAX_VALUE;for(let r=0;r<o.instancedDataCount;++r){let a=16*(o.instancedDataOffset+r),l=n.instancedDataArray.float32,h=[l[a+4],l[a+5],l[a+6]];p0(p,d,l[a],0|l[a+1]),pn(c,u,s,d,o.rotation,o.scale,h,!1,!1,!1),"globe"===s.projection.name&&(c=d0(c,s));let m=e.a6.multiply([],s.projMatrix,c),_=i.queryGeometry,g=d1(_.isPointQuery()?_.screenBounds:_.screenGeometry,s,m,u.aabb);null!=g&&(f=Math.min(g,f))}return f!==Number.MAX_VALUE&&f}}return!1}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){let i=this._transitionablePaint._values[e];return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof rw}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(i,r,a,n){let o=i.tile,s=o.getBucket(this),l=null,h=Number.MAX_VALUE;if(!(s&&s instanceof pJ))return{queryFeature:l,intersectionZ:h};let u=s.getNodesInfo()[r];if(u.hiddenByReplacement||!u.node.meshes||!a.filter(new rY(o.tileID.overscaledZ),u.feature,o.tileID.canonical))return{queryFeature:l,intersectionZ:h};let c=u.node,d=n.calculatePosMatrix(o.tileID.toUnwrapped(),n.worldSize),p=u.evaluatedScale,f=0;n.elevation&&c.elevation&&(f=c.elevation*n.elevation.exaggeration()),e.a6.translate(d,d,[(c.anchor?c.anchor[0]:0)*(p[0]-1),(c.anchor?c.anchor[1]:0)*(p[1]-1),f]),e.a6.scale(d,d,p),e.a6.multiply(d,d,c.matrix);let m=i.queryGeometry,_=m.isPointQuery()?m.screenBounds:m.screenGeometry,g=function(i){let r=e.a6.multiply([],d,i.matrix),a=e.a6.multiply(r,n.expandedFarZProjMatrix,r);for(let e=0;e<i.meshes.length;++e){let r=i.meshes[e];if(e===i.lightMeshIndex)continue;let o=d1(_,n,a,r.aabb);null!=o&&(h=Math.min(o,h))}if(i.children)for(let e of i.children)g(e)};if(g(c),h===Number.MAX_VALUE)return{queryFeature:l,intersectionZ:h};let y=new nU(0,0);return p0(o.tileID.canonical,y,u.node.anchor[0],u.node.anchor[1]),{queryFeature:l={type:"Feature",geometry:{type:"Point",coordinates:[y.lng,y.lat]},properties:u.feature.properties,id:u.feature.id,state:{},layer:this.serialize()},intersectionZ:h}}}},p2={read:function(e,i){return e.readFields(p2._readField,{header_length:0,x:0,y:0,z:0,layers:[]},i)},_readField:function(e,i,r){1===e?i.header_length=r.readFixed32():2===e?i.x=r.readVarint():3===e?i.y=r.readVarint():4===e?i.z=r.readVarint():5===e&&i.layers.push(p2.Layer.read(r,r.readVarint()+r.pos))},PixelFormat:{PIXEL_FORMAT_UNKNOWN:{value:0,options:{}},PIXEL_FORMAT_UINT32:{value:1,options:{}},PIXEL_FORMAT_UINT16:{value:2,options:{}},PIXEL_FORMAT_UINT8:{value:3,options:{}}},Filter:{}};p2.Filter.read=function(e,i){return e.readFields(p2.Filter._readField,{delta_filter:null,filter:null,zigzag_filter:null,bitshuffle_filter:null,byteshuffle_filter:null},i)},p2.Filter._readField=function(e,i,r){1===e?(i.delta_filter=p2.Filter.Delta.read(r,r.readVarint()+r.pos),i.filter="delta_filter"):2===e?(i.zigzag_filter=p2.Filter.Zigzag.read(r,r.readVarint()+r.pos),i.filter="zigzag_filter"):3===e?(i.bitshuffle_filter=p2.Filter.BitShuffle.read(r,r.readVarint()+r.pos),i.filter="bitshuffle_filter"):4===e&&(i.byteshuffle_filter=p2.Filter.ByteShuffle.read(r,r.readVarint()+r.pos),i.filter="byteshuffle_filter")},p2.Filter.Delta={},p2.Filter.Delta.read=function(e,i){return e.readFields(p2.Filter.Delta._readField,{block_size:0},i)},p2.Filter.Delta._readField=function(e,i,r){1===e&&(i.block_size=r.readVarint())},p2.Filter.Zigzag={},p2.Filter.Zigzag.read=function(e,i){return e.readFields(p2.Filter.Zigzag._readField,{},i)},p2.Filter.Zigzag._readField=function(e,i,r){},p2.Filter.BitShuffle={},p2.Filter.BitShuffle.read=function(e,i){return e.readFields(p2.Filter.BitShuffle._readField,{},i)},p2.Filter.BitShuffle._readField=function(e,i,r){},p2.Filter.ByteShuffle={},p2.Filter.ByteShuffle.read=function(e,i){return e.readFields(p2.Filter.ByteShuffle._readField,{},i)},p2.Filter.ByteShuffle._readField=function(e,i,r){},p2.Codec={},p2.Codec.read=function(e,i){return e.readFields(p2.Codec._readField,{gzip_data:null,codec:null,jpeg_image:null,webp_image:null,png_image:null},i)},p2.Codec._readField=function(e,i,r){1===e?(i.gzip_data=p2.Codec.GzipData.read(r,r.readVarint()+r.pos),i.codec="gzip_data"):2===e?(i.jpeg_image=p2.Codec.JpegImage.read(r,r.readVarint()+r.pos),i.codec="jpeg_image"):3===e?(i.webp_image=p2.Codec.WebpImage.read(r,r.readVarint()+r.pos),i.codec="webp_image"):4===e&&(i.png_image=p2.Codec.PngImage.read(r,r.readVarint()+r.pos),i.codec="png_image")},p2.Codec.GzipData={},p2.Codec.GzipData.read=function(e,i){return e.readFields(p2.Codec.GzipData._readField,{},i)},p2.Codec.GzipData._readField=function(e,i,r){},p2.Codec.JpegImage={},p2.Codec.JpegImage.read=function(e,i){return e.readFields(p2.Codec.JpegImage._readField,{},i)},p2.Codec.JpegImage._readField=function(e,i,r){},p2.Codec.WebpImage={},p2.Codec.WebpImage.read=function(e,i){return e.readFields(p2.Codec.WebpImage._readField,{},i)},p2.Codec.WebpImage._readField=function(e,i,r){},p2.Codec.PngImage={},p2.Codec.PngImage.read=function(e,i){return e.readFields(p2.Codec.PngImage._readField,{},i)},p2.Codec.PngImage._readField=function(e,i,r){},p2.DataIndexEntry={},p2.DataIndexEntry.read=function(e,i){return e.readFields(p2.DataIndexEntry._readField,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},i)},p2.DataIndexEntry._readField=function(e,i,r){1===e?i.first_byte=r.readFixed64():2===e?i.last_byte=r.readFixed64():3===e?i.filters.push(p2.Filter.read(r,r.readVarint()+r.pos)):4===e?i.c
7odec=p2.Codec.read(r,r.readVarint()+r.pos):5===e?i.offset=r.readFloat():6===e?i.scale=r.readFloat():7===e&&i.bands.push(r.readString())},p2.Layer={},p2.Layer.read=function(e,i){return e.readFields(p2.Layer._readField,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},i)},p2.Layer._readField=function(e,i,r){1===e?i.version=r.readVarint():2===e?i.name=r.readString():3===e?i.units=r.readString():4===e?i.tilesize=r.readVarint():5===e?i.buffer=r.readVarint():6===e?i.pixel_format=r.readVarint():7===e&&i.data_index.push(p2.DataIndexEntry.read(r,r.readVarint()+r.pos))};let p3={read:function(e,i){return e.readFields(p3._readField,{uint32_values:null,values:null,fixed32_values:null},i)},_readField:function(e,i,r){2===e?(i.uint32_values=p3.Uint32Values.read(r,r.readVarint()+r.pos),i.values="uint32_values"):3===e&&(i.fixed32_values=p3.Fixed32Values.read(r,r.readVarint()+r.pos),i.values="fixed32_values")},Uint32Values:{}};p3.Uint32Values.read=function(e,i){return e.readFields(p3.Uint32Values._readField,{values:[]},i)},p3.Uint32Values._readField=function(e,i,r){1===e&&(i.readValuesInto=function(e){if(2!==e.type)throw Error(`Unsupported pbf type "${e.type}"`);let i=2===e.type?e.readVarint()+e.pos:e.pos+1,r=e.pos;return e.pos=i,function(a){e.pos=r;let n=0;for(;e.pos<i;){let i=e.readVarint();a[n++]=i}return a}}(r))},p3.Fixed32Values={},p3.Fixed32Values.read=function(e,i){return e.readFields(p3.Fixed32Values._readField,{values:[]},i)},p3.Fixed32Values._readField=function(e,i,r){throw Error("Not implemented")};class p5{constructor(e=0,i=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=i}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){let i=this.items[e];delete this.items[e],this.size--,null!==i.prev&&(i.prev.next=i.next),null!==i.next&&(i.next.prev=i.prev),this.first===i&&(this.first=i.next),this.last===i&&(this.last=i.prev)}return this}entries(e=this.keys()){return e.map(e=>[e,this.get(e)])}evict(e=!1){if(e||this.size>0){let e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let i;return this.has(e)&&(i=this.items[e].expiry),i}get(e){let i;if(this.has(e)){let r=this.items[e];this.ttl>0&&r.expiry<=Date.now()?this.delete(e):(i=r.value,this.set(e,i,!0))}return i}has(e){return e in this.items}keys(){let e=[],i=this.first;for(;null!==i;)e.push(i.key),i=i.next;return e}set(e,i,r=!1,a=this.resetTtl){let n;if(r||this.has(e)){if((n=this.items[e]).value=i,!1===r&&a&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let e=this.last,i=n.next,r=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,e.next=n,null!==r&&(r.next=i),null!==i&&(i.prev=r)}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:i},1==++this.size?this.first=n:this.last.next=n;return this.last=n,this}values(e=this.keys()){return e.map(e=>this.get(e))}}class p4 extends Error{constructor(e){super(e),this.name="MRTError"}}var p6=Uint8Array,p8=Uint16Array,p9=Int32Array,p7=new p6([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fe=new p6([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ft=new p6([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fi=function(e,i){for(var r=new p8(31),a=0;a<31;++a)r[a]=i+=1<<e[a-1];var n=new p9(r[30]);for(a=1;a<30;++a)for(var o=r[a];o<r[a+1];++o)n[o]=o-r[a]<<5|a;return{b:r,r:n}},fr=fi(p7,2),fa=fr.b,fn=fr.r;fa[28]=258,fn[258]=28;for(var fo=fi(fe,0).b,fs=new p8(32768),fl=0;fl<32768;++fl){var fh=(43690&fl)>>1|(21845&fl)<<1;fs[fl]=((65280&(fh=(61680&(fh=(52428&fh)>>2|(13107&fh)<<2))>>4|(3855&fh)<<4))>>8|(255&fh)<<8)>>1}var fu=function(e,i,r){for(var a=e.length,n=0,o=new p8(i);n<a;++n)e[n]&&++o[e[n]-1];var s,l=new p8(i);for(n=1;n<i;++n)l[n]=l[n-1]+o[n-1]<<1;if(r){s=new p8(1<<i);var h=15-i;for(n=0;n<a;++n)if(e[n])for(var u=n<<4|e[n],c=i-e[n],d=l[e[n]-1]++<<c,p=d|(1<<c)-1;d<=p;++d)s[fs[d]>>h]=u}else for(s=new p8(a),n=0;n<a;++n)e[n]&&(s[n]=fs[l[e[n]-1]++]>>15-e[n]);return s},fc=new p6(288);for(fl=0;fl<144;++fl)fc[fl]=8;for(fl=144;fl<256;++fl)fc[fl]=9;for(fl=256;fl<280;++fl)fc[fl]=7;for(fl=280;fl<288;++fl)fc[fl]=8;var fd=new p6(32);for(fl=0;fl<32;++fl)fd[fl]=5;var fp=fu(fc,9,1),ff=fu(fd,5,1),fm=function(e){for(var i=e[0],r=1;r<e.length;++r)e[r]>i&&(i=e[r]);return i},f_=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]<<8)>>(7&i)&r},fg=function(e,i){var r=i/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&i)}
7,fy=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],fx=function(e,i,r){var a=Error(i||fy[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,fx),!r)throw a;return a},fv=new p6(0),fb="undefined"!=typeof TextDecoder&&new TextDecoder;try{fb.decode(fv,{stream:!0})}catch(e){}let fw={gzip_data:"gzip"},fT={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},fM={uint32:1,uint16:2,uint8:4},fE={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class fS{constructor(e=1){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){return this.layers[e]}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new p4("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){let i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length<r)throw new p4(`Expected header with length >= ${r} but got buffer of length ${i.length}`);let a=new cm(i.subarray(0,r)),n=p2.read(a);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new p4(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);for(let e of(this.x=n.x,this.y=n.y,this.z=n.z,n.layers))this.layers[e.name]=new fA(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){let i=[],r=this.getLayer(e.layerName);for(let a=0;a<r.dataIndex.length;a++){let n=r.dataIndex[a],o=n.first_byte-e.firstByte,s=n.last_byte+1-e.firstByte;if(a<e.firstBlock||a>e.lastBlock||r._blocksInProgress.has(a))continue;let l={layerName:r.name,firstByte:o,lastByte:s,pixelFormat:r.pixelFormat,blockIndex:a,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};r._blocksInProgress.add(a),i.push(l)}return new fI(i,()=>{i.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,a)=>{if(i.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;a.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class fA{constructor({version:e,name:i,units:r,tilesize:a,pixel_format:n,buffer:o,data_index:s},l){if(this.version=e,1!==this.version)throw new p4(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=o,this.pixelFormat=fT[n],this.dataIndex=s,this.bandShape=[a+2*o,a+2*o,fM[this.pixelFormat]],this._decodedBlocks=function(e=1e3,i=0,r=!1){if(isNaN(e)||e<0)throw TypeError("Invalid max value");if(isNaN(i)||i<0)throw TypeError("Invalid ttl value");if("boolean"!=typeof r)throw TypeError("Invalid resetTtl value");return new p5(e,i,r)}(l?l.cacheSize:5),this._blocksInProgress=new Set}processDecodedData(e){let i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.set(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(let[r,a]of this.dataIndex.entries()){for(let[n,o]of a.bands.entries())if(o===e)return{bandIndex:i+n,blockIndex:r,blockBandIndex:n};i+=a.bands.length}break;case"number":for(let[r,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new p4(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new p4(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,r=-1/0,a=1/0,n=-1/0;for(let o of e){let{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new p4(`Invalid band: ${JSON.stringify(o)}`);let s=this.dataIndex[e];a=Math.min(a,e),n=Math.max(n,e),i=Math.min(i,s.first_byte),r=Math.max(r,s.last_byte)}return{layerName:this.name,firstByte:i,lastByte:r,firstBlock:a,lastBlock:n}}hasBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){let{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e),a=this._decodedBlocks.get(i.toString());if(!a)throw new p4(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);let n=this.dataIndex[i],o=this.bandShape.reduce((e,i)=>e*i,1),s=r*o,l=a.subarray(s,s+o);return{data:l,bytes:new Uint8Array(l.buffer).subarray(l.byteOffset,l.byteOffset+l.byteLength),tileSize:this.tileSize,buffer:this.buffer,offset:n.offset,scale:n.scale}}}class fI{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}fS.performDecoding=function(e,i){return Promise.all(i.tasks.map(i=>
7{let{layerName:r,firstByte:a,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:l,filters:h,codec:u}=i,c=new Uint8Array(e).subarray(a,n+1),d=new Uint32Array(s[0]*s[1]*s[2]);if("gzip_data"!==u)throw Error(`Unhandled codec: ${u}`);return(function(e,i){var r,a;if(!globalThis.DecompressionStream&&"gzip_data"===i)return Promise.resolve(((a=function(e){31==e[0]&&139==e[1]&&8==e[2]||fx(6,"invalid gzip data");var i=e[3],r=10;4&i&&(r+=2+(e[10]|e[11]<<8));for(var a=(i>>3&1)+(i>>4&1);a>0;a-=!e[r++]);return r+(2&i)}(e))+8>e.length&&fx(6,"invalid gzip data"),function(e,i,r,a){var n,o,s,l=e.length;if(!l||i.f&&!i.l)return r||new p6(0);var h=!r,u=h||2!=i.i,c=i.i;h&&(r=new p6(3*l));var d=function(e){var i=r.length;if(e>i){var a=new p6(Math.max(2*i,e));a.set(r),r=a}},p=i.f||0,f=i.p||0,m=i.b||0,_=i.l,g=i.d,y=i.m,x=i.n,v=8*l;do{if(!_){p=f_(e,f,1);var b=f_(e,f+1,3);if(f+=3,!b){var w=e[(L=4+((f+7)/8|0))-4]|e[L-3]<<8,T=L+w;if(T>l){c&&fx(0);break}u&&d(m+w),r.set(e.subarray(L,T),m),i.b=m+=w,i.p=f=8*T,i.f=p;continue}if(1==b)_=fp,g=ff,y=9,x=5;else if(2==b){var M=f_(e,f,31)+257,E=f_(e,f+10,15)+4,S=M+f_(e,f+5,31)+1;f+=14;for(var A=new p6(S),I=new p6(19),C=0;C<E;++C)I[ft[C]]=f_(e,f+3*C,7);f+=3*E;var P=fm(I),z=(1<<P)-1,D=fu(I,P,1);for(C=0;C<S;){var L,R=D[f_(e,f,z)];if(f+=15&R,(L=R>>4)<16)A[C++]=L;else{var k=0,O=0;for(16==L?(O=3+f_(e,f,3),f+=2,k=A[C-1]):17==L?(O=3+f_(e,f,7),f+=3):18==L&&(O=11+f_(e,f,127),f+=7);O--;)A[C++]=k}}var B=A.subarray(0,M),F=A.subarray(M);y=fm(B),x=fm(F),_=fu(B,y,1),g=fu(F,x,1)}else fx(1);if(f>v){c&&fx(0);break}}u&&d(m+131072);for(var N=(1<<y)-1,V=(1<<x)-1,U=f;;U=f){var j=(k=_[fg(e,f)&N])>>4;if((f+=15&k)>v){c&&fx(0);break}if(k||fx(2),j<256)r[m++]=j;else{if(256==j){U=f,_=null;break}var G=j-254;j>264&&(G=f_(e,f,(1<<($=p7[C=j-257]))-1)+fa[C],f+=$);var Z=g[fg(e,f)&V],q=Z>>4;if(Z||fx(3),f+=15&Z,F=fo[q],q>3){var $=fe[q];F+=fg(e,f)&(1<<$)-1,f+=$}if(f>v){c&&fx(0);break}u&&d(m+131072);var W=m+G;if(m<F){var H=0-F,X=Math.min(F,W);for(H+m<0&&fx(3);m<X;++m)r[m]=a[H+m]}for(;m<W;++m)r[m]=r[m-F]}}i.l=_,i.p=U,i.b=m,i.f=p,_&&(p=1,i.m=y,i.d=g,i.n=x)}while(!p);return m!=r.length&&h?(n=r,(o=0)<0&&(o=0),(null==(s=m)||s>n.length)&&(s=n.length),new p6(n.subarray(o,s))):r.subarray(0,m)}(e.subarray(a,-8),{i:2},new p6((e[(r=e.length)-4]|e[r-3]<<8|e[r-2]<<16|e[r-1]<<24)>>>0),void 0)));let n=fw[i];if(!n)throw Error(`Unhandled codec: ${i}`);let o=new globalThis.DecompressionStream(n);return new Response(new Blob([e]).stream().pipeThrough(o)).arrayBuffer().then(e=>new Uint8Array(e))})(c,u).then(e=>{let i=p3.read(new cm(e));if("uint32_values"===i.values)return i.uint32_values.readValuesInto(d),new fE[o](d.buffer);throw Error(`Unhandled numeric data "${i.values}"`)}).then(e=>{for(let i=h.length-1;i>=0;i--)switch(h[i]){case"delta_filter":(function(e,i){if(4!==i.length)throw Error(`Expected data of dimension 4 but got ${i.length}.`);let r=i[3];for(let a=2;a>=1;a--){let n=1===a?1:0,o=2===a?1:0;for(let a=0;a<i[0];a++){let s=i[1]*a;for(let a=n;a<i[1];a++){let n=i[2]*(a+s);for(let a=o;a<i[2];a++){let o=i[3]*(a+n);for(let a=0;a<i[3];a++){let i=o+a;e[i]+=e[i-r]}}}}r*=i[a]}})(e,s);break;case"zigzag_filter":(function(e){for(let i=0,r=e.length;i<r;i++)e[i]=e[i]>>>1^-(1&e[i])})(e);break;case"bitshuffle_filter":(function(e,i){switch(i){case"uint32":return;case"uint16":for(let i=0;i<e.length;i+=2){let r=e[i],a=e[i+1];e[i]=(240&r)>>4|(61440&r)>>8|(240&a)<<4|61440&a,e[i+1]=15&r|(3840&r)>>4|(15&a)<<8|(3840&a)<<4}return;case"uint8":for(let i=0;i<e.length;i+=4){let r=e[i],a=e[i+1],n=e[i+2],o=e[i+3];e[i+0]=(192&r)>>6|(192&a)>>4|(192&n)>>2|192&o,e[i+1]=(48&r)>>4|(48&a)>>2|48&n|(48&o)<<2,e[i+2]=(12&r)>>2|12&a|(12&n)<<2|(12&o)<<4,e[i+3]=3&r|(3&a)<<2|(3&n)<<4|(3&o)<<6}return;default:throw Error(`Invalid pixel format, "${i}"`)}})(e,o);break;default:throw Error(`Unhandled filter "${h[i]}"`)}return{layerName:r,blockIndex:l,data:e}}).catch(e=>{throw e})}))},rI(fI,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});let fC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class fP{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(e,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=fC[15&r];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new fP(s,o,n,e)}constructor(e,i=64,r=Float64Array,a){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let n=fC.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+l),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);
7return function e(i,r,a,n,o,s){if(o-n<=a)return;let l=n+o>>1;(function e(i,r,a,n,o,s){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);e(i,r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}let l=r[2*a+s],h=n,u=o;for(fz(i,r,n,a),r[2*o+s]>l&&fz(i,r,n,o);h<u;){for(fz(i,r,h,u),h++,u--;r[2*h+s]<l;)h++;for(;r[2*u+s]>l;)u--}r[2*n+s]===l?fz(i,r,n,u):fz(i,r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}})(i,r,l,n,o,s),e(i,r,a,n,l-1,1-s),e(i,r,a,l+1,o,1-s)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,l=[0,n.length-1,0],h=[];for(;l.length;){let u=l.pop()||0,c=l.pop()||0,d=l.pop()||0;if(c-d<=s){for(let s=d;s<=c;s++){let l=o[2*s],u=o[2*s+1];l>=e&&l<=r&&u>=i&&u<=a&&h.push(n[s])}continue}let p=d+c>>1,f=o[2*p],m=o[2*p+1];f>=e&&f<=r&&m>=i&&m<=a&&h.push(n[p]),(0===u?e<=f:i<=m)&&(l.push(d),l.push(p-1),l.push(1-u)),(0===u?r>=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:o}=this,s=[0,a.length-1,0],l=[],h=r*r;for(;s.length;){let u=s.pop()||0,c=s.pop()||0,d=s.pop()||0;if(c-d<=o){for(let r=d;r<=c;r++)fL(n[2*r],n[2*r+1],e,i)<=h&&l.push(a[r]);continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];fL(f,m,e,i)<=h&&l.push(a[p]),(0===u?e-r<=f:i-r<=m)&&(s.push(d),s.push(p-1),s.push(1-u)),(0===u?e+r>=f:i+r>=m)&&(s.push(p+1),s.push(c),s.push(1-u))}return l}}function fz(e,i,r,a){fD(e,r,a),fD(i,2*r,2*a),fD(i,2*r+1,2*a+1)}function fD(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function fL(e,i,r,a){let n=e-r,o=i-a;return n*n+o*o}e.$=c5,e.A=rc,e.B=rl,e.C=tO,e.D=at,e.E=eJ,e.F=r9,e.G=r4,e.H=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return H(e.expression.evaluate(i))}interpolate(e,i,r){return{x:e4(e.x,i.x,r),y:e4(e.y,i.y,r),z:e4(e.z,i.z,r),azimuthal:e4(e.azimuthal,i.azimuthal,r),polar:e4(e.polar,i.polar,r)}}},e.I=cB,e.J=rQ,e.K=rY,e.L=n5,e.M=class{constructor(e,i,r,a){this.id=e,this.position=null!=i?new nU(i[0],i[1]):new nU(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=a,this.uploaded=!1,this.aabb=new lI([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(i,r){if(e.a6.multiply(i.matrix,r,i.matrix),i.meshes)for(let e of i.meshes){let r=lI.applyTransform(e.aabb,i.matrix);this.aabb.encapsulate(r)}if(i.children)for(let e of i.children)this._applyTransformations(e,i.matrix)}computeBoundsAndApplyParent(){let i=e.a6.identity([]);for(let e of this.nodes)this._applyTransformations(e,i)}computeModelMatrix(e,i,r,a,n,o,s=!1){pn(this.matrix,this,e.transform,this.position,i,r,a,n,o,s)}upload(e){if(!this.uploaded){for(let i of this.nodes)ps(i,e);for(let e of this.nodes)pl(e);this.uploaded=!0}}destroy(){for(let e of this.nodes)ph(e)}},e.O=z,e.P=T,e.Q=r5,e.R=eE,e.S=lK,e.T=dz,e.U=e4,e.V=8192,e.W=e6,e.X=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return function([e,i]){let r=H([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:e4(e.x,i.x,r),y:e4(e.y,i.y,r),z:e4(e.z,i.z,r)}}},e.Y=function(e,i,r=0,a=!0){let n=new T(r,r),o=e.sub(n),s=i.add(n),l=[o,new T(s.x,o.y),s,new T(o.x,s.y)];return a&&l.push(o.clone()),l},e.Z=rw,e._=function(e,i){let r=[];for(let a=0;a<e.length;a++){let n=D(a-1,-1,e.length-1),o=D(a+1,-1,e.length-1),s=e[a],l=e[o],h=e[n].sub(s).unit(),u=l.sub(s).unit(),c=u.angleWithSep(h.x,h.y),d=h.add(u).unit().mult(-1*i/Math.sin(c/2));r.push(s.add(d))}return r},e.a=eK,e.a$=function(e){let i=[];for(let r in e)i.push(e[r]);return i},e.a0=oh,e.a1=function(i,r,a=0){return e.N.fromValues(((r.x-a)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,r.z*nX(nQ(r.y)))},e.a2=lb,e.a3=uU,e.a4=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);return{min:new T(i,r),max:new T(a,n)}},e.a5=nY,e.a8=ol,e.a9=n4,e.aA=i9,e.aB=a9,e.aC=O,e.aD=aY,e.aE=db,e.aF=function(){rX.isLoading()||rX.isLoaded()||"deferred"!==rW()||rH()},e.aG=ar,e.aH=n9,e.aI=pZ,e.aJ=Y,e.aK=uF,e.aL=hR,e.aM=n8,e.aN=ax,e.aO=aG,e.aP=lz,e.aQ=hC,e.aR=dP,e.aS=function(i,r){let a=lK(r.zoom);if(0===a)return lB(i);let n=lU(i),o=lj(n),s=nY(n.getWest())*r.worldSize,l=nY(n.getEast())*r.worldSize,h=nK(n.getNorth())*r.worldSize,u=nK(n.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=e.a6.invert([],r.globeMatrix);return e.N.transformMat4(c,c,m),e.N.transformMat4(d,d,m),e.N.transformMat4(p,p,m),e.N.transformMat4(f,f,m),o[0]=lF(o[0],p,a),o[1]=lF(o[1],f,a),o[2]=lF(o[2],d,a),o[3]=lF(o[3],c,a),lI.fromPoints(o)},e.aT=l$,e.aU=lG,e.aV=lF,e.aW=av,e.aX=lP,e.aY=V,e.aZ=fS,e.a_=eC,e.aa=P,e.ab=nk,e.ac=function(e,i){let r={};for(let a=0;a<i.length;a++){let n=i[a];n in e&&(r[n]=e[n])}return r}
7,e.ad=nj,e.ae=nK,e.af=class{constructor(e){this.entries={},this.scheduler=e}request(e,i,r,a){let n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){let[e,r]=n.result;return this.scheduler?this.scheduler.add(()=>{a(e,r)},i):a(e,r),()=>{}}return n.callbacks.push(a),n.cancel||(n.cancel=r((r,a)=>{for(let e of(n.result=[r,a],n.callbacks))this.scheduler?this.scheduler.add(()=>{e(r,a)},i):e(r,a);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==a),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.ag=ac,e.ah=function(e,i,r){let a=JSON.stringify(e.request);return e.data&&(this.deduped.entries[a]={result:[null,e.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},i=>{let a=eC(e.request,(e,a,n,o)=>{e?i(e):a&&i(null,{vectorTile:r?void 0:new hX(new cm(a)),rawData:a,cacheControl:n,expires:o})});return()=>{a.cancel(),i()}},i)},e.ai=function(e){++eg>ed&&(e.getActor().send("enforceCacheSizeLimit",ec),eg=0)},e.aj=eV,e.ak=el,e.al=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.am=n$,e.an=dB,e.ao=dV,e.ap=dO,e.aq=function(e,i){let r=document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let i=0;i<e.length;i++){let a=document.createElement("source");(function(e){let i=document.createElement("a");return i.href=e,i.protocol===location.protocol&&i.host===location.host})(e[i])||(r.crossOrigin="Anonymous"),a.src=e[i],r.appendChild(a)}return{cancel:()=>{}}},e.ar=dD,e.as=c3,e.at=nJ,e.au=nQ,e.av=ab,e.aw=aO,e.ax=e5,e.ay=ag,e.az=aZ,e.b=eY,e.b$=rZ,e.b0=function(e,i){let r=[];for(let a in e)a in i||r.push(a);return r},e.b1=L,e.b2=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.b3=function(i,r){let{x:a,y:n}=i.point,o=lY(a,n,i.worldSize/i._pixelsPerMercatorPixel,0,0);return e.a6.multiply(o,o,lW(lB(r)))},e.b5=u5,e.b6=cx,e.b7=u3,e.b8=function(e,i,r,a,n){let o=5*i+2;e.float32[o+0]=r,e.float32[o+1]=a,e.float32[o+2]=n},e.b9=dy,e.bA=dH,e.bB=d$,e.bC=function(i){let r=d$(i,!0);return e.b4.invert([],[r[0],r[1],r[4],r[5]])},e.bD=lw,e.bE=function(e){let{x:i,y:r}=e.point,{lng:a,lat:n}=e._center;return lY(i,r,e.worldSize,a,n)},e.bF=function(e){return e*E},e.bG=5,e.bH=function(e){return S[Math.round((e+45+360)%360/90)%4]},e.bI=45,e.bJ=nX,e.bK=nx,e.bL=nf,e.bM=nm,e.bN=np,e.bO=nd,e.bP=n_,e.bQ=function(e,i,r){let a=Math.sqrt(e*e+i*i+r*r),n=a>0?Math.acos(r/a)*E:0,o=0!==e||0!==i?Math.atan2(-i,-e)*E+90:0;return o<0&&(o+=360),[a,o,n]},e.bR=n3,e.bS=lI,e.bT=H,e.bU=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.bV=function(e){return e({pluginStatus:rj,pluginURL:rG}),r$.on("pluginStateChange",e),e},e.bW=pp,e.bX=py,e.bY=cj,e.bZ=cU,e.b_=eA,e.ba=ck,e.bb=oi,e.bc=24,e.bd=cY,e.be=cK,e.bf=cI,e.bg=fP,e.bh=D,e.bj=function(e){return e*M},e.bk=en,e.bl=function(e,i){return e/nX(i)},e.bm=function(e,i,r){e[4*i+0]=r[0],e[4*i+1]=r[1],e[4*i+2]=r[2],e[4*i+3]=r[3]},e.bn=nU,e.bo=dd,e.bp=nq,e.bq=lA,e.br=dW,e.bs=nZ,e.bt=lV,e.bu=function(e,i,r,a,n,o,s,l,h){if("globe"===h.name)return lV(e,i,new nZ(r,a,n),!1);let u=c3({z:r,x:a,y:n},h);return new lI([(o+u.x/u.scale)*i,u.y/u.scale*i,s],[(o+u.x2/u.scale)*i,u.y2/u.scale*i,l])},e.bv=function(e,i,r){let a=0;for(let n=0;n<2;++n){let o=r?r[n]:0;e[n]>o&&(a+=(e[n]-o)*(e[n]-o)),i[n]<o&&(a+=(o-i[n])*(o-i[n]))}return a},e.bw=85.051129,e.bx=6,e.by=function(i){let r=e.a6.identity(new Float64Array(16));e.a6.multiply(r,i.pixelMatrix,i.globeMatrix);let a=[0,nB,0],n=[0,nk,0];return e.N.transformMat4(a,a,r),e.N.transformMat4(n,n,r),[a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!lQ(i,new nU(i.center.lat,90)),n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!lQ(i,new nU(i.center.lat,-90))]},e.bz=function(i,r){let{scale:a}=i.tileTransform,n=8192*a/(i.tileSize*Math.pow(2,r.zoom-i.tileID.overscaledZ+i.tileID.canonical.z));return e.b4.scale(new Float32Array(4),r.inverseAdjustmentMatrix,[n,n])},e.c=pU,e.c$=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.c0=p,e.c1=Z,e.c2=function(e,i,r){return"custom"===e.type?new dU(e,i):new p1[e.type](e,i,r)},e.c3=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.c4=function(e){return e.indexOf("\x1f")>=0},e.c5=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.c6=function(e){let i=[],r=e.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&i.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},e.c7=G,e.c8=r$,e.c9=eI,e.cA=uZ,e.cB=(e,i,r,a,n,o)=>{let s=e.transform;return{u_matrix:uG(e,i,r,a),u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(i),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:uj(i,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alph
7a_discard_threshold:0,u_trim_offset:o}},e.cC=(e,i,r,a,n,o,s)=>{let l=e.transform,h=l.calculatePixelsToTileUnitsMatrix(i);return{u_matrix:uG(e,i,r,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:o,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:uq(r)&&i.lineAtlasTexture?i.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:uj(i,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s,u_emissive_strength:r.paint.get("line-emissive-strength")}},e.cD=F,e.cE=hs,e.cF=uE,e.cG=nH,e.cH=uy,e.cI=2147483648,e.cJ=450,e.cK=7,e.cL=.0038760859073359074,e.cM=256,e.cN=lW,e.cO=aV,e.cP=aU,e.cQ=function(e,i,r,a,n){return P((e-i)/(r-i)*(n-a)+a,a,n)},e.cR=n1,e.cS=d0,e.cT=[1,1,1],e.cU=ua,e.cV=pa,e.cW=az,e.cX=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[]}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e){let i=h1(new T(0,0),new T(8192,8192),e),r=[];for(let a of this._activeRegions){if(a.hiddenByOverlap||!h0(i,a))continue;let n=function(e,i,r){let a=1<<r.canonical.z,n=((i.x-r.wrap)*a-r.canonical.x)*8192,o=(i.y*a-r.canonical.y)*8192;return{min:new T(((e.x-r.wrap)*a-r.canonical.x)*8192,(e.y*a-r.canonical.y)*8192),max:new T(n,o)}}(a.min,a.max,e);r.push({min:n.min,max:n.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId})}return r}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{let i=[];for(let r of e.cache.getVisibleCoordinates()){let a=e.cache.getTile(r).buckets[e.layer];if(a)for(let e of a.getNodesInfo()){let a=e.node;a.footprint&&i.push({footprint:a.footprint,id:r.toUnwrapped()})}}return i}})))}_addSource(e){let i=e.getFootprints();if(0!==i.length){for(let e of i){if(!e.footprint)continue;let i=h1(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:i.min,max:i.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint})}this._sourceIds.push(e.getSourceId())}}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||hJ(e.min,i.min)||hJ(e.max,i.max));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let i=0,r=0;for(;!e&&i!==this._activeRegions.length;){let a=this._activeRegions[i],n=this._prevRegions[r];e=a.priority!==n.priority||!hQ(a,n),++i,++r}}if(e){++this._updateTime;let e=e=>{let i=this._activeRegions;if(e>=i.length)return e;let r=i[e].priority;for(;e<i.length&&i[e].priority===r;)++e;return e};if(this._sourceIds.length>1){let i=0,r=e(0);for(;i!==r;){let a=i,n=i;for(;a!==r;){let e=this._activeRegions[a];e.hiddenByOverlap=!1;for(let i=0;i<n;i++){let r=this._activeRegions[i];if(!r.hiddenByOverlap&&h0(e,r)&&(e.hiddenByOverlap=function e(i,r,a,n){if(!i||!a)return!1;let o=i.vertices;if(!r.canonical.equals(n.canonical)||r.wrap!==n.wrap){if(a.vertices.length<i.vertices.length)return e(a,n,i,r);let s=r.canonical,l=n.canonical,h=Math.pow(2,l.z-s.z);o=i.vertices.map(e=>new T(e.x*s.x*8192*h-8192*l.x,e.y*s.y*8192*h-8192*l.y))}return h2(a,o,i.indices,0,i.indices.length,0,0)}(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++a}r=e(i=r)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=e.length-1;i>=0;i--)this._addSource(e[i]);this._computeReplacement()}},e.cY=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){for(let e of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))e.destroy();for(let e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,i){let r=new ax,a=new aO,n=[],o=e+1+2,s=i[0]+1,l=i[0]+1+(1+i.length),h=(e,i,r)=>{let a=e===o-1?e-2:0===e?e:e-1;return[a+=r?24575:0,i]};for(let e=0;e<o;++e)r.emplaceBack(...h(e,0,!0));for(let e=0;e<s;++e)for(let i=0;i<o;++i)r.emplaceBack(...h(i,e,0===i||i===o-1));for(let e=0;e<i.length;++e){let a=i[e];for(let e=0;e<o;++e)r.emplaceBack(...h(e,a,!0))}for(let e=0;e<i.length;++e){let s=a.length,h=i[e]+1+2,u=new aO;for(let r=0;r<h-1;r++){let n=r===h-2,s=n?o*(l-i.length+e-r):o;for(let e=0;e<o-1;e++){let i=r*o+e;0===r||n||0===e||e===o-2?(u.emplaceBack(i+1,i,i+s),u.emplaceBack(i+s,i+s+1,i+1)):(a.emplaceBack(i+1,i,i+s),a.emplaceBack(i+s,i+s+1,i+1))}}let c=a9.simpleSegment(0,s,r.length,a.length-s);for(let e=0;e<u.uint16.length;e+=3)a.emplaceBack(u.uint16[e],u.uint16[e+1],u.uint16[e+2]);let d=a9.simpleSegment(0,s,r.length,a.length-s);n.push({withoutSkirts:c,withSkirts:d})}return{vertices:r,indices:a,segments:n}}_createGrid(e){let i=this._fillGridMeshWithLods(64,nO);this._gridSegments=i.segments,this._gridBuffer=e.createVertexBuffer(i.vertices,lz.members),this._gridIndexBuffer=e.createIndexBuffer(i.indices,!0)}_createPoles(e){let i=new aO;for(let e=0;e<=64;e++)i.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(i,!0);let r=new aV,a=new aV,n=new aV,o=new aV;this._poleSegments=[];for(let e=0,i=0;e<5;e++){let s=360/(1<<e);r.emplaceBack(0,-nk,0,.5,0),a.emplaceBack(0,-nk,0,.5,1),n.emplaceBack(0,-nk,0,.5,.5),o.emplaceBack(0,-nk,0,.5,.5);for(let e=0;e<=64;e++){let i=e/64,l=0,h=e4(0,s,i),[u,c,d]=nF(l1,l2,h,nk);r.emplaceBack(u,c,d,i,l),a.emplaceBack(u,c,d,i,1-l);let p=h*M;i=.5+.5*Math.sin(p),l=.5+.5*Math.cos(p),n.emplaceBack(u,c,d,i,l),o.emplaceBack(u,c,d,i,1-l)}this._poleSegments.push(a9.simpleSegment(i,0,66,64)),i+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,lC,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(a,lC,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,lC,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,lC,!1)}getGridBuffers(e,i){return[this._gridBuffer,this._gridIndexBuffer,i?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,i){return[i?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,i?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.cZ=function(e){return eW.has(e)},e.c_=I,e.ca=ng,e.cb=class extends nc{constructor(e){super(e),this.current=nv}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<9;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}},e.cc=A,e.cd=function(e,i,r){let a=lK(r.zoom),n=e.style.map._antialias,o=i.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===a&&!n&&!o},e.ce=function(i){let r=i.pixelsPerMeter,a=r/(1/nX(i.center.lat)),n=e.a6.identity(new Float64Array(16));return e.a6.translate(n,n,[i.point.x,i.point.y,0]),e.a6.scale(n,n,[a,a,r]),Float32Array.from(n)},e.cf=lU,e.cg=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=P(e,-80.051129,80.051129)/80.051129*90)*M)),3)*(nO.length-1))},e.ch=function(i,r,a,n){let o=r.getNorth(),s=r.getSouth(),l=r.getWest(),h=r.getEast(),u=1<<i.z,c=h-l,d=o-s,p=c/64,f=-d/nO[a],m=[0,p,0,f,0,0,o,l,0];if(i.z>0){let i=180/n;e.co.multiply(m,m,[i/c+1,0,0,0,i/d+1,0,-.5*i/p,.5*i/f,1])}return m[2]=u,m[5]=i.x,m[8]=i.y,m},e.ci=lB,e.cj=function(i,r,a){let n=e.a6.identity(new Float64Array(16));return e.a6.rotateY(n,a.globeMatrix,(r/(1<<i)-.5)*Math.PI*2),Float32Array.from(n)},e.ck=class{isDataAvailableAtPoint(e){let i=this._source();if(this.isUsingMockSource()||!i||e.y<0||e.y>1)return!1;let r=i.getSource().maxzoom,a=1<<r,n=Math.floor(e.x),o=Math.floor((e.x-n)*a),s=Math.floor(e.y*a),l=this.findDEMTileFor(new n$(r,n,r,o,s));return!(!l||!l.dem)}
7getAtPointOrZero(e,i=0){return this.getAtPoint(e,i)||0}getAtPoint(e,i,r=!0){if(this.isUsingMockSource())return null;null==i&&(i=null);let a=this._source();if(!a||e.y<0||e.y>1)return i;let n=a.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),l=e.x-s,h=new n$(n,s,n,Math.floor(l*o),Math.floor(e.y*o)),u=this.findDEMTileFor(h);if(!u||!u.dem)return i;let c=u.dem,d=1<<u.tileID.canonical.z,p=(l*d-u.tileID.canonical.x)*c.dim,f=(e.y*d-u.tileID.canonical.y)*c.dim,m=Math.floor(p),_=Math.floor(f);return(r?this.exaggeration():1)*e4(e4(c.get(m,_),c.get(m,_+1),f-_),e4(c.get(m+1,_),c.get(m+1,_+1),f-_),p-m)}getAtTileOffset(e,i,r){let a=1<<e.canonical.z;return this.getAtPointOrZero(new n5(e.wrap+(e.canonical.x+i/8192)/a,(e.canonical.y+r/8192)/a))}getAtTileOffsetFunc(i,r,a,n){return o=>{let s=this.getAtTileOffset(i,o.x,o.y),l=n.upVector(i.canonical,o.x,o.y),h=n.upVectorScale(i.canonical,r,a).metersToTile;return e.N.scale(l,l,s*h),l}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=ua.create(this,e,a);return!!n&&(i.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;let i=this.findDEMTileFor(e);if(!i||!i.dem)return null;let r=i.dem.tree,a=i.tileID,n=1<<e.canonical.z-a.canonical.z,o=e.canonical.x/n-a.canonical.x,s=e.canonical.y/n-a.canonical.y,l=0;for(let i=0;i<e.canonical.z-a.canonical.z&&!r.leaves[l];i++){let e=2*Math.floor(s*=2)+Math.floor(o*=2);l=r.childOffsets[l]+e,o%=1,s%=1}return{min:this.exaggeration()*r.minimums[l],max:this.exaggeration()*r.maximums[l]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(e,i,r){throw Error("Pure virtual method called.")}pointCoordinate(e){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(e){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let e=this.visibleDemTiles;if(0===e.length)return null;let i=!1,r=Number.MAX_VALUE,a=Number.MIN_VALUE;for(let n of e){let e=this.getMinMaxForTile(n.tileID);e&&(r=Math.min(r,e.min),a=Math.max(a,e.max),i=!0)}return i?{min:r,max:a}:null}},e.cl=lD,e.cm=ha,e.cn=function(e,i){return[Math.pow(e[0],2.2)*i,Math.pow(e[1],2.2)*i,Math.pow(e[2],2.2)*i]},e.cp=lX,e.cq=256,e.cr=function(i,r){let a=[0,0,0],n=l$(lB(r.canonical));return e.N.transformMat4(a,a,n),e.N.transformMat4(a,a,i),a},e.cs=e=>({u_camera_to_center_distance:new np(e),u_extrude_scale:new nw(e),u_device_pixel_ratio:new np(e),u_matrix:new nx(e),u_inv_rot_matrix:new nx(e),u_merc_center:new nf(e),u_tile_id:new nm(e),u_zoom_transition:new np(e),u_up_dir:new nm(e),u_emissive_strength:new np(e)}),e.ct=e=>({u_matrix:new nx(e),u_pixels_to_tile_units:new nw(e),u_device_pixel_ratio:new np(e),u_units_to_pixels:new nf(e),u_dash_image:new nd(e),u_gradient_image:new nd(e),u_image_height:new np(e),u_texsize:new nf(e),u_tile_units_to_pixels:new np(e),u_alpha_discard_threshold:new np(e),u_trim_offset:new nf(e),u_emissive_strength:new np(e)}),e.cu=e=>({u_matrix:new nx(e),u_texsize:new nf(e),u_pixels_to_tile_units:new nw(e),u_device_pixel_ratio:new np(e),u_image:new nd(e),u_units_to_pixels:new nf(e),u_tile_units_to_pixels:new np(e),u_alpha_discard_threshold:new np(e),u_trim_offset:new nf(e)}),e.cv=aR,e.cw=u1,e.cx=u4,e.cy=l5,e.cz=(e,i,r,a,n,o)=>{let s;let l=e.transform,h="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment")){if(h){let e=lX(l.zoom,i.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([e,0,0,e])}else s=l.calculatePixelsToTileUnitsMatrix(r)}else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);let u={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(l.projection),u_matrix:e.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:eh.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:l3,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(h){u.u_inv_rot_matrix=a,u.u_merc_center=n,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=lK(l.zoom);let e=8192*n[0],r=8192*n[1];u.u_up_dir=l.projection.upVector(new nZ(0,0,0),e,r)}return u},e.d=ez,e.d0=C,e.d1=n2,e.d2=nN,e.d3=function([e,i,r]){let a=Math.hypot(e,i,r);return new nU(Math.atan2(e,r)*E,(.5*Math.PI-Math.acos(-i/a))*E)}
7,e.d4=6371008.8,e.d5=c,e.d6=lQ,e.d7=lJ,e.d8=function(i){let r=[0,0,0],a=e.a6.identity(new Float64Array(16));return e.a6.multiply(a,i.pixelMatrix,i.globeMatrix),e.N.transformMat4(r,r,a),new T(r[0],r[1])},e.d9=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==er){let i=e.navigator?e.navigator.userAgent:null;er=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return er}(e)&&i&&(i.match("Version/15.4")||i.match("Version/15.5")||i.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dA=2,e.dB=pj,e.dC=pq,e.dD=uk,e.dE=j,e.dF=cF,e.dG=function(e,i,r,a,n,o,s,l,h,u,c){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let d=e.layers[0].layout,p=e.layers[0]._unevaluatedLayout._values,f={};if("composite"===e.textSizeData.kind){let{minZoom:i,maxZoom:r}=e.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new rY(i),l),p["text-size"].possiblyEvaluate(new rY(r),l)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new rY(i),l),p["icon-size"].possiblyEvaluate(new rY(r),l)]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new rY(h+1),l),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new rY(h+1),l),f.textMaxSize=p["text-size"].possiblyEvaluate(new rY(18),l);let m="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),_=d.get("text-size"),g=!1;for(let i of e.features)if(i.icon&&i.icon.nameSecondary){g=!0;break}for(let o of e.features){let h=d.get("text-font").evaluate(o,{},l).join(","),p=_.evaluate(o,{},l),y=f.layoutTextSize.evaluate(o,{},l),x=(f.layoutIconSize.evaluate(o,{},l),{horizontal:{},vertical:void 0}),v=o.text,b,w=[0,0];if(v){let a=v.toString(),s=24*d.get("text-letter-spacing").evaluate(o,{},l),u=24*d.get("text-line-height").evaluate(o,{},l),c=!function(e){for(let r of e){var i;if(i=r.charCodeAt(0),rL.Arabic(i)||rL["Arabic Supplement"](i)||rL["Arabic Extended-A"](i)||rL["Arabic Presentation Forms-A"](i)||rL["Arabic Presentation Forms-B"](i))return!1}return!0}(a)?0:s,f=d.get("text-anchor").evaluate(o,{},l),_=d.get("text-variable-anchor");if(!_){let e=d.get("text-radial-offset").evaluate(o,{},l);w=e?cY(f,[24*e,cH]):d.get("text-offset").evaluate(o,{},l).map(e=>24*e)}let g=m?"center":d.get("text-justify").evaluate(o,{},l),b="point"===d.get("symbol-placement"),T=b?24*d.get("text-max-width").evaluate(o,{},l):1/0,M=o=>{e.allowVerticalPlacement&&rR(a)&&(x.vertical=cw(v,i,r,n,h,T,u,f,o,c,w,cx.vertical,!0,y,p))};if(!m&&_){let e="auto"===g?_.map(e=>cK(e)):[g],a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(!x.horizontal[s]){if(a)x.horizontal[s]=x.horizontal[0];else{let e=cw(v,i,r,n,h,T,u,"center",s,c,w,cx.horizontal,!1,y,p);e&&(x.horizontal[s]=e,a=1===e.positionedLines.length)}}}M("left")}else{if("auto"===g&&(g=cK(f)),b||d.get("text-writing-mode").indexOf("horizontal")>=0||!rR(a)){let e=cw(v,i,r,n,h,T,u,f,g,c,w,cx.horizontal,!1,y,p);e&&(x.horizontal[g]=e)}M(b?"left":g)}}let E=!1;if(o.icon&&o.icon.namePrimary){let i=a[o.icon.namePrimary];i&&(b=function(e,i,r,a){let{horizontalAlign:n,verticalAlign:o}=cI(a),s=r[0]-e.displaySize[0]*n,l=r[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:i,top:l,bottom:l+e.displaySize[1],left:s,right:s+e.displaySize[0]}}(n[o.icon.namePrimary],o.icon.nameSecondary?n[o.icon.nameSecondary]:void 0,d.get("icon-offset").evaluate(o,{},l),d.get("icon-anchor").evaluate(o,{},l)),E=i.sdf,void 0===e.sdfIcons?e.sdfIcons=i.sdf:e.sdfIcons!==i.sdf&&$("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(i.pixelRatio!==e.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}let S=cQ(x.horizontal)||x.vertical;e.iconsInText||(e.iconsInText=!!S&&S.iconsInText),(S||b)&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){var _;let g,y=o.textMaxSize.evaluate(i,{},d);void 0===y&&(y=s);let x=e.layers[0].layout,v=x.get("icon-offset").evaluate(i,{},d),b=cQ(r.horizontal)||r.vertical,w="globe"===p.name,E=s/24,S=e.tilePixelRatio*y/24,A=(_=e.overscaling,e.zoom>18&&_>2&&(_>>=1),Math.max(8192/(512*_),1)*x.get("symbol-spacing")),I=x.get("text-padding")*e.tilePixelRatio,C=x.get("icon-padding")*e.tilePixelRatio,P=x.get("text-max-angle")*M,z="map"===x.get("text-rotation-alignment")&&"point"!==x.get("symbol-placement"),D="map"===x.get("icon-rotation-alignment")&&"point"!==x.get("symbol-placement"),L=x.get("symbol-placement"),R=A/2,k=x.get("icon-text-fit").evaluate(i,{},d),O=x.get("icon-text-fit-padding").evaluate(i,{},d),B="none"!==k;!1===e.hasAnyIconTextFit&&B&&(e.hasAnyIconTextFit=!0),a&&B&&(e.allowVerticalPlacement&&r.vertical&&(g=cP(a,r.vertical,k,O,v,E)),b&&(a=cP(a,b,k,O,v,E)));let F=(s,l,_)=>{if(l.x<0||l.x>=8192||l.y<0||l.y>=8192)return;let y=null;if(w){let{x:e,y:i,z:r}=p.projectTilePoint(l.x,l.y,_);y={anchor:new cz(e,i,r,0,void 0),up:p.upVector(_,l.x,l.y)}}!function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,M,E,S,A){let I=e.addToLineVertexArray(i,a),C,P,z,D,L,R,k,O=0,B=0,F=0,N=0,V=-1,U=-1,j={},G=ns(""),Z=r?r.anchor:i,q="none"!==h.layout.get("icon-text-fit").evaluate(b,{},E),W=0,H=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[W,H]=h.layout.get("text-offset").evaluate(b,{},E).map(e=>24*e):(W=24*h.layout.get("text-radial-offset").evaluate(b,{},E),H=cH),e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(m)R=c1(e),l&&(k=c1(l));else{let r=h.layout.get("text-rotate").evaluate(b,{},E)+90;z=c0(u,Z,i,c,d,p,e,f,r,_),l&&(D=c0(u,Z,i,c,d,p,l,y,r))}}if(o){let a=h.layout.get("icon-rotate").evaluate(b,{},E),n=cG(o,a,T,q),s=l?cG(l,a,T,q):void 0;P=c0(u,Z,i,c,d,p,o,y,a),O=4*n.length;let f=e.iconSizeData,m=null;"source"===f.kind?(m=[128*h.layout.get("icon-size").evaluate(b,{},E)])[0]>32640&&$(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===f.kind&&((m=[128*w.compositeIconSizes[0].evaluate(b,{},E),128*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>32640||m[1]>32640)&&$(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),e.addSymbols(e.icon,n,m,v,x,b,!1,r,i,I.lineStartIndex,I.lineLength,-1,M,E,S,A),V=e.icon.placedSymbolArray.length-1,s&&(B=4*s.length,e.addSymbols(e.icon,s,m,v,x,b,cx.vertical,r,i,I.lineStartIndex,I.lineLength,-1,M,E,S,A),U=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let o=n.horizontal[a];C||(G=ns(o.text),m?L=c1(o):C=c0(u,Z,i,c,d,p,o,f,h.layout.get("text-rotate").evaluate(b,{},E),_));let l=1===o.positionedLines.length;if(F+=cJ(e,r,i,o,s,h,m,b,_,I,n.vertical?cx.horizontal:cx.horizontalOnly,l?Object.keys(n.horizontal):[a],j,V,w,M,E,S),l)break}n.vertical&&(N+=cJ(e,r,i,n.vertical,s,h,m,b,_,I,cx.vertical,["vertical"],j,U,w,M,E,S));let X=-1,Y=(e,i)=>e?Math.max(e,i):i;X=Y(L,-1),X=Y(R,X);let K=(X=Y(k,X))>-1?1:0;e.glyphOffsetArray.length>=65535&&$("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKey
7Ranges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,Z.x,Z.y,Z.z,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,V,U,G,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==z?z:e.collisionBoxArray.length,void 0!==z?z+1:e.collisionBoxArray.length,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,D||e.collisionBoxArray.length,D?D+1:e.collisionBoxArray.length,c,F,N,O,B,K,0,W,H,X,0,q?1:0)}(e,l,y,s,r,a,n,g,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,I,z,h,0,C,D,v,i,o,u,c,d,f,m)};if("line"===L)for(let n of ck(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,o,s,l,h){let u=a?14.399999999999999*s:0,c=cR(a,n),d=c*s,p=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-d<i/4&&(i=d+i/4),function e(i,r,a,n,o,s,l,h,u){let c=s/2,d=cL(i),p=0,f=r-a,m=[];for(let e=0;e<i.length-1;e++){let r=i[e],l=i[e+1],h=r.dist(l),_=l.angleTo(r);for(;f+a<p+h;){let g=((f+=a)-p)/h,y=e4(r.x,l.x,g),x=e4(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new cz(y,x,0,_,e);n&&!cD(i,r,s,n,o)||m.push(r)}}p+=h}return h||m.length||l||(m=e(i,p/2,a,n,o,s,l,!0,u)),m}(e,p?i/2*l%i:(c/2+48)*s*l%i,i,u,r,d,p,!1,8192)}(n,A,P,r.vertical||b,a,0,S,e.overscaling,8192))b&&function(e,i,r,a){let n=e.compareText;if(i in n){let e=n[i];for(let i=e.length-1;i>=0;i--)if(a.dist(e[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(e,b.text,R,i)||F(n,i,d);else if("line-center"===L){for(let e of i.geometry)if(e.length>1){let i=function(e,i,r,a,n,o){let s=r?14.399999999999999*o:0,l=cR(r,a)*o,h=0,u=cL(e)/2;for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1],o=a.dist(n);if(h+o>u){let c=(u-h)/o,d=new cz(e4(a.x,n.x,c),e4(a.y,n.y,c),0,n.angleTo(a),r);return!s||cD(e,d,l,s,i)?d:void 0}h+=o}}(e,P,r.vertical||b,a,0,S);i&&F(e,i,d)}}else if("Polygon"===i.type)for(let e of hP(i.geometry,0)){let i=function(e,i=1,r=!1){let a=1/0,n=1/0,o=-1/0,s=-1/0,l=e[0];for(let e=0;e<l.length;e++){let i=l[e];(!e||i.x<a)&&(a=i.x),(!e||i.y<n)&&(n=i.y),(!e||i.x>o)&&(o=i.x),(!e||i.y>s)&&(s=i.y)}let h=Math.min(o-a,s-n),u=h/2,c=new t2([],c$);if(0===h)return new T(a,n);for(let i=a;i<o;i+=h)for(let r=n;r<s;r+=h)c.push(new cW(i+u,r+u,u,e));let d=function(e){let i=0,r=0,a=0,n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){let o=n[e],l=n[s],h=o.x*l.y-l.x*o.y;r+=(o.x+l.x)*h,a+=(o.y+l.y)*h,i+=3*h}return new cW(r/i,a/i,0,e)}(e),p=c.length;for(;c.length;){let a=c.pop();(a.d>d.d||!d.d)&&(d=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=i||(u=a.h/2,c.push(new cW(a.p.x-u,a.p.y-u,u,e)),c.push(new cW(a.p.x+u,a.p.y-u,u,e)),c.push(new cW(a.p.x-u,a.p.y+u,u,e)),c.push(new cW(a.p.x+u,a.p.y+u,u,e)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}(e,16);F(e[0],new cz(i.x,i.y,0,0,void 0),d)}else if("LineString"===i.type)for(let e of i.geometry)F(e,new cz(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===i.type)for(let e of i.geometry)for(let i of e)F([i],new cz(i.x,i.y,0,0,void 0),d)}(e,o,x,b,a,f,y,0,w,E,s,l,u,c,g)}o&&e.generateCollisionDebugBuffers(h,e.collisionBoxArray)},e.dH=hX,e.dI=cm,e.dJ=ur,e.dK=x,e.dL=hY,e.dM=hG,e.dN=w,e.dO=u7,e.dP=function(e){let i=0;if(1179937895!==new Uint32Array(e,0,1)[0]){let r=new Uint32Array(e,0,7),[,,a,n,o,s]=r;i=r.byteLength+n+o+s+o,(a!==e.byteLength||i>=e.byteLength)&&$("Invalid b3dm header information.")}return pO(e,i)},e.dQ=function(i,r){let a=pU(i);for(let i of a){for(let e of i.meshes)(function(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);let i=e.vertexArray.float32,r=e.aabb.min[0]-1,a=e.aabb.min[1]-1,n=64/(e.aabb.max[0]-r+2),o=64/(e.aabb.max[1]-a+2);for(let s=0;s<i.length;s+=3){let l=i[s+2],h=(i[s+0]-r)*n|0,u=(i[s+1]-a)*o|0;l>e.heightmap[64*u+h]&&(e.heightmap[64*u+h]=l)}})(e);i.lights&&(i.lightMeshIndex=i.meshes.length,i.meshes.push(function(i,r){let a={};a.indexArray=new aO,a.indexArray.reserve(4*i.length),a.vertexArray=new aZ,a.vertexArray.reserve(10*i.length),a.colorArray=new aM,a.vertexArray.reserve(10*i.length);let n=0;for(let o of i){let i=Math.min(10,Math.max(4,1.3*o.height))*r,s=[-o.normal[1],o.normal[0],0],l=Math.min(.29,.1*o.width/o.depth),h=o.width-2*o.depth*r*(l+.01),u=e.N.scaleAndAdd([],o.pos,s,h/2),c=e.N.scaleAndAdd([],o.pos,s,-h/2),d=[u[0],u[1],u[2]+o.height],p=[c[0],c[
71],c[2]+o.height],f=e.N.scaleAndAdd([],o.normal,s,l);e.N.scale(f,f,i);let m=e.N.scaleAndAdd([],o.normal,s,-l);e.N.scale(m,m,i),e.N.add(f,u,f),e.N.add(m,c,m),u[2]+=.1,c[2]+=.1,a.vertexArray.emplaceBack(f[0],f[1],f[2]),a.vertexArray.emplaceBack(m[0],m[1],m[2]),a.vertexArray.emplaceBack(u[0],u[1],u[2]),a.vertexArray.emplaceBack(c[0],c[1],c[2]),a.vertexArray.emplaceBack(d[0],d[1],d[2]),a.vertexArray.emplaceBack(p[0],p[1],p[2]),a.vertexArray.emplaceBack(u[0],u[1],u[2]),a.vertexArray.emplaceBack(c[0],c[1],c[2]),a.vertexArray.emplaceBack(f[0],f[1],f[2]),a.vertexArray.emplaceBack(m[0],m[1],m[2]);let _=h/i/2;a.colorArray.emplaceBack(-_-l,-1,_,.8),a.colorArray.emplaceBack(_+l,-1,_,.8),a.colorArray.emplaceBack(-_,0,_,1.3),a.colorArray.emplaceBack(_,0,_,1.3),a.colorArray.emplaceBack(_+l,-.8,_,.7),a.colorArray.emplaceBack(_+l,-.8,_,.7),a.colorArray.emplaceBack(0,0,_,1.3),a.colorArray.emplaceBack(0,0,_,1.3),a.colorArray.emplaceBack(_+l,-1.2,_,.8),a.colorArray.emplaceBack(_+l,-1.2,_,.8),a.indexArray.emplaceBack(6+n,4+n,8+n),a.indexArray.emplaceBack(7+n,9+n,5+n),a.indexArray.emplaceBack(0+n,1+n,2+n),a.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}let o={defined:!0,emissiveFactor:[0,0,0]},s={};return s.baseColorFactor=e5.white,o.pbrMetallicRoughness=s,a.material=o,a.aabb=new lI([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),a}(i.lights,r)))}return a},e.dR=pJ,e.dS=pd,e.dT=rX,e.dU=function(e){ef(),r&&r.then(i=>{i.keys().then(r=>{for(let a=0;a<r.length-e;a++)i.delete(r[a])})})},e.da=class{constructor(e,i,r){this._transformRequestFn=e,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){let e=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}normalizeStyleURL(e,i){if(!p(e))return e;let r=eR(e);return r.params.push(`sdk=js-${u}`),r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeGlyphsURL(e,i){if(!p(e))return e;let r=eR(e);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeModelURL(e,i){if(!p(e))return e;let r=eR(e);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeSourceURL(e,i,r,a){if(!p(e))return e;let n=eR(e);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),r&&n.params.push(`language=${r}`),a&&n.params.push(`worldview=${a}`),this._makeAPIURL(n,this._customAccessToken||i)}normalizeSpriteURL(e,i,r,a){let n=eR(e);return p(e)?(n.path=`/styles/v1${n.path}/sprite${i}${r}`,this._makeAPIURL(n,this._customAccessToken||a)):(n.path+=`${i}${r}`,ek(n))}normalizeTileURL(e,i,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!p(e))return e;let a=eR(e);a.path=a.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${i||r&&"raster"!==a.authority&&512===r?"@2x":""}${ey.supported?".webp":"$1"}`),"raster"===a.authority?a.path=`/${c.RASTER_URL_PREFIX}${a.path}`:"rasterarrays"===a.authority?a.path=`/${c.RASTERARRAYS_URL_PREFIX}${a.path}`:(a.path=a.path.replace(/^.+\/v4\//,"/"),a.path=`/${c.TILE_URL_VERSION}${a.path}`);let n=this._customAccessToken||function(e){for(let i of e){let e=i.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(a.params)||c.ACCESS_TOKEN;return c.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&a.params.push(`sku=${this._skuToken}`),this._makeAPIURL(a,n)}canonicalizeTileURL(e,i){let r=eR(e);if(!r.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!r.path.match(/\.[\w]+$/))return e;let a="mapbox://";r.path.match(/^\/raster\/v1\//)?a+=`raster/${r.path.replace(`/${c.RASTER_URL_PREFIX}/`,"")}`:r.path.match(/^\/rasterarrays\/v1\//)?a+=`rasterarrays/${r.path.replace(`/${c.RASTERARRAYS_URL_PREFIX}/`,"")}`:a+=`tiles/${r.path.replace(`/${c.TILE_URL_VERSION}/`,"")}`;let n=r.params;return i&&(n=n.filter(e=>!e.match(/^access_token=/))),n.length&&(a+=`?${n.join("&")}`),a}canonicalizeTileset(e,i){let r=!!i&&p(i),a=[];for(let i of e.tiles||[])d(i)?a.push(this.canonicalizeTileURL(i,r)):a.push(i);return a}_makeAPIURL(e,i){let r="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",a=eR(c.API_URL);if(e.protocol=a.protocol,e.authority=a.authority,"http"===e.protocol){let i=e.params.indexOf("secure");i>=0&&e.params.splice(i,1)}if("/"!==a.path&&(e.path=`${a.path}${e.path}`),!c.REQUIRE_ACCESS_TOKEN)return ek(e);if(i=i||c.ACCESS_TOKEN,!this._silenceAuthErrors){if(!i)throw Error(`An API access token is required to use Mapbox GL. ${r}`);if("s"===i[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return e.params=e.params.filter(e=>-1===e.indexOf("access_token")),e.params.push(`access_token=${i||""}`),ek(e)}},e.db=function(e,i){i?eW.add(e):eW.delete(e)},e.dc=ey,e.dd=eZ,e.de=e$,e.df=eD,e.dg=ej,e.dh=function(e){eW.delete(e)},e.di=eq,e.dj=eU,e.dk=u,e.dl=function(e,i){ec=e,ed=i},e.dm=function(e,i,r=!1){if(rj===rF||rj===rN||rj===rV)throw Error("setRTLTextPlugin cannot be called multiple times.");rG=eh.resolveURL(e),rj=rF,rU=i,rq(),r||rH()},e.dn=rW,e.dp=function(){py().acquire(p_)},e.dq=function(){let e=l;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(p_),l=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()"))},e.dr=pg,e.ds=function(e){let i=ep();if(!i)return;let r=i.delete(eu);e&&r.catch(e).then(()=>e())},e.dt=pf,e.du=pE,e.dv=function(e){pv=eh.resolveURL(e),pM||(pM=new pp(py(),new eJ)),pM.broadcast("setDracoUrl",pv)},e.dw=pS,e.dx=function(e){pw=eh.resolveURL(e),pM||(pM=new pp(py(),new eJ)),pM.broadcast("setMeshoptUrl",pw)},e.dy=rI,e.dz=hi,e.e=R,e.f=eh,e.g=function(e,i){return eI(R(e,{type:"json"}),i)},e.h=hr,e.i=tz,e.j=e9,e.k=rs,e.l=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(i=>pO(i,0,e))},e.m=rh,e.n=rx,e.o=ae,e.p=cO,e.q=rT,e.r=rv,e.s=ru,e.t=iy,e.u=r7,e.v=iv,e.w=$,e.x=ig,e.z=ai}),a(["./shared"],function(e){function i(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}
7class r{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,i){this._layerConfigs={},this._layers={},this.update(e,[],i)}update(i,r,a){for(let r of(this._options=a,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.c2(r,this.scope,this._options)).compileFilter(),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource={},function(i,r){let a={};for(let n=0;n<i.length;n++){let o=r&&r[i[n].id]||function(i){let r="";for(let a of e.b2)r+=`/${function e(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${e(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}:${e(i[a])},`;return`${r}}`}(i[a])}`;return r}(i[n]);r&&(r[i[n].id]=o);let s=a[o];s||(s=a[o]=[]),s.push(i[n])}let n=[];for(let e in a)n.push(a[e]);return n}(e.a$(this._layerConfigs),this.keyCache))){let e=i.map(e=>this._layers[e.id]),r=e[0];if("none"===r.visibility)continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]={});let o=r.sourceLayer||"_geojsonTileLayer",s=n[o];s||(s=n[o]=[]),s.push(e)}}}let a=1*e.dA;class n{constructor(i){let r={},n=[];for(let e in i){let o=i[e],s=r[e]={};for(let e in o.glyphs){let i=o.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;let r=i.metrics.localGlyph?a:1,l={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};n.push(l),s[e]=l}}let{w:o,h:s}=e.p(n),l=new e.dz({width:o||1,height:s||1});for(let n in i){let o=i[n];for(let i in o.glyphs){let s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;let h=r[n][i],u=s.metrics.localGlyph?a:1;e.dz.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=r}}e.dy(n,"GlyphAtlas");class o{constructor(i){this.tileID=new e.am(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.as(i.tileID.canonical,i.projection),this.projection=i.projection,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster}parse(i,r,a,o,l){let h,u,c,d;this.status="parsing",this.data=i,this.collisionBoxArray=new e.aD;let p=new e.dB(Object.keys(i.layers).sort()),f=new e.dC(this.tileID,this.promoteId);f.bucketLayerIDs=[];let m={},_=new e.dD(256,256),g={featureIndex:f,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:_,availableImages:a,brightness:this.brightness},y=r.familiesBySource[this.source];for(let r in y){let n=i.layers[r];if(!n)continue;let o=!1,l=!1,h=!1;for(let e of y[r])"symbol"===e[0].type?o=!0:l=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h||!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!l)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let u=p.encode(r),c=[];for(let e=0;e<n.length;e++){let i=n.feature(e),a=f.getId(i,r);c.push({feature:i,id:a,index:e,sourceLayerIndex:u})}for(let e of y[r]){let i=e[0];(!this.extraShadowCaster||i.is3D()&&"model"!==i.type)&&(void 0!==this.isSymbolTile&&"symbol"===i.type!==this.isSymbolTile||i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(s(e,this.zoom,g.brightness,a),(m[i.id]=i.createBucket({index:f.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:u,sourceID:this.source,projection:this.projection.spec})).populate(c,g,this.tileID.canonical,this.tileTransform),f.bucketLayerIDs.push(e.map(e=>e.id))))}}_.trim();let x={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(h)return this.status="done",l(h);if(this.extraShadowCaster)this.status="done",l(null,{buckets:e.a$(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:g.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(u&&c&&d){let i=new n(u),r=new e.dF(c,d);for(let n in m){let o=m[n];o instanceof e.aE?(s(o.layers,this.zoom,g.brightness,a),e.dG(o,u,i.positions,c,r.iconPositions,this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):o.hasPattern&&(o instanceof e.aK||o instanceof e.aL||o instanceof e.cH)&&(s(o.layers,this.zoom,g.brightness,a),o.addFeatures(g,this.tileID.canonical,r.patternPositions,a,this.tileTransform,this.brightness))}this.status="done",l(null,{buckets:e.a$(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:_,imageAtlas:r,brightness:g.brightness})}};if(!this.extraShadowCaster){let i=e.dE(g.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?o.send("getGlyphs",{uid:this.uid,stacks:i,scope:this.scope},(e,i)=>{h||(h=e,u=i,v())},void 0,!1,x):u={};let r=Object.keys(g.iconDependencies);r.length?o.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{h||(h=e,c=i,v())},void 0,!1,x):c={};let a=Object.keys(g.patternDependencies);a.length?o.send("getImages",{icons:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{h||(h=e,d=i,v())},void 0,!1,x):d={}}v()}}function s(i,r,a,n){let o=new e.K(r,{brightness:a});for(let e of i)e.recalculate(o,n)}class l extends e.E{constructor(i,r,a,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.loadVectorData=o||e.ah,this.loading={},this.loaded={},this.deduped=new e.af(i.scheduler),this.isSpriteLoaded=n,this.scheduler
7=i.scheduler,this.brightness=s}loadTile(r,a){let n=r.uid,s=r&&r.request,l=s&&s.collectResourceTiming,h=this.loading[n]=new o(r);h.abort=this.loadVectorData(r,(o,u)=>{let c=!this.loading[n];if(delete this.loading[n],c||o||!u)return h.status="done",c||(this.loaded[n]=h),a(o);let d=u.rawData,p={};u.expires&&(p.expires=u.expires),u.cacheControl&&(p.cacheControl=u.cacheControl),h.vectorTile=u.vectorTile||new e.dH(new e.dI(d));let f=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.actor,(r,n)=>{if(r||!n)return a(r);let o={};if(l){let e=i(s);e.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,e.e({rawTileData:d.slice(0)},n,p,o))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}):f()}),this.loaded=this.loaded||{},this.loaded[n]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid,o=this;if(a&&a[n]){let s=a[n];s.showCollisionBoxes=i.showCollisionBoxes,s.projection=i.projection,s.brightness=i.brightness,s.tileTransform=e.as(i.tileID.canonical,i.projection),s.extraShadowCaster=i.extraShadowCaster;let l=(e,i)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,s.parse(s.vectorTile,o.layerIndex,this.availableImages,o.actor,a)),r(e,i)};"parsing"===s.status?s.reloadCallback=l:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}else r(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class h{loadTile(i,r){let{uid:a,encoding:n,rawImageData:o,padding:s}=i,l=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;r(null,new e.dJ(a,l,n,s<1))}getImageData(e,i){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-i,-i,e.width+2*i,e.height+2*i);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}class u{decodeRasterArray({task:i,buffer:r},a){e.aZ.performDecoding(r,i).then(e=>{a(null,e)},e=>{a(e)})}}function c(e,i){if(0!==e.length){d(e[0],i);for(var r=1;r<e.length;r++)d(e[r],!i)}}function d(e,i){for(var r=0,a=0,n=0,o=e.length,s=o-1;n<o;s=n++){var l=(e[n][0]-e[s][0])*(e[s][1]+e[n][1]),h=r+l;a+=Math.abs(r)>=Math.abs(l)?r-h+l:l-h+r,r=h}r+a>=0!=!!i&&e.reverse()}var p,f=e.dK(function e(i,r){var a,n=i&&i.type;if("FeatureCollection"===n)for(a=0;a<i.features.length;a++)e(i.features[a],r);else if("GeometryCollection"===n)for(a=0;a<i.geometries.length;a++)e(i.geometries[a],r);else if("Feature"===n)e(i.geometry,r);else if("Polygon"===n)c(i.coordinates,r);else if("MultiPolygon"===n)for(a=0;a<i.coordinates.length;a++)c(i.coordinates[a],r);return i});let m=e.dL.prototype.toGeoJSON,_=class{constructor(i){this._feature=i,this.extent=e.V,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let r of this._feature.geometry)i.push([new e.P(r[0],r[1])]);return i}{let i=[];for(let r of this._feature.geometry){let a=[];for(let i of r)a.push(new e.P(i[0],i[1]));i.push(a)}return i}}toGeoJSON(e,i,r){return m.call(this,e,i,r)}},g=class{constructor(i){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.V,this.length=i.length,this._features=i}feature(e){return new _(this._features[e])}};var y={exports:{}},x=e.dN,v=e.dM.VectorTileFeature;function b(e,i){this.options=i||{},this.features=e,this.length=e.length}function w(e,i){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=i||4096}b.prototype.feature=function(e){return new w(this.features[e],this.options.extent)},w.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i<e.length;i++){for(var r=e[i],a=[],n=0;n<r.length;n++)a.push(new x(r[n][0],r[n][1]));this.geometry.push(a)}return this.geometry},w.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,i=1/0,r=-1/0,a=1/0,n=-1/0,o=0;o<e.length;o++)for(var s=e[o],l=0;l<s.length;l++){var h=s[l];
7i=Math.min(i,h.x),r=Math.max(r,h.x),a=Math.min(a,h.y),n=Math.max(n,h.y)}return[i,a,r,n]},w.prototype.toGeoJSON=v.prototype.toGeoJSON;var T=e.dO;function M(e){var i=new T;return function(e,i){for(var r in e.layers)i.writeMessage(3,E,e.layers[r])}(e,i),i.finish()}function E(e,i){i.writeVarintField(15,e.version||1),i.writeStringField(1,e.name||""),i.writeVarintField(5,e.extent||4096);var r,a={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)a.feature=e.feature(r),i.writeMessage(2,S,a);var n=a.keys;for(r=0;r<n.length;r++)i.writeStringField(3,n[r]);var o=a.values;for(r=0;r<o.length;r++)i.writeMessage(4,C,o[r])}function S(e,i){var r=e.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,A,e),i.writeVarintField(3,r.type),i.writeMessage(4,I,r)}function A(e,i){var r=e.feature,a=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(var l in r.properties){var h=r.properties[l],u=o[l];if(null!==h){void 0===u&&(a.push(l),o[l]=u=a.length-1),i.writeVarint(u);var c=typeof h;"string"!==c&&"boolean"!==c&&"number"!==c&&(h=JSON.stringify(h));var d=c+":"+h,p=s[d];void 0===p&&(n.push(h),s[d]=p=n.length-1),i.writeVarint(p)}}}function I(e,i){for(var r=e.loadGeometry(),a=e.type,n=0,o=0,s=r.length,l=0;l<s;l++){var h=r[l],u=1;1===a&&(u=h.length),i.writeVarint((u<<3)+1);for(var c=3===a?h.length-1:h.length,d=0;d<c;d++){1===d&&1!==a&&i.writeVarint((c-1<<3)+2);var p=h[d].x-n,f=h[d].y-o;i.writeVarint(p<<1^p>>31),i.writeVarint(f<<1^f>>31),n+=p,o+=f}3===a&&i.writeVarint(15)}}function C(e,i){var r=typeof e;"string"===r?i.writeStringField(1,e):"boolean"===r?i.writeBooleanField(7,e):"number"===r&&(e%1!=0?i.writeDoubleField(3,e):e<0?i.writeSVarintField(6,e):i.writeVarintField(5,e))}y.exports=M,y.exports.fromVectorTileJs=M,y.exports.fromGeojsonVt=function(e,i){i=i||{};var r={};for(var a in e)r[a]=new b(e[a].features,i),r[a].name=a,r[a].version=i.version,r[a].extent=i.extent;return M({layers:r})},y.exports.GeoJSONWrapper=b;var P=e.dK(y.exports);let z={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},D=Math.fround||(p=new Float32Array(1),e=>(p[0]=+e,p[0]));class L{constructor(e){this.options=Object.assign(Object.create(z),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${e.length} points`;i&&console.time(n),this.points=e;let o=[];for(let i=0;i<e.length;i++){let r=e[i];if(!r.geometry)continue;let[a,n]=r.geometry.coordinates,s=D(O(a)),l=D(B(n));o.push(s,l,1/0,i,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[a+1]=this._createTree(o);i&&console.timeEnd(n);for(let e=a;e>=r;e--){let r=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),i&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-r)}return i&&console.timeEnd("total time"),this}getClusters(e,i){let r=((e[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){let e=this.getClusters([r,a,180,o],i),s=this.getClusters([-180,a,n,o],i);return e.concat(s)}let s=this.trees[this._limitZoom(i)],l=s.range(O(r),B(o),O(n),B(a)),h=s.data,u=[];for(let e of l){let i=this.stride*e;u.push(h[i+5]>1?R(h,i,this.clusterProps):this.points[h[i+3]])}return u}getChildren(e){let i=this._getOriginId(e),r=this._getOriginZoom(e),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let o=n.data;if(i*this.stride>=o.length)throw Error(a);let s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(o[i*this.stride],o[i*this.stride+1],s),h=[];for(let i of l){let r=i*this.stride;o[r+4]===e&&h.push(o[r+5]>1?R(o,r,this.clusterProps):this.points[o[r+3]])}if(0===h.length)throw Error(a);return h}getLeaves(e,i,r){let a=[];return this._appendLeaves(a,e,i=i||10,r=r||0,0),a}getTile(e,i,r){let a=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,l=s/o,h=(r-l)/n,u=(r+1+l)/n,c={features:[]};return this._addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.data,i,r,n,c),0===i&&this._addTileFeatures(a.range(1-l/n,h,1,u),a.data,n,r,n,c),i===n-1&&this._addTileFeatures(a.range(0,h,l/n,u),a.data,-1,r,n,c),c.features.length?c:null}getClusterExpansionZoom(e){let i=this._getOriginZoom(e)-1;for(;i<=this.options.maxZoom;){let r=this.getChildren(e);if(i++,1!==r.length)break;e=r[0].properties.cluster_id}return i}_appendLeaves(e,i,r,a,n){for(let o of this.getChildren(i)){let i=o.properties;if(i&&i.cluster?n+i.point_count<=a?n+=i.point_count:n=this._appendLeaves(e,i.cluster_id,r,a,n):n<a?n++:e.push(o),e.length===r)break}return n}_createTree(i){let r=new e.bg(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<i.length;e+=this.stride)r.add(i[e],i[e+1]);return r.finish(),r.data=i,r}_addTileFeatures(e,i,r,a,n,o){for(let s of e){let e,l,h,u;let c=s*this.stride,d=i[c+5]>1;if(d)e=k(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];e=r.properties;let[a,n]=r.geometry.coordinates;l=O(a),h=B(n)}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:e};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),o.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,i){let{radius:r,extent:a,reduce:n,minPoints:o}=this.options,s=r/(a*Math.pow(2,i)),l=e.data,h=[],u=this.stride;for(let r=0;r<l.length;r+=u){if(l[r+2]<=i)continue;l[r+2]=i;let a=l[r],c=l[r+1],d=e.within(l[r],l[r+1],s),p=l[r+5],f=p;for(let e of d){let r=e*u;l[r+2]>i&&(f+=l[r+5])}if(f>p&&f>=o){let e,o=a*p,s=c*p,m=-1,_=(r/u<<5)+(i+1)+this.points.length;for(let a of d){let h=a*u;if(l[h+2]<=i)continue;l[h+2]=i;let c=l[h+5];o+=l[h]*c,s+=l[h+1]*c,l[h+4]=_,n&&(e||(e=this._map(l,r,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(l,h)))}l[r+4]=_,h.push(o/f,s/f,1/0,_,-1,f),n&&h.push(m)}else{for(let e=0;e<u;e++)h.push(l[r+e]);if(f>1)for(let e of d){let r=e*u;if(!(l[r+2]<=i)){l[r+2]=i;for(let e=0;e<u;e++)h.push(l[r+e])}}}}return h}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,i,r){if(e[i+5]>1){let a=this.clusterProps[e[i+6]];return r?Object.assign({},a):a}let a=this.points[e[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function R(e,i,r){return{type:"Feature",id:e[i+3],properties:k(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180)
7)/Math.PI-90]}}}function k(e,i,r){let a=e[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,o=e[i+6];return Object.assign(-1===o?{}:Object.assign({},r[o]),{cluster:!0,cluster_id:e[i+3],point_count:a,point_count_abbreviated:n})}function O(e){return e/360+.5}function B(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}var F={exports:{}};F.exports=function(){function e(e,r,a,n){var o={id:void 0===e?null:e,type:r,geometry:a,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var r=e.geometry,a=e.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i(e,r);else if("Polygon"===a||"MultiLineString"===a)for(var n=0;n<r.length;n++)i(e,r[n]);else if("MultiPolygon"===a)for(n=0;n<r.length;n++)for(var o=0;o<r[n].length;o++)i(e,r[n][o])}(o),o}function i(e,i){for(var r=0;r<i.length;r+=3)e.minX=Math.min(e.minX,i[r]),e.minY=Math.min(e.minY,i[r+1]),e.maxX=Math.max(e.maxX,i[r]),e.maxY=Math.max(e.maxY,i[r+1])}function r(i,s,l,h){if(s.geometry){var u=s.geometry.coordinates,c=s.geometry.type,d=Math.pow(l.tolerance/((1<<l.maxZoom)*l.extent),2),p=[],f=s.id;if(l.promoteId?f=s.properties[l.promoteId]:l.generateId&&(f=h||0),"Point"===c)a(u,p);else if("MultiPoint"===c)for(var m=0;m<u.length;m++)a(u[m],p);else if("LineString"===c)n(u,p,d,!1);else if("MultiLineString"===c){if(l.lineMetrics){for(m=0;m<u.length;m++)n(u[m],p=[],d,!1),i.push(e(f,"LineString",p,s.properties));return}o(u,p,d,!1)}else if("Polygon"===c)o(u,p,d,!0);else{if("MultiPolygon"!==c){if("GeometryCollection"===c){for(m=0;m<s.geometry.geometries.length;m++)r(i,{id:f,geometry:s.geometry.geometries[m],properties:s.properties},l,h);return}throw Error("Input data is not a valid GeoJSON object.")}for(m=0;m<u.length;m++){var _=[];o(u[m],_,d,!0),p.push(_)}}i.push(e(f,c,p,s.properties))}}function a(e,i){i.push(e[0]/360+.5),i.push(s(e[1])),i.push(0)}function n(e,i,r,a){for(var n,o,l=0,h=0;h<e.length;h++){var u=e[h][0]/360+.5,c=s(e[h][1]);i.push(u),i.push(c),i.push(0),h>0&&(l+=a?(n*c-u*o)/2:Math.sqrt(Math.pow(u-n,2)+Math.pow(c-o,2))),n=u,o=c}var d=i.length-3;i[2]=1,function e(i,r,a,n){for(var o,s=n,l=a-r>>1,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1],f=r+3;f<a;f+=3){var m=function(e,i,r,a,n,o){var s=n-r,l=o-a;if(0!==s||0!==l){var h=((e-r)*s+(i-a)*l)/(s*s+l*l);h>1?(r=n,a=o):h>0&&(r+=s*h,a+=l*h)}return(s=e-r)*s+(l=i-a)*l}(i[f],i[f+1],u,c,d,p);if(m>s)o=f,s=m;else if(m===s){var _=Math.abs(f-l);_<h&&(o=f,h=_)}}s>n&&(o-r>3&&e(i,r,o,n),i[o+2]=s,a-o>3&&e(i,o,a,n))}(i,0,d,r),i[d+2]=1,i.size=Math.abs(l),i.start=0,i.end=i.size}function o(e,i,r,a){for(var o=0;o<e.length;o++){var s=[];n(e[o],s,r,a),i.push(s)}}function s(e){var i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function l(i,r,a,n,o,s,l,u){if(n/=r,s>=(a/=r)&&l<n)return i;if(l<a||s>=n)return null;for(var d=[],p=0;p<i.length;p++){var f=i[p],m=f.geometry,_=f.type,g=0===o?f.minX:f.minY,y=0===o?f.maxX:f.maxY;if(g>=a&&y<n)d.push(f);else if(!(y<a||g>=n)){var x=[];if("Point"===_||"MultiPoint"===_)(function(e,i,r,a,n){for(var o=0;o<e.length;o+=3){var s=e[o+n];s>=r&&s<=a&&(i.push(e[o]),i.push(e[o+1]),i.push(e[o+2]))}})(m,x,a,n,o);else if("LineString"===_)h(m,x,a,n,o,!1,u.lineMetrics);else if("MultiLineString"===_)c(m,x,a,n,o,!1);else if("Polygon"===_)c(m,x,a,n,o,!0);else if("MultiPolygon"===_)for(var v=0;v<m.length;v++){var b=[];c(m[v],b,a,n,o,!0),b.length&&x.push(b)}if(x.length){if(u.lineMetrics&&"LineString"===_){for(v=0;v<x.length;v++)d.push(e(f.id,_,x[v],f.tags));continue}"LineString"!==_&&"MultiLineString"!==_||(1===x.length?(_="LineString",x=x[0]):_="MultiLineString"),"Point"!==_&&"MultiPoint"!==_||(_=3===x.length?"Point":"MultiPoint"),d.push(e(f.id,_,x,f.tags))}}}return d.length?d:null}function h(e,i,r,a,n,o,s){for(var l,h,c=u(e),m=0===n?p:f,_=e.start,g=0;g<e.length-3;g+=3){var y=e[g],x=e[g+1],v=e[g+2],b=e[g+3],w=e[g+4],T=0===n?y:x,M=0===n?b:w,E=!1;s&&(l=Math.sqrt(Math.pow(y-b,2)+Math.pow(x-w,2))),T<r?M>r&&(h=m(c,y,x,b,w,r),s&&(c.start=_+l*h)):T>a?M<a&&(h=m(c,y,x,b,w,a),s&&(c.start=_+l*h)):d(c,y,x,v),M<r&&T>=r&&(h=m(c,y,x,b,w,r),E=!0),M>a&&T<=a&&(h=m(c,y,x,b,w,a),E=!0),!o&&E&&(s&&(c.end=_+l*h),i.push(c),c=u(e)),s&&(_+=l)}var S=e.length-3;y=e[S],x=e[S+1],v=e[S+2],(T=0===n?y:x)>=r&&T<=a&&d(c,y,x,v),S=c.length-3,o&&S>
vendor: 6,232 bytes, line 7
7=3&&(c[S]!==c[0]||c[S+1]!==c[1])&&d(c,c[0],c[1],c[2]),c.length&&i.push(c)}function u(e){var i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function c(e,i,r,a,n,o){for(var s=0;s<e.length;s++)h(e[s],i,r,a,n,o,!1)}function d(e,i,r,a){e.push(i),e.push(r),e.push(a)}function p(e,i,r,a,n,o){var s=(o-i)/(a-i);return e.push(o),e.push(r+(n-r)*s),e.push(1),s}function f(e,i,r,a,n,o){var s=(o-r)/(n-r);return e.push(i+(a-i)*s),e.push(o),e.push(1),s}function m(i,r){for(var a=[],n=0;n<i.length;n++){var o,s=i[n],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=_(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l){o=[];for(var h=0;h<s.geometry.length;h++)o.push(_(s.geometry[h],r))}else if("MultiPolygon"===l)for(o=[],h=0;h<s.geometry.length;h++){for(var u=[],c=0;c<s.geometry[h].length;c++)u.push(_(s.geometry[h][c],r));o.push(u)}a.push(e(s.id,l,o,s.tags))}return a}function _(e,i){var r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(var a=0;a<e.length;a+=3)r.push(e[a]+i,e[a+1],e[a+2]);return r}function g(e,i){if(e.transformed)return e;var r,a,n,o=1<<e.z,s=e.x,l=e.y;for(r=0;r<e.features.length;r++){var h=e.features[r],u=h.geometry,c=h.type;if(h.geometry=[],1===c)for(a=0;a<u.length;a+=2)h.geometry.push(y(u[a],u[a+1],i,o,s,l));else for(a=0;a<u.length;a++){var d=[];for(n=0;n<u[a].length;n+=2)d.push(y(u[a][n],u[a][n+1],i,o,s,l));h.geometry.push(d)}}return e.transformed=!0,e}function y(e,i,r,a,n,o){return[Math.round(r*(e*a-n)),Math.round(r*(i*a-o))]}function x(e,i,r,a,n,o){var s=a*a;if(a>0&&i.size<(n?s:a))r.numPoints+=i.length/3;else{for(var l=[],h=0;h<i.length;h+=3)(0===a||i[h+2]>s)&&(r.numSimplified++,l.push(i[h]),l.push(i[h+1])),r.numPoints++;n&&function(e,i){for(var r=0,a=0,n=e.length,o=n-2;a<n;o=a,a+=2)r+=(e[a]-e[o])*(e[a+1]+e[o+1]);if(r>0===i)for(a=0,n=e.length;a<n/2;a+=2){var s=e[a],l=e[a+1];e[a]=e[n-2-a],e[a+1]=e[n-1-a],e[n-2-a]=s,e[n-1-a]=l}}(l,o),e.push(l)}}function v(e,i){var a,n,o,s,h,u,c=(i=this.options=function(e,i){for(var r in i)e[r]=i[r];return e}(Object.create(this.options),i)).debug;if(c&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");var d=function(e,i){var a=[];if("FeatureCollection"===e.type)for(var n=0;n<e.features.length;n++)r(a,e.features[n],i,n);else r(a,"Feature"===e.type?e:{geometry:e},i);return a}(e,i);this.tiles={},this.tileCoords=[],c&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=d,o=(n=i).buffer/n.extent,s=a,h=l(a,1,-1-o,o,0,-1,2,n),u=l(a,1,1-o,2+o,0,-1,2,n),(h||u)&&(s=l(a,1,-o,1+o,0,-1,2,n)||[],h&&(s=m(h,1).concat(s)),u&&(s=s.concat(m(u,-1)))),d=s).length&&this.splitTile(d,0,0,0),c&&(d.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function b(e,i,r){return 32*((1<<e)*r+i)+e}return v.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},v.prototype.splitTile=function(e,i,r,a,n,o,s){for(var h=[e,i,r,a],u=this.options,c=u.debug;h.length;){a=h.pop(),r=h.pop(),i=h.pop(),e=h.pop();var d=1<<i,p=b(i,r,a),f=this.tiles[p];if(!f&&(c>1&&console.time("creation"),f=this.tiles[p]=function(e,i,r,a,n){for(var o=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:a,z:i,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},l=0;l<e.length;l++){s.numFeatures++,function(e,i,r,a){var n=i.geometry,o=i.type,s=[];if("Point"===o||"MultiPoint"===o)for(var l=0;l<n.length;l+=3)s.push(n[l]),s.push(n[l+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)x(s,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(l=0;l<n.length;l++)x(s,n[l],e,r,"Polygon"===o,0===l);else if("MultiPolygon"===o)for(var h=0;h<n.length;h++){var u=n[h];for(l=0;l<u.length;l++)x(s,u[l],e,r,!0,0===l)}if(s.length){var c=i.tags||null;if("LineString"===o&&a.lineMetrics){for(var d in c={},i.tags)c[d]=i.tags[d];c.mapbox_clip_start=n.start/n.size,c.mapbox_clip_end=n.end/n.size}var p={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==i.id&&(p.id=i.id),e.features.push(p)}}(s,e[l],o,n);var h=e[l].minX,u=e[l].minY,c=e[l].maxX,d=e[l].maxY;h<s.minX&&(s.minX=h),u<s.minY&&(s.minY=u),c>s.maxX&&(s.maxX=c),d>s.maxY&&(s.maxY=d)}return s}(e,i,r,a,u),this.tileCoords.push({z:i,x:r,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+i;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=e,n){if(i===u.maxZoom||i===n)continue;var _=1<<n-i;if(r!==Math.floor(o/_)||a!==Math.floor(s/_))continue}else if(i===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue;if(f.source=null,0!==e.length){c>1&&console.time("clipping");var g,y,v,w,T,M,E=.5*u.buffer/u.extent,S=.5-E,A=.5+E,I=1+E;g=y=v=w=null,T=l(e,d,r-E,r+A,0,f.minX,f.maxX,u),M=l(e,d,r+S,r+I,0,f.minX,f.maxX,u),e=null,T&&(g=l(T,d,a-E,a+A,1,f.minY,f.maxY,u),y=l(T,d,a+S,a+I,1,f.minY,f.maxY,u),T=null),M&&(v=l(M,d,a-E,a+A,1,f.minY,f.maxY,u),w=l(M,d,a+S,a+I,1,f.minY,f.maxY,u),M=null),c>1&&console.timeEnd("clipping"),h.push(g||[],i+1,2*r,2*a),h.push(y||[],i+1,2*r,2*a+1),h.push(v||[],i+1,2*r+1,2*a),h.push(w||[],i+1,2*r+1,2*a+1)}}},v.prototype.getTile=function(e,i,r){var a=this.options,n=a.extent,o=a.debug;if(e<0||e>24)return null;var s=1<<e,l=b(e,i=(i%s+s)%s,r);if(this.tiles[l])return g(this.tiles[l],n);o>1&&console.log("drilling down to z%d-%d-%d",e,i,r);for(var h,u=e,c=i,d=r;!h&&u>0;)u--,c=Math.floor(c/2),d=Math.floor(d/2),h=this.tiles[b(u,c,d)];return h&&h.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,d),o>1&&console.time("drilling down"),this.splitTile(h.source,u,c,d,e,i,r),o>1&&console.timeEnd("drilling down"),this.tiles[l]?g(this.tiles[l],n):null):null},function(e,i){return new v(e,i)}}();
7var N=e.dK(F.exports);function V(e,i){let r=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!a)return i(null,null);let n=new g(a.features),o=P(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:n,rawData:o.buffer})}class U extends l{constructor(e,i,r,a,n,o){super(e,i,r,a,V,o),n&&(this.loadGeoJSON=n)}loadData(r,a){let n=r&&r.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(r,(s,l)=>{if(s||!l)return a(s);if("object"!=typeof l)return a(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{f(l,!0);try{if(r.filter){let i=e.r(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));let a=l.features.filter(e=>i.value.evaluate({zoom:0},e));l={type:"FeatureCollection",features:a}}this._geoJSONIndex=r.cluster?new L(function({superclusterOptions:i,clusterProperties:r}){if(!r||!i)return i;let a={},n={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r);for(let i of l){let[o,s]=r[i],l=e.r(s),h=e.r("string"==typeof o?[o,["accumulated"],["get",i]]:o);a[i]=l.value,n[i]=h.value}return i.map=e=>{s.properties=e;let i={};for(let e of l)i[e]=a[e].evaluate(o,s);return i},i.reduce=(e,i)=>{for(let r of(s.properties=i,l))o.accumulated=e[r],e[r]=n[r].evaluate(o,s)},i}(r)).load(l.features):N(l,r.geojsonVtOptions)}catch(e){return a(e)}this.loaded={};let s={};if(o){let e=i(n);e&&(s.resourceTiming={},s.resourceTiming[r.source]=JSON.parse(JSON.stringify(e)))}a(null,s)}})}reloadTile(e,i){let r=this.loaded;return r&&r[e.uid]?super.reloadTile(e,i):this.loadTile(e,i)}loadGeoJSON(i,r){if(i.request)e.g(i.request,r);else{if("string"!=typeof i.data)return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(i.data))}catch(e){return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,i){try{i(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){i(e)}}getClusterChildren(e,i){try{i(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){i(e)}}getClusterLeaves(e,i){try{i(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){i(e)}}}class j{constructor(i,r){this.tileID=new e.am(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=r}parse(i,r,a,n){this.status="parsing";let o=new e.am(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),s={},l=r.familiesBySource[a.source],h=new e.dC(o,a.promoteId);return h.bucketLayerIDs=[],h.is3DTile=!0,e.dP(i).then(i=>{if(!i)return n(Error("Could not parse tile"));let r=e.dQ(i,1/e.bR(a.tileID.canonical)),u=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new e.K(this.zoom,{brightness:this.brightness});for(let i in l)for(let a of l[i]){let i=a[0];h.bucketLayerIDs.push(a.map(e=>e.id)),i.recalculate(d,[]);let n=new e.dR(r,o,u,c,this.brightness,h);u||(n.needsUpload=!0),s[i.fqid]=n,n.evaluate(i)}this.status="done",n(null,{buckets:s,featureIndex:h})}).catch(e=>n(Error(e.message)))}}class G{constructor(e,i,r,a,n,o){this.actor=e,this.layerIndex=i,this.brightness=o,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=this.loading[a]=new j(i,this.brightness);e.a_(i.request,(e,o)=>{let s=!this.loading[a];return delete this.loading[a],s||e?(n.status="done",s||(this.loaded[a]=n),r(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,i,(e,i)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[a]=n,e||!i?r(e):r(null,i)}):(n.status="done",this.loaded[a]=n,r())})}reloadTile(e,i){let r=this.loaded,a=e.uid;if(r&&r[a]){let n=r[a];n.projection=e.projection,n.brightness=e.brightness,"parsing"===n.status?n.reloadCallback=(r,a)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,i)),i(r,a)}:"done"===n.status&&this.loadTile(e,i)}}abortTile(e,i){let r=e.uid;this.loading[r]&&delete this.loading[r],i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class Z{constructor(i){this.self=i,this.actor=new e.dS(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.bo({name:"mercator"}),this.workerSourceTypes={vector:l,geojson:U,"batched-model":G},this.workerSources={},this.demWorkerSources={}
7,this.self.registerWorkerSource=(e,i)=>{if(this.workerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=i},this.self.registerRTLTextPlugin=i=>{if(e.dT.isParsed())throw Error("RTL text plugin already registered.");e.dT.applyArabicShaping=i.applyArabicShaping,e.dT.processBidirectionalText=i.processBidirectionalText,e.dT.processStyledBidirectionalText=i.processStyledBidirectionalText}}clearCaches(e,i,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,r()}checkIfReady(e,i,r){r()}setReferrer(e,i){this.referrer=i}spriteLoaded(i,{scope:r,isLoaded:a}){if(this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),this.isSpriteLoaded[i][r]=a,this.workerSources[i]&&this.workerSources[i][r])for(let n in this.workerSources[i][r]){let o=this.workerSources[i][r][n];for(let i in o)o[i]instanceof l&&(o[i].isSpriteLoaded=a,o[i].fire(new e.b("isSpriteLoaded")))}}setImages(e,{scope:i,images:r},a){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][i]=r,this.workerSources[e]&&this.workerSources[e][i]){for(let a in this.workerSources[e][i]){let n=this.workerSources[e][i][a];for(let e in n)n[e].availableImages=r}a()}else a()}setProjection(i,r){this.projections[i]=e.bo(r)}setBrightness(e,i,r){this.brightness=i,r()}setLayers(e,i,r){this.getLayerIndex(e,i.scope).replace(i.layers,i.options),r()}updateLayers(e,i,r){this.getLayerIndex(e,i.scope).update(i.layers,i.removedIds,i.options),r()}loadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).loadTile(i,r)}loadDEMTile(e,i,r){this.getDEMWorkerSource(e,i.source,i.scope).loadTile(i,r)}decodeRasterArray(e,i,r){this.getRasterArrayWorkerSource().decodeRasterArray(i,r)}reloadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).reloadTile(i,r)}abortTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).abortTile(i,r)}removeTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).removeTile(i,r)}removeSource(e,i,r){if(!(this.workerSources[e]&&this.workerSources[e][i.scope]&&this.workerSources[e][i.scope][i.type]&&this.workerSources[e][i.scope][i.type][i.source]))return;let a=this.workerSources[e][i.scope][i.type][i.source];delete this.workerSources[e][i.scope][i.type][i.source],void 0!==a.removeSource?a.removeSource(i,r):r()}loadWorkerSource(e,i,r){try{this.self.importScripts(i.url),r()}catch(e){r(e.toString())}}syncRTLPluginState(i,r,a){try{e.dT.setState(r);let i=e.dT.getPluginURL();if(e.dT.isLoaded()&&!e.dT.isParsed()&&null!=i){this.self.importScripts(i);let r=e.dT.isParsed();a(r?void 0:Error(`RTL Text Plugin failed to import scripts from ${i}`),r)}}catch(e){a(e.toString())}}setDracoUrl(e,i){this.dracoUrl=i}getAvailableImages(e,i){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][i];return r||(r=[]),r}getLayerIndex(e,i){this.layerIndexes[e]||(this.layerIndexes[e]={});let a=this.layerIndexes[e][i];return a||((a=this.layerIndexes[e][i]=new r).scope=i),a}getWorkerSource(e,i,r,a){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][a]||(this.workerSources[e][a]={}),this.workerSources[e][a][i]||(this.workerSources[e][a][i]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),!this.workerSources[e][a][i][r]){let n={send:(i,r,a,n,o,s)=>{this.actor.send(i,r,a,e,o,s)},scheduler:this.actor.scheduler};this.workerSources[e][a][i][r]=new this.workerSourceTypes[i](n,this.getLayerIndex(e,a),this.getAvailableImages(e,a),this.isSpriteLoaded[e][a],void 0,this.brightness)}return this.workerSources[e][a][i][r]}getDEMWorkerSource(e,i,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]={}),this.demWorkerSources[e][r][i]||(this.demWorkerSources[e][r][i]=new h),this.demWorkerSources[e][r][i]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new u),this.rasterArrayWorkerSource}enforceCacheSizeLimit(i,r){e.dU(r)}getWorkerPerformanceMetrics(e,i,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Z(self)),Z}),a(["./shared"],function(e){let i,r;function a(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!a(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i||Object.keys(e).length!==Object.keys(i).length)return!1;for(let r in e)if(!a(e[r],i[r]))return!1;return!0}return e===i}function n(e){var i;return"undefined"!=typeof window&&"undefined"!=typeof document&&!!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,i,r=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(r);try{i=new Worker(a),e=!0}catch(i){e=!1}return i&&i.terminate(),URL.revokeObjectURL(a),e}()&&!!function(){var e=document.createElement("canvas");e.width=e.height=1;var i=e.getContext("2d");if(!i)return!1;var r=i.getImageData(0,0,1,1);return r&&r.width===e.width}()&&(void 0===o[i=e&&e.failIfMajorPerformanceCaveat]&&(o[i]=function(e){var i,r,a,o=(i=document.createElement("canvas"),(r=Object.create(n.webGLContextAttributes)).failIfMajorPerformanceCaveat=e,i.getContext("webgl2",r));if(!o)return!1;try{a=o.createShader(o.VERTEX_SHADER)}catch(e){return!1}return!(!a||o.isContextLost())&&(o.shaderSource(a,"void main() {}"),o.compileShader(a),!0===o.getShaderParameter(a,o.COMPILE_STATUS))}(i)),!!o[i]&&!document.documentMode)}var o={};function s(e,i,r){let a=document.createElement(e);return null!=i&&(a.className=i),r&&r.appendChild(a),a}function l(e,i,r){let a=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e of Object.keys(i))a.setAttributeNS(null,e,String(i[e]));return r&&r.appendChild(a),a}n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};let h="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,u=h&&void 0!==h.userSelect?"userSelect":"WebkitUserSelect";function c(){h&&u&&(i=h[u],h[u]="none")}function d(){h&&u&&(h[u]=i)}function p(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",p,!0)}function f(){window.addEventListener("click",p,!0),window.setTimeout(()=>{window.removeEventListener("click",p,!0)},0)}function m(e,i){let r=e.getBoundingClientRect();
7return y(e,r,i)}function _(e,i){let r=e.getBoundingClientRect(),a=[];for(let n=0;n<i.length;n++)a.push(y(e,r,i[n]));return a}function g(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function y(i,r,a){let n=i.offsetWidth===r.width?1:i.offsetWidth/r.width;return new e.P((a.clientX-r.left)*n,(a.clientY-r.top)*n)}class x{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(e,i){this._updatedSourceCaches[e]=i,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){let i=e.scope;this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._updatedLayers[i].add(e.id),this.setDirty()}removeLayer(e){let i=e.scope;this._removedLayers[i]=this._removedLayers[i]||{},this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._removedLayers[i][e.id]=e,this._updatedLayers[i].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){let e={};for(let i in this._updatedLayers)e[i]=e[i]||{},e[i].updatedIds=Array.from(this._updatedLayers[i].values());for(let i in this._removedLayers)e[i]=e[i]||{},e[i].removedIds=Object.keys(this._removedLayers[i]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class v extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(i,r){return e.l(this.requestManager.transformRequest(r,e.R.Model).url).then(r=>{if(!r)return;let a=e.c(r),n=new e.M(i,void 0,void 0,a);return n.computeBoundsAndApplyParent(),n}).catch(a=>{this.fire(new e.a(Error(`Could not load model ${i} from ${r}: ${a.message}`)))})}load(i,r){this.models[r]||(this.models[r]={});let a=Object.keys(i);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+a.length;let n=[];for(let e of a)n.push(this.loadModel(e,i[e]));Promise.allSettled(n).then(i=>{for(let e=0;e<i.length;e++){let{status:n,value:o}=i[e];"fulfilled"===n&&o&&(this.models[r][a[e]]=o)}this.numModelsLoading[r]-=a.length,this.fire(new e.b("data",{dataType:"style"}))}).catch(i=>{this.fire(new e.a(Error(`Could not load models: ${i.message}`)))})}isLoaded(){for(let e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,i){return!!this.getModel(e,i)}getModel(e,i){return this.models[i]||(this.models[i]={}),this.models[i][e]}addModel(e,i,r){this.models[r]||(this.models[r]={}),this.hasModel(e,r)&&this.removeModel(e,r),this.load({[e]:this.requestManager.normalizeModelURL(i)},r)}addModels(e,i){let r={};for(let i in e)r[i]=this.requestManager.normalizeModelURL(e[i]);this.load(r,i)}removeModel(e,i){this.models[i]||(this.models[i]={});let r=this.models[i][e];delete this.models[i][e],r.destroy()}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,i){for(let r in this.models[i]||(this.models[i]={}),this.models[i])this.models[i][r].upload(e.context)}}class b{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},e.e(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let e in this.deletedStates[i]={},this.state[i])e!==n&&(this.deletedStates[i][e]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let e in this.deletedStates[i][n]={},this.state[i][n])a[e]||(this.deletedStates[i][n][e]=null);else for(let e in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][e]&&delete this.deletedStates[i][n][e]}removeFeatureState(e,i,r){if(null===this.deletedStates[e])return;let a=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==i)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][r]=null);else if(void 0!==i){if(this.stateChanges[e]&&this.stateChanges[e][a])for(r in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][r]=null;else this.deletedStates[e][a]=null}else this.deletedStates[e]=null}getState(i,r){let a=String(r),n=e.e({},(this.state[i]||{})[a],(this.stateChanges[i]||{})[a]);if(null===this.deletedStates[i])return{};if(this.deletedStates[i]){let e=this.deletedStates[i][r];if(null===e)return{};for(let i in e)delete n[i]}return n}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),e.e(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let e in this.state[i])r[e]={},this.state[i][e]={};else for(let e in this.deletedStates[i]){if(null===this.deletedStates[i][e])this.state[i][e]={};else if(this.state[i][e])for(let r of Object.keys(this.deletedStates[i][e]))delete this.state[i][e][r];r[e]=this.state[i][e]}a[i]=a[i]||{},e.e(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let e in i)i[e].setFeatureState(a,r)}}class w extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(i){this.images[i]={},this.loaded[i]=!1,this.updatedImages[i]={},this.patterns[i]={},this.callbackDispatchedThisFrame[i]={},this.atlasImage[i]=new e.h({width:1,height:1})}isLoaded(){for(let e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,i){if(this.loaded[i]!==e&&(this.loaded[i]=e,e)){for(let{ids:e,callback:r}of this.requestors)this._notify(e,i,r);this.requestors=[]}}hasImage(e,i){return!!this.getImage(e,i)}getImage(e,i){return this.images[i][e]}
7addImage(e,i,r){this._validate(e,r)&&(this.images[i][e]=r)}_validate(i,r){let a=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.a(Error(`Image "${i}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.a(Error(`Image "${i}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new e.a(Error(`Image "${i}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let r=0;for(let a of e){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(e,i){return!(e&&(4!==e.length||e[0]<0||i.data.width<e[0]||e[1]<0||i.data.height<e[1]||e[2]<0||i.data.width<e[2]||e[3]<0||i.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,i,r){r.version=this.images[i][e].version+1,this.images[i][e]=r,this.updatedImages[i][e]=!0}removeImage(e,i){let r=this.images[i][e];delete this.images[i][e],delete this.patterns[i][e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,i,r){let a=!0,n=!!this.loaded[i];if(!n)for(let r of e)this.images[i][r]||(a=!1);n||a?this._notify(e,i,r):this.requestors.push({ids:e,scope:i,callback:r})}getUpdatedImages(e){return this.updatedImages[e]}_notify(i,r,a){let n={};for(let a of i){this.images[r][a]||this.fire(new e.b("styleimagemissing",{id:a}));let i=this.images[r][a];i?n[a]={data:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:e.w(`Image "${a}" 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.`)}a(null,n)}getPixelSize(e){let{width:i,height:r}=this.atlasImage[e];return{width:i,height:r}}getPattern(i,r){let a=this.patterns[r][i],n=this.getImage(i,r);if(!n)return null;if(a&&a.position.version===n.version)return a.position;if(a)a.position.version=n.version;else{let a={w:n.data.width+2,h:n.data.height+2,x:0,y:0},o=new e.I(a,n);this.patterns[r][i]={bin:a,position:o}}return this._updatePatternAtlas(r),this.patterns[r][i].position}bind(i,r){let a=i.gl,n=this.atlasTexture[r];n?this.dirty&&(n.update(this.atlasImage[r]),this.dirty=!1):(n=new e.T(i,this.atlasImage[r],a.RGBA),this.atlasTexture[r]=n),n.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(i){let r=[];for(let e in this.patterns[i])r.push(this.patterns[i][e].bin);let{w:a,h:n}=e.p(r),o=this.atlasImage[i];for(let r in o.resize({width:a||1,height:n||1}),this.patterns[i]){let{bin:a}=this.patterns[i][r],n=a.x+1,s=a.y+1,l=this.images[i][r].data,h=l.width,u=l.height;e.h.copy(l,o,{x:0,y:0},{x:n,y:s},{width:h,height:u}),e.h.copy(l,o,{x:0,y:u-1},{x:n,y:s-1},{width:h,height:1}),e.h.copy(l,o,{x:0,y:0},{x:n,y:s+u},{width:h,height:1}),e.h.copy(l,o,{x:h-1,y:0},{x:n-1,y:s},{width:1,height:u}),e.h.copy(l,o,{x:0,y:0},{x:n+h,y:s},{width:1,height:u})}this.dirty=!0}beginFrame(){for(let e in this.images)this.callbackDispatchedThisFrame[e]={}}dispatchRenderCallbacks(e,i){for(let r of e){if(this.callbackDispatchedThisFrame[i][r])continue;this.callbackDispatchedThisFrame[i][r]=!0;let e=this.images[i][r];(function(e){let{userImage:i}=e;return!!(i&&i.render&&i.render())&&(e.data.replace(new Uint8Array(i.data.buffer)),!0)})(e)&&this.updateImage(r,i,e)}}}class T{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}class M extends T{}function E(i){let r=i.key,a=i.value,n=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=e.i(a);if("object"!==u)return[new T(r,a,`object expected, ${u} found`)];for(let e in a){let i;let u=e.split(".")[0];o[u]?i=o[u]:n[u]?i=q:o["*"]?i=o["*"]:n["*"]&&(i=q),i?h=h.concat(i({key:(r?`${r}.`:r)+e,value:a[e],valueSpec:n[u]||n["*"],style:s,styleSpec:l,object:a,objectKey:e},a)):h.push(new M(r,a[e],`unknown property "${e}"`))}for(let e in n)o[e]||n[e].required&&void 0===n[e].default&&void 0===a[e]&&h.push(new T(r,a,`missing required property "${e}"`));return h}function S(i){let r=i.value,a=i.valueSpec,n=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||q;
7if("array"!==e.i(r))return[new T(s,r,`array expected, ${e.i(r)} found`)];if(a.length&&r.length!==a.length)return[new T(s,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new T(s,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let h={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};o.$version<7&&(h.function=a.function),"object"===e.i(a.value)&&(h=a.value);let u=[];for(let e=0;e<r.length;e++)u=u.concat(l({array:r,arrayIndex:e,value:r[e],valueSpec:h,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return u}function A(i){let r=i.key,a=i.value,n=i.valueSpec,o=e.i(a);if("number"===o&&a!=a&&(o="NaN"),"number"!==o)return[new T(r,a,`number expected, ${o} found`)];if("minimum"in n){let o=n.minimum;if("array"===e.i(n.minimum)&&(o=n.minimum[i.arrayIndex]),a<o)return[new T(r,a,`${a} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if("array"===e.i(n.maximum)&&(o=n.maximum[i.arrayIndex]),a>o)return[new T(r,a,`${a} is greater than the maximum value ${o}`)]}return[]}function I(i){let r=i.valueSpec,a=e.u(i.value.type),n,o,s,l={},h="categorical"!==a&&void 0===i.value.property,u="array"===e.i(i.value.stops)&&"array"===e.i(i.value.stops[0])&&"object"===e.i(i.value.stops[0][0]),c=E({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===a)return[new T(i.key,i.value,'identity function may not have a "stops" property')];let r=[],n=i.value;return r=r.concat(S({key:i.key,value:n,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===e.i(n)&&0===n.length&&r.push(new T(i.key,n,"array must have at least one stop")),r},default:function(e){return q({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&h&&c.push(new T(i.key,i.value,'missing required property "property"')),"identity"===a||i.value.stops||c.push(new T(i.key,i.value,'missing required property "stops"')),"exponential"===a&&i.valueSpec.expression&&!e.s(i.valueSpec)&&c.push(new T(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||e.k(i.valueSpec)?h&&!e.m(i.valueSpec)&&c.push(new T(i.key,i.value,"zoom functions not supported")):c.push(new T(i.key,i.value,"property functions not supported"))),("categorical"===a||u)&&void 0===i.value.property&&c.push(new T(i.key,i.value,'"property" property is required')),c;function d(i){let a=[],n=i.value,h=i.key;if("array"!==e.i(n))return[new T(h,n,`array expected, ${e.i(n)} found`)];if(2!==n.length)return[new T(h,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.i(n[0]))return[new T(h,n,`object expected, ${e.i(n[0])} found`)];if(void 0===n[0].zoom)return[new T(h,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new T(h,n,"object stop key must have value")];let r=e.u(n[0].zoom);if("number"!=typeof r)return[new T(h,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new T(h,n[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,l={}),a=a.concat(E({key:`${h}[0]`,value:n[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:A,value:p}}))}else a=a.concat(p({key:`${h}[0]`,value:n[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},n));return e.n(e.o(n[1]))?a.concat([new T(`${h}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(q({key:`${h}[1]`,value:n[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}function p(i,s){let h=e.i(i.value),u=e.u(i.value),c=null!==i.value?i.value:s;if(n){if(h!==n)return[new T(i.key,c,`${h} stop domain type must match previous stop domain type ${n}`)]}else n=h;if("number"!==h&&"string"!==h&&"boolean"!==h&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new T(i.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==h&&"categorical"!==a){let n=`number expected, ${h} found`;return e.k(r)&&void 0===a&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new T(i.key,c,n)]}return"categorical"!==a||"number"!==h||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==a&&"number"===h&&"number"==typeof u&&"number"==typeof o&&void 0!==o&&u<o?[new T(i.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===a&&u in l?[new T(i.key,c,"stop domain values must be unique")]:(l[u]=!0,[])):[new T(i.key,c,`integer expected, found ${String(u)}`)]}}function C(i){let r=("property"===i.expressionContext?e.q:e.r)(e.o(i.value),i.valueSpec);if("error"===r.result)return r.value.map(e=>new T(`${i.key}${e.key}`,i.value,e.message));let a=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!a.outputDefined())return[new T(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!e.t(a))return[new T(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,a){let n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(a.valueSpec&&a.valueSpec.expression)for(let e of a.valueSpec.expression.parameters)n.delete(e);
7if(0===n.size)return[];let o=[];return r instanceof e.C&&n.has(r.name)?[new T(a.key,a.value,`["${r.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`)]:(r.eachChild(e=>{o.push(...i(e,a))}),o)}(a,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!e.v(a,["zoom","feature-state"]))return[new T(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!e.x(a))return[new T(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function P(i){let r=i.key,a=i.value,n=i.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.u(a))&&o.push(new T(r,a,`expected one of [${n.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(n.values).indexOf(e.u(a))&&o.push(new T(r,a,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(a)} found`)),o}function z(i){return e.z(e.o(i.value))?C(e.j({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let a=r.value,n=r.key;if("array"!==e.i(a))return[new T(n,a,`array expected, ${e.i(a)} found`)];let o=r.styleSpec,s,l=[];if(a.length<1)return[new T(n,a,"filter array must have at least 1 element")];switch(l=l.concat(P({key:`${n}[0]`,value:a[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),e.u(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===e.u(a[1])&&l.push(new T(n,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&l.push(new T(n,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(s=e.i(a[1]))&&l.push(new T(`${n}[1]`,a[1],`string expected, ${s} found`));for(let i=2;i<a.length;i++)s=e.i(a[i]),"$type"===e.u(a[1])?l=l.concat(P({key:`${n}[${i}]`,value:a[i],valueSpec:o.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&l.push(new T(`${n}[${i}]`,a[i],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let e=1;e<a.length;e++)l=l.concat(i({key:`${n}[${e}]`,value:a[e],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=e.i(a[1]),2!==a.length?l.push(new T(n,a,`filter array for "${a[0]}" operator must have 2 elements`)):"string"!==s&&l.push(new T(`${n}[1]`,a[1],`string expected, ${s} found`))}return l}(i)}function D(i,r){let a;let n=i.key,o=i.style,s=i.layer,l=i.styleSpec,h=i.value,u=i.objectKey,c=l[`${r}_${i.layerType}`];if(!c)return[];let d=u.match(/^(.*)-transition$/);if("paint"===r&&d&&c[d[1]]&&c[d[1]].transition)return q({key:n,value:h,valueSpec:l.transition,style:o,styleSpec:l});let p=i.valueSpec||c[u];if(!p)return[new M(n,h,`unknown property "${u}"`)];if("string"===e.i(h)&&e.k(p)&&!p.tokens&&(a=/^{([^}]+)}$/.exec(h))){let e=`\`{ "type": "identity", "property": ${a?JSON.stringify(a[1]):'"_"'} }\``;return[new T(n,h,`"${u}" does not support interpolation syntax 8Use an identity property function instead: ${e}.`)]}let f=[];if("symbol"===i.layerType)"text-field"!==u||!o||o.glyphs||o.imports||f.push(new T(n,h,'use of "text-field" requires a style "glyphs" property')),"text-font"===u&&e.A(e.o(h))&&"identity"===e.u(h.type)&&f.push(new T(n,h,'"text-font" does not support identity functions'));else if("model"===i.layerType&&"paint"===r&&s&&s.layout&&s.layout.hasOwnProperty("model-id")&&e.k(p)&&(e.B(p)||e.m(p))){let i=e.q(e.o(h),p),r=i.value.expression||i.value._styleExpression.expression;r&&!e.v(r,["measure-light"])&&("model-emissive-strength"===u&&e.x(r)&&e.t(r)||f.push(new T(n,h,`${u} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return f.concat(q({key:i.key,value:h,valueSpec:p,style:o,styleSpec:l,expressionContext:"property",propertyType:r,propertyKey:u}))}function L(e){return D(e,"paint")}function R(e){return D(e,"layout")}function k(i){let r=[],a=i.value,n=i.key,o=i.style,s=i.styleSpec;a.type||a.ref||r.push(new T(n,a,'either "type" or "ref" is required'));let l=e.u(a.type),h=e.u(a.ref);
8if(a.id){let s=e.u(a.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];e.u(i.id)===s&&r.push(new T(n,a.id,`duplicate layer id "${a.id}", previously used at line ${i.id.__line__}`))}}if("ref"in a){let i;["type","source","source-layer","filter","layout"].forEach(e=>{e in a&&r.push(new T(n,a[e],`"${e}" is prohibited for ref layers`))}),o.layers.forEach(r=>{e.u(r.id)===h&&(i=r)}),i?i.ref?r.push(new T(n,a.ref,"ref cannot reference another ref layer")):l=e.u(i.type):"string"==typeof h&&r.push(new T(n,a.ref,`ref layer "${h}" not found`))}else if("background"!==l&&"sky"!==l&&"slot"!==l){if(a.source){let i=o.sources&&o.sources[a.source],s=i&&e.u(i.type);i?"vector"===s&&"raster"===l?r.push(new T(n,a.source,`layer "${a.id}" requires a raster source`)):"raster"===s&&"raster"!==l?r.push(new T(n,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==s||a["source-layer"]?"raster-dem"===s&&"hillshade"!==l?r.push(new T(n,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(l)?"line"===l&&a.paint&&(
8a.paint["line-gradient"]||a.paint["line-trim-offset"])&&("geojson"!==s||!i.lineMetrics)?r.push(new T(n,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):"raster-particle"===l&&"raster-array"!==s&&r.push(new T(n,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new T(n,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new T(n,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new T(n,a.source,`source "${a.source}" not found`))}else r.push(new T(n,a,'missing required property "source"'))}return r=r.concat(E({key:n,value:a,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>q({key:`${n}.type`,value:a.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:i=>z(e.j({layerType:l},i)),layout:i=>E({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>R(e.j({layerType:l},i))}}),paint:i=>E({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>L(e.j({layerType:l,layer:a},i))}})}}))}function O(i){let r=i.value,a=i.key,n=e.i(r);return"string"!==n?[new T(a,r,`string expected, ${n} found`)]:[]}let B={promoteId:function({key:i,value:r}){if("string"===e.i(r))return O({key:i,value:r});{let e=[];for(let a in r)e.push(...O({key:`${i}.${a}`,value:r[a]}));return e}}};function F(i){let r=i.value,a=i.key,n=i.styleSpec,o=i.style;if(!r.type)return[new T(a,r,'"type" is required')];let s=e.u(r.type),l=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(r.url||r.tiles||l.push(new M(a,r,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return l.concat(E({key:a,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:B}));case"geojson":if(l=E({key:a,value:r,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:B}),r.cluster)for(let e in r.clusterProperties){let[i,n]=r.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;l.push(...C({key:`${a}.${e}.map`,value:n,expressionContext:"cluster-map"})),l.push(...C({key:`${a}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return l;case"video":return E({key:a,value:r,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return E({key:a,value:r,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new T(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return P({key:`${a}.type`,value:r.type,valueSpec:{values:n.source.reduce((e,i)=>{let r=n[i];return"enum"===r.type.type&&(e=e.concat(Object.keys(r.type.values))),e},[])},style:o,styleSpec:n})}}function N(i){let r=i.value,a=[];if(!r)return a;let n=e.i(r);return"string"!==n?a=a.concat([new T(i.key,r,`string expected, "${n}" found`)]):(function(e){let i=-1===e.indexOf("://");try{return new URL(e,i?"http://example.com":void 0),!0}catch(e){return!1}}(r)||(a=a.concat([new T(i.key,r,`invalid url "${r}"`)])),a)}function V(i){let r=i.value,a=i.styleSpec,n=a.light,o=i.style,s=[],l=e.i(r);if(void 0===r)return s;if("object"!==l)return s.concat([new T("light",r,`object expected, ${l} found`)]);for(let e in r){let i=e.match(/^(.*)-transition$/);s=s.concat(i&&n[i[1]]&&n[i[1]].transition?q({key:e,value:r[e],valueSpec:a.transition,style:o,styleSpec:a}):n[e]?q({key:e,value:r[e],valueSpec:n[e],style:o,styleSpec:a}):[new T(e,r[e],`unknown property "${e}"`)])}return s}function U(i){let r=i.value,a=[];if(!r)return a;let n=e.i(r);if("object"!==n)return a.concat([new T("light-3d",r,`object expected, ${n} found`)]);let o=i.styleSpec,s=o["light-3d"],l=i.key,h=i.style,u=i.style.lights;for(let e of["type","id"])if(!(e in r))return a.concat([new T("light-3d",r,`missing property ${e} on light`)]);if(r.type&&u)for(let n=0;n<i.arrayIndex;n++){let i=e.u(r.type),o=u[n];e.u(o.type)===i&&a.push(new T(l,r.id,`duplicate light type "${r.type}", previously defined at line ${o.id.__line__}`))}let c=`properties_light_${r.type}`;if(!(c in o))return a.concat([new T("light-3d",r,`Invalid light type ${r.type}`)]);let d=o[c];for(let n in r)if("properties"===n){let s=r[n],l=e.i(s);if("object"!==l)return a.concat([new T("properties",s,`object expected, ${l}
8 found`)]);for(let e in s)a=a.concat(d[e]?q({key:e,value:s[e],valueSpec:d[e],style:h,styleSpec:o}):[new M(i.key,s[e],`unknown property "${e}"`)])}else{let e=n.match(/^(.*)-transition$/);a=a.concat(e&&s[e[1]]&&s[e[1]].transition?q({key:n,value:r[n],valueSpec:o.transition,style:h,styleSpec:o}):s[n]?q({key:n,value:r[n],valueSpec:s[n],style:h,styleSpec:o}):[new M(n,r[n],`unknown property "${n}"`)])}return a}function j(i){let r=i.value,a=i.key,n=i.style,o=i.styleSpec,s=o.terrain,l=[],h=e.i(r);if(void 0===r||"null"===h)return l;if("object"!==h)return l.concat([new T("terrain",r,`object expected, ${h} found`)]);for(let e in r){let i=e.match(/^(.*)-transition$/);l=l.concat(i&&s[i[1]]&&s[i[1]].transition?q({key:e,value:r[e],valueSpec:o.transition,style:n,styleSpec:o}):s[e]?q({key:e,value:r[e],valueSpec:s[e],style:n,styleSpec:o}):[new M(e,r[e],`unknown property "${e}"`)])}if(r.source){let i=n.sources&&n.sources[r.source],o=i&&e.u(i.type);i?"raster-dem"!==o&&l.push(new T(a,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):l.push(new T(a,r.source,`source "${r.source}" not found`))}else l.push(new T(a,r,'terrain is missing required property "source"'));return l}function G(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.fog,s=[],l=e.i(r);if(void 0===r)return s;if("object"!==l)return s.concat([new T("fog",r,`object expected, ${l} found`)]);for(let e in r){let i=e.match(/^(.*)-transition$/);s=s.concat(i&&o[i[1]]&&o[i[1]].transition?q({key:e,value:r[e],valueSpec:n.transition,style:a,styleSpec:n}):o[e]?q({key:e,value:r[e],valueSpec:o[e],style:a,styleSpec:n}):[new M(e,r[e],`unknown property "${e}"`)])}return s}let Z={"*":()=>[],array:S,boolean:function(i){let r=i.value,a=i.key,n=e.i(r);return"boolean"!==n?[new T(a,r,`boolean expected, ${n} found`)]:[]},number:A,color:function(i){let r=i.key,a=i.value,n=e.i(a);return"string"!==n?[new T(r,a,`color expected, ${n} found`)]:null===e.y(a)?[new T(r,a,`color expected, "${a}" found`)]:[]},enum:P,filter:z,function:I,layer:k,object:E,source:F,model:N,light:V,"light-3d":U,terrain:j,fog:G,string:O,formatted:function(e){return 0===O(e).length?[]:C(e)},resolvedImage:function(e){return 0===O(e).length?[]:C(e)},projection:function(i){let r=i.value,a=i.styleSpec,n=a.projection,o=i.style,s=[],l=e.i(r);if("object"===l)for(let e in r)s=s.concat(q({key:e,value:r[e],valueSpec:n[e],style:o,styleSpec:a}));else"string"!==l&&(s=s.concat([new T("projection",r,`object or string expected, ${l} found`)]));return s},import:function(i){let{value:r,styleSpec:a}=i,{data:n,...o}=r;Object.defineProperty(o,"__line__",{value:r.__line__,enumerable:!1});let s=E(e.j({},i,{value:o,valueSpec:a.import}));return""===e.u(o.id)&&s.push(new T(`${i.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(W(n,a,{key:`${i.key}.data`}))),s}};function q(i,r=!1){let a=i.value,n=i.valueSpec,o=i.styleSpec;if(n.expression&&e.A(e.u(a)))return I(i);if(n.expression&&e.n(e.o(a)))return C(i);if(n.type&&Z[n.type]){let a=Z[n.type](i);return!0===r&&a.length>0&&"array"===e.i(i.value)?C(i):a}return E(e.j({},i,{valueSpec:n.type?o[n.type]:n}))}function $(e){let i=e.value,r=e.key,a=O(e);return a.length||(-1===i.indexOf("{fontstack}")&&a.push(new T(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&a.push(new T(r,i,'"glyphs" url must include a "{range}" token'))),a}function W(i,r=e.D,a={}){return q({key:a.key||"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:$,"*":()=>[]}})}function H(i,r=e.D){return en(W(i,r))}let X=e=>en(F(e)),Y=e=>en(V(e)),K=e=>en(U(e)),J=e=>en(j(e)),Q=e=>en(G(e)),ee=e=>en(k(e)),et=e=>en(z(e)),ei=e=>en(L(e)),er=e=>en(R(e)),ea=e=>en(N(e));function en(e){return e.slice().sort((e,i)=>e.line&&i.line?e.line-i.line:0)}function eo(i,r){let a=!1;if(r&&r.length)for(let n of r)n instanceof M?e.w(n.message):(i.fire(new e.a(Error(n.message))),a=!0);return a}let es=new e.F({anchor:new e.G(e.D.light.anchor),position:new e.H(e.D.light.position),color:new e.G(e.D.light.color),intensity:new e.G(e.D.light.intensity)});class el extends e.E{constructor(i,r="flat"){super(),this._transitionable=new e.J(es),this.setLight(i,r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i,r={}
8){this._validate(Y,e,r)||(this._transitionable.setTransitionOrValue(e),this.id=i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eo(this,i.call(H,e.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.D})))}}let eh=new e.F({source:new e.G(e.D.terrain.source),exaggeration:new e.G(e.D.terrain.exaggeration)}),eu=class extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._transitionable=new e.J(eh,a,n),this._transitionable.setTransitionOrValue(i,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(e,i){this._transitionable.setTransitionOrValue(e,i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(i){return this._transitioning.possiblyEvaluate(new e.K(i)).get("exaggeration")}isZoomDependent(){let i=this._transitionable._values.exaggeration;return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof e.Z}};function ec(i,r,a,n){let o=e.O(45,65,a),[s,l]=ed(i,n),h=1-Math.min(1,Math.exp(-((r-s)/(l-s)*6)));return h*=h*h,(h=Math.min(1,1.00747*h))*o*i.alpha}function ed(e,i){let r=.5/Math.tan(.5*i);return[e.range[0]+r,e.range[1]+r]}function ep(i,r,a,n,o){let s=e.N.transformMat4([],[r,a,n],o.mercatorFogMatrix);return ec(i,e.N.length(s),o.pitch,o._fov)}function ef(i,r,a,n,o,s,l){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let i of[[a,n,0],[o,n,0],[o,s,0],[a,s,0]]){let a=e.N.transformMat4([],i,r),n=e.N.length(a);h=Math.min(h,n),u=Math.max(u,n)}return[ec(i,h,l.pitch,l._fov),ec(i,u,l.pitch,l._fov)]}let em=new e.F({range:new e.G(e.D.fog.range),color:new e.G(e.D.fog.color),"high-color":new e.G(e.D.fog["high-color"]),"space-color":new e.G(e.D.fog["space-color"]),"horizon-blend":new e.G(e.D.fog["horizon-blend"]),"star-intensity":new e.G(e.D.fog["star-intensity"]),"vertical-range":new e.G(e.D.fog["vertical-range"])});class e_ extends e.E{constructor(i,r,a,n){super(),this._transitionable=new e.J(em,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.Q(em)}get state(){let i=this._transform,r="globe"===i.projection.name,a=e.S(i.zoom),n=this.properties.get("range");return{range:r?[e.U(.5,n[0],a),e.U(3,n[1],a)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(Q,i,a))return;let n=e.e({},i);for(let i of Object.keys(e.D.fog))void 0===n[i]&&(n[i]=e.D.fog[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;let r=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.O(45,65,i))*r.a}getOpacityAtLatLng(i,r){return this._transform.projection.supportsFog?function(i,r,a){let n=e.L.fromLngLat(r),o=a.elevation?a.elevation.getAtPointOrZero(n):0;return ep(i,n.x,n.y,o,a)}(this.state,i,r):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];let r=this._transform.calculateFogTileMatrix(i.toUnwrapped());return ef(this.state,r,0,0,e.V,e.V,this._transform)}getOpacityForBounds(e,i,r,a,n){return this._transform.projection.supportsFog?ef(this.state,e,i,r,a,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?ed(this.state,e):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;for(let r of[4,5,6,7]){let a;let n=i.points[r];if(n[2]>=0)a=n;else{let o=i.points[r-4];a=e.W(o,n,o[2]/(o[2]-n[2]))}if(ep(this.state,a[0],a[1],0,this._transform)>=.05)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}
8_validate(i,r,a){return(!a||!1!==a.validate)&&eo(this,i.call(H,e.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.D})))}}class eg extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._options=i,this.properties=new e.Q(r),this._transitionable=new e.J(r,a,new Map(n)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,i){this._options=e,this._transitionable.setTransitionOrValue(e.properties,i)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let ey=new e.F({color:new e.G(e.D.properties_light_ambient.color),intensity:new e.G(e.D.properties_light_ambient.intensity)}),ex=new e.F({direction:new e.X(e.D.properties_light_directional.direction),color:new e.G(e.D.properties_light_directional.color),intensity:new e.G(e.D.properties_light_directional.intensity),"cast-shadows":new e.G(e.D.properties_light_directional["cast-shadows"]),"shadow-intensity":new e.G(e.D.properties_light_directional["shadow-intensity"])});class ev{constructor(e,i,r,a){this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(i,r){let a,n;if(i instanceof e.P||"number"==typeof i[0]){let o=e.P.convert(i);a=[o],n=r.isPointAboveHorizon(o)}else{let o=e.P.convert(i[0]),s=e.P.convert(i[1]);a=[o,s],n=e.Y(o,s).every(e=>r.isPointAboveHorizon(e))}return new ev(a,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(i){return e.Y(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.Y(r,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<a.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?n[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(n[3]=this.cameraPoint)),e._(n,i)}bufferedCameraGeometryGlobe(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.Y(r,a,i),o=this.cameraPoint.clone();switch(3*((o.y>r.y)+(o.y>a.y))+((o.x>r.x)+(o.x>a.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(i,r,a,n=0){var o;let s=i.queryPadding/r._pixelsPerMercatorPixel+1,l=a?this._bufferedCameraMercator(s,r):this._bufferedScreenMercator(s,r),h=i.tileID.wrap+(l.unwrapped?n:0),u=l.polygon.map(r=>e.$(i.tileTransform,r,h));if(!e.a0(u,0,0,e.V,e.V))return;h=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);let c=this.screenGeometryMercator.polygon.map(r=>e.a1(i.tileTransform,r,h)),d=c.map(i=>new e.P(i[0],i[1])),p=r.getFreeCameraOptions().position||new e.L(0,0,0),f=e.a1(i.tileTransform,p,h),m=c.map(i=>{let r=e.N.sub(i,i,f);return e.N.normalize(r,r),new e.a2(f,r)}),_=e.a3(i,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:d,tilespaceRays:m,bufferedTilespaceGeometry:u,bufferedTilespaceBounds:((o=e.a4(u)).min.x=e.aa(o.min.x,0,e.V),o.min.y=e.aa(o.min.y,0,e.V),o.max.x=e.aa(o.max.x,0,e.V),o.max.y=e.aa(o.max.y,0,e.V),o),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:_}}_bufferedScreenMercator(e,i){let r=100*e|0;if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),i):{polygon:this.bufferedScreenGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[r]=a,a}}_bufferedCameraMercator(e,i){let r=100*e|0;if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),i):{polygon:this.bufferedCameraGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[r]=a,a}}_projectAndResample(i,r){let a=function(i,r){let a=e.a6.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.ab,0,1],o=[0,e.ab,0,1],s=[0,0,0,1];e.a7.transformMat4(n,n,a),e.a7.transformMat4(o,o,a),e.a7.transformMat4(s,s,a);let l=new e.P(n[0]/n[3],n[1]/n[3]),h=new e.P(o[0]/o[3],o[1]/o[3]),u=e.a8(i,l)&&n[3]<s[3],c=e.a8(i,h)&&o[3]<s[3];if(!u&&!c)return null;let d=function(e,i,r){for(let a=1;a<e.length;a++){let n=ew(i.pointCoordinate3D(e[a-1]).x),o=ew(i.pointCoordinate3D(e[a]).x);
8if(r<0){if(n<o)return{idx:a,t:-n/(o-1-n)}}else if(o<n)return{idx:a,t:(1-n)/(o+1-n)}}return null}(i,r,u?-1:1);if(!d)return null;let{idx:p,t:f}=d,m=p>1?eb(i.slice(0,p),r):[],_=p<i.length?eb(i.slice(p),r):[];m=m.map(i=>new e.P(ew(i.x),i.y)),_=_.map(i=>new e.P(ew(i.x),i.y));let g=[...m];0===g.length&&g.push(_[_.length-1]);let y=e.U(g[g.length-1].y,(0===_.length?m[0]:_[0]).y,f);return g.push(...u?[new e.P(0,y),new e.P(0,0),new e.P(1,0),new e.P(1,y)]:[new e.P(1,y),new e.P(1,1),new e.P(0,1),new e.P(0,y)]),0===_.length?g.push(m[0]):g.push(..._),{polygon:g.map(i=>new e.L(i.x,i.y)),unwrapped:!1}}(i,r);if(a)return a;let n=function(i,r){let a=!1,n=-1/0,o=0;for(let e=0;e<i.length-1;e++)i[e].x>n&&(n=i[e].x,o=e);for(let e=0;e<i.length-1;e++){let r=(o+e)%(i.length-1),n=i[r],s=i[r+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===r&&(i[i.length-1].x+=1)):(s.x+=1,r+1===i.length-1&&(i[0].x+=1)),a=!0)}let s=e.a5(r.center.lng);return a&&s<Math.abs(s-1)&&i.forEach(e=>{e.x-=1}),{polygon:i,unwrapped:a}}(eb(i,r).map(i=>new e.P(ew(i.x),i.y)),r);return{polygon:n.polygon.map(i=>new e.L(i.x,i.y)),unwrapped:n.unwrapped}}}function eb(i,r){return e.a9(i,e=>{let i=r.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function ew(e){return e<0?1+e%1:e%1}function eT(i,r,a,n,o){let s=function(a,n){if(a)return o(a);if(n){i.url&&n.tiles&&i.tiles&&delete i.tiles;let a=e.ac(e.e(n,i),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(a.vectorLayers=n.vector_layers,a.vectorLayerIds=a.vectorLayers.map(e=>e.id)),n.raster_layers&&(a.rasterLayers=n.raster_layers,a.rasterLayerIds=a.rasterLayers.map(e=>e.id)),a.tiles=r.canonicalizeTileset(a,i.url),o(null,a)}};return i.url?e.g(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),e.R.Source),s):e.f.frame(()=>s(null,i))}class eM{constructor(i,r,a){this.bounds=e.ad.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=a||24}
8validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(i){let r=Math.pow(2,i.z),a=Math.floor(e.a5(this.bounds.getWest())*r),n=Math.floor(e.ae(this.bounds.getNorth())*r),o=Math.ceil(e.a5(this.bounds.getEast())*r),s=Math.ceil(e.ae(this.bounds.getSouth())*r);return i.x>=a&&i.x<o&&i.y>=n&&i.y<s}}class eE extends e.E{constructor(i,r,a,n){if(super(),this.id=i,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.ac(r,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.af}load(i){this._loaded=!1,this.fire(new e.b("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=eT(this._options,this.map._requestManager,r,a,(n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.a(n))):o&&(e.e(this,o),o.bounds&&(this.tileBounds=new eM(o.bounds,this.minzoom,this.maxzoom)),e.aj(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.b("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.ag(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.e({},this._options)}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(a,e.R.Tile),data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:e.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.isExtraShadowCaster};if(n.request.collectResourceTiming=this._collectResourceTiming,i.actor&&"expired"!==i.state)"loading"===i.state?i.reloadCallback=r:i.request=i.actor.send("reloadTile",n,o.bind(this));else if(i.actor=this._tileWorkers[a]=this._tileWorkers[a]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",n,o.bind(this),void 0,!0);else{let r=e.ah.call({deduped:this._deduped},n,(e,r)=>{e||!r?o.call(this,e):(n.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},i.actor&&i.actor.send("loadTile",n,o.bind(this),void 0,!0))},!0);i.request={cancel:r}}function o(a,n){return delete i.request,i.aborted?r(null):a&&404!==a.status?r(a):(n&&n.resourceTiming&&(i.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&i.setExpiryData(n),i.loadVectorData(n,this.map.painter),e.ai(this.dispatcher),r(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(e){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eS extends e.E{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,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=e.e({type:"raster"},r),e.e(this,e.ac(r,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new e.b("dataloading",{dataType:"source"})),this._tileJSONRequest=eT(this._options,this.map._requestManager,null,null,(r,a)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.a(r)):a&&(e.e(this,a),a.bounds&&(this.tileBounds=new eM(a.bounds,this.minzoom,this.maxzoom)),e.aj(a.tiles),this.fire(new e.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.b("data",{dataType:"source",sourceDataType:"content"}))),i&&i(r)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.ag(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(i,r){let a=e.f.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);i.request=e.d(this.map._requestManager.transformRequest(n,e.R.Tile),(a,n,o,s)=>(delete i.request,i.aborted?(i.state="unloaded",r(null)):a?(i.state="errored",r(a)):n?(this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:o,expires:s}),i.setTexture(n,this.map.painter),i.state="loaded",e.ai(this.dispatcher),void r(null)):r(null)))}abortTile(e,i){e.request&&(e.request.cancel(),delete e.request),i()}unloadTile(i,r){i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eA extends eS{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this._options=e.e({type:"raster-array"},r)}triggerRepaint(e){let i=this.map.painter._terrain,r=this.map.style.getSourceCache(this.id);i&&i.enabled&&r&&i._clearRenderCacheForTile(r.id,e.tileID),this.map.triggerRepaint()}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(a,e.R.Tile);i.requestParams=n,i.actor||(i.actor=this.dispatcher.getActor()),i.request=i.fetchHeader(void 0,(e,a,n,o)=>{if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(e){if(20===e.code)return;return i.state="errored",r(e)}this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:n,expires:o}),i.state="empty",r(null)})}unloadTile(i){let r=i.texture;r&&r instanceof e.T?(i.destroy(!0),this.map.painter.saveTileTexture(r)):(i.destroy(),i.flushQueues(),i._isHeaderLoaded=!1,delete i._mrt,delete i.textureDescriptor),i.fbo&&(i.fbo.destroy(),delete i.fbo),delete i.request,delete i.requestParams,delete i.neighboringTiles,i.state="unloaded"}prepareTile(i,r,a){i._isHeaderLoaded&&("empty"!==i.state&&(i.state="reloading"),i.fetchBand(r,a,(r,a)=>{if(r)return i.state="errored",this.fire(new e.a(r)),void this.triggerRepaint(i);a&&(i.setTexture(a,this.map.painter),i.state="loaded",this.triggerRepaint(i))}))}getInitialBand(e){if(!this.rasterLayers)return 0;let i=this.rasterLayers.find(({id:i})=>i===e),r=i&&i.fields,a=r&&r.bands&&r.bands;return a?a[0]:0}getTextureDescriptor(i,r,a){if(!i)return;let n=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;r instanceof e.an?o=r.paint.get("raster-array-band"):r instanceof e.ao&&(o=r.paint.get("raster-particle-array-band"));let s=o||this.getInitialBand(n);if(null!=s){if(i.textureDescriptor){if(!i.updateNeeded(n,s)||a)return Object.assign({},i.textureDescriptor,{texture:i.texture})}else this.prepareTile(i,n,s)}}}let eI=new Uint16Array(8184);for(let e=0;e<2046;e++){let i=e+2,r=0,a=0,n=0,o=0,s=0,l=0;for(1&i?n=o=s=32:r=a=l=32;(i>>=1)>1;){let e=r+n>>1,h=a+o>>1;1&i?(n=r,o=a,r=s,a=l):(r=n,a=o,n=s,o=l),s=e,l=h}let h=4*e;eI[h+0]=r,eI[h+1]=a,eI[h+2]=n,eI[h+3]=o}let eC=new Uint16Array(2178),eP=new Uint8Array(1089),ez=new Uint16Array(1089);function eD(e){return 0===e?-.03125:32===e?.03125:0}class eL{constructor(e,i,r,a){this.id=eL.uniqueIdxCounter,eL.uniqueIdxCounter++,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||a||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=eL.uniqueIdxCounter,eL.uniqueIdxCounter++;let i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}eL.uniqueIdxCounter=0;let eR={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ek{constructor(e,i,r,a,n,o){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.instanceCount=o,this.context=e;let s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||i.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}
8enableAttributes(e,i){for(let r=0;r<this.attributes.length;r++){let a=i.attributes[this.attributes[r].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=this.attributes[a],o=i.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[eR[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=i.attributes[this.attributes[a].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,r)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class eO{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class eB extends eO{getDefault(){return e.ax.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class eF extends eO{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class eN extends eO{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class eV extends eO{getDefault(){return[!0,!0,!0,!0]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class eU extends eO{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ej extends eO{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class eG extends eO{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class eZ extends eO{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class eq extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class e$ extends eO{getDefault(){return[0,1]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class eW extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class eH extends eO{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class eX extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class eY extends eO{getDefault(){let e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class eK extends eO{getDefault(){return e.ax.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class eJ extends eO{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class eQ extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class e0 extends eO{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class e1 extends eO{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let e2=class extends eO{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class e3 extends eO{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class e5 extends eO{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class e4 extends eO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class e6 extends eO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class e8 extends eO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class e9 extends eO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class e7 extends eO{getDefault(){return null}set(e){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class te extends eO{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class tt extends eO{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class ti extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class tr extends eO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class ta extends eO{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class tn extends ta{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class to extends ta{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,this.attachment(),i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ts extends ta{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,this.attachment(),i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class tl extends to{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class th{constructor(e,i,r,a,n){this.context=e,this.width=i,this.height=r;let o=this.framebuffer=e.gl.createFramebuffer();
8a&&(this.colorAttachment=new tn(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new to(e,o):new ts(e,o))}destroy(){let e=this.context.gl;if(this.colorAttachment){let i=this.colorAttachment.get();i&&e.deleteTexture(i)}if(this.depthAttachment&&this.depthAttachmentType){if("renderbuffer"===this.depthAttachmentType){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}else{let i=this.depthAttachment.get();i&&e.deleteTexture(i)}}e.deleteFramebuffer(this.framebuffer)}}class tu{constructor(e,i,r){this.func=e,this.mask=i,this.range=r}}tu.ReadOnly=!1,tu.ReadWrite=!0,tu.disabled=new tu(519,tu.ReadOnly,[0,1]);class tc{constructor(e,i,r,a,n,o){this.test=e,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=o}}tc.disabled=new tc({func:519,mask:0},0,0,7680,7680,7680);class td{constructor(e,i,r,a){this.blendFunction=e,this.blendColor=i,this.mask=r,this.blendEquation=a}}td.Replace=[1,0,1,0],td.disabled=new td(td.Replace,e.ax.transparent,[!1,!1,!1,!1]),td.unblended=new td(td.Replace,e.ax.transparent,[!0,!0,!0,!0]),td.alphaBlended=new td([1,771,1,771],e.ax.transparent,[!0,!0,!0,!0]),td.multiply=new td([774,0,774,0],e.ax.transparent,[!0,!0,!0,!0]);class tp{constructor(e,i,r){this.enable=e,this.mode=i,this.frontFace=r}}tp.disabled=new tp(!1,1029,2305),tp.backCCW=new tp(!0,1029,2305),tp.backCW=new tp(!0,1029,2304),tp.frontCW=new tp(!0,1028,2304),tp.frontCCW=new tp(!0,1028,2305);class tf{constructor(e,i){this.gl=e,this.clearColor=new eB(this),this.clearDepth=new eF(this),this.clearStencil=new eN(this),this.colorMask=new eV(this),this.depthMask=new eU(this),this.stencilMask=new ej(this),this.stencilFunc=new eG(this),this.stencilOp=new eZ(this),this.stencilTest=new eq(this),this.depthRange=new e$(this),this.depthTest=new eW(this),this.depthFunc=new eH(this),this.blend=new eX(this),this.blendFunc=new eY(this),this.blendColor=new eK(this),this.blendEquation=new eJ(this),this.cullFace=new eQ(this),this.cullFaceSide=new e0(this),this.frontFace=new e1(this),this.program=new e2(this),this.activeTexture=new e3(this),this.viewport=new e5(this),this.bindFramebuffer=new e4(this),this.bindRenderbuffer=new e6(this),this.bindTexture=new e8(this),this.bindVertexBuffer=new e9(this),this.bindElementBuffer=new e7(this),this.bindVertexArrayOES=new te(this),this.pixelStoreUnpack=new tt(this),this.pixelStoreUnpackPremultiplyAlpha=new ti(this),this.pixelStoreUnpackFlipY=new tr(this),this.options=i?{...i}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}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(e,i,r){return new eL(this,e,i,r)}createVertexBuffer(e,i,r,a,n){return new ek(this,e,i,r,a,n)}createRenderbuffer(e,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,e,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,i,r,a){return new th(this,e,i,r,a)}clear({color:e,depth:i,stencil:r,colorMask:a}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(a||[!0,!0,!0,!0])),void 0!==i&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){a(e.blendFunction,td.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor),e.blendEquation?this.blendEquation.set(e.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(e.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}var tm=e.ay([{name:"a_pos",type:"Float32",components:3}]);class t_{constructor(i,r,a,n){let o={width:a[0],height:a[1],data:null},s=i.gl;this.targetColorTexture=new e.T(i,o,s.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new e.T(i,o,s.RGBA,{useMipmap:!1}),this.context=i,this.setNumParticles(r,n),this.lastInvalidatedAt=0}setNumParticles(i,r){if(this.numParticles===r)return;(this.particleVertices0||this.particleVertices1||this.particleSegment)&&(this.particleVertices0.destroy(),this.particleVertices1.destroy(),this.particleSegment.destroy());let a=new e.az;a.reserve(Math.round(r));let n=e.aA(i.key);for(let e=0;e<r;e++)a.emplaceBack(n(),n(),n());this.particleVertices0=this.context.createVertexBuffer(a,tm.members,!0),this.particleVertices1=this.context.createVertexBuffer(a,tm.members,!0),this.particleSegment=e.aB.simpleSegment(0,0,this.particleVertices0.length,0),this.numParticles=r}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=e.f.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleVertices0.destroy(),this.particleVertices1.destroy(),this.particleSegment.destroy()}}let tg={type:2,extent:e.V,loadGeometry:()=>[[new e.P(0,0),new e.P(e.V+1,0),new e.P(e.V+1,e.V+1),new e.P(0,e.V+1),new e.P(0,0)]]};class ty{constructor(i,r,a,n,o){this.tileID=i,this.uid=e.aC(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<e.f.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.as(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=function(e,i){let r={};if(!i)return r;for(let a of e){let e=a.layerIds.map(e=>
8i.getLayer(e)).filter(Boolean);if(0!==e.length)for(let i of(a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>e.filter(e=>e.id===i)[0])),e))r[i.fqid]=a}return r}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof e.aE){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof e.aE&&r.hasRTLText){this.hasRTLText=!0,e.aF();break}}for(let e in this.queryPadding=0,this.buckets){let i=this.buckets[e],a=r.style.getOwnLayer(e);if(!a)continue;let n=a.queryRadius(i);this.queryPadding=Math.max(this.queryPadding,n)}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new e.aD}unloadVectorData(){if(this.hasData()){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.fqid]}upload(i){for(let e in this.buckets){let r=this.buckets[e];r.uploadPending()&&r.upload(i)}let r=i.gl,a=this.imageAtlas;if(a&&!a.uploaded){let n=!!Object.keys(a.patternPositions).length;this.imageAtlasTexture=new e.T(i,a.image,r.RGBA,{useMipmap:n}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(i,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(i,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,r){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,r),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let a=i.style.getBrightness();(this._lastUpdatedBrightness||a)&&(this._lastUpdatedBrightness&&a&&.001>Math.abs(this._lastUpdatedBrightness-a)||(this._lastUpdatedBrightness=a,this.updateBuckets(void 0,i)))}queryRenderedFeatures(e,i,r,a,n,o,s,l){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:a,pixelPosMatrix:s,transform:o,params:n,tileTransform:this.tileTransform},e,i,r):{}}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=e.aG(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=e.aH(n,!0);if(!l.filter(new e.K(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new e.K(this.tileID.overscaledZ),n))continue;let p=a.getId(n,o),f=new e.aI(n,h,u,c,p);f.tile=d,i.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}bucketsLoaded(){for(let e in this.buckets)if(this.buckets[e].uploadPending())return!1;return!0}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=e.aJ(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(r){if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=e+Math.max(a,3e4):i=!0}}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2147483647)}setFeatureState(e,i){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&i&&this.updateBuckets(e,i)}updateBuckets(i,r){if(!this.latestFeatureIndex)return;let a=this.latestFeatureIndex.loadVTLayers(),n=r.style.listImages(),o=r.style.getBrightness();for(let s in this.buckets){if(!r.style.hasLayer(s))continue;let l=this.buckets[s],h=l.layers[0].sourceLayer||"_geojsonTileLayer",u=a[h],c={};if(i&&(c=i[h],!u||!c||0===Object.keys(c).length))continue;if(l.update(c,u,n,this.imageAtlas&&this.imageAtlas.patternPositions||{},o),l instanceof e.aK||l instanceof e.aL){let e=r.style.getOwnSourceCache(l.layers[0].source);r._terrain&&r._terrain.enabled&&e&&l.programConfigurations.needsUpload&&r._terrain._clearRenderCacheForTile(e.id,this.tileID)}let d=r&&r.style&&r.style.getOwnLayer(s);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(l)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=e.f.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i,{useMipmap:!0}):(this.texture=new e.T(a,i,n.RGBA,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}
8setDependencies(e,i){let r={};for(let e of i)r[e]=!0;this.dependencies[e]=r}hasDependency(e,i){for(let r of e){let e=this.dependencies[r];if(e){for(let r of i)if(e[r])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=e.aM(tg,this.tileID.canonical,this.tileTransform)[0],n=new e.aN,o=new e.aO;for(let e=0;e<a.length;e++){let{x:i,y:r}=a[e];n.emplaceBack(i,r),o.emplaceBack(e)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,e.aP.members),this._tileDebugSegments=e.aB.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=e.aM(tg,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=e.as(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=e.at((i.x+(s+eD(s))/32)/n),h=e.au((i.y+(o+eD(o))/32)/n),u=r.project(l,h),c=33*o+s;eC[2*c+0]=Math.round((u.x*a.scale-a.x)*e.V),eC[2*c+1]=Math.round((u.y*a.scale-a.y)*e.V)}eP.fill(0),ez.fill(0);for(let e=2045;e>=0;e--){let i=4*e,r=eI[i+0],a=eI[i+1],n=eI[i+2],o=eI[i+3],s=r+n>>1,l=a+o>>1,h=s+l-a,u=l+r-s,c=33*a+r,d=33*o+n,p=33*l+s,f=Math.hypot((eC[2*c+0]+eC[2*d+0])/2-eC[2*p+0],(eC[2*c+1]+eC[2*d+1])/2-eC[2*p+1])>=16;eP[p]=eP[p]||(f?1:0),e<1022&&(eP[p]=eP[p]||eP[(a+u>>1)*33+(r+h>>1)]||eP[(o+u>>1)*33+(n+h>>1)])}let o=new e.av,s=new e.aw,l=0;function h(i,r){let a=33*r+i;return 0===ez[a]&&(o.emplaceBack(eC[2*a+0],eC[2*a+1],i*e.V/32,r*e.V/32),ez[a]=++l),ez[a]-1}function u(e,i,r,a,n,o){let l=e+r>>1,c=i+a>>1;if(Math.abs(e-n)+Math.abs(i-o)>1&&eP[33*c+l])u(n,o,e,i,l,c),u(r,a,n,o,l,c);else{let l=h(e,i),u=h(r,a),c=h(n,o);s.emplaceBack(l,u,c)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new e.av,n=new e.aw,o))a.emplaceBack(i,r,0,0);let i=e.aQ(a.int16,void 0,4);for(let e=0;e<i.length;e+=3)n.emplaceBack(i[e],i[e+1],i[e+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,e.aR.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=e.aB.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a;let n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=e.aS(o,r),l=e.aT(s),h=e.S(r.zoom);h>0&&(a=e.a6.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,l,a,h),this._makeGlobeTileDebugTextBuffer(i,o,r,l,a,h)}_globePoint(i,r,a,n,o,s,l){let h=e.aU(i,r,a);if(s){let o=1<<a.z,u=e.a5(n.center.lng),c=e.ae(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/e.V+a.x)/o+p,m=(r/e.V+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];e.N.transformMat4(_,_,s),h=e.aV(h,_,l)}return e.N.transformMat4(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new e.aN,h=new e.aO,u=new e.aW,c=(e,i,c,d,p)=>{let f=(c-e)/(p-1),m=(d-i)/(p-1),_=l.length;for(let c=0;c<p;c++){let d=e+c*f,p=i+c*m;l.emplaceBack(d,p);let g=this._globePoint(d,p,r,a,n,o,s);u.emplaceBack(g[0],g[1],g[2]),h.emplaceBack(_+c)}},d=e.V;c(0,0,d,0,16),c(d,0,d,d,16),c(d,d,0,d,16),c(0,d,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,e.aP.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,e.aX.members),this._tileDebugSegments=e.aB.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=e.V/4,h=new e.aN,u=new e.aw,c=new e.aW;u.reserve(32),h.reserve(25),c.reserve(25);let d=(e,i)=>25*e+i;for(let e=0;e<25;e++){let i=e*l;for(let e=0;e<25;e++){let u=e*l;h.emplaceBack(u,i);let d=this._globePoint(u,i,r,a,n,o,s);c.emplaceBack(d[0],d[1],d[2])}}for(let e=0;e<4;e++)for(let i=0;i<4;i++){let r=d(e,i),a=d(e,i+1),n=d(e+1,i),o=d(e+1,i+1);u.emplaceBack(r,a,n),u.emplaceBack(n,a,o)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(u),this._tileDebugTextBuffer=i.createVertexBuffer(h,e.aP.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(c,e.aX.members),this._tileDebugTextSegments=e.aB.simpleSegment(0,0,25,32)}destroy(i=!1){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!i&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}let tx={vector:eE,raster:eS,"raster-dem":class extends eS{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,a){e&&(i.state="errored",r(e)),a&&(i.dem=a,i.dem.onDeserialize(),i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0,i.state="loaded",r(null))}i.request=e.d(this.map._requestManager.transformRequest(a,e.R.Tile),(function(a,o,s,l){if(delete i.request,i.aborted)i.state="unloaded",r(null);else if(a)i.state="errored",r(a);
8else if(o){this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:s,expires:l});let r=ImageBitmap&&o instanceof ImageBitmap&&e.ak(),a=1-(o.width-e.al(o.width))/2;a<1||i.neighboringTiles||(i.neighboringTiles=this._getNeighboringTiles(i.tileID));let h=r?o:e.f.getImageData(o,a),u={uid:i.uid,coord:i.tileID,source:this.id,scope:this.scope,rawImageData:h,encoding:this.encoding,padding:a};i.actor&&"expired"!==i.state||(i.actor=this.dispatcher.getActor(),i.actor.send("loadDEMTile",u,n.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(i){let r=i.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,o=0===r.x?i.wrap-1:i.wrap,s=(r.x+1+a)%a,l=r.x+1===a?i.wrap+1:i.wrap,h={};return h[new e.am(i.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},h[new e.am(i.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(h[new e.am(i.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},h[new e.am(i.overscaledZ,i.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new e.am(i.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new e.am(i.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},h[new e.am(i.overscaledZ,i.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new e.am(i.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),h}},"raster-array":eA,geojson:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let o=e.V/this.tileSize;this.workerOptions=e.e({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*o,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*o,extent:e.V,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.V,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*o,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}getClusterExpansionZoom(e,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterChildren(e,i){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterLeaves(e,i,r,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:i,offset:r},a),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.b("dataloading",{dataType:"source"})),this._loaded=!1;let i=e.e({},this.workerOptions);i.scope=this.scope;let r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(e.f.resolveURL(r),e.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,(i,r)=>{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.a(i));else{let i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[this.id]&&(i.resourceTiming=r.resourceTiming[this.id]),this.fire(new e.b("data",i)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(i,r){let a=i.actor?"reloadTile":"loadTile";i.actor=this.actor;let n={type:this.type,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,scope:this.scope,pixelRatio:e.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0};i.request=this.actor.send(a,n,(e,n)=>(delete i.request,i.destroy(),i.aborted?r(null):e?r(e):(i.loadVectorData(n,this.map.painter,"reloadTile"===a),r(null))),void 0,"loadTile"===a)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){this.actor.send("removeTile",{uid:e.uid,type:this.t
8ype,source:this.id,scope:this.scope}),e.destroy()}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.ap{constructor(e,i,r,a){super(e,i,r,a),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;let i=this.options;for(let r of(this.urls=[],i.urls))this.urls.push(this.map._requestManager.transformRequest(r,e.R.Source).url);e.aq(this.urls,(i,r)=>{this._loaded=!0,i?this.fire(new e.a(i)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){let r=this.video.seekable;i<r.start(0)||i>r.end(0)?this.fire(new e.a(new T(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let i=this.map.painter.context,r=i.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(i,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(i)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.ap,model:class extends e.E{constructor(e,i,r,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i}load(){let i=[];for(let r in this._options.models){let a=this._options.models[r],n=e.l(this.map._requestManager.transformRequest(a.uri,e.R.Model).url).then(i=>{if(!i)return;let n=e.c(i),o=new e.M(r,a.position,a.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)}).catch(i=>{this.fire(new e.a(Error(`Could not load model ${r} from ${a.uri}: ${i.message}`)))});i.push(n)}return Promise.allSettled(i).then(()=>{this._loaded=!0,this.fire(new e.b("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new e.a(Error(`Could not load models: ${i.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,i,r,a){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(a)}onAdd(e){this.map=e,this.load()}load(i){this._loaded=!1,this.fire(new e.b("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=eT(this._options,this.map._requestManager,r,a,(n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.a(n))):o&&(e.e(this,o),o.bounds&&(this.tileBounds=new eM(o.bounds,this.minzoom,this.maxzoom)),e.aj(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.b("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(a,e.R.Tile),data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(i.actor&&"expired"!==i.state){if("loading"===i.state)i.reloadCallback=r;else{if(i.buckets){for(let e of Object.values(i.buckets))e.dirty=!0;return void(i.state="loaded")}i.request=i.actor.send("reloadTile",n,o.bind(this))}}else i.actor=this.dispatcher.getActor(),i.request=i.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,a){return i.aborted?r(null):e&&404!==e.status?r(e):(a&&(a.resourceTiming&&(i.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&i.setExpiryData(a),i.buckets={...i.buckets,...a.buckets},a.featureIndex&&(i.latestFeatureIndex=a.featureIndex)),i.state="loaded",void r(null))}}serialize(){return e.e({},this._options)}},canvas:class extends e.ap{constructor(i,r,a,n){super(i,r,a,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.a(new T(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.a(new T(`sources.${i}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.a(new T(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.a(new T(`sources.${i}`,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 e.a(new T(`sources.${i}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.a(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context;this.texture?!i&&!this._playing||this.texture instanceof e.ar||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.a(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.a(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new eM(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),e.e(this,e.ac(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ac(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.b("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(i){this._map=i,this._loaded=!1,this.fire(new e.b("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(i),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){let{x:i,y:r,z:a}=e.canonical;return this._implementation.hasTile({x:i,y:r,z:a})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,i){let{x:r,y:a,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:r,y:a,z:n},{signal:o.signal})).then((function(r){return delete e.request,e.aborted?(e.state="unloaded",i(null)):void 0===r?(e.state="errored",i(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null)):r instanceof ImageData||r instanceof HTMLCanvasElement||r instanceof ImageBitmap||r instanceof HTMLImageElement?(this.loadTileData(e,r),e.state="loaded",void i(null)):(e.state="errored",i(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(r=>{20!==r.code&&(e.state="errored",i(r))}),e.request.cancel=()=>o.abort()}loadTileData(e,i){e.setTexture(i,this._map.painter)}unloadTile(i,r){if(i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this._map.painter.saveTileTexture(i.texture)):i.destroy(),this._implementation.unloadTile){let{x:e,y:r,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:e,y:r,z:a})}r()}abortTile(e,i){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),i()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){let i=e.ag(this.id,this.scope);this._map.style.clearSource(i)}
8_update(){this.fire(new e.b("data",{dataType:"source",sourceDataType:"content"}))}}},tv=function(i,r,a,n){let o=new tx[r.type](i,r,a,n);if(o.id!==i)throw Error(`Expected Source id to be ${i} instead of ${o.id}`);return e.aY(["load","abort","unload","serialize","prepare"],o),o};function tb(e,i){let r=e.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}class tw extends ty{constructor(e,i,r,a,n){super(e,i,r,a,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i,{useMipmap:!1,premultiply:!1}):this.texture=new e.T(a,i,n.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(i=16384,r){let a=this._mrt=new e.aZ(30),n=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=e.a_(n,(e,n,o,s)=>{if(e)r(e);else try{let e=a.getHeaderLength(n);if(e>i)return void(this.request=this.fetchHeader(e,r));a.parseHeader(n),this._isHeaderLoaded=!0;let l=0;for(let e of Object.values(a.layers))l=Math.max(l,e.dataIndex[e.dataIndex.length-1].last_byte);n.byteLength>=l&&(this.entireBuffer=n),r(null,this.entireBuffer||n,o,s)}catch(e){r(e)}}),this.request}fetchBand(i,r,a){let n;let o=this._mrt;if(!this._isHeaderLoaded||!o)return void a(Error("Tile header is not ready"));let s=this.actor;if(!s)return void a(Error("Can't fetch tile band without an actor"));let l=(e,o)=>{n.complete(e,o),e?a(e):(this.updateTextureDescriptor(i,r),a(null,this.textureDescriptor&&this.textureDescriptor.img))},h=(e,i)=>{if(e)return a(e);let r=s.send("decodeRasterArray",{buffer:i,task:n},l,void 0,!0);this._workQueue.push(()=>{r&&r.cancel(),n.cancel()})},u=o.getLayer(i);if(!u)return void a(Error(`Unknown sourceLayer "${i}"`));if(u.hasDataForBand(r))return this.updateTextureDescriptor(i,r),void a(null,this.textureDescriptor?this.textureDescriptor.img:null);let c=u.getDataRange([r]);if((n=o.createDecodingTask(c))&&!n.tasks.length)a(null);else if(this.flushQueues(),this.entireBuffer)h(null,this.entireBuffer.slice(c.firstByte,c.lastByte+1));else{let i=Object.assign({},this.requestParams,{headers:{Range:`bytes=${c.firstByte}-${c.lastByte}`}}),r=e.a_(i,h);this._fetchQueue.push(()=>{r.cancel(),n.cancel()})}}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(i,r){if(!this._mrt)return;let a=this._mrt.getLayer(i);if(!a||!a.hasBand(r)||!a.hasDataForBand(r))return;let{bytes:n,tileSize:o,buffer:s,offset:l,scale:h}=a.getBandView(r),u=o+2*s,c={data:n,width:u,height:u},d=this.texture;d&&d instanceof e.T&&d.update(c,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:i,band:r,img:c,buffer:s,offset:l,tileSize:o,format:a.pixelFormat,mix:[h,256*h,65536*h,16777216*h]}}}class tT{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(let e in this.data)for(let i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,r){let a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){let i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;let r=e.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let i=[];for(let r in this.data)for(let a of this.data[r])e(a.value)||i.push(a);for(let e of i)this.remove(e.value.tileID,e)}}class tM extends e.E{constructor(e,i,r){super(),this.id=e,this._onlySymbols=r,i.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new tT(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new b,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles){let i=this._tiles[e];if("errored"!==i.state&&("loaded"!==i.state||!i.bucketsLoaded()))return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,()=>{})}serialize(){return this._source.serialize()}prepare(e){for(let i in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let r=this._tiles[i];r.upload(e),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return e.a$(this._tiles).map(e=>e.tileID).sort(tE).map(e=>e.key)}getRenderableIds(i,r){let a=[];for(let e in this._tiles)this._isIdRenderable(+e,i,r)&&a.push(this._tiles[e]);return i?a.sort((i,r)=>{let a=i.tileID,n=r.tileID,o=new e.P(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x}).map(e=>e.tileID.key):a.map(e=>e.tileID).sort(tE).map(e=>e.key)}hasRenderableParent(e){let i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(r||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}_reloadTile(e,i){let r=this._tiles[e];r&&("loading"!==r.state&&(r.state=i),this._loadTile(r,this._tileLoaded.bind(this,r,e,i)))}_tileLoaded(i,r,a,n){if(n){if(i.state="errored",404!==n.status)this._source.fire(new e.a(n,{tile:i}));else{if(!(i.tileID.key in this._loadedParentTiles))return void this._source.fire(new e.b("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id}));if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}}else i.timeAdded=e.f.now(),"expired"===a&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new e.b("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(e){let i=this.getRenderableIds();for(let a=0;a<i.length;a++){let n=i[a];if(e.neighboringTiles&&e.neighboringTiles[n]){let i=this.getTileByID(n);r(e,i),r(i,e)}}function r(e,i){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let r=i.tileID.canonical.x-e.tileID.canonical.x,a=i.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=i.tileID.key;0===r&&0===a||Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),i.dem&&e.dem&&(e.dem.backfillBorder(i.dem,r,a),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}
8getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,r,a){for(let n in this._tiles){let o=this._tiles[n];if(a[n]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let e=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[e.key])&&o.hasData()&&(s=e)}let l=s;for(;l.overscaledZ>i;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){a[s.key]=s;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=e.overscaledZ-1;r>=i;r--){let i=e.scaledTo(r),a=this._getLoadedTile(i);if(a)return a}}_getLoadedTile(e){let i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;let r=Math.floor((Math.ceil(e.width/i)+1)*(Math.ceil(e.height/i)+1)*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(n)}handleWrapJump(e){let i=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,i){let e={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+i),e[a.tileID.key]=a}for(let i in this._tiles=e,this._timers)clearTimeout(this._timers[i]),delete this._timers[i];for(let e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(i,r,a,n){let o;if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!a)return;if(this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain){if(this._source.tileID)o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new e.am(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y));else if(0!==this.tileCoverLift){let n=i.clone();n.tileCoverLift=this.tileCoverLift,o=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.minzoom<=1&&"globe"===i.projection.name&&(o.push(new e.am(1,0,1,0,0)),o.push(new e.am(1,0,1,1,0)),o.push(new e.am(1,0,1,0,1)),o.push(new e.am(1,0,1,1,1)))}else o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(o=o.filter(e=>this._source.hasTile(e)))}else o=[];if(o.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!tS(this._source.type)){let e=Math.min(i.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!a}),this._source.maxzoom);for(let r of i.extendTileCoverForShadows(o,n,e))this._shadowCasterTiles[r.key]=!0,o.push(r)}let s=this._updateRetainedTiles(o);if(tS(this._source.type)&&0!==o.length){let i={},r={};for(let a of Object.keys(s)){let n=s[a],o=this._tiles[a];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.f.now())continue;let l=this.findLoadedParent(n,Math.max(n.overscaledZ-tM.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),i[l.tileID.key]=l.tileID),r[a]=n}let a=o[o.length-1].overscaledZ;for(let e in this._tiles){let i=this._tiles[e];if(s[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>a;){n=n.scaledTo(n.overscaledZ-1);let a=this._tiles[n.key];if(a&&a.hasData()&&r[n.key]){s[e]=i.tileID;break}}}for(let e in i)s[e]||(this._coveredTiles[e]=!0,s[e]=i[e])}for(let e in s)this._tiles[e].clearFadeHold();for(let i of e.b0(this._tiles,s)){let e=this._tiles[i];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){let i={};if(0===e.length)return i;let r={},a=e.reduce((e,i)=>
8Math.min(e,i.overscaledZ),1/0),n=e[0].overscaledZ,o=Math.max(n-tM.maxOverzooming,this._source.minzoom),s=Math.max(n+tM.maxUnderzooming,this._source.minzoom),l={};for(let r of e){let e=this._addTile(r);i[r.key]=r,e.hasData()||a<this._source.maxzoom&&(l[r.key]=r)}for(let n of(this._retainLoadedChildren(l,a,s,i),e)){let e=this._tiles[n.key];if(e.hasData())continue;if(n.canonical.z>=this._source.maxzoom){let e=n.children(this._source.maxzoom)[0],r=this.getTile(e);if(r&&r.hasData()){i[e.key]=e;continue}}else{let e=n.children(this._source.maxzoom);if(i[e[0].key]&&i[e[1].key]&&i[e[2].key]&&i[e[3].key])continue}let a=e.wasRequested();for(let s=n.overscaledZ-1;s>=o;--s){let o=n.scaledTo(s);if(r[o.key]||(r[o.key]=!0,(e=this.getTile(o))||!a||(e=this._addTile(o)),e&&(i[o.key]=o,a=e.wasRequested(),e.hasData())))break}}return i}_updateLoadedParentTileCache(){for(let e in this._loadedParentTiles={},this._tiles){let i=[],r,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){r=this._loadedParentTiles[a.key];break}i.push(a.key);let e=a.scaledTo(a.overscaledZ-1);if(r=this._getLoadedTile(e))break;a=e}for(let e of i)this._loadedParentTiles[e]=r}}_addTile(i){let r=this._tiles[i.key];if(r)return!0!==r.isExtraShadowCaster||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let a=!!r;if(!a){let e=this.map?this.map.painter:null,a=this._source.tileSize*i.overscaleFactor();r="raster-array"===this._source.type?new tw(i,a,this.transform.tileZoom,e,this._isRaster):new ty(i,a,this.transform.tileZoom,e,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,a||this._source.fire(new e.b("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=i.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_removeTile(e){let i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&"reloading"!==i.state||"empty"===i.state?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){for(let e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(i,r,a){let n=[],o=this.transform;if(!o)return n;let s="globe"===o.projection.name,l=e.a5(o.center.lng);for(let h in this._tiles){let u;let c=this._tiles[h];if(a&&c.clearQueryDebugViz(),!c.holdingForFade()){if(s){let i=c.tileID.canonical;if(0===i.z){let r=[Math.abs(e.aa(l,...tA(i,-1))-l),Math.abs(e.aa(l,...tA(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(e.aa(l,...tA(i,-1))-l),Math.abs(e.aa(l,...tA(i,0))-l),Math.abs(e.aa(l,...tA(i,1))-l)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(let e of u){let a=i.containsTile(c,o,r,e);a&&n.push(a)}}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){let r=this.getRenderableIds(e,i).map(e=>this._tiles[e].tileID),a="globe"===this.transform.projection.name;for(let e of r)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=a?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return r}sortCoordinatesByDistance(e){let i=e.slice(),r=this.transform._camera.position,a=this.transform._camera.forward(),n={};for(let e of i){let i=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*i+e.wrap-r[0])*a[0]+((e.canonical.y+.5)*i-r[1])*a[1]-r[2]*a[2]}return i.sort((e,i)=>n[e.key]-n[i.key]),i}hasTransition(){if(this._source.hasTransition())return!0;
8if(tS(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=e.f.now())return!0}return!1}setFeatureState(e,i,r){this._state.updateState(e=e||"_geojsonTileLayer",i,r)}removeFeatureState(e,i,r){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,r)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,r){let a=this._tiles[e];a&&a.setDependencies(i,r)}reloadTilesForDependencies(e,i){for(let r in this._tiles)this._tiles[r].hasDependency(e,i)&&this._reloadTile(+r,"reloading");this._cache.filter(r=>!r.hasDependency(e,i))}_preloadTiles(i,r){if(!this._sourceLoaded){let e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(i,r))};return void this._source.on("data",e)}let a=new Map,n=Array.isArray(i)?i:[i],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(let e of n){for(let i of e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))a.set(i.key,i);this.usedForTerrain&&e.updateElevation(!1)}let l=Array.from(a.values());e.b1(l,(e,i)=>{let r=new ty(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,e=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),i(e,r)})},r)}}function tE(e,i){let r=Math.abs(2*e.wrap)-+(e.wrap<0),a=Math.abs(2*i.wrap)-+(i.wrap<0);return e.overscaledZ-i.overscaledZ||a-r||i.canonical.y-e.canonical.y||i.canonical.x-e.canonical.x}function tS(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function tA(e,i){let r=1<<e.z;return[e.x/r+i,(e.x+1)/r+i]}tM.maxOverzooming=10,tM.maxUnderzooming=3;class tI{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let e in this.layers=[],this.style._mergedLayers){let i=this.style._mergedLayers[e];if("fill-extrusion"===i.type)this.layers.push({layer:i,visible:!1,visibilityChanged:!1});else if("model"===i.type){let e=this.style.getLayerSource(i);e&&"batched-model"===e.type&&this.layers.push({layer:i,visible:!1,visibilityChanged:!1})}}}onNewFrame(e){for(let i of(this.layersGotHidden=!1,this.layers)){let r=i.layer,a=!1;"fill-extrusion"===r.type?a=!r.isHidden(e)&&r.paint.get("fill-extrusion-opacity")>0:"model"===r.type&&(a=!r.isHidden(e)&&r.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!a&&i.visible,i.visible=a}}updateZOffset(e,i){for(let e of(this.currentBuildingBuckets=[],this.layers)){let r=e.layer,a=this.style.getLayerSourceCache(r),n=1;"fill-extrusion"===r.type&&(n=e.visible?r.paint.get("fill-extrusion-vertical-scale"):0);let o=a?a.getTile(i):null;if(!o&&a&&i.canonical.z>a.getSource().minzoom){let e=i.scaledTo(Math.min(a.getSource().maxzoom,i.overscaledZ-1));for(;e.overscaledZ>=a.getSource().minzoom&&!(o=a.getTile(e))&&0!==e.overscaledZ;)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(r):null,tileID:o?o.tileID:i,verticalScale:n})}e.hasAnyZOffset=!1;let r=!1;for(let a=0;a<e.symbolInstances.length;a++){let n=e.symbolInstances.get(a),o=n.zOffset,s=this._getHeightAtTileOffset(i,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==Number.NEGATIVE_INFINITY?s:o,r||o===n.zOffset||(r=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}r&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,r,a,n){let o=r,s=a;if(i.canonical.z!==n.canonical.z){let l=n.canonical,h=1/(1<<i.canonical.z-l.z);o=(r+i.canonical.x*e.V)*h-l.x*e.V|0,s=(a+i.canonical.y*e.V)*h-l.y*e.V|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,i,r){let a,n;for(let o=0;o<this.layers.length;++o){if("fill-extrusion"!==this.layers[o].layer.type)continue;let{bucket:s,tileID:l,verticalScale:h}=this.currentBuildingBuckets[o];if(!s)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(e,i,r,l),d=s.getHeightAtTileCoord(u,c);d&&void 0!==d.height&&(d.hidden?a=d.height:n=Math.max(d.height*h,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){let o=this.layers[n];if("model"!==o.layer.type||!o.visible)continue;let{bucket:s,tileID:l}=this.currentBuildingBuckets[n];if(!s)continue;let{tileX:h,tileY:u}=this._mapCoordToOverlappingTile(e,i,r,l),c=s.getHeightAtTileCoord(h,u);if(c&&!c.hidden)return void 0===c.height&&void 0!==a?Math.min(c.maxHeight,a)*c.verticalScale:(c.height||0)*c.verticalScale}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function tC(i){i=i.slice();let r=Object.create(null);for(let e=0;e<i.length;e++)r[i[e].id]=i[e];for(let a=0;a<i.length;a++)"ref"in i[a]&&(i[a]=function(i,r){let a={};for(let e in i)"ref"!==e&&(a[e]=i[e]);
8return e.b2.forEach(e=>{e in r&&(a[e]=r[e])}),a}(i[a],r[i[a].ref]));return i}let tP={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",updateImport:"updateImport"};function tz(e,i,r){r.push({command:tP.addSource,args:[e,i[e]]})}function tD(e,i,r){i.push({command:tP.removeSource,args:[e]}),r[e]=!0}function tL(e,i,r,n,o,s){let l;for(l in i=i||{},e=e||{})e.hasOwnProperty(l)&&(a(e[l],i[l])||r.push({command:s,args:[n,l,i[l],o]}));for(l in i)i.hasOwnProperty(l)&&!e.hasOwnProperty(l)&&(a(e[l],i[l])||r.push({command:s,args:[n,l,i[l],o]}))}function tR(e){return e.id}function tk(e,i){return e[i.id]=i,e}class tO{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(1===this.points.length)return this.points[0];i=e.aa(i,0,1);let r=1,a=this._distances[r],n=i*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let o=r-1,s=this._distances[o],l=a-s,h=l>0?(n-s)/l:0;return this.points[o].mult(1-h).add(this.points[r].mult(h))}}class tB{constructor(e,i,r){let a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(i/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(e,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(e,i,r,a,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,i,r,a,n,o){this.circleCells[n].push(o)}_query(e,i,r,a,n,o){if(r<0||e>this.width||a<0||i>this.height)return!n&&[];let s=[];if(e<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let i=this.circles[3*e],r=this.circles[3*e+1],a=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}return o?s.filter(o):s}return this._forEachCell(e,i,r,a,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,i,r,a,n){let o=e-r,s=e+r,l=i-r,h=i+r;if(s<0||o>this.width||h<0||l>this.height)return!a&&[];let u=[];return this._forEachCell(o,l,s,h,this._queryCellCircle,u,{hitTest:a,circle:{x:e,y:i,radius:r},seenUids:{box:{},circle:{}}},n),a?u.length>0:u}query(e,i,r,a,n){return this._query(e,i,r,a,!1,n)}hitTest(e,i,r,a,n){return this._query(e,i,r,a,!0,n)}hitTestCircle(e,i,r,a){return this._queryCircle(e,i,r,!0,a)}_queryCell(e,i,r,a,n,o,s,l){let h=s.seenUids,u=this.boxCells[n];if(null!==u){let n=this.bboxes;for(let c of u)if(!h.box[c]){h.box[c]=!0;let u=4*c;if(e<=n[u+2]&&i<=n[u+3]&&r>=n[u+0]&&a>=n[u+1]&&(!l||l(this.boxKeys[c]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[c],x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]})}}}let c=this.circleCells[n];if(null!==c){let n=this.circles;for(let u of c)if(!h.circle[u]){h.circle[u]=!0;let c=3*u;if(this._circleAndRectCollide(n[c],n[c+1],n[c+2],e,i,r,a)&&(!l||l(this.circleKeys[u]))){if(s.hitTest)return o.push(!0),!0;{let e=n[c],i=n[c+1],r=n[c+2];o.push({key:this.circleKeys[u],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}}}}_queryCellCircle(e,i,r,a,n,o,s,l){let h=s.circle,u=s.seenUids,c=this.boxCells[n];if(null!==c){let e=this.bboxes;for(let i of c)if(!u.box[i]){u.box[i]=!0;let r=4*i;
8if(this._circleAndRectCollide(h.x,h.y,h.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!l||l(this.boxKeys[i])))return o.push(!0),!0}}let d=this.circleCells[n];if(null!==d){let e=this.circles;for(let i of d)if(!u.circle[i]){u.circle[i]=!0;let r=3*i;if(this._circlesCollide(e[r],e[r+1],e[r+2],h.x,h.y,h.radius)&&(!l||l(this.circleKeys[i])))return o.push(!0),!0}}}_forEachCell(e,i,r,a,n,o,s,l){let h=this._convertToXCellCoord(e),u=this._convertToYCellCoord(i),c=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++)if(n.call(this,e,i,r,a,this.xCellCount*h+p,o,s,l))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,r,a,n,o){let s=a-e,l=n-i,h=r+o;return h*h>s*s+l*l}_circleAndRectCollide(e,i,r,a,n,o,s){let l=(o-a)/2,h=Math.abs(e-(a+l));if(h>l+r)return!1;let u=(s-n)/2,c=Math.abs(i-(n+u));if(c>u+r)return!1;if(h<=l||c<=u)return!0;let d=h-l,p=c-u;return d*d+p*p<=r*r}}let tF={unknown:0,flipRequired:1,flipNotRequired:2},tN=Math.tan(85*Math.PI/180);function tV(i,r,a,n,o,s,l){let h=e.a6.create();if(a){if("globe"===s.name){let i=e.b3(o,r);e.a6.multiply(h,h,i)}else{let i=e.b4.invert([],l);h[0]=i[0],h[1]=i[1],h[4]=i[2],h[5]=i[3],n||e.a6.rotateZ(h,h,o.angle)}}else e.a6.multiply(h,o.labelPlaneMatrix,i);return h}function tU(e,i,r,a,n,o,s){let l=tV(e,i,r,a,n,o,s);return"globe"===o.name&&r||(l[2]=l[6]=l[10]=l[14]=0),l}function tj(i,r,a,n,o,s,l){if(a){if("globe"===s.name){let h=tV(i,r,a,n,o,s,l);return e.a6.invert(h,h),e.a6.multiply(h,i,h),h}{let r=e.a6.clone(i),a=e.a6.identity([]);return a[0]=l[0],a[1]=l[1],a[4]=l[2],a[5]=l[3],e.a6.multiply(r,r,a),n||e.a6.rotateZ(r,r,-o.angle),r}}return o.glCoordMatrix}function tG(i,r,a,n){let o=[i,r,a,1];a?e.a7.transformMat4(o,o,n):tQ(o,o,n);let s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function tZ(e,i){return Math.min(.5+e/i*.5,1.5)}function tq(i,r,a,n,o,s,l,h,u,c){let d=a.transform,p=n?i.textSizeData:i.iconSizeData,f=e.b5(p,a.transform.zoom),m="globe"===d.projection.name,_=[256/a.width*2+1,256/a.height*2+1],g=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;g.clear();let y=null;m&&(y=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);let x=i.lineVertexArray,v=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,b=a.transform.width/a.transform.height,w,T=!1;for(let n=0;n<v.length;n++){let m=v.get(n),{numGlyphs:M,writingMode:E}=m;if(E!==e.b6.vertical||T||w===e.b6.horizontal||(T=!0),w=E,(m.hidden||E===e.b6.vertical)&&!T){tJ(M,g);continue}T=!1;let S=new e.P(m.tileAnchorX,m.tileAnchorY),{x:A,y:I,z:C}=d.projection.projectTilePoint(S.x,S.y,c.canonical);if(u){let[e,i,r]=u(S);A+=e,I+=i,C+=r}let P=[A,I,C,1];if(e.a7.transformMat4(P,P,r),!function(e,i){let r=e[0]/e[3],a=e[1]/e[3];return r>=-i[0]&&r<=i[0]&&a>=-i[1]&&a<=i[1]}(P,_)){tJ(M,g);continue}let z=P[3],D=tZ(a.transform.getCameraToCenterDistance(d.projection),z),L=e.b7(p,f,m),R=l?L/D:L*D,k=tG(A,I,C,o);if(k[3]<=0){tJ(M,g);continue}let O={},B=l?null:u,F=tH(m,R,!1,h,r,o,s,i.glyphOffsetArray,x,g,y,k,S,O,b,B,d.projection,c,l);T=F.useVertical,B&&F.needsFlipping&&(O={}),(F.notEnoughRoom||T||F.needsFlipping&&tH(m,R,!0,h,r,o,s,i.glyphOffsetArray,x,g,y,k,S,O,b,B,d.projection,c,l).notEnoughRoom)&&tJ(M,g)}n?(i.text.dynamicLayoutVertexBuffer.updateData(g),y&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(y)):(i.icon.dynamicLayoutVertexBuffer.updateData(g),y&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(y))}function t$(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let{lineStartIndex:g,glyphStartIndex:y,segment:x}=l,v=y+l.numGlyphs,b=g+l.lineLength,w=i.getoffsetX(y),T=i.getoffsetX(v-1),M=tK(e*w,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);if(!M)return null;let E=tK(e*T,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);return E?{first:M,last:E}:null}function tW(i,r,a,n){return i===e.b6.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===e.b6.vertical?n>0?{needsFlipping:!0}:null:r!==tF.unknown&&(0===a||Math.abs(n/a)>tN)?r===tF.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function tH(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=r/24,w=i.lineOffsetX*b,T=i.lineOffsetY*b,{lineStartIndex:M,glyphStartIndex:E,numGlyphs:S,segment:A,writingMode:I,flipState:C}=i,P=M+i.lineLength,z=i=>{if(d){let[r,a,n]=i.up,o=c.length;e.b8(d,o+0,r,a,n),e.b8(d,o+1,r,a,n),e.b8(d,o+2,r,a,n),e.b8(d,o+3,r,a,n)}let[r,a,n]=i.point;e.b9(c,r,a,n,i.angle)};if(S>1){let e=t$(b,h,w,T,a,p,f,i,u,s,m,g,!1,y,x,v);if(!e)return{notEnoughRoom:!0};if(n&&!a){let[r,a,n]=e.first.point,[o,s,h]=e.last.point;[r,a]=tG(r,a,n,l),[o,s]=tG(o,s,h,l);let u=tW(I,C,(o-r)*_,s-a);if(i.flipState=u&&u.needsFlipping?tF.flipRequired:tF.flipNotRequired,u)return u}z(e.first);for(let e=E+1;e<E+S-1;e++){let i=tK(b*h.getoffsetX(e),w,T,a,p,f,A,M,P,u,s,m,g,!1,!1,y,x,v);if(!i)return c.length-=4*(e-E),{notEnoughRoom:!0};z(i)}z(e.last)}else{if(n&&!a){let r=tG(f.x,f.y,0,o),a=M+A+1,n=new e.P(u.getx(a),u.gety(a)),s=tG(n.x,n.y,0,o),l=s[3]>0?s:tY(f,n,r,1,o,void 0,y,x.canonical),h=tW(I,C,(l[0]-r[0])*_,l[1]-r[1]);if(i.flipState=h&&h.needsFlipping?tF.flipRequired:tF.flipNotRequired,h)return h}let r=tK(b*h.getoffsetX(E),w,T,a,p,f,A,M,P,u,s,m,g,!1,!1,y,x,v);if(!r)return{notEnoughRoom:!0};z(r)}return{}}function tX(e,i,r,a,n){let{x:o,y:s,z:l}=a.projectTilePoint(e.x,e.y,i);if(!n)return tG(o,s,l,r);let[h,u,c]=n(e);return tG(o+h,s+u,l+c,r)}function tY(i,r,a,n,o,s,l,h){let u=tX(i.sub(r)._unit()._add(i),h,o,l,s);return e.N.sub(u,a,u),e.N.normalize(u,u),e.N.scaleAndAdd(u,a,u,n)}function tK(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=n?i-r:i+r,b=v>0?1:-1,w=0;n&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=h+l+(b>0?0:1)|0,M=o,E=o,S=0,A=0,I=Math.abs(v),C=[],P=[],z=s,D=z,L=()=>tY(D,z,E,I-S+1,d,f,g,y.canonical);for(;S+A<=I;){if((T+=b)<h||T>=u)return null;if(E=M,D=z,C.push(E),m&&P.push(D),z=new e.P(c.getx(T),c.gety(T)),!(M=p[T])){let e=tX(z,y.canonical,d,g,f);M=e[3]>0?p[T]=e:L()}S+=A,A=e.N.distance(E,M)}_&&f&&(p[T]&&(M=L(),A=e.N.distance(E,M)),p[T]=M);let R=(I-S)/A,k=z.sub(D)._mult(R)._add(D),O=e.N.sub([],M,E),B=e.N.scaleAndAdd([],E,O,R),F=[0,0,1],N=O[0],V=O[1];if(x&&(0!==(F=g.upVector(y.canonical,k.x,k.y))[0]||0!==F[1]||1!==F[2])){let i=[F[2],0,-F[0]],r=e.N.cross([],F,i);e.N.normalize(i,i),e.N.normalize(r,r),N=e.N.dot(O,i),V=e.N.dot(O,r)}if(a){let i=e.N.cross([],F,O);e.N.normalize(i,i),e.N.scaleAndAdd(B,B,i,a*b)}let U=w+Math.atan2(V,N);return C.push(B),m&&P.push(k),{point:B,angle:U,path:C,tilePath:P,up:F}}function tJ(e,i){let r=i.length,a=r+4*e;i.resize(a),i.float32.fill(-1/0,4*r,4*a)}function tQ(e,i,r){let a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e[3]=r[3]*a+r[7]*n+r[15],e}class t0{constructor(e,i,r=new tB(e.width+200,e.height+200,25),a=new tB(e.width+200,e.height+200,25)){this.transform=e,this.grid=r,this.ignoredGrid=a,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.he
8ight+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}placeCollisionBox(e,i,r,a,n,o,s,l){let h=r.projectedAnchorX,u=r.projectedAnchorY,c=r.projectedAnchorZ,d=r.elevation,p=r.tileID,f=e.getProjection();if(d&&p){let[e,i,a]=f.upVector(p.canonical,r.tileAnchorX,r.tileAnchorY),n=f.upVectorScale(p.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;h+=e*d*n,u+=i*d*n,c+=a*d*n}let m=this.projectAndGetPerspectiveRatio(s,h,u,c,r.tileID,"globe"===f.name||!!d||this.transform.pitch>0,f),_=o*m.perspectiveRatio,g=(r.x1*i+a.x-r.padding)*_+m.point.x,y=(r.y1*i+a.y-r.padding)*_+m.point.y,x=(r.x2*i+a.x+r.padding)*_+m.point.x,v=(r.y2*i+a.y+r.padding)*_+m.point.y,b=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(g,y,x,v)||!n&&this.grid.hitTest(g,y,x,v,l)||b?{box:[],offscreen:!1,occluded:m.occluded}:{box:[g,y,x,v],offscreen:this.isOffscreen(g,y,x,v),occluded:!1}}placeCollisionCircles(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=[],y=this.transform.elevation,x=i.getProjection(),v=y?y.getAtTileOffsetFunc(_,this.transform.center.lat,this.transform.worldSize,x):null,b=new e.P(a.tileAnchorX,a.tileAnchorY),{x:w,y:T,z:M}=x.projectTilePoint(b.x,b.y,_.canonical);if(v){let[e,i,r]=v(b);w+=e,T+=i,M+=r}let E="globe"===x.name,S=this.projectAndGetPerspectiveRatio(l,w,T,M,_,E||!!y||this.transform.pitch>0,x),{perspectiveRatio:A}=S,I=(d?s/A:s*A)/e.bc,C=tG(w,T,M,h),P=S.signedDistanceFromCamera>0?t$(I,o,a.lineOffsetX*I,a.lineOffsetY*I,!1,C,b,a,n,h,{},y&&!d?v:null,d&&!!y,x,_,d):null,z=!1,D=!1,L=!0;if(P&&!S.occluded){let i=.5*f*A+m,a=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new tO,{first:s,last:l}=P,h=s.path.length,d=[];for(let e=h-1;e>=1;e--)d.push(s.path[e]);for(let e=1;e<l.path.length;e++)d.push(l.path[e]);let _=2.5*i;u&&(d=d.map(([e,i,r],a)=>(v&&!E&&(r=v(a<h-1?s.tilePath[h-1-a]:l.tilePath[a-h+2])[2]),tG(e,i,r,u)))).some(e=>e[3]<=0)&&(d=[]);let y=[];if(d.length>0){let i=1/0,r=-1/0,o=1/0,s=-1/0;for(let e of d)i=Math.min(i,e[0]),o=Math.min(o,e[1]),r=Math.max(r,e[0]),s=Math.max(s,e[1]);r>=a.x&&i<=n.x&&s>=a.y&&o<=n.y&&(y=[d.map(i=>new e.P(i[0],i[1]))],(i<a.x||r>n.x||o<a.y||s>n.y)&&(y=e.ba(y,a.x,a.y,n.x,n.y)))}for(let e of y){o.reset(e,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/_)+1;for(let e=0;e<a;e++){let n=e/Math.max(a-1,1),s=o.lerp(n),l=s.x+100,h=s.y+100;g.push(l,h,i,0);let u=l-i,d=h-i,f=l+i,m=h+i;if(L=L&&this.isOffscreen(u,d,f,m),D=D||this.isInsideGrid(u,d,f,m),!r&&this.grid.hitTestCircle(l,h,i,p)&&(z=!0,!c))return{circles:[],offscreen:!1,collisionDetected:z,occluded:!1}}}}return{circles:(c||!z)&&D?g:[],offscreen:L,collisionDetected:z,occluded:S.occluded}}queryRenderedSymbols(i){if(0===i.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=1/0,n=1/0,o=-1/0,s=-1/0;for(let l of i){let i=new e.P(l.x+100,l.y+100);a=Math.min(a,i.x),n=Math.min(n,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y),r.push(i)}let l=this.grid.query(a,n,o,s).concat(this.ignoredGrid.query(a,n,o,s)),h={},u={};for(let i of l){let a=i.key;if(void 0===h[a.bucketInstanceId]&&(h[a.bucketInstanceId]={}),h[a.bucketInstanceId][a.featureIndex])continue;let n=[new e.P(i.x1,i.y1),new e.P(i.x2,i.y1),new e.P(i.x2,i.y2),new e.P(i.x1,i.y2)];e.bb(r,n)&&(h[a.bucketInstanceId][a.featureIndex]=!0,void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]=[]),u[a.bucketInstanceId].push(a.featureIndex))}return u}insertCollisionBox(e,i,r,a,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,r,a,n){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,collisionGroupID:n};for(let i=0;i<e.length;i+=4)o.insertCircle(s,e[i],e[i+1],e[i+2])}projectAndGetPerspectiveRatio(i,r,a,n,o,s,l){let h=[r,a,n,1],u=!1;n||this.transform.pitch>0?(e.a7.transformMat4(h,h,i),this.fogState&&o&&"globe"!==l.name&&(u=function(i,r,a,n,o,s){let l=s.calculateFogTileMatrix(o),h=[r,a,n];return e.N.transformMat4(h,h,l),ec(i,e.N.length(h),s.pitch,s._fov)}(this.fogState,r,a,n,o.toUnwrapped(),this.transform)>.9)):tQ(h,h,i);let c=h[3];return{point:new e.P((h[0]/c+1)/2*this.transform.width+100,(-h[1]/c+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(l)/c*.5,1.5),signedDistanceFromCamera:c,occluded:s&&h[2]>c||u}}isOffscreen(e,i,r,a){return r<100||e>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(e,i,r,a){return r>=0&&e<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let i=e.a6.identity([]);return e.a6.translate(i,i,[-100,-100,0]),i}}function t1(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return e.a6.multiply(new Float32Array(16),i.projMatrix,n)}function t2(e,i,r){return i.name===r.projection.name?e.projMatrix:t1(r,i,e)}class t3{constructor(e,i,r,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class t5{constructor(e,i,r,a,n,o=!1){this.text=new t3(e?e.text:null,i,r,n),this.icon=new t3(e?e.icon:null,i,a,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class t4{constructor(e,i,r,a=!1){this.text=e,this.icon=i,this.skipFade=r,this.clipped=a}}class t6{constructor(){this.invProjMatrix=e.a6.create(),this.viewportMatrix=e.a6.create(),this.circles=[]}}class t8{constructor(e,i,r,a,n){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class t9{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:e=>e.collisionGroupID===i}}return this.collisionGroups[e]}}function t7(i,r,a,n,o){let{horizontalAlign:s,verticalAlign:l}=e.bf(i),h=e.bd(i,n);return new e.P(-(s-.5)*r+h[0]*o,-(l-.5)*a+h[1]*o)}function ie(i,r,a,n,o){let s=new e.P(i,r);return a&&s._rotate(n?o:-o),s}class it{constructor(e,i,r,a,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new t0(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new t9(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,r,a,n){var o,s,l;let h=a.getBucket(r),u=a.latestFeatureIndex;if(!h||!u||r.fqid!==h.layerIds[0])return;let c=h.layers[0].layout,d=a.collisionBoxArray,p=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ
8),f=a.tileSize/e.V,m=a.tileID.toUnwrapped();this.transform.setProjection(h.projection);let _=(o=a.tileID,s=h.getProjection(),l=this.transform,s.name===this.projection?l.calculateProjMatrix(o.toUnwrapped()):t1(l,s,o)),g="map"===c.get("text-pitch-alignment"),y="map"===c.get("text-rotation-alignment");r.compileFilter();let x=r.dynamicFilter(),v=r.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(a),w=tU(_,a.tileID.canonical,g,y,this.transform,h.getProjection(),b),T=null;if(g){let i=tj(_,a.tileID.canonical,g,y,this.transform,h.getProjection(),b);T=e.a6.multiply([],this.transform.labelPlaneMatrix,i)}let M=null;x&&a.latestFeatureIndex&&(M={unwrappedTileID:m,dynamicFilter:x,dynamicFilterNeedsFeature:v,featureIndex:a.latestFeatureIndex}),this.retainedQueryData[h.bucketInstanceId]=new t8(h.bucketInstanceId,u,h.sourceLayerIndex,h.index,a.tileID);let E={bucket:h,layout:c,posMatrix:_,textLabelPlaneMatrix:w,labelToScreenMatrix:T,clippingData:M,scale:p,textPixelRatio:f,holdingForFade:a.holdingForFade(),collisionBoxArray:d,partiallyEvaluatedTextSize:e.b5(h.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.b5(h.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(n)for(let e of h.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=e;i.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:E})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:E})}attemptAnchorPlacement(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let{textOffset0:x,textOffset1:v,crossTileID:b}=d,w=[x,v],T=t7(e,r,a,w,n),M=this.collisionIndex.placeCollisionBox(f,n,i,ie(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate);if(_){let e=f.getSymbolInstanceIconSize(y,this.transform.zoom,d.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(f,e,_,ie(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate).box.length)return}if(M.box.length>0){let i;return this.prevPlacement&&this.prevPlacement.variableOffsets[b]&&this.prevPlacement.placements[b]&&this.prevPlacement.placements[b].text&&(i=this.prevPlacement.variableOffsets[b].anchor),this.variableOffsets[b]={textOffset:w,width:r,height:a,anchor:e,textScale:n,prevAnchor:i},this.markUsedJustification(f,e,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[b]=m),{shift:T,placedGlyphBoxes:M}}}placeLayerBucketPart(i,r,a,n){let{bucket:o,layout:s,posMatrix:l,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:c,textPixelRatio:d,holdingForFade:p,collisionBoxArray:f,partiallyEvaluatedTextSize:m,partiallyEvaluatedIconSize:_,collisionGroup:g}=i.parameters,y=s.get("text-optional"),x=s.get("icon-optional"),v=s.get("text-allow-overlap"),b=s.get("icon-allow-overlap"),w="map"===s.get("text-rotation-alignment"),T="map"===s.get("text-pitch-alignment"),M="viewport-y"===s.get("symbol-z-order"),E=s.get("symbol-z-elevate");this.transform.setProjection(o.projection);let S=v&&(b||!o.hasIconData()||x),A=b&&(v||!o.hasTextData()||y);!o.collisionArrays&&f&&o.deserializeCollisionBoxes(f),a&&n&&o.updateCollisionDebugBuffers(this.transform.zoom,f);let I=(i,n,f)=>{let{crossTileID:M,numVerticalGlyphVertices:E}=i;if(c){let a={zoom:this.transform.zoom,pitch:this.transform.pitch},n=null;if(c.dynamicFilterNeedsFeature){let e=this.retainedQueryData[o.bucketInstanceId];n=c.featureIndex.loadFeature({featureIndex:i.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
8ourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,c.dynamicFilter)(a,n,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.P(i.tileAnchorX,i.tileAnchorY),this.transform.calculateDistanceTileData(c.unwrappedTileID)))return this.placements[M]=new t4(!1,!1,!1,!0),void r.add(M)}if(r.has(M))return;if(p)return void(this.placements[M]=new t4(!1,!1,!1));let I=!1,C=!1,P=!0,z=!1,D=!1,L=null,R={box:null,offscreen:null,occluded:null},k={box:null,offscreen:null,occluded:null},O=null,B=null,F=null,N=0,V=0,U=0;f.textFeatureIndex?N=f.textFeatureIndex:i.useRuntimeCollisionCircles&&(N=i.featureIndex),f.verticalTextFeatureIndex&&(V=f.verticalTextFeatureIndex);let j=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;let r=this.transform.elevation;e.elevation=i.zOffset+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},G=f.textBox;if(G){j(G);let r=r=>{let a=e.b6.horizontal;if(o.allowVerticalPlacement&&!r&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[M];e&&(this.placedOrientations[M]=e,a=e,this.markUsedOrientation(o,a,i))}return a},a=(i,r)=>{if(o.allowVerticalPlacement&&E>0&&f.verticalTextBox){for(let a of o.writingModes)if(a===e.b6.vertical?k=R=r():R=i(),R&&R.box&&R.box.length)break}else R=i()};if(s.get("text-variable-anchor")){let h=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[M]){let e=this.prevPlacement.variableOffsets[M];h.indexOf(e.anchor)>0&&(h=h.filter(i=>i!==e.anchor)).unshift(e.anchor)}let u=(e,r,a)=>{let s=o.getSymbolInstanceTextSize(m,i,this.transform.zoom,n),u=(e.x2-e.x1)*s+2*e.padding,c=(e.y2-e.y1)*s+2*e.padding,p=i.hasIconTextFit&&!b?r:null;p&&j(p);let f={box:[],offscreen:!1,occluded:!1},y=v?2*h.length:h.length;for(let r=0;r<y;++r){let y=this.attemptAnchorPlacement(h[r%h.length],e,u,c,s,w,T,d,l,g,r>=h.length,i,n,o,a,p,m,_);if(y&&(f=y.placedGlyphBoxes)&&f.box&&f.box.length){I=!0,L=y.shift;break}}return f};a(()=>u(G,f.iconBox,e.b6.horizontal),()=>{let i=f.verticalTextBox;return i&&j(i),o.allowVerticalPlacement&&!(R&&R.box&&R.box.length)&&E>0&&i?u(i,f.verticalIconBox,e.b6.vertical):{box:null,offscreen:null,occluded:null}}),R&&(I=R.box,P=R.offscreen,z=R.occluded);let c=r(!(!R||!R.box));if(!I&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[M];e&&(this.variableOffsets[M]=e,this.markUsedJustification(o,e.anchor,i,c))}}else{let s=(r,a)=>{let s=o.getSymbolInstanceTextSize(m,i,this.transform.zoom,n),h=this.collisionIndex.placeCollisionBox(o,s,r,new e.P(0,0),v,d,l,g.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(o,a,i),this.placedOrientations[M]=a),h};a(()=>s(G,e.b6.horizontal),()=>{let i=f.verticalTextBox;return o.allowVerticalPlacement&&E>0&&i?(j(i),s(i,e.b6.vertical)):{box:null,offscreen:null,occluded:null}}),r(!!(R&&R.box&&R.box.length))}}if(I=(O=R)&&O.box&&O.box.length>0,P=O&&O.offscreen,z=O&&O.occluded,i.useRuntimeCollisionCircles){let r=o.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex),n=e.b7(o.textSizeData,m,r),c=s.get("text-padding");B=this.collisionIndex.placeCollisionCircles(o,v,r,o.lineVertexArray,o.glyphOffsetArray,n,l,h,u,a,T,g.predicate,i.collisionCircleDiameter*n/e.bc,c,this.retainedQueryData[o.bucketInstanceId].tileID),I=v||B.circles.length>0&&!B.collisionDetected,P=P&&B.offscreen,z=B.occluded}if(f.iconFeatureIndex&&(U=f.iconFeatureIndex),f.iconBox){let r=r=>{j(r);let a=i.hasIconTextFit&&L?ie(L.x,L.y,w,T,this.transform.angle):new e.P(0,0),n=o.getSymbolInstanceIconSize(_,this.transform.zoom,i.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,n,r,a,b,d,l,g.predicate)};C=k&&k.box&&k.box.length&&f.verticalIconBox?(F=r(f.verticalIconBox)).box.length>0:(F=r(f.iconBox)).box.length>0,P=P&&F.offscreen,D=F.occluded}let Z=y||0===i.numHorizontalGlyphVertices&&0===E,q=x||0===i.numIconVertices;if(Z||q?q?Z||(C=C&&I):I=C&&I:C=I=C&&I,I&&O&&O.box&&this.collisionIndex.insertCollisionBox(O.box,s.get("text-ignore-placement"),o.bucketInstanceId,k&&k.box&&V?V:N,g.ID),C&&F&&this.collisionIndex.insertCollisionBox(F.box,s.get("icon-ignore-placement"),o.bucketInstanceId,U,g.ID),B&&(I&&this.collisionIndex.insertCollisionCircles(B.circles,s.get("text-ignore-placement"),o.bucketInstanceId,N,g.ID),a)){let e=o.bucketInstanceId,i=this.collisionCircleArrays[e];void 0===i&&(i=this.collisionCircleArrays[e]=new t6);for(let e=0;e<B.circles.length;e+=4)i.circles.push(B.circles[e+0]),i.circles.push(B.circles[e+1]),i.circles.push(B.circles[e+2]),i.circles.push(B.collisionDetected?1:0)}let $="globe"!==o.projection.name;S=S&&($||!z),A=A&&($||!D),this.placements[M]=new t4(I||S,C||A,P||o.justReloaded),r.add(M)};if(E&&this.buildingIndex&&(this.buildingIndex.updateZOffset(o,this.retainedQueryData[o.bucketInstanceId].tileID),o.updateZOffset()),M){let i=o.getSortedSymbolIndexe
8s(this.transform.angle);for(let e=i.length-1;e>=0;--e){let r=i[e];I(o.symbolInstances.get(r),r,o.collisionArrays[r])}o.hasAnyZOffset&&e.w(`${o.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(o.hasAnyZOffset){let e=o.getSortedIndexesByZOffset();for(let i=0;i<e.length;++i){let r=e[i];I(o.symbolInstances.get(r),r,o.collisionArrays[r])}}else for(let e=i.symbolInstanceStart;e<i.symbolInstanceEnd;e++)I(o.symbolInstances.get(e),e,o.collisionArrays[e]);if(a&&o.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[o.bucketInstanceId];e.a6.invert(i.invProjMatrix,l),i.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}markUsedJustification(i,r,a,n){let{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:h,crossTileID:u}=a,c=e.be(r),d=n===e.b6.vertical?h:"left"===c?o:"center"===c?s:"right"===c?l:-1;o>=0&&(i.text.placedSymbolArray.get(o).crossTileID=d>=0&&o!==d?0:u),s>=0&&(i.text.placedSymbolArray.get(s).crossTileID=d>=0&&s!==d?0:u),l>=0&&(i.text.placedSymbolArray.get(l).crossTileID=d>=0&&l!==d?0:u),h>=0&&(i.text.placedSymbolArray.get(h).crossTileID=d>=0&&h!==d?0:u)}markUsedOrientation(i,r,a){let n=r===e.b6.horizontal||r===e.b6.horizontalOnly?r:0,o=r===e.b6.vertical?r:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u}=a,c=i.text.placedSymbolArray;s>=0&&(c.get(s).placedOrientation=n),l>=0&&(c.get(l).placedOrientation=n),h>=0&&(c.get(h).placedOrientation=n),u>=0&&(c.get(u).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(e):1,n=i?i.opacities:{},o=i?i.variableOffsets:{},s=i?i.placedOrientations:{};for(let e in this.placements){let i=this.placements[e],o=n[e];o?(this.opacities[e]=new t5(o,a,i.text,i.icon,null,i.clipped),r=r||i.text!==o.text.placed||i.icon!==o.icon.placed):(this.opacities[e]=new t5(null,a,i.text,i.icon,i.skipFade,i.clipped),r=r||i.text||i.icon)}for(let e in n){let i=n[e];if(!this.opacities[e]){let n=new t5(i,a,!1,!1);n.isHidden()||(this.opacities[e]=n,r=r||i.text.placed||i.icon.placed)}}for(let e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(let e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){let r=new Set;for(let a of i){let i=a.getBucket(e);i&&a.latestFeatureIndex&&e.fqid===i.layerIds[0]&&(this.updateBucketOpacities(i,r,a.collisionBoxArray),i.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(i,a.tileID),i.updateZOffset()))}}updateBucketOpacities(i,r,a){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();let n=i.layers[0].layout,o=!!i.layers[0].dynamicFilter(),s=new t5(null,0,!1,!1,!0),l=n.get("text-allow-overlap"),h=n.get("icon-allow-overlap"),u=n.get("text-variable-anchor"),c="map"===n.get("text-rotation-alignment"),d="map"===n.get("text-pitch-alignment"),p=new t5(null,0,l&&(h||!i.hasIconData()||n.get("icon-optional")),h&&(l||!i.hasTextData()||n.get("text-optional")),!0);!i.collisionArrays&&a&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(a);let f=(e,i,r)=>{for(let a=0;a<i/4;a++)e.opacityVertexArray.emplaceBack(r)},m=0;for(let a=0;a<i.symbolInstances.length;a++){let n=i.symbolInstances.get(a),{numHorizontalGlyphVertices:l,numVerticalGlyphVertices:h,crossTileID:_,numIconVertices:g}=n,y=r.has(_),x=this.opacities[_];y?x=s:x||(x=p,this.opacities[_]=x),r.add(_);let v=l>0||h>0,b=g>0,w=this.placedOrientations[_],T=w===e.b6.vertical,M=w===e.b6.horizontal||w===e.b6.horizontalOnly;if(!v&&!b||x.isHidden()||m++,v){let e=ir(x.text);f(i.text,l,T?ia:e),f(i.text,h,M?ia:e);let r=x.text.isHidden(),{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:u}=n,c=i.text.placedSymbolArray,d=r||T?1:0;a>=0&&(c.get(a).hidden=d),o>=0&&(c.get(o).hidden=d),s>=0&&(c.get(s).hidden=d),u>=0&&(c.get(u).hidden=r||M?1:0);let p=this.variableOffsets[_];
8p&&this.markUsedJustification(i,p.anchor,n,w);let m=this.placedOrientations[_];m&&(this.markUsedJustification(i,"left",n,m),this.markUsedOrientation(i,m,n))}if(b){let e=ir(x.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=n,o=i.icon.placedSymbolArray,s=x.icon.isHidden()?1:0;r>=0&&(f(i.icon,g,T?ia:e),o.get(r).hidden=s),a>=0&&(f(i.icon,n.numVerticalIconVertices,M?ia:e),o.get(a).hidden=s)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){let r=i.collisionArrays[a];if(r){let a=new e.P(0,0),s=!0;if(r.textBox||r.verticalTextBox){if(u){let e=this.variableOffsets[_];e?(a=t7(e.anchor,e.width,e.height,e.textOffset,e.textScale),c&&a._rotate(d?this.transform.angle:-this.transform.angle)):s=!1}o&&(s=!x.clipped),r.textBox&&ii(i.textCollisionBox.collisionVertexArray,x.text.placed,!s||T,a.x,a.y),r.verticalTextBox&&ii(i.textCollisionBox.collisionVertexArray,x.text.placed,!s||M,a.x,a.y)}let l=s&&!!(!M&&r.verticalIconBox);r.iconBox&&ii(i.iconCollisionBox.collisionVertexArray,x.icon.placed,l,n.hasIconTextFit?a.x:0,n.hasIconTextFit?a.y:0),r.verticalIconBox&&ii(i.iconCollisionBox.collisionVertexArray,x.icon.placed,!l,n.hasIconTextFit?a.x:0,n.hasIconTextFit?a.y:0)}}}if(i.fullyClipped=0===m,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=e.invProjMatrix,i.placementViewportMatrix=e.viewportMatrix,i.collisionCircleArray=e.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function ii(e,i,r,a,n){e.emplaceBack(i?1:0,r?1:0,a||0,n||0),e.emplaceBack(i?1:0,r?1:0,a||0,n||0),e.emplaceBack(i?1:0,r?1:0,a||0,n||0),e.emplaceBack(i?1:0,r?1:0,a||0,n||0)}function ir(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let i=e.placed?1:0,r=Math.floor(127*e.opacity);return 33554432*r+16777216*i+131072*r+65536*i+512*r+256*i+2*r+i}let ia=0;class io{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,i,r,a,n){let o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(o,a,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((e,i)=>e.sortKey-i.sortKey));this._currentPartIndex<o.length;){let e=o[this._currentPartIndex];if(i.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}class is{constructor(e,i,r,a,n,o,s,l,h){this.placement=new it(e,n,o,s,l,h),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(i,r,a,n){let o=e.f.now(),s=()=>{let i=e.f.now()-o;return!this._forceFullPlacement&&i>2};for(;this._currentPlacementIndex>=0;){let o=r[i[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===o.type&&(!o.minzoom||o.minzoom<=l)&&(!o.maxzoom||o.maxzoom>l)){let i=o.layout.get("symbol-z-elevate"),r=this._inProgressLayer=this._inProgressLayer||new io(o),l=e.ag(o.source,o.scope);if(r.continuePlacement(i?n[l]:a[l],this.placement,this._showCollisionBoxes,o,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let il=512/e.V/2;class ih{constructor(i,r,a){this.tileID=i,this.bucketInstanceId=a,this.index=new e.bg(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let n=i.canonical.x*e.V,o=i.canonical.y*e.V;for(let e=0;e<r.length;e++){let{key:i,crossTileID:a,tileAnchorX:s,tileAnchorY:l}=r.get(e),h=Math.floor((n+s)*il),u=Math.floor((o+l)*il);this.index.add(h,u),this.keys.push(i),this.crossTileIDs.push(a)}this.index.finish()}
8findMatches(i,r,a){let n=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),o=il/Math.pow(2,r.canonical.z-this.tileID.canonical.z),s=r.canonical.x*e.V,l=r.canonical.y*e.V;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.crossTileID)continue;let{key:h,tileAnchorX:u,tileAnchorY:c}=r,d=Math.floor((s+u)*o),p=Math.floor((l+c)*o);for(let e of this.index.range(d-n,p-n,d+n,p+n)){let i=this.crossTileIDs[e];if(this.keys[e]===h&&!a.has(i)){a.add(i),r.crossTileID=i;break}}}}}class iu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ic{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let i=Math.round((e-this.lng)/360);if(0!==i)for(let e in this.indexes){let r=this.indexes[e],a={};for(let e in r){let n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[e]=a}this.lng=e}addBucket(e,i,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<i.symbolInstances.length;e++)i.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);let a=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in n){let o=n[r];o.tileID.isChildOf(e)&&o.findMatches(i.symbolInstances,e,a)}else{let o=n[e.scaledTo(Number(r)).key];o&&o.findMatches(i.symbolInstances,e,a)}}for(let e=0;e<i.symbolInstances.length;e++){let n=i.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),a.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ih(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(let r of i.crossTileIDs)this.usedCrossTileIDs[e].delete(r)}removeStaleBuckets(e){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)e[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class id{constructor(){this.layerIndexes={},this.crossTileIDs=new iu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,r,a){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new ic);let o=!1,s={};for(let l of("globe"!==a.name&&n.handleWrapJump(r),i)){let i=l.getBucket(e);i&&e.fqid===i.layerIds[0]&&(i.bucketInstanceId||(i.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(l.tileID,i,this.crossTileIDs)&&(o=!0),s[i.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){let i={};for(let r in e.forEach(e=>{i[e]=!0}),this.layerIndexes)i[r]||delete this.layerIndexes[r]}}class ip{constructor(e=0,i=0,r=0,a=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=r,this.right=a}interpolate(i,r,a){return null!=r.top&&null!=i.top&&(this.top=e.U(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=e.U(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=e.U(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=e.U(i.right,r.right,a)),this}getCenter(i,r){let a=e.aa((this.left+i-this.right)/2,0,i),n=e.aa((this.top+r-this.bottom)/2,0,r);return new e.P(a,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ip(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function im(i,r){let a=e.bk(i,3);e.a6.fromQuat(i,r),e.bm(i,3,a)}function i_(i,r){let a=e.bi.identity([]);return e.bi.rotateZ(a,a,-r),e.bi.rotateX(a,a,-i),a}function ig(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(e.N.length(a)>=1e-15){let i=e.N.normalize([],a);e.N.scale(n,i,e.N.dot(n,i)),r[0]=n[0],r[1]=n[1]}let o=e.N.cross([],r,i);if(1e-15>e.N.len(o))return null;let s=Math.atan2(-o[1],o[0]);return i_(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),s)}class iy{constructor(e,i){this.position=e,this.orientation=i}get position(){return this._position}set position(i){if(i){let r=i instanceof e.L?i:new e.L(i[0],i[1],i[2]);
8this._renderWorldCopies&&(r.x=e.bh(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(i,r){if(this.orientation=null,!this.position)return;let a=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.L.fromLngLat(i)):0,o=e.L.fromLngLat(i,n),s=[o.x-a.x,o.y-a.y,o.z-a.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=ig(s,r)}setPitchBearing(i,r){this.orientation=i_(e.bj(i),e.bj(-r))}}class ix{constructor(i,r){this._transform=e.a6.identity([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new e.L(i[0],i[1],i[2])}get position(){let i=e.bk(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&e.bm(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||e.bi.identity([]),i&&im(this._transform,this._orientation)}getPitchBearing(){let e=this.forward(),i=this.right();return{bearing:Math.atan2(-i[1],i[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,i){this._orientation=i_(e,i),im(this._transform,this._orientation)}forward(){let i=e.bk(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=e.bk(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=e.bk(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return e.a6.invert(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;e.N.scale(n,n,-i);let o=new Float64Array(16);return e.a6.fromScaling(o,[a,a,a]),e.a6.translate(o,o,n),o[10]*=r,o}getWorldToCamera(i,r){let a=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.bi.conjugate(n,this._orientation),e.N.scale(o,o,-i),e.a6.fromQuat(a,n),e.a6.translate(a,a,o),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=r,a[9]*=r,a[10]*=r,a[11]*=r,a}getCameraToClipPerspective(i,r,a,n){let o=new Float64Array(16);return e.a6.perspective(o,i,r,a,n),o}getCameraToClipOrthographic(i,r,a,n,o,s){let l=new Float64Array(16);return e.a6.ortho(l,i,r,a,n,o,s),l}getDistanceToElevation(i,r=!1){let a=0===i?0:e.bl(i,r?e.au(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new ix([...this.position],[...this.orientation])}}let iv=(e,i,r)=>(1-r)*e+r*i,ib=e=>e*e*e*e*e;class iw{constructor(i,r,a,n,o,s,l){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==a?0:a,this._maxPitch=null==n?60:n,this.setProjection(s),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new e.bn(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 ip,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new ix,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){let e=new iw(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
8xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,i=!1){let r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(e||r)&&this._constrainCamera(i),this._calcMatrices()}getProjection(){return e.ac(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=e.bo(this.projectionOptions);let n=!a(r,this.getProjection());return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){let i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.bo({name:"mercator"});let r=i!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bl(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bh(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=e.b4.create(),e.b4.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let r=e.aa(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){let e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=e.bj(i),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){let i=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._setZoom(i),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){let e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,i=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!i||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let r=this._elevation;i||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&r.exaggeration()&&this._centerAltitudeValidForExaggeration!==r.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration():this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=r.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;let i=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),n=0,o=0;for(let s=0;s<r.length;s++){let l=new e.P(r[s][0]*this.width,a+r[s][1]*(this.height-a)),h=i.pointCoordinate(l);if(!h)continue;let u=1/Math.hypot(h[0]-this._camera.position[0],h[1]-this._camera.position[1]);n+=h[3]*u,o+=u}return 0===o?NaN:n/o}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let e=this._seaLevelZoom,i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*i,a=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom);this._setZoom(this._zoomFromMercatorZ(Math.max(a-r,n)))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}computeZoomRelativeTo(i){let r;let a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));r=i.z<this._camera.position[2]?[a.x,a.y,a.z]:[i.x,i.y,i.z];let n=e.N.length(e.N.sub([],this._camera.position,r));return e.aa(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let r=!1;if(i.orientation&&!e.bi.exactEquals(i.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(i.orientation)),i.position){let a=[i.position.x,i.position.y,i.position.z];e.N.exactEquals(a,this._camera.position)||(this._setCameraPosition(a),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let i=this._camera.position,r=new iy;return r.position=new e.L(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){if(!e.bi.length(i))return!1;e.bi.normalize(i,i);let r=e.N.transformQuat([],[0,0,-1],i),a=e.N.transformQuat([],[0,-1,0],i);if(a[2]<0)return!1;let n=ig(r,a);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(i){let r=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;i[2]=e.aa(i[2],n/a,n/r),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,r){this._unmodified=!1,this._edgeInsets.interpolate(e,i,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){return Math.max(0,(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize)))}getVisibleUnwrappedCoordinates(i){let r=[new e.bp(0,i)];if(this.renderWorldCopies){let a=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(0,this.height)),l=Math.floor(Math.min(a.x,n.x,o.x,s.x)),h=Math.floor(Math.max(a.x,n.x,o.x,s.x));for(let a=l-1;a<=h+1;a++)0!==a&&r.push(new e.bp(a,i))}return r}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(i,r,a){let n=[];if(0===r[0]&&0===r[1])return n;for(let a of i){let i=a.canonical,o=a.overscaledZ,s=a.wrap,l=1<<i.z,h=i.x+1<l,u=i.x>0,c=i.y+1<l,d=i.y>0,p=a.wrap-(u?0:1),f=a.wrap+(h?0:1),m=u?i.x-1:l-1,_=h?i.x+1:0;r[0]<0?(n.push(new e.am(o,f,i.z,_,i.y)),r[1]<0&&c&&(n.push(new e.am(o,s,i.z,i.x,i.y+1)),n.push(new e.am(o,f,i.z,_,i.y+1))),r[1]>0&&d&&(n.push(new e.am(o,s,i.z,i.x,i.y-1)),n.push(new e.am(o,f,i.z,_,i.y-1)))):r[0]>0?(n.push(new e.am(o,p,i.z,m,i.y)),r[1]<0&&c&&(n.push(new e.am(o,s,i.z,i.x,i.y+1)),n.push(new e.am(o,p,i.z,m,i.y+1))),r[1]>0&&d&&(n.push(new e.am(o,s,i.z,i.x,i.y-1)),n.push(new e.am(o,p,i.z,m,i.y-1)))):r[1]<0&&c?n.push(new e.am(o,s,i.z,i.x,i.y+1)):d&&n.push(new e.am(o,s,i.z,i.x,i.y-1))}if(n.length>1){n.sort((e,i)=>e.overscaledZ-i.overscaledZ||e.wrap-i.wrap||e.canonical.z-i.canonical.z||e.canonical.x-i.canonical.x||e.canonical.y-i.
8canonical.y);let e=0,i=0;for(;i<n.length;)n[i].equals(n[e])?++i:n[++e]=n[i++];n.length=e+1}let o=[];for(let e of n)n.some(i=>e.isChildOf(i))||o.push(e);return o.filter(e=>!i.some(i=>!!(e.overscaledZ<a&&i.isChildOf(e))||e.equals(i)||e.isChildOf(i)))}coveringTiles(i){let r,a=this.coveringZoomLevel(i),n=a,o=this.elevation&&this.elevation.exaggeration(),s=o&&!i.isTerrainDEM,l="mercator"===this.projection.name;if(void 0!==i.minzoom&&a<i.minzoom)return[];void 0!==i.maxzoom&&a>i.maxzoom&&(a=i.maxzoom);let h=this.locationCoordinate(this.center),u=this.center.lat,c=1<<a,d=[c*h.x,c*h.y,0],p="globe"===this.projection.name,f=!p,m=e.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,f),_=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),g=c*e.bl(1,this.center.lat),y=this._camera.position[2]/e.bl(1,this.center.lat),x=[c*_.x,c*_.y,y*(f?1:g)],v=p||o,b=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),w=this.isLODDisabled(!0)?a:0;if(this._elevation&&i.isTerrainDEM)r=1e4*this._elevation.exaggeration();else if(this._elevation){let e=this._elevation.getMinMaxForVisibleTiles();r=e?e.max:this._centerAltitude}else r=this._centerAltitude;let T=i.isTerrainDEM?-r:this._elevation?this._elevation.getMinElevationBelowMSL():0,M=this.projection.isReprojectedInTileSpace?e.br(this):1,E=i=>{let r=1/4e4,a=new e.L(i.x+r,i.y,i.z),n=new e.L(i.x,i.y+r,i.z),o=i.toLngLat(),s=a.toLngLat(),l=n.toLngLat(),h=this.locationCoordinate(o),u=this.locationCoordinate(s),c=this.locationCoordinate(l);return Math.sqrt(Math.hypot(u.x-h.x,u.y-h.y)*Math.hypot(c.x-h.x,c.y-h.y))*M/r},S=i=>{let a=r;return{aabb:e.bu(this,c,0,0,0,i,T,a,this.projection),zoom:0,x:0,y:0,minZ:T,maxZ:a,wrap:i,fullyVisible:!1}},A=[],I=[],C=a,P=i.reparseOverscaled?n:a,z=e=>e*e,D=z((y-this._centerAltitude)*g),L=e=>{if(!this._elevation||!e.tileID||!l)return;let i=this._elevation.getMinMaxForTile(e.tileID),r=e.aabb;i?(r.min[2]=i.min,r.max[2]=i.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=R(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=this._centerAltitude))},R=i=>{if(i.zoom<w)return!0;if(i.zoom===C)return!1;if(null!=i.shouldSplit)return i.shouldSplit;let r=i.aabb.distanceX(x),a=i.aabb.distanceY(x),o=D,l=1;if(p){o=z(i.aabb.distanceZ(x));let r=Math.pow(2,i.zoom),a=Math.min(Math.max(u,e.au((i.y+1)/r)),e.au(i.y/r)),n=e.bJ(a)/e.bJ(u);if(l=a===u?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=e.bG&&i.zoom===C-1&&n>=.9)return!0}else if(s&&(o=z(i.aabb.distanceZ(x)*g)),this.projection.isReprojectedInTileSpace&&n<=5){let r=Math.pow(2,i.zoom),a=E(new e.L((i.x+.5)/r,(i.y+.5)/r));l=a>.85?1:a}let h=r*r+a*a+o,c=z((1<<C-i.zoom)*b*l*((e,i)=>{if(i*z(.707)<e)return 1;let r=Math.sqrt(i/e);return r/(1.4144271570014144+(Math.pow(1.1,r-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(o,D),h));return h<c};if(this.renderWorldCopies)for(let e=1;e<=3;e++)A.push(S(-e)),A.push(S(e));for(A.push(S(0));A.length>0;){let r=A.pop(),n=r.x,o=r.y,h=r.fullyVisible,u=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!h){let i=v?r.aabb.intersects(m):r.aabb.intersectsFlat(m);if(0===i&&u()){let a=new e.bs(r.zoom,n,o);i=e.bt(this,c,a,!0).intersects(m)}if(0===i)continue;h=2===i}if(r.zoom!==C&&R(r))for(let i=0;i<4;i++){let a=(n<<1)+i%2,u=(o<<1)+(i>>1),d={aabb:l?r.aabb.quadrant(i):e.bu(this,c,r.zoom+1,a,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:a,y:u,wrap:r.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};s&&!p&&(d.tileID=new e.am(r.zoom+1===C?P:r.zoom+1,r.wrap,r.zoom+1,a,u),L(d)),A.push(d)}else{let s=r.zoom===C?P:r.zoom;if(i.minzoom&&i.minzoom>s)continue;if(!h){let i=v?r.aabb.intersectsPrecise(m):r.aabb.intersectsPreciseFlat(m);if(0===i&&u()){let a=new e.bs(r.zoom,n,o);i=e.bt(this,c,a,!0).intersectsPrecise(m)}if(0===i)continue}let l=d[0]-(.5+n+(r.wrap<<r.zoom))*(1<<a-r.zoom),p=d[1]-.5-o,f=r.tileID?r.tileID:new e.am(s,r.wrap,r.zoom,n,o);I.push({tileID:f,distanceSq:l*l+p*p})}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();I=I.filter(o=>{let s=[0,0,0,1],l=[e.V,e.V,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());e.a7.transformMat4(s,s,h),e.a7.transformMat4(l,l,h);let u=e.a7.min([],s,l),c=e.a7.max([],s,l),d=e.bv(u,c);if(0===d)return!0;let p=!1,f=this._elevation;if(f&&d>a&&0!==n){let a;let s=this.calculateProjMatrix(o.tileID.toUnwrapped());i.isTerrainDEM||(a=f.getMinMaxForTile(o.tileID)),a||(a={min:T,max:r});let l=e.bH(this.rotation),h=[l[0]*e.V,l[1]*e.V,a.max];e.N.transformMat4(h,h,s),p=(1-h[1])*this.height*.5<n}return d<a||p})}return I.sort((e,i)=>e.distanceSq-i.distanceSq).map(e=>e.tileID)}resize(e,i){this.width=e,this.height=i,this.pixelsToGLUnits=[2/e,-2/i],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(i){let r=e.aa(i.lat,-e.bw,e.bw),a=this.projection.project(i.lng,r);return new e.P(a.x*this.worldSize,a.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bl(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,r){let a,n;let o=this.centerPoint;if("globe"===this.projection.name){let e=this.worldSize;a=(r.x-o.x)/e,n=(r.y-o.y)/e}else{let e=this.pointCoordinate(r),i=this.pointCoordinate(o);a=e.x-i.x,n=e.y-i.y}let s=this.locationCoordinate(i);this.setLocation(new e.L(s.x-a,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}
8locationCoordinate(i,r){let a=r?e.bl(r,i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new e.L(n.x,n.y,a)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(i,r){let a=null!=r?r:this._centerAltitude,n=[i.x,i.y,0,1],o=[i.x,i.y,1,1];e.a7.transformMat4(n,n,this.pixelMatrixInverse),e.a7.transformMat4(o,o,this.pixelMatrixInverse);let s=o[3];e.a7.scale(n,n,1/n[3]),e.a7.scale(o,o,1/s);let l=n[2],h=o[2];return{p0:n,p1:o,t:l===h?0:(a-l)/(h-l)}}screenPointToMercatorRay(i){let r=[i.x,i.y,0,1],a=[i.x,i.y,1,1];return e.a7.transformMat4(r,r,this.pixelMatrixInverse),e.a7.transformMat4(a,a,this.pixelMatrixInverse),e.a7.scale(r,r,1/r[3]),e.a7.scale(a,a,1/a[3]),r[2]=e.bl(r[2],this._center.lat)*this.worldSize,a[2]=e.bl(a[2],this._center.lat)*this.worldSize,e.a7.scale(r,r,1/this.worldSize),e.a7.scale(a,a,1/this.worldSize),new e.a2([r[0],r[1],r[2]],e.N.normalize([],e.N.sub([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,o=e.bl(r[2],this._center.lat),s=e.bl(a[2],this._center.lat);return new e.L(e.U(r[0],a[0],n)/this.worldSize,e.U(r[1],a[1],n)/this.worldSize,e.U(o,s,n))}pointCoordinate(e,i=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,i)}pointCoordinate3D(i){if(!this.elevation)return this.pointCoordinate(i);let r=this.projection.pointCoordinate3D(this,i.x,i.y);if(r)return new e.L(r[0],r[1],r[2]);let a=0,n=this.horizonLineFromTop();if(i.y>n)return this.pointCoordinate(i);let o=.02*n,s=i.clone();for(let i=0;i<10&&n-a>o;i++){s.y=e.U(a,n,.66);let i=this.projection.pointCoordinate3D(this,s.x,s.y);i?(n=s.y,r=i):a=s.y}return r?new e.L(r[0],r[1],r[2]):this.pointCoordinate(i)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=e.bx)return!this.isPointAboveHorizon(i);let r=this.pointCoordinate(i);return r.y>=0&&r.y<=1}_coordinatePoint(i,r){let a=r&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,n=[i.x*this.worldSize,i.y*this.worldSize,a+i.toAltitude(),1];return e.a7.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:i,left:r}=this._edgeInsets,a=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(r,i)),s=this.pointLocation3D(new e.P(n,i)),l=this.pointLocation3D(new e.P(n,a)),h=this.pointLocation3D(new e.P(r,a)),u=Math.min(o.lng,s.lng,l.lng,h.lng),c=Math.max(o.lng,s.lng,l.lng,h.lng),d=Math.min(o.lat,s.lat,l.lat,h.lat),p=Math.max(o.lat,s.lat,l.lat,h.lat),f=Math.pow(2,-this.zoom)/16*270,m="globe"===this.projection.name?1:4,_=(i,r,a,n,o)=>{let s=(i+a)/2,l=(r+n)/2,h=new e.P(s,l),{lng:g,lat:y}=this.pointLocation3D(h),x=Math.max(0,u-g,d-y,g-c,y-p);u=Math.min(u,g),c=Math.max(c,g),d=Math.min(d,y),p=Math.max(p,y),(o<m||x>f)&&(_(i,r,s,l,o+1),_(s,l,a,n,o+1))};if(_(r,i,n,i,1),_(n,i,n,a,1),_(n,a,r,a,1),_(r,a,r,i,1),"globe"===this.projection.name){let[i,r]=e.by(this);i?(p=90,c=180,u=-180):r&&(d=-90,c=180,u=-180)}return new e.ad(new e.bn(u,d),new e.bn(c,p))}_getBoundsRectangular(i,r){let a,n,o,s;let{top:l,left:h}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,c=this.width-this._edgeInsets.right,d=new e.P(h,l),p=new e.P(c,l),f=new e.P(c,u),m=new e.P(h,u),_=this.pointCoordinate(d,i),g=this.pointCoordinate(p,i),y=this.pointCoordinate(f,r),x=this.pointCoordinate(m,r);return _.y>1&&g.y>=0?_=new e.L((1-x.y)/(((a=_).y-x.y)/(a.x-x.x))+x.x,1):_.y<0&&g.y<=1&&(_=new e.L(-x.y/(((n=_).y-x.y)/(n.x-x.x))+x.x,0)),g.y>1&&_.y>=0?g=new e.L((1-y.y)/(((o=g).y-y.y)/(o.x-y.x))+y.x,1):g.y<0&&_.y<=1&&(g=new e.L(-y.y/(((s=g).y-y.y)/(s.x-y.x))+y.x,0)),(new e.ad).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(g)).extend(this.coordinateLocation(x)).extend(this.coordinateLocation(y))}_getBoundsRectangularTerrain(){let e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);let i=e.visibleDemTiles.reduce((e,i)=>{if(i.dem){let r=i.dem.tree;e.min=Math.min(e.min,r.minimums[0]),e.max=Math.max(e.max,r.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(i.min*e.exaggeration(),i.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){let 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 e?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-e.bw,this.maxLat=e.bw,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.a5(this.minLng)*this.tileSize,this.worldMaxX=e.a5(this.maxLng)*this.tileSize,this.worldMinY=e.ae(this.maxLat)*this.tileSize,this.worldMaxY=e.ae(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,i){return this.projection.createTileMatrix(this,i,e)}calculateDistanceTileData(i){let r=i.key,a=this._distanceTileDataCache;if(a[r])return a[r];let n=i.canonical,o=1/this.height,s=this.cameraWorldSize,l=s/this.zoomScale(n.z),h=(n.x+Math.pow(2,n.z)*i.wrap)*l,u=n.y*l,c=this.point;c.x*=s/this.worldSize,c.y*=s/this.worldSize;let d=this.angle,p=Math.sin(-d),f=-Math.cos(-d);return a[r]={bearing:[p,f],center:[(c.x-h)*o,(c.y-u)*o],scale:l/e.V*o},a[r]}calculateFogTileMatrix(i){let r=i.key,a=this._fogTileMatrixCache;if(a[r])return a[r];let n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return e.a6.multiply(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,o;let s=i.key;if((n=a?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache)[s])return n[s];let l=this.calculatePosMatrix(i,this.worldSize);return o=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:a?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,e.a6.multiply(l,o,l),n[s]=new Float32Array(l),n[s]}calculatePixelsToTileUnitsMatrix(i){let r=i.tileID.key,a=this._pixelsToTileUnitsCache;if(a[r])return a[r];let n=e.bz(i,this);return a[r]=n,a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let i=1/this.worldSize,r=e.a6.fromScaling([],[i,i,i]);return e.a6.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let i=this._elevation;this._updateCameraState();let r=e.bl(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),o=e.bl(1,this._center.lat);a[2]/=o,n[2]/=o,e.N.normalize(n,n);let s=i.raycast(a,n,i.exaggeration());if(s){let i=e.N.scaleAndAdd([],a,n,s),r=new e.L(i[0],i[1],e.bl(i[2],e.au(i[1]))),l=(r.z+e.N.length([r.x-a[0],r.y-a[1],r.z-a[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(l),this._centerAltitude=r.toAltitude(),this._center=this.coordinateLocation(r),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;let r=this._elevation,a=e.bl(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=r.getAtPointOrZero(new e.L(...n)),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),h=n[2]-s;if(h<=l){if(h<0||i){let i=this.locationCoordinate(this._center,this._centerAltitude),r=[n[0],n[1],i.z-n[2]],a=e.N.length(r);r[2]-=(l-h)/this._pixelsPerMercatorPixel;let o=e.N.length(r);if(0===o)return;e.N.scale(r,r,a/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],i.z*this._pixelsPerMercatorPixel-r[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){let r=this.center;return r.lat=e.aa(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=e.aa(r.lng,this.minLng,this.maxLng)),this.center=r,void(this._constraining=!1)}let r=this._unmodified,{x:a,y:n}=this.point,o=0,s=a,l=n,h=this.width/2,u=this.height/2,c=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(n-u<c&&(l=c+u),n+u>d&&(l=d-u),d-c<this.height&&(o=Math.max(o,this.height/(d-c)),l=(d+c)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let e=this.worldMinX*this.scale,i=this.worldMaxX*this.scale,r=this.worldSize/2-(e+i)/2;(s=(a+r+this.worldSize)%this.worldSize-r)-h<e&&(s=e+h),s+h>i&&(s=i-h),i-e<this.width&&(o=Math.max(o,this.width/(i-e)),s=(i+e)/2)}s===a&&l===n||(this.center=this.unproject(new e.P(s,l))),o&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){let i;if(!this.height)return;let r=this.centerOffset,a="globe"===this.projection.name,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.bl(1,this.center.lat)/e.bl(1,e.bI));let o=e.bA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,o),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;let s="meters"===this.projection.zAxisUnit?n:1,l=this._camera.getWorldToCamera(this.worldSize,s),h=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(h[8]=-(2*r.x)/this.width,h[9]=2*r.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),a=e*this.aspect,n=-a,o=-e;a-=r.x,n-=r.x,e+=r.y,o+=r.y,((e,i,r,a)=>{for(let n=0;n<16;n++)e[n]=iv(i[n],r[n],a)})(i=this._camera.getCameraToClipOrthographic(n,a,o,e,this._nearZ,this._farZ),i,h,ib(this.pitch>=15?1:this.pitch/15))}else i=h;let u=e.a6.mul([],h,l),c=e.a6.mul([],i,l);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center),r=e.a6.identity([]);e.a6.translate(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),e.a6.multiply(r,r,e.bB(this)),e.a6.translate(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),e.a6.multiply(c,c,r),e.a6.multiply(u,u,r),this.inverseAdjustmentMatrix=e.bC(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.a6.scale([],c,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=c,this.invProjMatrix=e.a6.invert(new Float64Array(16),this.projMatrix),a){let i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=-(2*r.x)/this.width,i[9]=2*r.y/this.height,this.expandedFarZProjMatrix=e.a6.mul([],i,l)}else this.expandedFarZProjMatrix=this.projMatrix;let d=e.a6.invert([],i);this.frustumCorners=e.bD.fromInvProjectionMatrix(d,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);let p=new Float32Array(16);e.a6.identity(p),e.a6.scale(p,p,[1,-1,1]),e.a6.rotateX(p,p,this._pitch),e.a6.rotateZ(p,p,this.angle);let f=e.a6.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.a6.clone(f);let m=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;f[8]=-(2*r.x)/this.width,f[9]=2*(r.y+m)/this.height,this.skyboxMatrix=e.a6.multiply(
8p,f,p);let _=this.point,g=_.x,y=_.y,x=this.width%2/2,v=this.height%2/2,b=Math.cos(this.angle),w=Math.sin(this.angle),T=g-Math.round(g)+b*x+w*v,M=y-Math.round(y)+b*v+w*x,E=new Float64Array(c);if(e.a6.translate(E,E,[T>.5?T-1:T,M>.5?M-1:M,0]),this.alignedProjMatrix=E,c=e.a6.create(),e.a6.scale(c,c,[this.width/2,-this.height/2,1]),e.a6.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=e.a6.create(),e.a6.scale(c,c,[1,-1,1]),e.a6.translate(c,c,[-1,-1,0]),e.a6.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=e.a6.multiply(new Float64Array(16),this.labelPlaneMatrix,u),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=e.a6.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=c,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.bE(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.N.transformMat4(i,i,l),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=c;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let i=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,a=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[i,i,r];e.N.scale(o,o,n),e.N.scale(a,a,-1),e.N.multiply(a,a,o);let s=e.a6.create();e.a6.translate(s,s,a),e.a6.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,r,n)}_computeCameraPosition(e){let i=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),a=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*i-e/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-r[0]*n,a.y/this.worldSize-r[1]*n,e/this.worldSize*this._centerAltitude-r[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(i){let r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=this._camera.position[2],n=i[2],o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((r-a)/n,1)),this._camera.position=e.N.scaleAndAdd([],this._camera.position,i,o),this._updateStateFromCamera()}_updateStateFromCamera(){let i=this._camera.position,r=this._camera.forward(),{pitch:a,bearing:n}=this._camera.getPitchBearing(),o=e.bl(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.bj(this._maxPitch)),l=Math.max((i[2]-o)/Math.cos(a),s),h=this._zoomFromMercatorZ(l);e.N.scaleAndAdd(i,i,r,l),this._pitch=e.aa(a,e.bj(this.minPitch),e.bj(this.maxPitch)),this.angle=e.bh(n,-Math.PI,Math.PI),this._setZoom(e.aa(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.L(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){let e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(i){let r=0,a=e.bx,n=0,o=1/0;for(;a-r>1e-6&&a>r;){let e=r+.5*(a-r),s=this.tileSize*Math.pow(2,e),l=this.getCameraToCenterDistance(this.projection,e,s),h=this.scaleZoom(l/(i*this.tileSize)),u=Math.abs(e-h);u<o&&(o=u,n=e),e<h?r=e:a=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,r){let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let l=[new e.P(a,o),new e.P(n,s),new e.P(a,s),new e.P(n,o)],h=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1;for(let e of l){let i=this.pointRayIntersection(e);if(i.t<0)return!0;let r=this.rayIntersectionCoordinate(i);if(r.x<h||r.y<0||r.x>u||r.y>1)return!0}return!1}
8isHorizonVisible(){return this.pitch+e.bF(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(i,r){let a=e.N.length(e.N.sub([],this._camera.position,i)),n=this._zoomFromMercatorZ(a)+r;return a-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){let i=function([i,r,a],n){let o=[i,r,a,1];e.a7.transformMat4(o,o,n);let s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(i[0],i[1])}{let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,i))}}getCameraToCenterDistance(i,r=this.zoom,a=this.worldSize){let n=e.bA(i,r,this.width,this.height,1024),o=i.pixelSpaceConversion(this.center.lat,a,n),s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=iv(1,s,ib(this.pitch>=15?1:this.pitch/15))),s}getWorldToCameraMatrix(){let i=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.a6.multiply(i,i,this.globeMatrix),i}getFrustum(i){return e.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let iT={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,ShadowMap0:10},iM=(i,r)=>{if(r>0&&i.terrain&&e.w("Cutoff is currently disabled on terrain"),r<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let a=i.transform,n=Math.max(Math.abs(a._zoom-(i.minCutoffZoom-1)),1),o=a.isLODDisabled(!1)?e.O(60,45,a.pitch):e.O(30,15,a.pitch),s=a._farZ-a._nearZ,l=r*a.height,h=((1-o)*a.cameraToCenterDistance+o*(a._farZ+l))*n;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(h-a._nearZ)/s,(h-l-a._nearZ)/s]}}},iE={cascadeCount:2,shadowMapResolution:2048};class iS{constructor(e,i){this.aabb=e,this.lastCascade=i}}class iA{add(e,i){let r=this.receivers[e.key];void 0!==r?(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[e.key]=new iS(i,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(i,r,a){let n=e.bS.fromPoints(i.points),o=0;for(let i in this.receivers){let s=this.receivers[i];if(!s||!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);let l=s.aabb.getCorners();for(let i=0;i<a.length;i++){let n=!0;for(let o of l){let s=[o[0]*r,o[1]*r,o[2]];if(e.N.transformMat4(s,s,a[i].matrix),s[0]<-1||s[0]>1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=i,o=Math.max(o,i),n)break}}return o+1}}class iI{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new iA,this._depthMode=new tu(e.context.gl.LEQUAL,tu.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,e.tp.registerParameter(iE,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(iE,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32})}destroy(){for(let e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,r){let a=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;let n=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||n<=0||(this._shadowLayerCount=a.style.order.reduce((e,r)=>{let n=a.style._mergedLayers[r];return e+(n.hasShadowPass()&&!n.isHidden(i.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this._enabled))return;let o=a.context,s=iE.shadowMapResolution,l=iE.shadowMapResolution;if(0===this._cascades.length||iE.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let i=0;i<iE.cascadeCount;++i){let i=a._shadowMapDebug,r=o.gl,n=o.createFramebuffer(s,l,i,"texture"),h=new e.T(o,{width:s,height:l,data:null},r.DEPTH_COMPONENT);if(n.depthAttachment.set(h.texture),i){let i=new e.T(o,{width:s,height:l,data:null},r.RGBA);n.colorAttachment.set(i.texture)}this._cascades.push({framebuffer:n,texture:h,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bq,scale:0})}}this.shadowDirection=iP(r);let h=0;if(i.elevation){let e=i.elevation,r=[1e4,-1e4];e.visibleDemTiles.filter(e=>
8e.dem).forEach(e=>{let i=e.dem.tree;r[0]=Math.min(r[0],i.minimums[0]),r[1]=Math.max(r[1],i.maximums[0])}),1e4!==r[0]&&(h=(r[1]-r[0])*e.exaggeration())}let u=1.5*i.cameraToCenterDistance,c=3*u,d=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){let a=this._cascades[r],n=i.height/50,o=1;1===iE.cascadeCount?o=c:0===r?o=u:(n=u,o=c);let[s,l]=function(i,r,a,n,o,s){let l,h;let u=i.zoom,c=i.scale,d=i.worldSize,p=1/d,f=i.aspect,m=Math.sqrt(1+f*f)*Math.tan(.5*i.fovX),_=m*m,g=n-a,y=n+a;_>g/y?(l=n,h=n*m):(l=.5*y*(1+_),h=.5*Math.sqrt(g*g+2*(n*n+a*a)*_+y*y*_*_));let x=i.projection.pixelsPerMeter(i.center.lat,d),v=i._camera.getCameraToWorldMercator(),b=[0,0,-l*p];e.N.transformMat4(b,b,v);let w=h*p,T=i._edgeInsets;if(!(0===T.left&&0===T.top&&0===T.right&&0===T.bottom||T.left===T.right&&T.top===T.bottom)){let r=i._camera.getWorldToCamera(i.worldSize,"meters"===i.projection.zAxisUnit?x:1),o=i._camera.getCameraToClipPerspective(i._fov,i.width/i.height,a,n);o[8]=-(2*i.centerOffset.x)/i.width,o[9]=2*i.centerOffset.y/i.height;let s=new Float64Array(16);e.a6.mul(s,o,r);let l=new Float64Array(16);for(let r of(e.a6.invert(l,s),e.bq.fromInvProjectionMatrix(l,d,u,!0).points)){let a=(r[0]/=c,r[1]/=c,r[2]=e.bl(r[2],i._center.lat),r);w=Math.max(w,e.N.len(e.N.subtract([],b,a)))}}w*=o/(o-1);let M=Math.acos(r[2]),E=Math.atan2(-r[0],-r[1]),S=new ix;S.position=b,S.setPitchBearing(M,E);let A=S.getWorldToCamera(d,x),I=w*d,C=Math.min(-(i._mercatorZfromZoom(17)*d*2),-2*I),P=S.getCameraToClipOrthographic(-I,I,-I,I,C,(I+s*x)/r[2]),z=new Float64Array(16);e.a6.multiply(z,P,A);let D=e.N.fromValues(Math.floor(1e6*b[0])/1e6*d,Math.floor(1e6*b[1])/1e6*d,0),L=.5*o,R=[0,0,0];e.N.transformMat4(R,D,z),e.N.scale(R,R,L);let k=[Math.floor(R[0]),Math.floor(R[1]),Math.floor(R[2])],O=[0,0,0];e.N.sub(O,R,k),e.N.scale(O,O,-1/L);let B=new Float64Array(16);return e.a6.identity(B),e.a6.translate(B,B,O),e.a6.multiply(z,B,z),[z,I]}(i,this.shadowDirection,n,o,iE.shadowMapResolution,h);a.scale=i.scale,a.matrix=s,a.boundingSphereRadius=l,e.a6.invert(d,a.matrix
8),a.frustum=e.bq.fromInvProjectionMatrix(d,1,0,!0),a.far=o}let p=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[p].far,this._cascades[p].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=1/iE.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=iE.shadowMapResolution,this._uniformValues.u_shadowmap_0=iT.ShadowMap0,this._uniformValues.u_shadowmap_1=iT.ShadowMap0+1,this._groundShadowTiles=a.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let f=a.transform.elevation;for(let e of this._groundShadowTiles){let i={min:0,max:0};if(f){let r=f.getMinMaxForTile(e);r&&(i=r)}this.addShadowReceiver(e.toUnwrapped(),i.min,i.max)}}get enabled(){return this._enabled}set enabled(e){this._enabled=e}drawShadowPass(i,r){if(!this._enabled)return;let a=this.painter,n=a.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(a.transform.getFrustum(0),a.transform.worldSize,this._cascades),n.viewport.set([0,0,iE.shadowMapResolution,iE.shadowMapResolution]);for(let o=0;o<this._numCascadesToRender;++o)for(let s of(a.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:e.ax.white,depth:1}),i.order)){let e=i._mergedLayers[s];if(!e.hasShadowPass()||e.isHidden(a.transform.zoom))continue;let n=i.getLayerSourceCache(e),o=n?r[n.id]:void 0;("model"===e.type||o&&o.length)&&a.renderLayer(a,n,e,o)}a.currentShadowCascade=0}drawGroundShadows(){if(!this._enabled)return;let e=this.painter,i=e.style,r=e.context,a=i.directionalLight,n=i.ambientLight;if(!a||!n)return;let o=[],s=iM(e,e.longestCutoffRange);s.shouldRenderCutoff&&o.push("RENDER_CUTOFF");let l=iz(a,n),h=new tu(r.gl.LEQUAL,tu.ReadOnly,e.depthRangeFor3D);for(let i of this._groundShadowTiles){let a=i.toUnwrapped(),n=e.isTileAffectedByFog(i),u=e.getOrCreateProgram("groundShadow",{defines:o,overrideFog:n});this.setupShadows(a,u),e.uploadCommonUniforms(r,u,a,null,s);let c={u_matrix:e.transform.calculateProjMatrix(a),u_ground_shadow_factor:l};u.draw(e,r.gl.TRIANGLES,h,tc.disabled,td.multiply,tp.disabled,c,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?td.unblended:td.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return e.a6.multiply(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return e.a6.multiply(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}setupShadows(i,r,a,n=0){if(!this._enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=new Float64Array(16),c=o.calculatePosMatrix(i,o.worldSize);for(let i=0;i<this._cascades.length;i++)e.a6.multiply(u,this._cascades[i].matrix,c),h[0===i?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(u),s.activeTexture.set(l.TEXTURE0+iT.ShadowMap0+i),this._cascades[i].texture.bind(l.NEAREST,l.CLAMP_TO_EDGE);if(this.useNormalOffset=!!a,this.useNormalOffset){let r=e.bR(i.canonical),s=2/o.tileSize*e.V/iE.shadowMapResolution,l=s*this._cascades[0].boundingSphereRadius,u=s*this._cascades[this._cascades.length-1].boundingSphereRadius,c=("vector-tile"===a?1:3)/Math.pow(2,n-i.canonical.z-(1-o.zoom+Math.floor(o.zoom)));h.u_shadow_normal_offset=[r,l*c,u*c],h.u_shadow_bias=[6e-5,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(s,h)}setupShadowsFromMatrix(i,r,a=!1){if(!this._enabled)return;let n=this.painter.context,o=n.gl,s=this._uniformValues,l=new Float64Array(16);for(let r=0;r<iE.cascadeCount;r++)e.a6.multiply(l,this._cascades[r].matrix,i),s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(l),n.activeTexture.set(o.TEXTURE0+iT.ShadowMap0+r),this._cascades[r].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);(this.useNormalOffset=a,a)?(s.u_shadow_normal_offset=[1,5,5],s.u_shadow_bias=[6e-5,.0012,.012]):s.u_shadow_bias=[36e-5,.0012,.012],r.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,r,a,n){if(n[2]>=0)return{};let o=(function(i,r,a){let n=a/(1<<i.canonical.z);return new e.bS([i.canonical.x*n+i.wrap*a,i.canonical.y*n+i.wrap*a,0],[(i.canonical.x+1)*n+i.wrap*a,(i.canonical.y+1)*n+i.wrap*a,r])})(i,r,a).getCorners(),s=-(r/n[2]);n[0]<0?(e.N.add(o[0],o[0],[n[0]*s,0,0]),e.N.add(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.N.add(o[1],o[1],[n[0]*s,0,0]),e.N.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.N.add(o[0],o[0],[0,n[1]*s,0]),e.N.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.N.add(o[2],o[2],[0,n[1]*s,0]),e.N.add(o[3],o[3],[0,n[1]*s,0]));let l={};return l.vertices=o,l.planes=[iC(o[1],o[0],o[4]),iC(o[2],o[1],o[5]),iC(o[3],o[2],o[6]),iC(o[0],o[3],o[7])],l}addShadowReceiver(i,r,a){this._receivers.add(i,e.bS.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(e){let i=this._receivers.get(e);return i&&i.lastCascade?i.lastCascade:0}}function iC(i,r,a){let n=e.N.sub([],a,r),o=e.N.sub([],i,r),s=e.N.cross([],n,o),l=e.N.length(s);return 0===l?[0,0,1,0]:(e.N.scale(s,s,1/l),[s[0],s[1],s[2],-e.N.dot(s,r)])}function iP(i){let r=i.properties.get("direction"),a=e.bQ(r.x,r.y,r.z);
8a[2]=e.aa(a[2],0,75);let n=e.bT([a[0],a[1],a[2]]);return e.N.fromValues(n.x,n.y,n.z)}function iz(i,r){let a=i.properties.get("color"),n=i.properties.get("intensity"),o=i.properties.get("direction"),s=[o.x,o.y,o.z],l=r.properties.get("color"),h=r.properties.get("intensity"),u=Math.max(e.N.dot([0,0,1],s),0),c=[0,0,0];e.N.scale(c,l.toArray01Linear().slice(0,3),h);let d=[0,0,0];return e.N.scale(d,a.toArray01Linear().slice(0,3),u*n),e.bU([c[0]>0?c[0]/(c[0]+d[0]):0,c[1]>0?c[1]/(c[1]+d[1]):0,c[2]>0?c[2]/(c[2]+d[2]):0])}let iD=(e,i)=>eo(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),iL=e.ac(tP,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),iR=e.ac(tP,["setCenter","setZoom","setBearing","setPitch"]),ik={version:8,layers:[],sources:{}},iO={duration:300,delay:0},iB=new Set(["fill","line","background","hillshade","raster"]);class iF extends e.E{constructor(i,r={}){super(),this.map=i,this.scope=r.scope||"",this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=e.e({},iO),this._buildingIndex=new tI(this),this.crossTileSymbolIndex=new id,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new x,this.dispatcher=r.dispatcher?r.dispatcher:new e.bW(e.bX(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new w,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.bY(i._requestManager,r.localFontFamily?e.bZ.all:r.localIdeographFontFamily?e.bZ.ideographs:e.bZ.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new v(i._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=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this.dispatcher.broadcast("setReferrer",e.b_());let a=this;this._rtlTextPluginCallback=iF.registerForPluginStateChange(i=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:i.pluginStatus,pluginURL:i.pluginURL},(i,r)=>{if(e.b$(i),r&&r.every(e=>e))for(let e in a._sourceCaches){let i=a._sourceCaches[e],r=i.getSource().type;"vector"!==r&&"geojson"!==r||i.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let i=this.getOwnSource(e.sourceId);if(i&&i.vectorLayerIds)for(let e in this._layers){let r=this._layers[e];r.source===i.id&&this._validateLayer(r)}})}loadURL(i,r={}){this.fire(new e.b("dataloading",{dataType:"style"}));let a="boolean"==typeof r.validate?r.validate:!e.c0(i);i=this.map._requestManager.normalizeStyleURL(i,r.accessToken),this.resolvedImports.add(i);let n=this.importsCache.get(i);if(n)return this._load(n,a);let o=this.map._requestManager.transformRequest(i,e.R.Style);this._request=e.g(o,(r,n)=>{if(this._request=null,r)this.fire(new e.a(r));else if(n)return this.importsCache.set(i,n),this._load(n,a)})}loadJSON(i,r={}){this.fire(new e.b("dataloading",{dataType:"style"})),this._request=e.f.frame(()=>{this._request=null,this._load(i,!1!==r.validate)})}loadEmpty(){this.fire(new e.b("dataloading",{dataType:"style"})),this._load(ik,!1)}_loadImports(i,r,a){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let n=[];for(let e of i){let i=this._createFragmentStyle(e),o=new Promise(e=>{i.once("style.import.load",e),i.once("error",e)}).then(()=>this.mergeAll());if(n.push(o),this.resolvedImports.has(e.url)){i.loadEmpty();continue}let s=e.data||this.importsCache.get(e.url);s?i.loadJSON(s,{validate:r}):e.url?i.loadURL(e.url,{validate:r}):i.loadEmpty();let l={style:i,id:e.id,config:e.config};if(a){let e=this.fragments.findIndex(({id:e})=>e===a);this.fragments=this.fragments.slice(0,e).concat(l).concat(this.fragments.slice(e))}else this.fragments.push(l)}return Promise.allSettled(n)}_createFragmentStyle(i){let r=this.scope?e.ag(i.id,this.scope):i.id,a=new iF(this.map,{scope:r,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:i.config,configOptions:this.options,configDependentLayers:this._configDependentLayers});return a.setEventedParent(this.map,{style:a}),a}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options});let i=this.isRootStyle();this._shouldPrecompile=i,this.fire(new e.b(i?"style.load":"style.import.load"))}_load(i,r){let a=i.schema;if(this.isRootStyle()&&(i.fragment||a&&!1!==i.fragment)){let a=e.e({},ik,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(a,r)}if(this.setConfig(this._config,a),r&&iD(this,H(i)))return;for(let r in this._loaded=!0,this.stylesheet=e.c1(i),i.sources)this.addSource(r,i.sources[r],{validate:!1,isInitialLoad:!0});i.sprite?this._loadSprite(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(i.glyphs,this.scope);
8let n=tC(this.stylesheet.layers);if(this._order=n.map(e=>e.id),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights){if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let e=this.stylesheet.lights[0];this.light=new el(e.properties,e.id)}else this.setLights(this.stylesheet.lights)}for(let i of(this.light||(this.light=new el(this.stylesheet.light)),this._layers={},this._serializedLayers={},n)){let r=e.c2(i,this.scope,this.options);r.isConfigDependent&&this._configDependentLayers.add(r.fqid),r.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r,this._serializedLayers[r.id]=r.serialize();let a=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&r.canCastShadows()&&n&&(a.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);let o=this.stylesheet.terrain;o&&(void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.f.hasCanvasFingerprintNoise()),this.disableElevatedTerrain?e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."):this.terrainSetForDrapingOnly()||this._createTerrain(o,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.b("data",{dataType:"style"})),i.imports?this._loadImports(i.imports,r).then(()=>this._reloadImports()):this._reloadImports()}isRootStyle(){return 0===this.importDepth}mergeAll(){let i,r,a,n,o,s,l,h;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(e=>{if(e.stylesheet){if(null!=e.light&&(i=e.light),e.stylesheet.lights)for(let i of e.stylesheet.lights)"ambient"===i.type&&null!=e.ambientLight&&(r=e.ambientLight),"directional"===i.type&&null!=e.directionalLight&&(a=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),null!=e.stylesheet.camera&&(h=e.stylesheet.camera),null!=e.stylesheet.projection&&(s=e.stylesheet.projection),null!=e.stylesheet.transition&&(l=e.stylesheet.transition)}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,null===n?delete this.terrain:this.terrain=n,this.camera=h||{"camera-projection":"perspective"},this.projection=s||{name:"mercator"},this.transition=e.e({},iO,l),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){let i=r=>{for(let e of r.fragments)i(e.style);e(r)};i(this)}_prioritizeTerrain(e,i,r){let a=e&&0===e.drapeRenderMode;return null===r?i&&0===i.drapeRenderMode?i:a?e:null:null!=i&&(!e||a||i&&1===i.drapeRenderMode)?i:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(i=>{e=this._prioritizeTerrain(e,i.terrain,i.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(i=>{null!=i.stylesheet.projection&&(e=i.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){let i={},r={},a={};this.forEachFragmentStyle(n=>{for(let r in n._sourceCaches)i[e.ag(r,n.scope)]=n._sourceCaches[r];for(let i in n._otherSourceCaches)r[e.ag(i,n.scope)]=n._otherSourceCaches[i];for(let i in n._symbolSourceCaches)a[e.ag(i,n.scope)]=n._symbolSourceCaches[i]}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=a}mergeLayers(){let i={},r=[],a={};this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(a=>{for(let n of a._order){let o=a._layers[n];if("slot"===o.type){let r=e.c3(n);if(i[r])continue;i[r]=[]}o.slot&&i[o.slot]?i[o.slot].push(o):r.push(o)}}),this._mergedOrder=[];let n=(r=[])=>{for(let o of r)if("slot"===o.type){let r=e.c3(o.id);i[r]&&n(i[r])}else{let i=e.ag(o.id,o.scope);this._mergedOrder.push(i),a[i]=o,o.is3D()&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0)}};n(r),this._mergedLayers=a,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=e.e({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(i,r,a){let n,o,s;let l=e.f.devicePixelRatio>1?"@2x":"",h=e.g(r.transformRequest(r.normalizeSpriteURL(i,l,".json"),e.R.SpriteJSON),(e,i)=>{h=null,s||(s=e,n=i,c())}),u=e.d(r.transformRequest(r.normalizeSpriteURL(i,l,".png"),e.R.SpriteImage),(e,i)=>{u=null,s||(s=e,o=i,c())});function c(){if(s)a(s);
8else if(n&&o){let i=e.f.getImageData(o),r={};for(let a in n){let{width:o,height:s,x:l,y:h,sdf:u,pixelRatio:c,stretchX:d,stretchY:p,content:f}=n[a],m=new e.h({width:o,height:s});e.h.copy(i,m,{x:l,y:h},{x:0,y:0},{width:o,height:s}),r[a]={data:m,pixelRatio:c,sdf:u,stretchX:d,stretchY:p,content:f}}a(null,r)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(i,this.map._requestManager,(i,r)=>{if(this._spriteRequest=null,i)this.fire(new e.a(i));else if(r)for(let e in r)this.imageManager.addImage(e,this.scope,r[e]);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 e.b("data",{dataType:"style"}))})}_validateLayer(i){let r=this.getOwnSource(i.source);if(!r)return;let a=i.sourceLayer;a&&("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.a(Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${i.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded())return!1;for(let{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,i)=>{let r=this.fragments[i];return r&&r.style&&(e.data=r.style.serialize()),e})}_serializeSources(){let e={};for(let i in this._sourceCaches){let r=this._sourceCaches[i].getSource();e[r.id]||(e[r.id]=r.serialize())}return e}_serializeLayers(e){let i=[];for(let r of e){let e=this._layers[r];e&&"custom"!==e.type&&i.push(e.serialize())}return i}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(let e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped(this.getLayerSourceCache(e)):iB.has(e.type))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(i){let r=this.getOwnLayer(i);if(r)return r;this.fire(new e.a(Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){let r=this.getOwnSource(i);if(r)return r;this.fire(new e.a(Error(`The source '${i}' does not exist in the map's style.`)))}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);let r=this.calculateLightsBrightness();i.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));let a=this._changes.isDirty();if(this._changes.isDirty()){let e=this._changes.getLayerUpdatesByScope();for(let i in e){let{updatedIds:r,removedIds:a}=e[i];(r||a)&&this._updateWorkerLayers(i,r,a)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this._changes.reset()}let n={};for(let e in this._mergedSourceCaches){let i=this._mergedSourceCaches[e];n[e]=i.used,i.used=!1,i.tileCoverLift=0}for(let e of this._mergedOrder){let r=this._mergedLayers[e];if(r.recalculate(i,this._availableImages),!r.isHidden(i.zoom)){let e=this.getLayerSourceCache(r);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,r.tileCoverLift()))}if(!this._precompileDone&&this._shouldPrecompile)for(let e=r.minzoom||0;e<(r.maxzoom||25.5);e++){let e=this.map.painter;if(e){let a=r.getProgramIds();if(!a)continue;for(let n of a){let a=r.getDefaultProgramParams(n,i.zoom);a&&(e.style=this,this.fog&&(e._fogVisible=!0,a.overrideFog=!0,e.getOrCreateProgram(n,a)),e._fogVisible=!1,a.overrideFog=!1,e.getOrCreateProgram(n,a),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(a.overrideRtt=!0,e.getOrCreateProgram(n,a)))}}}}for(let i in this._shouldPrecompile&&(this._precompileDone=!0),n){let r=this._mergedSourceCaches[i];n[i]!==r.used&&r.getSource().fire(new e.b("data",{sourceDataType:"visibility",dataType:"source",sourceId:r.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.z=i.zoom,this._markersNeedU
8pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),a&&this.fire(new e.b("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=this._changes.getUpdatedImages();if(e.length){for(let i in this._sourceCaches)this._sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,i,r){let a=this.getFragmentStyle(e);a&&this.dispatcher.broadcast("updateLayers",{layers:i?a._serializeLayers(i):[],scope:e,removedIds:r||[],options:a.options})}setState(i){if(this._checkLoaded(),iD(this,H(i)))return!1;(i=e.c1(i)).layers=tC(i.layers);let r=(function(e,i){if(!e)return[{command:tP.setStyle,args:[i]}];let r=[];try{if(!a(e.version,i.version))return[{command:tP.setStyle,args:[i]}];a(e.center,i.center)||r.push({command:tP.setCenter,args:[i.center]}),a(e.zoom,i.zoom)||r.push({command:tP.setZoom,args:[i.zoom]}),a(e.bearing,i.bearing)||r.push({command:tP.setBearing,args:[i.bearing]}),a(e.pitch,i.pitch)||r.push({command:tP.setPitch,args:[i.pitch]}),a(e.sprite,i.sprite)||r.push({command:tP.setSprite,args:[i.sprite]}),a(e.glyphs,i.glyphs)||r.push({command:tP.setGlyphs,args:[i.glyphs]}),a(e.imports,i.imports)||function(e=[],i=[],r){let n,o,s,l;i=i||[];let h=(e=e||[]).map(tR),u=i.map(tR),c=e.reduce(tk,{}),d=i.reduce(tk,{}),p=h.slice();for(n=0,o=0;n<h.length;n++)s=h[n],d.hasOwnProperty(s)?o++:(r.push({command:tP.removeImport,args:[s]}),p.splice(p.indexOf(s,o),1));for(n=0,o=0;n<u.length;n++)s=u[u.length-1-n],p[p.length-1-n]!==s&&(c.hasOwnProperty(s)?(r.push({command:tP.removeImport,args:[s]}),p.splice(p.lastIndexOf(s,p.length-o),1)):o++,l=p[p.length-n],r.push({command:tP.addImport,args:[d[s],l]}),p.splice(p.length-n,0,s));for(let e of i){let i=c[e.id];i&&!a(i,e)&&r.push({command:tP.updateImport,args:[e.id,e]})}}(e.imports,i.imports,r),a(e.transition,i.transition)||r.push({command:tP.setTransition,args:[i.transition]}),a(e.light,i.light)||r.push({command:tP.setLight,args:[i.light]}),a(e.fog,i.fog)||r.push({command:tP.setFog,args:[i.fog]}),a(e.projection,i.projection)||r.push({command:tP.setProjection,args:[i.projection]}),a(e.lights,i.lights)||r.push({command:tP.setLights,args:[i.lights]}),a(e.camera,i.camera)||r.push({command:tP.setCamera,args:[i.camera]});let n={},o=[];!function(e,i,r,n){let o;for(o in i=i||{},e=e||{})e.hasOwnProperty(o)&&(i.hasOwnProperty(o)||tD(o,r,n));for(o in i){var s,l;if(!i.hasOwnProperty(o))continue;let h=i[o];e.hasOwnProperty(o)?a(e[o],h)||("geojson"===e[o].type&&"geojson"===h.type&&function(e,i,r){let n;for(n in e[r])if(e[r].hasOwnProperty(n)&&"data"!==n&&!a(e[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!a(e[r][n],i[r][n]))return!1;return!0}(e,i,o)?r.push({command:tP.setGeoJSONSourceData,args:[o,h.data]}):(s=o,l=i,tD(s,r,n),tz(s,l,r))):tz(o,i,r)}}(e.sources,i.sources,o,n);let s=[];e.layers&&e.layers.forEach(e=>{e.source&&n[e.source]?r.push({command:tP.removeLayer,args:[e.id]}):s.push(e)});let l=e.terrain;l&&n[l.source]&&(r.push({command:tP.setTerrain,args:[void 0]}),l=void 0),r=r.concat(o),a(l,i.terrain)||r.push({command:tP.setTerrain,args:[i.terrain]}),function(e,i,r){let n,o,s,l,h,u,c;i=i||[];let d=(e=e||[]).map(tR),p=i.map(tR),f=e.reduce(tk,{}),m=i.reduce(tk,{}),_=d.slice(),g=Object.create(null);for(n=0,o=0;n<d.length;n++)s=d[n],m.hasOwnProperty(s)?o++:(r.push({command:tP.removeLayer,args:[s]}),_.splice(_.indexOf(s,o),1));for(n=0,o=0;n<p.length;n++)s=p[p.length-1-n],_[_.length-1-n]!==s&&(f.hasOwnProperty(s)?(r.push({command:tP.removeLayer,args:[s]}),_.splice(_.lastIndexOf(s,_.length-o),1)):o++,u=_[_.length-n],r.push({command:tP.addLayer,args:[m[s],u]}),_.splice(_.length-n,0,s),g[s]=!0);for(n=0;n<p.length;n++)if(l=f[s=p[n]],h=m[s],!g[s]&&!a(l,h)){if(a(l.source,h.source)&&a(l["source-layer"],h["source-layer"])&&a(l.type,h.type)){for(c in tL(l.layout,h.layout,r,s,null,tP.setLayoutProperty),tL(l.paint,h.paint,r,s,null,tP.setPaintProperty),a(l.slot,h.slot)||r.push({command:tP.setSlot,args:[s,h.slot]}),a(l.filter,h.filter)||r.push({command:tP.setFilter,args:[s,h.filter]}),a(l.minzoom,h.minzoom)&&a(l.maxzoom,h.maxzoom)||r.push({command:tP.setLayerZoomRange,args:[s,h.minzoom,h.maxzoom]}),l)l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?tL(l[c],h[c],r,s,c.slice(6),tP.setPaintProperty):a(l[c],h[c])||r.push({command:tP.setLayerProperty,args:[s,c,h[c]]}));for(c in h)h.hasOwnProperty(c)&&!l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?tL(l[c],h[c],r,s,c.slice(6),tP.setPaintProperty):a(l[c],h[c])||r.push({command:tP.setLayerProperty,args:[s,c,h[c]]}))}else r.push({command:tP.removeLayer,args:[s]}),u=_[_.lastIndexOf(s)+1],r.push({command:tP.addLayer,args:[h,u]})}}(s,i.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:tP.setStyle,args:[i]}]}return r})(this.serialize(),i).filter(e=>!(e.command in iR));if(0===r.length)return!1;let n=r.filter(e=>!(e.command in iL));if(n.length>0)throw Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);
8return r.forEach(e=>{this[e.command].apply(this,e.args)}),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(i,r){return this.getImage(i)?this.fire(new e.a(Error("An image with this name already exists."))):(this.imageManager.addImage(i,this.scope,r),this._afterImageUpdated(i),this)}updateImage(e,i){this.imageManager.updateImage(e,this.scope,i)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._afterImageUpdated(i),this):this.fire(new e.a(Error("No image with this name exists.")))}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(i),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.b("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,i,r={}){return this._checkLoaded(),this._validate(ea,`models.${e}`,i,null,r)||(this.modelManager.addModel(e,i,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.scope),this):this.fire(new e.a(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(i,r,a={}){if(this._checkLoaded(),void 0!==this.getOwnSource(i))throw Error(`There is already a source with ID "${i}".`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(X,`sources.${i}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=tv(i,r,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));let o=i=>{let r=(i?"symbol:":"other:")+n.id,a=e.ag(r,this.scope),o=this._sourceCaches[r]=new tM(a,n,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==r.type&&"geojson"!==r.type||o(!0),n.onAdd&&n.onAdd(this.map),a.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();let r=this.getOwnSource(i);if(!r)throw Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===i)return this.fire(new e.a(Error(`Source "${i}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new e.a(Error(`Source "${i}" cannot be removed while terrain is using it.`)));for(let r of this.getOwnSourceCaches(i)){let i=e.c3(r.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(r.id),r.fire(new e.b("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,i){this._checkLoaded(),this.getOwnSource(e).setData(i),this._changes.setDirty()}getOwnSource(e){let i=this.getOwnSourceCache(e);return i&&i.getSource()}getOwnSources(){let e=[];for(let i in this._otherSourceCaches){let r=this.getOwnSourceCache(i);r&&e.push(r.getSource())}return e}areTilesLoaded(){let e=this._mergedSourceCaches;for(let i in e){let r=e[i]._tiles;for(let e in r){let i=r[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;let r=this._getTransitionParameters();for(let e of i){if(this._validate(K,"lights",e))return;switch(e.type){case"ambient":if(this.ambientLight){let i=this.ambientLight;i.set(e),i.updateTransitions(r)}else this.ambientLight=new eg(e,ey,this.scope,this.options);break;case"directional":if(this.directionalLight){let i=this.directionalLight;i.set(e),i.updateTransitions(r)}else this.directionalLight=new eg(e,ex,this.scope,this.options)}}let a=new e.K(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(a),this.directionalLight&&this.directionalLight.recalculate(a),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let i=this.directionalLight,r=this.ambientLight;if(!i||!r)return;let a=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=i.properties.get("color").toArray01(),o=i.properties.get("intensity"),s=i.properties.get("direction"),l=1-e.bQ(s.x,s.y,s.z)[2]/90,h=a(n)*o*l,u=r.properties.get("color").toArray01(),c=r.properties.get("intensity");
8return(h+a(u)*c)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(!i)return this;if(e.c4(i)){let r=e.c5(i),a=this.fragments.find(({id:e})=>e===r);if(!a)throw Error(`Style import not found: ${i}`);let n=e.c3(i);return a.style.getFragmentStyle(n)}{let e=this.fragments.find(({id:e})=>e===i);if(!e)throw Error(`Style import not found: ${i}`);return e.style}}getConfigProperty(i,r){let a=this.getFragmentStyle(i);if(!a)return null;let n=e.ag(r,a.scope),o=a.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(i,r,a){let n=e.r(a);if("success"!==n.result)return void iD(this,n.value);let o=n.value.expression,s=this.getFragmentStyle(i);if(!s)return;let l=e.ag(r,s.scope),h=s.options.get(l);h&&(this.options.set(l,{...h,value:o}),this.updateConfigDependencies())}setConfig(i,r){if(this._config=i,i||r){if(r)for(let a in r){let n,o;let s=e.r(r[a].default);if("success"===s.result&&(n=s.value.expression),i&&void 0!==i[a]){let r=e.r(i[a]);"success"===r.result&&(o=r.value.expression)}let{minValue:l,maxValue:h,stepValue:u,type:c,values:d}=r[a];if(n){let i=e.ag(a,this.scope);this.options.set(i,{default:n,value:o,minValue:l,maxValue:h,stepValue:u,type:c,values:d})}else this.fire(new e.a(Error(`No schema defined for config option "${a}".`)))}else this.fire(new e.a(Error("Attempting to set config for a style without schema.")))}}updateConfigDependencies(){for(let e of this._configDependentLayers){let i=this.getLayer(e);i&&(i.possiblyEvaluateVisibility(),this._updateLayer(i))}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this._changes.setDirty()}addLayer(i,r,a={}){let n;this._checkLoaded();let o=i.id;if(this._layers[o])return void this.fire(new e.a(Error(`Layer with i
8d "${o}" already exists on this map`)));if("custom"===i.type){if(iD(this,e.c6(i)))return;n=e.c2(i,this.scope,this.options)}else{if("object"==typeof i.source&&(this.addSource(o,i.source),i=e.c1(i),i=e.e(i,{source:o})),this._validate(ee,`layers.${o}`,i,{arrayIndex:-1},a))return;n=e.c2(i,this.scope,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:o}}),this._serializedLayers[n.id]=n.serialize()}n.isConfigDependent&&this._configDependentLayers.add(n.fqid);let s=this._order.length;if(r){let i=this._order.indexOf(r);if(-1===i)return void this.fire(new e.a(Error(`Layer with id "${r}" does not exist on this map.`)));n.slot===this._layers[r].slot?s=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=n;let l=this.getOwnLayerSourceCache(n),h=!!this.directionalLight&&this.directionalLight.shadowsEnabled();l&&n.canCastShadows()&&h&&(l.castsShadows=!0);let u=this._changes.getRemovedLayer(n);if(u&&n.source&&l&&"custom"!==n.type){this._changes.discardLayerRemoval(n);let i=e.ag(n.source,n.scope);u.type!==n.type?this._changes.updateSourceCache(i,"clear"):(this._changes.updateSourceCache(i,"reload"),l.pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map),n.scope=this.scope,this.mergeLayers()}moveLayer(i,r){this._checkLoaded();let a=this._checkLayer(i);if(!a||i===r)return;let n=this._order.indexOf(i);this._order.splice(n,1);let o=this._order.length;if(r){let i=this._order.indexOf(r);
8if(-1===i)return void this.fire(new e.a(Error(`Layer with id "${r}" does not exist on this map.`)));a.slot===this._layers[r].slot?o=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,i),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();let i=this._checkLayer(e);if(!i)return;i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),delete this._layers[e],delete this._serializedLayers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(i.fqid),this._changes.removeLayer(i);let a=this.getOwnLayerSourceCache(i);if(a&&a.castsShadows){let e=!1;for(let r in this._layers)if(this._layers[r].source===i.source&&this._layers[r].canCastShadows()){e=!0;break}a.castsShadows=e}i.onRemove&&i.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(let i in this._layers)if(this._layers[i].type===e)return!0;return!1}setLayerZoomRange(e,i,r){this._checkLoaded();let a=this._checkLayer(e);a&&(a.minzoom===i&&a.maxzoom===r||(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)))}setSlot(e,i){this._checkLoaded();let r=this._checkLayer(e);r&&r.slot!==i&&(r.slot=i,this._updateLayer(r))}setFilter(i,r,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o&&!a(o.filter,r))return null==r?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(et,`layers.${o.id}.filter`,r,{layerType:o.type},n)||(o.filter=e.c1(r),this._updateLayer(o)))}getFilter(i){let r=this._checkLayer(i);if(r)return e.c1(r.filter)}setLayoutProperty(i,r,n,o={}){this._checkLoaded();let s=this._checkLayer(i);if(s&&!a(s.getLayoutProperty(r),n)){if(null!=n&&(!o||!1!==o.validate)&&iD(s,er.call(H,{key:`layers.${i}.layout.${r}`,layerType:s.type,objectKey:r,value:n,styleSpec:e.D,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(r,n),s.isConfigDependent&&this._configDependentLayers.add(s.fqid),this._updateLayer(s)}}getLayoutProperty(e,i){let r=this._checkLayer(e);if(r)return r.getLayoutProperty(i)}setPaintProperty(i,r,n,o={}){this._checkLoaded();let s=this._checkLayer(i);if(!s||a(s.getPaintProperty(r),n)||null!=n&&(!o||!1!==o.validate)&&iD(s,ei.call(H,{key:`layers.${i}.paint.${r}`,layerType:s.type,objectKey:r,value:n,styleSpec:e.D})))return;let l=s.setPaintProperty(r,n);s.isConfigDependent&&this._configDependentLayers.add(s.fqid),l&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(e,i){let r=this._checkLayer(e);if(r)return r.getPaintProperty(i)}setFeatureState(i,r){this._checkLoaded();let a=i.source,n=i.sourceLayer,o=this._checkSource(a);if(!o)return;let s=o.type;if("geojson"===s&&n)return void this.fire(new e.a(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.a(Error("The sourceLayer parameter must be provided for vector source types.")));for(let o of(void 0===i.id&&this.fire(new e.a(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)))o.setFeatureState(n,i.id,r)}removeFeatureState(i,r){this._checkLoaded();let a=i.source,n=this._checkSource(a);if(!n)return;let o=n.type,s="vector"===o?i.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.a(Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&"string"!=typeof i.id&&"number"!=typeof i.id)return void this.fire(new e.a(Error("A feature id is required to remove its specific state property.")));for(let e of this.getOwnSourceCaches(a))e.removeFeatureState(s,i.id,r)}getFeatureState(i){this._checkLoaded();let r=i.source,a=i.sourceLayer,n=this._checkSource(r);if(n){if("vector"!==n.type||a)return void 0===i.id&&this.fire(new e.a(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(a,i.id);this.fire(new e.a(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=e.e({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return e.e({},this.stylesheet.transition)}serialize(){this._checkLoaded();let i=this.getTerrain(),r=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return e.c7({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:r,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)},e=>void 0!==e)}_updateLayer(i){this._changes.updateLayer(i);let r=this.getLayerSourceCache(i),a=e.ag(i.source,i.scope),n=this._changes.getUpd
8atedSourceCaches();i.source&&!n[a]&&r&&"raster"!==r.getSource().type&&(this._changes.updateSourceCache(a,"reload"),r.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){let i=e=>"fill-extrusion"===this._mergedLayers[e].type||"model"===this._mergedLayers[e].type,r=this.order,a={},n=[];for(let o=r.length-1;o>=0;o--){let s=r[o];if(i(s))for(let i of(a[s]=o,e)){let e=i[s];if(e)for(let i of e)n.push(i)}}n.sort((e,i)=>i.intersectionZ-e.intersectionZ);let o=[];for(let s=r.length-1;s>=0;s--){let l=r[s];if(i(l))for(let e=n.length-1;e>=0;e--){let i=n[e].feature;if(a[i.layer.id]<s)break;o.push(i),n.pop()}else for(let i of e){let e=i[l];if(e)for(let i of e)o.push(i.feature)}}return o}queryRenderedFeatures(i,r,a){r&&r.filter&&this._validate(et,"queryRenderedFeatures.filter",r.filter,null,r),r.scope=this.scope,r.availableImages=this._availableImages,r.serializedLayers=this._serializedLayers;let n={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.a(Error("parameters.layers must be an Array."))),[];for(let i of r.layers){let r=this._mergedLayers[i];if(!r)return this.fire(new e.a(Error(`The layer '${i}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}let o=[],s=r.serializedLayers||{},l=r&&r.layers?r.layers.some(e=>{let i=this.getLayer(e);return i&&i.is3D()}):this.has3DLayers(),h=ev.createFromScreenPoints(i,a);for(let i in this._mergedSourceCaches){let u=this._mergedSourceCaches[i].getSource();if(!u||u.scope!==r.scope)continue;let c=this._mergedSourceCaches[i].getSource().id;r.layers&&!n[c]||o.push(function(i,r,a,n,o,s,l,h=!1){let u=i.tilesIn(n,l,h);u.sort(tb);let c=[];for(let n of u)c.push({wrappedTileID:n.tile.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(r,a,i._state,n,o,s,function(i,r){let a=e.a6.identity([]);return e.a6.scale(a,a,[.5*i.width,-(.5*i.height),1]),e.a6.translate(a,a,[1,-1,0]),e.a6.multiply(a,a,i.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}(i.transform,n.tile.tileID),h)});let d=function(e){let i={},r={};for(let a of e){let e=a.queryResults,n=a.wrappedTileID,o=r[n]=r[n]||{};for(let r in e){let a=e[r],n=o[r]=o[r]||{},s=i[r]=i[r]||[];for(let e of a)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return i}(c);for(let e in d)d[e].forEach(e=>{let r=e.feature,a=r.layer;a&&"background"!==a.type&&"sky"!==a.type&&"slot"!==a.type&&(r.source=a.source,a["source-layer"]&&(r.sourceLayer=a["source-layer"]),r.state=void 0!==r.id?i.getFeatureState(a["source-layer"],r.id):{})});return d}(this._mergedSourceCaches[i],this._mergedLayers,s,h,r,a,l,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,i,r,a,n,o,s){let l={},h=o.queryRenderedSymbols(a),u=[];for(let e of Object.keys(h).map(Number))u.push(s[e]);for(let r of(u.sort(tb),u)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(let e in a){let i=l[e]=l[e]||[],n=a[e];for(let e of(n.sort((e,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(e.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-e.featureIndex}),n))i.push(e)}}for(let i in l)l[i].forEach(a=>{let n=a.feature,o=r(e[i]);if(!o)return;let s=o.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=s});return l}(this._mergedLayers,s,this.getLayerSourceCache.bind(this),h.screenGeometry,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(et,"querySourceFeatures.filter",i.filter,null,i);let r=this.getOwnSourceCaches(e),a=[];for(let e of r)a=a.concat(function(e,i){let r=e.getRenderableIds().map(i=>e.getTileByID(i)),a=[],n={};for(let e=0;e<r.length;e++){let o=r[e],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(a,i))}return a}(e,i));return a}addSourceType(e,i,r){return iF.getSourceType(e)?r(Error(`A source type called "${e}" already exists.`)):(iF.setSourceType(e,i),i.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:i.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(e,i,r={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let i in e)if(!a(e[i],n[i])){o=!0;break}if(!o)return;let s=this._getTransitionParameters();this.light.setLight(e,i,r),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(i,r=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()&&0!==r||delete this.terrain,null===i?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedU
8pdate=!0);let n=i,o=null==i.source;if(1===r){if("object"==typeof n.source){let i="terrain-dem-src";this.addSource(i,n.source),n=e.c1(n),n=e.e(n,{source:i})}let i=e.e({},n),r={};if(this.terrain&&o){i.source=this.terrain.get().source;let e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(r.style=e.serialize())}if(this._validate(J,"terrain",i,r))return}if(this.terrain&&(this.terrain.scope===this.scope||o)&&(!this.terrain||r===this.terrain.drapeRenderMode)){let r=this.terrain,o=r.get();for(let i of Object.keys(e.D.terrain))!n.hasOwnProperty(i)&&e.D.terrain[i].default&&(n[i]=e.D.terrain[i].default);for(let n in i)if(!a(i[n],o[n])){r.set(i,this.options),this.stylesheet.terrain=i;let a=this._getTransitionParameters({duration:0});r.updateTransitions(a),this.fire(new e.b("data",{dataType:"style"}));break}}else{if(!n)return;this._createTerrain(n,r),this.fire(new e.b("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){let i=this.fog=new e_(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let i=this.fog;if(!a(i.get(),e)){i.set(e,this.options),this.stylesheet.fog=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}}else this._createFog(e);this._markersNeedUpdate=!0}_getTransitionParameters(i){return{now:e.f.now(),transition:e.e(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;let e=[],i=[];for(let r in this._mergedLayers)this.isLayerDraped(this._mergedLayers[r])?e.push(r):i.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...i)}_createTerrain(e,i){let r=this.terrain=new eu(e,i,this.scope,this.options);1===i&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_force3DLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"fill-extrusion"===i.type&&this._updateLayer(i)}}_forceSymbolLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"symbol"===i.type&&this._updateLayer(i)}}_validate(i,r,a,n,o={}){if(o&&!1===o.validate)return!1;let s=e.e({},this.serialize());return iD(this,i.call(H,e.e({key:r,style:s,value:a,styleSpec:e.D},n)))}_remove(){for(let i in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.c8.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}
8clearSource(e){for(let i of this.getSourceCaches(e))i.clearTiles()}clearSources(){for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){for(let i of this.getSourceCaches(e))i.resume(),i.reload()}reloadSources(){for(let e of this.getSources())e.reload&&e.reload()}updateSources(e){let i;for(let r in this.directionalLight&&(i=iP(this.directionalLight)),this._mergedSourceCaches)this._mergedSourceCaches[r].update(e,void 0,void 0,i)}_generateCollisionBoxes(){for(let e in this._sourceCaches){let i=this._sourceCaches[e];i.resume(),i.reload()}}_updatePlacement(i,r,a,n,o=!1){let s=!1,l=!1,h={},u={};for(let r of this._mergedOrder){let a=this._mergedLayers[r];if("symbol"!==a.type)continue;let n=e.ag(a.source,a.scope),o=h[n];if(!o){let e=this.getLayerSourceCache(a);if(!e)continue;let i=e.getRenderableIds(!0).map(i=>e.getTileByID(i));u[n]=i.slice(),o=h[n]=i.sort((e,i)=>i.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(i.tileID)?-1:1))}let l=this.crossTileSymbolIndex.addLayer(a,o,i.center.lng,i.projection);s=s||l}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),o=o||this._layerOrderChanged||0===a,this._layerOrderChanged&&this.fire(new e.b("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.f.now(),i.zoom))&&(this.pauseablePlacement=new is(i,this._mergedOrder,o,r,a,n,this.placement,this.fog&&i.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,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.f.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let r of(this._buildingIndex.onNewFrame(i.zoom),this._mergedOrder)){let i=this._mergedLayers[r];"symbol"===i.type&&this.placement.updateLayerOpacities(i,h[e.ag(i.source,i.scope)])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.f.now())}_releaseSymbolFadeTiles(){for(let e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(i,r){this._checkLoaded();let a=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==a.findIndex(({id:e})=>e===i.id))return this.fire(new e.a(Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!r)return a.push(i),this._loadImports([i],!0),this;let n=a.findIndex(({id:e})=>e===r);return -1===n?this.fire(new e.a(Error(`Import with id "${r}" does not exist on this map.`))):(this.stylesheet.imports=a.slice(0,n).concat(i).concat(a.slice(n)),this._loadImports([i],!0,r),this)}updateImport(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],n=this.getImportIndex(e);return -1===n||("string"==typeof i?this.setImportUrl(e,i):(i.url&&i.url!==r[n].url&&this.setImportUrl(e,i.url),a(i.config,r[n].config)||this.setImportConfig(e,i.config),a(i.data,r[n].data)||this.setImportData(e,i.data))),this}moveImport(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;let n=this.getImportIndex(i);if(-1===n)return this;let o=r[a],s=this.fragments[a];return r=r.filter(({id:i})=>i!==e),this.fragments=this.fragments.filter(({id:i})=>i!==e),this.stylesheet.imports=r.slice(0,n).concat(o).concat(r.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;r[a].url=i;let n=this.fragments[a];return n.style=this._createFragmentStyle(r[a]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(i),this}setImportData(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];return -1===r?this:i?(this.fragments[r].style.setState(i),this._reloadImports(),this):(delete a[r].data,this.setImportUrl(e,a[r].url))}setImportConfig(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];if(-1===r)return this;i?a[r].config=i:delete a[r].config;let n=this.fragments[r],o=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=i,n.style.setConfig(i,o),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();let i=this.stylesheet.imports||[],r=this.getImportIndex(e);return -1===r||(i.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports()),this}getImportIndex(i){let r=(this.stylesheet.imports||[]).findIndex(e=>e.id===i);return -1===r&&this.fire(new e.a(Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),r}getLayer(e){return this._mergedLayers[e]}getSources(){let e=[];for(let i in this._mergedOtherSourceCaches){let r=this._mergedOtherSourceCaches[i];r&&e.push(r.getSource())}return e}getSource(e,i){let r=this.getSourceCache(e,i);return r&&r.getSource()}getLayerSource(e){let i=this.getLayerSourceCache(e);return i&&i.getSource()}getSourceCache(i,r){let a=e.ag(i,r);return this._mergedOtherSourceCaches[a]}getLayerSourceCache(i){let r=e.ag(i.source,i.scope);return"symbol"===i.type?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(e){let i=[];return this._mergedOtherSourceCaches[e]&&i.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&i.push(this._mergedSymbolSourceCaches[e]),i}
8updateSourceCaches(){let e=this._changes.getUpdatedSourceCaches();for(let i in e){let r=e[i];"reload"===r?this.reloadSource(i):"clear"===r&&this.clearSource(i)}}updateLayers(e){for(let i of this._changes.getUpdatedPaintProperties()){let r=this.getLayer(i);r&&r.updateTransitions(e)}}getImages(e,i,r){this.imageManager.getImages(i.icons,i.scope,r),this._updateTilesForChangedImages();let a=e=>{e&&e.setDependencies(i.tileID.key,i.type,i.icons)};a(this._otherSourceCaches[i.source]),a(this._symbolSourceCaches[i.source])}getGlyphs(e,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(i,r,a){return e.c9(r,a)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){let i=[];return this._otherSourceCaches[e]&&i.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&i.push(this._symbolSourceCaches[e]),i}_isSourceCacheLoaded(i){let r=this.getOwnSourceCaches(i);return 0===r.length?(this.fire(new e.a(Error(`There is no source with ID '${i}'`))),!1):r.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}iF.getSourceType=function(e){return tx[e]},iF.setSourceType=function(e,i){tx[e]=i},iF.registerForPluginStateChange=e.bV;var iN="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat 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;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",iV="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{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;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat 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);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}",iU="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat 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;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat 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;\n#else\nreturn vec3(0.0);\n#endif\n}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);}\n#endif\nvec2 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(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}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);
8return (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);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",ij="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;}",iG="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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(\nmix(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;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform 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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{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 > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;
8vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_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))\n);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);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",iZ="#ifdef FOG\nuniform 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);}\n#endif",iq="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;}\n#ifdef FOG\nuniform 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(\nmix(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;}
8vec3 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 > 0.0 || u_fog_vertical_limit.y > 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) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",i$="#ifdef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp 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(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",iW="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform vec2 u_velocity_res;uniform float u_max_speed;const vec2 INVALID_VELOCITY=vec2(-1);uniform vec2 u_texture_offset;uniform float u_data_offset;uniform vec4 u_data_scale;vec2 lookup_velocity(vec2 uv) {uv=u_texture_offset.x+u_texture_offset.y*uv;vec2 fxy;ivec4 c=_raTexLinearCoord(uv,u_velocity_res,fxy);vec4 tl=texelFetch(u_velocity,c.yz,0);vec4 tr=texelFetch(u_velocity,c.xz,0);vec4 bl=texelFetch(u_velocity,c.yw,0);vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NODATA) {return INVALID_VELOCITY;}if (tr==NODATA) {return INVALID_VELOCITY;}if (bl==NODATA) {return INVALID_VELOCITY;}if (br==NODATA) {return INVALID_VELOCITY;}vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);\n#ifdef DATA_FORMAT_UINT32\nvec2 velocity=vec2(u_data_offset+dot(t,u_data_scale),0);return velocity;\n#else\nvec2 velocity=vec2(u_data_offset+dot(t.rg,u_data_scale.yx),-(u_data_offset+dot(t.ba,u_data_scale.yx)));\n#endif\nreturn velocity/max(u_max_speed,length(velocity));}\n#endif",iH="#ifdef RENDER_SHADOWS\nuniform 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];}
8\n#endif//RENDER_SHADOWS",iX="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform 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;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn 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;\n#ifdef NATIVE\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp 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(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 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) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_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 < 1.0 && abs_bounds.y < 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 >=1.0 || abs_bounds.w >=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));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}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);}\n#endif";let iY=[];i1(iN,iY),i1(iU,iY),i1(iV,iY);let iK={"_prelude_fog.vertex.glsl":iZ,"_prelude_terrain.vertex.glsl":iG,"_prelude_shadow.vertex.glsl":iH,"_prelude_fog.fragment.glsl":iq,"_prelude_shadow.fragment.glsl":iX,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform 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
8));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);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":i$,"_prelude_raster_particle.glsl":iW},iJ={};i2("",iG),i2(iq,iZ),i2(iX,iH),i2(i$,""),i2(iW,"");let iQ=i2(iV,iU);var i0={background:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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 < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
8/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 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) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}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);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
8s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat 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;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < 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);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:i2("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:i2('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat 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);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:i2("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;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_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:i2("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"\nin 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(\n0.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:i2("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(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=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(\n0.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:i2("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"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout 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;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
8);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 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);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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 highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 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);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nuniform float u_emissive_strength;in float v_height;void main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat 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;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat 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);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);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);\n#else\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\nbase*=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));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 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 > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 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);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=max(0.01,cutoff_opacity(u_cutoff_params,ground.z));if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff < 0.01 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_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);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=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*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
8\n#endif\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_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);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_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;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat 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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:i2("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\nbase*=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 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 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 > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 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);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat 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
8),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;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\nout vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 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 > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 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 > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 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);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: 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;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
8ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:i2('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid 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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:i2("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;\n#ifdef SDF_SUBPASS\nin 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);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp 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;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform 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;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 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;
8fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;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=direction*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=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_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);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 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 > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:i2("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 < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.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:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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 > 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;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;
8uniform 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;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat 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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp 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 > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat 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 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) { \nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 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);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform 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;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat 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 > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*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;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat 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];\n#ifdef RENDER_LINE_GRADIENT\nhighp 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);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat 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);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;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;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 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 pattern_x=v_linesofar/pattern_size.x*aspect;float x=mod(pattern_x,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));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp 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 > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_ground(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin 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;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat 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 > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifndef RENDER_TO_TEXTURE\nfloat 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;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform 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;\n#ifndef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_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\n);\n#else\nvalue=mix(\nraTexture2D_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\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=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);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp 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));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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 float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 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;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);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);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);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;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
8if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_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;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp 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));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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 float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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 mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;vec2 uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);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 > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);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)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nvec2 uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:i2("precision highp float;uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'precision highp float;\n#include "_prelude_raster_array.glsl"\n#include "_prelude_raster_particle.glsl"\nin vec3 a_pos;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {vec2 pos=a_pos.xy+u_tile_offset;vec2 tex_coords=fract(pos);gl_PointSize=1.0;vec2 velocity=lookup_velocity(tex_coords);if (velocity==INVALID_VELOCITY) {v_particle_speed=0.0;gl_Position=vec4(2.0,2.0,2.0,1.0);} else {v_particle_speed=length(velocity);gl_Position=vec4(2.0*pos-vec2(1.0),0.0,1.0);}}'),rasterParticleTexture:i2("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {v_tex_pos=0.5*a_pos+vec2(0.5);gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:i2("void main() {}",'#include "_prelude_raster_array.glsl"\n#include "_prelude_raster_particle.glsl"\nin vec3 a_pos;uniform float u_speed_factor;uniform float u_lifetime_delta;uniform float u_rand_seed;out vec3 v_new_particle;const vec3 rand_constants=vec3(12.9898,78.233,4375.85453);float rand(const vec2 co) {float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {float lifetime=a_pos.z;vec2 pos=a_pos.xy;vec2 uv=clamp(pos,vec2(0.0),vec2(1.0));vec2 velocity=lookup_velocity(uv);float next_lifetime=lifetime-u_lifetime_delta;float t=step(0.0,next_lifetime);\n#ifdef DATA_FORMAT_UINT32\nvec2 dp=vec2(0);\n#else\nvec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity
8*u_speed_factor;\n#endif\nvec2 seed=pos*u_rand_seed;vec2 next_pos=pos+dp;vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));v_new_particle=vec3(\nvec2(mix(random_pos,next_pos,t)),mix(1.0,next_lifetime,t)\n);}'),symbolIcon:i2('#include "_prelude_lighting.glsl"\nuniform sampler2D u_texture;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\nin float v_fade_opacity;in vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nuniform mediump float u_icon_saturation;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nlowp float alpha=opacity*v_fade_opacity;vec4 out_color;\n#ifdef ICON_TRANSITION\nvec4 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;\n#else\nout_color=texture(u_texture,v_tex_a)*alpha;\n#endif\n#ifdef SATURATION\nvec3 luma=vec3(dot(out_color.rgb,vec3(0.2126,0.7152,0.0722)));out_color.rgb=mix(luma,out_color.rgb,u_icon_saturation);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 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 && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_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) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 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 <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nv_tex_a=a_tex/u_texsize;\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\nv_fade_opacity=out_fade_opacity;}'),symbolSDF:i2('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\nuniform 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;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat 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 > 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).r;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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nout float v_draw_halo;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 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 && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_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) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 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 <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && 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:i2('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
8glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}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 > 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).r;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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nout float v_draw_halo;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 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 && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_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) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 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;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nfloat out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && 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:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 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 < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,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;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nvoid 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);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 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.);\n#endif\n}'),terrainDepth:i2("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform 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:i2('#include "_prelude_fog.fragment.glsl"\nin 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(\ncos_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))/(e
8nd-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;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_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);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',ij),skyboxGradient:i2('#include "_prelude_fog.fragment.glsl"\nin 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));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',ij),skyboxCapture:i2
vendor: 3,803 bytes, line 8
8("\nin 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;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat 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 < 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 < 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);}"),globe
8Raster:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform 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;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(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);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform 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;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat 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);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 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);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:i2('#include "_prelude_fog.fragment.glsl"\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_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 < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp 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 < 0.0 ?\nPI-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);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_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;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat 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);\n#else\nvec3 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;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"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(\nmix(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(\nmix(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:i2('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin 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 > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 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)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 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)-light
8Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nreturn 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 ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp 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;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp 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;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 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);\n#endif\nreturn 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;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst 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)\n{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)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{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)\n{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)\n{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)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{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)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 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)\n{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;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
8Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst 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);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat 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));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
8y));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);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 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;\n#else\nlocal_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);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat 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);
8\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_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);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=local_pos;\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_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;\n#endif\n}'),modelDepth:i2("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 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;
8rs[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;\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:i2("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{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;}","\nin 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 i1(e,i){for(let r of e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"))if("#"===(r=r.trim())[0]&&r.includes("if")&&!r.includes("endif"))for(let e of(r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "))i.includes(e)||i.push(e)}function i2(e,i){let r=/#include\s+"([^"]+)"/g,a=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,n=i.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=[...new Set(n=n.map(e=>{let i=e.split(" ");return i[i.length-1]}))]);let o={},s=[],l=[];if(e=e.replace(r,(e,i)=>(l.push(i),"")),(i=i.replace(r,(e,i)=>(s.push(i),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let h=[...iY];for(let r of(i1(e,h),i1(i,h),[...s,...l]))iK[r]||console.error(`Undefined include: ${r}`),iJ[r]||(iJ[r]=[],i1(iK[r],iJ[r])),h=[...h,...iJ[r]];return{fragmentSource:e=e.replace(a,(e,i,r,a,n)=>(o[n]=!0,"define"===i?` 9#ifndef HAS_UNIFORM_u_${n} 10in ${r} ${a} ${n}; 11#else 12uniform ${r} ${a} u_${n}; 13#endif 14`:"initialize"===i?` 15#ifdef HAS_UNIFORM_u_${n} 16 ${r} ${a} ${n} = u_${n}; 17#endif 18`:"define-attribute"===i?` 19#ifdef HAS_ATTRIBUTE_a_${n} 20 in ${r} ${a} ${n}; 21#endif 22`:"initialize-attribute"===i?"":void 0)),vertexSource:i=i.replace(a,(e,i,r,a,n)=>{let s="float"===a?"vec2":a,l=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===i?` 23#ifdef HAS_ATTRIBUTE_a_${n} 24in ${r} ${a} a_${n}; 25#endif 26`:o[n]?"define"===i?` 27#ifndef HAS_UNIFORM_u_${n} 28uniform lowp float u_${n}_t; 29in ${r} ${s} a_${n}; 30out ${r} ${a} ${n}; 31#else 32uniform ${r} ${a} u_${n}; 33#endif 34`:"initialize"===i?"vec4"===l?` 35#ifndef HAS_UNIFORM_u_${n} 36 ${n} = a_${n}; 37#else 38 ${r} ${a} ${n} = u_${n}; 39#endif 40`:` 41#ifndef HAS_UNIFORM_u_${n} 42 ${n} = unpack_mix_${l}(a_${n}, u_${n}_t); 43#else 44 ${r} ${a} ${n} = u_${n}; 45#endif 46`:"define-attribute"===i?` 47#ifdef HAS_ATTRIBUTE_a_${n} 48 in ${r} ${a} a_${n}; 49 out ${r} ${a} ${n}; 50#endif 51`:"initialize-attribute"===i?` 52#ifdef HAS_ATTRIBUTE_a_${n} 53 ${n} = a_${n}; 54#endif 55`:void 0:"define"===i?` 56#ifndef HAS_UNIFORM_u_${n} 57uniform lowp float u_${n}_t; 58in ${r} ${s} a_${n}; 59#else 60uniform ${r} ${a} u_${n}; 61#endif 62`:"define-instanced"===i?"mat4"===l?` 63#ifdef INSTANCED_ARRAYS 64in vec4 a_${n}0; 65in vec4 a_${n}1; 66in vec4 a_${n}2; 67in vec4 a_${n}3; 68#else 69uniform ${r} ${a} u_${n}; 70#endif 71`:` 72#ifdef INSTANCED_ARRAYS 73in ${r} ${s} a_${n}; 74#else 75uniform ${r} ${a} u_${n}; 76#endif 77`:"initialize-attribute-custom"===i?` 78#ifdef HAS_ATTRIBUTE_a_${n} 79 ${r} ${a} ${n} = a_${n}; 80#endif 81`:"vec4"===l?` 82#ifndef HAS_UNIFORM_u_${n} 83 ${r} ${a} ${n} = a_${n}; 84#else 85 ${r} ${a} ${n} = u_${n}; 86#endif 87`:` 88#ifndef HAS_UNIFORM_u_${n} 89 ${r} ${a} ${n} = unpack_mix_${l}(a_${n}, u_${n}_t); 90#else 91 ${r} ${a} ${n} = u_${n}; 92#endif 93`}),staticAttributes:n,usedDefines:h,vertexIncludes:s,fragmentIncludes:l}}class i3{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,i,r,a,n,o,s,l){this.context=e;let h=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!h&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(h=!0);let u=this.boundDynamicVertexBuffers.length!==s.length;for(let e=0;!u&&e<s.length;e++)this.boundDynamicVertexBuffers[e]!==s[e]&&(u=!0);if(!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||h||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(i,r,a,n,o,s,l);else{for(let r of(e.bindVertexArrayOES.set(this.vao),s))r&&(r.bind(),l&&r.instanceCount&&r.setVertexAttribDivisor(e.gl,i,l));n&&n.dynamicDraw&&n.bind()}}freshBind(e,i,r,a,n,o,s){let l=e.numAttributes,h=this.context,u=h.gl;for(let s of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),r))s.enableAttributes(u,e),s.bind(),s.setVertexAttribPointers(u,e,n);for(let i of o)i&&(i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),s&&i.instanceCount&&i.setVertexAttribDivisor(u,e,s));a&&a.bind(),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function i5(i,r,a){if(!r.needsDEMTextureUpload)return;let n=i.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||i.getTileTexture(a.stride);let s=a.getPixels();r.demTexture?r.demTexture.update(s,{premultiply:!1}):r.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}let i4=i=>({u_matrix:new e.bK(i),u_image0:new e.bO(i),u_skirt_height:new e.bN(i),u_ground_shadow_factor:new e.bM(i)}),i6=(e,i,r)=>({u_matrix:e,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:r}),i8=(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:r,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:f,u_far_z_cutoff:m});
93function i9(e,i){return null!=e&&null!=i&&!(!e.hasData()||!i.hasData())&&null!=e.demTexture&&null!=i.demTexture&&e.tileID.key!==i.tileID.key}let i7=new class{constructor(){this.operations={}}newMorphing(e,i,r,a,n){if(e in this.operations){let i=this.operations[e];i.to.tileID.key!==r.tileID.key&&(i.queued=r)}else this.operations[e]={startTime:a,phase:0,duration:n,from:i,to:r,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;let i=this.operations[e];return{from:i.from,to:i.to,phase:i.phase}}update(e){for(let i in this.operations){let r=this.operations[i];for(r.phase=(e-r.startTime)/r.duration;r.phase>=1||!this._validOp(r);)if(!this._nextOp(r,e)){delete this.operations[i];break}}}_nextOp(e,i){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=i,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},re={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rt(e,i,r){return 0===i?0:6*Math.pow(1.5,22-e)*Math.max(i,1)*(i<1&&514===r?.25/i:1)}let ri=e=>({u_matrix:e});function rr(i,r,a,n,o){if(o>0){let s=e.f.now(),l=(s-i.timeAdded)/o,h=r?(s-r.timeAdded)/o:-1,u=a.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!r||Math.abs(r.tileID.overscaledZ-c)>Math.abs(i.tileID.overscaledZ-c),p=d&&i.refreshedUponExpiration?1:e.aa(d?l:1-h,0,1);return i.refreshedUponExpiration&&l>=1&&(i.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}class ra extends tM{constructor(i){let r=tv("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new e.bW(e.bX(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,i){e.state="loaded",i(null)}}class rn extends tM{constructor(i){let r=tv("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new e.bW(e.bX(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,i,r){if(e.freezeTileCoverage)return;this.transform=e;let a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((i,r)=>{if(i[r.key]="",!this._tiles[r.key]){let i=new ty(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i},{});for(let e in this._tiles)e in a||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){let i=this.proxyCachedFBO[e];if(void 0!==i){let r=Object.values(i);this.renderCachePool.push(...r),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class ro extends e.am{constructor(e,i,r){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=i,this.projMatrix=r}}class rs extends e.ck{constructor(i,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},i.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[a,n,o]=function(i){let r=new e.aN,a=new e.aw;r.reserve(17161),a.reserve(33800);let n=e.V/128,o=e.V+n/2,s=o+n;for(let i=-n;i<s;i+=n)for(let a=-n;a<s;a+=n){let n=a<0||a>o||i<0||i>o?24575:0,s=e.aa(Math.round(a),0,e.V),l=e.aa(Math.round(i),0,e.V);r.emplaceBack(s+n,l)}let l=(e,i)=>{let r=131*i+e;a.emplaceBack(r+1,r,r+131),a.emplaceBack(r+131,r+131+1,r+1)};for(let e=1;e<129;e++)for(let i=1;i<129;i++)l(i,e);return[0,129].forEach(e=>{for(let i=0;i<130;i++)l(i,e),l(e,i)}),[r,a,32768]}(),s=i.context;this.gridBuffer=s.createVertexBuffer(a,e.aP.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.aB.simpleSegment(0,0,a.length,n.length),this.gridNoSkirtSegments=e.aB.simpleSegment(0,0,a.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new rn(r.map),this.orthoMatrix=e.a6.create(),e.a6.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.V,0,e.V,0,1);let l=s.gl;this._overlapStencilMode=new tc({func:l.GEQUAL,mask:255},0,255,l.KEEP,l.KEEP,l.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new ra(r.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,r,a){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);let n=i.terrain.properties,o=0===i.terrain.drapeRenderMode,s=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.f.now();let l=i.terrain&&i.terrain.scope,h=n.get("source"),u=o?this._mockSourceCache:i.getSourceCache(h,l);if(!u)return void e.w(`Couldn't find terrain source "${h}".`);if(this.sourceCache=u,this._exaggeration=s?this.calculateExaggeration(r):n.get("exaggeration"),!r.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;let c=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 94This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let i=this.getScaledDemTileSize();this.sourceCache.update(r,i,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,c(),this._initializing=!0),c(),r.updateElevation(!0,a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(i){let r=this._previousCameraAltitude,a=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=a;let n=null!=r?a-r:Number.MAX_VALUE;if(2>Math.abs(n))return this._exaggeration;let o=i.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let l=o-this._previousZoom,h=this._previousUpdateTimestamp,u=o;null!=this._evaluationZoom&&(Math.abs(o-(u=this._evaluationZoom))>.5&&(l=.5*(o-u+l)),l*n<0&&(u+=l)),this._evaluationZoom=u;let c=s.getExaggeration(u),d=c===s.getExaggeration(Math.max(0,u-.1));if(d&&.01>Math.abs(c-this._exaggeration))return c;
94let p=Math.min(.1,.00375*(this._updateTimestamp-h));return(d||c<.1||1e-4>Math.abs(l))&&(p=Math.min(.2,4*p)),e.U(this._exaggeration,c,p)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(e=>e.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),this.framebufferCopyTexture&&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(){let e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(i){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let r=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(e.L.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let n=this.proxyCoords=r.getIds().map(e=>{let i=r.getTileByID(e).tileID;return i.projMatrix=a.calculateProjMatrix(i.toUnwrapped()),i});!function(i,r){let a=r.transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(a.x,a.y);i.sort((i,r)=>{if(r.overscaledZ-i.overscaledZ)return r.overscaledZ-i.overscaledZ;let a=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),o=new e.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=n.mult(1<<i.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(a)-s.distSqr(o)})}(n,this.painter);let o=this.proxyToSource||{};this.proxyToSource={},n.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};let s=this._style._mergedSourceCaches;for(let e in s){let r=s[e];if(!r.used||(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,i[e],o),r.usedForTerrain))continue;let a=i[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[r.id]=n.map(e=>new ro(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;let l={};for(let e of(this._visibleDemTiles=[],this.proxyCoords)){let i=this.terrainTileForTile[e.key];if(!i)continue;let r=i.tileID.key;r in l||(this._visibleDemTiles.push(i),l[r]=r)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;let i=this._findTileCoveringTileID(e,this.sourceCache);i&&(this.terrainTileForTile[e.key]=i)})}_prepareDEMTextures(){let e=this.painter.context,i=e.gl;for(let r in this.terrainTileForTile){let a=this.terrainTileForTile[r],n=a.dem;n&&(!a.demTexture||a.needsDEMTextureUpload)&&(e.activeTexture.set(i.TEXTURE1),i5(this.painter,a,n))}}_prepareDemTileUniforms(e,i,r,a){if(!i||null==i.demTexture)return!1;let n=e.tileID.canonical,o=Math.pow(2,i.tileID.canonical.z-n.z),s=a||"";return r[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],r[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){let i=this.painter.context,r=i.gl;if(!this._emptyDepthBufferTexture){let a=new e.h({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.T(i,a,r.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0,i=this._visibleDemTiles.reduce((i,r)=>{if(!r.dem)return i;let a=r.dem.tree.minimums[0];return a>0&&e++,i+a},0);return e?i/e:0}_updateEmptyDEMTexture(){let i=this.painter.context,r=i.gl;i.activeTexture.set(r.TEXTURE2);let a=this._getLoadedAreaMinimum(),[n,o]=(()=>{let i=new e.cm({width:1,height:1},new Float32Array([a]));return[r.R32F,i]})();this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new e.T(i,o,n,{premultiply:!1}),s}setupElevationDraw(i,r,a){let n=this.painter.context,o=n.gl,s={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};s.u_exaggeration=this.exaggeration();let l=null,h=null,u=1;if(a&&a.morphing&&this._useVertexMorphing){let e=a.morphing.srcDemTile,r=a.morphing.dstDemTile;
94u=a.morphing.phase,e&&r&&(this._prepareDemTileUniforms(i,e,s,"_prev")&&(h=e),this._prepareDemTileUniforms(i,r,s)&&(l=r))}let c=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST,d=e=>{s.u_dem_size=1===e.size[0]?1:e.size[0]-2};if(h&&l)n.activeTexture.set(o.TEXTURE2),l.demTexture.bind(c(l),o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE4),h.demTexture.bind(c(h),o.CLAMP_TO_EDGE),l.demTexture&&d(l.demTexture),s.u_dem_lerp=u;else{l=this.terrainTileForTile[i.tileID.key],n.activeTexture.set(o.TEXTURE2);let e=this._prepareDemTileUniforms(i,l,s)?l.demTexture:this.emptyDEMTexture;e.bind(c(l),o.CLAMP_TO_EDGE),d(e)}if(n.activeTexture.set(o.TEXTURE3),a&&a.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.u_depth_size_inv=[1,1]),a&&a.useMeterToDem&&l){let i=(1<<l.tileID.canonical.z)*e.bl(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=i}if(a&&a.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),r.setTerrainUniformValues(n,s),"globe"===this.painter.transform.projection.name){let e=this.globeUniformValues(this.painter.transform,i.tileID.canonical,a&&a.useDenormalizedUpVectorScale);r.setGlobeUniformValues(n,e)}}globeUniformValues(i,r,a){let n=i.projection;return{u_tile_tl_up:n.upVector(r,0,0),u_tile_tr_up:n.upVector(r,e.V,0),u_tile_br_up:n.upVector(r,e.V,e.V),u_tile_bl_up:n.upVector(r,0,e.V),u_tile_up_scale:a?e.cl(1):n.upVectorScale(r,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){let r=this.painter,a=this.painter.context;0!==i.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(i,r,a,n,o){if("globe"===i.transform.projection.name)!function(i,r,a,n,o){let s,l;let h=i.context,u=h.gl,c=i.transform,d=e.cd(i,h,c),p=(e,r)=>{if(l===r)return;let a=[re[r],"PROJECTION_GLOBE_VIEW"];d&&a.push("CUSTOM_ANTIALIASING");let n=i.isTileAffectedByFog(e);s=i.getOrCreateProgram("globeRaster",{defines:a,overrideFog:n}),l=r},f=i.colorModeForRenderPass(),m=new tu(u.LEQUAL,tu.ReadWrite,i.depthRangeFor3D);i7.update(o);let _=e.ce(c),g=[e.a5(c.center.lng),e.ae(c.center.lat)],y=i.globeSharedBuffers,x=[c.width*e.f.devicePixelRatio,c.height*e.f.devicePixelRatio],v=Float32Array.from(c.globeMatrix),b={useDenormalizedUpVectorScale:!0};{let c=i.transform,d=rt(c.zoom,r.exaggeration(),r.sourceCache._source.tileSize);l=-1;let w=u.TRIANGLES;for(let l of n){let n=a.getTile(l),T=tc.disabled,M=r.prevTerrainTileForTile[l.key],E=r.terrainTileForTile[l.key];i9(M,E)&&i7.newMorphing(l.key,M,E,o,250),h.activeTexture.set(u.TEXTURE0),n.texture&&n.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let S=i7.getMorphValuesForProxy(l.key),A=S?1:0;S&&e.j(b,{morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.cc(S.phase)}});let I=e.cf(l.canonical),C=e.cg(I.getCenter().lat),P=e.ch(l.canonical,I,C,c.worldSize/c._pixelsPerMercatorPixel),z=e.aT(e.ci(l.canonical)),D=i8(c.expandedFarZProjMatrix,v,_,z,e.S(c.zoom),g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,d,c._farZ,P);if(p(l,A),s&&(r.setupElevationDraw(n,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),y)){let[e,r,a]=y.getGridBuffers(C,0!==d);s.draw(i,w,m,T,f,tp.backCCW,D,"globe_raster",e,r,a)}}}if(y&&(i.renderDefaultNorthPole||i.renderDefaultSouthPole)){let o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let l of(d&&o.push("CUSTOM_ANTIALIASING"),s=i.getOrCreateProgram("globeRaster",{defines:o}),n)){let{x:n,y:o,z:d}=l.canonical,p=0===o,_=o===(1<<d)-1,[v,w,T,M]=y.getPoleBuffers(d,!1);if(M&&(p||_)){let o=a.getTile(l);h.activeTexture.set(u.TEXTURE0),o.texture&&o.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let y=e.cj(d,n,c),E=e.aT(e.ci(l.canonical)),S=(e,r)=>e.draw(i,u.TRIANGLES,m,tc.disabled,f,tp.disabled,i8(c.expandedFarZProjMatrix,y,y,E,0,g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,0,c._farZ),"globe_pole_raster",r,T,M);r.setupElevationDraw(o,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),p&&i.renderDefaultNorthPole&&S(s,v),_&&i.renderDefaultSouthPole&&(y=e.a6.scale(e.a6.create(),y,[1,-1,1]),S(s,w))}}}}(i,r,a,n,o);else{let s,l;let h=i.context,u=h.gl,c=i.shadowRenderer,d=iM(i,i.longestCutoffRange),p=e=>{if(l===e)return;let r=[];r.push(re[e]),d.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),s=i.getOrCreateProgram("terrainRaster",{defines:r}),l=e},f=i.colorModeForRenderPass(),m=new tu(u.LEQUAL,tu.ReadWrite,i.depthRangeFor3D);i7.update(o);let _=i.transform,g=rt(_.zoom,r.exaggeration(),r.sourceCache._source.tileSize),y=[0,0,0];if(c){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(y=iz(e,r))}{l=-1;let x=u.TRIANGLES,[v,b]=[r.gridIndexBuffer,r.gridSegments];for(let l of n){let n;let w=a.getTile(l),T=tc.disabled,M=r.prevTerrainTileForTile[l.key],E=r.terrainTileForTile[l.key];i9(M,E)&&i7.newMorphing(l.key,M,E,o,250),h.activeTexture.set(u.TEXTURE0),w.texture&&w.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let S=i7.getMorphValuesForProxy(l.key),A=S?1:0;S&&(n={morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.cc(S.phase)}});let I=i6(l.projMatrix,!function(e,i){let r=1<<e.z;return!i&&(0===e.x||e.x===r-1)||0===e.y||e.y===r-1}(l.canonical,_.renderWorldCopies)?g:g/10,y);if(p(A),!s)continue;r.setupElevationDraw(w,s,n);let C=l.toUnwrapped();c&&c.setupShadows(C,s),i.uploadCommonUniforms(h,s,C,null,d),s.draw(i,x,m,T,f,tp.backCCW,I,"terrain_raster",r.gridBuffer,v,b)}}}}(r,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(0===this._drapedRenderBatches.length)return i+1;this.renderingToTexture=!0;let r=this.painter,a=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),l=r.style.order,h=[],u=0;for(let c of o){let o;let d=n.getTileByID(c.proxyTileKey),p=n.proxyCachedFBO[c.key]?n.proxyCachedFBO[c.key][i]:void 0,f=void 0!==p?n.renderCache[p]:this.pool[u++],m=void 0!==p;if(d.texture=f.tex,m&&!f.dirty){h.push(d.tileID);continue}a.bindFramebuffer.set(f.fb.framebuffer),this.renderedToTile=!1,f.dirty&&(a.clear({color:e.ax.transparent,stencil:0}),f.dirty=!1);for(let e=s.start;e<=s.end;++e){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s)
94)}if(0===this._drapedRenderBatches.length)for(let e of this._pendingGroundEffectLayers){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s))}this.renderedToTile?(f.dirty=!0,h.push(d.tileID)):m||--u,5===u&&(u=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){let i=e.order.length,r=-1,a=i;for(let n=0;n<i;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?r=Math.max(r,n):a=Math.min(a,n);return a>r}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(i=>{e=Math.min(e,i.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,i,r){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(e=>e.dem).map(a=>{let n=a.tileID,o=1<<n.overscaledZ,{x:s,y:l}=n.canonical,h=s/o,u=(s+1)/o,c=l/o,d=(l+1)/o;return{minx:h,miny:c,maxx:u,maxy:d,t:a.dem.tree.raycastRoot(h,c,u,d,e,i,r),tile:a}});for(let n of(a.sort((e,i)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==i.t?i.t:Number.MAX_VALUE)),a)){if(null==n.t)break;let a=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,i,r);if(null!=a)return a}return null}_createFBO(){let i=this.painter.context,r=i.gl,a=this.drapeBufferSize;i.activeTexture.set(r.TEXTURE0);let n=new e.T(i,{width:a[0],height:a[1],data:null},r.RGBA);n.bind(r.LINEAR,r.CLAMP_TO_EDGE);let o=i.createFramebuffer(a[0],a[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new tl(i,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(let e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{let i=this._style._mergedLayers[e],r=i.isHidden(this.painter.transform.zoom);return"custom"===i.type?!r&&i.shouldRedrape():!r&&i.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(let e of this._style.getSources())if(e instanceof eE){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(n&&!r[n.id]&&!a.isHidden(this.painter.transform.zoom)&&"line"===a.type&&a.widthExpression() instanceof e.Z)for(let e of(r[n.id]=!0,this.proxyCoords)){let i=this.proxyToSource[e.key][n.id];if(i)for(let e of i)this._clearRenderCacheForTile(n.id,e)}}}_clearRasterLayersFromRenderCache(){let e=!1;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i]._source instanceof eS){e=!0;break}if(!e)return;let i={};for(let e=0;e<this._style.order.length;++e){let r=this._style._mergedLayers[this._style.order[e]],a=this._style.getLayerSourceCache(r);if(!a||i[a.id]||r.isHidden(this.painter.transform.zoom)||"raster"!==r.type)continue;let n=r.paint.get("raster-fade-duration");for(let e of this.proxyCoords){let i=this.proxyToSource[e.key][a.id];if(i)for(let e of i){let i=rr(a.getTile(e),a.findLoadedParent(e,0),a,this.painter.transform,n);(1!==i.opacity||0!==i.mix)&&this._clearRenderCacheForTile(a.id,e)}}}}_setupDrapedRenderBatches(){let i=this._style.order,r=i.length;if(0===r)return;let a=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[i[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._mergedLayers[i[o]];for(;o<r;++o){let e=this._style._mergedLayers[i[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(a.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&a.push({start:n,end:o-1}),0!==a.length){let i=a[a.length-1];this._pendingGroundEffectLayers.every(e=>e>i.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=a}_setupRenderCache(e){let i=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,i.renderCache.length>i.renderCachePool.length){let e=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(let r=0;r<e.length;++r){let a=Object.values(e[r]);i.renderCachePool.push(...a)}}return}this._clearRasterLayersFromRenderCache();let r=this.proxyCoords,a=this._tilesDirty;for(let n=r.length-1;n>=0;n--){let o=r[n];if(i.getTileByID(o.key),void 0!==i.proxyCachedFBO[o.key]){let r=e[o.key],n=this.proxyToSource[o.key],s=0;for(let e in n){let i=n[e],o=r[e];if(!o||o.length!==i.length||i.some((i,r)=>i!==o[r]||a[e]&&a[e].hasOwnProperty(i.key))){s=-1;break}++s}for(let e in i.proxyCachedFBO[o.key])i.renderCache[i.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(r).length}}let n=[...this._drapedRenderBatches];for(let e of(n.sort((e,i)=>i.end-i.start-(e.end-e.start)),n))for(let a of r){if(i.proxyCachedFBO[a.key])continue;let r=i.renderCachePool.pop();void 0===r&&i.renderCache.length<50&&(r=i.renderCache.length,i.renderCache.push(this._createFBO())),void 0!==r&&(i.proxyCachedFBO[a.key]={},i.proxyCachedFBO[a.key][e.start]=r,i.renderCache[r].dirty=!0)}this._tilesDirty={}}_setupStencil(e,i,r,a){let n;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let o=this.painter.context,s=o.gl;if(i.length<=1)return void(this._overlapStencilType=!1);if(r.isTileClipped())n=i.length,this._overlapStencilMode.test={func:s.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(i[0].overscaledZ>
94i[i.length-1].overscaledZ))return void(this._overlapStencilType=!1);n=1,this._overlapStencilMode.test={func:s.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+n>255&&(o.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=n,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&&this._renderTileClippingMasks(i,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):tc.disabled}_renderTileClippingMasks(e,i){let r=this.painter,a=this.painter.context,n=a.gl;r._tileClippingMaskIDs={},a.setColorMode(td.disabled),a.setDepthMode(tu.disabled);let o=r.getOrCreateProgram("clippingMask");for(let a of e){let e=r._tileClippingMaskIDs[a.key]=--i;o.draw(r,n.TRIANGLES,tu.disabled,new tc({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),td.disabled,tp.disabled,ri(a.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(i){let r=this.painter.transform;if(i.x<0||i.x>r.width||i.y<0||i.y>r.height)return null;let a=[i.x,i.y,1,1];e.a7.transformMat4(a,a,r.pixelMatrixInverse),e.a7.scale(a,a,1/a[3]),a[0]/=r.worldSize,a[1]/=r.worldSize;let n=r._camera.position,o=e.bl(1,r.center.lat),s=[n[0],n[1],n[2]/o,0],l=e.N.subtract([],a.slice(0,3),s);e.N.normalize(l,l);let h=this.raycast(s,l,this._exaggeration);return null!==h&&h?(e.N.scaleAndAdd(s,s,l,h),s[3]=s[2],s[2]*=o,s):null}drawDepth(){let i=this.painter,r=i.context,a=this.proxySourceCache,n=Math.ceil(i.width),o=Math.ceil(i.height);if(this._depthFBO&&(this._depthFBO.width!==n||this._depthFBO.height!==o)&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){let i=r.gl,a=r.createFramebuffer(n,o,!0,"renderbuffer");r.activeTexture.set(i.TEXTURE0);let s=new e.T(r,{width:n,height:o,data:null},i.RGBA);s.bind(i.NEAREST,i.CLAMP_TO_EDGE),a.colorAttachment.set(s.texture);let l=r.createRenderbuffer(r.gl.DEPTH_COMPONENT16,n,o);a.depthAttachment.set(l),this._depthFBO=a,this._depthTexture=s}r.bindFramebuffer.set(this._depthFBO.framebuffer),r.viewport.set([0,0,n,o]),function(e,i,r,a){if("globe"===e.transform.projection.name)return;let n=e.context,o=n.gl;n.clear({depth:1});let s=e.getOrCreateProgram("terrainDepth"),l=new tu(o.LESS,tu.ReadWrite,e.depthRangeFor3D);for(let n of a){let a=r.getTile(n),h=i6(n.projMatrix,0,[0,0,0]);i.setupElevationDraw(a,s),s.draw(e,o.TRIANGLES,l,tc.disabled,td.unblended,tp.backCCW,h,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(i,this,a,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,a){if(i.getSource() instanceof e.ap)return this._setupProxiedCoordsForImageSource(i,r,a);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords;for(let e=0;e<o.length;e++){let r=o[e],s=this._findTileCoveringTileID(r,i);if(s){let e=this._createProxiedId(r,s,a[r.key]&&a[r.key][i.id]);n.push(e),this.proxyToSource[r.key][i.id]=[e]}}let s=!1,l=new Set;for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData())continue;let h=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(h&&h.tileID.canonical.z!==o.tileID.canonical.z){let e=this.proxyToSource[h.tileID.key][i.id],r=this._createProxiedId(h.tileID,o,a[h.tileID.key]&&a[h.tileID.key][i.id]);e?e.splice(e.length-1,0,r):this.proxyToSource[h.tileID.key][i.id]=[r];let u=this.proxyToSource[h.tileID.key][i.id];l.has(u)||l.add(u),n.push(r),s=!0}}if(this._sourceTilesOverlap[i.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(let e of l)e.sort((e,i)=>i.overscaledZ-e.overscaledZ)}
94_setupProxiedCoordsForImageSource(i,r,a){if(!i.getSource().loaded())return;let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords,s=i.getSource(),l=s.tileID;if(!l)return;let h=new e.P(l.x,l.y)._div(1<<l.z),u=s.coordinates.map(e.L.fromLngLat).reduce((e,i)=>(e.min.x=Math.min(e.min.x,i.x-h.x),e.min.y=Math.min(e.min.y,i.y-h.y),e.max.x=Math.max(e.max.x,i.x-h.x),e.max.y=Math.max(e.max.y,i.y-h.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(i,r)=>{let a=i.wrap+i.canonical.x/(1<<i.canonical.z),n=i.canonical.y/(1<<i.canonical.z),o=e.V/(1<<i.canonical.z),s=r.wrap+r.canonical.x/(1<<r.canonical.z),l=r.canonical.y/(1<<r.canonical.z);return a+o<s+u.min.x||a>s+u.max.x||n+o<l+u.min.y||n>l+u.max.y};for(let e=0;e<o.length;e++){let s=o[e];for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData()||c(s,o.tileID))continue;let l=this._createProxiedId(s,o,a[s.key]&&a[s.key][i.id]),h=this.proxyToSource[s.key][i.id];h?h.push(l):this.proxyToSource[s.key][i.id]=[l],n.push(l)}}}_createProxiedId(i,r,a){let n=this.orthoMatrix;if(a){let e=a.find(e=>e.key===r.tileID.key);if(e)return e}if(r.tileID.key!==i.key){let a,o,s;let l=i.canonical.z-r.tileID.canonical.z;n=e.a6.create();let h=r.tileID.wrap-i.wrap<<i.overscaledZ;l>0?(o=(a=e.V>>l)*((r.tileID.canonical.x<<l)-i.canonical.x+h),s=a*((r.tileID.canonical.y<<l)-i.canonical.y)):(a=e.V<<-l,o=e.V*(r.tileID.canonical.x-(i.canonical.x+h<<-l)),s=e.V*(r.tileID.canonical.y-(i.canonical.y<<-l))),e.a6.ortho(n,0,a,0,a,0,1),e.a6.translate(n,n,[o,s,0])}return new ro(r.tileID,i.key,n)}_findTileCoveringTileID(i,r){let a=r.getTile(i);if(a&&a.hasData())return a;let n=this._findCoveringTileCache[r.id],o=n[i.key];if((a=o?r.getTileByID(o):null)&&a.hasData()||null===o)return a;let s=a?a.tileID:i,l=s.overscaledZ,h=r.getSource().minzoom,u=[];if(!o){let n=r.getSource().maxzoom;if(i.canonical.z>=n){let a=i.canonical.z-n;r.getSource().reparseOverscaled?(l=Math.max(i.canonical.z+2,r.transform.tileZoom),s=new e.am(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a)):0!==a&&(l=n,s=new e.am(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a))}s.key!==i.key&&(u.push(s.key),a=r.getTile(s))}let c=e=>{u.forEach(i=>{n[i]=e}),u.length=0};for(l-=1;l>=h&&(!a||!a.hasData());l--){a&&c(a.tileID.key);let e=s.calculateScaledKey(l);if((a=r.getTileByID(e))&&a.hasData())break;let i=n[e];if(null===i)break;void 0===i?u.push(e):a=r.getTileByID(i)}return c(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,i){let r=this._tilesDirty[e];r||(r=this._tilesDirty[e]={}),r[i.key]=!0}}let rl=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rh=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class ru{static cacheKey(e,i,r,a){let n=`${i}${a?a.cacheKey:""}`;for(let i of r)e.usedDefines.includes(i)&&(n+=`/${i}`);return n}constructor(i,r,a,n,o,s,l){let h=i.gl;this.program=h.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...s];let u=n?n.getBinderAttributes():[],c=(a.staticAttributes||[]).concat(u),d=n?n.defines():[];d=d.concat(s.map(e=>`#define ${e}`));let p="#version 300 es\n",f=p+d.concat("precision mediump float;",iN,iQ.fragmentSource).join("\n");for(let e of a.fragmentIncludes)f+=` 95${iK[e]}`;f+=` 96${a.fragmentSource}`;let m=p+d.concat("precision highp float;",iN,iQ.vertexSource).join("\n");for(let e of a.vertexIncludes)m+=` 97${iK[e]}`;m+=` 98${a.vertexSource}`;let _=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(_,f),h.compileShader(_),h.attachShader(this.program,_);let g=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())this.failedToCreate=!0;else{h.shaderSource(g,m),h.compileShader(g),h.attachShader(this.program,g),this.attributes={},this.numAttributes=c.length;for(let e=0;e<this.numAttributes;e++)if(c[e]){let i=c[e].startsWith("a_")?c[e]:`a_${c[e]}`;h.bindAttribLocation(this.program,e,i),this.attributes[i]=e}l&&l.shaderVaryings.length>0&&h.transformFeedbackVaryings(this.program,l.shaderVaryings,l.bufferMode),h.linkProgram(this.program),h.deleteShader(g),h.deleteShader(_),this.fixedUniforms=o(i),this.binderUniforms=n?n.getUniforms(i):[],s.includes("TERRAIN")&&(this.terrainUniforms={u_dem:new e.bO(i),u_dem_prev:new e.bO(i),u_dem_tl:new e.b
98L(i),u_dem_scale:new e.bN(i),u_dem_tl_prev:new e.bL(i),u_dem_scale_prev:new e.bN(i),u_dem_size:new e.bN(i),u_dem_lerp:new e.bN(i),u_exaggeration:new e.bN(i),u_depth:new e.bO(i),u_depth_size_inv:new e.bL(i),u_meter_to_dem:new e.bN(i),u_label_plane_matrix_inv:new e.bK(i)}),s.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new e.bM(i),u_tile_tr_up:new e.bM(i),u_tile_br_up:new e.bM(i),u_tile_bl_up:new e.bM(i),u_tile_up_scale:new e.bN(i)}),s.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new e.bK(i),u_fog_range:new e.bL(i),u_fog_color:new e.bP(i),u_fog_horizon_blend:new e.bN(i),u_fog_vertical_limit:new e.bL(i),u_fog_temporal_offset:new e.bN(i),u_frustum_tl:new e.bM(i),u_frustum_tr:new e.bM(i),u_frustum_br:new e.bM(i),u_frustum_bl:new e.bM(i),u_globe_pos:new e.bM(i),u_globe_radius:new e.bN(i),u_globe_transition:new e.bN(i),u_is_globe:new e.bO(i),u_viewport:new e.bL(i)}),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new e.bP(i)}),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new e.bM(i),u_lighting_directional_dir:new e.bM(i),u_lighting_directional_color:new e.bM(i),u_ground_radiance:new e.bM(i)}),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new e.bK(i),u_light_matrix_1:new e.bK(i),u_fade_range:new e.bL(i),u_shadow_normal_offset:new e.bM(i),u_shadow_intensity:new e.bN(i),u_shadow_texel_size:new e.bN(i),u_shadow_map_resolution:new e.bN(i),u_shadow_direction:new e.bM(i),u_shadow_bias:new e.bM(i),u_shadowmap_0:new e.bO(i),u_shadowmap_1:new e.bO(i)})}}setTerrainUniformValues(e,i){if(!this.terrainUniforms)return;let r=this.terrainUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setGlobeUniformValues(e,i){if(!this.globeUniforms)return;let r=this.globeUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setFogUniformValues(e,i){if(!this.fogUniforms)return;let r=this.fogUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setCutoffUniformValues(e,i){if(!this.cutoffUniforms)return;let r=this.cutoffUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setLightsUniformValues(e,i){if(!this.lightsUniforms)return;let r=this.lightsUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setShadowUniformValues(e,i){if(this.failedToCreate||!this.shadowUniforms)return;let r=this.shadowUniforms;for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}_drawDebugWireframe(i,r,a,n,o,s,l,h,u,c){let d=i.options.wireframe;if(!1===d.terrain&&!1===d.layers2D&&!1===d.layers3D)return;let p=i.context;if(!(!(!d.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!d.layers2D||i._terrain&&i._terrain.renderingToTexture||!rl.includes(this.name))||!(!d.layers3D||!rh.includes(this.name))))return;let f=p.gl,m=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,o,p);if(!m)return;let _=[...this.fixedDefines];_.push("DEBUG_WIREFRAME");let g=i.getOrCreateProgram(this.name,{config:this.configuration,defines:_});p.program.set(g.program);let y=(e,i,r)=>{if(i[e]&&r[e])for(let a in i[e])r[e][a]&&r[e][a].set(r.program,a,i[e][a].current)};u&&u.setUniforms(g.program,p,g.binderUniforms,l,{zoom:h}),y("fixedUniforms",this,g),y("terrainUniforms",this,g),y("globeUniforms",this,g),y("fogUniforms",this,g),y("lightsUniforms",this,g),y("shadowUniforms",this,g),m.bind(),p.setColorMode(new td([f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ZERO,f.ONE],e.ax.transparent,[!0,!0,!0,!1])),p.setDepthMode(new tu(r.func===f.LESS?f.LEQUAL:r.func,tu.ReadOnly,r.range)),p.setStencilMode(tc.disabled);let x=3*s.primitiveLength*2,v=3*s.primitiveOffset*4;c&&c>1?f.drawElementsInstanced(f.LINES,x,f.UNSIGNED_SHORT,v,c):f.drawElements(f.LINES,x,f.UNSIGNED_SHORT,v),o.bind(),p.program.set(this.program),p.setDepthMode(r),p.setStencilMode(a),p.setColorMode(n)}draw(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=e.context,x=y.gl;if(this.failedToCreate)return;for(let e of(y.program.set(this.program),y.setDepthMode(r),y.setStencilMode(a),y.setColorMode(n),y.setCullFace(o),Object.keys(this.fixedUniforms)))this.fixedUniforms[e].set(this.program,e,s[e]);f&&f.setUniforms(this.program,y,this.binderUniforms,d,{zoom:p});let v={[x.POINTS]:1,[x.LINES]:2,[x.TRIANGLES]:3,[x.LINE_STRIP]:1}[i],b=g&&g.length>0;if(b){for(let e of g)x.bindBufferBase(x.TRANSFORM_FEEDBACK_BUFFER,e.targetIndex,e.buffer.buffer);x.beginTransformFeedback(i)}let w=_&&_>0?1:void 0;for(let o of c.get()){let s=o.vaos||(o.vaos={});(s[l]||(s[l]=new i3)).bind(y,this,h,f?f.getPaintVertexBuffers():[],u,o.vertexOffset,m||[],w),_&&_>1?x.drawElementsInstanced(i,o.primitiveLength*v,x.UNSIGNED_SHORT,o.primitiveOffset*v*2,_):u?x.drawElements(i,o.primitiveLength*v,x.UNSIGNED_SHORT,o.primitiveOffset*v*2):x.drawArrays(i,o.vertexOffset,o.vertexLength),i===x.TRIANGLES&&u&&this._drawDebugWireframe(e,r,a,n,u,o,d,p,f,_)}
98b&&x.endTransformFeedback()}}function rc(i,r){let a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,i.transform.tileZoom)/a,o=n*(r.tileID.canonical.x+r.tileID.wrap*a),s=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.a3(r,1,i.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let rd=e.a6.create(),rp=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g)=>{let y=r.style.light,x=y.properties.get("position"),v=[x.x,x.y,x.z],b=e.co.create();"viewport"===y.properties.get("anchor")&&(e.co.fromRotation(b,-r.transform.angle),e.N.transformMat3(v,v,b));let w=y.properties.get("color"),T=r.transform,M={u_matrix:i,u_lightpos:v,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rd,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:s,u_flood_light_color:p,u_vertical_scale:f,u_flood_light_intensity:m,u_ground_shadow_factor:_,u_emissive_strength:g};return"globe"===T.projection.name&&(M.u_tile_id=[l.canonical.x,l.canonical.y,1<<l.canonical.z],M.u_zoom_transition=u,M.u_inv_rot_matrix=d,M.u_merc_center=c,M.u_up_dir=T.projection.upVector(new e.bs(0,0,0),c[0]*e.V,c[1]*e.V),M.u_height_lift=h),M},rf=(e,i,r)=>({u_matrix:e,u_edge_radius:i,u_vertical_scale:r}),rm=(i,r,a,n,o,s,l,h,u,c,d,p,f,m)=>{let _=rp(i,r,a,n,o,s,l,u,c,d,p,f,m,1,[0,0,0],0),g={u_height_factor:-Math.pow(2,l.overscaledZ)/h.tileSize/8};return e.e(_,rc(r,h),g)},r_=(e,i)=>({u_matrix:e,u_emissive_strength:i}),rg=(i,r,a,n)=>e.e(r_(i,r),rc(a,n)),ry=(e,i,r)=>({u_matrix:e,u_world:r,u_emissive_strength:i}),rx=(i,r,a,n,o)=>e.e(rg(i,r,a,n),{u_world:o}),rv=(i,r,a,n)=>{let o=e.V/a.tileSize;return{u_matrix:i,u_camera_to_center_distance:r.getCameraToCenterDistance(n),u_extrude_scale:[r.pixelsToGLUnits[0]/o,r.pixelsToGLUnits[1]/o]}},rb=(e,i,r=1)=>({u_matrix:e,u_color:i,u_overlay:0,u_overlay_scale:r}),rw=e.a6.create(),rT=(i,r,a,n,o,s,l)=>{let h=i.transform,u="globe"===h.projection.name,c=u?e.cp(h.zoom,r.canonical)*h._pixelsPerMercatorPixel:e.a3(a,1,s),d={u_matrix:r.projMatrix,u_extrude_scale:c,u_intensity:l,u_inv_rot_matrix:rw,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){d.u_inv_rot_matrix=n,d.u_merc_center=o,d.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],d.u_zoom_transition=e.S(h.zoom);let i=o[0]*e.V,a=o[1]*e.V;d.u_up_dir=h.projection.upVector(new e.bs(0,0,0),i,a)}return d};function rM(e,[i,r,a,n],[o,s]){if(o===s)return[0,0,0,0];let l=255*(e-1)/(e*(s-o));return[i*l,r*l,a*l,n*l]}function rE(e,i,[r,a]){return r===a?0:.5/e+(i-r)*(e-1)/(e*(a-r))}let rS=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)=>{var T,M;return{u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:(M=p.paint.get("raster-saturation"))>0?1-1/(1.001-M):-M,u_contrast_factor:(T=p.paint.get("raster-contrast"))>0?1/(1-T):1+T,u_spin_weights:function(e){let i=Math.sin(e*=Math.PI/180),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*i-r+1)/3,(Math.sqrt(3)*i-r+1)/3]}(p.paint.get("raster-hue-rotate")),u_perspective_transform:f,u_raster_elevation:m,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u,u_colorization_mix:rM(e.cq,g,x),u_colorization_offset:rE(e.cq,y,x),u_color_ramp:_,u_texture_offset:[b/(v+2*b),v/(v+2*b)],u_texture_res:[v+2*b,v+2*b],u_emissive_strength:w}},rA=(e,i,r,a,n,o,s,l,h,u,c,d)=>({u_matrix:e,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:a,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:u,u_fade_t:c.mix,u_opacity:c.opacity,u_image0:0,u_image1:1,u_raster_elevation:d,u_zoom_transition:s,u_merc_center:l,u_cutoff_params:h}),rI=(e,i,r,a,n,o,s,l)=>({u_tile_offset:e,u_velocity:i,u_color_ramp:a,u_velocity_res:r,u_max_speed:n,u_texture_offset:o,u_data_scale:s,u_data_offset:l}),rC=(e,i,r,a,n,o,s,l)=>({u_velocity:e,u_velocity_res:i,u_max_speed:r,u_speed_factor:a,u_lifetime_delta:n,u_rand_seed:Math.random(),u_texture_offset:o,u_data_scale:s,u_data_offset:l}),rP=e.a6.create(),rz=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=o.transform,b={u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:v.getCameraToCenterDistance(g),u_rotate_symbol:+a,u_aspect_ratio:v.width/v.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+u,u_pitch_with_map:+n,u_texsize:c,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:rP,u_up_vector:[0,-1,0],u_icon_transition:x||0,u_icon_saturation:y};return"globe"===g.name&&(b.u_tile_id=[d.canonical.x,d.canonical.y,1<<d.canonical.z],b.u_zoom_transition=p,b.u_inv_rot_matrix=m,b.u_merc_center=f,b.u_camera_forward=v._camera.forward(),b.u_ecef_origin=e.cr(v.globeMatrix,d.toUnwrapped()),b.u_tile_matrix=Float32Array.from(v.globeMatrix),b.u_up_vector=_),b},rD=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y)=>e.e(rz(i,r,a,n,o,s,l,h,u,c,p,f,m,_,g,y,1),{u_gamma_scale:n?o.transform.getCameraToCenterDistance(y)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.f.devicePixelRatio,u_is_halo:+d,undefined:void 0}
98),rL=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g)=>e.e(rD(i,r,a,n,o,s,l,h,!0,u,!0,d,p,f,m,_,g),{u_texsize_icon:c,u_texture_icon:1}),rR=(e,i,r,a)=>({u_matrix:e,u_emissive_strength:i,u_opacity:r,u_color:a}),rk=(i,r,a,n,o,s,l)=>e.e(function(i,r,a,n){let o=a.imageManager.getPattern(i.toString(),r),{width:s,height:l}=a.imageManager.getPixelSize(r),h=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,a.transform.tileZoom)/h,c=u*(n.tileID.canonical.x+n.tileID.wrap*h),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl:o.tl,u_pattern_br:o.br,u_texsize:[s,l],u_pattern_size:o.displaySize,u_tile_units_to_pixels:1/e.a3(n,1,a.transform.tileZoom),u_pixel_coord_upper:[c>>16,d>>16],u_pixel_coord_lower:[65535&c,65535&d]}}(o,s,n,l),{u_matrix:i,u_emissive_strength:r,u_opacity:a}),rO=(i,r,a,n,o,s,l,h,u,c,d,p,f=[0,0,0],m)=>{let _=n.style.light,g=_.properties.get("position"),y=[-g.x,-g.y,g.z],x=e.co.create();"viewport"===_.properties.get("anchor")&&(e.co.fromRotation(x,-n.transform.angle),e.N.transformMat3(y,y,x));let v="MASK"===c.alphaMode,b=_.properties.get("color"),w=p.paint.get("model-ambient-occlusion-intensity"),T=p.paint.get("model-color").constantOr(e.ax.white),M=p.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:i,u_lighting_matrix:r,u_normal_matrix:a,u_lightpos:y,u_lightintensity:_.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_camera_pos:f,u_opacity:o,u_baseTextureIsAlpha:0,u_alphaMask:+v,u_alphaCutoff:c.alphaCutoff,u_baseColorFactor:[s.r,s.g,s.b,s.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:h,u_roughnessFactor:u,u_baseColorTexture:iT.BaseColor,u_metallicRoughnessTexture:iT.MetallicRoughness,u_normalTexture:iT.Normal,u_occlusionTexture:iT.Occlusion,u_emissionTexture:iT.Emission,u_color_mix:[T.r,T.g,T.b,M],u_aoIntensity:w,u_emissive_strength:d,u_occlusionTextureTransform:m||[0,0,0,0]}},rB=new Float32Array(16),rF=(e,i=rB,r=rB)=>({u_matrix:e,u_instance:i,u_node_matrix:r}),rN={fillExtrusion:i=>({u_matrix:new e.bK(i),u_lightpos:new e.bM(i),u_lightintensity:new e.bN(i),u_lightcolor:new e.bM(i),u_vertical_gradient:new e.bN(i),u_opacity:new e.bN(i),u_edge_radius:new e.bN(i),u_ao:new e.bL(i),u_tile_id:new e.bM(i),u_zoom_transition:new e.bN(i),u_inv_rot_matrix:new e.bK(i),u_merc_center:new e.bL(i),u_up_dir:new e.bM(i),u_height_lift:new e.bN(i),u_flood_light_color:new e.bM(i),u_vertical_scale:new e.bN(i),u_flood_light_intensity:new e.bN(i),u_ground_shadow_factor:new e.bM(i),u_emissive_strength:new e.bN(i)}),fillExtrusionDepth:i=>({u_matrix:new e.bK(i),u_edge_radius:new e.bN(i),u_vertical_scale:new e.bN(i)}),fillExtrusionPattern:i=>({u_matrix:new e.bK(i),u_lightpos:new e.bM(i),u_lightintensity:new e.bN(i),u_lightcolor:new e.bM(i),u_vertical_gradient:new e.bN(i),u_height_factor:new e.bN(i),u_edge_radius:new e.bN(i),u_ao:new e.bL(i),u_tile_id:new e.bM(i),u_zoom_transition:new e.bN(i),u_inv_rot_matrix:new e.bK(i),u_merc_center:new e.bL(i),u_up_dir:new e.bM(i),u_height_lift:new e.bN(i),u_image:new e.bO(i),u_texsize:new e.bL(i),u_pixel_coord_upper:new e.bL(i),u_pixel_coord_lower:new e.bL(i),u_tile_units_to_pixels:new e.bN(i),u_opacity:new e.bN(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new e.bK(i),u_opacity:new e.bN(i),u_ao_pass:new e.bN(i),u_meter_to_tile:new e.bN(i),u_ao:new e.bL(i),u_flood_light_intensity:new e.bN(i),u_flood_light_color:new e.bM(i),u_attenuation:new e.bN(i),u_edge_radius:new e.bN(i),u_fb:new e.bO(i),u_fb_size:new e.bN(i)}),fill:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i)}),fillPattern:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i),u_image:new e.bO(i),u_texsize:new e.bL(i),u_pixel_coord_upper:new e.bL(i),u_pixel_coord_lower:new e.bL(i),u_tile_units_to_pixels:new e.bN(i)}),fillOutline:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i),u_world:new e.bL(i)}),fillOutlinePattern:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i),u_world:new e.bL(i),u_image:new e.bO(i),u_texsize:new e.bL(i),u_pixel_coord_upper:new e.bL(i),u_pixel_coord_lower:new e.bL(i),u_tile_units_to_pixels:new e.bN(i)}),circle:e.cs,collisionBox:i=>({u_matrix:new e.bK(i),u_camera_to_center_distance:new e.bN(i),u_extrude_scale:new e.b
98L(i)}),collisionCircle:i=>({u_matrix:new e.bK(i),u_inv_matrix:new e.bK(i),u_camera_to_center_distance:new e.bN(i),u_viewport_size:new e.bL(i)}),debug:i=>({u_color:new e.ca(i),u_matrix:new e.bK(i),u_overlay:new e.bO(i),u_overlay_scale:new e.bN(i)}),clippingMask:i=>({u_matrix:new e.bK(i)}),heatmap:i=>({u_extrude_scale:new e.bN(i),u_intensity:new e.bN(i),u_matrix:new e.bK(i),u_inv_rot_matrix:new e.bK(i),u_merc_center:new e.bL(i),u_tile_id:new e.bM(i),u_zoom_transition:new e.bN(i),u_up_dir:new e.bM(i)}),heatmapTexture:i=>({u_image:new e.bO(i),u_color_ramp:new e.bO(i),u_opacity:new e.bN(i)}),hillshade:i=>({u_matrix:new e.bK(i),u_image:new e.bO(i),u_latrange:new e.bL(i),u_light:new e.bL(i),u_shadow:new e.ca(i),u_highlight:new e.ca(i),u_emissive_strength:new e.bN(i),u_accent:new e.ca(i)}),hillshadePrepare:i=>({u_matrix:new e.bK(i),u_image:new e.bO(i),u_dimension:new e.bL(i),u_zoom:new e.bN(i)}),line:e.ct,linePattern:e.cu,raster:i=>({u_matrix:new e.bK(i),u_normalize_matrix:new e.bK(i),u_globe_matrix:new e.bK(i),u_merc_matrix:new e.bK(i),u_grid_matrix:new e.cb(i),u_tl_parent:new e.bL(i),u_scale_parent:new e.bN(i),u_fade_t:new e.bN(i),u_opacity:new e.bN(i),u_image0:new e.bO(i),u_image1:new e.bO(i),u_brightness_low:new e.bN(i),u_brightness_high:new e.bN(i),u_saturation_factor:new e.bN(i),u_contrast_factor:new e.bN(i),u_spin_weights:new e.bM(i),u_perspective_transform:new e.bL(i),u_raster_elevation:new e.bN(i),u_zoom_transition:new e.bN(i),u_merc_center:new e.bL(i),u_cutoff_params:new e.bP(i),u_colorization_mix:new e.bP(i),u_colorization_offset:new e.bN(i),u_color_ramp:new e.bO(i),u_texture_offset:new e.bL(i),u_texture_res:new e.bL(i),u_emissive_strength:new e.bN(i)}),rasterParticle:i=>({u_matrix:new e.bK(i),u_normalize_matrix:new e.bK(i),u_globe_matrix:new e.bK(i),u_merc_matrix:new e.bK(i),u_grid_matrix:new e.cb(i),u_tl_parent:new e.bL(i),u_scale_parent:new e.bN(i),u_fade_t:new e.bN(i),u_opacity:new e.bN(i),u_image0:new e.bO(i),u_image1:new e.bO(i),u_raster_elevation:new e.bN(i),u_zoom_transition:new e.bN(i),u_merc_center:new e.bL(i),u_cutoff_params:new e.bP(i)}),rasterParticleTexture:i=>({u_texture:new e.bO(i),u_opacity:new e.bN(i)}),rasterParticleDraw:i=>({u_tile_offset:new e.bL(i),u_velocity:new e.bO(i),u_color_ramp:new e.bO(i),u_velocity_res:new e.bL(i),u_max_speed:new e.bN(i),u_texture_offset:new e.bL(i),u_data_scale:new e.bP(i),u_data_offset:new e.bN(i)}),rasterParticleUpdate:i=>({u_velocity:new e.bO(i),u_velocity_res:new e.bL(i),u_max_speed:new e.bN(i),u_speed_factor:new e.bN(i),u_lifetime_delta:new e.bN(i),u_rand_seed:new e.bN(i),u_texture_offset:new e.bL(i),u_data_scale:new e.bP(i),u_data_offset:new e.bN(i)}),symbolIcon:i=>({u_is_size_zoom_constant:new e.bO(i),u_is_size_feature_constant:new e.bO(i),u_size_t:new e.bN(i),u_size:new e.bN(i),u_camera_to_center_distance:new e.bN(i),u_rotate_symbol:new e.bO(i),u_aspect_ratio:new e.bN(i),u_fade_change:new e.bN(i),u_matrix:new e.bK(i),u_label_plane_matrix:new e.bK(i),u_coord_matrix:new e.bK(i),u_is_text:new e.bO(i),u_pitch_with_map:new e.bO(i),u_texsize:new e.bL(i),u_tile_id:new e.bM(i),u_zoom_transition:new e.bN(i),u_inv_rot_matrix:new e.bK(i),u_merc_center:new e.bL(i),u_camera_forward:new e.bM(i),u_tile_matrix:new e.bK(i),u_up_vector:new e.bM(i),u_ecef_origin:new e.bM(i),u_texture:new e.bO(i),u_icon_transition:new e.bN(i),u_icon_saturation:new e.bN(i)}),symbolSDF:i=>({u_is_size_zoom_constant:new e.bO(i),u_is_size_feature_constant:new e.bO(i),u_size_t:new e.bN(i),u_size:new e.bN(i),u_camera_to_center_distance:new e.bN(i),u_rotate_symbol:new e.bO(i),u_aspect_ratio:new e.bN(i),u_fade_change:new e.bN(i),u_matrix:new e.bK(i),u_label_plane_matrix:new e.bK(i),u_coord_matrix:new e.bK(i),u_is_text:new e.bO(i),u_pitch_with_map:new e.bO(i),u_texsize:new e.bL(i),u_texture:new e.bO(i),u_gamma_scale:new e.bN(i),u_device_pixel_ratio:new e.bN(i),u_tile_id:new e.bM(i),u_zoom_transition:new e.bN(i),u_inv_rot_matrix:new e.bK(i),u_merc_center:new e.bL(i),u_camera_forward:new e.bM(i),u_tile_matrix:new e.bK(i),u_up_vector:new e.bM(i),u_ecef_origin:new e.bM(i),u_is_halo:new e.bO(i)}),symbolTextAndIcon:i=>({u_is_size_zoom_constant:new e.bO(i),u_is_size_feature_constant:new e.bO(i),u_size_t:new e.bN(i),u_size:new e.bN(i),u_camera_to_center_distance:new e.bN(i),u_rotate_symbol:new e.bO(i),u_aspect_ratio:new e.bN(i),u_fade_change:new e.bN(i),u_matrix:new e.bK(i),u_label_plane_matrix:new e.bK(i),u_coord_matrix:new e.bK(i),u_is_text:new e.bO(i),u_pitch_with_map:new e.bO(i),u_texsize:new e.b
98L(i),u_texsize_icon:new e.bL(i),u_texture:new e.bO(i),u_texture_icon:new e.bO(i),u_gamma_scale:new e.bN(i),u_device_pixel_ratio:new e.bN(i),u_is_halo:new e.bO(i)}),background:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i),u_opacity:new e.bN(i),u_color:new e.ca(i)}),backgroundPattern:i=>({u_matrix:new e.bK(i),u_emissive_strength:new e.bN(i),u_opacity:new e.bN(i),u_image:new e.bO(i),u_pattern_tl:new e.bL(i),u_pattern_br:new e.bL(i),u_texsize:new e.bL(i),u_pattern_size:new e.bL(i),u_pixel_coord_upper:new e.bL(i),u_pixel_coord_lower:new e.bL(i),u_tile_units_to_pixels:new e.bN(i)}),terrainRaster:i4,terrainDepth:i4,skybox:i=>({u_matrix:new e.bK(i),u_sun_direction:new e.bM(i),u_cubemap:new e.bO(i),u_opacity:new e.bN(i),u_temporal_offset:new e.bN(i)}),skyboxGradient:i=>({u_matrix:new e.bK(i),u_color_ramp:new e.bO(i),u_center_direction:new e.bM(i),u_radius:new e.bN(i),u_opacity:new e.bN(i),u_temporal_offset:new e.bN(i)}),skyboxCapture:i=>({u_matrix_3f:new e.cb(i),u_sun_direction:new e.bM(i),u_sun_intensity:new e.bN(i),u_color_tint_r:new e.bP(i),u_color_tint_m:new e.bP(i),u_luminance:new e.bN(i)}),globeRaster:i=>({u_proj_matrix:new e.bK(i),u_globe_matrix:new e.bK(i),u_normalize_matrix:new e.bK(i),u_merc_matrix:new e.bK(i),u_zoom_transition:new e.bN(i),u_merc_center:new e.bL(i),u_image0:new e.bO(i),u_grid_matrix:new e.cb(i),u_skirt_height:new e.bN(i),u_far_z_cutoff:new e.bN(i),u_frustum_tl:new e.bM(i),u_frustum_tr:new e.bM(i),u_frustum_br:new e.bM(i),u_frustum_bl:new e.bM(i),u_globe_pos:new e.bM(i),u_globe_radius:new e.bN(i),u_viewport:new e.bL(i)}),globeAtmosphere:i=>({u_frustum_tl:new e.bM(i),u_frustum_tr:new e.bM(i),u_frustum_br:new e.bM(i),u_frustum_bl:new e.bM(i),u_horizon:new e.bN(i),u_transition:new e.bN(i),u_fadeout_range:new e.bN(i),u_color:new e.bP(i),u_high_color:new e.bP(i),u_space_color:new e.bP(i),u_temporal_offset:new e.bN(i),u_horizon_angle:new e.bN(i)}),model:i=>({u_matrix:new e.bK(i),u_lighting_matrix:new e.bK(i),u_normal_matrix:new e.bK(i),u_lightpos:new e.bM(i),u_lightintensity:new e.bN(i),u_lightcolor:new e.bM(i),u_camera_pos:new e.bM(i),u_opacity:new e.bN(i),u_baseColorFactor:new e.bP(i),u_emissiveFactor:new e.bP(i),u_metallicFactor:new e.bN(i),u_roughnessFactor:new e.bN(i),u_baseTextureIsAlpha:new e.bO(i),u_alphaMask:new e.bO(i),u_alphaCutoff:new e.bN(i),u_baseColorTexture:new e.bO(i),u_metallicRoughnessTexture:new e.bO(i),u_normalTexture:new e.bO(i),u_occlusionTexture:new e.bO(i),u_emissionTexture:new e.bO(i),u_color_mix:new e.bP(i),u_aoIntensity:new e.bN(i),u_emissive_strength:new e.bN(i),u_occlusionTextureTransform:new e.bP(i)}),modelDepth:i=>({u_matrix:new e.bK(i),u_instance:new e.bK(i),u_node_matrix:new e.bK(i)}),groundShadow:i=>({u_matrix:new e.bK(i),u_ground_shadow_factor:new e.bM(i)}),stars:i=>({u_matrix:new e.bK(i),u_up:new e.bM(i),u_right:new e.bM(i),u_intensity_multiplier:new e.bN(i)})};function rV(i,a,n,o,s,l,h){let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("collisionBox"),f=[],m=0,_=0;for(let r=0;r<o.length;r++){let u=o[r],g=a.getTile(u),y=g.getBucket(n);if(!y)continue;let x=function(e,i,r){if(i.projection.name===r.projection.name)return e.projMatrix;let a=r.clone();return a.setProjection(i.projection),t1(a,i.getProjection(),e)}(u,y,d),v=x;0===s[0]&&0===s[1]||(v=i.translatePosMatrix(x,g,s,l));let b=h?y.textCollisionBox:y.iconCollisionBox,w=y.collisionCircleArray;if(w.length>0){let i=e.a6.create(),r=v;e.a6.mul(i,y.placementInvProjMatrix,d.glCoordMatrix),e.a6.mul(i,i,y.placementViewportMatrix),f.push({circleArray:w,circleOffset:_,transform:r,invTransform:i,projection:y.getProjection()}),m+=w.length/4,_=m}b&&(i.terrain&&i.terrain.setupElevationDraw(g,p),p.draw(i,c.LINES,tu.disabled,tc.disabled,i.colorModeForRenderPass(),tp.disabled,rv(v,d,g,y.getProjection()),n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,d.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}if(!h||!f.length)return;let g=i.getOrCreateProgram("collisionCircle"),y=new e.cv;y.resize(4*m),y._trim();let x=0;for(let e of f)for(let i=0;i<e.circleArray.length/4;i++){let r=4*i,a=e.circleArray[r+0],n=e.circleArray[r+1],o=e.circleArray[r+2],s=e.circleArray[r+3];y.emplace(x++,a,n,o,s,0),y.emplace(x++,a,n,o,s,1),y.emplace(x++,a,n,o,s,2),y.emplace(x++,a,n,o,s,3)}(!r||r.length<2*m)&&(r=function(i){let r=2*i,a=new e.aw;a.resize(r),a._trim();for(let e=0;e<r;e++){let i=6*e;a.uint16[i+0]=4*e+0,a.uint16[i+1]=4*e+1,a.uint16[i+2]=4*e+2,a.uint16[i+3]=4*e+2,a.uint16[i+4]=4*e+3,a.uint16[i+5]=4*e+0}return a}(m));let v=u.createIndexBuffer(r,!0),b=u.createVertexBuffer(y,e.cw.members,!0);for(let r of f){let a={u_matrix:r.transform,u_inv_matrix:r.invTransform,u_camera_to_center_distance:d.getCameraToCenterDistance(r.projection),u_viewport_size:[d.width,d.height]};g.draw(i,c.TRIANGLES,tu.disabled,tc.disabled,i.colorModeForRenderPass(),tp.disabled,a,n.id,b,v,e.aB.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,d.zoom)}b.destroy(),v.destroy()}let rU=e.a6.create();function rj(i){let r=i._camera.getWorldToCamera(i.worldSize,1),a=e.a6.multiply([],r,i.globeMatrix);e.a6.invert(a,a);let n=[0,0,0],o=[0,1,0,0];return e.a7.transformMat4(o,o,a),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.N.normalize(n,n),n}function rG(i,r,a,n,o,s,l={}){let h=a.paint.get("icon-translate"),u=a.paint.get("text-translate"),c=a.paint.get("icon-translate-anchor"),d=a.paint.get("text-translate-anchor"),p=a.layout.get("icon-rotation-alignment"),f=a.layout.get("text-rotation-alignment"),m=a.layout.get("icon-pitch-alignment"),_=a.layout.get("text-pitch-alignment"),g=a.layout.get("icon-keep-upright"),y=a.layout.get("text-keep-upright"),x=a.paint.get("icon-color-saturation"),v=i.context,b=v.gl,w=i.transform,T="map"===p,M="map"===f,E="map"===m,S="map"===_,A=void 0!==a.layout.get("symbol-sort-key").constantOr(1),I=!1,C=i.depthModeForSublayer(0,tu.ReadOnly),P=[e.a5(w.center.lng),e.ae(w.center.lat)],z=a.layout.get("text-variable-anchor"),D="globe"===w.projection.name,L=[],R=[0,-1,0];for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||"mercator"===s.projection.name&&D||s.fullyClipped)continue;let p="globe"===s.projection.name,f=p?e.S(w.zoom):0,m=t2(o,s.getProjection(),w),_=w.calculatePixelsToTileUnitsMatrix(n),v=z&&s.hasTextData(),C=s.hasIconTextFit()&&v&&s.hasIconData(),k=s.getProjection().createInversionMatrix(w,o.canonical),O=()=>{let r;let l=T&&"point"!==a.layout.get("symbol-placement"),u=[],d=l||C,y=a.paint.get("icon-image-cross-fade").constantOr(0);i.terrainRenderModeElevated()&&E&&u.push("PITCH_WITH_MAP_TERRAIN"),p&&(u.pu
98sh("PROJECTION_GLOBE_VIEW"),d&&u.push("PROJECTED_POS_ON_VIEWPORT")),y>0&&u.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&u.push("Z_OFFSET"),x<1&&u.push("SATURATION");let v=s.icon.programConfigurations.get(a.id),M=i.getOrCreateProgram(s.sdfIcons?"symbolSDF":"symbolIcon",{config:v,defines:u}),S=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],A=s.iconSizeData,I=e.b5(A,w.zoom),z=E||0!==w.pitch,L=tV(m,n.tileID.canonical,E,T,w,s.getProjection(),_),O=tj(m,n.tileID.canonical,E,T,w,s.getProjection(),_),B=i.translatePosMatrix(O,n,h,c,!0),F=i.translatePosMatrix(m,n,h,c),N=d?rU:L,V=T&&!E&&!l,U=R;(D||w.mercatorFromTransition)&&!T&&(U=rj(w));let j=p?U:R;r=s.sdfIcons&&!s.iconsInText?rD(A.kind,I,V,E,i,F,N,B,!1,S,!0,o,f,P,k,j,s.getProjection()):rz(A.kind,I,V,E,i,F,N,B,!1,S,o,f,P,k,j,s.getProjection(),x,y);let G=n.imageAtlasTexture?n.imageAtlasTexture:null,Z=1!==a.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,q=s.sdfIcons||i.options.rotating||i.options.zooming||Z||z?b.LINEAR:b.NEAREST,$=s.sdfIcons&&0!==a.paint.get("icon-halo-width").constantOr(1),W=i.terrain&&E&&l?e.a6.invert(e.a6.create(),L):rU;if(l&&s.icon){let e=w.elevation,r=e?e.getAtTileOffsetFunc(o,w.center.lat,w.worldSize,s.getProjection()):null,a=tU(m,n.tileID.canonical,E,T,w,s.getProjection(),_);tq(s,m,i,!1,a,O,E,g,r,o)}return{program:M,buffers:s.icon,uniformValues:r,atlasTexture:G,atlasTextureIcon:null,atlasInterpolation:q,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:$,tile:n,labelPlaneMatrixInv:W}},B=()=>{let r;let l=M&&"point"!==a.layout.get("symbol-placement"),h=[],c=l||z||C;i.terrainRenderModeElevated()&&S&&h.push("PITCH_WITH_MAP_TERRAIN"),p&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&h.push("Z_OFFSET");let g=s.text.programConfigurations.get(a.id),x=i.getOrCreateProgram(s.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:g,defines:h}),v,T=[0,0],E=null,A=s.textSizeData;s.iconsInText&&(T=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],E=n.imageAtlasTexture?n.imageAtlasTexture:null,v=S||0!==w.pitch||i.options.rotating||i.options.zooming||"composite"===A.kind||"camera"===A.kind?b.LINEAR:b.NEAREST);let I=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],L=e.b5(A,w.zoom),O=tV(m,n.tileID.canonical,S,M,w,s.getProjection(),_),B=tj(m,n.tileID.canonical,S,M,w,s.getProjection(),_),F=i.translatePosMatrix(B,n,u,d,!0),N=i.translatePosMatrix(m,n,u,d),V=c?rU:O,U=M&&!S&&!l,j=R;(D||w.mercatorFromTransition)&&!M&&(j=rj(w));let G=p?j:R;r=s.iconsInText?rL(A.kind,L,U,S,i,N,V,F,I,T,o,f,P,k,G,s.getProjection()):rD(A.kind,L,U,S,i,N,V,F,!0,I,!0,o,f,P,k,G,s.getProjection());let Z=n.glyphAtlasTexture?n.glyphAtlasTexture:null,q=b.LINEAR,$=0!==a.paint.get("text-halo-width").constantOr(1),W=i.terrain&&S&&l?e.a6.invert(e.a6.create(),O):rU;if(l&&s.text){let e=w.elevation,r=e?e.getAtTileOffsetFunc(o,w.center.lat,w.worldSize,s.getProjection()):null,a=tU(m,n.tileID.canonical,S,M,w,s.getProjection(),_);tq(s,m,i,!0,a,B,S,y,r,o)}return{program:x,buffers:s.text,uniformValues:r,atlasTexture:Z,atlasTextureIcon:E,atlasInterpolation:q,atlasInterpolationIcon:v,isSDF:!0,hasHalo:$,tile:n,labelPlaneMatrixInv:W}},F=s.icon.segments.get().length,N=s.text.segments.get().length,V=F&&!l.onlyText?O():null,U=N&&!l.onlyIcons?B():null,j=a.paint.get("icon-opacity").constantOr(1),G=a.paint.get("text-opacity").constantOr(1);if(A&&s.canOverlap){I=!0;let i=j&&!l.onlyText?s.icon.segments.get():[],r=G&&!l.onlyIcons?s.text.segments.get():[];for(let r of i)L.push({segments:new e.aB([r]),sortKey:r.sortKey,state:V});for(let i of r)L.push({segments:new e.aB([i]),sortKey:i.sortKey,state:U})}else l.onlyText||L.push({segments:j?s.icon.segments:new e.aB([]),sortKey:0,state:V}),l.onlyIcons||L.push({segments:G?s.text.segments:new e.aB([]),sortKey:0,state:U})}for(let e of(I&&L.sort((e,i)=>e.sortKey-i.sortKey),L)){let r=e.state;if(r){if(i.terrain&&i.terrain.setupElevationDraw(r.tile,r.program,{useDepthForOcclusion:w.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}),v.activeTexture.set(b.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,b.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(v.activeTexture.set(b.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,b.CLAMP_TO_EDGE,!0)),i.uploadCommonLightUniforms(i.context,r.program),r.hasHalo){let n=r.uniformValues;n.u_is_halo=1,rZ(r.buffers,e.segments,a,i,r.program,C,o,s,n,2),n.u_is_halo=0}else{if(r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,rZ(r.buffers,e.segments,a,i,r.program,C,o,s,n,1)),n.u_is_halo=0}rZ(r.buffers,e.segments,a,i,r.program,C,o,s,r.uniformValues,1)}}}}function rZ(e,i,r,a,n,o,s,l,h,u){let c=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(a,a.context.gl.TRIANGLES,o,s,l,tp.disabled,h,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,a.transform.zoom,e.programConfigurations.get(r.id),c,u)}function rq(e,i,r,a,n,o,s){let l,h,u,c,d;let p=e.context.gl,f=r.paint.get("fill-pattern"),m=f&&f.constantOr(1);for(let _ of(s?(h=m&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.L
98INES):(h=m?"fillPattern":"fill",l=p.TRIANGLES),a)){let a=i.getTile(_);if(m&&!a.patternsLoaded())continue;let g=a.getBucket(r);if(!g)continue;e.prepareDrawTile();let y=g.programConfigurations.get(r.id),x=e.isTileAffectedByFog(_),v=e.getOrCreateProgram(h,{config:y,overrideFog:x});m&&(e.context.activeTexture.set(p.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),y.updatePaintBuffers());let b=f.constantOr(null);if(b&&a.imageAtlas){let e=a.imageAtlas.patternPositions[b.toString()];e&&y.setConstantPatternPositions(e)}let w=e.translatePosMatrix(_.projMatrix,a,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),T=r.paint.get("fill-emissive-strength");if(s){c=g.indexBuffer2,d=g.segments2;let i=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];u="fillOutlinePattern"===h&&m?rx(w,T,e,a,i):ry(w,T,i)}else c=g.indexBuffer,d=g.segments,u=m?rg(w,T,e,a):r_(w,T);e.uploadCommonUniforms(e.context,v,_.toUnwrapped()),v.draw(e,l,n,e.stencilModeForClipping(_),o,tp.disabled,u,r.id,g.layoutVertexBuffer,c,d,r.paint,e.transform.zoom,y,void 0)}}function r$(i,r,a,n,o,s,l,h){let u;a.resetLayerRenderingStats(i);let c=i.context,d=c.gl,p=i.transform,f=a.paint.get("fill-extrusion-pattern"),m=f.constantOr(1),_=a.paint.get("fill-extrusion-opacity"),g=i.style.enable3dLights(),y=a.paint.get(g&&!m?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),x=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),y],v=a.layout.get("fill-extrusion-edge-radius"),b=v>0&&!a.paint.get("fill-extrusion-rounded-roof"),w=b?0:v,T="globe"===p.projection.name?e.cF():0,M="globe"===p.projection.name,E=M?e.S(p.zoom):0,S=[e.a5(p.center.lng),e.ae(p.center.lat)],A=a.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),I=a.paint.get("fill-extrusion-flood-light-intensity"),C=a.paint.get("fill-extrusion-vertical-scale"),P=iM(i,a.paint.get("fill-extrusion-cutoff-fade-range")),z=a.paint.get("fill-extrusion-emissive-strength"),D=[];M&&D.push("PROJECTION_GLOBE_VIEW"),x[0]>0&&D.push("FAUX_AO"),b&&D.push("ZERO_ROOF_RADIUS"),h&&D.push("HAS_CENTROID"),I>0&&D.push("FLOOD_LIGHT"),P.shouldRenderCutoff&&D.push("RENDER_CUTOFF");let L="shadow"===i.renderPass,R=i.shadowRenderer;i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0);let k=[0,0,0];if(R){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(k=iz(e,r)),u=D.concat(["SHADOWS_SINGLE_CASCADE"])}let O=L&&R?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",B=a.getLayerRenderingStats();for(let g of n){let n;let y=r.getTile(g),v=y.getBucket(a);if(!v||v.projection.name!==p.projection.name)continue;let b=!1;R&&(b=0===R.getMaxCascadeForTile(g.toUnwrapped()));let F=i.isTileAffectedByFog(g),N=v.programConfigurations.get(a.id),V=i.getOrCreateProgram(O,{config:N,defines:b?u:D,overrideFog:F});if(i.terrain&&i.terrain.setupElevationDraw(y,V,{useMeterToDem:!0}),!v.centroidVertexBuffer){let e=V.attributes.a_centroid_pos;void 0!==e&&d.vertexAttrib2f(e,0,0)}!L&&R&&R.setupShadows(y.tileID.toUnwrapped(),V,"vector-tile",y.tileID.overscaledZ),m&&(i.context.activeTexture.set(d.TEXTURE0),y.imageAtlasTexture&&y.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),N.updatePaintBuffers());let U=f.constantOr(null);if(U&&y.imageAtlas){let e=y.imageAtlas.patternPositions[U.toString()];e&&N.setConstantPatternPositions(e)}let j=a.paint.get("fill-extrusion-vertical-gradient");if(L&&R){if(function(i,r,a){let n=a.transform,o=a.shadowRenderer;if(!o)return!0;let s=i.toUnwrapped(),l=n.tileSize*o._cascades[a.currentShadowCascade].scale,h=r.maxHeight;if(n.elevation){let e=n.elevation.getMinMaxForTile(i);e&&(h+=e.max)}let u=[...o.shadowDirection];u[2]=-u[2];let c=o.computeSimplifiedTileShadowVolume(s,h,l,u);if(!c)return!1;let d=[rH,rX,rY,u,[u[0],0,u[2]],[0,u[1],u[2]]],p="globe"===n.projection.name,f=n.scaleZoom(l),m=e.bq.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,f,!p),_=o.getCurrentCascadeFrustum();return 0===m.intersectsPrecise(c.vertices,c.planes,d)||0===_.intersectsPrecise(c.vertices,c.planes,d)}(y.tileID,v,i))continue;n=rf(R.calculateShadowPassMatrixFromTile(y.tileID.toUnwrapped()),w,C)}else{let e=i.translatePosMatrix(g.expandedProjMatrix,y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=p.projection.createInversionMatrix(p,g.canonical);n=m?rm(e,i,j,_,x,w,g,y,T,E,S,r,A,C):rp(e,i,j,_,x,w,g,T,E,S,r,A,C,I,k,z)}i.uploadCommonUniforms(c,V,g.toUnwrapped(),null,P);let G=v.segments;if("mercator"===p.projection.name&&!L&&!(G=v.getVisibleSegments(y.tileID,i.terrain,i.transform.getFrustum(0))).get().length)continue;
98if(B){if(L)for(let e of G.get())B.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(let e of G.get())B.numRenderedVerticesInTransparentPass+=e.primitiveLength}let Z=[];(i.terrain||h)&&Z.push(v.centroidVertexBuffer),M&&Z.push(v.layoutVertexExtBuffer),V.draw(i,c.gl.TRIANGLES,o,s,l,tp.backCCW,n,a.id,v.layoutVertexBuffer,v.indexBuffer,G,a.paint,i.transform.zoom,N,Z)}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1)}function rW(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=i.context,w=b.gl,T=i.transform,M=i.transform.zoom,E=[],S=iM(i,a.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===c?(E.push("CLEAR_SUBPASS"),v&&(E.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===c&&E.push("SDF_SUBPASS"),y&&E.push("HAS_CENTROID"),S.shouldRenderCutoff&&E.push("RENDER_CUTOFF");let A=a.layout.get("fill-extrusion-edge-radius"),I=(e,r,n,c,x)=>{let w=r.programConfigurations.get(a.id),T=i.isTileAffectedByFog(e),I=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:w,defines:E,overrideFog:T}),C={u_matrix:c,u_opacity:d,u_ao_pass:u?1:0,u_meter_to_tile:x,u_ao:[p,f*x],u_flood_light_intensity:m,u_flood_light_color:_,u_attenuation:g,u_edge_radius:M>=17?0:A*x,u_fb:0,u_fb_size:v?v.size[0]:0},P=[];y&&P.push(r.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(b,I,e.toUnwrapped(),null,S),I.draw(i,b.gl.TRIANGLES,o,s,l,h,C,a.id,r.vertexBuffer,r.indexBuffer,n,a.paint,M,w,P)};for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||s.projection.name!==T.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;let l=s.groundEffect,h=1/s.tileToMeter;{let e=i.translatePosMatrix(o.projMatrix,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=l.getDefaultSegment();I(o,l,r,e,h)}if(x)for(let s=0;s<4;s++){let l,u;let c=e.cG[s](o),d=r.getTile(c);if(!d)continue;let p=d.getBucket(a);if(!p||p.projection.name!==T.projection.name||!p.groundEffect||p.groundEffect&&!p.groundEffect.hasData())continue;let f=p.groundEffect;0===s?(l=[-e.V,0,0],u=1):1===s?(l=[e.V,0,0],u=0):2===s?(l=[0,-e.V,0],u=3):(l=[0,e.V,0],u=2);let m=f.regionSegments[u];if(!m)continue;let _=new Float32Array(16);e.a6.translate(_,o.projMatrix,l),I(o,f,m,i.translatePosMatrix(_,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),h)}}}let rH=[1,0,0],rX=[0,1,0],rY=[0,0,1];function rK(i){return[i[0]*e.cL,i[1]*e.cL,i[2]*e.cL,0]}function rJ(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y;let x=n.getSource(),v=a.globeSharedBuffers;if(!v||(r&&(c=n.getTile(r)),x instanceof e.ap?(d=x.texture,p=e.cj(0,0,a.transform)):c&&r&&(d=c.texture,p=e.cj(r.canonical.z,r.canonical.x,a.transform)),!d||!p))return;i||(p=e.a6.scale(e.a6.create(),p,[1,-1,1]));let b=a.context,w=b.gl,T="nearest"===o.paint.get("raster-resampling")?w.NEAREST:w.LINEAR,M=a.colorModeForDrapableLayerRenderPass(s),E=l.defines;E.push("GLOBE_POLES");let S=new tu(w.LEQUAL,tu.ReadWrite,a.depthRangeFor3D),A=Float32Array.from(a.transform.expandedFarZProjMatrix),I=Float32Array.from(e.aT(e.ci(new e.bs(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),b.activeTexture.set(w.TEXTURE0),d.bind(T,w.CLAMP_TO_EDGE),b.activeTexture.set(w.TEXTURE1),d.bind(T,w.CLAMP_TO_EDGE),d.useMipmap&&b.extTextureFilterAnisotropic&&a.transform.pitch>20&&w.texParameterf(w.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let[C,P,z,D]=r?v.getPoleBuffers(r.canonical.z,!1):v.getPoleBuffers(0,!0),L=o.paint.get("raster-elevation");i?(f=C,a.renderDefaultNorthPole=0!==L):(f=P,a.renderDefaultSouthPole=0!==L);let R=rK(l.mix),k=(m=p,_=e.S(a.transform.zoom),g=l.offset,y=l.range,rS(A,I,m,new Float32Array(16),new Float32Array(9),[0,0],_,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0],L,2,R,g,y,1,0,s)),O=a.getOrCreateProgram("raster",{defines:E});a.uploadCommonUniforms(b,O,null),O.draw(a,w.TRIANGLES,S,u,M,h,k,o.id,f,z,D)}let rQ=new e.ax(1,0,0,1),r0=new e.ax(0,1,0,1),r1=new e.ax(0,0,1,1),r2=new e.ax(1,0,1,1),r3=new e.ax(0,1,1,1);function r5(i,r,a,n,o,s,l){let h=i.context,u=i.transform,c=h.gl,d="globe"===u.projection.name,p=e.a6.clone(a.projMatrix);if(d&&e.S(u.zoom)>0){let i=e.aS(a.canonical,u),r=e.cN(i);p=e.a6.multiply(new Float32Array(16),u.globeMatrix,r),e.a6.multiply(
98p,u.projMatrix,p)}let f=e.a6.create();f[12]+=2*o/(e.f.devicePixelRatio*u.width),f[13]+=2*s/(e.f.devicePixelRatio*u.height),e.a6.multiply(p,f,p);let m=i.getOrCreateProgram("debug",{defines:d?["PROJECTION_GLOBE_VIEW"]:[]}),_=r.getTileByID(a.key);i.terrain&&i.terrain.setupElevationDraw(_,m);let g=tu.disabled,y=tc.disabled,x=i.colorModeForRenderPass(),v="$debug";h.activeTexture.set(c.TEXTURE0),i.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),d?_._makeGlobeTileDebugBuffers(i.context,u):_._makeDebugTileBoundsBuffers(i.context,u.projection);let b=_._tileDebugBuffer||i.debugBuffer,w=_._tileDebugIndexBuffer||i.debugIndexBuffer,T=_._tileDebugSegments||i.debugSegments;if(m.draw(i,c.LINE_STRIP,g,y,x,tp.disabled,rb(p,n),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),l){let e=_.latestRawTileData,r=Math.floor((e&&e.byteLength||0)/1024),n=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(n+=` => ${a.overscaledZ}`),function(e,i){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,a=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(i,5,5),n.strokeText(i,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(i,n+=` ${_.state} ${r}kb`)}let M=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/u.zoom)*.5,E=_._tileDebugTextBuffer||i.debugBuffer,S=_._tileDebugTextIndexBuffer||i.quadTriangleIndexBuffer,A=_._tileDebugTextSegments||i.debugSegments;m.draw(i,c.TRIANGLES,g,y,td.alphaBlended,tp.disabled,rb(p,e.ax.transparent,M),v,E,S,A,null,null,null,[_._globeTileDebugTextBuffer])}function r4(e,i,r,a){r8(e,0,i+r/2,e.transform.width,r,a)}function r6(e,i,r,a){r8(e,i-r/2,0,r,e.transform.height,a)}function r8(i,r,a,n,o,s){let l=i.context,h=l.gl;h.enable(h.SCISSOR_TEST),h.scissor(r*e.f.devicePixelRatio,a*e.f.devicePixelRatio,n*e.f.devicePixelRatio,o*e.f.devicePixelRatio),l.clear({color:s}),h.disable(h.SCISSOR_TEST)}let{members:r9}=e.ay([{name:"a_pos_3f",components:3,type:"Float32"}]);function r7(e,i,r,a){e.emplaceBack(i,r,a)}class ae{constructor(i){this.vertexArray=new e.az,this.indices=new e.aw,r7(this.vertexArray,-1,-1,1),r7(this.vertexArray,1,-1,1),r7(this.vertexArray,-1,1,1),r7(this.vertexArray,1,1,1),r7(this.vertexArray,-1,-1,-1),r7(this.vertexArray,1,-1,-1),r7(this.vertexArray,-1,1,-1),r7(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=i.createVertexBuffer(this.vertexArray,r9),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.aB.simpleSegment(0,0,36,12)}}function at(i,r,a,n,o,s){let l=i.context.gl,h=r.paint.get("sky-atmosphere-color"),u=r.paint.get("sky-atmosphere-halo-color"),c=r.paint.get("sky-atmosphere-sun-intensity"),d={u_matrix_3f:e.co.fromMat4(e.co.create(),n),u_sun_direction:o,u_sun_intensity:c,u_color_tint_r:[h.r,h.g,h.b,h.a],u_color_tint_m:[u.r,u.g,u.b,u.a],u_luminance:5e-5};l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_CUBE_MAP_POSITIVE_X+s,r.skyboxTexture,0),a.draw(i,l.TRIANGLES,tu.disabled,tc.disabled,td.unblended,tp.frontCW,d,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}let ai=e.ay([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class ar{constructor(i){let r=new e.cO;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);let a=new e.aw;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,ai.members),this.indexBuffer=i.createIndexBuffer(a),this.segments=e.aB.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let aa=e.ay([{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 an{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ao{constructor(i){this.colorModeAlphaBlendedWriteRGB=new td([1,771,1,771],e.ax.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new td([1,0,1,0],e.ax.transparent,[!1,!1,!1,!0]),this.params=new an,this.updateNeeded=!0,i.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),i.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(i){let r=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new ar(r);let i=this.params.sizeRange,a=this.params.intensityRange,n=function(i){let r=e.aA(30),a=[];for(let n=0;n<i;++n){let i=2*Math.PI*r(),n=Math.acos(1-2*r())-.5*Math.PI;a.push(e.N.fromValues(Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)))}return a}(this.params.starsCount),o=e.aA(300),s=new e.cP,l=new e.aw,h=0;for(let r=0;r<n.length;++r){let u=e.N.scale([],n[r],200),c=Math.max(0,1+.01*i*(1*o()-.5)),d=Math.max(0,1+.01*a*(1*o()-.5));s.emplaceBack(u[0],u[1],u[2],-1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,1,c,d),s.emplaceBack(u[0],u[1],u[2],-1,1,c,d),l.emplaceBack(h+0,h+1,h+2),l.emplaceBack(h+0,h+2,h+3),h+=4}this.starsVx=r.createVertexBuffer(s,aa.members),this.starsIdx=r.createIndexBuffer(l),this.starsSegments=e.aB.simpleSegment(0,0,s.length,l.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,r){let a=i.context,n=a.gl,o=i.transform,s=new tu(n.LEQUAL,tu.ReadOnly,[0,1]),l=e.S(o.zoom),h=r.properties.get("color").toArray01(),u=r.properties.get("high-color").toArray01(),c=r.properties.get("space-color").toArray01PremultipliedAlpha(),d=e.cQ(r.properties.get("horizon-blend"),0,1,5e-4,.25),p=e.cd(i,a,o)&&5e-4===d?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,f=i.frameCounter/1e3%1,m=e.N.length(o.globeCenterInViewSpace),_=Math.acos(Math.sqrt(Math.pow(m,2)-Math.pow(p,2))/m),g=e=>{let r,p,m;let g="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];
98e&&g.push("ALPHA_PASS");let y=i.getOrCreateProgram("globeAtmosphere",{defines:g}),x=(r=o.frustumCorners.TL,p=o.frustumCorners.TR,m=o.frustumCorners.BR,{u_frustum_tl:r,u_frustum_tr:p,u_frustum_br:m,u_frustum_bl:o.frustumCorners.BL,u_horizon:o.frustumCorners.horizon,u_transition:l,u_fadeout_range:d,u_color:h,u_high_color:u,u_space_color:c,u_temporal_offset:f,u_horizon_angle:_});i.uploadCommonUniforms(a,y);let v=this.atmosphereBuffer;v&&y.draw(i,n.TRIANGLES,s,tc.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,tp.backCW,x,e?"atmosphere_glow_alpha":"atmosphere_glow",v.vertexBuffer,v.indexBuffer,v.segments)};g(!1),g(!0)}drawStars(i,r){let a=e.aa(r.properties.get("star-intensity"),0,1);if(0===a)return;let n=i.context,o=n.gl,s=i.transform,l=i.getOrCreateProgram("stars"),h=e.bi.identity([]);e.bi.rotateX(h,h,-s._pitch),e.bi.rotateZ(h,h,-s.angle),e.bi.rotateX(h,h,e.bj(s._center.lat)),e.bi.rotateY(h,h,-e.bj(s._center.lng));let u=e.a6.fromQuat(new Float32Array(16),h),c=e.a6.multiply([],s.starsProjMatrix,u),d=e.co.fromMat4([],u),p=e.co.invert([],d),f=[0,1,0];e.N.transformMat3(f,f,p),e.N.scale(f,f,this.params.sizeMultiplier);let m=[1,0,0];e.N.transformMat3(m,m,p),e.N.scale(m,m,this.params.sizeMultiplier);let _={u_matrix:Float32Array.from(c),u_up:f,u_right:m,u_intensity_multiplier:a};i.uploadCommonUniforms(n,l),this.starsVx&&this.starsIdx&&l.draw(i,o.TRIANGLES,tu.disabled,tc.disabled,this.colorModeAlphaBlendedWriteRGB,tp.disabled,_,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function as(i,r){let a=[...i],n=r.cameraWorldSizeForFog/r.worldSize,o=e.a6.identity([]);return e.a6.scale(o,o,[n,n,1]),e.a6.multiply(a,o,a),e.a6.multiply(a,r.worldToFogMatrix,a),a}function al(e,i,r,a){let n=r.material,o=a.context,{baseColorTexture:s,metallicRoughnessTexture:l}=n.pbrMetallicRoughness,{normalTexture:h,occlusionTexture:u,emissionTexture:c}=n;function d(i,r,a){if(i&&(e.push(r),o.activeTexture.set(o.gl.TEXTURE0+a),i.gfxTexture)){let{minFilter:e,magFilter:r,wrapS:a,wrapT:n}=i.sampler;i.gfxTexture.bindExtraParam(e,r,a,n)}}d(s,"HAS_TEXTURE_u_baseColorTexture",iT.BaseColor),d(l,"HAS_TEXTURE_u_metallicRoughnessTexture",iT.MetallicRoughness),d(h,"HAS_TEXTURE_u_normalTexture",iT.Normal),d(u,"HAS_TEXTURE_u_occlusionTexture",iT.Occlusion),d(c,"HAS_TEXTURE_u_emissionTexture",iT.Emission),r.texcoordBuffer&&(e.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(r.texcoordBuffer)),r.colorBuffer&&(e.push(12===r.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(r.colorBuffer)),r.normalBuffer&&(e.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(r.normalBuffer)),r.pbrBuffer&&(e.push("HAS_ATTRIBUTE_a_pbr"),e.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(r.pbrBuffer)),"OPAQUE"!==n.alphaMode&&"MASK"!==n.alphaMode||e.push("UNPREMULT_TEXTURE_IN_SHADER"),n.defined||e.push("DIFFUSE_SHADED"),e.push("USE_STANDARD_DERIVATIVES")}function ah(i,r,a,n,o,s){let l;let h=a.paint.get("model-opacity"),u=r.context,c=new tu(r.context.gl.LEQUAL,tu.ReadWrite,r.depthRangeFor3D),d=r.transform,p=i.mesh,f=p.material,m=f.pbrMetallicRoughness,_=r.style.fog;l="pixels"===r.transform.projection.zAxisUnit?[...i.nodeModelMatrix]:e.a6.multiply([],n.zScaleMatrix,i.nodeModelMatrix),e.a6.multiply(l,n.negCameraPosMatrix,l);let g=e.a6.invert([],l);e.a6.transpose(g,g);let y=a.paint.get("model-emissive-strength").constantOr(0),x=rO(new Float32Array(i.worldViewProjection),new Float32Array(l),new Float32Array(g),r,h,m.baseColorFactor,f.emissiveFactor,m.metallicFactor,m.roughnessFactor,f,y,a),v={defines:[]},b=[];al(v.defines,b,p,r);let w=r.shadowRenderer;w&&(w.useNormalOffset=!1);let T=null;if(_){let e=as(i.nodeModelMatrix,r.transform);if(T=new Float32Array(e),"globe"!==d.projection.name){let i=p.aabb.min,r=p.aabb.max,[a,n]=_.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);v.overrideFog=a>=.05||n>=.05}}let M=iM(r,a.paint.get("model-cutoff-fade-range"));M.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");let E=r.getOrCreateProgram("model",v);r.uploadCommonUniforms(u,E,null,T,M),"shadow"!==r.renderPass&&w&&w.setupShadowsFromMatrix(i.nodeModelMatrix,E),E.draw(r,u.gl.TRIANGLES,c,o,s,p.material.doubleSided?tp.disabled:tp.backCCW,x,a.id,p.vertexBuffer,p.indexBuffer,p.segments,a.paint,r.transform.zoom,void 0,b)}function au(e,i,r,a){let n=r.shadowRenderer;if(!n)return;
98let o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),l=rF(n.calculateShadowPassMatrixFromMatrix(i));r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,o,tc.disabled,s,tp.backCCW,l,a.id,e.vertexBuffer,e.indexBuffer,e.segments,a.paint,r.transform.zoom,void 0,void 0)}let ac={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.bS([0,0,0],[e.V,e.V,0])},ad=[1,-1,1];class ap{}class af{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,r,a){{let e=this._storage.get(r.id);if(e)return e.lastUsedFrameIdx=i,e.buf}let n=a.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),l=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));let h=new e.cW;for(let e=0;e<o/2;e+=3){let i=l[e],r=l[e+1],a=l[e+2];h.emplaceBack(i,r),h.emplaceBack(r,a),h.emplaceBack(a,i)}let u=a.bindVertexArrayOES.current,c=new ap;return c.buf=new eL(a,h),c.lastUsedFrameIdx=i,this._storage.set(r.id,c),a.bindVertexArrayOES.set(u),c.buf}update(e){for(let[i,r]of this._storage)e-r.lastUsedFrameIdx>30&&(r.buf.destroy(),this._storage.delete(i))}destroy(){for(let[e,i]of this._storage)i.buf.destroy(),this._storage.delete(e)}}class am{registerParameter(e,i,r,a,n){}registerButton(e,i,r){}}let a_={symbol:function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=tc.disabled,l=i.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(i,r,a,n,o,s,l){let h=r.transform,u="map"===o,c="map"===s;for(let r of i){let i=n.getTile(r),o=i.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;let s=e.b5(o.textSizeData,h.zoom),d=t2(r,o.getProjection(),h),p=h.calculatePixelsToTileUnitsMatrix(i),f=tV(d,i.tileID.canonical,c,u,h,o.getProjection(),p),m=o.hasIconTextFit()&&o.hasIconData();if(s){let a=Math.pow(2,h.zoom-i.tileID.overscaledZ);!function(i,r,a,n,o,s,l,h,u,c,d){let p=i.text.placedSymbolArray,f=i.text.dynamicLayoutVertexArray,m=i.icon.dynamicLayoutVertexArray,_={},g=i.getProjection(),y=t2(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;f.clear();for(let m=0;m<p.length;m++){let b=p.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:M}=b,E=b.hidden||!b.crossTileID||i.allowVerticalPlacement&&!b.placedOrientation?null:n[b.crossTileID];if(E){let n=0,p=0,m=0;if(x){let e=x?x.getAtTileOffset(h,w,T):0,[i,r,a]=g.upVector(h.canonical,w,T);n=e*i*v,p=e*r*v,m=e*a*v}let[S,A,I,C]=tG(b.projectedAnchorX+n,b.projectedAnchorY+p,b.projectedAnchorZ+m,a?y:l),P=tZ(s.getCameraToCenterDistance(g),C),z=o.evaluateSizeForFeature(i.textSizeData,c,b)*P/e.bc;a&&(z*=i.tilePixelRatio/u);let D=function({width:i,height:r,anchor:a,textOffset:n,textScale:o},s){let{horizontalAlign:l,verticalAlign:h}=e.bf(a),u=e.bd(a,n);return new e.P((-(l-.5)*i/o+u[0])*s,(-(h-.5)*r/o+u[1])*s)}(E,z);a?({x:S,y:A,z:I}=g.projectTilePoint(w+D.x,T+D.y,h.canonical),[S,A,I]=tG(S+n,A+p,I+m,l)):(r&&D._rotate(-s.angle),S+=D.x,A+=D.y,I=0);let L=i.allowVerticalPlacement&&b.placedOrientation===e.b6.vertical?Math.PI/2:0;for(let i=0;i<M;i++)e.b9(f,S,A,I,L);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:S,y:A,z:I,angle:L})}else tJ(M,f)}if(d){m.clear();let r=i.icon.placedSymbolArray;for(let i=0;i<r.length;i++){let a=r.get(i),{numGlyphs:n}=a,o=_[i];if(a.hidden||!o)tJ(n,m);else{let{x:i,y:r,z:a,angle:s}=o;for(let o=0;o<n;o++)e.b9(m,i,r,a,s)}}i.icon.dynamicLayoutVertexBuffer.updateData(m)}i.text.dynamicLayoutVertexBuffer.updateData(f)}(o,u,c,l,e.cx,h,f,r,a,s,m)}}}(n,i,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),o);let h=0!==a.paint.get("icon-opacity").constantOr(1),u=0!==a.paint.get("text-opacity").constantOr(1);void 0!==a.layout.get("symbol-sort-key").constantOr(1)&&(h||u)?rG(i,r,a,n,s,l):(h&&rG(i,r,a,n,s,l,{onlyIcons:!0}),u&&rG(i,r,a,n,s,l,{onlyText:!0})),r.map.showCollisionBoxes&&(rV(i,r,a,n,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),rV(i,r,a,n,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(i,r,a,n){if("translucent"!==i.renderPass)return;let o=a.paint.get("circle-opacity"),s=a.paint.get("circle-stroke-width"),l=a.paint.get("circle-stroke-opacity"),h=void 0!==a.layout.get("
98circle-sort-key").constantOr(1),u=a.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===l.constantOr(1)))return;let c=i.context,d=c.gl,p=i.transform,f=i.depthModeForSublayer(0,tu.ReadOnly),m=tc.disabled,_=i.colorModeForDrapableLayerRenderPass(u),g="globe"===p.projection.name,y=[e.a5(p.center.lng),e.ae(p.center.lat)],x=[];for(let o=0;o<n.length;o++){let s=n[o],l=r.getTile(s),u=l.getBucket(a);if(!u||u.projection.name!==p.projection.name)continue;let c=u.programConfigurations.get(a.id),d=e.cy(a),f=i.isTileAffectedByFog(s);g&&d.push("PROJECTION_GLOBE_VIEW");let m=i.getOrCreateProgram("circle",{config:c,defines:d,overrideFog:f}),_=u.layoutVertexBuffer,v=u.globeExtVertexBuffer,b=u.indexBuffer,w=p.projection.createInversionMatrix(p,s.canonical),T={programConfiguration:c,program:m,layoutVertexBuffer:_,globeExtVertexBuffer:v,indexBuffer:b,uniformValues:e.cz(i,s,l,w,y,a),tile:l};if(h)for(let i of u.segments.get())x.push({segments:new e.aB([i]),sortKey:i.sortKey,state:T});else x.push({segments:u.segments,sortKey:0,state:T})}h&&x.sort((e,i)=>e.sortKey-i.sortKey);let v={useDepthForOcclusion:p.depthOcclusionForSymbolsAndCircles};for(let e of x){let{programConfiguration:r,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:l,uniformValues:h,tile:u}=e.state,g=e.segments;i.terrain&&i.terrain.setupElevationDraw(u,n,v),i.uploadCommonUniforms(c,n,u.tileID.toUnwrapped()),n.draw(i,d.TRIANGLES,f,m,_,tp.disabled,h,a.id,o,l,g,a.paint,p.zoom,r,[s])}},heatmap:function(i,r,a,n){if(0!==a.paint.get("heatmap-opacity")){if("offscreen"===i.renderPass){let o=i.context,s=o.gl,l=tc.disabled,h=new td([s.ONE,s.ONE,s.ONE,s.ONE],e.ax.transparent,[!0,!0,!0,!0]);(function(e,i,r,a){let n=e.gl,o=i.width*a,s=i.height*a;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let l=r.heatmapFbo;if(!l||l&&(l.width!==o||l.height!==s)){l&&l.destroy();let i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
98INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),l=r.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,i,r,a,n,o){let s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),a.colorAttachment.set(r)}(e,0,i,l,o,s)}else n.bindTexture(n.TEXTURE_2D,l.colorAttachment.get()),e.bindFramebuffer.set(l.framebuffer)})(o,i,a,"globe"===i.transform.projection.name?.5:.25),o.clear({color:e.ax.transparent});let u=i.transform,c="globe"===u.projection.name,d=c?["PROJECTION_GLOBE_VIEW"]:[],p=c?tp.frontCCW:tp.disabled,f=[e.a5(u.center.lng),e.ae(u.center.lat)];for(let e=0;e<n.length;e++){let m=n[e];if(r.hasRenderableParent(m))continue;let _=r.getTile(m),g=_.getBucket(a);if(!g||g.projection.name!==u.projection.name)continue;let y=i.isTileAffectedByFog(m),x=g.programConfigurations.get(a.id),v=i.getOrCreateProgram("heatmap",{config:x,defines:d,overrideFog:y}),{zoom:b}=i.transform;i.terrain&&i.terrain.setupElevationDraw(_,v),i.uploadCommonUniforms(o,v,m.toUnwrapped());let w=u.projection.createInversionMatrix(u,m.canonical);v.draw(i,s.TRIANGLES,tu.disabled,l,h,p,rT(i,m,_,w,f,b,a.paint.get("heatmap-intensity")),a.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,a.paint,i.transform.zoom,x,c?[g.globeExtVertexBuffer]:null)}o.viewport.set([0,0,i.width,i.height])}else"translucent"===i.renderPass&&(i.context.setColorMode(i.colorModeForRenderPass()),function(i,r){let a=i.context,n=a.gl,o=r.heatmapFbo;if(!o)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1);let s=r.colorRampTexture;s||(s=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),i.getOrCreateProgram("heatmapTexture").draw(i,n.TRIANGLES,tu.disabled,tc.disabled,i.colorModeForRenderPass(),tp.disabled,{u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}(i,a))}},line:function(i,r,a,n){if("translucent"!==i.renderPass)return;let o=a.paint.get("line-opacity"),s=a.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;let l=a.paint.get("line-emissive-strength"),h=i.depthModeForSublayer(0,tu.ReadOnly),u=i.colorModeForDrapableLayerRenderPass(l),c=i.terrain&&i.terrain.renderingToTexture?1:e.f.devicePixelRatio,d=a.paint.get("line-dasharray"),p=d.constantOr(1),f=a.layout.get("line-cap"),m=a.paint.get("line-pattern"),_=m.constantOr(1),g=a.paint.get("line-pattern").constantOr(1),y=1!==a.paint.get("line-opacity").constantOr(1),x=!g&&y,v=a.paint.get("line-gradient"),b=_?"linePattern":"line",w=i.context,T=w.gl,M=e.cA(a);for(let o of(i.terrain&&i.terrain.clipOrMaskOverlapStencilType()&&(x=!1),n)){let n=r.getTile(o);if(_&&!n.patternsLoaded())continue;let s=n.getBucket(a);if(!s)continue;i.prepareDrawTile();let l=s.programConfigurations.get(a.id),g=i.isTileAffectedByFog(o),y=i.getOrCreateProgram(b,{config:l,defines:M,overrideFog:g}),E=m.constantOr(null);if(E&&n.imageAtlas){let e=n.imageAtlas.patternPositions[E.toString()];e&&l.setConstantPatternPositions(e)}let S=d.constantOr(null),A=f.constantOr(null);if(!_&&S&&A&&n.lineAtlas){let e=n.lineAtlas.getDash(S,A);e&&l.setConstantPatternPositions(e)}let[I,C]=a.paint.get("line-trim-offset");("round"===A||"square"===A)&&I!==C&&(0===I&&(I-=1),1===C&&(C+=1));let P=i.terrain?o.projMatrix:null,z=_?e.cB(i,n,a,P,c,[I,C]):e.cC(i,n,a,P,s.lineClipsArray.length,c,[I,C]);if(v){let n=s.gradients[a.id],l=n.texture;if(a.gradientVersion!==n.version){let h=256;if(a.stepInterpolant){let a=r.getSource().maxzoom,n=o.canonical.z===a?Math.ceil(1<<i.transform.maxZoom-o.canonical.z):1;h=e.aa(e.cD(s.maxLineLength/e.V*1024*n),256,w.maxTextureSize)}n.gradient=e.cE({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:n.gradient||void 0,clips:s.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(w,n.gradient,T.RGBA),n.version=a.gradientVersion,l=n.texture}w.activeTexture.set(T.TEXTURE1),l.bind(a.stepInterpolant?T.NEAREST:T.LINEAR,T.CLAMP_TO_EDGE)}p&&(w.activeTexture.set(T.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(T.LINEAR,T.REPEAT),l.updatePaintBuffers()),_&&(w.activeTexture.set(T.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),l.updatePaintBuffers()),i.uploadCommonUniforms(w,y,o.toUnwrapped());let D=e=>{y.draw(i,T.TRIANGLES,h,e,u,tp.disabled,z,a.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,a.paint,i.transform.zoom,l,[s.layoutVertexBuffer2])};if(x){let e=i.stencilModeForClipping(o).ref;0===e&&i.terrain&&w.clear({stencil:0});let r={func:T.EQUAL,mask:255};z.u_alpha_discard_threshold=.8,D(new tc(r,e,255,T.KEEP,T.KEEP,T.INVERT)),z.u_alpha_discard_threshold=0,D(new tc(r,e,255,T.KEEP,T.KEEP,T.KEEP))}else D(i.stencilModeForClipping(o))}x&&(i.resetStencilClippingMasks(),i.terrain&&w.clear({stencil:0}))},fill:function(i,r,a,n){let o=a.paint.get("fill-color"),s=a.paint.get("fill-opacity");if(0===s.constantOr(1))return;let l=a.paint.get("fill-emissive-strength"),h=i.colorModeForDrapableLayerRenderPass(l),u=a.paint.get("fill-pattern"),c=i.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(e.ax.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(i.renderPass===c){let e=i.depthModeForSublayer(1,"opaque"===i.renderPass?tu.ReadWrite:tu.ReadOnly);rq(i,r,a,n,e,h,!1)}if("translucent"===i.renderPass&&a.paint.get("fill-antialias")){let e=i.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,tu.ReadOnly);rq(i,r,a,n,e,h,!0)}},"fill-extrusion":function(i,r,a,n){let o=a.paint.get("fill-extrusion-opacity"),s=i.context,l=s.gl,h=i.terrain,u=h&&h.renderingToTexture;if(0===o)return;let c=i.conflationActive&&i.layerUsedInConflation(a,r.getSource());if(c&&function(e,i,r,a){for(let n of a){let a=i.getTile(n).getBucket(r);a&&(a.updateReplacement(n,e.replacementSource),a.uploadCentroid(e.context))}}(i,r,a,n),h||c)for(let o of n){let n=r.getTile(o).getBucket(a);n&&function(i,r,a,n,o,s,l){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();let h=s?s.findDEMTileFor(a):null;if(!(h&&h.dem||l))return;let u=i=>new e.P(Math.ceil((i+e.cJ)*e.cK),0),c=e=>{let i=r.getSource().minzoom,a=e=>{let i=r.getTileByID(e);if(i&&i.hasData())return i.getBucket(o)};
98for(let r of[0,-1,1]){if(e.overscaledZ+r<i)continue;let n=a(e.calculateScaledKey(e.overscaledZ+r));if(n)return n}},d=[0,0,0],p=(i,r)=>(d[0]=Math.min(i.min.y,r.min.y),d[1]=Math.max(i.max.y,r.max.y),d[2]=e.V-r.min.x>i.max.x?r.min.x-e.V:i.max.x,d),f=(i,r)=>(d[0]=Math.min(i.min.x,r.min.x),d[1]=Math.max(i.max.x,r.max.x),d[2]=e.V-r.min.y>i.max.y?r.min.y-e.V:i.max.y,d),m=[(e,i)=>p(e,i),(e,i)=>p(i,e),(e,i)=>f(e,i),(e,i)=>f(i,e)],_=(i,r,n,o,l,u,c)=>{if(!s)return 0;let d=[[u?n:i,u?i:n,0],[u?n:r,u?r:n,0]],p=c<0?e.V+c:c,f=[u?p:(i+r)/2,u?(i+r)/2:p,0];return 0===n&&c<0||0!==n&&c>0?s.getForTilePoints(l,[f],!0,o):d.push(f),s.getForTilePoints(a,d,!0,h),Math.max(d[0][2],d[1][2],f[2])/s.exaggeration()};for(let i=0;i<4;i++){let r=n.borderFeatureIndices[i];if(0===r.length)continue;let o=e.cG[i](a),h=c(o);if(!(h&&h instanceof e.cH)||n.borderDoneWithNeighborZ[i]===h.canonical.z)continue;0===h.centroidVertexArray.length&&h.createCentroidsBuffer();let d=s?s.findDEMTileFor(o):null;if(!(d&&d.dem||l))continue;let p=(i<2?1:5)-i,f=h.borderDoneWithNeighborZ[p]!==n.canonical.z,g=h.borderFeatureIndices[p],y=0;if(n.canonical.z!==h.canonical.z){for(let e of r)n.showCentroid(n.featuresOnBorder[e]);if(f)for(let e of g)h.showCentroid(h.featuresOnBorder[e]);n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}for(let a of r){let r;let s=n.featuresOnBorder[a],c=n.centroidData[s.centroidDataIndex],f=s.borders[i];for(;y<g.length;){let e=(r=h.featuresOnBorder[g[y]]).borders[p];if(e[1]>f[0]+3||e[0]>f[0]-3)break;h.showCentroid(r),y++}if(r&&y<g.length){let a=y,x=0;for(;!(r.borders[p][0]>f[1]-3)&&(x++,++y!==g.length);)r=h.featuresOnBorder[g[y]];if(r=h.featuresOnBorder[g[a]],x>1){let e=r.borders[p];3>Math.abs(f[0]-e[0])&&3>Math.abs(f[1]-e[1])&&(x=1,y=a+1)}else if(0===x){n.showCentroid(s);continue}let v=h.centroidData[r.centroidDataIndex];l&&1===x&&((c.flags|v.flags)&e.cI?(c.flags|=e.cI,v.flags|=e.cI):(c.flags&=~e.cI,v.flags&=~e.cI));let b=s.intersectsCount()>1||r.intersectsCount()>1;if(x>1)y=a,c.centroidXY=v.centroidXY=new e.P(0,0);else if(d&&d.dem&&!b){let r=m[i](c,v),a=i%2?e.V-1:0,n=_(r[0],Math.min(e.V-1,r[1]),a,d,o,i<2,r[2]);c.centroidXY=v.centroidXY=u(n)}else b?c.centroidXY=v.centroidXY=new e.P(0,0):(c.centroidXY=n.encodeBorderCentroid(s),v.centroidXY=h.encodeBorderCentroid(r));n.writeCentroidToBuffer(c),h.writeCentroidToBuffer(v)}else n.showCentroid(s)}n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(i)}(i.context,r,o,n,a,h,c)}if("shadow"===i.renderPass&&i.shadowRenderer){let s=i.shadowRenderer;if(h&&o<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.Z)return;let l=s.getShadowPassDepthMode(),u=s.getShadowPassColorMode();r$(i,r,a,n,l,tc.disabled,u,c)}else if("translucent"===i.renderPass){let d=!a.paint.get("fill-extrusion-pattern").constantOr(1),p=a.paint.get("fill-extrusion-color").constantOr(e.ax.white);if(!u&&0!==p.a){let e=new tu(i.context.gl.LEQUAL,tu.ReadWrite,i.depthRangeFor3D);1===o&&d?r$(i,r,a,n,e,tc.disabled,td.unblended,c):(r$(i,r,a,n,e,tc.disabled,td.disabled,c),r$(i,r,a,n,e,i.stencilModeFor3D(),i.colorModeForRenderPass(),c),i.resetStencilClippingMasks())}if(i.style.enable3dLights()&&d&&(!h&&"globe"!==i.transform.projection.name||u)){let o=a.paint.get("fill-extrusion-opacity"),d=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),p=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),f=a.paint.get("fill-extrusion-flood-light-intensity"),m=a.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),_=d>0&&p>0,g=f>0,y=(e,i,r)=>(1-r)*e+r*i,x=s=>{let h=i.depthModeForSublayer(1,tu.ReadOnly,l.LEQUAL,!0),u=y(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),_=i._showOverdrawInspector;_||rW(i,r,a,n,h,new tc({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new td([l.ONE,l.ONE,l.ONE,l.ONE],e.ax.transparent,[!1,!1,!1,!0],l.MIN),tp.disabled,s,"sdf",o,d,p,f,m,u,c,!1);{let g=_?tc.disabled:new tc({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),y=_?i.colorModeForRenderPass():new td([l.ONE_MINUS_DST_ALPHA,l.DST_ALPHA,l.ONE,l.ONE],e.ax.transparent,[!0,!0,!0,!0]);rW(i,r,a,n,h,g,y,tp.disabled,s,"color",o,d,p,f,m,u,c,!1)}};if(u){let u=(s,h,u)=>{let _=i.depthModeForSublayer(1,tu.ReadOnly,l.LEQUAL,!1),g=y(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let u=new td([l.ONE,l.ONE,l.ONE,l.ONE],e.ax.transparent,[!1,!1,!1,!0]);rW(i,r,a,n,_,tc.disabled,u,tp.disabled,s,"clear",o,d,p,f,m,g,c,h)}rW(i,r,a,n,_,new tc({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new td([l.ONE,l.ONE,l.ONE,l.ONE],e.ax.transparent,[!1,!1,!1,!0],l.MIN),tp.disabled,s,"sdf",o,d,p,f,m,g,c,h);{let u=s?l.ZERO:l.ONE_MINUS_DST_ALPHA;rW(i,r,a,n,_,new tc({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),new td([u,l.DST_ALPHA,l.ONE_MINUS_DST_ALPHA,l.ZERO],e.ax.transparent,[!0,!0,!0,!0]),tp.disabled,s,"color",o,d,p,f,m,g,c,h)}{let y=new td([l.ONE,l.ONE,l.ONE,s?l.ZERO:l.ONE],e.ax.transparent,[!1,!1,!1,!0],s?l.FUNC_ADD:l.MAX);rW(i,r,a,n,_,tc.disabled,y,tp.disabled,s,"clear",o,d,p,f,m,g,c,h,u)}};if(_||g){let r;if(i.prepareDrawTile(),h){let i=h.drapeBufferSize[0],a=h.drapeBufferSize[1];(r=h.framebufferCopyTexture)&&(!r||r.size[0]===i&&r.size[1]===a)||(r&&r.destroy(),r=h.framebufferCopyTexture=new e.T(s,new e.h({width:i,height:a}),l.RGBA)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE),l.copyTexImage2D(l.TEXTURE_2D,0,l.RGBA,0,0,i,a,0)}_&&u(!0,!1,r),g&&u(!1,!0,r)}}else _&&x(!0),g&&x(!1)}}},hillshade:function(i,r,a,n){if("offscreen"!==i.renderPass&&"translucent"!==i.renderPass||i.style.disableElevatedTerrain)return;let o=i.context,s=i.terrain&&i.terrain.renderingToTexture,[l,h]="translucent"!==i.renderPass||s?[{},n]:i.stencilConfigForOverlap(n);for(let n of h){let o=r.getTile(n);if(o.needsHillshadePrepare&&"offscreen"===i.renderPass)!function(i,r,a){let n=i.context,o=n.gl;if(!r.dem)return;let s=r.dem;if(n.activeTexture.set(o.TEXTURE1),i5(i,r,s),!r.demTexture)return;r.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);let l=s.dim;n.activeTexture.set(o.TEXTURE0);let h=r.hillshadeFBO;if(!h){let i=new e.T(n,{width:l,height:l,data:null},o.RGBA);i.bind(o.LINEAR,o.CLAMP_TO_EDGE),(h=r.hillshadeFBO=n.createFramebuffer(l,l,!0,"renderbuffer")).colorAttachment.set(i.texture)}n.bindFramebuffer.set(h.framebuffer),n.viewport.set([0,0,l,l]);let{tileBoundsBuffer:u,tileBoundsIndexBuffer:c,tileBoundsSegments:d}=i.getMercatorTileBoundsBuffers(),p=[];i.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT"),i.getOrCreateProgram("hillshadePrepare",{defines:p}).draw(i,o.TRIANGLES,tu.disabled,tc.disabled,td.unblended,tp.disabled,((i,r)=>{let a=r.stride,n=e.a6.create();return e.a6.ortho(n,0,e.V,-e.V,0,0,1),e.a6.translate(n,n,[0,-e.V,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:i.overscaledZ}})(r.tileID,s),a.id,u,c,d),r.needsHillshadePrepare=!1}(i,o,a);else if("translucent"===i.renderPass){let r=i.depthModeForSublayer(0,tu.ReadOnly),h=a.paint.get("hillshade-emissive-strength"),u=i.colorModeForDrapableLayerRenderPass(h),c=s&&i.terrain?i.terrain.stencilModeForRTTOverlap(n):l[n.overscaledZ];!function(i,r,a,n,o,s,l){let h=i.context,u=h.gl,c=a.hillshadeFBO;if(!c)return;i.prepareDrawTile();let d=i.isTileAffectedByFog(r),p=i.getOrCreateProgram("hillshade",{overrideFog:d});h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());let f=((i,r,a,n)=>{let o=a.paint.get("hillshade-shadow-color"),s=a.paint.get("hillshade-highlight-color"),l=a.paint.get("hillshade-accent-color"),h=a.paint.get("hillshade-emissive-strength"),u=e.bj(a.paint.get("hillshade-illumination-direction"));if("viewport"===a.paint.get("hillshade-illumination-anchor"))u-=i.transform.angle;else if(i.style&&i.style.enable3dLights()&&i.style.directionalLight){let r=i.style.directionalLight.properties.get("direction"),a=e.bQ(r.x,r.y,r.z);u=e.bj(a[1])}let c=!i.options.moving;return{u_matrix:n||i.transform.calculateProjMatrix(r.tileID.toUnwrapped(),c),u_image:0,u_latrange:function(i,r){let a=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.L(0,n/a).toLngLat().lat,new e.L(0,(n+1)/a).toLngLat().lat]}(0,r.tileID),u_light:[a.paint.get("hillshade-exaggeration"),u],u_shadow:o,u_highlight:s,u_emissive_strength:h,u_accent:l}})(i,a,n,i.terrain?r.projMatrix:null);i.uploadCommonUniforms(h,p,r.toUnwrapped());let{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=i.getTileBoundsBuffers(a);p.draw(i,u.TRIANGLES,o,s,l,tp.disabled,f,n.id,m,_,g)}(i,n,o,a,r,c,u)}}o.viewport.set([0,0,i.width,i.height]),i.resetStencilClippingMasks()}
98,raster:function(i,r,a,n,o,s){if("translucent"!==i.renderPass||0===a.paint.get("raster-opacity"))return;let l="globe"===i.transform.projection.name,h=0!==a.paint.get("raster-elevation"),u=h&&l;if(i.renderElevatedRasterBackface&&!u)return;let c=i.context,d=c.gl,p=r.getSource(),f=function(i,r,a,n){let o=r.paint.get("raster-color"),s="raster-array"===i.type,l=[],h=r.paint.get("raster-resampling"),u=r.paint.get("raster-color-mix"),c=r.paint.get("raster-color-range"),d=[u[0],u[1],u[2],0],p=u[3],f="nearest"===h?n.NEAREST:n.LINEAR;if(s&&(l.push("RASTER_ARRAY"),o||l.push("RASTER_COLOR"),"linear"===h&&l.push("RASTER_ARRAY_LINEAR"),f=n.NEAREST,!c&&i.rasterLayers)){let e=i.rasterLayers.find(({id:e})=>e===r.sourceLayer);e&&e.fields&&e.fields.range&&(c=e.fields.range)}if(c=c||[0,1],o){l.push("RASTER_COLOR"),a.activeTexture.set(n.TEXTURE2),r.updateColorRamp(c);let i=r.colorRampTexture;i||(i=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA)),i.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:d,range:c,offset:p,defines:l,resampling:f}}(p,a,c,d);if(p instanceof e.ap&&!n.length&&!l)return;let m=a.paint.get("raster-emissive-strength"),_=i.colorModeForDrapableLayerRenderPass(m),g=i.terrain&&i.terrain.renderingToTexture,y=!i.options.moving,x="nearest"===a.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;if(p instanceof e.ap&&!n.length&&(p.onNorthPole||p.onSouthPole)){let e=h?i.stencilModeFor3D():tc.disabled;return void rJ(!!p.onNorthPole,null,i,r,a,m,f,tp.disabled,e)}if(!n.length)return;let[v,b]=p instanceof e.ap||g?[{},n]:i.stencilConfigForOverlap(n),w=b[b.length-1].overscaledZ;u&&f.defines.push("PROJECTION_GLOBE_VIEW"),h&&f.defines.push("RENDER_CUTOFF");let T=(n,o,b)=>{for(let T of n){let n,M,E,S,A;let I=T.toUnwrapped(),C=r.getTile(T);if(g&&(!C||!C.hasData()))continue;c.activeTexture.set(d.TEXTURE0);let P=function(e,i,r,a){if(e)return i instanceof eA&&e instanceof tw?i.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:rK(a.mix),offset:a.offset,buffer:0,tileSize:1}}(C,p,a,f);if(!P||!P.texture)continue;let{texture:z,mix:D,offset:L,tileSize:R,buffer:k}=P;g?(n=tu.disabled,M=T.projMatrix):h?(n=new tu(d.LEQUAL,tu.ReadWrite,i.depthRangeFor3D),M=l?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(I,y)):(n=i.depthModeForSublayer(T.overscaledZ-w,1===a.paint.get("raster-opacity")?tu.ReadWrite:tu.ReadOnly,d.LESS),M=i.transform.calculateProjMatrix(I,y));let O=i.terrain&&g?i.terrain.stencilModeForRTTOverlap(T):v[T.overscaledZ],B=s?0:a.paint.get("raster-fade-duration");C.registerFadeDuration(B);let F=r.findLoadedParent(T,0),N=rr(C,F,r,i.transform,B);i.terrain&&i.terrain.prepareDrawTile(),c.activeTexture.set(d.TEXTURE0),z.bind(x,d.CLAMP_TO_EDGE),c.activeTexture.set(d.TEXTURE1),F?(F.texture&&F.texture.bind(x,d.CLAMP_TO_EDGE),E=Math.pow(2,F.tileID.overscaledZ-C.tileID.overscaledZ),S=[C.tileID.canonical.x*E%1,C.tileID.canonical.y*E%1]):z.bind(x,d.CLAMP_TO_EDGE),z.useMipmap&&c.extTextureFilterAnisotropic&&i.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let V=i.transform,U=h?function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(V):[0,0,0,0],j,G,Z,q,$,W=0;if(u&&p instanceof e.ap&&p.coordinates.length>3)j=Float32Array.from(e.aT(e.ci(new e.bs(0,0,0)))),G=Float32Array.from(V.globeMatrix),Z=Float32Array.from(e.ce(V)),q=[e.a5(V.center.lng),e.ae(V.center.lat)],A=p.elevatedGlobePerspectiveTransform,$=p.elevatedGlobeGridMatrix||new Float32Array(9);else if(u){let i=e.cf(T.canonical);W=e.cg(i.getCenter().lat),j=Float32Array.from(e.aT(e.ci(T.canonical))),G=Float32Array.from(V.globeMatrix),Z=Float32Array.from(e.ce(V)),q=[e.a5(V.center.lng),e.ae(V.center.lat)],A=[0,0],$=Float32Array.from(e.ch(T.canonical,i,W,V.worldSize/V._pixelsPerMercatorPixel))}else A=p instanceof e.ap?p.perspectiveTransform:[0,0],j=new Float32Array(16),G=new Float32Array(9),Z=new Float32Array(16),q=[0,0],$=new Float32Array(9);let H=rS(M,j,G,Z,$,S||[0,0],e.S(i.transform.zoom),q,U,E||1,N,a,A,h?a.paint.get("raster-elevation"):0,2,D,L,f.range,R,k,m),X=i.isTileAffectedByFog(T),Y=i.getOrCreateProgram("raster",{defines:f.defines,overrideFog:X});if(i.uploadCommonUniforms(c,Y,I),p instanceof e.ap){let r=p.elevatedGlobeVertexBuffer,s=p.elevatedGlobeIndexBuffer;if(g||!l)p.boundsBuffer&&p.boundsSegments&&Y.draw(i,d.TRIANGLES,n,tc.disabled,_,tp.disabled,H,a.id,p.boundsBuffer,i.quadTriangleIndexBuffer,p.boundsSegments);else if(r&&s){let l=V.zoom<=e.bG?p.elevatedGlobeSegments:p.getSegmentsForLongitude(V.center.lng);l&&Y.draw(i,d.TRIANGLES,n,tc.disabled,_,o,H,a.id,r,s,l)}}else if(u){n=new tu(d.LEQUAL,tu.ReadOnly,i.depthRangeFor3D);let e=i.globeSharedBuffers;if(e){let[r,s,l]=e.getGridBuffers(W,!1);Y.draw(i,d.TRIANGLES,n,b||O,i.colorModeForRenderPass(),o,H,a.id,r,s,l)}}else{let{tileBoundsBuffer:e,tileBoundsIndexBuffer:r,tileBoundsSegments:o}=i.getTileBoundsBuffers(C);Y.draw(i,d.TRIANGLES,n,O,_,tp.disabled,H,a.id,e,r,o)}}if(!(p instanceof e.ap)&&u)for(let e of n){let n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&rJ(!0,e,i,r,a,m,f,o,b||tc.disabled),n&&rJ(!1,e,i,r,a,m,f,o===tp.frontCW?tp.backCW:tp.frontCW,b||tc.disabled)}};u?T(b,i.renderElevatedRasterBackface?tp.backCW:tp.frontCW,i.stencilModeFor3D()):T(b,tp.disabled,void 0),i.resetStencilClippingMasks()},"raster-particle":function(i,r,a,n,o,s){"offscreen"===i.renderPass&&function(i,r,a,n){if(!n.length)return;let o=i.context,s=o.gl,l=r.getSource();if(!(l instanceof eA))return;let h=[];for(let i of n){let n=r.getTile(i);if(!(n instanceof tw))continue;let s=function(i,r,a){if(!i)return null;let n=r.getTextureDescriptor(i,a,!0);if(!n)return null;let{texture:o,mix:s,offset:l,tileSize:h,buffer:u,format:c}=n;if(!o||!c)return null;let d=!1;return"uint32"===c&&(d=!0,s[3]=0,s=rM(e.cM,s,[0,a.paint.get("raster-particle-max-speed")]),l=rE(e.cM,l,[0,a.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[u/(h+2*u),h/(h+2*u)],tileSize:h,scalarData:d,scale:s,offset:l,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[c]]}}(n,l,a);if(!s)continue;let u=[s.tileSize,s.tileSize],c=a.tileFramebuffer;c||(c=a.tileFramebuffer=o.createFramebuffer(u[0],u[1],!0,null));let d=n.rasterParticleState,p=a.paint.get("raster-particle-count");d||(d=n.rasterParticleState=new t_(o,i,u,p));let f=d.update(a.lastInvalidatedAt);d.numParticles!==p&&d.setNumParticles(i,p);let m=d.targetColorTexture;d.targetColorTexture=d.backgroundColorTexture,d.backgroundColorTexture=m;let _=d.particleVertices0;d.particleVertices0=d.particleVertices1,d.particleVertices1=_,h.push([i,s,d,f])}if(0===h.length)return;let u=e.f.now(),c=a.previousDrawTimestamp?.001*(u-a.previousDrawTimestamp):.0167;if(a.previousDrawTimestamp=u,a.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let i=a.colorRampTexture;i||(i=a.colorRampTexture=new e.T(o,a.colorRamp,s.RGBA)),i.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(a.tileFramebuffer.framebuffer),o.activeTexture.set(s.TEXTURE0),function(i,r,a){var n;let o=i.context,s=o.gl,l=r.tileFramebuffer;o.activeTexture.set(s.TEXTURE0);let h={u_texture:0,u_opacity:1.05*(n=r.paint.get("raster-particle-fade-opacity-factor"))/(n+.05)},u=i.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let n of a){let[,,a,c]=n;l.colorAttachment.set(a.targetColorTexture.texture),o.viewport.set([0,0,l.width,l.height]),o.clear({color:e.ax.transparent}),c&&(a.backgroundColorTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),u.draw(i,s.TRIANGLES,tu.disabled,tc.disabled,td.alphaBlended,tp.disabled,h,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments))}}(i,a,h),function(i,r,a,n){let o=i.context.gl,s=a.tileFramebuffer,l="globe"===i.transform.projection.name,h=a.paint.get("raster-particle-max-speed");for(let u of n){let[n,c,d]=u;c.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.colorAttachment.set(d.targetColorTexture.texture);let p=i.getOrCreateProgram("rasterParticleDraw",{defines:c.defines,overrideFog:!1}),f=c.scalarData?[]:[0,1,2,3].map(i=>e.cG[i](n));f.push(n);let m=n.canonical.x,_=n.canonical.y;for(let e of f){let s=r.getTile(l?e.wrapped():e);if(!s)continue;let u=s.rasterParticleState;if(!u)continue;let d=rI([e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap)-m,e.canonical.y-_],0,c.texture.size,2,h,c.textureOffset,c.scale,c.offset);p.draw(i,o.POINTS,tu.disabled,tc.disabled,td.alphaBlended,tp.disabled,d,a.id,u.particleVertices0,void 0,u.particleSegment)}}}(i,r,a,h),function(e,i,r,a){let n=e.context.gl,o=i.transformFeedbackObject;o||(o=i.transformFeedbackObject=n.createTransformFeedback()),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,i.transformFeedbackObject);let s=i.paint.get("raster-particle-max-speed"),l=a*i.paint.get("raster-particle-speed-factor")*.3,h=Math.pow(i.paint.get("raster-particle-reset-rate-factor"),6);for(let a of r){let[,r,o]=a;r.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE);let u=rC(0,r.texture.size,s,l,h,r.textureOffset,r.scale,r.offset);e.getOrCreateProgram("rasterParticleUpdate",{defines:r.defines,transformFeedback:{bufferMode:n.SEPARATE_ATTRIBS,shaderVaryings:["v_new_particle"]}}).draw(e,n.POINTS,tu.disabled,tc.disabled,td.disabled,tp.disabled,u,i.id,o.particleVertices0,void 0,o.particleSegment,{},void 0,void 0,void 0,void 0,[{buffer:o.particleVertices1,targetIndex:0}])}n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null)}(i,a,h,c)}(i,r,a,n),"translucent"===i.renderPass&&(function(i,r,a,n,o){let s=i.context,l=s.gl,h=!i.options.moving,u="globe"===i.transform.projection.name;if(!n.length)return;let[c,d]=i.stencilConfigForOverlap(n),p=[];for(let n of(u&&p.push("PROJECTION_GLOBE_VIEW"),d)){let o,d,f,m,_,g,y;let x=n.toUnwrapped(),v=r.getTile(n);if(!v.rasterParticleState)continue;let b=v.rasterParticleState;v.registerFadeDuration(100);let w=r.findLoadedParent(n,0),T=rr(v,w,r,i.transform,100);i.terrain&&i.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),b.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),w&&w.rasterParticleState?(w.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),o=Math.pow(2,w.tileID.overscaledZ-v.tileID.overscaledZ
98),d=[v.tileID.canonical.x*o%1,v.tileID.canonical.y*o%1]):b.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let M=u?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(x,h),E=i.transform,S=function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(E),A=e.cf(n.canonical),I=e.cg(A.getCenter().lat);u?(f=Float32Array.from(e.aT(e.ci(n.canonical))),m=Float32Array.from(E.globeMatrix),_=Float32Array.from(e.ce(E)),g=[e.a5(E.center.lng),e.ae(E.center.lat)],y=Float32Array.from(e.ch(n.canonical,A,I,E.worldSize/E._pixelsPerMercatorPixel))):(f=new Float32Array(16),m=new Float32Array(9),_=new Float32Array(16),g=[0,0],y=new Float32Array(9));let C=rA(M,f,m,_,y,d||[0,0],e.S(i.transform.zoom),g,S,o||1,T,250),P=i.isTileAffectedByFog(n),z=i.getOrCreateProgram("rasterParticle",{defines:p,overrideFog:P});if(i.uploadCommonUniforms(s,z,x),u){let e=new tu(l.LEQUAL,tu.ReadWrite,i.depthRangeFor3D),r=i.globeSharedBuffers;if(r){let[n,o,s]=r.getGridBuffers(I,!1);z.draw(i,l.TRIANGLES,e,tc.disabled,td.alphaBlended,tp.backCCW,C,a.id,n,o,s)}}else{let e=i.depthModeForSublayer(0,tu.ReadOnly),r=c[n.overscaledZ],{tileBoundsBuffer:o,tileBoundsIndexBuffer:s,tileBoundsSegments:h}=i.getTileBoundsBuffers(v);z.draw(i,l.TRIANGLES,e,r,td.alphaBlended,tp.disabled,C,a.id,o,s,h)}}i.resetStencilClippingMasks()}(i,r,a,n),i.style.map.triggerRepaint())},background:function(e,i,r,a){let n=r.paint.get("background-color"),o=r.paint.get("background-opacity"),s=r.paint.get("background-emissive-strength");if(0===o)return;let l=e.context,h=l.gl,u=e.transform,c=u.tileSize,d=r.paint.get("background-pattern");if(e.isPatternMissing(d,r.scope))return;let p=!d&&1===n.a&&1===o&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==p)return;let f=tc.disabled,m=e.depthModeForSublayer(0,"opaque"===p?tu.ReadWrite:tu.ReadOnly),_=e.colorModeForDrapableLayerRenderPass(s),g=d?"backgroundPattern":"background",y,x=a;for(let p of(x||(x=Object.values(y=e.getBackgroundTiles()).map(e=>e.tileID)),d&&(l.activeTexture.set(h.TEXTURE0),e.imageManager.bind(e.context,r.scope)),x)){let x=e.isTileAffectedByFog(p),v=e.getOrCreateProgram(g,{overrideFog:x}),b=p.toUnwrapped(),w=a?p.projMatrix:e.transform.calculateProjMatrix(b);e.prepareDrawTile();let T=i?i.getTile(p):y?y[p.key]:new ty(p,c,u.zoom,e),M=d?rk(w,s,o,e,d,r.scope,{tileID:p,tileSize:c}):rR(w,s,o,n);e.uploadCommonUniforms(l,v,b);let{tileBoundsBuffer:E,tileBoundsIndexBuffer:S,tileBoundsSegments:A}=e.getTileBoundsBuffers(T);v.draw(e,h.TRIANGLES,m,f,_,tp.disabled,M,r.id,E,S,A)}},sky:function(i,r,a){let n=i._atmosphere?e.S(i.transform.zoom):1,o=a.paint.get("sky-opacity")*n;if(0===o)return;let s=i.context,l=a.paint.get("sky-type"),h=new tu(s.gl.LEQUAL,tu.ReadOnly,[0,1]),u=i.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===i.renderPass?a.needsSkyboxCapture(i)&&(function(i,r,a,n){let o=i.context,s=o.gl,l=r.skyboxFbo;if(!l){l=r.skyboxFbo=o.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new ae(o),r.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,r.skyboxTexture),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR);for(let e=0;e<6;++e)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(l.framebuffer),o.viewport.set([0,0,32,32]);let h=r.getCenter(i,!0),u=i.getOrCreateProgram("skyboxCapture"),c=new Float64Array(16);e.a6.identity(c),e.a6.rotateY(c,c,-(.5*Math.PI)),at(i,r,u,c,h,0),e.a6.identity(c),e.a6.rotateY(c,c,.5*Math.PI),at(i,r,u,c,h,1),e.a6.identity(c),e.a6.rotateX(c,c,-(.5*Math.PI)),at(i,r,u,c,h,2),e.a6.identity(c),e.a6.rotateX(c,c,.5*Math.PI),at(i,r,u,c,h,3),e.a6.identity(c),at(i,r,u,c,h,4),e.a6.identity(c),e.a6.rotateY(c,c,Math.PI),at(i,r,u,c,h,5),o.viewport.set([0,0,i.width,i.height])}(i,a),a.markSkyboxValid(i)):"sky"===i.renderPass&&function(e,i,r,a,n){let o=e.context,s=o.gl,l=e.transform,h=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);let u={u_matrix:l.skyboxMatrix,u_sun_direction:i.getCenter(e,!1),u_cubemap:0,u_opacity:a,u_temporal_offset:n};e.uploadCommonUniforms(o,h),h.draw(e,s.TRIANGLES,r,tc.disabled,e.colorModeForRenderPass(),tp.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(i,a,h,o,u):"gradient"===l&&"sky"===i.renderPass&&function(i,r,a,n,o){let s,l,h;let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("skyboxGradient");r.skyboxGeometry||(r.skyboxGeometry=new ae(u)),u.activeTexture.set(c.TEXTURE0);let f=r.colorRampTexture;f||(f=r.colorRampTexture=new e.T(u,r.colorRamp,c.RGBA)),f.bind(c.LINEAR,c.CLAMP_TO_EDGE);let m=(s=d.skyboxMatrix,l=r.getCenter(i,!1),h=r.paint.get("sky-gradient-radius"),{u_matrix:s,u_color_ramp:0,u_center_direction:l,u_radius:e.bj(
98h),u_opacity:n,u_temporal_offset:o});i.uploadCommonUniforms(u,p),p.draw(i,c.TRIANGLES,a,tc.disabled,i.colorModeForRenderPass(),tp.backCW,m,"skyboxGradient",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(i,a,h,o,u)},debug:function(i,r,a,n,o,s){for(let l=0;l<a.length;l++)if(o){let o=new e.ax(.8*n.r,.8*n.g,.8*n.b,1);r5(i,r,a[l],n,-1,-1,s),r5(i,r,a[l],n,-1,1,s),r5(i,r,a[l],n,1,1,s),r5(i,r,a[l],n,1,-1,s),r5(i,r,a[l],o,0,0,s)}else r5(i,r,a[l],n,0,0,s)},custom:function(i,r,a,n){let o=i.context,s=a.implementation;if(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes("custom")||i.terrain&&(i.terrain.renderingToTexture||"offscreen"===i.renderPass)&&a.isLayerDraped(r)){if("offscreen"===i.renderPass){let r=s.prerender;if(r){if(i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),"globe"===i.transform.projection.name){let a=i.transform.pointMerc;r.call(s,o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.S(i.transform.zoom),[a.x,a.y],i.transform.pixelsPerMeterRatio)}else r.call(s,o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState()}}else if("translucent"===i.renderPass){if(i.terrain&&i.terrain.renderingToTexture){let r=s.renderToTile;if(r){let a=n[0].canonical,l=new e.L(a.x+n[0].wrap*(1<<a.z),a.y,a.z);o.setDepthMode(tu.disabled),o.setStencilMode(tc.disabled),o.setColorMode(i.colorModeForRenderPass()),i.setCustomLayerDefaults(),r.call(s,o.gl,l),o.setDirty(),i.setBaseState()}return}i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),o.setStencilMode(tc.disabled);let r="3d"===s.renderingMode?new tu(i.context.gl.LEQUAL,tu.ReadWrite,i.depthRangeFor3D):i.depthModeForSublayer(0,tu.ReadOnly);if(o.setDepthMode(r),"globe"===i.transform.projection.name){let r=i.transform.pointMerc;s.render(o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.S(i.transform.zoom),[r.x,r.y],i.transform.pixelsPerMeterRatio)}else s.render(o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(i,r,a,n){if("opaque"===i.renderPass)return;let o=a.paint.get("model-opacity");if(0===o)return;let s=a.paint.get("model-cast-shadows");if("shadow"===i.renderPass&&(!s||i.terrain&&o<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof e.Z))return;let l=i.shadowRenderer,h=a.paint.get("model-receive-shadows");l&&(l.useNormalOffset=!0,h||(l.enabled=!1));let u=()=>{l&&(l.useNormalOffset=!0,h||(l.enabled=!0))},c=r.getSource();if("light-beam"===i.renderPass&&"batched-model"!==c.type)return;if("vector"===c.type||"geojson"===c.type)return function(i,r,a,n){let o=i.transform;if("mercator"!==o.projection.name)return void e.w(`Drawing 3D models for ${o.projection.name} projection is not yet implemented`);let s=o.getFreeCameraOptions().position;if(!i.modelManager)return;let l=i.modelManager;a.modelManager=l;let h=i.shadowRenderer;if(!a._unevaluatedLayout._values.hasOwnProperty("model-id"))return;let u=a._unevaluatedLayout._values["model-id"],c={...a.layout.get("model-id").parameters};for(let d of n){let n=r.getTile(d).getBucket(a);if(!n||n.projection.name!==o.projection.name)continue;let p=function(i,r){let a=1<<i.canonical.z,n=r.getFreeCameraOptions().position,o=r.elevation,s=i.canonical.x/a,l=(i.canonical.x+1)/a,h=i.canonical.y/a,u=(i.canonical.y+1)/a,c=r._centerAltitude;if(o){let e=o.getMinMaxForTile(i);e&&e.max>c&&(c=e.max)}let d=e.aa(n.x,s,l)-n.x,p=e.aa(n.y,h,u)-n.y,f=e.bl(c,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(d*d+p*p+f*f))}(d,o);c.zoom=p;let f=u.possiblyEvaluate(c);if(function(i,r,a){let n=r.updateZoomBasedPaintProperties(),o=function(i,r,a){let n,o,s,l=i.terrain?i.terrain.exaggeration():0;if(i.terrain&&l>0){let r=i.terrain,o=r.findDEMTileFor(a);o&&o.dem?n=e.cU.create(r,a,o):l=0}if(0===l&&(r.terrainElevationMin=0,r.terrainElevationMax=0),l===r.validForExaggeration&&(0===l||n&&n._demTile&&n._demTile.tileID===r.validForDEMTile.id&&n._dem._timestamp===r.validForDEMTile.timestamp))return!1;for(let e in r.instancesPerModel){let i=r.instancesPerModel[e];for(let e=0;e<i.instancedDataArray.length;++e){let a=(n?l*n.getElevationAt(0|i.instancedDataArray.float32[16*e],0|i.instancedDataArray.float32[16*e+1],!0,!0):0)+i.instancesEvaluatedElevation[e];i.instancedDataArray.float32[16*e+6]=a,o=o?Math.min(r.terrainElevationMin,a):a,s=s?Math.max(r.terrainElevationMax,a):a}}return r.terrainElevationMin=o||0,r.terrainElevationMax=s||0,r.validForExaggeration=l,r.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(i,r,a);(n||o)&&(r.uploaded=!1,r.upload(i.context))}(i,n,d),ac.shadowUniformsInitialized=!1,ac.useSingleShadowCascade=!!h&&0===h.getMaxCascadeForTile(d.toUnwrapped()),"shadow"===i.renderPass&&h){if(1===i.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;let r=o.calculatePosMatrix(d.toUnwrapped(),o.worldSize);if(ac.tileMatrix.set(r),ac.shadowTileMatrix=Float32Array.from(h.calculateShadowPassMatrixFromMatr
98ix(r)),ac.aabb.min.fill(0),ac.aabb.max[0]=ac.aabb.max[1]=e.V,ac.aabb.max[2]=0,function(i,r,a,n){if(!a.modelManager)return!0;let o=a.modelManager;if(!a.shadowRenderer)return!0;let s=a.shadowRenderer,l=r.aabb,h=!0,u=i.maxHeight;if(0===u){let e=0;for(let r in i.instancesPerModel){let i=o.getModel(r,n);i?e=Math.max(e,Math.max(Math.max(i.aabb.max[0],i.aabb.max[1]),i.aabb.max[2])):h=!1}u=i.maxScale*e*1.41+i.maxVerticalOffset,h&&(i.maxHeight=u)}l.max[2]=u,l.min[2]+=i.terrainElevationMin,l.max[2]+=i.terrainElevationMax,e.N.transformMat4(l.min,l.min,r.tileMatrix),e.N.transformMat4(l.max,l.max,r.tileMatrix);let c=l.intersects(s.getCurrentCascadeFrustum());return 0===a.currentShadowCascade&&(i.isInsideFirstShadowMapFrustum=2===c),0===c}(n,ac,i,a.scope))continue}let m=1<<d.canonical.z,_=[((s.x-d.wrap)*m-d.canonical.x)*e.V,(s.y*m-d.canonical.y)*e.V,s.z*m*e.V];for(let e in n.instancesPerModel){let r=n.instancesPerModel[e];r.features.length>0&&(e=f.evaluate(r.features[0].feature,{}));let o=l.getModel(e,a.scope);if(o&&o.uploaded)for(let e of o.nodes)(function e(i,r,a,n,o,s,l){let h=i.context,u="shadow"===i.renderPass,c=i.shadowRenderer,d=u&&c?c.getShadowPassDepthMode():new tu(h.gl.LEQUAL,tu.ReadWrite,i.depthRangeFor3D),p=i.isTileAffectedByFog(s);if(a.meshes)for(let e of a.meshes){let f,m,_;let g=["MODEL_POSITION_ON_GPU"],y=[];n.instancedDataArray.length>20&&g.push("INSTANCED_ARRAYS");let x=iM(i,r.paint.get("model-cutoff-fade-range"));if(x.shouldRenderCutoff&&g.push("RENDER_CUTOFF"),u&&c)f=i.getOrCreateProgram("modelDepth",{defines:g}),m=rF(l.shadowTileMatrix,l.shadowTileMatrix,Float32Array.from(a.matrix)),_=c.getShadowPassColorMode();else{al(g,y,e,i),f=i.getOrCreateProgram("model",{defines:g,overrideFog:p});let n=e.material,u=n.pbrMetallicRoughness,d=r.paint.get("model-opacity"),v=r.paint.get("model-emissive-strength").constantOr(0);m=rO(s.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),i,d,u.baseColorFactor,n.emissiveFactor,u.metallicFactor,u.roughnessFactor,n,v,r,o),c&&(l.shadowUniformsInitialized?f.setShadowUniformValues(h,c.getShadowUniformValues()):(c.setupShadows(s.toUnwrapped(),f,"model-tile",s.overscaledZ),l.shadowUniformsInitialized=!0)),_=x.shouldRenderCutoff||d<1||"OPAQUE"!==n.alphaMode?td.alphaBlended:td.unblended}i.uploadCommonUniforms(h,f,s.toUnwrapped(),null,x);let v=e.material.doubleSided?tp.disabled:tp.backCCW;if(n.instancedDataArray.length>20)y.push(n.instancedDataBuffer),f.draw(i,h.gl.TRIANGLES,d,tc.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y,n.instancedDataArray.length);else{let a=u?"u_instance":"u_normal_matrix";for(let o=0;o<n.instancedDataArray.length;++o)m[a]=new Float32Array(n.instancedDataArray.arrayBuffer,64*o,16),f.draw(i,h.gl.TRIANGLES,d,tc.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y)}}if(a.children)for(let h of a.children)e(i,r,h,n,o,s,l)})(i,a,e,r,_,d,ac)}}}(i,r,a,n),void u();if(!c.loaded())return;if("batched-model"===c.type)return function(i,r,a,n){a.resetLayerRenderingStats(i);let o=i.context,s=i.transform,l=i.style.fog,h=i.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);let u=i.transform.getFreeCameraOptions().position,c=e.N.scale([],[u.x,u.y,u.z],i.transform.worldSize);e.N.negate(c,c);let d=e.a6.identity([]),p=e.cR(s.center.lat,s.zoom),f=e.a6.fromScaling([],[1,1,1/p]);e.a6.translate(d,d,c);let m=a.paint.get("model-opacity"),_=new tu(o.gl.LEQUAL,tu.ReadWrite,i.depthRangeFor3D),g=new tu(o.gl.LEQUAL,tu.ReadOnly,i.depthRangeFor3D),y=new e.bS([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),x="shadow"===i.renderPass,v=x&&h?h.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),b=a.getLayerRenderingStats(),w=function(u,c){for(let p of n){let n=r.getTile(p).getBucket(a);if(!n||!n.uploaded)continue;let w=!1;h&&(w=0===h.getMaxCascadeForTile(p.toUnwrapped()));let T=s.calculatePosMatrix(p.toUnwrapped(),s.worldSize),M=n.modelTraits;for(let r of n.getNodesInfo()){if(r.hiddenByReplacement||!r.node.meshes)continue;let n=r.evaluatedScale,E=r.node,S=0;if(i.terrain&&E.elevation&&(S=E.elevation*i.terrain.exaggeration()),n[0]<=1&&n[1]<=1&&n[2]<=1&&0===(()=>{let i=r.getLocalBounds();return y.min=[...i.min],y.max=[...i.max],y.min[2]+=S,y.max[2]+=S,e.N.transformMat4(y.min,y.min,T),e.N.transformMat4(y.max,y.max,T),y})().intersects(v))continue;let A="light-beam"===i.renderPass,I=[...T];
98e.a6.translate(I,I,[(E.anchor?E.anchor[0]:0)*(n[0]-1),(E.anchor?E.anchor[1]:0)*(n[1]-1),S]),e.N.exactEquals(n,e.cT)||e.a6.scale(I,I,n),e.a6.multiply(I,I,E.matrix);let C=e.a6.multiply([],f,I);e.a6.multiply(C,d,C);let P=e.a6.invert([],C);e.a6.transpose(P,P),e.a6.scale(P,P,ad);let z=e.a6.multiply([],s.expandedFarZProjMatrix,I),D=M&e.cV.HasMapboxMeshFeatures,L=D?0:r.evaluatedRMEA[0][2];for(let e=0;e<E.meshes.length;++e){let n;let d=E.meshes[e],f=e===E.lightMeshIndex;if(f){if(!A&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}}else if(A)continue;let y={defines:[]},v=[];if(al(y.defines,v,d,i),D||y.defines.push("DIFFUSE_SHADED"),w&&y.defines.push("SHADOWS_SINGLE_CASCADE"),b&&(x?b.numRenderedVerticesInShadowPass+=d.vertexArray.length:b.numRenderedVerticesInTransparentPass+=d.vertexArray.length),x){au(d,I,i,a);continue}let T=null;if(l){let e=as(I,i.transform);if(T=new Float32Array(e),"globe"!==s.projection.name){let i=d.aabb.min,r=d.aabb.max,[a,n]=l.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);y.overrideFog=a>=.05||n>=.05}}let M=d.material;M.occlusionTexture&&M.occlusionTexture.offsetScale&&(n=M.occlusionTexture.offsetScale,y.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!x&&h&&(h.useNormalOffset=!!d.normalBuffer);let S=i.getOrCreateProgram("model",y);!x&&h&&h.setupShadowsFromMatrix(I,S,h.useNormalOffset),i.uploadCommonUniforms(o,S,p.toUnwrapped(),T);let R=M.pbrMetallicRoughness;R.metallicFactor=.9,R.roughnessFactor=.5;let k=rO(new Float32Array(z),new Float32Array(C),new Float32Array(P),i,m,R.baseColorFactor,M.emissiveFactor,R.metallicFactor,R.roughnessFactor,M,L,a,[0,0,0],n);S.draw(i,o.gl.TRIANGLES,c&&!f?_:g,tc.disabled,u?f||m<1||r.hasTranslucentParts?td.alphaBlended:td.unblended:td.disabled,tp.backCCW,k,a.id,d.vertexBuffer,d.indexBuffer,d.segments,a.paint,i.transform.zoom,void 0,v)}}}};(function(e,i,r,a){let n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(let s of a){let a=i.getTile(s).getBucket(r);a&&(e.conflationActive&&a.updateReplacement(s,e.replacementSource),a.evaluateScale(e,r),e.terrain&&n>0&&a.elevationUpdate(e.terrain,n,s,r.source),a.needsReEvaluation(e,o,r)&&a.evaluate(r))}})(i,r,a,n),1===m?w(!0,!0):(w(!1,!0),w(!0,!1))}(i,r,a,n),void u();let d=c.getModels(),p=[],f=i.transform.getFreeCameraOptions().position,m=e.N.scale([],[f.x,f.y,f.z],i.transform.worldSize);e.N.negate(m,m);let _=[],g=[],y=0;for(let r of d){let n=a.paint.get("model-rotation").constantOr(null),o=a.paint.get("model-scale").constantOr(null),s=a.paint.get("model-translation").constantOr(null);r.computeModelMatrix(i,n,o,s,!0,!0,!1);let l=e.a6.identity([]),h=e.cR(r.position.lat,i.transform.zoom),u=e.a6.fromScaling([],[1,1,1/h]);for(let a of(e.a6.translate(l,l,m),p.push({zScaleMatrix:u,negCameraPosMatrix:l}),r.nodes))!function i(r,a,n,o,s,l,h){let u;u="globe"===r.projection.name?e.cS(n,r):[...n],e.a6.multiply(u,u,a.matrix);let c=e.a6.multiply([],o,u);if(a.meshes)for(let i of a.meshes){if("BLEND"!==i.material.alphaMode){h.push({mesh:i,depth:0,modelIndex:s,worldViewProjection:c,nodeModelMatrix:u});continue}let r=e.N.transformMat4([],i.centroid,c);r[2]>0&&l.push({mesh:i,depth:r[2],modelIndex:s,worldViewProjection:c,nodeModelMatrix:u})}if(a.children)for(let e of a.children)i(r,e,n,o,s,l,h)}(i.transform,a,r.matrix,i.transform.expandedFarZProjMatrix,y,_,g);y++}if(_.sort((e,i)=>i.depth-e.depth),"shadow"!==i.renderPass){if(1===o)for(let e of g)ah(e,i,a,p[e.modelIndex],tc.disabled,i.colorModeForRenderPass());else{for(let e of g)ah(e,i,a,p[e.modelIndex],tc.disabled,td.disabled);for(let e of g)ah(e,i,a,p[e.modelIndex],i.stencilModeFor3D(),i.colorModeForRenderPass());i.resetStencilClippingMasks()}for(let e of _)ah(e,i,a,p[e.modelIndex],tc.disabled,i.colorModeForRenderPass());u()}else{for(let e of g)au(e.mesh,e.nodeModelMatrix,i,a);for(let e of _)au(e.mesh,e.nodeModelMatrix,i,a);u()}}},ag={model:function(e,i,r){let a=e.scope,n=i.getSource();if(n.loaded()){if("vector"===n.type||"geojson"===n.type)return void(r.modelManager&&r.modelManager.upload(r,a));if("batched-model"!==n.type)for(let e of n.getModels())e.upload(r.context)}},raster:function(e,i,r){let a=i.getSource();if(!(a instanceof eA&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)},"raster-particle":function(e,i,r){let a=i.getSource();if(!(a instanceof eA&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-particle-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)}};class ay{constructor(i,r,a,n){this.context=new tf(i,r),this.transform=a,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=n,this._debugParams={showTerrainProxyTiles:!1},n.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),this.setup(),this.numSublayers=tM.maxUnderzooming+tM.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.cX,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new iI(this),this._wireframeDebugCache=new af,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0}updateTerrain(e,i){let r=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(r||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new rs(this,e));let a=this._terrain;this.transform.elevation=r?a:null,a.update(e,this.transform,i),this.transform.elevation&&!a.enabled&&(this.transform.elevation=null)}_updateFog(e){let i=e.fog;if(!i||"globe"===this.transform.projection.name||1>i.getOpacity(this.transform.pitch)||.03>i.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[r,a]=i.getFovAdjustedRange(this.transform._fov);if(r>a)return void(this.transform.fogCullDistSq=null);let n=r+.78*(a-r);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,r){if(this.width=i*e.f.devicePixelRatio,this.height=r*e.f.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style.order)this.style._mergedLayers[e].resize()}setup(){let i=this.context,r=new e.aN;r.emplaceBack(0,0),r.emplaceBack(e.V,0),r.emplaceBack(0,e.V),r.emplaceBack(e.V,e.V),this.tileExtentBuffer=i.createVertexBuffer(r,e.aP.members),this.tileExtentSegments=e.aB.simpleSegment(0,0,4,2);let a=new e.aN;a.emplaceBack(0,0),a.emplaceBack(e.V,0),a.emplaceBack(0,e.V),a.emplaceBack(e.V,e.V),this.debugBuffer=i.createVertexBuffer(a,e.aP.members),this.debugSegments=e.aB.simpleSegment(0,0,4,5);let n=new e.aN;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(n,e.aP.members),this.viewportSegments=e.aB.simpleSegment(0,0,4,2);let o=new e.av;
98o.emplaceBack(0,0,0,0),o.emplaceBack(e.V,0,e.V,0),o.emplaceBack(0,e.V,0,e.V),o.emplaceBack(e.V,e.V,e.V,e.V),this.mercatorBoundsBuffer=i.createVertexBuffer(o,e.aR.members),this.mercatorBoundsSegments=e.aB.simpleSegment(0,0,4,2);let s=new e.aw;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(s);let l=new e.aO;for(let e of[0,1,3,2,0])l.emplaceBack(e);this.debugIndexBuffer=i.createIndexBuffer(l),this.emptyTexture=new e.T(i,new e.h({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA),this.identityMat=e.a6.create();let h=this.context.gl;this.stencilClearMode=new tc({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,tu.disabled,this.stencilClearMode,td.disabled,tp.disabled,ri(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,i,r){if(!i||this.currentStencilSource===i.id||!e.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(let i of r)if(void 0===this._tileClippingMaskIDs[i.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;let a=this.context,n=a.gl;this.nextStencilID+r.length>256&&this.clearStencil(),a.setColorMode(td.disabled),a.setDepthMode(tu.disabled);let o=this.getOrCreateProgram("clippingMask");for(let e of(this._tileClippingMaskIDs={},r)){let r=i.getTile(e),a=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:l,tileBoundsSegments:h}=this.getTileBoundsBuffers(r);o.draw(this,n.TRIANGLES,tu.disabled,new tc({func:n.ALWAYS,mask:0},a,255,n.KEEP,n.KEEP,n.REPLACE),td.disabled,tp.disabled,ri(e.projMatrix),"$clipping",s,l,h)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,i=this.context.gl;return new tc({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);let i=this.context.gl;return new tc({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(e){let i=this.context.gl,r=e.sort((e,i)=>i.overscaledZ-e.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let r=0;r<n;r++)e[r+a]=new tc({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[a]:tc.disabled},r]}colorModeForRenderPass(){let i=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new td([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new e.ax(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?td.unblended:td.alphaBlended}colorModeForDrapableLayerRenderPass(i){let r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?new td([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.ax(0,0,0,void 0===i?0:i),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,i,r,a=!1){if(!this.opaquePassEnabledForLayer()&&!a)return tu.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tu(r||this.context.gl.LEQUAL,i,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,r){this._wireframeDebugCache.update(this.frameCounter),this.style=i,this.options=r;let a=this.style._mergedLayers,n=this.style.order,o=n.map(e=>a[e]),s=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(e.f.now()),this.imageManager.beginFrame();let l=0,h=!1;for(let e in s){let i=s[e];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++l)}for(let e of o)e.isHidden(this.transform.zoom)||this.prepareLayer(e);let u={},c={},d={},p={},f={};for(let e in s){let i=s[e];u[e]=i.getVisibleCoordinates(),c[e]=u[e].slice().reverse(),d[e]=i.getVisibleCoordinates(!0).reverse(),p[e]=i.get
98ShadowCasterCoordinates(),f[e]=i.sortCoordinatesByDistance(u[e])}let m=e=>{let i=this.style.getLayerSourceCache(e);return i&&i.used?i.getSource():null};if(l){let e=[];for(let i of o)this.layerUsedInConflation(i,m(i))&&e.push(i);if(e&&e.length>1){let i=[];for(let r of e){let e=this.style.getLayerSourceCache(r);e&&e.used&&e.getSource().usedInConflation&&i.push({layer:r.fqid,cache:e})}this.replacementSource.setSources(i),h=!0}}for(let e of(h||this.replacementSource.clear(),this.conflationActive=h,this.minCutoffZoom=0,this.longestCutoffRange=0,o)){let i=e.cutoffRange();if(this.longestCutoffRange=Math.max(i,this.longestCutoffRange),i>0){let i=m(e);i&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom)),e.minzoom&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom))}}this.opaquePassCutoff=1/0;for(let e=0;e<o.length;e++)if(o[e].is3D()){this.opaquePassCutoff=e;break}let _=this.style&&this.style.fog;_?(this._fogVisible=0!==_.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=_.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(d),this.opaquePassCutoff=0);let g=this._shadowRenderer;if(g)for(let e in g.updateShadowParameters(this.transform,this.style.directionalLight),s)for(let i of u[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(i)||e),g.addShadowReceiver(i.toUnwrapped(),e.min,e.max)}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.cY(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ao(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!e.cZ(this.context.gl))return;for(let e of(this.renderPass="offscreen",o)){let r=i.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let a=r?c[r.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||a&&a.length)&&this.renderLayer(this,r,e,a)}this.depthRangeFor3D=[0,1-(o.length+2)*this.numSublayers*this.depthEpsilon];let y=this.terrain;y&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&!this.transform.isOrthographic&&y.drawDepth(),this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,p)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let x="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),v=(()=>{if(r.showOverdrawInspector)return e.ax.black;if(this.style.fog&&this.transform.projection.supportsFog&&!x){let i=this.style.fog.properties.get("color").toArray01();return new e.ax(...i)}if(this.style.fog&&this.transform.projection.supportsFog&&x){let i=this.style.fog.properties.get("space-color").toArray01();return new e.ax(...i)}return e.ax.transparent})();if(this.context.clear({color:v,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&x&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){let e=o[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())continue;let a=r?(e.is3D()?f:c)[r.id]:void 0;this._renderTileClippingMasks(e,r,a),this.renderLayer(this,r,e,a)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&x&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.S(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let e=o[this.currentLayer],r=i.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?c[r.id]:void 0)}function b(e,i){let r;return i&&(r=("symbol"===e.type?d:e.is3D()?f:c)[i.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<n.length;){let e=o[this.currentLayer];if("raster"===e.type){let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,b(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let w=0;for(g&&(w=g.getShadowCastingLayerCount());this.currentLayer<n.length;){let e=o[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(y&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=y.renderBatch(this.currentLayer)}else{if(this._renderTileClippingMasks(e,r,r?u[r.id]:void 0),this.renderLayer(this,r,e,b(e,r)),!y&&g&&w>0&&e.hasShadowPass()&&0==--w&&(g.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){let e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){let e=o[this.currentLayer];if(!e.hasLightBeamPass())continue;let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,r?c[r.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let r=null;
98o.forEach(e=>{let a=i.getLayerSourceCache(e);a&&!e.isHidden(this.transform.zoom)&&a.getVisibleCoordinates().length&&(!r||r.getSource().maxzoom<a.getSource().maxzoom)&&(r=a)}),r&&this.options.showTileBoundaries&&a_.debug(this,r,r.getVisibleCoordinates(),e.ax.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&a_.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.ax(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){var i,r;let a=e.transform.padding;r4(e,e.transform.height-(a.top||0),3,rQ),r4(e,a.bottom||0,3,r0),r6(e,a.left||0,3,r1),r6(e,e.transform.width-(a.right||0),3,r2);let n=e.transform.centerPoint;i=n.x,r=e.transform.height-n.y,r8(e,i-1,r-10,2,20,r3),r8(e,i-10,r-1,20,2,r3)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),h||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);let{unsupportedLayers:i}=this.transform.projection,r=!i||!i.includes(e.type);if(ag[e.type]&&(r||this.terrain&&"custom"===e.type)){let i=this.style.getLayerSourceCache(e);ag[e.type](e,i,this)}this.gpuTimingEnd()}renderLayer(e,i,r,a){r.isHidden(this.transform.zoom)||("background"===r.type||"sky"===r.type||"custom"===r.type||"model"===r.type||"raster"===r.type||"raster-particle"===r.type||a&&a.length)&&(this.id=r.id,this.gpuTimingStart(r),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(r.type)&&(!e.terrain||"custom"!==r.type)||a_[r.type](e,i,r,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery,r=this.context.gl,a=this.gpuTimers[e.id];a||(a=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:r.createQuery()}),a.calls++,r.beginQuery(i.TIME_ELAPSED_EXT,a.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let e=this.context.extTimerQuery,i=this.context.gl,r=i.createQuery();this.deferredRenderGpuTimeQueries.push(r),i.beginQuery(e.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){let e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){let i={};for(let r in e){let a=e[r],n=this.context.extTimerQuery,o=n.getQueryParameter(a.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(a.query),i[r]=o}return i}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;let i=this.context.extTimerQuery,r=this.context.gl,a=0;for(let n of e)a+=i.getQueryParameter(n,r.QUERY_RESULT)/1e6,i.deleteQueryEXT(n);return a}translatePosMatrix(i,r,a,n,o){if(!a[0]&&!a[1])return i;let s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){let e=Math.sin(s),i=Math.cos(s);a=[a[0]*i-a[1]*e,a[0]*e+a[1]*i]}let l=[o?a[0]:e.a3(r,a[0],this.transform.zoom),o?a[1]:e.a3(r,a[1],this.transform.zoom),0],h=new Float32Array(16);return e.a6.translate(h,i,l),h}saveTileTexture(e){let i=e.size[0],r=this._tileTextures[i];r?r.push(e):this._tileTextures[i]=[e]}getTileTexture(e){let i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e,i){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString(),i)}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,i,r){let a=void 0===r?this.terrain&&this.terrain.renderingToTexture:r,n=this.terrain&&0===this.terrain.exaggeration(),o=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(o.push("LIGHTING_3D_MODE"),o.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):a||o.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass?this._shadowMapDebug||o.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?o.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):o.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(o.push("TERRAIN"),this.linearFloatFilteringSupported()&&o.push("TERRAIN_DEM_FLOAT_FORMAT"),n&&o.push("ZERO_EXAGGERATION")),"globe"===this.transform.projection.name&&o.push("GLOBE"),this._fogVisible&&!a&&(void 0===i||i)&&o.push("FOG","FOG_DITHERING"),a&&o.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&o.push("OVERDRAW_INSPECTOR"),o}getOrCreateProgram(e,i){this.cache=this.cache||{};let r=i&&i.defines||[],a=i&&i.config,n=i&&i.transformFeedback,o=this.currentGlobalDefines(e,i&&i.overrideFog,i&&i.overrideRtt).concat(r),s=ru.cacheKey(i0[e],e,o,a);
98return this.cache[s]||(this.cache[s]=new ru(this.context,e,i0[e],a,rN[e],o,n)),this.cache[s]}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(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,r){if(this.style.enable3dLights()){let a=this.style.directionalLight,n=this.style.ambientLight;if(a&&n){let o=((i,r)=>{let a=i.properties.get("direction"),n=i.properties.get("color").toArray01(),o=i.properties.get("intensity"),s=r.properties.get("color").toArray01(),l=r.properties.get("intensity"),h=[a.x,a.y,a.z],u=e.cn(s,l),c=e.cn(n,o);return{u_lighting_ambient_color:u,u_lighting_directional_dir:h,u_lighting_directional_color:c,u_ground_radiance:function(i,r,a){let n=function(i,r,a){let n,o,s;let l=e.N.dot(r,i),h=(n=1-.3*Math.min(e.N.dot(a,[.2126,.7152,.0722]),1),(1-(o=Math.min(l+1,1)))*n+1*o);return((1-(s=Math.asin(e.aa(r[2],-1,1))/Math.PI+.5))*.92+1*s)*h}(i,[0,0,1],r),o=[0,0,0];e.N.scale(o,a.slice(0,3),n);let s=[0,0,0];e.N.scale(s,r.slice(0,3),i[2]);let l=[0,0,0];return e.N.add(l,o,s),e.bU(l)}(h,c,u)}})(a,n);r.setLightsUniformValues(i,o)}}}uploadCommonUniforms(i,r,a,n,o){if(this.uploadCommonLightUniforms(i,r),this.terrain&&this.terrain.renderingToTexture)return;let s=this.style.fog;if(s){let o=s.getOpacity(this.transform.pitch),l=((i,r,a,n,o,s,l,h,u,c,d,p)=>{let f=i.transform,m=r.properties.get("color").toArray01();m[3]=n;let _=i.frameCounter/1e3%1,[g,y]=r.properties.get("vertical-range");return{u_fog_matrix:a?f.calculateFogTileMatrix(a):p||i.identityMat,u_fog_range:r.getFovAdjustedRange(f._fov),u_fog_color:m,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(g,y),y],u_fog_temporal_offset:_,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:h,u_globe_pos:u,u_globe_radius:c,u_viewport:d,u_globe_transition:e.S(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,s,a,o,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.f.devicePixelRatio,this.transform.height*e.f.devicePixelRatio],n);r.setFogUniformValues(i,l)}o&&r.setCutoffUniformValues(i,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){let e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){let e=this.context.gl,i=e.createTexture();return e.bindTexture(e.TEXTURE_2D,i),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),i}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){let e=this._backgroundTiles,i=this._backgroundTiles={};for(let r of this.transform.coveringTiles({tileSize:512}))i[r.key]=e[r.key]||new ty(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}layerUsedInConflation(e,i){return!(!e.is3D()||e.minzoom&&e.minzoom>this.transform.zoom||"building"!==e.sourceLayer&&(!i||"batched-model"!==i.type))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let i=this._cachedTileFogOpacities[e.key];
98return i||(this._cachedTileFogOpacities[e.key]=i=this.style.fog.getOpacityForTile(e)),i[0]>=.05||i[1]>=.05}}function ax(e,i){let r=!1,a=null,n=()=>{a=null,r&&(e(),a=setTimeout(n,i),r=!1)};return()=>(r=!0,a||n(),a)}class av{constructor(i){this._hashName=i&&encodeURIComponent(i),e.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ax(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let e=this._map;if(!e)return"";let i=ab(e);if(this._hashName){let e=this._hashName,r=!1,a=location.hash.slice(1).split("&").map(a=>{let n=a.split("=")[0];return n===e?(r=!0,`${n}=${i}`):a}).filter(e=>e);return r||a.push(`${e}=${i}`),`#${a.join("&")}`}return`#${i}`}_getCurrentHash(){let e=location.hash.replace("#","");if(this._hashName){let i;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(i=e)}),(i&&i[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._map;if(!e)return!1;let i=this._getCurrentHash();if(i.length>=3&&!i.some(e=>isNaN(e))){let r=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(i[3]||0):e.getBearing();return e.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function ab(e,i){let r=e.getCenter(),a=Math.round(100*e.getZoom())/100,n=Math.pow(10,Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10)),o=Math.round(r.lng*n)/n,s=Math.round(r.lat*n)/n,l=e.getBearing(),h=e.getPitch(),u=i?`/${o}/${s}/${a}`:`${a}/${s}/${o}`;return(l||h)&&(u+="/"+Math.round(10*l)/10),h&&(u+=`/${Math.round(h)}`),u}let aw={linearity:.3,easing:e.c_(0,0,.3,1)},aT=e.e({deceleration:2500,maxSpeed:1400},aw),aM=e.e({deceleration:20,maxSpeed:1400},aw),aE=e.e({deceleration:1e3,maxSpeed:360},aw),aS=e.e({deceleration:1e3,maxSpeed:90},aw);class aA{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.f.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,r=e.f.now();for(;i.length>0&&r-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let r={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let o=aC(r.pan.mag(),a,e.e({},aT,i||{}));n.offset=r.pan.mult(o.amount/r.pan.mag()),n.center=this._map.transform.center,aI(n,o)}if(r.zoom){let e=aC(r.zoom,a,aM);n.zoom=this._map.transform.zoom+e.amount,aI(n,e)}if(r.bearing){let i=aC(r.bearing,a,aE);n.bearing=this._map.transform.bearing+e.aa(i.amount,-179,179),aI(n,i)}if(r.pitch){let e=aC(r.pitch,a,aS);n.pitch=this._map.transform.pitch+e.amount,aI(n,e)}if(n.zoom||n.bearing){let e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function aI(e,i){(!e.duration||e.duration<i.duration)&&(e.duration=i.duration,e.easing=i.easing)}function aC(i,r,a){let{maxSpeed:n,linearity:o,deceleration:s}=a,l=e.aa(i*o/(r/1e3),-n,n),h=Math.abs(l)/(s*o);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class aP extends e.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let o=m(r.getCanvasContainer(),a);super(i,e.e({point:o,lngLat:r.unproject(o),originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class az extends e.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a){let n="touchend"===i?a.changedTouches:a.touches,o=_(r.getCanvasContainer(),n),s=o.map(e=>r.unproject(e)),l=o.reduce((e,i,r,a)=>e.add(i.div(a.length)),new e.P(0,0));super(i,{points:o,point:l,lngLats:s,lngLat:r.unproject(l),originalEvent:a}),this._defaultPrevented=!1}}class aD extends e.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){super(e,{originalEvent:r}),this._defaultPrevented=!1}}class aL{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new aD(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new aP(e.type,this._map,e))}mouseup(e){this._map.fire(new aP(e.type,this._map,e))}preclick(i){let r=e.e({},i);r.type="preclick",this._map.fire(new aP(r.type,this._map,r))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||(this.preclick(e),this._map.fire(new aP(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new aP(e.type,this._map,e))}mouseover(e){this._map.fire(new aP(e.type,this._map,e))}mouseout(e){this._map.fire(new aP(e.type,this._map,e))}touchstart(e){return this._firePreventable(new az(e.type,this._map,e))}touchmove(e){this._map.fire(new az(e.type,this._map,e))}touchend(e){this._map.fire(new az(e.type,this._map,e))}touchcancel(e){this._map.fire(new az(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class aR{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new aP(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new aP("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new aP(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ak{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&0===e.button&&(c(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;let r=this._startPos,a=this._lastPos;if(!r||!a||a.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=s("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),l=Math.min(r.y,i.y),h=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${n}px,${l}px)`,this._box.style.width=o-n+"px",this._box.style.height=h-l+"px")})}mouseupWindow(i,r){if(!this._active)return;let a=this._startPos;if(a&&0===i.button){if(this.reset(),f(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.b("boxzoomend",{originalEvent:i})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}
98keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),d(),delete this._startPos,delete this._lastPos}_fireEvent(i,r){return this._map.fire(new e.b(i,{originalEvent:r}))}}function aO(e,i){let r={};for(let a=0;a<e.length;a++)r[e[a].identifier]=i[a];return r}class aB{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=i.timeStamp),a.length===this.numTouches&&(this.centroid=function(i){let r=new e.P(0,0);for(let e of i)r._add(e);return r.div(i.length)}(r),this.touches=aO(a,r)))}touchmove(e,i,r){if(this.aborted||!this.centroid)return;let a=aO(r,i);for(let e in this.touches){let i=a[e];(!i||i.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,i,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class aF{constructor(e){this.singleTap=new aB(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,i,r){this.singleTap.touchstart(e,i,r)}touchmove(e,i,r){this.singleTap.touchmove(e,i,r)}touchend(e,i,r){let a=this.singleTap.touchend(e,i,r);if(a){let i=e.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class aN{constructor(){this._zoomIn=new aF({numTouches:1,numTaps:2}),this._zoomOut=new aF({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,r){this._zoomIn.touchstart(e,i,r),this._zoomOut.touchstart(e,i,r)}touchmove(e,i,r){this._zoomIn.touchmove(e,i,r),this._zoomOut.touchmove(e,i,r)}touchend(e,i,r){let a=this._zoomIn.touchend(e,i,r),n=this._zoomOut.touchend(e,i,r);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()+1,around:i.unproject(a)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()-1,around:i.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let aV={0:1,2:2};class aU{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,i){return!1}_move(e,i){return{}}mousedown(e,i){if(this._lastPoint)return;let r=g(e);this._correctButton(e,r)&&(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(e,i){let r=this._lastPoint;if(r){if(e.preventDefault(),null!=this._eventButton&&function(e,i){let r=aV[i];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton))this.reset();else if(this._moved||!(i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}}mouseupWindow(e){this._lastPoint&&g(e)===this._eventButton&&(this._moved&&f(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class aj extends aU{mousedown(e,i){super.mousedown(e,i),this._lastPoint&&(this._active=!0)}_correctButton(e,i){return 0===i&&!e.ctrlKey}_move(e,i){return{around:i,panDelta:i.sub(e)}}}class aG extends aU{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=.8*(i.x-e.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(e){e.preventDefault()}}class aZ extends aU{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=-.5*(i.y-e.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(e){e.preventDefault()}}class aq{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,i,r){return this._calculateTransform(e,i,r)}touchmove(i,r,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!e.c$())return void this._showTouchPanBlockerAlert();
98"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,r,a)}}touchend(e,i,r){this._calculateTransform(e,i,r),this._active&&r.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,r,a){a.length>0&&(this._active=!0);let n=aO(a,r),o=new e.P(0,0),s=new e.P(0,0),l=0;for(let e in n){let i=n[e],r=this._touches[e];r&&(o._add(i),s._add(i.sub(r)),l++,n[e]=i)}if(this._touches=n,l<this._minTouches||!s.mag())return;let h=s.div(l);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(l),panDelta:h}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(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&&!this._alertContainer&&(this._alertContainer=s("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(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class a${constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,i,r){return{}}touchstart(e,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,r){let a=this._firstTwoTouches;if(!a)return;e.preventDefault();let[n,o]=a,s=aW(r,i,n),l=aW(r,i,o);if(!s||!l)return;let h=this._aroundCenter?null:s.add(l).div(2);return this._move([s,l],h,e)}touchend(e,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,o=aW(r,i,a),s=aW(r,i,n);o&&s||(this._active&&f(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function aW(e,i,r){for(let a=0;a<e.length;a++)if(e[a].identifier===r)return i[a]}function aH(e,i){return Math.log(e/i)/Math.LN2}class aX extends a${reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){let r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(.1>Math.abs(aH(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:aH(this._distance,r),pinchAround:i}}}function aY(e,i){return 180*e.angleWith(i)/Math.PI}class aK extends a${reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),r&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:aY(this._vector,r),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let i=25/(Math.PI*this._minDiameter)*360,r=this._startVector;return!!r&&Math.abs(aY(e,r))<i}}function aJ(e){return Math.abs(e.y)>Math.abs(e.x)}class aQ extends a${constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,aJ(e[0].sub(e[1]))&&(this._valid=!1)}_move(i,r,a){let n=this._lastPoints;if(!n)return;let o=i[0].sub(n[0]),s=i[1].sub(n[1]);return this._map._cooperativeGestures&&!e.c$()&&a.touches.length<3||(this._val
98id=this.gestureBeginsVertically(o,s,a.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)})}gestureBeginsVertically(e,i,r){if(void 0!==this._valid)return this._valid;let a=e.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return null==this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let o=e.y>0==i.y>0;return aJ(e)&&aJ(i)&&o}}class a0{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,a=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:s=>{let l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:a1,zoom:i?Math.round(l)+i*(e.shiftKey?2:1):l,bearing:s.getBearing()+r*this._bearingStep,pitch:s.getPitch()+a*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function a1(e){return e*(2-e)}let a2=1/450;class a3{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=a2,e.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||e.c$()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,a=e.f.now(),n=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),i.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=i,this._delta-=r,this._active||this._start(i)),i.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=m(this._el,e);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;let i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let r=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(0!==this._delta){let e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==a&&(a=1/a);let n=r(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(s*a))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:r(),n=this._startZoom,o=this._easing,s,l=!1;if("wheel"===this._type&&n&&o){let i=Math.min((e.f.now()-this._lastWheelEventTime)/200,1),r=o(i);s=e.U(n,a,r),i<1?this._frameId||(this._frameId=!0):l=!0}else s=a,l=!0;this._active=!0,l&&(this._active=!1,this._finishTimeout=setTimeout(()=>
98{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let h=s-r();return h*this._lastDelta<0&&(h=0),{noInertia:!0,needsRenderFrame:!l,zoomDelta:h,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let r=e.d0;if(this._prevEase){let i=this._prevEase,a=(e.f.now()-i.start)/i.duration,n=i.easing(a+.01)-i.easing(a),o=.27/Math.sqrt(n*n+1e-4)*.01;r=e.c_(o,Math.sqrt(.0729-o*o),.25,1)}return this._prevEase={start:e.f.now(),duration:i,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=s("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(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(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class a5{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class a4{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:r.getZoom()+(e.shiftKey?-1:1),around:r.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class a6{constructor(){this._tap=new aF({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,i,r){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=i[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(e,i,r))}touchmove(e,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,i,r)}touchend(e,i,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(e,i,r)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class a8{constructor(e,i,r){this._el=e,this._mousePan=i,this._touchPan=r}enable(e){this._inertiaOptions=e||{},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()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class a9{constructor(e,i,r){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class a7{constructor(e,i,r,a){this._el=e,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("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()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&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()&&this._touchRotate.enable()}}let ne=e=>e.zoom||e.drag||e.pitch||e.rotate;class nt extends e.b{}class ni{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,r){let a=e.N.sub([],r,i);this.radius=e.N.length(a[2]<0?e.N.div([],a,this.constants):[a[0],a[1],0])}projectRay(i){e.N.div(i,i,this.constants),e.N.normalize(i,i),e.N.mul(i,i,this.constants);let r=e.N.scale([],i,this.radius);if(r[2]>0){let i=e.N.scale([],[0,0,1],e.N.dot(r,[0,0,1])),a=e.N.scale([],e.N.normalize([],[r[0],r[1],0]),this.radius),n=e.N.add([],r,e.N.scale([],e.N.sub([],e.N.add([],a,i),r),2));r[0]=n[0],r[1]=n[1]}return r}}function nr(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class na{constructor(i,r){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new aA(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new ni,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aY(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[e,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){let a=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(i,a,r)}}destroy(){for(let[e,i,r]of this._listeners){let a=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(i,a,r)}}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new aL(i,e));let a=i.boxZoom=new ak(i,e);this._add("boxZoom",a);let n=new aN,o=new a4;i.doubleClickZoom=new a5(o,n),this._add("tapZoom",n),this._add("clickZoom",o);let s=new a6;this._add("tapDragZoom",s);let l=i.touchPitch=new aQ(i);this._add("touchPitch",l);let h=new aG(e),u=new aZ(e);i.dragRotate=new a9(e,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);let c=new aj(e),d=new aq(i,e);i.dragPan=new a8(r,c,d),this._add("mousePan",c),this._add("touchPan",d,["touchZoom","touchRotate"]);let p=new aK,f=new aX;i.touchZoomRotate=new a7(r,f,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new aR(i));let m=i.scrollZoom=new a3(i,this);this._add("scrollZoom",m,["mousePan"]);let _=i.keyboard=new a0;for(let r of(this._add("keyboard",_),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))e.interactive&&e[r]&&i[r].enable(e[r])}_add(e,i,r){this._handlers.push({handlerName:e,handler:i,allowed:r}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ne(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,i,r){for(let a in e)if(a!==r&&(!i||0>i.indexOf(a)))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let i=[];for(let r of e)this._el.contains(r.target)&&i.push(r);return i}handleEvent(e,i){this._updatingCamera=!0;let r="renderFrame"===e.type,a=r?void 0:e,n={needsRenderFrame:!1},o={},s={},l=e.touches?this._getMapTouches(e.touches):void 0,h=l?_(this._el,l):r?void 0:m(this._el,e);for(let{handlerName:r,handler:u,allowed:c}of this._handlers){let d;u.isEnabled()&&(this._blockedByActive(s,c,r)?u.reset():u[i||e.type]&&(d=u[i||e.type](e,h,l),this.mergeHandlerResult(n,o,d,r,a),d&&d.needsRenderFrame&&this._triggerRe
98nderFrame()),(d||u.isActive())&&(s[r]=u))}let u={};for(let e in this._previousActiveHandlers)s[e]||(u[e]=a);this._previousActiveHandlers=s,(Object.keys(u).length||nr(n))&&(this._changes.push([n,o,u]),this._triggerRenderFrame()),(Object.keys(s).length||nr(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;e.e(i,a);let s={handlerName:n,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(r.zoom=s),void 0!==a.panDelta&&(r.drag=s),void 0!==a.pitchDelta&&(r.pitch=s),void 0!==a.bearingDelta&&(r.rotate=s)}_applyChanges(){let i={},r={},a={};for(let[n,o,s]of this._changes)n.panDelta&&(i.panDelta=(i.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(i.around=n.around),void 0!==n.aroundCoord&&(i.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(i.pinchAround=n.pinchAround),n.noInertia&&(i.noInertia=n.noInertia),e.e(r,o),e.e(a,s);this._updateMapTransform(i,r,a),this._changes=[]}_updateMapTransform(i,r,a){let n;let o=this._map,s=o.transform,l=e=>[e.x,e.y,e.z];if((e=>{let i=this._eventsInProgress.drag;return i&&!this._handlersById[i.handlerName].isActive()})()&&!nr(i)){let e=s.zoom;s.cameraElevationReference="sea",null!=this._originalZoom&&s._orthographicProjectionAtLowPitch&&"globe"!==s.projection.name&&0===s.pitch?(s.cameraElevationReference="ground",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference="ground"),e!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&o._stop(!0),!nr(i))return void this._fireEvents(r,a,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:d,around:p,aroundCoord:f,pinchAround:m}=i;s._isCameraConstrained&&(u>0&&(u=0),s._isCameraConstrained=!1),void 0!==m&&(p=m),(u||r[n="drag"]&&!this._eventsInProgress[n])&&p&&(this._dragOrigin=l(s.pointCoordinate3D(p)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),p=p||o.transform.centerPoint,c&&(s.bearing+=c),d&&(s.pitch+=d),s._updateCameraState();let _=[0,0,0];if(h){if("mercator"===s.projection.name){let e=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p).dir),i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p.sub(h)).dir);_[0]=i[0]-e[0],_[1]=i[1]-e[1]}else{let i=s.pointCoordinate(p);if("globe"===s.projection.name){h=h.rotate(-s.angle);let r=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*e.d1(e.au(i.y))*r,_[1]=-h.y*e.d1(s.center.lat)*r}else{let e=s.pointCoordinate(p.sub(h));i&&e&&(_[0]=e.x-i.x,_[1]=e.y-i.y)}}}let g=s.zoom,y=[0,0,0];if(u){let i=l(f||s.pointCoordinate3D(p)),r={dir:e.N.normalize([],e.N.sub([],i,s._camera.position))};if(r.dir[2]<0){let a=s.zoomDeltaToMovement(i,u);e.N.scale(y,r.dir,a)}}let x=e.N.add(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(r,a,!0)}_fireEvents(i,r,a){let n;let o=ne(this._eventsInProgress),s=ne(i),l={};for(let e in i){let{originalEvent:r}=i[e];this._eventsInProgress[e]||(l[`${e}start`]=r),this._eventsInProgress[e]=i[e]}for(let e in!o&&s&&this._fireEvent("movestart",s.originalEvent),l)this._fireEvent(e,l[e]);for(let e in s&&this._fireEvent("move",s.originalEvent),i){let{originalEvent:r}=i[e];this._fireEvent(e,r)}let h={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],n=r[i]||a,h[`${e}end`]=n)}for(let e in h)this._fireEvent(e,h[e]);let u=ne(this._eventsInProgress);if(a&&(o||s)&&!u){let i,r;this._updatingCamera=!0;let a=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);a?(0!==(i=a.bearing||this._map.getBearing())&&-this._bearingSnap<i&&i<this._bearingSnap&&(a.bearing=0),this._map.easeTo(a,{originalEvent:n})):(this._map.fire(new e.b("moveend",{originalEvent:n})),0!==(r=this._map.getBearing())&&-this._bearingSnap<r&&r<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,r){this._map.fire(new e.b(i,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new nt("renderFrame",{timeStamp:e})),this._applyChanges()})}
98_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let nn="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class no extends e.E{constructor(i,r){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=!1!==r.respectPrefersReducedMotion,e.aY(["_renderFrameCallback"],this)}getCenter(){return new e.bn(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}panBy(i,r,a){return i=e.P.convert(i).mult(-1),this.panTo(this.transform.center,e.e({offset:i},r),a)}panTo(i,r,a){return this.easeTo(e.e({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(i,r,a){return this.easeTo(e.e({zoom:i},r),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(i,r,a){return this.easeTo(e.e({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,e.e({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}cameraForBounds(i,r){i=e.ad.convert(i);let a=r&&r.bearing||0,n=r&&r.pitch||0,o=i.getNorthWest(),s=i.getSouthEast();return this._cameraForBounds(this.transform,o,s,a,n,r)}_extendCameraOptions(i){let r={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=e.e({padding:r,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){let e=i.padding;i.padding={top:e,bottom:e,right:e,left:e}}return i.padding=e.e(r,i.padding),i}_minimumAABBFrustumDistance(e,i){let r=i.max[0]-i.min[0],a=i.max[1]-i.min[1];return r/a>e.aspect?r/(2*Math.tan(.5*e.fovX)*e.aspect):a/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(i,r,a,n,o,s){let l=i.clone(),h=this._extendCameraOptions(s);l.bearing=n,l.pitch=o;let u=e.bn.convert(r),c=e.bn.convert(a),d=.5*(u.lat+c.lat),p=.5*(u.lng+c.lng),f=e.d2(d,p),m=e.N.normalize([],f),_=e.N.normalize([],e.N.cross([],m,[0,1,0])),g=e.N.cross([],_,m),y=[_[0],_[1],_[2],0,g[0],g[1],g[2],0,m[0],m[1],m[2],0,0,0,0,1],x=[f,e.d2(u.lat,u.lng),e.d2(c.lat,u.lng),e.d2(c.lat,c.lng),e.d2(u.lat,c.lng),e.d2(d,u.lng),e.d2(d,c.lng),e.d2(u.lat,p),e.d2(c.lat,p)],v=e.bS.fromPoints(x.map(i=>[e.N.dot(_,i),e.N.dot(g,i),e.N.dot(m,i)])),b=e.N.transformMat4([],v.center,y);0===e.N.squaredLength(b)&&e.N.set(b,0,0,1),e.N.normalize(b,b),e.N.scale(b,b,e.ab),l.center=e.d3(b);let w=l.getWorldToCameraMatrix(),T=e.a6.invert(new Float64Array(16),w);v=e.bS.applyTransform(v,e.a6.multiply([],w,y)),e.N.transformMat4(b,b,w);let M=.5*(v.max[2]-v.min[2]),E=this._minimumAABBFrustumDistance(l,v),S=e.N.scale([],[0,0,1],M),A=e.N.add(S,b,S),I=E+(0===l.pitch?0:e.N.distance(b,A)),C=l.globeCenterInViewSpace,P=e.N.sub([],b,[C[0],C[1],C[2]]);e.N.normalize(P,P),e.N.scale(P,P,I);let z=e.N.add([],b,P);e.N.transformMat4(z,z,T);let D=e.d4/e.ab,L=e.N.length(z),R=e.bl(Math.max(L*D-e.d4,Number.EPSILON),0),k=Math.min(l.zoomFromMercatorZAdjusted(R),h.maxZoom);return k>.5*(e.bG+e.bx)?(l.setProjection({name:"mercator"}),l.zoom=k,this._cameraForBounds(l,r,a,n,o,s)):{center:l.center,zoom:k,bearing:n,pitch:o}}queryTerrainElevation(i,r){let a=this.transform.elevation;return a?(r=e.e({},{exaggerated:!0},r),a.getAtPoint(e.L.fromLngLat(i),null,r.exaggerated)):null}_cameraForBounds(i,r,a,n,o,s){if("globe"===i.projection.name)return this._cameraForBoundsOnGlobe(i,r,a,n,o,s);let l=i.clone(),h=this._extendCameraOptions(s),u=l.padding;l.bearing=n,l.pitch=o;let c=e.bn.convert(r),d=e.bn.convert(a),p=new e.bn(c.lng,d.lat),f=new e.bn(d.lng,c.lat),m=l.project(c),_=l.project(d),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=this.queryTerrainElevation(f),b=[[m.x,m.y,Math.min(g||0,y||0,x||0,v||0)],[_.x,_.y,Math.max(g||0,y||0,x||0,v||0)]],w=e.bS.fromPoints(b),T=l.getWorldToCameraMatrix(),M=e.a6.invert(new Float64Array(16),T);
98w=e.bS.applyTransform(w,T);let E=e.N.sub([],w.max,w.min),S=u.left||0,A=u.right||0,I=u.bottom||0,C=u.top||0,{left:P,right:z,top:D,bottom:L}=h.padding,R=.5*(S+A),k=.5*(C+I),O=Math.min(l.scaleZoom(l.scale*Math.min((l.width-(S+A+P+z))/E[0],(l.height-(I+C+L+D))/E[1])),h.maxZoom),B=l.scale/l.zoomScale(O);w=new e.bS([w.min[0]-(P+R)*B,w.min[1]-(L+k)*B,w.min[2]],[w.max[0]+(z+R)*B,w.max[1]+(D+k)*B,w.max[2]]);let F=.5*E[2],N=this._minimumAABBFrustumDistance(l,w),V=[0,0,1,0];e.a7.transformMat4(V,V,T),e.a7.normalize(V,V);let U=e.N.scale([],V,N+F),j=e.N.add([],w.center,U),G=("number"==typeof h.offset.x&&"number"==typeof h.offset.y?new e.P(h.offset.x,h.offset.y):e.P.convert(h.offset)).rotate(-e.bj(n));w.center[0]-=G.x*B,w.center[1]+=G.y*B,e.N.transformMat4(w.center,w.center,M),e.N.transformMat4(j,j,M);let Z=[w.center[0],w.center[1],j[2]*l.pixelsPerMeter];e.N.scale(Z,Z,1/l.worldSize);let q=e.at(Z[0]),$=e.au(Z[1]),W=Math.min(l._zoomFromMercatorZ(Z[2]),h.maxZoom),H=new e.bn(q,$);return l.mercatorFromTransition&&W<.5*(e.bG+e.bx)?(l.setProjection({name:"globe"}),l.zoom=W,this._cameraForBounds(l,r,a,n,o,s)):{center:H,zoom:W,bearing:n,pitch:o}}fitBounds(e,i,r){let a=this.cameraForBounds(e,i);return this._fitInternal(a,i,r)}fitScreenCoordinates(i,r,a,n,o){let s=e.P.convert(i),l=e.P.convert(r),h=new e.P(Math.min(s.x,l.x),Math.min(s.y,l.y)),u=new e.P(Math.max(s.x,l.x),Math.max(s.y,l.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,l))return this;let c=this.transform.pointLocation3D(h),d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(new e.P(h.x,u.y)),f=this.transform.pointLocation3D(new e.P(u.x,h.y)),m=[Math.min(c.lng,d.lng,p.lng,f.lng),Math.min(c.lat,d.lat,p.lat,f.lat)],_=[Math.max(c.lng,d.lng,p.lng,f.lng),Math.max(c.lat,d.lat,p.lat,f.lat)],g=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,m,_,a,g,n);return this._fitInternal(y,n,o)}_fitInternal(i,r,a){return i?(delete(r=e.e(i,r)).padding,r.linear?this.easeTo(r,a):this.flyTo(r,a)):this}jumpTo(i,r){this.stop();let a=i.preloadOnly?this.transform.clone():this.transform,n=!1,o=!1,s=!1;return"zoom"in i&&a.zoom!==+i.zoom&&(n=!0,a.zoom=+i.zoom),void 0!==i.center&&(a.center=e.bn.convert(i.center)),"bearing"in i&&a.bearing!==+i.bearing&&(o=!0,a.bearing=+i.bearing),"pitch"in i&&a.pitch!==+i.pitch&&(s=!0,a.pitch=+i.pitch),null==i.padding||a.isPaddingEqual(i.padding)||(a.padding=i.padding),i.preloadOnly?(this._preloadTiles(a),this):(this.fire(new e.b("movestart",r)).fire(new e.b("move",r)),n&&this.fire(new e.b("zoomstart",r)).fire(new e.b("zoom",r)).fire(new e.b("zoomend",r)),o&&this.fire(new e.b("rotatestart",r)).fire(new e.b("rotate",r)).fire(new e.b("rotateend",r)),s&&this.fire(new e.b("pitchstart",r)).fire(new e.b("pitch",r)).fire(new e.b("pitchend",r)),this.fire(new e.b("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(nn),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,r){let a=this.transform;if(!a.projection.supportsFreeCamera)return e.w(nn),this;this.stop();let n=a.zoom,o=a.pitch,s=a.bearing;a.setFreeCameraOptions(i);let l=n!==a.zoom,h=o!==a.pitch,u=s!==a.bearing;return this.fire(new e.b("movestart",r)).fire(new e.b("move",r)),l&&this.fire(new e.b("zoomstart",r)).fire(new e.b("zoom",r)).fire(new e.b("zoomend",r)),u&&this.fire(new e.b("rotatestart",r)).fire(new e.b("rotate",r)).fire(new e.b("rotateend",r)),h&&this.fire(new e.b("pitchstart",r)).fire(new e.b("pitch",r)).fire(new e.b("pitchend",r)),this.fire(new e.b("moveend",r)),this}easeTo(i,r){let a,n,o,s,l;this._stop(!1,i.easeId),(!1===(i=e.e({offset:[0,0],duration:500,easing:e.d0},i)).animate||this._prefersReducedMotion(i))&&(i.duration=0);let h=this.transform,u=this.getZoom(),c=this.getBearing(),d=this.getPitch(),p=this.getPadding(),f="zoom"in i?+i.zoom:u,m="bearing"in i?this._normalizeBearing(i.bearing,c):c,_="pitch"in i?+i.pitch:d,g="padding"in i?i.padding:h.padding,y=e.P.convert(i.offset);if("globe"===h.projection.name){let r=e.L.fromLngLat(h.center),s=y.rotate(-h.angle);r.x+=s.x/h.worldSize,r.y+=s.y/h.worldSize;let l=r.toLngLat(),u=e.bn.convert(i.center||l);this._normalizeCenter(u),a=h.centerPoint.add(s),n=new e.P(r.x,r.y).mult(h.worldSize),o=new e.P(e.a5(u.lng),e.ae(u.lat)).mult(h.worldSize).sub(n)}else{a=h.centerPoint.add(y);let r=h.pointLocation(a),s=e.bn.convert(i.center||r);this._normalizeCenter(s),n=h.project(r),o=h.project(s).sub(n)}let x=h.zoomScale(f-u);i.around&&(s=e.bn.convert(i.around),l=h.locationPoint(s));let v=this._zooming||f!==u,b=this._rotating||c!==m,w=this._pitching||_!==d,T=!h.isPaddingEqual(g),M=h=>M=>{if(v&&(h.zoom=e.U(u,f,M)),b&&(h.bearing=e.U(c,m,M)),w&&(h.pitch=e.U(d,_,M)),T&&(h.interpolatePadding(p,g,M),a=h.centerPoint.add(y)),s)h.setLocationAtPoint(s,l);else{let e=h.zoomScale(h.zoom-u),i=Math.pow(f>u?Math.min(2,x):Math.max(.5,x),1-M),r=h.unproject(n.add(o.mult(M*i)).mult(e));h.setLocationAtPoint(h.renderWorldCopies?r.wrap():r,a)}return i.preloadOnly||this._fireMoveEvents(r),h};if(i.preloadOnly){let e=this._emulate(M,i.duration,h);return this._preloadTiles(e),this}let E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=b,this._pitching=w,this._easeId=i.easeId,this._prepareEase(r,i.noMoveStart,E),this._ease(M(h),e=>{"sea"===h.cameraElevationReference&&h.recenterOnTerrain(),this._afterEase(r,e)},i),this}_prepareEase(i,r,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),r||a.mov
98ing||this.fire(new e.b("movestart",i)),this._zooming&&!a.zooming&&this.fire(new e.b("zoomstart",i)),this._rotating&&!a.rotating&&this.fire(new e.b("rotatestart",i)),this._pitching&&!a.pitching&&this.fire(new e.b("pitchstart",i))}_fireMoveEvents(i){this.fire(new e.b("move",i)),this._zooming&&this.fire(new e.b("zoom",i)),this._rotating&&this.fire(new e.b("rotate",i)),this._pitching&&this.fire(new e.b("pitch",i))}_afterEase(i,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,a&&this.fire(new e.b("zoomend",i)),n&&this.fire(new e.b("rotateend",i)),o&&this.fire(new e.b("pitchend",i)),this.fire(new e.b("moveend",i))}flyTo(i,r){if(this._prefersReducedMotion(i)){let a=e.ac(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,r)}this.stop(),i=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.d0},i);let a=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l="zoom"in i?e.aa(+i.zoom,a.minZoom,a.maxZoom):n,h="bearing"in i?this._normalizeBearing(i.bearing,o):o,u="pitch"in i?+i.pitch:s,c=a.zoomScale(l-n),d=e.P.convert(i.offset),p=a.centerPoint.add(d),f=a.pointLocation(p),m=i.center;if(m&&i.padding){let e=this._cameraForBounds(this.transform,m,m,h,u,i);e&&(m=e.center)}m=e.bn.convert(m||f),this._normalizeCenter(m);let _=a.project(f),g=a.project(m).sub(_),y=i.curve,x=Math.max(a.width,a.height),v=x/c,b=g.mag();if("minZoom"in i){let r=e.aa(Math.min(i.minZoom,n,l),a.minZoom,a.maxZoom);y=Math.sqrt(x/a.zoomScale(r-n)/b*2)}let w=y*y;function T(e){let i=(v*v-x*x+(e?-1:1)*w*w*b*b)/(2*(e?v:x)*w*b);return Math.log(Math.sqrt(i*i+1)-i)}function M(e){return(Math.exp(e)-Math.exp(-e))/2}function E(e){return(Math.exp(e)+Math.exp(-e))/2}let S=T(0),A=function(e){return E(S)/E(S+y*e)},I=function(e){var i;return(E(S)*(M(i=S+y*e)/E(i))-M(S))/w*x/b},C=(T(1)-S)/y;if(1e-6>Math.abs(b)||!isFinite(C)){if(1e-6>Math.abs(x-v))return this.easeTo(i,r);let e=v<x?-1:1;C=Math.abs(Math.log(v/x))/y,I=function(){return 0},A=function(i){return Math.exp(e*y*i)}}i.duration="duration"in i?+i.duration:1e3*C/("screenSpeed"in i?+i.screenSpeed/y:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);let P=o!==h,z=u!==s,D=a=>c=>{let d=c*C,f=1/A(d);a.zoom=1===c?l:n+a.scaleZoom(f),P&&(a.bearing=e.U(o,h,c)),z&&(a.pitch=e.U(s,u,c));let y=1===c?m:a.unproject(_.add(g.mult(I(d))).mult(f));return a.setLocationAtPoint(a.renderWorldCopies?y.wrap():y,p),a._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(r),a};if(i.preloadOnly){let e=this._emulate(D,i.duration,a);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=z,this._prepareEase(r,!1),this._ease(D(a),()=>this._afterEase(r),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,i)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(i,r,a){!1===a.animate||0===a.duration?(i(1),r()):(this._easeStart=e.f.now(),this._easeOptions=a,this._onEaseFrame=i,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((e.f.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,r){let a=Math.abs((i=e.bh(i,-180,180))-r);return Math.abs(i-360-r)<a&&(i-=360),Math.abs(i+360-r)<a&&(i+=360),i}_normalizeCenter(e){let i=this.transform;if(i.maxBounds||"globe"!==i.projection.name&&!i.renderWorldCopies)return;let r=e.lng-i.center.lng;e.lng+=r>180?-360:r<-180?360:0}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&e.f.prefersReducedMotion&&!(i&&i.essential)}_emulate(e,i,r){let a=Math.ceil(15*i/1e3),n=[],o=e(r.clone());for(let e=0;e<=a;e++){let i=o(e/a);n.push(i.clone())}return n}}class ns{constructor(i={}){this.options=i,e.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){let i=this.options&&this.options.compact;return this._map=e,this._container=s("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=s("button","mapboxgl-ctrl-attrib-button",this._container),s("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=s("div","mapboxgl-ctrl-attrib-inner",this._container),i&&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),void 0===i&&(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(e,i){let r=this._map._getUIString(`AttributionControl.${i}`);e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
98se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));let r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.d5.ACCESS_TOKEN}];if(i){let a=r.reduce((e,i,a)=>(i.value&&(e+=`${i.key}=${i.value}${a<r.length-1?"&":""}`),e),"?");i.href=`${e.d5.FEEDBACK_URL}/${a}#${ab(this._map,!0)}`,i.rel="noopener nofollow",this._setElementTitle(i,"MapFeedback")}}_updateData(e){e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let i=this._map.style._mergedSourceCaches;for(let r in i){let a=i[r];if(a.used){let i=a.getSource();i.attribution&&0>e.indexOf(i.attribution)&&e.push(i.attribution)}}e.sort((e,i)=>e.length-i.length),e=e.filter((i,r)=>{for(let a=r+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.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<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class nl{constructor(){e.aY(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=s("div","mapboxgl-ctrl");let i=s("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(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(let i in e){let r=e[i].getSource();if(r.hasOwnProperty("mapbox_logo")&&!r.mapbox_logo)return!1}return!0}_updateCompact(){let e=this._container.children;if(e.length){let i=e[0];this._map.getCanvasContainer().offsetWidth<250?i.classList.add("mapboxgl-compact"):i.classList.remove("mapboxgl-compact")}}}class nh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===e)return void(r.cancelled=!0)}run(e=0){let i=this._currentlyRunning=this._queue;for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function nu(i,r,a){if(i=new e.bn(i.lng,i.lat),r){let n=new e.bn(i.lng-360,i.lat),o=new e.bn(i.lng+360,i.lat),s=360*Math.ceil(Math.abs(i.lng-a.center.lng)/360),l=a.locationPoint(i).distSqr(r),h=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(n).distSqr(r)<l&&(h||Math.abs(n.lng-a.center.lng)<s)?i=n:a.locationPoint(o).distSqr(r)<l&&(h||Math.abs(o.lng-a.center.lng)<s)&&(i=o)}for(;Math.abs(i.lng-a.center.lng)>180;){let e=a.locationPoint(i);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;
98i.lng>a.center.lng?i.lng-=360:i.lng+=360}return i}let nc={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 nd extends e.E{constructor(i,r){if(super(),(i instanceof HTMLElement||r)&&(i=e.e({element:i},r)),e.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=i&&i.occludedOpacity||.2,i&&i.element)this._element=i.element,this._offset=e.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=s("div");let r=l("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=l("radialGradient",{id:"shadowGradient"},l("defs",{},r));l("stop",{offset:"10%","stop-opacity":.4},a),l("stop",{offset:"100%","stop-opacity":.05},a),l("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),l("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"},r),l("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"},r),l("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.P.convert(i&&i.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",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});let a=this._element.classList;for(let e in nc)a.remove(`mapboxgl-marker-anchor-${e}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`);let n=i&&i.className?i.className.trim().split(/\s+/):[];a.add(...n),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){let e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=e.bn.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let i=Math.sqrt(91.125);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
980,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&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(e){let i=e.code,r=e.charCode||e.keyCode;"Space"!==i&&"Enter"!==i&&32!==r&&13!==r||this.togglePopup()}_onMapClick(e){let i=e.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e&&(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let e=this._map,i=this._pos;if(!e||!i)return!1;let r=e.unproject(i),a=e.getFreeCameraOptions();if(!a.position)return!1;let n=a.position.toLngLat();return n.distanceTo(r)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){let i;let r=this._map;if(!r)return;let a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();let n=r.unproject(a);r._showingGlobe()&&e.d6(r.transform,this._lngLat)?i=0:(i=1-r._queryFogOpacity(n),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(i*=this._occludedOpacity)),this._element.style.opacity=`${i}`,this._element.style.pointerEvents=i>0?"auto":"none",this._popup&&this._popup._setOpacity(i),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let e=this._pos;if(!e||!this._map)return;let i=this._offset.mult(this._scale);this._element.style.transform=` 99 translate(${e.x}px,${e.y}px) 100 ${nc[this._anchor]} 101 ${this._calculateXYTransform()} ${this._calculateZTransform()} 102 translate(${i.x}px,${i.y}px) 103 `}_calculateXYTransform(){let i=this._pos,r=this._map,a=this.getPitchAlignment();if(!r||!i||"map"!==a)return"";if(!r._showingGlobe()){let e=r.getPitch();return e?`rotateX(${e}deg)`:""}let n=e.bF(e.d7(r.transform,this._lngLat)),o=i.sub(e.d8(r.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";let l=n/s;return`rotateX(${-o.y*l}deg) rotateY(${o.x*l}deg)`}_calculateZTransform(){let i=this._pos,r=this._map;if(!r||!i)return"";let a=0,n=this.getRotationAlignment();if("map"===n){if(r._showingGlobe()){let i=r.project(new e.bn(this._lngLat.lng,this._lngLat.lat+.001)),n=r.project(new e.bn(this._lngLat.lng,this._lngLat.lat-.001)).sub(i);a=e.bF(Math.atan2(n.y,n.x))-90}else a=-r.getBearing()}else if("horizon"===n){let n=e.O(4,6,r.getZoom()),o=e.d8(r.transform);o.y+=n*r.transform.height;let s=i.sub(o),l=e.bF(Math.atan2(s.y,s.x));a=(l>90?l-270:l+90)*(1-n)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);let i=this._map;
103i&&(i.transform.renderWorldCopies&&(this._lngLat=nu(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),i._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=e.P.convert(i),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(i){let r=this._map;if(!r)return;let a=this._pointerdownPos,n=this._positionDelta;if(a&&n){if(!this._isDragging){let e=this._clickTolerance||r._clickTolerance;if(i.point.dist(a)<e)return;this._isDragging=!0}this._pos=i.point.sub(n),this._lngLat=r.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.b("dragstart"))),this.fire(new e.b("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.b("dragend")),this._state="inactive"}_addDragHandler(e){let i=this._map,r=this._pos;i&&r&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(r),this._pointerdownPos=e.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(e){this._draggable=!!e;let i=this._map;return i&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function nf(i=new e.P(0,0),r="bottom"){if("number"==typeof i){let a=Math.round(Math.sqrt(.5*Math.pow(i,2)));switch(r){case"top":return new e.P(0,i);case"top-left":return new e.P(a,a);case"top-right":return new e.P(-a,a);case"bottom":return new e.P(0,-i);case"bottom-left":return new e.P(a,-a);case"bottom-right":return new e.P(-a,-a);case"left":return new e.P(i,0);case"right":return new e.P(-i,0)}return new e.P(0,0)}return i instanceof e.P||Array.isArray(i)?e.P.convert(i):e.P.convert(i[r]||[0,0])}class nm{constructor(e){this.jumpTo(e)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;let r=e.cc((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,i,r){this._start=this.getValue(i),this._end=e,this._startTime=i,this._endTime=i+r}}let n_={"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"},ng={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,maxTileC
103acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1};class ny{constructor(){this.showOverdrawInspector=!1,this.showTileBoundaries=!1,this.showParseStatus=!1,this.continuousRedraw=!1,this.showTileAABBs=!1,this.showPadding=!1,this.showTerrainWireframe=!1,this.showLayers2DWireframe=!1,this.showLayers3DWireframe=!1}}let nx={showCompass:!0,showZoom:!0,visualizePitch:!1};class nv{constructor(i,r,a=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new aG({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,a&&(this.mousePitch=new aZ({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(e,i){this.mouseRotate.mousedown(e,i),this.mousePitch&&this.mousePitch.mousedown(e,i),c()}move(e,i){let r=this.map,a=this.mouseRotate.mousemoveWindow(e,i),n=a&&a.bearingDelta;if(n&&r.setBearing(r.getBearing()+n),this.mousePitch){let a=this.mousePitch.mousemoveWindow(e,i),n=a&&a.pitchDelta;n&&r.setPitch(r.getPitch()+n)}}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){d(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(e.e({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),m(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,m(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=_(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=_(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}let nb={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},nw={maxWidth:100,unit:"metric"},nT={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"};return{version:e.dk,supported:n,setRTLTextPlugin:e.dm,getRTLTextPluginStatus:e.dn,Map:class extends no{constructor(i){let r=i;if(null!=(i=e.e({},ng,i)).minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(i.antialias&&e.d9(window)&&(i.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new iw(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),i),this._repaint=!1,this._interactive=i.interactive,this._minTileCacheSize=i.minTileCacheSize,this._maxTileC
103acheSize=i.maxTileCacheSize,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=i.preserveDrawingBuffer,this._antialias=i.antialias,this._trackResize=i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=i.crossSourceCollisions,this._collectResourceTiming=i.collectResourceTiming,this._language=this._parseLanguage(i.language),this._worldview=i.worldview,this._renderTaskQueue=new nh,this._domRenderTaskQueue=new nh,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aC(),this._locale=e.e({},n_,i.locale),this._clickTolerance=i.clickTolerance,this._cooperativeGestures=i.cooperativeGestures,this._performanceMetricsCollection=i.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new nm(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new e.da(i.transformRequest,i.accessToken,i.testMode),this._silenceAuthErrors=!!i.testMode,this._contextCreateOptions=i.contextCreateOptions?{...i.contextCreateOptions}:{},"string"==typeof i.container){let e=document.getElementById(i.container);if(!e)throw Error(`Container '${i.container.toString()}' not found.`);this._container=e}else{if(!(i.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(this._container.childNodes.length>0&&e.w("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."),i.maxBounds&&this.setMaxBounds(i.maxBounds),e.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._debugParams=new ny,this._tp=i.devtools?new am(this):new am,this._tp.registerParameter(this._debugParams,["Debug"],"showOverdrawInspector",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"showTileBoundaries",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"showParseStatus",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug"],"continuousRedraw",void 0,e=>{this.repaint=e}),this._tp.registerParameter(this._debugParams,["Debug"],"showTileAABBs",void 0,e=>{this.showTileAABBs=e}),this._tp.registerParameter(this._debugParams,["Debug"],"showPadding",void 0,e=>{this.showPadding=e}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showTerrainWireframe",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showLayers2DWireframe",void 0,()=>{this._update()}),this._tp.registerParameter(this._debugParams,["Debug","Wireframe"],"showLayers3DWireframe",void 0,()=>{this._update()}),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new na(this,i),this._localFontFamily=i.localFontFamily,this._localIdeographFontFamily=i.localIdeographFontFamily,(i.style||!i.testMode)&&this.setStyle(i.style||e.d5.DEFAULT_STYLE,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),i.projection&&this.setProjection(i.projection),i.hash&&(this._hash=new av("string"==typeof i.hash&&i.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==r.center&&null==r.zoom||(this.transform._unmodified=!1),this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch});let a=i.bounds;a&&(this.resize(),this.fitBounds(a,e.e({},i.fitBoundsOptions,{duration:0})))}this.resize(),i.attributionControl&&this.addControl(new ns({customAttribution:i.customAttribution}
103)),this._logoControl=new nl,this.addControl(this._logoControl,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update("style"===i.dataType),this.fire(new e.b(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new e.b(`${i.dataType}dataloading`,i))})}_getMapId(){return this._mapId}addControl(i,r){if(void 0===r&&(r=i.getDefaultPosition?i.getDefaultPosition():"top-right"),!i||!i.onAdd)return this.fire(new e.a(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=i.onAdd(this);this._controls.push(i);let n=this._controlPositions[r];return -1!==r.indexOf("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(i){if(!i||!i.onRemove)return this.fire(new e.a(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(i);return r>-1&&this._controls.splice(r,1),i.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(i){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&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));let r=!this._moving;return r&&this.fire(new e.b("movestart",i)).fire(new e.b("move",i)),this.fire(new e.b("resize",i)),r&&this.fire(new e.b("moveend",i)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(i){return this.transform.setMaxBounds(e.ad.convert(i)),this._update()}setMinZoom(i){if((i=null==i?-2:i)>=-2&&i<=this.transform.maxZoom)return this.transform.minZoom=i,this._update(),this.getZoom()<i?this.setZoom(i):this.fire(new e.b("zoomstart")).fire(new e.b("zoom")).fire(new e.b("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(i){if((i=null==i?22:i)>=this.transform.minZoom)return this.transform.maxZoom=i,this._update(),this.getZoom()>i?this.setZoom(i):this.fire(new e.b("zoomstart")).fire(new e.b("zoom")).fire(new e.b("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(i){if((i=null==i?0:i)<0)throw Error("minPitch must be greater than or equal to 0");if(i>=0&&i<=this.transform.maxPitch)return this.transform.minPitch=i,this._update(),this.getPitch()<i?this.setPitch(i):this.fire(new e.b("pitchstart")).fire(new e.b("pitch")).fire(new e.b("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(i){if((i=null==i?85:i)>85)throw Error("maxPitch must be less than or equal to 85");if(i>=this.transform.minPitch)return this.transform.maxPitch=i,this._update(),this.getPitch()>i?this.setPitch(i):this.fire(new e.b("pitchstart")).fire(new e.b("pitch")).fire(new e.b("pitchend")),this;throw 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"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){let i=this._parseLanguage(e);if(!this.style||i===this._language)return this;for(let e of(this._language=i,this.style.reloadSources(),this._controls))e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview&&(this._worldview=e,this.style.reloadSources()),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){let i;if("globe"!==this.getProjection().name)return;let r=this.transform,a=r.projection.name;"globe"===a&&r.zoom>=e.bx?(r.setMercatorFromTransition(),i=!0):"mercator"===a&&r.zoom<e.bx&&(r.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
103Update())}_prioritizeAndUpdateProjection(e,i){return this._updateProjection(e||i||{name:"mercator"})}_updateProjection(i){let r;return r="globe"===i.name&&this.transform.zoom>=e.bx?this.transform.setMercatorFromTransition():this.transform.setProjection(i),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(i){return this.transform.locationPoint3D(e.bn.convert(i))}unproject(i){return this.transform.pointLocation3D(e.P.convert(i))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,i,r){if("mouseenter"===e||"mouseover"===e){let a=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:n=>{let o=i.filter(e=>this.getLayer(e)),s=o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?a||(a=!0,r.call(this,new aP(e,this,n.originalEvent,{features:s}))):a=!1},mouseout:()=>{a=!1}}}}if("mouseleave"===e||"mouseout"===e){let a=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:n=>{let o=i.filter(e=>this.getLayer(e));(o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?a=!0:a&&(a=!1,r.call(this,new aP(e,this,n.originalEvent)))},mouseout:i=>{a&&(a=!1,r.call(this,new aP(e,this,i.originalEvent)))}}}}return{layers:new Set(i),listener:r,delegates:{[e]:e=>{let a=i.filter(e=>this.getLayer(e)),n=a.length?this.queryRenderedFeatures(e.point,{layers:a}):[];n.length&&(e.features=n,r.call(this,e),delete e.features)}}}}on(e,i,r){if(void 0===r)return super.on(e,i);if(Array.isArray(i)||(i=[i]),i){for(let e of i)if(!this._isValidId(e))return this}let a=this._createDelegatedListener(e,i,r);for(let i in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a),a.delegates)this.on(i,a.delegates[i]);return this}once(e,i,r){if(void 0===r)return super.once(e,i);if(Array.isArray(i)||(i=[i]),i){for(let e of i)if(!this._isValidId(e))return this}let a=this._createDelegatedListener(e,i,r);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,i,r){if(void 0===r)return super.off(e,i);for(let e of i=new Set(Array.isArray(i)?i:[i]))if(!this._isValidId(e))return this;let a=(e,i)=>{if(e.size!==i.size)return!1;for(let r of e)if(!i.has(r))return!1;return!0},n=this._delegatedListeners?this._delegatedListeners[e]:void 0;return n&&(e=>{for(let n=0;n<e.length;n++){let o=e[n];if(o.listener===r&&a(o.layers,i)){for(let e in o.delegates)this.off(e,o.delegates[e]);return e.splice(n,1),this}}})(n),this}queryRenderedFeatures(i,r){if(!this.style)return[];if(void 0!==r||void 0===i||i instanceof e.P||Array.isArray(i)||(r=i,i=void 0),i=i||[[0,0],[this.transform.width,this.transform.height]],(r=r||{}).layers&&Array.isArray(r.layers)){for(let e of r.layers)if(!this._isValidId(e))return[]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,i){return this._isValidId(e)?this.style.querySourceFeatures(e,i):[]}isPointOnSurface(i){let{name:r}=this.transform.projection;return"globe"!==r&&"mercator"!==r&&e.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(i))}setStyle(i,r){return!1!==(r=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&r.localFontFamily===this._localFontFamily&&this.style&&i?(this._diffStyle(i,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(i,r))}_getUIString(e){let i=this._locale[e];if(null==i)throw Error(`Missing UI string '${e}'`);return i}_updateStyle(e,i){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e&&(this.style=new iF(this,i||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e):this.style.loadJSON(e)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new iF(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(i,r){if("string"==typeof i){let a=this._requestManager.normalizeStyleURL(i),n=this._requestManager.transformRequest(a,e.R.Style);e.g(n,(i,a)=>{i?this.fire(new e.a(i)):a&&this._updateDiff(a,r)})}else"object"==typeof i&&this._updateDiff(i,r)}_updateDiff(i,r){try{this.style.setState(i)&&this._update(!0)}catch(a){e.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(i,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(i){return null==i?(this.fire(new e.a(Error("IDs can't be empty."))),!1):!e.c4(i)||(this.fire(new e.a(Error(`IDs can't
103contain special symbols: "${i}".`))),!1)}addSource(e,i){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,i),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,i,r){this._lazyInitEmptyStyle(),this.style.addSourceType(e,i,r)}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(i,r,{pixelRatio:a=1,sdf:n=!1,stretchX:o,stretchY:s,content:l}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){let{width:h,height:u,data:c}=e.f.getImageData(r);this.style.addImage(i,{data:new e.h({width:h,height:u},c),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0})}else if(void 0===r.width||void 0===r.height)this.fire(new e.a(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{let{width:h,height:u}=r;this.style.addImage(i,{data:new e.h({width:h,height:u},new Uint8Array(r.data)),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0,userImage:r}),r.onAdd&&r.onAdd(this,i)}}updateImage(i,r){this._lazyInitEmptyStyle();let a=this.style.getImage(i);if(!a)return void this.fire(new e.a(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let n=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.f.getImageData(r):r,{width:o,height:s}=n,l=n.data;if(void 0===o||void 0===s)return void this.fire(new e.a(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==a.data.width||s!==a.data.height)return void this.fire(new e.a(Error(`The width and height of the updated image (${o}, ${s}) 104 must be that same as the previous version of the image 105 (${a.data.width}, ${a.data.height})`)));let h=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(l,h),this.style.updateImage(i,a)}hasImage(i){return i?!!this.style&&!!this.style.getImage(i):(this.fire(new e.a(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(i,r){e.d(this._requestManager.transformRequest(i,e.R.Image),(i,a)=>{r(i,a instanceof HTMLImageElement?e.f.getImageData(a):a)})}listImages(){return this.style.listImages()}addModel(e,i){this._lazyInitEmptyStyle(),this.style.addModel(e,i)}hasModel(i){return i?this.style.hasModel(i):(this.fire(new e.a(Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,i){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,i),this._update(!0)):this}getSlot(e){let i=this.getLayer(e);return i&&i.slot||null}setSlot(e,i){return this.style.setSlot(e,i),this.style.mergeLayers(),this._update(!0)}addImport(e,i){return this.style.addImport(e,i),this}updateImport(e,i){return"string"!=typeof i&&i.id!==e?(this.removeImport(e),this.addImport(i)):(this.style.updateImport(e,i),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,i){return this.style.moveImport(e,i),this._update(!0)}moveLayer(e,i){return this._isValidId(e)?(this.style.moveLayer(e,i),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,i,r){return this._isValidId(e)?(this.style.setLayerZoomRange(e,i,r),this._update(!0)):this}setFilter(e,i,r={}){return this._isValidId(e)?(this.style.setFilter(e,i,r),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setPaintProperty(e,i,r,a),this._update(!0)):this}getPaintProperty(e,i){return this._isValidId(e)?this.style.getPaintProperty(e,i):null}setLayoutProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,i,r,a),this._update(!0)):this}getLayoutProperty(e,i){return this._isValidId(e)?this.style.getLayoutProperty(e,i):null}getConfigProperty(e,i){return this.style.getConfigProperty(e,i)}setConfigProperty(e,i,r){return this.style.setConfigProperty(e,i,r),this._update(!0)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){let i=e[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,i={}
105){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&&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("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(i){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bn.convert(i),this.transform):0}setFeatureState(e,i){return this._isValidId(e.source)?(this.style.setFeatureState(e,i),this._update()):this}removeFeatureState(e,i){return this._isValidId(e.source)?(this.style.removeFeatureState(e,i),this._update()):this}getFeatureState(e){return this._isValidId(e.source)?this.style.getFeatureState(e):null}_updateContainerDimensions(){if(!this._container)return;let e=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300,r,a,n,o=this._container;for(;o&&(!a||!n);){let e=window.getComputedStyle(o).transform;e&&"none"!==e&&((r=e.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==r[0]&&"1"!==r[0]&&(a=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(n=r[3])),o=o.parentElement}this._containerWidth=a?Math.abs(e/a):e,this._containerHeight=n?Math.abs(i/n):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("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(){let e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=s("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();let i=this._canvasContainer=s("div","mapboxgl-canvas-container",e);this._canvas=s("canvas","mapboxgl-canvas",i),this._interactive&&(i.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);let r=this._controlContainer=s("div","mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{a[e]=s("div",`mapboxgl-ctrl-${e}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(i,r){let a=e.f.devicePixelRatio||1;this._canvas.width=a*Math.ceil(i),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${i}px`,this._canvas.style.height=`${r}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){let i=this._markers.indexOf(e);-1!==i&&this._markers.splice(i,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){let i=this._popups.indexOf(e);-1!==i&&this._popups.splice(i,1)}_setupPainter(){let i=e.e({},n.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?(e.db(r,!0),this.painter=new ay(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.dc.testSupport(r)):this.fire(new e.a(Error("Failed to initialize WebGL")))}_contextLost(i){i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.b("webglcontextlost",{originalEvent:i}))}_contextRestored(i){this._setupPainter(),this.resize(),this._update(),this.fire(new e.b("webglcontextrestored",{originalEvent:i}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(i){let r;this.fire(new e.b("renderstart"));let a=this.painter.context.extTimerQuery,n=e.f.now(),o=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=o.createQuery(),o.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
105(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(i),this._domRenderTaskQueue.run(i),this._removed)return;this._updateProjectionTransition();let s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let i=this.transform.zoom,r=this.transform.pitch,a=e.f.now(),n=new e.K(i,{now:a,fadeDuration:s,pitch:r,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let l=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),l=this._updateAverageElevation(n),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):l=this._updateAverageElevation(n),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries||this._debugParams.showTileBoundaries,showParseStatus:this.showParseStatus||this._debugParams.showParseStatus,wireframe:{terrain:this.showTerrainWireframe||this._debugParams.showTerrainWireframe,layers2D:this.showLayers2DWireframe||this._debugParams.showLayers2DWireframe,layers3D:this.showLayers3DWireframe||this._debugParams.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector||this._debugParams.showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs||this._debugParams.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding||this._debugParams.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.b("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.b("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){let i=e.f.now()-n;o.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{let a=o.getQueryParameter(r,o.QUERY_RESULT)/1e6;o.deleteQuery(r),this.fire(new e.b("gpu-timing-frame",{cpuTime:i,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){let i=this.painter.collectGpuTimers();setTimeout(()=>{let r=this.painter.queryGpuTimers(i);this.fire(new e.b("gpu-timing-layer",{layerTimes:r}))},50)}if(this.listens("gpu-timing-deferred-render")){let i=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let r=this.painter.queryGpuTimeDeferredRender(i);this.fire(new e.b("gpu-timing-deferred-render",{gpuTime:r}))},50)}let h=this._sourcesDirty||this._styleDirty||this._placementDirty||l;if(h||this._repaint)this.triggerRepaint();else{let i=!this.isMoving()&&this.loaded();if(i&&(l=this._updateAverageElevation(n,!0)),l)this.triggerRepaint();else if(this._triggerFrame(!1),i&&(this.fire(new e.b("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let i=this._calculateSpeedIndex();this.fire(new e.b("speedindexcompleted",{speedIndex:i})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,this._performanceMetricsCollection&&e.dd(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(let i of this._markers)e&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(let i of this._popups)!e||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(e,i=!1){let r=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);let a=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(a||(i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){let i=this.transform.averageElevation,n=this.transform.sampleAverageElevation();this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;let o=Math.abs(i-n);if(o>1){if(this._isInitialLoad||a)return this._averageElevation.jumpTo(n),r(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}_authenticate(){e.de(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{if(i&&(i.message===e.df||401===i.status)){let i=this.painter.context.gl;e.db(i,!1),this._logoControl instanceof nl&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.a(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/")))}}),e.dg(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){let e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){let e=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());let r=this.painter.context.gl,a=r.createFramebuffer();function n(e){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);let i=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,i),i}return r.bindFramebuffer(r.FRAMEBUFFER,a),this._canvasPixelComparison(n(e),i.canvasCopies.map(n),i.timeStamps)}_canvasPixelComparison(e,i,r){let a=r[1]-r[0],n=e.length/4;for(let o=0;o<i.length;o++){let s=i[o],l=0;for(let i=0;i<s.length;
105i+=4)s[i]===e[i]&&s[i+1]===e[i+1]&&s[i+2]===e[i+2]&&s[i+3]===e[i+3]&&(l+=1);a+=(r[o+2]-r[o+1])*(1-l/n)}return a}remove(){for(let e of(this._hash&&this._hash.remove(),this._controls))e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.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),e.dh(this.painter.context.gl),e.di.remove(),e.dj.remove(),this._removed=!0,this.fire(new e.b("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(i){this._renderNextFrame=this._renderNextFrame||i,this.style&&!this._frame&&(this._frame=e.f.frame(e=>{let i=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,i&&this._render(e)}))}_preloadTiles(i){let r=this.style?Object.values(this.style._sourceCaches):[];return e.b1(r,(e,r)=>e._preloadTiles(i,r),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(i,r){e.dl(i,r)}get version(){return e.dk}},NavigationControl:class{constructor(i){this.options=e.e({},nx,i),this._container=s("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),s("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),s("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{let i=this._map;i&&(this.options.visualizePitch?i.resetNorthPitch({},{originalEvent:e}):i.resetNorth({},{originalEvent:e}))}),this._compassIcon=s("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let e=this._map;if(!e)return;
105let i=e.getZoom(),r=i===e.getMaxZoom(),a=i===e.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let e=this._map;if(!e)return;let i=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(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nv(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){let e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,i){let r=s("button",e,this._container);return r.type="button",r.addEventListener("click",i),r}_setButtonTitle(e,i){if(!this._map)return;let r=this._map._getUIString(`NavigationControl.${i}`);e.setAttribute("aria-label",r),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends e.E{constructor(i){super();let r=navigator.geolocation;this.options=e.e({geolocation:r},nb,i),e.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ax(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=s("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){let i=(i=!!this.options.geolocation)=>{this._supportsGeolocation=i,e(i)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>i("denied"!==e.state)).catch(()=>i()):i()}_isOutOfMapMaxBounds(e){let i=this._map.getMaxBounds(),r=e.coords;return!!i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.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(i){if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new e.b("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
105RROR":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&&"OFF"!==this._watchState&&this._updateMarker(i),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(i),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.b("geolocate",i)),this._finish()}}_updateCamera(i){let r=new e.bn(i.coords.longitude,i.coords.latitude),a=i.coords.accuracy,n=this._map.getBearing(),o=e.e({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),o,{geolocateSource:!0})}_updateMarker(i){if(i){let r=new e.bn(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let i=this._map.transform,r=e.bl(1,i._center.lat)*i.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(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(i){if(this._map){if(this.options.trackUserLocation){if(1===i.code){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;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===i.code&&this._noTimeout)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.b("error",i)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(i){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=s("button","mapboxgl-ctrl-geolocate",this._container),s("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===i){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s("div","mapboxgl-user-location"),this._dotElement.appendChild(s("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(s("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new nd({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=s("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new nd({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i.originalEvent&&"resize"===i.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.b("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("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 e.b("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 e.b("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.b("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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>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&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){let e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ns,ScaleControl:class{constructor(i){this.options=e.e({},nw,i),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let e=this.options.maxWidth||100,i=this._map,r=i._containerHeight/2,a=i._containerWidth/2-e/2,n=i.unproject([a,r]),o=i.unproject([a+e,r]),s=n.distanceTo(o);if("imperial"===this.options.unit){let i=3.2808*s;i>5280?this._setScale(e,i/5280,"mile"):this._setScale(e,i,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,i,r){this._map._requestDomTask(()=>{let a=function(e){let i=Math.pow(10,`${Math.floor(e)}`.length-1),r=e/i;return i*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){let i=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*i)/i}(r))}(i),n=a/i;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(a):`${a} ${nT[r]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=s("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(i){this._fullscreen=!1,i&&i.container&&(i.container instanceof HTMLElement?this._container=i.container:e.w("Full screen control 'container' must be a DOM element.")),e.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(i){return this._map=i,this._container||(this._container=this._map.getContainer()),this._controlContainer=s("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){let e=this._fullscreenButton=s("button","mapboxgl-ctrl-fullscreen",this._controlContainer);s("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(i){super(),this.options=e.e(Object.create(np),i),e.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(i&&i.className?i.className.trim().split(/\s+/):[])}addTo(i){return this._map&&this.remove(),this._map=i,this.options.closeOnClick&&i.on("preclick",this._onClose),this.options.closeOnMove&&i.on("move",this._onClose),i.on("remove",this.remove),this._update(),i._addPopup(this),this._focusFirstElement(),this._trackPointer?(i.on("mousemove",this._onMouseEvent),i.on("mouseup",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")):i.on("move",this._update),this.fire(new e.b("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let i=this._map;return i&&(i.off("move",this._update),i.off("move",this._onClose),i.off("preclick",this._onClose),i.off("click",this._onClose),i.off("remove",this.remove),i.off("mousemove",this._onMouseEvent),i.off("mouseup",this._onMouseEvent),i.off("drag",this._onMouseEvent),i._canvasContainer&&i._canvasContainer.classList.remove("mapboxgl-track-pointer"),i._removePopup(this),this._map=void 0),this.fire(new e.b("close")),this}getLngLat(){return this._lngLat}setLngLat(i){this._lngLat=e.bn.convert(i),this._pos=null,this._trackPointer=!1,this._update();let r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let e=this._map;return e&&(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(document.createTextNode(e))}setHTML(e){let i;let r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=e;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=s("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(e),this.options.closeButton){let e=this._closeButton=s("button","mapboxgl-popup-close-button",i);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.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 i;return this._classList.delete(e)?i=!1:(this._classList.add(e),i=!0),this._updateClassList(),i}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;let i=this._map,r=this._container,a=this._pos;if(!i||!r||!a)return"bottom";let n=r.offsetWidth,o=r.offsetHeight,s=a.x<n/2,l=a.x>i.transform.width-n/2;if(a.y+e<o)return s?"top-left":l?"top-right":"top";if(a.y>i.transform.height-o){if(s)return"bottom-left";if(l)return"bottom-right"}return s?"left":l?"right":"bottom"}_updateClassList(){let e=this._container;if(!e)return;let i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),e.className=i.join(" ")}_update(i){let r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let n=this._container;if(n||(n=this._container=s("div","mapboxgl-popup",r.getContainer()),this._tip=s("div","mapboxgl-popup-tip",n),n.appendChild(a)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=nu(this._lngLat,this._pos,r.transform)),!this._trackPointer||i){let e=this._pos=this._trackPointer&&i?i:r.project(this._lngLat),a=nf(this.options.offset),n=this._anchor=this._getAnchor(a.y),o=nf(this.options.offset,n),s=e.add(o).round();r._requestDomTask(()=>{this._container&&n&&(this._container.style.transform=`${nc[n]} translate(${s.x}px,${s.y}px)`)})}if(!this._marker&&r._showingGlobe()){let i=e.d6(r.transform,this._lngLat)?0:1;this._setOpacity(i)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
105let e=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:nd,Style:iF,LngLat:e.bn,LngLatBounds:e.ad,Point:e.P,MercatorCoordinate:e.L,FreeCameraOptions:iy,Evented:e.E,config:e.d5,prewarm:e.dp,clearPrewarmedResources:e.dq,get accessToken(){return e.d5.ACCESS_TOKEN},set accessToken(t){e.d5.ACCESS_TOKEN=t},get baseApiUrl(){return e.d5.API_URL},set baseApiUrl(t){e.d5.API_URL=t},get workerCount(){return e.dr.workerCount},set workerCount(t){e.dr.workerCount=t},get maxParallelImageRequests(){return e.d5.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.d5.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(i){e.ds(i)},get workerUrl(){return e.dt.workerUrl},set workerUrl(t){e.dt.workerUrl=t},get workerClass(){return e.dt.workerClass},set workerClass(t){e.dt.workerClass=t},get workerParams(){return e.dt.workerParams},set workerParams(t){e.dt.workerParams=t},get dracoUrl(){return e.du()},set dracoUrl(t){e.dv(t)},get meshoptUrl(){return e.dw()},set meshoptUrl(t){e.dx(t)},setNow:e.f.setNow,restoreNow:e.f.restoreNow}}),r},e.exports=a()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.