vendor: 24,218 bytes, line 1
1(self.webpackChunkreact_weather=self.webpackChunkreact_weather||[]).push([[483],{483:function(t){t.exports=function(){"use strict";var t,e,i;function r(r,n){if(t)if(e){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 = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk); self.onerror = null;",s={};t(s),i=n(s),"undefined"!==typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=n;else t=n}return r(["exports"],(function(t){var e="undefined"!=typeof self?self:{},i=r;function r(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=i,this.p2y=r}r.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},r.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},r.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},r.prototype.solveCurveX=function(t,e){var i,r,n,o,s;for(void 0===e&&(e=1e-6),n=t,s=0;s<8;s++){if(o=this.sampleCurveX(n)-t,Math.abs(o)<e)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=o/a}if((n=t)<(i=0))return i;if(n>(r=1))return r;for(;i<r;){if(o=this.sampleCurveX(n),Math.abs(o-t)<e)return n;t>o?i=n:r=n,n=.5*(r-i)+i}return n},r.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var n=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};const s=Math.PI/180,a=180/Math.PI;function l(t){return t*s}function c(t){return t*a}const h=[[0,0],[1,0],[1,1],[0,1]];function u(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function p(t,e,r,n){const o=new i(t,e,r,n);return function(t){return o.solve(t)}}const d=p(.25,.1,.25,1);function f(t,e,i){return Math.min(i,Math.max(e,t))}function m(t,e,i){return(i=f((i-t)/(e-t),0,1))*i*(3-2*i)}function _(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function g(t,e,i){if(!t.length)return i(null,[]);let r=t.length;const n=new Array(t.length);let o=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(o=t),n[s]=e,0==--r&&i(o,n)}))}))}function y(t){const e=[];for(const i in t)e.push(t[i]);return e}function x(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];for(const n of i)for(const e in n)t[e]=n[e];return t}let v=1;function b(){return v++}function w(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function T(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function E(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function S(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function A(t,e){return-1!==t.indexOf(e,t.length-e.length)}function M(t,e,i){const r={};for(const n in t)r[n]=e.call(i||this,t[n],n,t);return r}function I(t,e,i){const r={};for(const n in t)e.call(i||this,t[n],n,t)&&(r[n]=t[n]);return r}function C(t){return Array.isArray(t)?t.map(C):"object"==typeof t&&t?M(t,C):t}const z={};function P(t){z[t]||("undefined"!=typeof console&&console.warn(t),z[t]=!0)}function k(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function D(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}function L(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function B(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const o=r||n;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let R=null;function F(t){if(null==R){const e=t.navigator?t.navigator.userAgent:null;R=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return R}function O(t){try{const i=e[t];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function U(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}const V=e.performance;function j(t){const e=t?t.url.toString():void 0;return V.getEntriesByName(e)}var N="2.10.0";let G,Z,q,W;const X={now:()=>void 0!==q?q:e.performance.now(),setNow(t){q=t},restoreNow(){q=void 0},frame(t){const i=e.requestAnimationFrame(t);return{cancel:()=>e.cancelAnimationFrame(i)}},getImageData(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{width:r,height:n}=t;W||(W=e.document.createElement("canvas"));const o=W.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return(r>W.width||n>W.height)&&(W.width=r,W.height=n),o.clearRect(-i,-i,r+2*i,n+2*i),o.drawImage(t,0,0,r,n),o.getImageData(-i,-i,r+2*i,n+2*i)},resolveURL:t=>(G||(G=e.document.createElement("a")),G.href=t,G.href),get devicePixelRatio(){return e.devicePixelRatio},get prefersReducedMotion(){return!!e.matchMedia&&(null==Z&&(Z=e.matchMedia("(prefers-reduced-motion: reduce)")),Z.matches)}};let H;const Y={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==H){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{H=null!={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_IMAGES_TOKEN:"f4a33819c8eb07obe0e6ft0bbcf0d4e1",REACT_APP_OPENWEATHER_TOKEN:"c39e19fbb86362056af8c33a19c4522e",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibmF5b2JhZXoiLCJhIjoiY2w4ZzN3dG83MGI4MjN1cHI0MDU0NWkxYyJ9.i7pZkoV_A_j7eSEX5oPmxQ"}.API_URL_REGEX?new RegExp({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_IMAGES_TOKEN:"f4a33819c8eb07obe0e6ft0bbcf0d4e1",REACT_APP_OPENWEATHER_TOKEN:"c39e19fbb86362056af8c33a19c4522e",REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoibmF5b2JhZXoiLCJhIjoiY2w4ZzN3dG83MGI4MjN1cHI0MDU0NWkxYyJ9.i7pZkoV_A_j7eSEX5oPmxQ"}.API_URL_REGEX):t}catch(e){H=t}}return H},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},K={supported:!1,testSupport:function(t){!$&&Q&&(tt?et(t):J=t)}};let J,Q,$=!1,tt=!1;function et(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Q),t.isContextLost())return;K.supported=!0}catch(t){}t.deleteTexture(e),$=!0}e.document&&(Q=e.document.createElement("img"),Q.onload=function(){J&&et(J),J=null,tt=!0},Q.onerror=function(){$=!0,J=null},Q.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const it="01",rt="NO_ACCESS_TOKEN";function nt(t){return 0===t.indexOf("mapbox:")}function ot(t){return Y.API_URL_REGEX.test(t)}const st=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function at(t){const e=t.match(st);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function lt(t){const e=t.params.length?"?".concat(t.params.join("&")):"";return"".concat(t.protocol,"://").concat(t.authority).concat(t.path).concat(e)}function ct(t){if(!t)return null;const i=t.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(decodeURIComponent(e.atob(i[1]).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(t){return null}}class ht{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const i=ct(Y.ACCESS_TOKEN);let r="";return r=i&&i.u?e.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e))))):Y.ACCESS_TOKEN||"",t?"mapbox.eventData.".concat(t,":").concat(r):"mapbox.eventData:".concat(r)}fetchEventData(){const t=O("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{const t=e.localStorage.getItem(i);t&&(this.eventData=JSON.parse(t));const n=e.localStorage.getItem(r);n&&(this.anonId=n)}catch(t){P("Unable to read from LocalStorage")}}saveEventData(){const t=O("localStorage"),i=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{e.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&e.localStorage.setItem(i,JSON.stringify(this.eventData))}catch(t){P("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,e,i,r){if(!Y.EVENTS_URL)return;const n=at(Y.EVENTS_URL);n.params.push("access_token=".concat(r||Y.ACCESS_TOKEN||""));const o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:N,skuId:it,userId:this.anonId},s=e?x(o,e):o,a={url:lt(n),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=Dt(a,(t=>{this.pendingRequest=null,i(t),this.saveEventData(),this.processRequests(r)}))}queueRequest(t,e){this.queue.push(t),this.processRequests(e)}}const ut=new class extends ht{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){Y.EVENTS_URL&&Y.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>nt(t)||ot(t)))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=ct(Y.ACCESS_TOKEN),i=e?e.u:Y.ACCESS_TOKEN;let r=i!==this.eventData.tokenU;E(this.anonId)||(this.anonId=w(),r=!0);const n=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(n),i=(n-this.eventData.lastSuccess)/864e5;r=r||i>=1||i<-1||t.getDate()!==e.getDate()}else r=!0;r?this.postEvent(n,{"enabled.telemetry":!1},(t=>{t||(this.eventData.lastSuccess=n,this.eventData.tokenU=i)}),t):this.processRequests()}},pt=ut.postTurnstileEvent.bind(ut),dt=new class extends ht{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,r){this.skuToken=e,this.errorCb=r,Y.EVENTS_URL&&(i||Y.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(rt)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),E(this.anonId)||(this.anonId=w()),this.postEvent(i,{skuToken:this.skuToken},(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t))}},ft=dt.postMapLoadEvent.bind(dt),mt=new class extends ht{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,i,r){if(!Y.API_URL||!Y.SESSION_PATH)return;const n=at(Y.API_URL+Y.SESSION_PATH);n.params.push("sku=".concat(e||"")),n.params.push("access_token=".concat(r||Y.ACCESS_TOKEN||""));const o={url:lt(n),headers:{"Content-Type":"text/plain"}};this.pendingRequest=Lt(o,(t=>{this.pendingRequest=null,i(t),this.saveEventData(),this.processRequests(r)}))}getSessionAPI(t,e,i,r){this.skuToken=e,this.errorCb=r,Y.SESSION_PATH&&Y.API_URL&&(i||Y.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(rt)))}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,(t=>{t?this.errorCb(t):e&&(this.success[e]=!0)}),t)}},_t=mt.getSessionAPI.bind(mt),gt=new Set;let yt,xt=500,vt=50,bt={};function wt(t){const e=St(t);let i,r;e&&e.forEach((t=>{const e=t.split("=");"language"===e[0]?i=e[1]:"worldview"===e[0]&&(r=e[1])}));let n="mapbox-tiles";return i&&(n+="-".concat(i)),r&&(n+="-".concat(r)),n}function Tt(){try{return e.caches}catch(t){}}function Et(t){const e=Tt();e&&!bt[t]&&(bt[t]=e.open(t))}function St(t){const e=t.indexOf("?");return e>0?t.slice(e+1).split("&"):[]}function At(t){const e=t.indexOf("?");if(e<0)return t;const i=St(t).filter((t=>{const e=t.split("=");return"language"===e[0]||"worldview"===e[0]}));return i.length?"".concat(t.slice(0,e),"?").concat(i.join("&")):t.slice(0,e)}let Mt=1/0;const It={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(It);class Ct extends Error{constructor(t,e,i){401===e&&ot(i)&&(t+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=i}toString(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}const zt=L()?()=>self.worker&&self.worker.referrer:()=>("blob:"===e.location.protocol?e.parent:e).location.href,Pt=function(t,i){if(!(/^file:/.test(r=t.url)||/^file:/.test(zt())&&!/^\w+:/.test(r))){if(e.fetch&&e.Request&&e.AbortController&&e.Request.prototype.hasOwnProperty("signal"))return function(t,i){const r=new e.AbortController,n=new e.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:zt(),signal:r.signal});let o=!1,s=!1;const a=(l=n.url).indexOf("sku=")>0&&ot(l);var l;"json"===t.type&&n.headers.set("Accept","application/json");const c=(r,o,l)=>{if(s)return;if(r&&"SecurityError"!==r.message&&P(r),o&&l)return h(o);const c=Date.now();e.fetch(n).then((e=>{if(e.ok){const t=a?e.clone():null;return h(e,t,c)}return i(new Ct(e.statusText,e.status,t.url))})).catch((t=>{20!==t.code&&i(new Error(t.message))}))},h=(r,a,l)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&l&&function(t,i,r){const n=wt(t.url);if(Et(n),!bt[n])return;const o={status:i.status,statusText:i.statusText,headers:new e.Headers};i.headers.forEach(((t,e)=>o.headers.set(e,t)));const s=B(i.headers.get("Cache-Control")||"");if(s["no-store"])return;s["max-age"]&&o.headers.set("Expires",new Date(r+1e3*s["max-age"]).toUTCString());const a=o.headers.get("Expires");a&&(new Date(a).getTime()-r<42e4||function(t,e){if(void 0===yt)try{new Response(new ReadableStream),yt=!0}catch(t){yt=!1}yt?e(t.body):t.blob().then(e)}(i,(i=>{const r=new e.Response(i,o);Et(n),bt[n]&&bt[n].then((e=>e.put(At(t.url),r))).catch((t=>P(t.message)))})))}(n,a,l),o=!0,i(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((t=>{s||i(new Error(t.message))}))};return a?function(t,e){const i=wt(t.url);if(Et(i),!bt[i])return e(null);const r=At(t.url);bt[i].then((t=>{t.match(r).then((i=>{const n=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),i=B(t.headers.get("Cache-Control")||"");return e>Date.now()&&!i["no-cache"]}(i);t.delete(r),n&&t.put(r,i.clone()),e(null,i,n)})).catch(e)})).catch(e)}(n,c):c(null,null),{cancel:()=>{s=!0,o||r.abort()}}}(t,i);if(L()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,i,void 0,!0)}var r;return function(t,i){const r=new e.XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{i(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let e=r.response;if("json"===t.type)try{e=JSON.parse(r.response)}catch(t){return i(t)}i(null,e,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new Ct(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,i)},kt=function(t,e){return Pt(x(t,{type:"arrayBuffer"}),e)},Dt=function(t,e){return Pt(x(t,{method:"POST"}),e)},Lt=function(t,e){return Pt(x(t,{method:"GET"}),e)};function Bt(t){const i=e.document.createElement("a");return i.href=t,i.protocol===e.document.location.protocol&&i.host===e.document.location.host}const Rt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Ft,Ot;Ft=[],Ot=0;const Ut=function(t,i){if(K.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Ot>=Y.MAX_PARALLEL_IMAGE_REQUESTS){const e={requestParameters:t,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return Ft.push(e),e}Ot++;let r=!1;const n=()=>{if(!r)for(r=!0,Ot--;Ft.length&&Ot<Y.MAX_PARALLEL_IMAGE_REQUESTS;){const t=Ft.shift(),{requestParameters:e,callback:i,cancelled:r}=t;r||(t.cancel=Ut(e,i).cancel)}},o=kt(t,((t,r,o,s)=>{n(),t?i(t):r&&(e.createImageBitmap?function(t,i){const r=new e.Blob([new Uint8Array(t)],{type:"image/png"});e.createImageBitmap(r).then((t=>{i(null,t)})).catch((t=>{i(new Error("Could not load image because of ".concat(t.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))}))}(r,((t,e)=>i(t,e,o,s))):function(t,i){const r=new e.Image,n=e.URL;r.onload=()=>{i(null,r),n.revokeObjectURL(r.src),r.onload=null,e.requestAnimationFrame((()=>{r.src=Rt}))},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const o=new e.Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?n.createObjectURL(o):Rt}(r,((t,e)=>i(t,e,o,s))))}));return{cancel:()=>{o.cancel(),n()}}};function Vt(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function jt(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class Nt{constructor(t){x(this,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.type=t}}class Gt extends Nt{constructor(t){super("error",x({error:t},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}}class Zt{on(t,e){return this._listeners=this._listeners||{},Vt(t,e,this._listeners),this}off(t,e){return jt(t,e,this._listeners),jt(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},Vt(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new Nt(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const o of r)jt(i,o,this._oneTimeListeners),o.call(this,t);const n=this._eventedParent;n&&(x(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof Gt&&console.error(t.error);return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var qt=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"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":{}}},"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":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1
vendor: 17,950 bytes, line 1
1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":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"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"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"]},"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"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"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":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"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,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"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"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"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,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}
vendor: 1,871 bytes, line 1
1,"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}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"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],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"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"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"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"],"transition":false,"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,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"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-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","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":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"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"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"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"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function Wt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];for(const n of i)for(const e in n)t[e]=n[e];return t}function Xt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ht(t){if(Array.isArray(t))return t.map(Ht);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Ht(t[i]);return e}return Xt(t)}
vendor: 15,124 bytes, line 1
1class Yt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}var Kt=Yt;class Jt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.parent=t,this.bindings={};for(const[i,r]of e)this.bindings[i]=r}concat(t){return new Jt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var Qt=Jt;const $t={kind:"null"},te={kind:"number"},ee={kind:"string"},ie={kind:"boolean"},re={kind:"color"},ne={kind:"object"},oe={kind:"value"},se={kind:"collator"},ae={kind:"formatted"},le={kind:"resolvedImage"};function ce(t,e){return{kind:"array",itemType:t,N:e}}function he(t){if("array"===t.kind){const e=he(t.itemType);return"number"==typeof t.N?"array<".concat(e,", ").concat(t.N,">"):"value"===t.itemType.kind?"array":"array<".concat(e,">")}return t.kind}const ue=[$t,te,ee,ie,re,ae,ne,ce(oe),le];function pe(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!pe(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of ue)if(!pe(t,e))return null}return"Expected ".concat(he(t)," but found ").concat(he(e)," instead.")}function de(t,e){return e.some((e=>e.kind===t.kind))}function fe(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function me(t){var e={exports:{}};return t(e,e.exports),e.exports}var _e=me((function(t,e){var i={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 r(t){return(t=Math.round(t))<0?0:t>255?255:t}function n(t){return r("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function s(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{e.parseCSSColor=function(t){var e,a=t.replace(/ /g,"").toLowerCase();if(a in i)return i[a].slice();if("#"===a[0])return 4===a.length?(e=parseInt(a.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===a.length&&(e=parseInt(a.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=a.indexOf("("),c=a.indexOf(")");if(-1!==l&&c+1===a.length){var h=a.substr(0,l),u=a.substr(l+1,c-(l+1)).split(","),p=1;switch(h){case"rgba":if(4!==u.length)return null;p=o(u.pop());case"rgb":return 3!==u.length?null:[n(u[0]),n(u[1]),n(u[2]),p];case"hsla":if(4!==u.length)return null;p=o(u.pop());case"hsl":if(3!==u.length)return null;var d=(parseFloat(u[0])%360+360)%360/360,f=o(u[1]),m=o(u[2]),_=m<=.5?m*(f+1):m+f-m*f,g=2*m-_;return[r(255*s(g,_,d+1/3)),r(255*s(g,_,d)),r(255*s(g,_,d-1/3)),p];default:return null}}return null}}catch(t){}}));class ge{constructor(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.r=t,this.g=e,this.b=i,this.a=r}static parse(t){if(!t)return;if(t instanceof ge)return t;if("string"!=typeof t)return;const e=_e.parseCSSColor(t);return e?new ge(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,r]=this.toArray();return"rgba(".concat(Math.round(t),",").concat(Math.round(e),",").concat(Math.round(i),",").concat(r,")")}toArray(){const{r:t,g:e,b:i,a:r}=this;return 0===r?[0,0,0,0]:[255*t/r,255*e/r,255*i/r,r]}toArray01(){const{r:t,g:e,b:i,a:r}=this;return 0===r?[0,0,0,0]:[t/r,e/r,i/r,r]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:i,a:r}=this;return[t,e,i,r]}}ge.black=new ge(0,0,0,1),ge.white=new ge(1,1,1,1),ge.transparent=new ge(0,0,0,0),ge.red=new ge(1,0,0,1),ge.blue=new ge(0,0,1,1);var ye=ge;class xe{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ve{constructor(t,e,i,r,n){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n}}class be{constructor(t){this.sections=t}static fromString(t){return new be([new ve(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof be?t:be.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class we{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new we({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Te(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value [".concat([t,e,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat(("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function Ee(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof ye)return!0;if(t instanceof xe)return!0;if(t instanceof be)return!0;if(t instanceof we)return!0;if(Array.isArray(t)){for(const e of t)if(!Ee(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ee(t[e]))return!1;return!0}return!1}function Se(t){if(null===t)return $t;if("string"==typeof t)return ee;if("boolean"==typeof t)return ie;if("number"==typeof t)return te;if(t instanceof ye)return re;if(t instanceof xe)return se;if(t instanceof be)return ae;if(t instanceof we)return le;if(Array.isArray(t)){const e=t.length;let i;for(const r of t){const t=Se(r);if(i){if(i===t)continue;i=oe;break}i=t}return ce(i||oe,e)}return ne}function Ae(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ye||t instanceof be||t instanceof we?t.toString():JSON.stringify(t)}class Me{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!Ee(t[1]))return e.error("invalid value");const i=t[1];let r=Se(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Me(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof ye?["rgba"].concat(this.value.toArray()):this.value instanceof be?this.value.serialize():this.value}}var Ie=Me,Ce=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const ze={string:ee,number:te,boolean:ie,object:ne};class Pe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ze)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=ze[i],r++}else n=oe;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],r++}i=ce(n,o)}else i=ze[n];const o=[];for(;r<t.length;r++){const i=e.parse(t[r],r,oe);if(!i)return null;o.push(i)}return new Pe(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!pe(this.type,Se(i)))return i;if(e===this.args.length-1)throw new Ce("Expected value to be of type ".concat(he(this.type),", but found ").concat(he(Se(i))," instead."))}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const r=t.N;("number"==typeof r||this.args.length>1)&&e.push(r)}}return e.concat(this.args.map((t=>t.serialize())))}}var ke=Pe;class De{constructor(t){this.type=ae,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let o=1;o<=t.length-1;++o){const i=t[o];if(n&&"object"==typeof i&&!Array.isArray(i)){n=!1;let t=null;if(i["font-scale"]&&(t=e.parse(i["font-scale"],1,te),!t))return null;let o=null;if(i["text-font"]&&(o=e.parse(i["text-font"],1,ce(ee)),!o))return null;let s=null;if(i["text-color"]&&(s=e.parse(i["text-color"],1,re),!s))return null;const a=r[r.length-1];a.scale=t,a.font=o,a.textColor=s}else{const i=e.parse(t[o],1,oe);if(!i)return null;const s=i.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:i,scale:null,font:null,textColor:null})}}return new De(r)}evaluate(t){return new be(this.sections.map((e=>{const i=e.content.evaluate(t);return Se(i)===le?new ve("",i,null,null,null):new ve(Ae(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Le{constructor(t){this.type=le,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ee);return i?new Le(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=we.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Be={"to-boolean":ie,"to-color":re,"to-number":te,"to-string":ee};class Re{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=Be[i],n=[];for(let o=1;o<t.length;o++){const i=e.parse(t[o],o,oe);if(!i)return null;n.push(i)}return new Re(r,n)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof ye)return e;if("string"==typeof e){const i=t.parseColor(e);
1if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?"Invalid rbga value ".concat(JSON.stringify(e),": expected an array containing either three or four numeric values."):Te(e[0],e[1],e[2],e[3]),!i))return new ye(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Ce(i||"Could not parse color from value '".concat("string"==typeof e?e:String(JSON.stringify(e)),"'"))}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new Ce("Could not convert ".concat(JSON.stringify(e)," to number."))}return"formatted"===this.type.kind?be.fromString(Ae(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?we.fromString(Ae(this.args[0].evaluate(t))):Ae(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new De([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Le(this.args[0]).serialize();const t=["to-".concat(this.type.kind)];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Fe=Re;const Oe=["Unknown","Point","LineString","Polygon"];var Ue=class{constructor(){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}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Oe[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*e-t[0])+this.featureDistanceData.bearing[1]*(r*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ye.parse(t)),e}};class Ve{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const i=t[0],r=Ve.definitions[i];if(!r)return e.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((e=>{let[i]=e;return!Array.isArray(i)||i.length===t.length-1}));let a=null;for(const[l,c]of s){a=new di(e.registry,e.path,null,e.scope);const r=[];let o=!1;for(let e=1;e<t.length;e++){const i=t[e],n=Array.isArray(l)?l[e-1]:l.type,s=a.parse(i,1+r.length,n);if(!s){o=!0;break}r.push(s)}if(!o)if(Array.isArray(l)&&l.length!==r.length)a.error("Expected ".concat(l.length," arguments, but found ").concat(r.length," instead."));else{for(let t=0;t<r.length;t++){const e=Array.isArray(l)?l[t]:l.type,i=r[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new Ve(i,n,c,r)}}if(1===s.length)e.errors.push(...a.errors);else{const i=(s.length?s:o).map((t=>{let[e]=t;return i=e,Array.isArray(i)?"(".concat(i.map(he).join(", "),")"):"(".concat(he(i.type),"...)");var i})).join(" | "),r=[];for(let n=1;n<t.length;n++){const i=e.parse(t[n],1+r.length);if(!i)return null;r.push(he(i.type))}e.error("Expected arguments of type ".concat(i,", but found (").concat(r.join(", "),") instead."))}return null}static register(t,e){Ve.definitions=e;for(const i in e)t[i]=Ve}}var je=Ve;class Ne{constructor(t,e,i){this.type=se,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ie);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ie);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,ee),!o)?null:new Ne(r,n,o)}evaluate(t){return new xe(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Ge=8192;function Ze(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function qe(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function We(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*Ge),Math.round(r*n*Ge)]}function Xe(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function He(t,e){let i=!1;for(let s=0,a=e.length;s<a;s++){const a=e[s];for(let e=0,s=a.length;e<s-1;e++){if(Xe(t,a[e],a[e+1]))return!1;(n=a[e])[1]>(r=t)[1]!=(o=a[e+1])[1]>r[1]&&r[0]<(o[0]-n[0])*(r[1]-n[1])/(o[1]-n[1])+n[0]&&(i=!i)}}var r,n,o;return i}function Ye(t,e){for(let i=0;i<e.length;i++)if(He(t,e[i]))return!0;return!1}function Ke(t,e,i,r){const n=r[0]-i[0],o=r[1]-i[1],s=(t[0]-i[0])*o-n*(t[1]-i[1]),a=(e[0]-i[0])*o-n*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function Je(t,e,i){for(const c of i)for(let i=0;i<c.length-1;++i)if(0!=(a=[(s=c[i+1])[0]-(o=c[i])[0],s[1]-o[1]])[0]*(l=[(n=e)[0]-(r=t)[0],n[1]-r[1]])[1]-a[1]*l[0]&&Ke(r,n,o,s)&&Ke(o,s,r,n))return!0;var r,n,o,s,a,l;return!1}function Qe(t,e){for(let i=0;i<t.length;++i)if(!He(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Je(t[i],t[i+1],e))return!1;return!0}function $e(t,e){for(let i=0;i<e.length;i++)if(Qe(t,e[i]))return!0;return!1}function ti(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=[];for(let r=0;r<t[n].length;r++){const s=We(t[n][r],i);Ze(e,s),o.push(s)}r.push(o)}return r}function ei(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=ti(t[n],e,i);r.push(o)}return r}
vendor: 7,303 bytes, line 1
1function ii(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}Ze(e,t)}function ri(t,e,i,r){const n=Math.pow(2,r.z)*Ge,o=[r.x*Ge,r.y*Ge],s=[];if(!t)return s;for(const a of t)for(const t of a){const r=[t.x+o[0],t.y+o[1]];ii(r,e,i,n),s.push(r)}return s}function ni(t,e,i,r){const n=Math.pow(2,r.z)*Ge,o=[r.x*Ge,r.y*Ge],s=[];if(!t)return s;for(const l of t){const t=[];for(const i of l){const r=[i.x+o[0],i.y+o[1]];Ze(e,r),t.push(r)}s.push(t)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of s)for(const r of t)ii(r,e,i,n)}var a;return s}class oi{constructor(t,e){this.type=ie,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(Ee(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new oi(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new oi(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new oi(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(!n)return!1;if("Polygon"===e.type){const o=ti(e.coordinates,r,n),s=ri(t.geometry(),i,r,n);if(!qe(i,r))return!1;for(const t of s)if(!He(t,o))return!1}if("MultiPolygon"===e.type){const o=ei(e.coordinates,r,n),s=ri(t.geometry(),i,r,n);if(!qe(i,r))return!1;for(const t of s)if(!Ye(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(!n)return!1;if("Polygon"===e.type){const o=ti(e.coordinates,r,n),s=ni(t.geometry(),i,r,n);if(!qe(i,r))return!1;for(const t of s)if(!Qe(t,o))return!1}if("MultiPolygon"===e.type){const o=ei(e.coordinates,r,n),s=ni(t.geometry(),i,r,n);if(!qe(i,r))return!1;for(const t of s)if(!$e(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var si=oi;function ai(t){if(t instanceof je){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof si)return!1;let e=!0;return t.eachChild((t=>{e&&!ai(t)&&(e=!1)})),e}function li(t){if(t instanceof je&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!li(t)&&(e=!1)})),e}function ci(t,e){if(t instanceof je&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ci(t,e)&&(i=!1)})),i}class hi{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new hi(i,e.scope.get(i)):e.error('Unknown variable "'.concat(i,'". Make sure "').concat(i,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var ui=hi;class pi{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Qt,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];this.registry=t,this.path=e,this.key=e.map((t=>"[".concat(t,"]"))).join(""),this.scope=r,this.errors=n,this.expectedType=i}parse(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new ke(e,[t]):"coerce"===i?new Fe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found ".concat(typeof r,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof Ie)&&"resolvedImage"!==r.type.kind&&fi(r)){const e=new Ue;try{r=new Ie(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found ".concat(typeof t," instead."))}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new pi(this.registry,r,e||null,n,this.errors)}error(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];const n="".concat(this.key).concat(i.map((t=>"[".concat(t,"]"))).join(""));this.errors.push(new Kt(n,t))}checkSubtype(t,e){const i=pe(t,e);return i&&this.error(i),i}}var di=pi;function fi(t){if(t instanceof ui)return fi(t.boundExpression);if(t instanceof je&&"error"===t.name)return!1;if(t instanceof Ne)return!1;if(t instanceof si)return!1;const e=t instanceof Fe||t instanceof ke;let i=!0;return t.eachChild((t=>{i=e?i&&fi(t):i&&t instanceof Ie})),!!i&&ai(t)&&ci(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function mi(t,e){const i=t.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=t[a],n=t[a+1],r<=e){if(a===i||e<n)return a;o=a+1}else{if(!(r>e))throw new Ce("Input is not a number.");s=a-1}return 0}class _i{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,te);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let o=1;o<t.length;o+=2){const i=1===o?-1/0:t[o],s=t[o+1],a=o,l=o+1;if("number"!=typeof i)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=i)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([i,c])}return new _i(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[mi(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var gi=_i;function yi(t,e,i){return t*(1-i)+e*i}function xi(t,e,i){return t.map(((t,r)=>yi(t,e[r],i)))}var vi=Object.freeze({__proto__:null,number:yi,color:function(t,e,i){return new ye(yi(t.r,e.r,i),yi(t.g,e.g,i),yi(t.b,e.b,i),yi(t.a,e.a,i))},array:xi});const bi=.95047,wi=1.08883,Ti=4/29,Ei=6/29,Si=3*Ei*Ei,Ai=Math.PI/180,Mi=180/Math.PI;function Ii(t){return t>.008856451679035631?Math.pow(t,1/3):t/Si+Ti}function Ci(t){return t>Ei?t*t*t:Si*(t-Ti)}
vendor: 4,449 bytes, line 1
1function zi(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Pi(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ki(t){const e=Pi(t.r),i=Pi(t.g),r=Pi(t.b),n=Ii((.4124564*e+.3575761*i+.1804375*r)/bi),o=Ii((.2126729*e+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-Ii((.0193339*e+.119192*i+.9503041*r)/wi)),alpha:t.a}}function Di(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,r=isNaN(t.b)?e:e-t.b/200;return e=1*Ci(e),i=bi*Ci(i),r=wi*Ci(r),new ye(zi(3.2404542*i-1.5371385*e-.4985314*r),zi(-.969266*i+1.8760108*e+.041556*r),zi(.0556434*i-.2040259*e+1.0572252*r),t.alpha)}function Li(t,e,i){const r=e-t;return t+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const Bi={forward:ki,reverse:Di,interpolate:function(t,e,i){return{l:yi(t.l,e.l,i),a:yi(t.a,e.a,i),b:yi(t.b,e.b,i),alpha:yi(t.alpha,e.alpha,i)}}},Ri={forward:function(t){const{l:e,a:i,b:r}=ki(t),n=Math.atan2(r,i)*Mi;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ai,i=t.c;return Di({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Li(t.h,e.h,i),c:yi(t.c,e.c,i),l:yi(t.l,e.l,i),alpha:yi(t.alpha,e.alpha,i)}}};var Fi=Object.freeze({__proto__:null,lab:Bi,hcl:Ri});class Oi{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[o,s]of n)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,e,r,n){let o=0;if("exponential"===t.name)o=Ui(e,t.base,r,n);else if("linear"===t.name)o=Ui(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;o=new i(s[0],s[1],s[2],s[3]).solve(Ui(e,1,r,n))}return o}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error("Unknown interpolation type ".concat(String(r[0])),1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,te),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=re:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let l=0;l<o.length;l+=2){const t=o[l],i=o[l+1],r=l+3,n=l+4;if("number"!=typeof t)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(s.length&&s[s.length-1][0]>=t)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(i,n,a);if(!c)return null;a=a||c.type,s.push([t,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Oi(a,i,r,n,s):e.error("Type ".concat(he(a)," is not interpolatable."))}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const o=mi(e,r),s=Oi.interpolationFactor(this.interpolation,r,e[o],e[o+1]),a=i[o].evaluate(t),l=i[o+1].evaluate(t);return"interpolate"===this.operator?vi[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?Ri.reverse(Ri.interpolate(Ri.forward(a),Ri.forward(l),s)):Bi.reverse(Bi.interpolate(Bi.forward(a),Bi.forward(l),s))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let i=0;i<this.labels.length;i++)e.push(this.labels[i],this.outputs[i].serialize());return e}}
1function Ui(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}var Vi=Oi;class ji{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const s of t.slice(1)){const t=e.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}const o=r&&n.some((t=>pe(r,t.type)));return new ji(o?oe:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(t),i&&i instanceof we&&!i.available&&(e||(e=i),i=null,r===this.args.length))return e;if(null!==i)break}return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var Ni=ji;class Gi{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error("Expected string, but found ".concat(typeof r," instead."),n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new Gi(i,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,i]of this.bindings)t.push(e,i.serialize());return t.push(this.result.serialize()),t}}var Zi=Gi;class qi{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));const i=e.parse(t[1],1,te),r=e.parse(t[2],2,ce(e.expectedType||oe));return i&&r?new qi(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Ce("Array index out of bounds: ".concat(e," < 0."));if(e>=i.length)throw new Ce("Array index out of bounds: ".concat(e," > ").concat(i.length-1,"."));if(e!==Math.floor(e))throw new Ce("Array index must be an integer, but found ".concat(e," instead."));return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Wi=qi;class Xi{constructor(t,e){this.type=ie,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));const i=e.parse(t[1],1,oe),r=e.parse(t[2],2,oe);return i&&r?de(i.type,[ie,ee,te,$t,oe])?new Xi(i,r):e.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(he(i.type)," instead")):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!fe(e,["boolean","string","number","null"]))throw new Ce("Expected first argument to be of type boolean, string, number or null, but found ".concat(he(Se(e))," instead."));if(!fe(i,["string","array"]))throw new Ce("Expected second argument to be of type array or string, but found ".concat(he(Se(i))," instead."));return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Hi=Xi;class Yi{constructor(t,e,i){this.type=te,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));const i=e.parse(t[1],1,oe),r=e.parse(t[2],2,oe);if(!i||!r)return null;if(!de(i.type,[ie,ee,te,$t,oe]))return e.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(he(i.type)," instead"));if(4===t.length){const n=e.parse(t[3],3,te);return n?new Yi(i,r,n):null}return new Yi(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!fe(e,["boolean","string","number","null"]))throw new Ce("Expected first argument to be of type boolean, string, number or null, but found ".concat(he(Se(e))," instead."));if(!fe(i,["string","array"]))throw new Ce("Expected second argument to be of type array or string, but found ".concat(he(Se(i))," instead."));if(this.fromIndex){const r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Ki=Yi;class Ji{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},o=[];for(let l=2;l<t.length-1;l+=2){let s=t[l];const a=t[l+1];Array.isArray(s)||(s=[s]);const c=e.concat(l);
1if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Se(t)))return null}else i=Se(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const h=e.parse(a,l,r);if(!h)return null;r=r||h.type,o.push(h)}const s=e.parse(t[1],1,oe);if(!s)return null;const a=e.parse(t[t.length-1],t.length-1,r);return a?"value"!==s.type.kind&&e.concat(1).checkSubtype(i,s.type)?null:new Ji(i,r,s,n,o,a):null}evaluate(t){const e=this.input.evaluate(t);return(Se(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],r={};for(const o of e){const t=r[this.cases[o]];void 0===t?(r[this.cases[o]]=i.length,i.push([this.cases[o],[o]])):i[t][1].push(o)}const n=t=>"number"===this.inputType.kind?Number(t):t;for(const[o,s]of i)t.push(1===s.length?n(s[0]):s.map(n)),t.push(this.outputs[o].serialize());return t.push(this.otherwise.serialize()),t}}var Qi=Ji;class $i{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let o=1;o<t.length-1;o+=2){const n=e.parse(t[o],o,ie);if(!n)return null;const s=e.parse(t[o+1],o+1,i);if(!s)return null;r.push([n,s]),i=i||s.type}const n=e.parse(t[t.length-1],t.length-1,i);return n?new $i(i,r,n):null}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((t=>{let[e,i]=t;return i.outputDefined()}))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var tr=$i;class er{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));const i=e.parse(t[1],1,oe),r=e.parse(t[2],2,te);if(!i||!r)return null;if(!de(i.type,[ce(oe),ee,oe]))return e.error("Expected first argument to be of type array or string, but found ".concat(he(i.type)," instead"));if(4===t.length){const n=e.parse(t[3],3,te);return n?new er(i.type,i,r,n):null}return new er(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!fe(e,["string","array"]))throw new Ce("Expected first argument to be of type array or string, but found ".concat(he(Se(e))," instead."));if(this.endIndex){const r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var ir=er;function rr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function nr(t,e,i,r){return 0===r.compare(e,i)}function or(t,e,i){const r="=="!==t&&"!="!==t;return class n{constructor(t,e,i){this.type=ie,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let o=e.parse(t[1],1,oe);if(!o)return null;if(!rr(i,o.type))return e.concat(1).error('"'.concat(i,"\" comparisons are not supported for type '").concat(he(o.type),"'."));let s=e.parse(t[2],2,oe);if(!s)return null;if(!rr(i,s.type))return e.concat(2).error('"'.concat(i,"\" comparisons are not supported for type '").concat(he(s.type),"'."));if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot compare types '".concat(he(o.type),"' and '").concat(he(s.type),"'."));r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new ke(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new ke(o.type,[s])));let a=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,se),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=Se(o),i=Se(s);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Ce('Expected arguments for "'.concat(t,'" to be (string, string) or (number, number), but found (').concat(e.kind,", ").concat(i.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){const t=Se(o),i=Se(s);if("string"!==t.kind||"string"!==i.kind)return e(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):e(n,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}
1const sr=or("==",(function(t,e,i){return e===i}),nr),ar=or("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!nr(0,e,i,r)})),lr=or("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),cr=or(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),hr=or("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),ur=or(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class pr{constructor(t,e,i,r,n,o){this.type=ee,this.number=t,this.locale=e,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,te);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,ee),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,ee),!o))return null;let s=null;if(r.unit&&(s=e.parse(r.unit,1,ee),!s))return null;let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,te),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=e.parse(r["max-fraction-digits"],1,te),!l)?null:new pr(i,n,o,s,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class dr{constructor(t){this.type=te,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found ".concat(t.length-1," instead."));const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error("Expected argument of type string or array, but found ".concat(he(i.type)," instead.")):new dr(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Ce("Expected value to be of type string or array, but found ".concat(he(Se(e))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const fr={"==":sr,"!=":ar,">":cr,"<":lr,">=":ur,"<=":hr,array:ke,at:Wi,boolean:ke,case:tr,coalesce:Ni,collator:Ne,format:De,image:Le,in:
1Hi,"index-of":Ki,interpolate:Vi,"interpolate-hcl":Vi,"interpolate-lab":Vi,length:dr,let:Zi,literal:Ie,match:Qi,number:ke,"number-format":pr,object:ke,slice:ir,step:gi,string:ke,"to-boolean":Fe,"to-color":Fe,"to-number":Fe,"to-string":Fe,var:ui,within:si};function mr(t,e){let[i,r,n,o]=e;i=i.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=o?o.evaluate(t):1,a=Te(i,r,n,s);if(a)throw new Ce(a);return new ye(i/255*s,r/255*s,n/255*s,s)}function _r(t,e){return t in e}function gr(t,e){const i=e[t];return void 0===i?null:i}function yr(t){return{type:t}}je.register(fr,{error:[{kind:"error"},[ee],(t,e)=>{let[i]=e;throw new Ce(i.evaluate(t))}],typeof:[ee,[oe],(t,e)=>{let[i]=e;return he(Se(i.evaluate(t)))}],"to-rgba":[ce(te,4),[re],(t,e)=>{let[i]=e;return i.evaluate(t).toArray()}],rgb:[re,[te,te,te],mr],rgba:[re,[te,te,te,te],mr],has:{type:ie,overloads:[[[ee],(t,e)=>{let[i]=e;return _r(i.evaluate(t),t.properties())}],[[ee,ne],(t,e)=>{let[i,r]=e;return _r(i.evaluate(t),r.evaluate(t))}]]},get:{type:oe,overloads:[[[ee],(t,e)=>{let[i]=e;return gr(i.evaluate(t),t.properties())}],[[ee,ne],(t,e)=>{let[i,r]=e;return gr(i.evaluate(t),r.evaluate(t))}]]},"feature-state":[oe,[ee],(t,e)=>{let[i]=e;return gr(i.evaluate(t),t.featureState||{})}],properties:[ne,[],t=>t.properties()],"geometry-type":[ee,[],t=>t.geometryType()],id:[oe,[],t=>t.id()],zoom:[te,[],t=>t.globals.zoom],pitch:[te,[],t=>t.globals.pitch||0],"distance-from-center":[te,[],t=>t.distanceFromCenter()],"heatmap-density":[te,[],t=>t.globals.heatmapDensity||0],"line-progress":[te,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[te,[],t=>t.globals.skyRadialProgress||0],accumulated:[oe,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[te,yr(te),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[te,yr(te),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:te,overloads:[[[te,te],(t,e)=>{let[i,r]=e;return i.evaluate(t)-r.evaluate(t)}],[[te],(t,e)=>{let[i]=e;return-i.evaluate(t)}]]},"/":[te,[te,te],(t,e)=>{let[i,r]=e;return i.evaluate(t)/r.evaluate(t)}],"%":[te,[te,te],(t,e)=>{let[i,r]=e;return i.evaluate(t)%r.evaluate(t)}],ln2:[te,[],()=>Math.LN2],pi:[te,[],()=>Math.PI],e:[te,[],()=>Math.E],"^":[te,[te,te],(t,e)=>{let[i,r]=e;return Math.pow(i.evaluate(t),r.evaluate(t))}],sqrt:[te,[te],(t,e)=>{let[i]=e;return Math.sqrt(i.evaluate(t))}],log10:[te,[te],(t,e)=>{let[i]=e;return Math.log(i.evaluate(t))/Math.LN10}],ln:[te,[te],(t,e)=>{let[i]=e;return Math.log(i.evaluate(t))}],log2:[te,[te],(t,e)=>{let[i]=e;return Math.log(i.evaluate(t))/Math.LN2}],sin:[te,[te],(t,e)=>{let[i]=e;return Math.sin(i.evaluate(t))}],cos:[te,[te],(t,e)=>{let[i]=e;return Math.cos(i.evaluate(t))}],tan:[te,[te],(t,e)=>{let[i]=e;return Math.tan(i.evaluate(t))}],asin:[te,[te],(t,e)=>{let[i]=e;return Math.asin(i.evaluate(t))}],acos:[te,[te],(t,e)=>{let[i]=e;return Math.acos(i.evaluate(t))}],atan:[te,[te],(t,e)=>{let[i]=e;return Math.atan(i.evaluate(t))}],min:[te,yr(te),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[te,yr(te),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[te,[te],(t,e)=>{let[i]=e;return Math.abs(i.evaluate(t))}],round:[te,[te],(t,e)=>{let[i]=e;const r=i.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[te,[te],(t,e)=>{let[i]=e;return Math.floor(i.evaluate(t))}],ceil:[te,[te],(t,e)=>{let[i]=e;return Math.ceil(i.evaluate(t))}],"filter-==":[ie,[ee,oe],(t,e)=>{let[i,r]=e;return t.properties()[i.value]===r.value}],"filter-id-==":[ie,[oe],(t,e)=>{let[i]=e;return t.id()===i.value}],"filter-type-==":[ie,[ee],(t,e)=>{let[i]=e;return t.geometryType()===i.value}],"filter-<":[ie,[ee,oe],(t,e)=>{let[i,r]=e;const n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n<o}],"filter-id-<":[ie,[oe],(t,e)=>{let[i]=e;const r=t.id(),n=i.value;return typeof r==typeof n&&r<n}],"filter->":[ie,[ee,oe],(t,e)=>{let[i,r]=e;const n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n>o}],"filter-id->":[ie,[oe],(t,e)=>{let[i]=e;const r=t.id(),n=i.value;return typeof r==typeof n&&r>n}],"filter-<=":[ie,[ee,oe],(t,e)=>{let[i,r]=e;const n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[ie,[oe],(t,e)=>{let[i]=e;const r=t.id(),n=i.value;return typeof r==typeof n&&r<=n}],"filter->=":[ie,[ee,oe],(t,e)=>{let[i,r]=e;const n=t.properties()[i.value],o=r.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[ie,[oe],(t,e)=>{let[i]=e;const r=t.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[ie,[oe],(t,e)=>{let[i]=e;return i.value in t.properties()}],"filter-has-id":[ie,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ie,[ce(ee)],(t,e)=>{let[i]=e;return i.value.indexOf(t.geometryType())>=0}],"filter-id-in":[ie,[ce(oe)],(t,e)=>{let[i]=e;return i.value.indexOf(t.id())>=0}],"filter-in-small":[ie,[ee,ce(oe)],(t,e)=>{let[i,r]=e;return r.value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[ie,[ee,ce(oe)],(t,e)=>{let[i,r]=e;
vendor: 14,196 bytes, line 1
1return function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[i.value],r.value,0,r.value.length-1)}],all:{type:ie,overloads:[[[ie,ie],(t,e)=>{let[i,r]=e;return i.evaluate(t)&&r.evaluate(t)}],[yr(ie),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ie,overloads:[[[ie,ie],(t,e)=>{let[i,r]=e;return i.evaluate(t)||r.evaluate(t)}],[yr(ie),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ie,[ie],(t,e)=>{let[i]=e;return!i.evaluate(t)}],"is-supported-script":[ie,[ee],(t,e)=>{let[i]=e;const r=t.globals&&t.globals.isSupportedScript;return!r||r(i.evaluate(t))}],upcase:[ee,[ee],(t,e)=>{let[i]=e;return i.evaluate(t).toUpperCase()}],downcase:[ee,[ee],(t,e)=>{let[i]=e;return i.evaluate(t).toLowerCase()}],concat:[ee,yr(oe),(t,e)=>e.map((e=>Ae(e.evaluate(t)))).join("")],"resolved-locale":[ee,[se],(t,e)=>{let[i]=e;return i.evaluate(t).resolvedLocale()}]});var xr=fr;function vr(t){return{result:"success",value:t}}function br(t){return{result:"error",value:t}}function wr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Tr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Er(t){return!!t.expression&&t.expression.interpolated}function Sr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ar(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Mr(t){return t}function Ir(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),o=t.type||(Er(e)?"exponential":"interval");if(i&&((t=Wt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],ye.parse(t[1])]))),t.default=ye.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Fi[t.colorSpace])throw new Error("Unknown color space: ".concat(t.colorSpace));let s,a,l;if("exponential"===o)s=kr;else if("interval"===o)s=Pr;else if("categorical"===o){s=zr,a=Object.create(null);for(const e of t.stops)a[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error('Unknown function type "'.concat(o,'"'));s=Dr}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of r)n.push([i[t].zoom,Ir(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Vi.interpolationFactor.bind(void 0,o),zoomStops:n.map((t=>t[0])),evaluate:(i,r)=>{let{zoom:o}=i;return kr({stops:n,base:t.base},e,o).evaluate(o,r)}}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Vi.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:i=>{let{zoom:r}=i;return s(t,e,r,a,l)}}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?Cr(t.default,e.default):s(t,e,n,a,l)}}}function Cr(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function zr(t,e,i,r,n){return Cr(typeof i===n?r[i]:void 0,t.default,e.default)}function Pr(t,e,i){if("number"!==Sr(i))return Cr(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=mi(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function kr(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==Sr(i))return Cr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=mi(t.stops.map((t=>t[0])),i),s=function(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],l=t.stops[o+1][1];let c=vi[e.type]||Mr;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Fi[t.colorSpace];c=(t,i)=>e.reverse(e.interpolate(e.forward(t),e.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];const r=a.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return c(r,n,s)}}:c(a,l,s)}function Dr(t,e,i){return"color"===e.type?i=ye.parse(i):"formatted"===e.type?i=be.fromString(i.toString()):"resolvedImage"===e.type?i=we.fromString(i.toString()):Sr(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),Cr(i,t.default,e.default)}class Lr{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ue,this._defaultValue=e?function(t){return"color"===t.type&&(Ar(t.default)||Array.isArray(t.default))?new ye(0,0,0,0):"color"===t.type?ye.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,o,s,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o,s,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Ce("Expected value to be one of ".concat(Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", "),", but found ").concat(JSON.stringify(t)," instead."));return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Br(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xr}function Rr(t,e){const i=new di(xr,[],e?function(t){const e={color:re,string:ee,number:te,enum:ee,boolean:ie,formatted:ae,resolvedImage:le};return"array"===t.type?ce(e[t.value]||oe,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?vr(new Lr(r,e)):br(i.errors)}class Fr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!li(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}}class Or{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!li(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?Vi.interpolationFactor(this.interpolationType,t,e,i):0}}function Ur(t,e){if("error"===(t=Rr(t,e)).result)return t;const i=t.value.expression,r=ai(i);if(!r&&!wr(e))return br([new Kt("","data expressions not supported")]);const n=ci(i,["zoom","pitch","distance-from-center"]);if(!n&&!Tr(e))return br([new Kt("","zoom expressions not supported")]);const o=jr(i);return o||n?o instanceof Kt?br([o]):o instanceof Vi&&!Er(e)?br([new Kt("",'"interpolate" expressions cannot be used with this property')]):vr(o?new Or(r?"camera":"composite",t.value,o.labels,o instanceof Vi?o.interpolation:void 0):new Fr(r?"constant":"source",t.value)):br([new Kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vr{constructor(t,e){this._parameters=t,this._specification=e,Wt(this,Ir(this._parameters,this._specification))}static deserialize(t){return new Vr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function jr(t){let e=null;if(t instanceof Zi)e=jr(t.result);else if(t instanceof Ni){for(const i of t.args)if(e=jr(i),e)break}else(t instanceof gi||t instanceof Vi)&&t.input instanceof je&&"zoom"===t.input.name&&(e=t);return e instanceof Kt||t.eachChild((t=>{const i=jr(t);i instanceof Kt?e=i:!e&&i?e=new Kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Kt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}class Nr{constructor(t,e,i,r){this.message=(t?"".concat(t,": "):"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function Gr(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,s=t.styleSpec;let a=[];const l=Sr(i);if("object"!==l)return[new Nr(e,i,"object expected, ".concat(l," found"))];for(const c in i){const t=c.split(".")[0],l=r[t]||r["*"];let h;n[t]?h=n[t]:r[t]?h=Tn:n["*"]?h=n["*"]:r["*"]&&(h=Tn),h?a=a.concat(h({key:(e?"".concat(e,"."):e)+c,value:i[c],valueSpec:l,style:o,styleSpec:s,object:i,objectKey:c},i)):a.push(new Nr(e,i[c],'unknown property "'.concat(c,'"')))}for(const c in r)n[c]||r[c].required&&void 0===r[c].default&&void 0===i[c]&&a.push(new Nr(e,i,'missing required property "'.concat(c,'"')));return a}function Zr(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,o=t.key,s=t.arrayElementValidator||Tn;if("array"!==Sr(e))return[new Nr(o,e,"array expected, ".concat(Sr(e)," found"))];if(i.length&&e.length!==i.length)return[new Nr(o,e,"array length ".concat(i.length," expected, length ").concat(e.length," found"))];if(i["min-length"]&&e.length<i["min-length"])return[new Nr(o,e,"array length at least ".concat(i["min-length"]," expected, length ").concat(e.length," found"))];let a={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};n.$version<7&&(a.function=i.function),"object"===Sr(i.value)&&(a=i.value);let l=[];for(let c=0;c<e.length;c++)l=l.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:a,style:r,styleSpec:n,key:"".concat(o,"[").concat(c,"]")}));return l}function qr(t){const e=t.key,i=t.value,r=t.valueSpec;let n=Sr(i);if("number"===n&&i!=i&&(n="NaN"),"number"!==n)return[new Nr(e,i,"number expected, ".concat(n," found"))];if("minimum"in r){let n=r.minimum;if("array"===Sr(r.minimum)&&(n=r.minimum[t.arrayIndex]),i<n)return[new Nr(e,i,"".concat(i," is less than the minimum value ").concat(n))]}if("maximum"in r){let n=r.maximum;if("array"===Sr(r.maximum)&&(n=r.maximum[t.arrayIndex]),i>n)return[new Nr(e,i,"".concat(i," is greater than the maximum value ").concat(n))]}return[]}function Wr(t){const e=t.valueSpec,i=Xt(t.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===Sr(t.value.stops)&&"array"===Sr(t.value.stops[0])&&"object"===Sr(t.value.stops[0][0]),h=Gr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new Nr(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(Zr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===Sr(r)&&0===r.length&&e.push(new Nr(t.key,r,"array must have at least one stop")),e},default:function(t){return Tn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&h.push(new Nr(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new Nr(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!Er(t.valueSpec)&&h.push(new Nr(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!wr(t.valueSpec)?h.push(new Nr(t.key,t.value,"property functions not supported")):a&&!Tr(t.valueSpec)&&h.push(new Nr(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new Nr(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,a=t.key;if("array"!==Sr(r))return[new Nr(a,r,"array expected, ".concat(Sr(r)," found"))];if(2!==r.length)return[new Nr(a,r,"array length 2 expected, length ".concat(r.length," found"))];if(c){if("object"!==Sr(r[0]))return[new Nr(a,r,"object expected, ".concat(Sr(r[0])," found"))];if(void 0===r[0].zoom)return[new Nr(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new Nr(a,r,"object stop key must have value")];const e=Xt(r[0].zoom);if("number"!=typeof e)return[new Nr(a,r[0].zoom,"stop zoom values must be numbers")];if(o&&o>e)return[new Nr(a,r[0].zoom,"stop zoom values must appear in ascending order")];e!==o&&(o=e,n=void 0,s={}),i=i.concat(Gr({key:"".concat(a,"[0]"),value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:qr,value:p}}))}else i=i.concat(p({key:"".concat(a,"[0]"),value:r[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},r));return Br(Ht(r[1]))?i.concat([new Nr("".concat(a,"[1]"),r[1],"expressions are not allowed in function stops.")]):i.concat(Tn({key:"".concat(a,"[1]"),value:r[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const a=Sr(t.value),l=Xt(t.value),c=null!==t.value?t.value:o;if(r){if(a!==r)return[new Nr(t.key,c,"".concat(a," stop domain type must match previous stop domain type ").concat(r))]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new Nr(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r="number expected, ".concat(a," found");return wr(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new
1Nr(t.key,c,r)]}return"categorical"!==i||"number"!==a||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&"number"==typeof l&&"number"==typeof n&&void 0!==n&&l<n?[new Nr(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in s?[new Nr(t.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new Nr(t.key,c,"integer expected, found ".concat(String(l)))]}}function Xr(t){const e=("property"===t.expressionContext?Ur:Rr)(Ht(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new Nr("".concat(t.key).concat(e.key),t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new Nr(t.key,t.value,'Invalid data expression for "'.concat(t.propertyKey,'". Output values must be contained as literals within the expression.'))];if("property"===t.expressionContext&&"layout"===t.propertyType&&!li(i))return[new Nr(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return Hr(i,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ci(i,["zoom","feature-state"]))return[new Nr(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ai(i))return[new Nr(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hr(t,e){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(e.valueSpec&&e.valueSpec.expression)for(const n of e.valueSpec.expression.parameters)i.delete(n);if(0===i.size)return[];const r=[];return t instanceof je&&i.has(t.name)?[new Nr(e.key,e.value,'["'.concat(t.name,'"] expression is not supported in a filter for a ').concat(e.object.type," layer with id: ").concat(e.object.id))]:(t.eachChild((t=>{r.push(...Hr(t,e))})),r)}function Yr(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Xt(i))&&n.push(new Nr(e,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):-1===Object.keys(r.values).indexOf(Xt(i))&&n.push(new Nr(e,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function Kr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Kr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function Jr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill";if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Kr(t)||(t=on(t));const i=t;let r=!0;try{r=function(t){if(!tn(t))return t;let e=Ht(t);return $r(e),e=Qr(e),e}(i)}catch(t){console.warn("Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(i,null,2),"\n "))}const n=qt["filter_".concat(e)],o=Rr(r,n);let s=null;if("error"===o.result)throw new Error(o.value.map((t=>"".concat(t.key,": ").concat(t.message))).join(", "));s=(t,e,i)=>o.value.evaluate(t,e,{},i);let a=null,l=null;if(r!==i){const t=Rr(i,n);if("error"===t.result)throw new Error(t.value.map((t=>"".concat(t.key,": ").concat(t.message))).join(", "));a=(e,i,r,n,o)=>t.value.evaluate(e,i,{},r,void 0,void 0,n,o),l=!ai(t.value.expression)}return{filter:s,dynamicFilter:a||void 0,needGeometry:nn(r),needFeature:!!l}}function Qr(t){if(!Array.isArray(t))return t;const e=function(t){if(en.has(t[0]))for(let e=1;e<t.length;e++)if(tn(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Qr(t)))}function $r(t){let e=!1;const i=[];if("case"===t[0]){for(let r=1;r<t.length-1;r+=2)e=e||tn(t[r]),i.push(t[r+1]);i.push(t[t.length-1])}else if("match"===t[0]){e=e||tn(t[1]);for(let e=2;e<t.length-1;e+=2)i.push(t[e+1]);i.push(t[t.length-1])}else if("step"===t[0]){e=e||tn(t[1]);for(let e=1;e<t.length-1;e+=2)i.push(t[e+1])}e&&(t.length=0,t.push("any",...i));for(let r=1;r<t.length;r++)$r(t[r])}function tn(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;var e;
1for(let i=1;i<t.length;i++)if(tn(t[i]))return!0;return!1}const en=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function rn(t,e){return t<e?-1:t>e?1:0}function nn(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(nn(t[e]))return!0;return!1}function on(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?sn(t[1],t[2],"=="):"!="===e?cn(sn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?sn(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(on))):"all"===e?["all"].concat(t.slice(1).map(on)):"none"===e?["all"].concat(t.slice(1).map(on).map(cn)):"in"===e?an(t[1],t.slice(2)):"!in"===e?cn(an(t[1],t.slice(2))):"has"===e?ln(t[1]):"!has"===e?cn(ln(t[1])):"within"!==e||t;var i}function sn(t,e,i){switch(t){case"$type":return["filter-type-".concat(i),e];case"$id":return["filter-id-".concat(i),e];default:return["filter-".concat(i),t,e]}}function an(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(rn)]]:["filter-in-small",t,["literal",e]]}}function ln(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function cn(t){return["!",t]}function hn(t){return Kr(Ht(t.value))?Xr(Wt({},t,{expressionContext:"filter",valueSpec:t.styleSpec["filter_".concat(t.layerType||"fill")]})):un(t)}function un(t){const e=t.value,i=t.key;if("array"!==Sr(e))return[new Nr(i,e,"array expected, ".concat(Sr(e)," found"))];const r=t.styleSpec;let n,o=[];if(e.length<1)return[new Nr(i,e,"filter array must have at least 1 element")];switch(o=o.concat(Yr({key:"".concat(i,"[0]"),value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Xt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Xt(e[1])&&o.push(new Nr(i,e,'"$type" cannot be use with operator "'.concat(e[0],'"')));case"==":case"!=":3!==e.length&&o.push(new Nr(i,e,'filter array for operator "'.concat(e[0],'" must have 3 elements')));case"in":case"!in":e.length>=2&&(n=Sr(e[1]),"string"!==n&&o.push(new Nr("".concat(i,"[1]"),e[1],"string expected, ".concat(n," found"))));for(let s=2;s<e.length;s++)n=Sr(e[s]),"$type"===Xt(e[1])?o=o.concat(Yr({key:"".concat(i,"[").concat(s,"]"),value:e[s],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Nr("".concat(i,"[").concat(s,"]"),e[s],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)o=o.concat(un({key:"".concat(i,"[").concat(r,"]"),value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=Sr(e[1]),2!==e.length?o.push(new Nr(i,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):"string"!==n&&o.push(new Nr("".concat(i,"[1]"),e[1],"string expected, ".concat(n," found")));break;case"within":n=Sr(e[1]),2!==e.length?o.push(new Nr(i,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):"object"!==n&&o.push(new Nr("".concat(i,"[1]"),e[1],"object expected, ".concat(n," found")))}return o}function pn(t,e){const i=t.key,r=t.style,n=t.styleSpec,o=t.value,s=t.objectKey,a=n["".concat(e,"_").concat(t.layerType)];if(!a)return[];const l=s.match(/^(.*)-transition$/);if("paint"===e&&l&&a[l[1]]&&a[l[1]].transition)return Tn({key:i,value:o,valueSpec:n.transition,style:r,styleSpec:n});const c=t.valueSpec||a[s];if(!c)return[new Nr(i,o,'unknown property "'.concat(s,'"'))];let h;if("string"===Sr(o)&&wr(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(o)))return[new Nr(i,o,'"'.concat(s,'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ').concat(JSON.stringify(h[1])," }`."))];const u=[];return"symbol"===t.layerType&&("text-field"===s&&r&&!r.glyphs&&u.push(new Nr(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Ar(Ht(o))&&"identity"===Xt(o.type)&&u.push(new Nr(i,o,'"text-font" does not support identity functions'))),u.concat(Tn({key:t.key,value:o,valueSpec:c,style:r,styleSpec:n,expressionContext:"property",propertyType:e,propertyKey:s}))}function dn(t){return pn(t,"paint")}function fn(t){return pn(t,"layout")}function mn(t){let e=[];const i=t.value,r=t.key,n=t.style,o=t.styleSpec;i.type||i.ref||e.push(new Nr(r,i,'either "type" or "ref" is required'));let s=Xt(i.type);const a=Xt(i.ref);
1if(i.id){const o=Xt(i.id);for(let s=0;s<t.arrayIndex;s++){const t=n.layers[s];Xt(t.id)===o&&e.push(new Nr(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(t.id.__line__)))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new Nr(r,i[t],'"'.concat(t,'" is prohibited for ref layers')))})),n.layers.forEach((e=>{Xt(e.id)===a&&(t=e)})),t?t.ref?e.push(new Nr(r,i.ref,"ref cannot reference another ref layer")):s=Xt(t.type):"string"==typeof a&&e.push(new Nr(r,i.ref,'ref layer "'.concat(a,'" not found')))}else if("background"!==s&&"sky"!==s)if(i.source){const t=n.sources&&n.sources[i.source],o=t&&Xt(t.type);t?"vector"===o&&"raster"===s?e.push(new Nr(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):"raster"===o&&"raster"!==s?e.push(new Nr(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?e.push(new Nr(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===o&&t.lineMetrics||e.push(new Nr(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):e.push(new Nr(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):e.push(new Nr(r,i.source,'source "'.concat(i.source,'" not found')))}else e.push(new Nr(r,i,'missing required property "source"'));return e=e.concat(Gr({key:r,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Tn({key:"".concat(r,".type"),value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"}),filter:t=>hn(Wt({layerType:s},t)),layout:t=>Gr({layer:i,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>fn(Wt({layerType:s},t))}}),paint:t=>Gr({layer:i,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>dn(Wt({layerType:s},t))}})}})),e}function _n(t){const e=t.value,i=t.key,r=Sr(e);return"string"!==r?[new Nr(i,e,"string expected, ".concat(r," found"))]:[]}const gn={promoteId:function(t){let{key:e,value:i}=t;if("string"===Sr(i))return _n({key:e,value:i});{const t=[];for(const r in i)t.push(..._n({key:"".concat(e,".").concat(r),value:i[r]}));return t}}};function yn(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style;if(!e.type)return[new Nr(i,e,'"type" is required')];const o=Xt(e.type);let s;switch(o){case"vector":case"raster":case"raster-dem":return s=Gr({key:i,value:e,valueSpec:r["source_".concat(o.replace("-","_"))],style:t.style,styleSpec:r,objectElementValidators:gn}),s;case"geojson":if(s=Gr({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:gn}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],o="string"==typeof r?[r,["accumulated"],["get",t]]:r;s.push(...Xr({key:"".concat(i,".").concat(t,".map"),value:n,expressionContext:"cluster-map"})),s.push(...Xr({key:"".concat(i,".").concat(t,".reduce"),value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Gr({key:i,value:e,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return Gr({key:i,value:e,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new Nr(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yr({key:"".concat(i,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,styleSpec:r})}}function xn(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let o=[];const s=Sr(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new Nr("light",e,"object expected, ".concat(s," found"))]),o;for(const a in e){const t=a.match(/^(.*)-transition$/);o=o.concat(t&&r[t[1]]&&r[t[1]].transition?Tn({key:a,value:e[a],valueSpec:i.transition,style:n,styleSpec:i}):r[a]?Tn({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new Nr(a,e[a],'unknown property "'.concat(a,'"'))])}return o}function vn(t){const e=t.value,i=t.key,r=t.style,n=t.styleSpec,o=n.terrain;let s=[];const a=Sr(e);
1if(void 0===e)return s;if("object"!==a)return s=s.concat([new Nr("terrain",e,"object expected, ".concat(a," found"))]),s;for(const l in e){const t=l.match(/^(.*)-transition$/);s=s.concat(t&&o[t[1]]&&o[t[1]].transition?Tn({key:l,value:e[l],valueSpec:n.transition,style:r,styleSpec:n}):o[l]?Tn({key:l,value:e[l],valueSpec:o[l],style:r,styleSpec:n}):[new Nr(l,e[l],'unknown property "'.concat(l,'"'))])}if(e.source){const t=r.sources&&r.sources[e.source],n=t&&Xt(t.type);t?"raster-dem"!==n&&s.push(new Nr(i,e.source,"terrain cannot be used with a source of type ".concat(String(n),', it only be used with a "raster-dem" source type'))):s.push(new Nr(i,e.source,'source "'.concat(e.source,'" not found')))}else s.push(new Nr(i,e,'terrain is missing required property "source"'));return s}function bn(t){const e=t.value,i=t.style,r=t.styleSpec,n=r.fog;let o=[];const s=Sr(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new Nr("fog",e,"object expected, ".concat(s," found"))]),o;for(const a in e){const t=a.match(/^(.*)-transition$/);o=o.concat(t&&n[t[1]]&&n[t[1]].transition?Tn({key:a,value:e[a],valueSpec:r.transition,style:i,styleSpec:r}):n[a]?Tn({key:a,value:e[a],valueSpec:n[a],style:i,styleSpec:r}):[new Nr(a,e[a],'unknown property "'.concat(a,'"'))])}return o}const wn={"*":()=>[],array:Zr,boolean:function(t){const e=t.value,i=t.key,r=Sr(e);return"boolean"!==r?[new Nr(i,e,"boolean expected, ".concat(r," found"))]:[]},number:qr,color:function(t){const e=t.key,i=t.value,r=Sr(i);return"string"!==r?[new Nr(e,i,"color expected, ".concat(r," found"))]:null===_e.parseCSSColor(i)?[new Nr(e,i,'color expected, "'.concat(i,'" found'))]:[]},enum:Yr,filter:hn,function:Wr,layer:mn,object:Gr,source:yn,light:xn,terrain:vn,fog:bn,string:_n,formatted:function(t){return 0===_n(t).length?[]:Xr(t)},resolvedImage:function(t){return 0===_n(t).length?[]:Xr(t)},projection:function(t){const e=t.value,i=t.styleSpec,r=i.projection,n=t.style;let o=[];const s=Sr(e);if("object"===s)for(const a in e)o=o.concat(Tn({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}));else"string"!==s&&(o=o.concat([new Nr("projection",e,"object or string expected, ".concat(s," found"))]));return o}};function Tn(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return i.expression&&Ar(Xt(e))?Wr(t):i.expression&&Br(Ht(e))?Xr(t):i.type&&wn[i.type]?wn[i.type](t):Gr(Wt({},t,{valueSpec:i.type?r[i.type]:i}))}function En(t){const e=t.value,i=t.key,r=_n(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new Nr(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new Nr(i,e,'"glyphs" url must include a "{range}" token'))),r}function Sn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qt;return In(Tn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:En,"*":()=>[]}}))}const An=t=>In(dn(t)),Mn=t=>In(fn(t));function In(t){return t.slice().sort(((t,e)=>t.line&&e.line?t.line-e.line:0))}function Cn(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new Gt(new Error(r.message))),i=!0;return i}var zn=Pn;function Pn(t,e,i){var r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(var o=0;o<this.d*this.d;o++){var s=n[3+o],a=n[3+o+1];r.push(s===a?null:n.subarray(s,a))}var l=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var c=0;c<this.d*this.d;c++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var h=i/e*t;this.min=-h,this.max=t+h}Pn.prototype.insert=function(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},Pn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Pn.prototype._insertCell=function(t,e,i,r,n,o){this.cells[n].push(o)},Pn.prototype.query=function(t,e,i,r,n){var o=this.min,s=this.max;if(t<=o&&e<=o&&s<=i&&s<=r&&!n)return Array.prototype.slice.call(this.keys);var a=[];
vendor: 44,905 bytes, line 1
1return this._forEachCell(t,e,i,r,this._queryCell,a,{},n),a},Pn.prototype._queryCell=function(t,e,i,r,n,o,s,a){var l=this.cells[n];if(null!==l)for(var c=this.keys,h=this.bboxes,u=0;u<l.length;u++){var p=l[u];if(void 0===s[p]){var d=4*p;(a?a(h[d+0],h[d+1],h[d+2],h[d+3]):t<=h[d+2]&&e<=h[d+3]&&i>=h[d+0]&&r>=h[d+1])?(s[p]=!0,o.push(c[p])):s[p]=!1}}},Pn.prototype._forEachCell=function(t,e,i,r,n,o,s,a){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),p=l;p<=h;p++)for(var d=c;d<=u;d++){var f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&n.call(this,t,e,i,r,f,o,s,a))return}},Pn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Pn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Pn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,i=0,r=0;r<this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=e,s=0;s<t.length;s++){var a=t[s];n[3+s]=o,n.set(a,o),o+=a.length}return n[3+t.length]=o,n.set(this.keys,o),n[3+t.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer};const kn={};function Dn(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),kn[e]={klass:t,omit:i.omit||[]}}Dn(Object,"Object"),zn.serialize=function(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}},zn.deserialize=function(t){return new zn(t.buffer)},Object.defineProperty(zn,"name",{value:"Grid"}),Dn(zn,"Grid"),Dn(ye,"Color"),Dn(Error,"Error"),Dn(Ct,"AJAXError"),Dn(we,"ResolvedImage"),Dn(Vr,"StylePropertyFunction"),Dn(Lr,"StyleExpression",{omit:["_evaluator"]}),Dn(Or,"ZoomDependentExpression"),Dn(Fr,"ZoomConstantExpression"),Dn(je,"CompoundExpression",{omit:["_evaluate"]});for(const om in xr)kn[xr[om]._classRegistryKey]||Dn(xr[om],"Expression".concat(om));function Ln(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Bn(t){return e.ImageBitmap&&t instanceof e.ImageBitmap}function Rn(t,i){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(Ln(t)||Bn(t))return i&&i.push(t),t;if(ArrayBuffer.isView(t)){const e=t;return i&&i.push(e.buffer),e}if(t instanceof e.ImageData)return i&&i.push(t.data.buffer),t;if(Array.isArray(t)){const e=[];for(const r of t)e.push(Rn(r,i));return e}if("object"==typeof t){const e=t.constructor,r=e._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class ".concat(r));const n=e.serialize?e.serialize(t,i):{};if(!e.serialize){for(const e in t)t.hasOwnProperty(e)&&(kn[r].omit.indexOf(e)>=0||(n[e]=Rn(t[e],i)));t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof t)}function Fn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Ln(t)||Bn(t)||ArrayBuffer.isView(t)||t instanceof e.ImageData)return t;if(Array.isArray(t))return t.map(Fn);if("object"==typeof t){const e=t.$name||"Object",{klass:i}=kn[e];if(!i)throw new Error("can't deserialize unregistered class ".concat(e));if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const n of Object.keys(t))"$name"!==n&&(r[n]=Fn(t[n]));return r}throw new Error("can't deserialize object of type "+typeof t)}class On{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Un=t=>t>=1536&&t<=1791,Vn=t=>t>=1872&&t<=1919,jn=t=>t>=2208&&t<=2303,Nn=t=>t>=11904&&t<=12031,Gn=t=>t>=12032&&t<=12255,Zn=t=>t>=12272&&t<=12287,qn=t=>t>=12288&&t<=12351,Wn=t=>t>=12352&&t<=12447,Xn=t=>t>=12448&&t<=12543,Hn=t=>t>=12544&&t<=12591,Yn=t=>t>=12704&&t<=12735,Kn=t=>t>=12736&&t<=12783,Jn=t=>t>=12784&&t<=12799,Qn=t=>t>=12800&&t<=13055,$n=t=>t>=13056&&t<=13311,to=t=>t>=13312&&t<=19903,eo=t=>t>=19968&&t<=40959,io=t=>t>=40960&&t<=42127,ro=t=>t>=42128&&t<=42191,no=t=>t>=44032&&t<=55215,oo=t=>t>=63744&&t<=64255,so=t=>t>=64336&&t<=65023,ao=t=>t>=65040&&t<=65055,lo=t=>t>=65072&&t<=65103,co=t=>t>=65104&&t<=65135,ho=t=>t>=65136&&t<=65279,uo=t=>t>=65280&&t<=65519;function po(t){for(const e of t)if(_o(e.charCodeAt(0)))return!0;return!1}function fo(t){for(const e of t)if(!mo(e.charCodeAt(0)))return!1;return!0}function mo(t){return!(Un(t)||Vn(t)||jn(t)||so(t)||ho(t))}function _o(t){return!(746!==t&&747!==t&&(t<4352||!(Yn(t)||Hn(t)||lo(t)&&!(t>=65097&&t<=65103)||oo(t)||$n(t)||Nn(t)||Kn(t)||!(!qn(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||to(t)||eo(t)||Qn(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||no(t)||Wn(t)||Zn(t)||(t=>t>=12688&&t<=12703)(t)||Gn(t)||Jn(t)||Xn(t)&&12540!==t||!(!uo(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!co(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ao(t)||(t=>t>=19904&&t<=19967)(t)||io(t)||ro(t))))}function go(t){return!(_o(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||qn(t)||Xn(t)||(t=>t>=57344&&t<=63743)(t)||lo(t)||co(t)||uo(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function yo(t){return t>=1424&&t<=2303||so(t)||ho(t)}function xo(t,e){return!(!e&&yo(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||(t=>t>=6016&&t<=6143)(t))}function vo(t){for(const e of t)if(yo(e.charCodeAt(0)))return!0;return!1}const bo="deferred",wo="loading",To="loaded";let Eo=null,So="unavailable",Ao=null;const Mo=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(So="error"),Eo&&Eo(t)};function Io(){Co.fire(new Nt("pluginStateChange",{pluginStatus:So,pluginURL:Ao}))}const Co=new Zt,zo=function(){return So},Po=function(){if(So!==bo||!Ao)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");So=wo,Io(),Ao&&kt({url:Ao},(t=>{t?Mo(t):(So=To,Io())}))},ko={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>So===To||null!=ko.applyArabicShaping,isLoading:()=>So===wo,setState(t){So=t.pluginStatus,Ao=t.pluginURL},isParsed:()=>null!=ko.applyArabicShaping&&null!=ko.processBidirectionalText&&null!=ko.processStyledBidirectionalText,getPluginURL:()=>Ao};class Do{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition,this.pitch=e.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new On,this.transition={},this.pitch=0)}isSupportedScript(t){return function(t,e){for(const i of t)if(!xo(i.charCodeAt(0),e))return!1;return!0}(t,ko.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class Lo{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ar(t))return new Vr(t,e);if(Br(t)){const i=Ur(t,e);if("error"===i.result)throw new Error(i.value.map((t=>"".concat(t.key,": ").concat(t.message))).join(", "));return i.value}{let i=t;return"string"==typeof t&&"color"===e.type&&(i=ye.parse(t)),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class Bo{constructor(t){this.property=t,this.value=new Lo(t,void 0)}transitioned(t,e){return new Fo(this.property,this.value,e,x({},t.transition,this.transition),t.now)}untransitioned(){return new Fo(this.property,this.value,null,{},0)}}class Ro{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return C(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].value=new Lo(this._values[t].property,null===e?void 0:C(e))}getTransition(t){return C(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].transition=C(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t["".concat(e,"-transition")]=r)}return t}transitioned(t,e){const i=new Oo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new Oo(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Fo{constructor(t,e,i,r,n){const o=r.delay||0,s=r.duration||0;n=n||0,this.property=t,this.value=e,this.begin=n+o,this.end=this.begin+s,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);{const s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,u(s))}}return n}}class Oo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new jo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Uo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return C(this._values[t].value)}setValue(t,e){this._values[t]=new Lo(this._values[t].property,null===e?void 0:C(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new jo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class Vo{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class jo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class No{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,i){const r=vi[this.specification.type];return r?r(t,e,i):t}}class Go{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new Vo(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Vo(this,{kind:"constant",value:void 0},t.parameters);const r=vi[this.specification.type];return r?new Vo(this,{kind:"constant",value:r(t.value.value,e.value.value,i)},t.parameters):t}evaluate(t,e,i,r,n,o){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,o)}}class Zo extends Go{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new Vo(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,s=this._calculate(o,o,o,e);return new Vo(this,{kind:"constant",value:s},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Vo(this,{kind:"constant",value:i},e)}return new Vo(this,t.expression,e)}evaluate(t,e,i,r,n,o){if("source"===t.kind){const s=t.evaluate(e,i,r,n,o);return this._calculate(s,s,s,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e,other:i}:{from:i,to:e,other:t}}interpolate(t){return t}}class qo{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Do(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Do(Math.floor(e.zoom),e)),t.expression.evaluate(new Do(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Wo{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class Xo{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const e=new Do(0,{});for(const i in t){const r=t[i];r.specification.overridable&&this.overridableProperties.push(i);const n=this.defaultPropertyValues[i]=new Lo(r,void 0),o=this.defaultTransitionablePropertyValues[i]=new Bo(r);this.defaultTransitioningPropertyValues[i]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=n.possiblyEvaluate(e)}}}function Ho(t,e){return 256*(t=f(Math.floor(t),0,255))+f(Math.floor(e),0,255)}Dn(Go,"DataDrivenProperty"),Dn(No,"DataConstantProperty"),Dn(Zo,"CrossFadedDataDrivenProperty"),Dn(qo,"CrossFadedProperty"),Dn(Wo,"ColorRampProperty");const Yo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ko{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Jo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=0,r=0;return{members:t.map((t=>{const n=Yo[t.type].BYTES_PER_ELEMENT,o=i=$o(i,Math.max(e,n)),s=t.components||1;return r=Math.max(r,n),i+=n*s,{name:t.name,type:t.type,components:s,offset:o}})),size:$o(i,Math.max(r,e)),alignment:e}}function $o(t,e){return Math.ceil(t/e)*e}class ts extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}ts.prototype.bytesPerElement=4,Dn(ts,"StructArrayLayout2i4");class es extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}es.prototype.bytesPerElement=6,Dn(es,"StructArrayLayout3i6");class is extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}is.prototype.bytesPerElement=8,Dn(is,"StructArrayLayout4i8");class rs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o,s)}emplace(t,e,i,r,n,o,s,a){const l=6*t,c=12*t,h=3*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[h+2]=a,t}}rs.prototype.bytesPerElement=12,Dn(rs,"StructArrayLayout2i4ub1f12");class ns extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}ns.prototype.bytesPerElement=16,Dn(ns,"StructArrayLayout4f16");class os extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,o,s,a,l,c)}emplace(t,e,i,r,n,o,s,a,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=o,this.uint16[u+5]=s,this.uint16[u+6]=a,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}os.prototype.bytesPerElement=20,Dn(os,"StructArrayLayout10ui20");class ss extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,n,o,s,a)}emplace(t,e,i,r,n,o,s,a,l){const c=8*t;return this.uint16[c+0]=e,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=o,this.uint16[c+5]=s,this.uint16[c+6]=a,this.uint16[c+7]=l,t}}ss.prototype.bytesPerElement=16,Dn(ss,"StructArrayLayout8ui16");class as extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,t}}as.prototype.bytesPerElement=12,Dn(as,"StructArrayLayout6i12");class ls extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,s,a,l,c,h,u)}emplace(t,e,i,r,n,o,s,a,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=s,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}ls.prototype.bytesPerElement=24,Dn(ls,"StructArrayLayout4i4ui4i24");class cs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){const a=10*t,l=5*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,t}}cs.prototype.bytesPerElement=20,Dn(cs,"StructArrayLayout3i3f20");class hs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}hs.prototype.bytesPerElement=4,Dn(hs,"StructArrayLayout1ul4");class us extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,l,c,h,u,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,i,r,n,o,s,a,l,c,h,u,p)}emplace(t,e,i,r,n,o,s,a,l,c,h,u,p,d){const f=20*t,m=10*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=s,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=h,this.uint32[m+8]=u,this.uint16[f+18]=p,this.uint16[f+19]=d,t}}us.prototype.bytesPerElement=40,Dn(us,"StructArrayLayout5i4f1i1ul2ui40");class ps extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o,s)}emplace(t,e,i,r,n,o,s,a){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,t}}ps.prototype.bytesPerElement=16,Dn(ps,"StructArrayLayout3i2i2i16");class ds extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){const s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,t}}ds.prototype.bytesPerElement=16,Dn(ds,"StructArrayLayout2f1f2i16");class fs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=12*t,s=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[s+1]=r,this.float32[s+2]=n,t}}fs.prototype.bytesPerElement=12,Dn(fs,"StructArrayLayout2ub2f12");class ms extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}ms.prototype.bytesPerElement=12,Dn(ms,"StructArrayLayout3f12");class _s extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}_s.prototype.bytesPerElement=6,Dn(_s,"StructArrayLayout3ui6");class gs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v){const b=this.length;return this.resize(b+1),this.emplace(b,t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v)}emplace(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v,b){const w=30*t,T=15*t,E=60*t;return this.int16[w+0]=e,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[T+2]=n,this.float32[T+3]=o,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[T+5]=l,this.uint32[T+6]=c,this.uint32[T+7]=h,this.uint16[w+16]=u,this.uint16[w+17]=p,this.uint16[w+18]=d,this.float32[T+10]=f,this.float32[T+11]=m,this.uint8[E+48]=_,this.uint8[E+49]=g,this.uint8[E+50]=y,this.uint32[T+13]=x,this.int16[w+28]=v,this.uint8[E+58]=b,t}}gs.prototype.bytesPerElement=60,Dn(gs,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ys extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v,b,w,T,E,S,A,M,I,C){const z=this.length;return this.resize(z+1),this.emplace(z,t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v,b,w,T,E,S,A,M,I,C)}emplace(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v,b,w,T,E,S,A,M,I,C,z){const P=38*t,k=19*t;return this.int16[P+0]=e,this.int16[P+1]=i,this.int16[P+2]=r,this.float32[k+2]=n,this.float32[k+3]=o,this.int16[P+8]=s,this.int16[P+9]=a,this.int16[P+10]=l,this.int16[P+11]=c,this.int16[P+12]=h,this.int16[P+13]=u,this.uint16[P+14]=p,this.uint16[P+15]=d,this.uint16[P+16]=f,this.uint16[P+17]=m,this.uint16[P+18]=_,this.uint16[P+19]=g,this.uint16[P+20]=y,this.uint16[P+21]=x,this.uint16[P+22]=v,this.uint16[P+23]=b,this.uint16[P+24]=w,this.uint16[P+25]=T,this.uint16[P+26]=E,this.uint16[P+27]=S,this.uint16[P+28]=A,this.uint32[k+15]=M,this.float32[k+16]=I,this.float32[k+17]=C,this.float32[k+18]=z,t}}ys.prototype.bytesPerElement=76,Dn(ys,"StructArrayLayout3i2f6i15ui1ul3f76");class xs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}xs.prototype.bytesPerElement=4,Dn(xs,"StructArrayLayout1f4");class vs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){const s=5*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,t}}vs.prototype.bytesPerElement=20,Dn(vs,"StructArrayLayout5f20");class bs extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=6*t;return this.uint32[3*t+0]=e,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,t}}bs.prototype.bytesPerElement=12,Dn(bs,"StructArrayLayout1ul3ui12");class ws extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}ws.prototype.bytesPerElement=4,Dn(ws,"StructArrayLayout2ui4");class Ts extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ts.prototype.bytesPerElement=2,Dn(Ts,"StructArrayLayout1ui2");class Es extends Jo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Es.prototype.bytesPerElement=8,Dn(Es,"StructArrayLayout2f8");class Ss extends Ko{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}Ss.prototype.size=12;class As extends as{get(t){return new Ss(this,t)}}Dn(As,"FillExtrusionExtArray");class Ms extends Ko{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]}}Ms.prototype.size=40;class Is extends us{get(t){return new Ms(this,t)}}Dn(Is,"CollisionBoxArray");class Cs extends Ko{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}Cs.prototype.size=60;class zs extends gs{get(t){return new Cs(this,t)}}Dn(zs,"PlacedSymbolArray");class Ps extends Ko{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 rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(t){this._structArray.uint32[this._pos4+15]=t}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}Ps.prototype.size=76;class ks extends ys{get(t){return new Ps(this,t)}}Dn(ks,"SymbolInstanceArray");class Ds extends xs{getoffsetX(t){return this.float32[1*t+0]}}Dn(Ds,"GlyphOffsetArray");class Ls extends es{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Dn(Ls,"SymbolLineVertexArray");class Bs extends Ko{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]}}Bs.prototype.size=12;class Rs extends bs{get(t){return new Bs(this,t)}}Dn(Rs,"FeatureIndexArray");class Fs extends Ko{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}Fs.prototype.size=4;class Os extends ws{get(t){return new Fs(this,t)}}Dn(Os,"FillExtrusionCentroidArray");class Us extends Ko{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}Us.prototype.size=12;class Vs extends as{get(t){return new Us(this,t)}}Dn(Vs,"CircleGlobeExtArray");const js=Qo([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),Ns=Qo([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var Gs=me((function(t){t.exports=function(t,e){var i,r,n,o,s,a,l,c;for(r=t.length-(i=3&t.length),n=e,s=3432918353,a=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=t.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}})),Zs=me((function(t){t.exports=function(t,e){for(var i,r=t.length,n=e^r,o=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}})),qs=Gs,Ws=Zs;qs.murmur3=Gs,qs.murmur2=Ws;class Xs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(Hs(t)),this.positions.push(e,i,r)}getPositions(t){const e=Hs(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Ys(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new Xs;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Hs(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:qs(String(t))}function Ys(t,e,i,r){for(;i<r;){const n=t[i+r>>1];let o=i-1,s=r+1;for(;;){do{o++}while(t[o]<n);do{s--}while(t[s]>n);if(o>=s)break;Ks(t,o,s),Ks(e,3*o,3*s),Ks(e,3*o+1,3*s+1),Ks(e,3*o+2,3*s+2)}s-i<r-s?(Ys(t,e,i,s),i=s+1):(Ys(t,e,s+1,r),r=s)}}function Ks(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}Dn(Xs,"FeaturePositionMap");class Js{constructor(t){this.gl=t.gl,this.initialized=!1}fetchUniformLocation(t,e){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,e),this.initialized=!0),!!this.location}}class Qs extends Js{constructor(t){super(t),this.current=0}set(t,e,i){this.fetchUniformLocation(t,e)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class $s extends Js{constructor(t){super(t),this.current=[0,0,0,0]}set(t,e,i){this.fetchUniformLocation(t,e)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}class ta extends Js{constructor(t){super(t),this.current=ye.transparent}set(t,e,i){this.fetchUniformLocation(t,e)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}const ea=new Float32Array(16),ia=new Float32Array(9),ra=new Float32Array(4);function na(t){return[Ho(255*t.r,255*t.g),Ho(255*t.b,255*t.a)]}class oa{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>"u_".concat(t))),this.type=i}setUniform(t,e,i,r,n){e.set(t,n,r.constantOr(this.value))}getBinding(t,e){return"color"===this.type?new ta(t):new Qs(t)}}class sa{constructor(t,e){this.uniformNames=e.map((t=>"u_".concat(t))),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio||1,this.pixelRatioTo=t.pixelRatio||1,this.patternFrom=e.tl.concat(e.br),this.patternTo=t.tl.concat(t.br)}setUniform(t,e,i,r,n){const o="u_pattern_to"===n||"u_dash_to"===n?this.patternTo:"u_pattern_from"===n||"u_dash_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;o&&e.set(t,n,o)}getBinding(t,e){return"u_pattern_from"===e||"u_pattern_to"===e||"u_dash_from"===e||"u_dash_to"===e?new $s(t):new Qs(t)}}class aa{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:"a_".concat(t),type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n,o){const s=this.paintVertexArray.length,a=this.expression.evaluate(new Do(0),e,{},n,r,o);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a)}updatePaintArray(t,e,i,r,n){const o=this.expression.evaluate({zoom:0},i,r,void 0,n);this._setPaintValue(t,e,o)}_setPaintValue(t,e,i){if("color"===this.type){const r=na(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class la{constructor(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((t=>"u_".concat(t,"_t"))),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:"a_".concat(t),type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,r,n,o){const s=this.expression.evaluate(new Do(this.zoom),e,{},n,r,o),a=this.expression.evaluate(new Do(this.zoom+1),e,{},n,r,o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,s,a)}updatePaintArray(t,e,i,r,n){const o=this.expression.evaluate({zoom:this.zoom},i,r,void 0,n),s=this.expression.evaluate({zoom:this.zoom+1},i,r,void 0,n);this._setPaintValue(t,e,o,s)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=na(i),o=na(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e,i,r,n){const o=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,s=f(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(t,n,s)}getBinding(t,e){return new Qs(t)}}class ca{constructor(t,e,i,r,n,o,s){this.expression=t,this.type=i,this.useIntegerZoom=r,this.zoom=n,this.layerId=s,this.paintVertexAttributes=("array"===i?Ns:js).members;for(let a=0;a<e.length;++a);this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,n,o){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:n,mid:o,max:s}
1=i,a=r[n],l=r[o],c=r[s];if(a&&l&&c)for(let h=t;h<e;h++)this._setPaintValue(this.zoomInPaintVertexArray,h,l,a),this._setPaintValue(this.zoomOutPaintVertexArray,h,l,c)}_setPaintValue(t,e,i,r){t.emplace(e,i.tl[0],i.tl[1],i.br[0],i.br[1],r.tl[0],r.tl[1],r.br[0],r.br[1],i.pixelRatio,r.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ha{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;this.binders={},this._buffers=[];const r=[];for(const n in t.paint._values){if(!i(n))continue;const o=t.paint.get(n);if(!(o instanceof Vo&&wr(o.property.specification)))continue;const s=da(n,t.type),a=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h,p="line-dasharray"===String(n)&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==a.kind||p)if("source"===a.kind||p||u){const i=_a(n,l,"source");this.binders[n]=u?new ca(a,s,l,c,e,i,t.id):new aa(a,s,l,i),r.push("/a_".concat(n))}else{const t=_a(n,l,"composite");this.binders[n]=new la(a,s,l,c,e,t),r.push("/z_".concat(n))}else this.binders[n]=u?new sa(a.value,s):new oa(a.value,s,l),r.push("/u_".concat(n))}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof aa||e instanceof la?e.maxValue:0}populatePaintArrays(t,e,i,r,n,o){for(const s in this.binders){const a=this.binders[s];(a instanceof aa||a instanceof la||a instanceof ca)&&a.populatePaintArray(t,e,i,r,n,o)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof sa&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,n,o){let s=!1;for(const a in t){const l=e.getPositions(a);for(const e of l){const l=i.feature(e.index);for(const i in this.binders){const c=this.binders[i];if((c instanceof aa||c instanceof la||c instanceof ca)&&!0===c.expression.isStateDependent){const h=r.paint.get(i);c.expression=h.value,c.updatePaintArray(e.start,e.end,l,t[a],n,o),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof oa||i instanceof sa)&&t.push(...i.uniformNames.map((t=>"#define HAS_UNIFORM_".concat(t))))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof aa||i instanceof la||i instanceof ca)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof oa||i instanceof sa||i instanceof la)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof oa||r instanceof sa||r instanceof la)for(const n of r.uniformNames)e.push({name:n,property:i,binding:r.getBinding(t,n)})}return e}setUniforms(t,e,i,r,n){for(const{name:o,property:s,binding:a}of i)this.binders[s].setUniform(t,a,n,r.get(s),o)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof ca){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof aa||i instanceof la)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof aa||i instanceof la||i instanceof ca)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof aa||e instanceof la||e instanceof ca)&&e.destroy()}}}class ua{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new ha(r,e,i);this.needsUpload=!1,this._featureMap=new Xs,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,o,s){for(const a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,r,n,o,s);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r,n){for(const o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,e,o,r,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const pa={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
1pwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"line-dasharray":["dash_to","dash_from"]};function da(t,e){return pa[t]||[t.replace("".concat(e,"-"),"").replace(/-/g,"_")]}const fa={"line-pattern":{source:os,composite:os},"fill-pattern":{source:os,composite:os},"fill-extrusion-pattern":{source:os,composite:os},"line-dasharray":{source:ss,composite:ss}},ma={color:{source:Es,composite:ns},number:{source:xs,composite:Es}};function _a(t,e,i){const r=fa[t];return r&&r[i]||ma[e][i]}Dn(oa,"ConstantBinder"),Dn(sa,"CrossFadedConstantBinder"),Dn(aa,"SourceExpressionBinder"),Dn(ca,"CrossFadedCompositeBinder"),Dn(la,"CompositeExpressionBinder"),Dn(ha,"ProgramConfiguration",{omit:["_buffers"]}),Dn(ua,"ProgramConfigurationSet");const ga="-transition";class ya extends Zt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&"sky"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Uo(e.layout)),e.paint)){this._transitionablePaint=new Ro(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new jo(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!=e&&this._validate(Mn,"layers.".concat(this.id,".layout.").concat(t),t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return A(t,ga)?this._transitionablePaint.getTransition(t.slice(0,-ga.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=e&&this._validate(An,"layers.".concat(this.id,".paint.").concat(t),t,e,i))return!1;if(A(t,ga))return this._transitionablePaint.setTransition(t.slice(0,-ga.length),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,o,s)}}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getProgramConfiguration(t){return null}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}
1serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),I(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!n||!1!==n.validate)&&Cn(this,t.call(Sn,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:qt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Vo&&wr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=Jr(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const xa=Qo([{name:"a_pos",components:2,type:"Int16"}],4),va=Qo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ba{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>ba.MAX_VERTEX_ARRAY_LENGTH&&P("Max vertices per segment is ".concat(ba.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!n||n.vertexLength+t>ba.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new ba([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}ba.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Dn(ba,"SegmentVector");var wa=8192;class Ta{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof Sa?new Sa(t.lng,t.lat):Sa.convert(t),this}setSouthWest(t){return this._sw=t instanceof Sa?new Sa(t.lng,t.lat):Sa.convert(t),this}extend(t){const e=this._sw,i=this._ne;let r,n;if(t instanceof Sa)r=t,n=t;else{if(!(t instanceof Ta))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Ta.convert(t)):this.extend(Sa.convert(t)):this;if(r=t._sw,n=t._ne,!r||!n)return this}return e||i?(e.lng=Math.min(r.lng,e.lng),e.lat=Math.min(r.lat,e.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new Sa(r.lng,r.lat),this._ne=new Sa(n.lng,n.lat)),this}getCenter(){return new Sa((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 Sa(this.getWest(),this.getNorth())}getSouthEast(){return new Sa(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:e,lat:i}=Sa.convert(t);let r=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(t){return!t||t instanceof Ta?t:new Ta(t)}}const Ea=6371008.8;class Sa{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(e,")"));if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Sa(_(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Ea*Math.acos(Math.min(n,1))}toBounds(){const t=360*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/40075017,e=t/Math.cos(Math.PI/180*this.lat);return new Ta(new Sa(this.lng-e,this.lat-t),new Sa(this.lng+e,this.lat+t))}static convert(t){if(t instanceof Sa)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Sa(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Sa(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Aa=2*Math.PI*Ea;function Ma(t){return Aa*Math.cos(t*Math.PI/180)}function Ia(t){return(180+t)/360}function Ca(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function za(t,e){return t/Ma(e)}function Pa(t){return 360*t-180}function ka(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180)
vendor: 22,795 bytes, line 1
1)-90}function Da(t,e){return t*Ma(ka(e))}const La=85.051129;function Ba(t){return 1/Math.cos(t*Math.PI/180)}class Ra{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Sa.convert(t);return new Ra(Ia(i.lng),Ca(i.lat),za(e,i.lat))}toLngLat(){return new Sa(Pa(this.x),ka(this.y))}toAltitude(){return Da(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Aa*Ba(ka(this.y))}}function Fa(t,e,i,r,o,s,a,l,c){const h=(e+r)/2,u=(i+o)/2,p=new n(h,u);l(p),function(t,e,i,r,n,o){const s=i-n,a=r-o;return Math.abs((r-e)*s-(i-t)*a)/Math.hypot(s,a)}(p.x,p.y,s.x,s.y,a.x,a.y)>=c?(Fa(t,e,i,h,u,s,p,l,c),Fa(t,h,u,r,o,p,a,l,c)):t.push(a)}function Oa(t,e,i){let r=t[0],n=r.x,o=r.y;e(r);const s=[r];for(let a=1;a<t.length;a++){const l=t[a],{x:c,y:h}=l;e(l),Fa(s,n,o,c,h,r,l,e,i),n=c,o=h,r=l}return s}function Ua(t,e,i,r,n){if(n(e,i)){const o=e.add(i).mult(.5);r(o),Ua(t,e,o,r,n),Ua(t,o,i,r,n)}else t.push(i)}function Va(t,e,i){let r=t[0];e(r);const n=[r];for(let o=1;o<t.length;o++){const s=t[o];e(s),Ua(n,r,s,e,i),r=s}return n}const ja=Math.pow(2,14)-1,Na=-ja-1;function Ga(t,e){const i=Math.round(t.x*e),r=Math.round(t.y*e);return t.x=f(i,Na,ja),t.y=f(r,Na,ja),(i<t.x||i>t.x+1||r<t.y||r>t.y+1)&&P("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Za(t,e,i){const r=t.loadGeometry(),n=t.extent,o=wa/n;if(e&&i&&i.projection.isReprojectedInTileSpace){const o=1<<e.z,{scale:s,x:a,y:l,projection:c}=i,h=t=>{const i=Pa((e.x+t.x/n)/o),r=ka((e.y+t.y/n)/o),h=c.project(i,r);t.x=(h.x*s-a)*n,t.y=(h.y*s-l)*n};for(let e=0;e<r.length;e++)if(1!==t.type)r[e]=Oa(r[e],h,1);else{const t=[];for(const i of r[e])i.x<0||i.x>=n||i.y<0||i.y>=n||(h(i),t.push(i));r[e]=t}}for(const s of r)for(const t of s)Ga(t,o);return r}function qa(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Za(t):[]}}function Wa(t,e,i,r,n){t.emplaceBack(2*e+(r+1)/2,2*i+(n+1)/2)}function Xa(t,e,i){const r=16384;t.emplaceBack(e.x,e.y,e.z,i[0]*r,i[1]*r,i[2]*r)}class Ha{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new ts,this.indexArray=new _s,this.segments=new ba,this.programConfigurations=new ua(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i,r){const n=this.layers[0],o=[];let s=null;"circle"===n.type&&(s=n.layout.get("circle-sort-key"));for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,e=qa(l,t);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),e,i))continue;const n=s?s.evaluate(e,{},i):void 0,a={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:t?e.geometry:Za(l,i,r),patterns:{},sortKey:n};o.push(a)}s&&o.sort(((t,e)=>t.sortKey-e.sortKey));let a=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Vs,a=r.projection);for(const l of o){const{geometry:r,index:n,sourceLayerIndex:o}=l,s=t[n].feature;this.addFeature(l,r,n,e.availableImages,i,a),e.featureIndex.insert(s,r,n,o,this.index)}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,xa.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,va.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(t,e,i,r,n,o){for(const s of e)for(const e of s){const i=e.x,r=e.y;if(i<0||i>=wa||r<0||r>=wa)continue;if(o){const t=o.projectTilePoint(i,r,n),e=o.upVector(n,i,r),s=this.globeExtVertexArray;Xa(s,t,e),Xa(s,t,e),Xa(s,t,e),Xa(s,t,e)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),a=s.vertexLength;Wa(this.layoutVertexArray,i,r,-1,-1),Wa(this.layoutVertexArray,i,r,1,-1),Wa(this.layoutVertexArray,i,r,1,1),Wa(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r,n)}}function Ya(t,e){for(let i=0;i<t.length;i++)if(nl(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(nl(t,e[i]))return!0;return!!$a(t,e)}function Ka(t,e,i){return!!nl(t,e)||!!el(e,t,i)}function Ja(t,e){if(1===t.length)return rl(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(nl(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(rl(e,t[i]))return!0;for(let i=0;i<e.length;i++)if($a(t,e[i]))return!0;return!1}function Qa(t,e,i){if(t.length>1){if($a(t,e))return!0;for(let r=0;r<e.length;r++)if(el(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(el(t[r],e,i))return!0;return!1}function $a(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(tl(r,n,e[t],e[t+1]))return!0}return!1}function tl(t,e,i,r){return k(t,i,r)!==k(e,i,r)&&k(t,e,i)!==k(t,e,r)}function el(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(il(t,e[n-1],e[n])<r)return!0;return!1}function il(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function rl(t,e){let i,r,n,o=!1;for(let s=0;s<t.length;s++){i=t[s];for(let t=0,s=i.length-1;t<i.length;s=t++)r=i[t],n=i[s],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function nl(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const o=t[r],s=t[n];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function ol(t,e,i,r,o){for(const n of t)if(e<=n.x&&i<=n.y&&r>=n.x&&o>=n.y)return!0;const s=[new n(e,i),new n(e,o),new n(r,o),new n(r,i)];if(t.length>2)for(const n of s)if(nl(t,n))return!0;for(let n=0;n<t.length-1;n++)if(sl(t[n],t[n+1],s))return!0;return!1}function sl(t,e,i){const r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;const o=k(t,e,i[0]);return o!==k(t,e,i[1])||o!==k(t,e,i[2])||o!==k(t,e,i[3])}function al(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ll(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function cl(t,e,i,r,o){if(!e[0]&&!e[1])return t;const s=n.convert(e)._mult(o);"viewport"===i&&s._rotate(-r);const a=[];for(let n=0;n<t.length;n++)a.push(t[n].sub(s));return a}function hl(t,e,i,r){const o=n.convert(t)._mult(r);return"viewport"===e&&o._rotate(-i),o}Dn(Ha,"CircleBucket",{omit:["layers"]});const ul=new Xo({"circle-sort-key":new Go(qt.layout_circle["circle-sort-key"])});var pl={paint:new Xo({"circle-radius":new Go(qt.paint_circle["circle-radius"]),"circle-color":new Go(qt.paint_circle["circle-color"]),"circle-blur":new Go(qt.paint_circle["circle-blur"]),"circle-opacity":new Go(qt.paint_circle["circle-opacity"]),"circle-translate":new No(qt.paint_circle["circle-translate"]),"circle-translate-anchor":new No(qt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new No(qt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new No(qt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Go(qt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Go(qt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Go(qt.paint_circle["circle-stroke-opacity"])}),layout:ul},dl=1e-6,fl="undefined"!=typeof Float32Array?Float32Array:Array;function ml(){var t=new fl(9);return fl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function _l(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function gl(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],f=e[12],m=e[13],_=e[14],g=e[15],y=i*a-r*s,x=i*l-n*s,v=i*c-o*s,b=r*l-n*a,w=r*c-o*a,T=n*c-o*l,E=h*m-u*f,S=h*_-p*f,A=h*g-d*f,M=u*_-p*m,I=u*g-d*m,C=p*g-d*_,z=y*C-x*I+v*M+b*A-w*S+T*E;return z?(t[0]=(a*C-l*I+c*M)*(z=1/z),t[1]=(n*I-r*C-o*M)*z,t[2]=(m*T-_*w+g*b)*z,t[3]=(p*w-u*T-d*b)*z,t[4]=(l*A-s*C-c*S)*z,t[5]=(i*C-n*A+o*S)*z,t[6]=(_*v-f*T-g*x)*z,t[7]=(h*T-p*v+d*x)*z,t[8]=(s*I-a*A+c*E)*z,t[9]=(r*A-i*I-o*E)*z,t[10]=(f*w-m*v+g*y)*z,t[11]=(u*v-h*w-d*y)*z,t[12]=(a*S-s*M-l*E)*z,t[13]=(i*M-r*S+n*E)*z,t[14]=(m*x-f*b-_*y)*z,t[15]=(h*b-u*x+p*y)*z,t):null}function yl(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=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];return t[0]=x*r+v*a+b*u+w*m,t[1]=x*n+v*l+b*p+w*_,t[2]=x*o+v*c+b*d+w*g,t[3]=x*s+v*h+b*f+w*y,t[4]=(x=i[4])*r+(v=i[5])*a+(b=i[6])*u+(w=i[7])*m,t[5]=x*n+v*l+b*p+w*_,t[6]=x*o+v*c+b*d+w*g,t[7]=x*s+v*h+b*f+w*y,t[8]=(x=i[8])*r+(v=i[9])*a+(b=i[10])*u+(w=i[11])*m,t[9]=x*n+v*l+b*p+w*_,t[10]=x*o+v*c+b*d+w*g,t[11]=x*s+v*h+b*f+w*y,t[12]=(x=i[12])*r+(v=i[13])*a+(b=i[14])*u+(w=i[15])*m,t[13]=x*n+v*l+b*p+w*_,t[14]=x*o+v*c+b*d+w*g,t[15]=x*s+v*h+b*f+w*y,t}function xl(t,e,i){var r,n,o,s,a,l,c,h,u,p,d,f,m=i[0],_=i[1],g=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*g+e[12],t[13]=e[1]*m+e[5]*_+e[9]*g+e[13],t[14]=e[2]*m+e[6]*_+e[10]*g+e[14],t[15]=e[3]*m+e[7]*_+e[11]*g+e[15]):(n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+a*_+u*g+e[12],t[13]=n*m+l*_+p*g+e[13],t[14]=o*m+c*_+d*g+e[14],t[15]=s*m+h*_+f*g+e[15]),t}function vl(t,e,i){var r=i[0],n=i[1],o=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function bl(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*r,t[5]=s*n+h*r,t[6]=a*n+u*r,t[7]=l*n+p*r,t[8]=c*n-o*r,t[9]=h*n-s*r,t[10]=u*n-a*r,t[11]=p*n-l*r,t}function wl(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-c*r,t[1]=s*n-h*r,t[2]=a*n-u*r,t[3]=l*n-p*r,t[8]=o*r+c*n,t[9]=s*r+h*n,t[10]=a*r+u*n,t[11]=l*r+p*n,t}function Tl(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function El(t,e,i){var r,n,o,s=i[0],a=i[1],l=i[2],c=Math.hypot(s,a,l);return c<dl?null:(s*=c=1/c,a*=c,l*=c,r=Math.sin(e),n=Math.cos(e),t[0]=s*s*(o=1-n)+n,t[1]=a*s*o+l*r,t[2]=l*s*o-a*r,t[3]=0,t[4]=s*a*o-l*r,t[5]=a*a*o+n,t[6]=l*a*o+s*r,t[7]=0,t[8]=s*l*o+a*r,t[9]=a*l*o-s*r,t[10]=l*l*o+n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Sl=yl;function Al(){var t=new fl(3);return fl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Ml(t){var e=new fl(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Il(t){return Math.hypot(t[0],t[1],t[2])}function Cl(t,e,i){var r=new fl(3);return r[0]=t,r[1]=e,r[2]=i,r}function zl(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Pl(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function kl(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function Dl(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t}function Ll(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t}function Bl(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Rl(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t}function Fl(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Ol(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ul(t,e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],l=i[2];return t[0]=n*l-o*a,t[1]=o*s-r*l,t[2]=r*a-n*s,t}function Vl(t,e,i){var r=e[0],n=e[1],o=e[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return t[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(s=s||1),t[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,t[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,t}function jl(t,e,i){var r=i[0],n=i[1],o=i[2],s=e[0],a=e[1],l=e[2],c=n*l-o*a,h=o*s-r*l,u=r*a-n*s,p=n*u-o*h,d=o*c-r*u,f=r*h-n*c,m=2*i[3];return h*=m,u*=m,d*=2,f*=2,t[0]=s+(c*=m)+(p*=2),t[1]=a+h+d,t[2]=l+u+f,t}var Nl,Gl=Pl,Zl=kl,ql=Il;function Wl(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}function Xl(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,t}function Hl(){var t=new fl(4);return fl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Yl(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Kl(t,e,i){i*=.5;var r=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);return t[0]=r*l+s*a,t[1]=n*l+o*a,t[2]=o*l-n*a,t[3]=s*l-r*a,t}function Jl(t,e,i){i*=.5;var r=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);return t[0]=r*l-o*a,t[1]=n*l+s*a,t[2]=o*l+r*a,t[3]=s*l-n*a,t}Al(),Nl=new fl(4),fl!=Float32Array&&(Nl[0]=0,Nl[1]=0,Nl[2]=0,Nl[3]=0),Al(),Cl(1,0,0),Cl(0,1,0),Hl(),Hl(),ml();class Ql{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(t,e,i){const r=Ol(e,this.dir);if(Math.abs(r)<1e-6)return!1;const n=((t[0]-this.pos[0])*e[0]+(t[1]-this.pos[1])*e[1]+(t[2]-this.pos[2])*e[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(t,e,i){if(function(t,e){var i=t[0],r=t[1],n=t[2],o=e[0],s=e[1],a=e[2];return Math.abs(i-o)<=dl*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=dl*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=dl*Math.max(1,Math.abs(n),Math.abs(a))}(this.pos,t)||0===e)return i[0]=i[1]=i[2]=0,!1;const[r,n,o]=this.dir,s=this.pos[0]-t[0],a=this.pos[1]-t[1],l=this.pos[2]-t[2],c=r*r+n*n+o*o,h=2*(s*r+a*n+l*o),u=h*h-4*c*(s*s+a*a+l*l-e*e);if(u<0){const t=Math.max(-h/2,0),c=s+r*t,u=a+n*t,p=l+o*t,d=Math.hypot(c,u,p);return i[0]=c*e/d,i[1]=u*e/d,i[2]=p*e/d,!1}{const t=(-h-Math.sqrt(u))/(2*c);if(t<0){const t=Math.hypot(s,a,l);return i[0]=s*e/t,i[1]=a*e/t,i[2]=l*e/t,!1}return i[0]=s+r*t,i[1]=a+n*t,i[2]=l+o*t,!0}}}class $l{constructor(t,e,i,r,n){this.TL=t,this.TR=e,this.BR=i,this.BL=r,this.horizon=n}static fromInvProjectionMatrix(t,e,i){const r=[-1,1,1],n=[1,1,1],o=[1,-1,1],s=[-1,-1,1],a=Vl(r,r,t),l=Vl(n,n,t),c=Vl(o,o,t),h=Vl(s,s,t);return new $l(a,l,c,h,e/i)}}class tc{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(t,e,i,r){const n=Math.pow(2,i),o=[[-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((i=>{const o=Xl([],i,t),s=1/o[3]/e*n;return function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}(o,o,[s,s,r?1/o[3]:s,s])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=Fl([],Ul([],Gl([],o[t[0]],o[t[1]]),Gl([],o[t[2]],o[t[1]]))),i=-Ol(e,o[t[1]]);return e.concat(i)}));return new tc(o,s)}}class ec{static fromPoints(t){const e=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],i=[Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];for(const r of t)e[0]=Math.min(e[0],r[0]),e[1]=Math.min(e[1],r[1]),e[2]=Math.min(e[2],r[2]),i[0]=Math.max(i[0],r[0]),i[1]=Math.max(i[1],r[1]),i[2]=Math.max(i[2],r[2]);return new ec(e,i)}constructor(t,e){this.min=t,this.max=e,this.center=Bl([],zl([],this.min,this.max),.5)}quadrant(t){const e=[t%2==0,t<2],i=Ml(this.min),r=Ml(this.max);for(let n=0;n<e.length;n++)i[n]=e[n]?this.min[n]:this.center[n],r[n]=e[n]?this.center[n]:this.max[n];return r[2]=this.max[2],new ec(i,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,e=this.max;return[[t[0],t[1],t[2]],[e[0],t[1],t[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],e[2]],[t[0],e[1],e[2]]]}intersects(t){const e=this.getCorners();let i=!0;for(let r=0;r<t.planes.length;r++){const n=t.planes[r];let o=0;for(let t=0;t<e.length;t++)o+=Ol(n,e[t])+n[3]>=0;if(0===o)return 0;o!==e.length&&(i=!1)}if(i)return 2;for(let r=0;r<3;r++){let e=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let n=0;n<t.points.length;n++){const o=t.points[n][r]-this.min[r];e=Math.min(e,o),i=Math.max(i,o)}if(i<0||e>this.max[r]-this.min[r])return 0}return 1}}function ic(t,e,i,r,n,o,s,a,l){if(o&&t.queryGeometry.isAboveHorizon)return!1;o&&(l*=t.pixelToTileUnitsFactor);const c=t.tileID.canonical,h=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile;for(const u of e)for(const e of u){const u=e.add(a),p=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(u.x,u.y,!0):0,d=i.projection.projectTilePoint(u.x,u.y,c);if(p>0){const t=i.projection.upVector(c,u.x,u.y);d.x+=t[0]*h*p,d.y+=t[1]*h*p,d.z+=t[2]*h*p}const f=o?u:rc(d.x,d.y,d.z,r),m=o?t.tilespaceRays.map((t=>sc(t,p))):t.queryGeometry.screenGeometry,_=Xl([],[d.x,d.y,d.z,1],r);if(!s&&o?l*=_[3]/i.cameraToCenterDistance:s&&!o&&(l*=i.cameraToCenterDistance/_[3]),o){const t=ka((e.y/wa+c.y)/(1<<c.z));l/=i.projection.pixelsPerMeter(t,1)/za(1,t)}if(Ka(m,f,l))return!0}return!1}function rc(t,e,i,r){const o=Xl([],[t,e,i,1],r);return new n(o[0]/o[3],o[1]/o[3])}const nc=Cl(0,0,0),oc=Cl(0,0,1);function sc(t,e){const i=Al();return nc[2]=e,t.intersectsPlane(nc,oc,i),new n(i[0],i[1])}class ac extends Ha{}function lc(t,e,i,r){let{width:n,height:o}=e;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==n*o*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*o*i);return t.width=n,t.height=o,t.data=r,t}function cc(t,e,i){const{width:r,height:n}=e;r===t.width&&n===t.height||(hc(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,r),height:Math.min(t.height,n)},i),t.width=r,t.height=n,t.data=e.data)}function hc(t,e,i,r,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const s=t.data,a=e.data;for(let l=0;l<n.height;l++){const c=((i.y+l)*t.width+i.x)*o,h=((r.y+l)*e.width+r.x)*o;for(let t=0;t<n.width*o;t++)a[h+t]=s[c+t]}return e}Dn(ac,"HeatmapBucket",{omit:["layers"]});class uc{constructor(t,e){lc(this,t,1,e)}resize(t){cc(this,new uc(t),1)}clone(){return new uc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){hc(t,e,i,r,n,1)}}class pc{constructor(t,e){lc(this,t,4,e)}resize(t){cc(this,new pc(t),4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new pc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){hc(t,e,i,r,n,4)}}Dn(uc,"AlphaImage"),Dn(pc,"RGBAImage");var dc={paint:new Xo({"heatmap-radius":new Go(qt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Go(qt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new No(qt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Wo(qt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new No(qt.paint_heatmap["heatmap-opacity"])})};function fc(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new pc({width:i,height:r}),o=(i,r,o)=>{e[t.evaluationKey]=o;const s=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*s.r/s.a),n.data[i+r+1]=Math.floor(255*s.g/s.a),n.data[i+r+2]=Math.floor(255*s.b/s.a),n.data[i+r+3]=Math.floor(255*s.a)};if(t.clips)for(let s=0,a=0;s<r;++s,a+=4*i)for(let e=0,r=0;e<i;e++,r+=4){const n=e/(i-1),{start:l,end:c}=t.clips[s];o(a,r,l*(1-n)+c*n)}else for(let s=0,a=0;s<i;s++,a+=4)o(0,a,s/(i-1));return n}var mc={paint:new Xo({"hillshade-illumination-direction":new No(qt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new No(qt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new No(qt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new No(qt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new No(qt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new No(qt.paint_hillshade["hillshade-accent-color"])})};const _c=Qo([{name:"a_pos",components:2,type:"Int16"}],4),{members:gc}=_c;var yc=vc,xc=vc;function vc(t,e,i){i=i||2;var r,n,o,s,a,l,c,h=e&&e.length,u=h?e[0]*i:t.length,p=bc(t,0,u,i,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,i,r){var n,o,s,a=[];for(n=0,o=e.length;n<o;n++)(s=bc(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(kc(s));for(a.sort(Ic),n=0;n<a.length;n++)i=Cc(a[n],i);return i}(t,e,p,i)),t.length>80*i){r=o=t[0],n=s=t[1];for(var f=i;f<u;f+=i)(a=t[f])<r&&(r=a),(l=t[f+1])<n&&(n=l),a>o&&(o=a),l>s&&(s=l);c=0!==(c=Math.max(o-r,s-n))?32767/c:0}return Tc(p,d,i,r,n,c,0),d}function bc(t,e,i,r,n){var o,s;if(n===qc(t,e,i,r)>0)for(o=e;o<i;o+=r)s=Nc(o,t[o],t[o+1],s);else for(o=i-r;o>=e;o-=r)s=Nc(o,t[o],t[o+1],s);return s&&Rc(s,s.next)&&(Gc(s),s=s.next),s}function wc(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Rc(r,r.next)&&0!==Bc(r.prev,r,r.next))r=r.next;else{if(Gc(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Tc(t,e,i,r,n,o,s){if(t){!s&&o&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=Pc(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,s,a,l,c=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,r=i,a=0,e=0;e<c&&(a++,r=r.nextZ);e++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,l--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,c*=2}while(s>1)}(n)}(t,r,n,o);for(var a,l,c=t;t.prev!==t.next;
vendor: 1,952 bytes, line 1
1)if(a=t.prev,l=t.next,o?Sc(t,r,n,o):Ec(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),Gc(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?Tc(t=Ac(wc(t),e,i),e,i,r,n,o,2):2===s&&Mc(t,e,i,r,n,o):Tc(wc(t),e,i,r,n,o,1);break}}}function Ec(t){var e=t.prev,i=t,r=t.next;if(Bc(e,i,r)>=0)return!1;for(var n=e.x,o=i.x,s=r.x,a=e.y,l=i.y,c=r.y,h=n<o?n<s?n:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,p=n>o?n>s?n:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,f=r.next;f!==e;){if(f.x>=h&&f.x<=p&&f.y>=u&&f.y<=d&&Dc(n,a,o,l,s,c,f.x,f.y)&&Bc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Sc(t,e,i,r){var n=t.prev,o=t,s=t.next;if(Bc(n,o,s)>=0)return!1;for(var a=n.x,l=o.x,c=s.x,h=n.y,u=o.y,p=s.y,d=a<l?a<c?a:c:l<c?l:c,f=h<u?h<p?h:p:u<p?u:p,m=a>l?a>c?a:c:l>c?l:c,_=h>u?h>p?h:p:u>p?u:p,g=Pc(d,f,e,i,r),y=Pc(m,_,e,i,r),x=t.prevZ,v=t.nextZ;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Dc(a,h,l,u,c,p,x.x,x.y)&&Bc(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=d&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Dc(a,h,l,u,c,p,v.x,v.y)&&Bc(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Dc(a,h,l,u,c,p,x.x,x.y)&&Bc(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Dc(a,h,l,u,c,p,v.x,v.y)&&Bc(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ac(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!Rc(n,o)&&Fc(n,r,r.next,o)&&Vc(n,o)&&Vc(o,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),Gc(r),Gc(r.next),r=t=o),r=r.next}while(r!==t);return wc(r)}function Mc(t,e,i,r,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Lc(s,a)){var l=jc(s,a);return s=wc(s,s.next),l=wc(l,l.next),Tc(s,e,i,r,n,o,0),void Tc(l,e,i,r,n,o,0)}a=a.next}s=s.next}while(s!==t)}function Ic(t,e){return t.x-e.x}function Cc(t,e){var i=function(t,e){var i,r=e,n=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y
vendor: 4,173 bytes, line 1
1);if(a<=n&&a>s&&(s=a,i=r.x<r.next.x?r:r.next,a===n))return i}r=r.next}while(r!==e);if(!i)return null;var l,c=i,h=i.x,u=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=h&&n!==r.x&&Dc(o<u?n:s,o,h,u,o<u?s:n,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(n-r.x),Vc(r,t)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&zc(i,r)))&&(i=r,p=l)),r=r.next}while(r!==c);return i}(t,e);if(!i)return e;var r=jc(i,t);return wc(r,r.next),wc(i,i.next)}function zc(t,e){return Bc(t.prev,t,e.prev)<0&&Bc(e.next,t,t.next)<0}function Pc(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function kc(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Dc(t,e,i,r,n,o,s,a){return(n-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(i-s)*(e-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function Lc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Fc(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Vc(t,e)&&Vc(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Bc(t.prev,t,e.prev)||Bc(t,e.prev,e))||Rc(t,e)&&Bc(t.prev,t,t.next)>0&&Bc(e.prev,e,e.next)>0)}function Bc(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Rc(t,e){return t.x===e.x&&t.y===e.y}function Fc(t,e,i,r){var n=Uc(Bc(t,e,i)),o=Uc(Bc(t,e,r)),s=Uc(Bc(i,r,t)),a=Uc(Bc(i,r,e));return n!==o&&s!==a||!(0!==n||!Oc(t,i,e))||!(0!==o||!Oc(t,r,e))||!(0!==s||!Oc(i,t,r))||!(0!==a||!Oc(i,e,r))}function Oc(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Uc(t){return t>0?1:t<0?-1:0}function Vc(t,e){return Bc(t.prev,t,t.next)<0?Bc(t,e,t.next)>=0&&Bc(t,t.prev,e)>=0:Bc(t,e,t.prev)<0||Bc(t,t.next,e)<0}function jc(t,e){var i=new Zc(t.i,t.x,t.y),r=new Zc(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Nc(t,e,i,r){var n=new Zc(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Gc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Zc(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qc(t,e,i,r){for(var n=0,o=e,s=i-r;o<i;o+=r)n+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return n}function Wc(t,e,i,r,n){Xc(t,e,i||0,r||t.length-1,n||Yc)}function Xc(t,e,i,r,n){for(;r>i;){if(r-i>600){var o=r-i+1,s=e-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Xc(t,e,Math.max(i,Math.floor(e-s*l/o+c)),Math.min(r,Math.floor(e+(o-s)*l/o+c)),n)}var h=t[e],u=i,p=r;for(Hc(t,i,e),n(t[r],h)>0&&Hc(t,i,r);u<p;){for(Hc(t,u,p),u++,p--;n(t[u],h)<0;)u++;for(;n(t[p],h)>0;)p--}0===n(t[i],h)?Hc(t,i,p):Hc(t,++p,r),p<=e&&(i=p+1),e<=p&&(r=p-1)}}function Hc(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function Yc(t,e){return t<e?-1:t>e?1:0}function Kc(t,e){const i=t.length;if(i<=1)return[t];const r=[];let n,o;for(let s=0;s<i;s++){const e=D(t[s]);0!==e&&(t[s].area=Math.abs(e),void 0===o&&(o=e<0),o===e<0?(n&&r.push(n),n=[t[s]]):n.push(t[s]))}if(n&&r.push(n),e>1)for(let s=0;s<r.length;s++)r[s].length<=e||(Wc(r[s],e,1,r[s].length-1,Jc),r[s]=r[s].slice(0,e));return r}function Jc(t,e){return e.area-t.area}function Qc(t,e,i){const r=i.patternDependencies;let n=!1;for(const o of e){const e=o.paint.get("".concat(t,"-pattern"));e.isConstant()||(n=!0);const i=e.constantOr(null);i&&(n=!0,r[i.to]=!0,r[i.from]=!0)}return n}function $c(t,e,i,r,n){const o=n.patternDependencies;for(const s of e){const e=s.paint.get("".concat(t,"-pattern")).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},n.availableImages),a=e.evaluate({zoom:r},i,{},n.availableImages),l=e.evaluate({zoom:r+1},i,{},n.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,i.patterns[s.id]={min:t,mid:a,max:l}}}return i}
vendor: 13,279 bytes, line 1
1vc.deviation=function(t,e,i,r){var n=e&&e.length,o=Math.abs(qc(t,0,n?e[0]*i:t.length,i));if(n)for(var s=0,a=e.length;s<a;s++)o-=Math.abs(qc(t,e[s]*i,s<a-1?e[s+1]*i:t.length,i));var l=0;for(s=0;s<r.length;s+=3){var c=r[s]*i,h=r[s+1]*i,u=r[s+2]*i;l+=Math.abs((t[c]-t[u])*(t[h+1]-t[c+1])-(t[c]-t[h])*(t[u+1]-t[c+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},vc.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var s=0;s<e;s++)i.vertices.push(t[n][o][s]);n>0&&i.holes.push(r+=t[n-1].length)}return i},yc.default=xc;class th{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ts,this.indexArray=new _s,this.indexArray2=new ws,this.programConfigurations=new ua(t.layers,t.zoom),this.segments=new ba,this.segments2=new ba,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection}populate(t,e,i,r){this.hasPattern=Qc("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=qa(s,t);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),h,i))continue;const u=n?n.evaluate(h,{},i,e.availableImages):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:Za(s,i,r),patterns:{},sortKey:u};o.push(p)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const s of o){const{geometry:r,index:n,sourceLayerIndex:o}=s;if(this.hasPattern){const t=$c("fill",this.layers,s,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(s,r,n,i,{},e.availableImages);e.featureIndex.insert(t[n].feature,r,n,o,this.index)}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i,r)}addFeatures(t,e,i,r,n){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,e,i,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gc),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,r,n){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];for(const s of Kc(e,500)){let t=0;for(const a of s)t+=a.length;const e=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),i=e.vertexLength,r=[],n=[];for(const a of s){if(0===a.length)continue;a!==s[0]&&n.push(r.length/2);const t=this.segments2.prepareSegment(a.length,this.layoutVertexArray,this.indexArray2),e=t.vertexLength;this.layoutVertexArray.emplaceBack(a[0].x,a[0].y),this.indexArray2.emplaceBack(e+a.length-1,e),r.push(a[0].x),r.push(a[0].y);for(let i=1;i<a.length;i++)this.layoutVertexArray.emplaceBack(a[i].x,a[i].y),this.indexArray2.emplaceBack(e+i-1,e+i),r.push(a[i].x),r.push(a[i].y);t.vertexLength+=a.length,t.primitiveLength+=a.length}const o=yc(r,n);for(let s=0;s<o.length;s+=3)this.indexArray.emplaceBack(i+o[s],i+o[s+1],i+o[s+2]);e.vertexLength+=t,e.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,o,r)}}Dn(th,"FillBucket",{omit:["layers","patternFeatures"]});const eh=new Xo({"fill-sort-key":new Go(qt.layout_fill["fill-sort-key"])});var ih={paint:new Xo({"fill-antialias":new No(qt.paint_fill["fill-antialias"]),"fill-opacity":new Go(qt.paint_fill["fill-opacity"]),"fill-color":new Go(qt.paint_fill["fill-color"]),"fill-outline-color":new Go(qt.paint_fill["fill-outline-color"]),"fill-translate":new No(qt.paint_fill["fill-translate"]),"fill-translate-anchor":new No(qt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Zo(qt.paint_fill["fill-pattern"])}),layout:eh};const rh=Qo([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),nh=Qo([{name:"a_centroid_pos",components:2,type:"Uint16"}]),oh=Qo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:sh}=rh;var ah=lh;function lh(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields(ch,this,e)}function ch(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function hh(t){for(var e,i,r=0,n=0,o=t.length,s=o-1;n<o;s=n++)r+=((i=t[s]).x-(e=t[n]).x)*(e.y+i.y);return r}lh.types=["Unknown","Point","LineString","Polygon"],lh.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,r=1,o=0,s=0,a=0,l=[];t.pos<i;){if(o<=0){var c=t.readVarint();r=7&c,o=c>>3}if(o--,1===r||2===r)s+=t.readSVarint(),a+=t.readSVarint(),1===r&&(e&&l.push(e),e=[]),e.push(new n(s,a));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&l.push(e),l},lh.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<s&&(s=n),n>a&&(a=n),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},lh.prototype.toGeoJSON=function(t,e,i){var r,n,o=this.extent*Math.pow(2,i),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=lh.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(r=0;r<l.length;r++)u[r]=l[r][0];h(l=u);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,n=[],o=0;o<e;o++){var s=hh(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(i&&n.push(i),i=[t[o]]):i.push(t[o]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)h(l[r][n])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var uh=ph;function ph(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(dh,this,e),this.length=this._features.length}function dh(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}function fh(t,e,i){if(3===t){var r=new uh(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}ph.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ah(this._pbf,e,this.extent,this._keys,this._values)};var mh={VectorTile:function(t,e){this.layers=t.readFields(fh,{},e)},VectorTileFeature:ah,VectorTileLayer:uh};function _h(t,e,i,r){const o=[],s=0===r?(t,e,i,r,o,s)=>{t.push(new n(s,i+(s-e)/(r-e)*(o-i)))}:(t,e,i,r,o,s)=>{t.push(new n(e+(s-i)/(o-i)*(r-e),s))};for(const n of t){const t=[];for(const o of n){if(o.length<=2)continue;const n=[];for(let t=0;t<o.length-1;t++){const a=o[t].x,l=o[t].y,c=o[t+1].x,h=o[t+1].y,u=0===r?a:l,p=0===r?c:h;u<e?p>e&&s(n,a,l,c,h,e):u>i?p<i&&s(n,a,l,c,h,i):n.push(o[t]),p<e&&u>=e&&s(n,a,l,c,h,e),p>i&&u<=i&&s(n,a,l,c,h,i)}let a=o[o.length-1];const l=0===r?a.x:a.y;l>=e&&l<=i&&n.push(a),n.length&&(a=n[n.length-1],n[0].x===a.x&&n[0].y===a.y||n.push(n[0]),t.push(n))}t.length&&o.push(t)}return o}const gh=mh.VectorTileFeature.types,yh=Math.pow(2,13);function xh(t,e,i,r,n,o,s,a){t.emplaceBack((e<<1)+s,(i<<1)+o,(Math.floor(r*yh)<<1)+n,Math.round(a))}function vh(t,e,i){const r=16384;t.emplaceBack(e.x,e.y,e.z,i[0]*r,i[1]*r,i[2]*r)}class bh{constructor(){this.acc=new n(0,0),this.polyCount=[]}startRing(t){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new n(t.x,t.y),this.max=new n(t.x,t.y))}append(t,e){this.currentPolyCount.edges++,this.acc._add(t);const i=this.min,r=this.max;t.x<i.x?i.x=t.x:t.x>r.x&&(r.x=t.x),t.y<i.y?i.y=t.y:t.y>r.y&&(r.y=t.y),((0===t.x||t.x===wa)&&t.x===e.x)!=((0===t.y||t.y===wa)&&t.y===e.y)&&this.processBorderOverlap(t,e),e.x<0!=t.x<0&&this.addBorderIntersection(0,yi(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>wa!=t.x>wa&&this.addBorderIntersection(1,yi(e.y,t.y,(wa-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,yi(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>wa!=t.y>wa&&this.addBorderIntersection(3,yi(e.x,t.x,(wa-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[t];e<i[0]&&(i[0]=e),e>i[1]&&(i[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const i=0===t.x?0:1;this.addBorderIntersection(i,e.y),this.addBorderIntersection(i,t.y)}else{const i=0===t.y?2:3;this.addBorderIntersection(i,e.x),this.addBorderIntersection(i,t.x)}}centroid(){const t=this.polyCount.reduce(((t,e)=>t+e.edges),0);return 0!==t?this.acc.div(t)._round():new n(0,0)}span(){return new n(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0)}}class wh{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.layoutVertexArray=new is,this.centroidVertexArray=new Os,this.indexArray=new _s,this.programConfigurations=new ua(t.layers,t.zoom),this.segments=new ba,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.enableTerrain=t.enableTerrain}populate(t,e,i,r){this.features=[],this.hasPattern=Qc("fill-extrusion",this.layers,e),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(t){const e=Math.exp(Math.PI*(1-t.y/(1<<t.z)*2));return 80150034*e/(e*e+1)/wa/(1<<t.z)}(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:n,id:o,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,l=qa(n,t);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),l,i))continue;const c={id:o,sourceLayerIndex:a,index:s,geometry:t?l.geometry:Za(n,i,r),properties:n.properties,type:n.type,patterns:{}},h=this.layoutVertexArray.length;this.hasPattern?this.features.push($c("fill-extrusion",this.layers,c,this.zoom,e)):this.addFeature(c,c.geometry,s,i,{},e.availableImages,r),e.featureIndex.insert(n,c.geometry,s,a,this.index,h)}this.sortBorders()}addFeatures(t,e,i,r,n){for(const o of this.features){const{geometry:t}=o;this.addFeature(o,t,o.index,e,i,r,n)}this.sortBorders()}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sh),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,oh.members,!0))),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,nh.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,o,s,a){const l=[new n(0,0),new n(wa,wa)],c=a.projection,h="globe"===c.name,u=this.enableTerrain&&!h?new bh:null,p="Polygon"===gh[t.type];h&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new As);const d=Kc(e,500);for(let n=d.length-1;n>=0;n--){const t=d[n];(0===t.length||(f=t[0]).every((t=>t.x<=0))||f.every((t=>t.x>
1=wa))||f.every((t=>t.y<=0))||f.every((t=>t.y>=wa)))&&d.splice(n,1)}var f;let m;if(h)m=zh(d,l,r);else{m=[];for(const t of d)m.push({polygon:t,bounds:l})}const _=p?this.edgeRadius:0;for(const{polygon:n,bounds:g}of m){let t=0,e=0;for(const r of n)p&&!r[0].equals(r[r.length-1])&&r.push(r[0]),e+=p?r.length-1:r.length;const i=this.segments.prepareSegment((p?5:4)*e,this.layoutVertexArray,this.indexArray);if(p){const e=[],o=[];t=i.vertexLength;for(const t of n){let s,a;t.length&&t!==n[0]&&o.push(e.length/2),s=t[1].sub(t[0])._perp()._unit();for(let n=1;n<t.length;n++){const o=t[n],l=t[n===t.length-1?1:n+1];let{x:u,y:p}=o;if(_){a=l.sub(o)._perp()._unit();const t=s.add(a)._unit(),e=_*Math.min(4,1/(s.x*t.x+s.y*t.y));u+=e*t.x,p+=e*t.y,s=a}xh(this.layoutVertexArray,u,p,0,0,1,1,0),i.vertexLength++,e.push(o.x,o.y),h&&vh(this.layoutVertexExtArray,c.projectTilePoint(u,p,r),c.upVector(r,u,p))}}const s=yc(e,o);for(let r=0;r<s.length;r+=3)this.indexArray.emplaceBack(t+s[r],t+s[r+2],t+s[r+1]),i.primitiveLength++}for(const o of n){u&&o.length&&u.startRing(o[0]);let e,n,s,a=o.length>4&&Mh(o[o.length-2],o[0],o[1]),l=_?Eh(o[o.length-2],o[0],o[1],_):0;n=o[1].sub(o[0])._perp()._unit();for(let d=1,f=0;d<o.length;d++){let m=o[d-1],y=o[d];const x=o[d===o.length-1?1:d+1];if(u&&p&&u.currentPolyCount.top++,Ah(y,m,g)){_&&(n=x.sub(y)._perp()._unit());continue}u&&u.append(y,m);const v=y.sub(m)._perp(),b=v.x/(Math.abs(v.x)+Math.abs(v.y)),w=v.y>0?1:0,T=m.dist(y);if(f+T>32768&&(f=0),_){s=x.sub(y)._perp()._unit();let t=Sh(m,y,x,Th(n,s),_);isNaN(t)&&(t=0);const e=y.sub(m)._unit();m=m.add(e.mult(l))._round(),y=y.add(e.mult(-t))._round(),l=t,n=s}const E=i.vertexLength,S=o.length>4&&Mh(m,y,x);let A=Ih(f,a,!0);if(xh(this.layoutVertexArray,m.x,m.y,b,w,0,0,A),xh(this.layoutVertexArray,m.x,m.y,b,w,0,1,A),f+=T,A=Ih(f,S,!1),a=S,xh(this.layoutVertexArray,y.x,y.y,b,w,0,0,A),xh(this.layoutVertexArray,y.x,y.y,b,w,0,1,A),i.vertexLength+=4,this.indexArray.emplaceBack(E+0,E+1,E+2),this.indexArray.emplaceBack(E+1,E+3,E+2),i.primitiveLength+=2,_){const r=t+(1===d?o.length-2:d-2),n=1===d?t:r+1;if(this.indexArray.emplaceBack(E+1,r,E+3),this.indexArray.emplaceBack(r,n,E+3),i.primitiveLength+=2,void 0===e&&(e=E),!Ah(x,o[d],g)){const t=d===o.length-1?e:i.vertexLength;this.indexArray.emplaceBack(E+2,E+3,t),this.indexArray.emplaceBack(E+3,t+1,t),this.indexArray.emplaceBack(E+3,n,t+1),i.primitiveLength+=3}}if(h){const t=this.layoutVertexExtArray,e=c.projectTilePoint(m.x,m.y,r),i=c.projectTilePoint(y.x,y.y,r),n=c.upVector(r,m.x,m.y),o=c.upVector(r,y.x,y.y);vh(t,e,n),vh(t,e,n),vh(t,i,o),vh(t,i,o)}}p&&(t+=o.length-1)}}if(u&&u.polyCount.length>0){if(u.borders){u.vertexArrayOffset=this.centroidVertexArray.length;const t=u.borders,e=this.featuresOnBorder.push(u)-1;for(let i=0;i<4;i++)t[i][0]!==Number.MAX_VALUE&&this.borders[i].push(e)}this.encodeCentroid(u.borders?void 0:u.centroid(),u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,s,r)}sortBorders(){for(let t=0;t<4;t++)this.borders[t].sort(((e,i)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[i].borders[t][0]))}encodeCentroid(t,e){let i,r,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(0!==t.y){const n=e.span()._mult(this.tileToMeter);i=(Math.max(t.x,1)<<3)+Math.min(7,Math.round(n.x/10)),r=(Math.max(t.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else i=Math.ceil(7*(t.x+450)),r=0;else i=0,r=+n;let o=n?this.centroidVertexArray.length:e.vertexArrayOffset;for(const s of e.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*s.edges+s.top);for(let t=0;t<s.top;t++)this.centroidVertexArray.emplace(o++,i,r);for(let t=0;t<2*s.edges;t++)this.centroidVertexArray.emplace(o++,0,r),this.centroidVertexArray.emplace(o++,i,r)}}}function Th(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function Eh(t,e,i,r){const n=e.sub(t)._perp()._unit(),o=i.sub(e)._perp()._unit();return Sh(t,e,i,Th(n,o),r)}function Sh(t,e,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(t.dist(e)/3,e.dist(i)/3,n*o/r)}function Ah(t,e,i){return t.x<i[0].x&&e.x<i[0].x||t.x>i[1].x&&e.x>i[1].x||t.y<i[0].y&&e.y<i[0].y||t.y>i[1].y&&e.y>i[1].y}function Mh(t,e,i){if(t.x<0||t.x>=wa||e.x<0||e.x>=wa||i.x<0||i.x>=wa)return!1;const r=i.sub(e),n=r.perp(),o=t.sub(e);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function Ih(t,e,i){const r=e?2|t:-3&t;return i?1|r:-2&r}function Ch(){const t=Math.PI/32,e=Math.tan(t),i=Ea;return i*Math.sqrt(1+2*e*e)-i}
vendor: 51,094 bytes, line 1
1function zh(t,e,i){const r=1<<i.z,o=Pa(i.x/r),s=Pa((i.x+1)/r),a=ka(i.y/r),l=ka((i.y+1)/r);return function(t,e,i,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0;const a=[];if(!t.length||!i||!r)return a;const l=(t,e)=>{for(const i of t)a.push({polygon:i,bounds:e})},c=Math.ceil(Math.log2(i)),h=Math.ceil(Math.log2(r)),u=c-h,p=[];for(let n=0;n<Math.abs(u);n++)p.push(u>0?0:1);for(let n=0;n<Math.min(c,h);n++)p.push(0),p.push(1);let d=t;if(d=_h(d,e[0].y-o,e[1].y+o,1),d=_h(d,e[0].x-o,e[1].x+o,0),!d.length)return a;const f=[];for(p.length?f.push({polygons:d,bounds:e,depth:0}):l(d,e);f.length;){const t=f.pop(),e=t.depth,i=p[e],r=t.bounds[0],a=t.bounds[1],c=0===i?r.x:r.y,h=0===i?a.x:a.y,u=s?s(i,c,h):.5*(c+h),d=_h(t.polygons,c-o,u+o,i),m=_h(t.polygons,u-o,h+o,i);if(d.length){const t=[r,new n(0===i?u:a.x,1===i?u:a.y)];p.length>e+1?f.push({polygons:d,bounds:t,depth:e+1}):l(d,t)}if(m.length){const t=[new n(0===i?u:r.x,1===i?u:r.y),a];p.length>e+1?f.push({polygons:m,bounds:t,depth:e+1}):l(m,t)}}return a}(t,e,Math.ceil((s-o)/11.25),Math.ceil((a-l)/11.25),1,((t,e,n)=>{if(0===t)return.5*(e+n);{const t=ka((i.y+e/wa)/r);return(Ca(.5*(ka((i.y+n/wa)/r)+t))*r-i.y)*wa}}))}Dn(wh,"FillExtrusionBucket",{omit:["layers","features"]}),Dn(bh,"PartMetadata");const Ph=new Xo({"fill-extrusion-edge-radius":new No(qt["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var kh={paint:new Xo({"fill-extrusion-opacity":new No(qt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Go(qt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new No(qt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new No(qt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zo(qt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Go(qt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Go(qt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new No(qt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new No(qt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new No(qt["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:Ph};function Dh(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class Lh{constructor(t,e,i){this.z=t,this.x=e,this.y=i,this.key=Fh(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e){const i=function(t,e,i){var r=Dh(256*t,256*(e=Math.pow(2,i)-e-1),i),n=Dh(256*(t+1),256*(e+1),i);return r[0]+","+r[1]+","+n[0]+","+n[1]}(this.x,this.y,this.z),r=function(t,e,i){let r,n="";for(let o=t;o>0;o--)r=1<<o-1,n+=(e&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}}class Bh{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Fh(t,e.z,e.z,e.x,e.y)}}class Rh{constructor(t,e,i,r,n){this.overscaledZ=t,this.wrap=e,this.canonical=new Lh(i,+r,+n),this.key=0===e&&t===i?this.canonical.key:Fh(e,t,i,r,n)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Rh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Rh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return Fh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-t;return Fh(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Rh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Rh(e,this.wrap,e,i,r),new Rh(e,this.wrap,e,i+1,r),new Rh(e,this.wrap,e,i,r+1),new Rh(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Rh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Rh(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Bh(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}}function Fh(t,e,i,r,n){const o=1<<Math.min(i,22);let s=o*(n%o)+r%o;return t&&i<22&&(s+=o*o*((t<0?-2*t-1:2*t)%(1<<2*(22-i)))),16*(32*s+i)+(e-i)}function Oh(t,e){return t.x*e.x+t.y*e.y}function Uh(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){const o=e[i],s=t[0],a=n.sub(r),l=o.sub(r),c=s.sub(r),h=Oh(a,a),u=Oh(a,l),p=Oh(l,l),d=Oh(c,a),f=Oh(c,l),m=h*p-u*u,_=(p*d-u*f)/m,g=(h*f-u*d)/m,y=r.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}function Vh(t){const e=new n(t[0],t[1]);return e.z=t[2],e}function jh(t,e,i,r,n,o,s,a){const l=s*n.getElevationAt(t,e,!0,!0),c=0!==o[0],h=c?0===o[1]?s*(o[0]/7-450):s*function(t,e,i){const r=Math.floor(e[0]/8),n=Math.floor(e[1]/8),o=10*(e[0]-8*r),s=10*(e[1]-8*n),a=t.getElevationAt(r,n,!0,!0),l=t.getMeterToDEM(i),c=Math.floor(.5*(o*l-1)),h=Math.floor(.5*(s*l-1)),u=t.tileCoordToPixel(r,n),p=2*c+1,d=2*h+1,f=function(t,e,i,r,n){return[t.getElevationAtPixel(e,i,!0),t.getElevationAtPixel(e+n,i,!0),t.getElevationAtPixel(e,i+n,!0),t.getElevationAtPixel(e+r,i+n,!0)]}(t,u.x-c,u.y-h,p,d),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/p),x=Math.min(.25,.5*l*g/d);return a+Math.max(y*o,x*s)}(n,o,a):l;return{base:l+(0===i)?-1:i,top:c?Math.max(h+r,l+i+2):l+r}}Dn(Lh,"CanonicalTileID"),Dn(Rh,"OverscaledTileID",{omit:["projMatrix"]});const Nh=Qo([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Gh}=Nh,Zh=Qo([{name:"a_packed",components:4,type:"Float32"}]),{members:qh}=Zh,Wh=mh.VectorTileFeature.types,Xh=Math.cos(Math.PI/180*37.5);class Hh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new rs,this.layoutVertexArray2=new ns,this.indexArray=new _s,this.programConfigurations=new ua(t.layers,t.zoom),this.segments=new ba,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i,r){this.hasPattern=Qc("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),o=[];for(const{feature:c,id:h,index:u,sourceLayerIndex:p}of t){const t=this.layers[0]._featureFilter.needGeometry,e=qa(c,t);if(!this.layers[0]._featureFilter.filter(new Do(this.zoom),e,i))continue;const s=n?n.evaluate(e,{},i):void 0,a={id:h,properties:c.properties,type:c.type,sourceLayerIndex:p,index:u,geometry:t?e.geometry:Za(c,i,r),patterns:{},sortKey:s};o.push(a)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:s,featureIndex:a}=e,l=this.addConstantDashes(s);for(const c of o){const{geometry:r,index:n,sourceLayerIndex:o}=c;if(l&&this.addFeatureDashes(c,s),this.hasPattern){const t=$c("line",this.layers,c,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(c,r,n,i,s.positions,e.availableImages);a.insert(t[n].feature,r,n,o,this.index)}}addConstantDashes(t){let e=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)e=!0;else{const e=n.value,i=r.value;if(!i)continue;t.addDash(i.from,e),t.addDash(i.to,e),i.other&&t.addDash(i.other,e)}}return e}addFeatureDashes(t,e){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let s,a,l,c,h,u;if("constant"===n.kind){const t=n.value;if(!t)continue;s=t.other||t.to,a=t.to,l=t.from}else s=n.evaluate({zoom:i-1},t),a=n.evaluate({zoom:i},t),l=n.evaluate({zoom:i+1},t);"constant"===o.kind?c=h=u=o.value:(c=o.evaluate({zoom:i-1},t),h=o.evaluate({zoom:i},t),u=o.evaluate({zoom:i+1},t)),e.addDash(s,c),e.addDash(a,h),e.addDash(l,u);const p=e.getKey(s,c),d=e.getKey(a,h),f=e.getKey(l,u);t.patterns[r.id]={min:p,mid:d,max:f}}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i,r)}addFeatures(t,e,i,r,n){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,e,i,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,qh)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Gh),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,r,n,o){const s=this.layers[0].layout,a=s.get("line-join").evaluate(t,{}),l=s.get("line-cap").evaluate(t,{}),c=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const u of e)this.addLine(u,t,a,l,c,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,o,r)}addLine(t,e,i,r,n,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const s="Polygon"===Wh[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(s?3:2))return;"bevel"===i&&(n=1.05);const c=this.overscaling<=16?122880/(512*this.overscaling):0,h=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let u,p,d,f,m;this.e1=this.e2=-1,s&&(u=t[a-2],m=t[l].sub(u)._unit()._perp());for(let _=l;_<a;_++){if(d=_===a-1?s?t[l+1]:void 0:t[_+1],d&&t[_].equals(d))continue;m&&(f=m),u&&(p=u),u=t[_],m=d?d.sub(u)._unit()._perp():f,f=f||m;let e=f.add(m);0===e.x&&0===e.y||e._unit();const g=f.x*m.x+f.y*m.y,y=e.x*m.x+e.y*m.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<Xh&&p&&d,w=f.x*m.y-f.y*m.x>0;if(b&&_>l){const t=u.dist(p);if(t>2*c){const e=u.sub(u.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,f,0,0,h),p=e}}const T=p&&d;let E=T?i:s?"butt":r;if(T&&"round"===E&&(x<o?E="miter":x<=2&&(E="fakeround")),"miter"===E&&x>n&&(E="bevel"),"bevel"===E&&(x>2&&(E="flipbevel"),x<n&&(E="miter")),p&&this.updateDistance(p,u),"miter"===E)e._mult(x),this.addCurrentVertex(u,e,0,0,h);else if("flipbevel"===E){if(x>100)e=m.mult(-1);else{const t=x*f.add(m).mag()/f.sub(m).mag();e._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(u,e,0,0,h),this.addCurrentVertex(u,e.mult(-1),0,0,h)}else if("bevel"===E||"fakeround"===E){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(u,f,e,i,h),"fakeround"===E){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const r=m.sub(f)._mult(i)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(u,r.x,r.y,!1,w,0,h)}}d&&this.addCurrentVertex(u,m,-e,-i,h)}else if("butt"===E)this.addCurrentVertex(u,e,0,0,h);else if("square"===E){const t=p?1:-1;p||this.addCurrentVertex(u,e,t,t,h),this.addCurrentVertex(u,e,0,0,h),p&&this.addCurrentVertex(u,e,t,t,h)}else"round"===E&&(p&&(this.addCurrentVertex(u,f,0,0,h),this.addCurrentVertex(u,f,1,1,h,!0)),d&&(this.addCurrentVertex(u,m,-1,-1,h,!0),this.addCurrentVertex(u,m,0,0,h)));if(b&&_<a-1){const t=u.dist(d);if(t>2*c){const e=u.add(d.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,m,0,0,h),u=e}}}}addCurrentVertex(t,e,i,r,n){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const s=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,s,a,o,!0,-r,n)}addHalfVertex(t,e,i,r,n,o,s){let{x:a,y:l}=t;this.layoutVertexArray.emplaceBack((a<<1)+(r?1:0),(l<<1)+(n?1:0),Math.round(63*e)+128,Math.round(63*i)+128,1+(0===o?0:o<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),n?this.e2=c:this.e1=c}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}Dn(Hh,"LineBucket",{omit:["layers","patternFeatures"]});const Yh=new Xo({"line-cap":new Go(qt.layout_line["line-cap"]),"line-join":new Go(qt.layout_line["line-join"]),"line-miter-limit":new No(qt.layout_line["line-miter-limit"]),"line-round-limit":new No(qt.layout_line["line-round-limit"]),"line-sort-key":new Go(qt.layout_line["line-sort-key"])});var Kh={paint:new Xo({"line-opacity":new Go(qt.paint_line["line-opacity"]),"line-color":new Go(qt.paint_line["line-color"]),"line-translate":new No(qt.paint_line["line-translate"]),"line-translate-anchor":new No(qt.paint_line["line-translate-anchor"]),"line-width":new Go(qt.paint_line["line-width"]),"line-gap-width":new Go(qt.paint_line["line-gap-width"]),"line-offset":new Go(qt.paint_line["line-offset"]),"line-blur":new Go(qt.paint_line["line-blur"]),"line-dasharray":new Zo(qt.paint_line["line-dasharray"]),"line-pattern":new Zo(qt.paint_line["line-pattern"]),"line-gradient":new Wo(qt.paint_line["line-gradient"]),"line-trim-offset":new No(qt.paint_line["line-trim-offset"])}),layout:Yh};const Jh=new class extends Go{possiblyEvaluate(t,e){return e=new Do(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=x({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}(Kh.paint.properties["line-width"].specification);function Qh(t,e){return e>0?e+2*t:t}Jh.useIntegerZoom=!0;const $h=Qo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tu=Qo([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),eu=Qo([{name:"a_projected_pos",components:4,type:"Float32"}],4);Qo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const iu=Qo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),ru=Qo([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Qo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const nu=Qo([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ou=Qo([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Qo([{name:"triangle",components:3,type:"Uint16"}]),Qo([{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"}]),Qo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"}]),Qo([{type:"Float32",name:"offsetX"}]),Qo([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var su=24;const au=128;function lu(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Do(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const s=e[n],a=e[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:a,minSize:i.evaluate(new Do(s)),maxSize:i.evaluate(new Do(a)),interpolationType:r}}}function cu(t,e,i){let{uSize:r,uSizeT:n}=e,{lowerSize:o,upperSize:s}=i;return"source"===t.kind?o/au:"composite"===t.kind?yi(o/au,s/au,n):r}function hu(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:s}=t,a=n?f(Vi.interpolationFactor(n,e,o,s),0,1):0;"camera"===t.kind?r=yi(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:r}}var uu=Object.freeze({__proto__:null,getSizeData:lu,evaluateSizeForFeature:cu,evaluateSizeForZoom:hu,SIZE_PACK_FACTOR:au});function pu(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),ko.applyArabicShaping&&(t=ko.applyArabicShaping(t)),t}(t.text,e,i)})),t}const du={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"};function fu(t){return"\ufe36"===t||"\ufe48"===t||"\ufe38"===t||"\ufe44"===t||"\ufe42"===t||"\ufe3e"===t||"\ufe3c"===t||"\ufe3a"===t||"\ufe18"===t||"\ufe40"===t||"\ufe10"===t||"\ufe13"===t||"\ufe14"===t||"\uff40"===t||"\uffe3"===t||"\ufe11"===t||"\ufe12"===t}function mu(t){return"\ufe35"===t||"\ufe47"===t||"\ufe37"===t||"\ufe43"===t||"\ufe41"===t||"\ufe3d"===t||"\ufe3b"===t||"\ufe39"===t||"\ufe17"===t||"\ufe3f"===t}var _u=function(t,e,i,r,n){var o,s,a=8*n-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?n-1:0,p=i?-1:1,d=t[e+u];for(u+=p,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+u],u+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+u],u+=p,h-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)},gu=function(t,e,i,r,n,o){var s,a,l,c=8*o-n-1,h=(1<<c)-1,u=h>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=h?(a=0,s=h):s+u>=1?(a=(e*l-1)*Math.pow(2,n),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),s=0));n>=8;t[i+d]=255&a,d+=f,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;t[i+d]=255&s,d+=f,s/=256,c-=8);t[i+d-f]|=128*m},yu=xu;function xu(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}xu.Varint=0,xu.Fixed64=1,xu.Bytes=2,xu.Fixed32=5;var vu=4294967296,bu=1/vu,wu="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Tu(t){return t.type===xu.Bytes?t.readVarint()+t.pos:t.pos+1}function Eu(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Su(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function Au(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Mu(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Iu(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Cu(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function zu(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Pu(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function ku(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Du(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Lu(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Bu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ru(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Fu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ou(t,e,i){e.glyphs=[],1===t&&i.readMessage(Uu,e)}function Uu(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Vu,{});e.glyphs.push({id:t,bitmap:new uc({width:n+6,height:o+6},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===t?e.ascender=i.readSVarint():5===t&&(e.descender=i.readSVarint())}function Vu(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function ju(t){let e=0,i=0;for(const s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,o=0;for(const s of t)for(let t=r.length-1;t>=0;t--){const e=r[t];if(!(s.w>e.w||s.h>e.h)){if(s.x=e.x,s.y=e.y,o=Math.max(o,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===e.w&&s.h===e.h){const e=r.pop();t<r.length&&(r[t]=e)}else s.h===e.h?(e.x+=s.w,e.w-=s.w):s.w===e.w?(e.y+=s.h,e.h-=s.h):(r.push({x:e.x+s.w,y:e.y,w:e.w-s.w,h:s.h}),e.y+=s.h,e.h-=s.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}xu.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Bu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fu(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Bu(this.buf,this.pos)+Bu(this.buf,this.pos+4)*vu;return this.pos+=8,t},readSFixed64:function(){var t=Bu(this.buf,this.pos)+Fu(this.buf,this.pos+4)*vu;return this.pos+=8,t},readFloat:function(){var t=_u(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=_u(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return Eu(t,r,e);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return Eu(t,r,e);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return Eu(t,r,e);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return Eu(t,r,e);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return Eu(t,r,e);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return Eu(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&wu?function(t,e,i){return wu.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n<i;){var o,s,a,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(o=t[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===h?(s=t[n+2],128==(192&(o=t[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(s=t[n+2],a=t[n+3],128==(192&(o=t[n+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==xu.Bytes)return t.push(this.readVarint(e));var i=Tu(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==xu.Bytes)return t.push(this.readSVarint());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==xu.Bytes)return t.push(this.readBoolean());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==xu.Bytes)return t.push(this.readFloat());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==xu.Bytes)return t.push(this.readDouble());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==xu.Bytes)return t.push(this.readFixed32());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==xu.Bytes)return t.push(this.readSFixed32());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==xu.Bytes)return t.push(this.readFixed64());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==xu.Bytes)return t.push(this.readSFixed64());var e=Tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===xu.Varint)for(;this.buf[this.pos++]>127;);else if(e===xu.Bytes)this.pos=this.readVarint()+this.pos;else if(e===xu.Fixed32)this.pos+=4;else{if(e!==xu.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ru(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ru(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ru(this.buf,-1&t,this.pos),Ru(this.buf,Math.floor(t*bu),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ru(this.buf,-1&t,this.pos),Ru(this.buf,Math.floor(t*bu),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Su(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),gu(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),gu(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&Su(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,xu.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Au,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Mu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,zu,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Iu,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Cu,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Pu,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ku,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Du,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Lu,e)},writeBytesField:function(t,e){this.writeTag(t,xu.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,xu.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,xu.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,xu.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,xu.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,xu.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,xu.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,xu.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,xu.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,xu.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class Nu{constructor(t,e){let{pixelRatio:i,version:r,stretchX:n,stretchY:o,content:s}=e;this.paddedRect=t,this.pixelRatio=i,this.stretchX=n,this.stretchY=o,this.content=s,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 Gu{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,i,n),this.addImages(e,r,n);const{w:o,h:s}=ju(n),a=new pc({width:o||1,height:s||1});for(const l in t){const e=t[l],r=i[l].paddedRect;pc.copy(e.data,a,{x:0,y:0},{x:r.x+1,y:r.y+1},e.data)}for(const l in e){const t=e[l],i=r[l].paddedRect,n=i.x+1,o=i.y+1,s=t.data.width,c=t.data.height;pc.copy(t.data,a,{x:0,y:0},{x:n,y:o},t.data),pc.copy(t.data,a,{x:0,y:c-1},{x:n,y:o-1},{width:s,height:1}),pc.copy(t.data,a,{x:0,y:0},{x:n,y:o+c},{width:s,height:1}),pc.copy(t.data,a,{x:s-1,y:0},{x:n-1,y:o},{width:1,height:c}),pc.copy(t.data,a,{x:0,y:0},{x:n+s,y:o},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const n=t[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),e[r]=new Nu(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(e))),t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}Dn(Nu,"ImagePosition"),Dn(Gu,"ImageAtlas");const Zu={horizontal:1,vertical:2,horizontalOnly:3};class qu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new qu;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new qu;return e.imageName=t,e}}class Wu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new Wu;for(let r=0;r<t.sections.length;r++){const n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(t){this.text=function(t,e){let i="";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,o=t.charCodeAt(r-1)||null;i+=!e&&(n&&go(n)&&!du[t[r+1]]||o&&go(o)&&!du[t[r-1]])||!du[t[r]]?t[r]:du[t[r]]}return i}(this.text,t)}trim(){let t=0;for(let i=0;i<this.text.length&&Hu[this.text.charCodeAt(i)];i++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&Hu[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new Wu;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(qu.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let r=0;r<t.text.length;++r)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void P("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(qu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):P("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Xu(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m){const _=Wu.fromFeature(t,n);let g;u===Zu.vertical&&_.verticalizePunctuation(p);const{processBidirectionalText:y,processStyledBidirectionalText:x}=ko;if(y&&1===_.sections.length){g=[];const t=y(_.toString(),ep(_,c,o,e,r,d,f));for(const e of t){const t=new Wu;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);g.push(t)}}else if(x){g=[];const t=x(_.text,_.sectionIndex,ep(_,c,o,e,r,d,f));for(const e of t){const t=new Wu;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,g.push(t)}}else g=function(t,e){const i=[],r=t.text;let n=0;for(const o of e)i.push(t.substring(n,o)),n=o;return n<r.length&&i.push(t.substring(n,r.length)),i}(_,ep(_,c,o,e,r,d,f));const v=[],b={positionedLines:v,text:_.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:u,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(t,e,i,r,n,o,s,a,l,c,h,u){let p=0,d=0,f=0;const m="right"===a?1:"left"===a?0:.5;let _=!1;for(const w of n){const t=w.getSections();for(const i of t){if(i.imageName)continue;const t=e[i.fontStack];if(t&&(_=void 0!==t.ascender&&void 0!==t.descender,!_))break}if(!_)break}let g=0;for(const w of n){w.trim();const n=w.getMaxScale(),s=(n-1)*su,a={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=a;const x=a.positionedGlyphs;let v=0;if(!w.length()){d+=o,++g;continue}let b=0,T=0;for(let o=0;o<w.length();o++){const s=w.getSection(o),a=w.getSectionIndex(o),f=w.getCharCode(o);let m=s.scale,g=null,E=null,S=null,A=su,M=0;const I=!(l===Zu.horizontal||!h&&!_o(f)||h&&(Hu[f]||(y=f,Un(y)||Vn(y)||jn(y)||so(y)||ho(y))));if(s.imageName){const e=r[s.imageName];if(!e)continue;S=s.imageName,t.iconsInText=t.iconsInText||!0,E=e.paddedRect;const i=e.displaySize;m=m*su/u,g={width:i[0],height:i[1],left:1,top:-3,advance:I?i[1]:i[0],localGlyph:!1},M=_?-g.height*m:n*su-17-i[1]*m,A=g.advance;const o=(I?i[0]:i[1])*m-su*n;o>0&&o>v&&(v=o)}else{const t=i[s.fontStack];if(!t)continue;t[f]&&(E=t[f]);const r=e[s.fontStack];if(!r)continue;const o=r.glyphs[f];if(!o)continue;if(g=o.metrics,A=8203!==f?su:0,_){const t=void 0!==r.ascender?Math.abs(r.ascender):0,e=void 0!==r.descender?Math.abs(r.descender):0,i=(t+e)*m;b<i&&(b=i,T=(t-e)/2*m),M=-t*m}else M=(n-m)*su-17}I?(t.verticalizable=!0,x.push({glyph:f,imageName:S,x:p,y:d+M,vertical:I,scale:m,localGlyph:g.localGlyph,fontStack:s.fontStack,sectionIndex:a,metrics:g,rect:E}),p+=A*m+c):(x.push({glyph:f,imageName:S,x:p,y:d+M,vertical:I,scale:m,localGlyph:g.localGlyph,fontStack:s.fontStack,sectionIndex:a,metrics:g,rect:E}),p+=g.advance*m+c)}0!==x.length&&(f=Math.max(p-c,f),_?rp(x,m,v,T,o*n/2):rp(x,m,v,0,o/2)),p=0;const E=o*n+v;a.lineOffset=Math.max(v,s),d+=E,++g}var y;const x=d,{horizontalAlign:v,verticalAlign:b}=ip(s);(function(t,e,i,r,n,o){const s=(e-i)*n,a=-o*r;for(const l of t)for(const t of l.positionedGlyphs)t.x+=s,t.y+=a})(t.positionedLines,m,v,b,f,x),t.top+=-b*x,t.bottom=t.top+x,t.left+=-v*f,t.right=t.left+f,t.hasBaseline=_}(b,e,i,r,g,s,a,l,u,c,p,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(v)&&b}const Hu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yu={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 Ku(t,e,i,r,n,o){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*su/o+n:0}{const r=i[e.fontStack],o=r&&r.glyphs[t];return o?o.metrics.advance*e.scale+n:0}}function Ju(t,e,i,r){const n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function Qu(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function $u(t,e,i,r,n,o){let s=null,a=Ju(e,i,n,o);for(const l of r){const t=Ju(e-l.x,i,n,o)+l.badness;t<=a&&(s=l,a=t)}return{index:t,x:e,priorBreak:s,badness:a}}function tp(t){return t?tp(t.priorBreak).concat(t.index):[]}function ep(t,e,i,r,n,o,s){if("point"!==o)return[];if(!t)return[];const a=[],l=function(t,e,i,r,n,o){let s=0;for(let a=0;a<t.length();a++){const i=t.getSection(a);s+=Ku(t.getCharCode(a),i,r,n,e,o)}return s/Math.max(1,Math.ceil(s/i))}(t,e,i,r,n,s),c=t.text.indexOf("\u200b")>=0;let h=0;for(let p=0;p<t.length();p++){const i=t.getSection(p),o=t.getCharCode(p);if(Hu[o]||(h+=Ku(o,i,r,n,e,s)),p<t.length()-1){const e=!((u=o)<11904||!(Yn(u)||Hn(u)||lo(u)||oo(u)||$n(u)||Nn(u)||Kn(u)||qn(u)||to(u)||eo(u)||Qn(u)||uo(u)||Wn(u)||Zn(u)||Gn(u)||Jn(u)||Xn(u)||ao(u)||ro(u)||io(u)));(Yu[o]||e||i.imageName)&&a.push($u(p+1,h,l,a,Qu(o,t.getCharCode(p+1),e&&c),!1))}}var u;return tp($u(t.length(),h,l,a,0,!0))}function ip(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function rp(t,e,i,r,n){if(!(e||i||r||n))return;const o=t.length-1,s=t[o],a=(s.x+s.metrics.advance*s.scale)*e;for(let l=0;l<=o;l++)t[l].x-=a,t[l].y+=i+r+n}function np(t,e,i){const{horizontalAlign:r,verticalAlign:n}=ip(i),o=e[0]-t.displaySize[0]*r,s=e[1]-t.displaySize[1]*n;return{image:t,top:s,bottom:s+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function op(t,e,i,r,n,o){const s=t.image;let a;if(s.content){const t=s.content,e=s.pixelRatio||1;a=[t[0]/e,t[1]/e,s.displaySize[0]-t[2]/e,s.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let h,u,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],u=n[0]+c+r[1]):(d=n[0]+(l+c-s.displaySize[0])/2,u=d+s.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===i||"both"===i?(h=n[1]+f-r[0],p=n[1]+m+r[2]):(h=n[1]+(f+m-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:u,bottom:p,left:d,collisionPadding:a}}class sp extends n{constructor(t,e,i,r,n){super(t,e),this.angle=r,this.z=i,void 0!==n&&(this.segment=n)}clone(){return new sp(this.x,this.y,this.z,this.angle,this.segment)}}function ap(t,e,i,r,n){if(void 0===e.segment)return!0;let o=e,s=e.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=t[s].dist(o),o=t[s]}a+=t[s].dist(t[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const e=t[s],i=t[s+1];if(!i)return!1;let o=t[s-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=e.dist(i)}return!0}function lp(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function cp(t,e,i){return t?.6*e*i:0}function hp(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function up(t,e,i,r,n,o){const s=cp(i,n,o),a=hp(i,r)*o;let l=0;const c=lp(t)/2;for(let h=0;h<t.length-1;h++){const i=t[h],r=t[h+1],n=i.dist(r);if(l+n>c){const o=(c-l)/n,u=yi(i.x,r.x,o),p=yi(i.y,r.y,o),d=new sp(u,p,0,r.angleTo(i),h);return!s||ap(t,d,a,s,e)?d:void 0}l+=n}}function pp(t,e,i,r,n,o,s,a,l){const c=cp(r,o,s),h=hp(r,n),u=h*s,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),dp(t,p?e/2*a%e:(h/2+2*o)*s*a%e,e,c,i,u,p,!1,l)}function dp(t,e,i,r,n,o,s,a,l){const c=o/2,h=lp(t);let u=0,p=e-i,d=[];for(let f=0;f<t.length-1;f++){const e=t[f],s=t[f+1],a=e.dist(s),m=s.angleTo(e);for(;p+i<u+a;){p+=i;const _=(p-u)/a,g=yi(e.x,s.x,_),y=yi(e.y,s.y,_);if(g>=0&&g<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const e=new sp(g,y,0,m,f);e._round(),r&&!ap(t,e,o,r,n)||d.push(e)}}u+=a}return a||d.length||s||(d=dp(t,u/2,i,r,n,o,s,!0,l)),d}function fp(t,e,i,r,o){const s=[];for(let a=0;a<t.length;a++){const l=t[a];let c;for(let t=0;t<l.length-1;t++){let a=l[t],h=l[t+1];a.x<e&&h.x<e||(a.x<e?a=new n(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x<e&&(h=new n(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y<i&&h.y<i||(a.y<i?a=new n(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round():h.y<i&&(h=new n(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round()),a.x>=r&&h.x>=r||(a.x>=r?a=new n(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x>=r&&(h=new n(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y>=o&&h.y>=o||(a.y>=o?a=new n(a.x+(o-a.y)/(h.y-a.y)*(h.x-a.x),o)._round():h.y>=o&&(h=new n(a.x+(o-a.y)/(h.y-a.y)*(h.x-a.x),o)._round()),c&&a.equals(c[c.length-1])||(c=[a],s.push(c)),c.push(h)))))}}return s}Dn(sp,"Anchor");const mp=1e20;function _p(t,e,i,r,n,o,s,a,l){for(let c=e;c<e+r;c++)gp(t,i*o+c,o,n,s,a,l);for(let c=i;c<i+n;c++)gp(t,c*o+e,1,r,s,a,l)}function gp(t,e,i,r,n,o,s){o[0]=0,s[0]=-mp,s[1]=mp,n[0]=t[e];for(let a=1,l=0,c=0;a<r;a++){n[a]=t[e+a*i];const r=a*a;do{const t=o[l];c=(n[a]-n[t]+r-t*t)/(a-t)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=mp}for(let a=0,l=0;a<r;a++){for(;s[l+1]<a;)l++;const r=o[l],c=a-r;t[e+a*i]=n[r]+c*c}}const yp={none:0,ideographs:1,all:2};class xp{constructor(t,e,i){this.requestManager=t,this.localGlyphMode=e,this.localFontFamily=i,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(t){this.url=t}getGlyphs(t,e){const i=[];for(const r in t)for(const e of t[r])i.push({stack:r,id:e});g(i,((t,e)=>{let{stack:i,id:r}=t,n=this.entries[i];n||(n=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=n.glyphs[r];if(void 0!==o)return void e(null,{stack:i,id:r,glyph:o});if(o=this._tinySDF(n,i,r),o)return n.glyphs[r]=o,void e(null,{stack:i,id:r,glyph:o});const s=Math.floor(r/256);if(256*s>65535)return void e(new Error("glyphs > 65535 not supported"));if(n.ranges[s])return void e(null,{stack:i,id:r,glyph:o});let a=n.requests[s];a||(a=n.requests[s]=[],xp.loadGlyphRange(i,s,this.url,this.requestManager,((t,e)=>{if(e){n.ascender=e.ascender,n.descender=e.descender;for(const t in e.glyphs)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e.glyphs[+t]);n.ranges[s]=!0}for(const i of a)i(t,e);delete n.requests[s]}))),a.push(((t,n)=>{t?e(t):n&&e(null,{stack:i,id:r,glyph:n.glyphs[r]||null})}))}),((t,i)=>{if(t)e(t);else if(i){const t={};for(const{stack:e,id:r,glyph:n}of i)void 0===t[e]&&(t[e]={}),void 0===t[e].glyphs&&(t[e].glyphs={}),t[e].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},t[e].ascender=this.entries[e].ascender,t[e].descender=this.entries[e].descender;e(null,t)}}))}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==yp.none&&(this.localGlyphMode===yp.all?!!this.localFontFamily:!!this.localFontFamily&&(eo(t)||no(t)||Wn(t)||Xn(t)||qn(t)))}_tinySDF(t,e,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=t.tinySDF;if(!n){let i="400";/bold/i.test(e)?i="900":/medium/i.test(e)?i="500":/light/i.test(e)&&(i="200"),n=t.tinySDF=new xp.TinySDF({fontFamily:r,fontWeight:i,fontSize:48,buffer:6,radius:16}),n.fontWeight=i}if(this.localGlyphs[n.fontWeight][i])return this.localGlyphs[n.fontWeight][i];const o=String.fromCharCode(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:h,glyphLeft:u,glyphTop:p,glyphAdvance:d}=n.draw(o);return this.localGlyphs[n.fontWeight][i]={id:i,bitmap:new uc({width:a,height:l},s),metrics:{width:c/2,height:h/2,left:u/2,top:p/2-27,advance:d/2,localGlyph:!0}}}}function vp(t,e,i,r){const o=[],s=t.image,a=s.pixelRatio,l=s.paddedRect.w-2,c=s.paddedRect.h-2,h=t.right-t.left,u=t.bottom-t.top,p=s.stretchX||[[0,l]],d=s.stretchY||[[0,c]],f=(t,e)=>t+e[1]-e[0],m=p.reduce(f,0),_=d.reduce(f,0),g=l-m,y=c-_;let x=0,v=m,b=0,w=_,T=0,E=g,S=0,A=y;if(s.content&&r){const t=s.content;x=bp(p,0,t[0]),b=bp(d,0,t[1]),v=bp(p,t[0],t[2]),w=bp(d,t[1],t[3]),T=t[0]-x,S=t[1]-b,E=t[2]-t[0]-v,A=t[3]-t[1]-w}const M=(r,o,l,c)=>{const p=Tp(r.stretch-x,v,h,t.left),d=Ep(r.fixed-T,E,r.stretch,m),f=Tp(o.stretch-b,w,u,t.top),g=Ep(o.fixed-S,A,o.stretch,_),y=Tp(l.stretch-x,v,h,t.left),M=Ep(l.fixed-T,E,l.stretch,m),I=Tp(c.stretch-b,w,u,t.top),C=Ep(c.fixed-S,A,c.stretch,_),z=new n(p,f),P=new n(y,f),k=new n(y,I),D=new n(p,I),L=new n(d/a,g/a),B=new n(M/a,C/a),R=e*Math.PI/180;if(R){const t=Math.sin(R),e=Math.cos(R),i=[e,-t,t,e];z._matMult(i),P._matMult(i),D._matMult(i),k._matMult(i)}const F=r.stretch+r.fixed,O=o.stretch+o.fixed;return{tl:z,tr:P,bl:D,br:k,tex:{x:s.paddedRect.x+1+F,y:s.paddedRect.y+1+O,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-O},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:B,minFontScaleX:E/a/h,minFontScaleY:A/a/u,isSDF:i}};if(r&&(s.stretchX||s.stretchY)){const t=wp(p,g,m),e=wp(d,y,_);for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)o.push(M(r,e[t],n,e[t+1]))}}else o.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}
1function bp(t,e,i){let r=0;for(const n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function wp(t,e,i){const r=[{fixed:-1,stretch:0}];for(const[n,o]of t){const t=r[r.length-1];r.push({fixed:n-t.stretch,stretch:t.stretch}),r.push({fixed:n-t.stretch,stretch:t.stretch+(o-n)})}return r.push({fixed:e+1,stretch:i}),r}function Tp(t,e,i,r){return t/e*i+r}function Ep(t,e,i,r){return t-e*i/r}function Sp(t,e,i,r){const n=e+t.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(e+t.positionedLines[r-1].lineOffset))/2}xp.loadGlyphRange=function(t,e,i,r,n){const o=256*e,s=o+255,a=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}","".concat(o,"-").concat(s)),It.Glyphs);kt(a,((t,e)=>{if(t)n(t);else if(e){const t={},i=function(t){return new yu(t).readFields(Ou,{})}(e);for(const e of i.glyphs)t[e.id]=e;n(null,{glyphs:t,ascender:i.ascender,descender:i.descender})}}))},xp.TinySDF=class{constructor(){let{fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.buffer=e,this.cutoff=r,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font="".concat(s," ").concat(o," ").concat(t,"px ").concat(n),c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),a=Math.min(this.size-this.buffer,Math.ceil(o-n)),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return d;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;f.clearRect(m,m,a,l),f.fillText(t,m,m+s);const y=f.getImageData(m,m,a,l);g.fill(mp,0,u),_.fill(0,0,u);for(let x=0;x<l;x++)for(let t=0;t<a;t++){const e=y.data[4*(x*a+t)+3]/255;if(0===e)continue;const i=(x+m)*c+t+m;if(1===e)g[i]=0,_[i]=mp;else{const t=.5-e;g[i]=t>0?t*t:0,_[i]=t<0?t*t:0}}_p(g,0,0,c,h,c,this.f,this.v,this.z),_p(_,m,m,a,l,c,this.f,this.v,this.z);for(let x=0;x<u;x++){const t=Math.sqrt(g[x])-Math.sqrt(_[x]);p[x]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}};class Ap{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mp;if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&i(e[s],o)<0&&(r=s,o=e[s]),i(o,n)>=0)break;e[t]=o,t=r}e[t]=n}}function Mp(t,e){return t<e?-1:t>e?1:0}function Ip(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=1/0,o=1/0,s=-1/0,a=-1/0;const l=t[0];for(let n=0;n<l.length;n++){const t=l[n];(!n||t.x<r)&&(r=t.x),(!n||t.y<o)&&(o=t.y),(!n||t.x>s)&&(s=t.x),(!n||t.y>a)&&(a=t.y)}const c=Math.min(s-r,a-o);let h=c/2;const u=new Ap([],Cp);if(0===c)return new n(r,o);for(let n=r;n<s;n+=c)for(let e=o;e<a;e+=c)u.push(new zp(n+h,e+h,h,t));let p=function(t){let e=0,i=0,r=0;const n=t[0];for(let o=0,s=n.length,a=s-1;o<s;a=o++){const t=n[o],s=n[a],l=t.x*s.y-s.x*t.y;i+=(t.x+s.x)*l,r+=(t.y+s.y)*l,e+=3*l}return new zp(i/e,r/e,0,t)}(t),d=u.length;for(;u.length;){const r=u.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(h=r.h/2,u.push(new zp(r.p.x-h,r.p.y-h,h,t)),u.push(new zp(r.p.x+h,r.p.y-h,h,t)),u.push(new zp(r.p.x-h,r.p.y+h,h,t)),u.push(new zp(r.p.x+h,r.p.y+h,h,t)),d+=4)}return i&&(console.log("num probes: ".concat(d)),console.log("best distance: ".concat(p.d))),p.p}function Cp(t,e){return e.max-t.max}
vendor: 13,536 bytes, line 1
1function zp(t,e,i,r){this.p=new n(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,s=n-1;e<n;s=e++){const n=o[e],a=o[s];n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,il(t,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}const Pp=Number.POSITIVE_INFINITY,kp=Math.sqrt(2);function Dp(t,e){return e[1]!==Pp?function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const n=e/kp;switch(t){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function Lp(t,e,i,r,n,o,s,a,l,c){t.createArrays(),t.tilePixelRatio=wa/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const h=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,p={};if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:i}=t.textSizeData;p.compositeTextSizes=[u["text-size"].possiblyEvaluate(new Do(e),a),u["text-size"].possiblyEvaluate(new Do(i),a)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:i}=t.iconSizeData;p.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new Do(e),a),u["icon-size"].possiblyEvaluate(new Do(i),a)]}p.layoutTextSize=u["text-size"].possiblyEvaluate(new Do(l+1),a),p.layoutIconSize=u["icon-size"].possiblyEvaluate(new Do(l+1),a),p.textMaxSize=u["text-size"].possiblyEvaluate(new Do(18),a);const d="map"===h.get("text-rotation-alignment")&&"point"!==h.get("symbol-placement"),f=h.get("text-size");for(const m of t.features){const o=h.get("text-font").evaluate(m,{},a).join(","),l=f.evaluate(m,{},a),u=p.layoutTextSize.evaluate(m,{},a),_=(p.layoutIconSize.evaluate(m,{},a),{horizontal:{},vertical:void 0}),g=m.text;let y,x=[0,0];if(g){const r=g.toString(),s=h.get("text-letter-spacing").evaluate(m,{},a)*su,c=h.get("text-line-height").evaluate(m,{},a)*su,p=fo(r)?s:0,f=h.get("text-anchor").evaluate(m,{},a),y=h.get("text-variable-anchor");if(!y){const t=h.get("text-radial-offset").evaluate(m,{},a);x=t?Dp(f,[t*su,Pp]):h.get("text-offset").evaluate(m,{},a).map((t=>t*su))}let v=d?"center":h.get("text-justify").evaluate(m,{},a);const b=h.get("symbol-placement"),w="point"===b,T="point"===b?h.get("text-max-width").evaluate(m,{},a)*su:0,E=s=>{t.allowVerticalPlacement&&po(r)&&(_.vertical=Xu(g,e,i,n,o,T,c,f,s,p,x,Zu.vertical,!0,b,u,l))};if(!d&&y){const t="auto"===v?y.map((t=>Bp(t))):[v];let r=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!_.horizontal[a])if(r)_.horizontal[a]=_.horizontal[0];else{const t=Xu(g,e,i,n,o,T,c,"center",a,p,x,Zu.horizontal,!1,b,u,l);t&&(_.horizontal[a]=t,r=1===t.positionedLines.length)}}E("left")}else{if("auto"===v&&(v=Bp(f)),w||h.get("text-writing-mode").indexOf("horizontal")>=0||!po(r)){const t=Xu(g,e,i,n,o,T,c,f,v,p,x,Zu.horizontal,!1,b,u,l);t&&(_.horizontal[v]=t)}E("point"===b?"left":v)}}let v=!1;if(m.icon&&m.icon.name){const e=r[m.icon.name];e&&(y=np(n[m.icon.name],h.get("icon-offset").evaluate(m,{},a),h.get("icon-anchor").evaluate(m,{},a)),v=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&P("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.pixelRatio||0!==h.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}const b=Up(_.horizontal)||_.vertical;t.iconsInText||(t.iconsInText=!!b&&b.iconsInText),(b||y)&&Rp(t,m,_,y,r,p,u,0,x,v,s,a,c)}o&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray)}function Bp(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Rp(t,e,i,r,n,o,s,a,c,h,u,p,d){let f=o.textMaxSize.evaluate(e,{},p);void 0===f&&(f=s);const m=t.layers[0].layout,_=m.get("icon-offset").evaluate(e,{},p),g=Up(i.horizontal)||i.vertical,y="globe"===d.name,x=s/24,v=t.tilePixelRatio*f/24,b=(C=t.overscaling,t.zoom>18&&C>2&&(C>>=1),Math.max(wa/(512*C),1)*m.get("symbol-spacing")),w=m.get("text-padding")*t.tilePixelRatio,T=m.get("icon-padding")*t.tilePixelRatio,E=l(m.get("text-max-angle")),S="map"===m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),A="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),M=m.get("symbol-placement"),I=b/2;var C;const z=m.get("icon-text-fit");let k;r&&"none"!==z&&(t.allowVerticalPlacement&&i.vertical&&(k=op(r,i.vertical,z,m.get("icon-text-fit-padding"),_,x)),g&&(r=op(r,g,z,m.get("icon-text-fit-padding"),_,x)));const D=(s,a,l)=>{if(a.x<0||a.x>=wa||a.y<0||a.y>=wa)return;let f=null;if(y){const{x:t,y:e,z:i}=d.projectTilePoint(a.x,a.y,l);f={anchor:new sp(t,e,i,0,void 0),up:d.upVector(l,a.x,a.y)}}!function(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x,v,b,w,T,E){const S=t.addToLineVertexArray(e,r);let A,M,I,C,z,k,D,L=0,B=0,R=0,F=0,O=-1,U=-1;const V={};let j=qs("");const N=i?i.anchor:e;let G=0,Z=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[G,Z]=l.layout.get("text-offset").evaluate(v,{},E).map((t=>t*su)):(G=l.layout.get("text-radial-offset").evaluate(v,{},E)*su,Z=Pp),t.allowVerticalPlacement&&n.vertical){const t=n.vertical;if(f)k=jp(t),a&&(D=jp(a));else{const i=l.layout.get("text-rotate").evaluate(v,{},E)+90;I=Vp(c,N,e,h,u,p,t,d,i,m),a&&(C=Vp(c,N,e,h,u,p,a,g,i))}}if(o){const r=l.layout.get("icon-rotate").evaluate(v,{},E),n="none"!==l.layout.get("icon-text-fit"),s=vp(o,r,w,n),d=a?vp(a,r,w,n):void 0;M=Vp(c,N,e,h,u,p,o,g,r),L=4*s.length;const f=t.iconSizeData;let m=null;"source"===f.kind?(m=[au*l.layout.get("icon-size").evaluate(v,{},E)],m[0]>Fp&&P("".concat(t.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".'))):"composite"===f.kind&&(m=[au*b.compositeIconSizes[0].evaluate(v,{},E),au*b.compositeIconSizes[1].evaluate(v,{},E)],(m[0]>Fp||m[1]>Fp)&&P("".concat(t.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".'))),t.addSymbols(t.icon,s,m,x,y,v,!1,i,e,S.lineStartIndex,S.lineLength,-1,T,E),O=t.icon.placedSymbolArray.length-1,d&&(B=4*d.length,t.addSymbols(t.icon,d,m,x,y,v,Zu.vertical,i,e,S.lineStartIndex,S.lineLength,-1,T,E),U=t.icon.placedSymbolArray.length-1)}for(const P in n.horizontal){const r=n.horizontal[P];A||(j=qs(r.text),f?z=jp(r):A=Vp(c,N,e,h,u,p,r,d,l.layout.get("text-rotate").evaluate(v,{},E),m));const o=1===r.positionedLines.length;if(R+=Op(t,i,e,r,s,l,f,v,m,S,n.vertical?Zu.horizontal:Zu.horizontalOnly,o?Object.keys(n.horizontal):[P],V,O,b,T,E),o)break}n.vertical&&(F+=Op(t,i,e,n.vertical,s,l,f,v,m,S,Zu.vertical,["vertical"],V,U,b,T,E));let q=-1;const W=(t,e)=>t?Math.max(t,e):e;q=W(z,q),q=W(k,q),q=W(D,q);const X=q>-1?1:0;t.glyphOffsetArray.length>=Qd.MAX_GLYPHS&&P("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey),t.symbolInstances.emplaceBack(N.x,N.y,N.z,e.x,e.y,V.right>=0?V.right:-1,V.center>=0?V.center:-1,V.left>=0?V.left:-1,V.vertical>=0?V.vertical:-1,O,U,j,void 0!==A?A:t.collisionBoxArray.length,void 0!==A?A+1:t.collisionBoxArray.length,void 0!==I?I:t.collisionBoxArray.length,void 0!==I?I+1:t.collisionBoxArray.length,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,C||t.collisionBoxArray.length,C?C+1:t.collisionBoxArray.length,h,R,F,L,B,X,0,G,Z,q)}(t,a,f,s,i,r,n,k,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,w,S,c,0,T,A,_,e,o,h,u,p)};if("line"===M)for(const l of fp(e.geometry,0,0,wa,wa)){const e=pp(l,b,E,i.vertical||g,r,24,v,t.overscaling,wa);for(const i of e){const e=g;e&&Np(t,e.text,I,i)||D(l,i,p)}}else if("line-center"===M){for(const l of e.geometry)if(l.length>1){const t=up(l,E,i.vertical||g,r,24,v);t&&D(l,t,p)}}else if("Polygon"===e.type)for(const l of Kc(e.geometry,0)){const t=Ip(l,16);D(l[0],new sp(t.x,t.y,0,0,void 0),p)}else if("LineString"===e.type)for(const l of e.geometry)D(l,new sp(l[0].x,l[0].y,0,0,void 0),p);else if("Point"===e.type)for(const l of e.geometry)for(const t of l)D([t],new sp(t.x,t.y,0,0,void 0),p)}const Fp=32640;function Op(t,e,i,r,o,s,a,l,c,h,u,p,d,f,m,_,g){const y=function(t,e,i,r,o,s,a,l){const c=[];if(0===e.positionedLines.length)return c;const h=r.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=function(t){const e=t[0],i=t[1],r=e*i;return r>0?[e,-i]:r<0?[-e,i]:0===e?[i,e]:[i,-e]}(i);let p=Math.abs(e.top-e.bottom);for(const n of e.positionedLines)p-=n.lineOffset;const d=e.positionedLines.length,f=p/d;let m=e.top-i[1];for(let _=0;_<d;++_){const t=e.positionedLines[_];m=Sp(e,f,m,_);for(const r of t.positionedGlyphs){if(!r.rect)continue;const t=r.rect||{};let s=4,p=!0,d=1,f=0;if(r.imageName){const t=a[r.imageName];if(!t)continue;if(t.sdf){P("SDF images are not supported in formatted text and will be ignored.");continue}p=!1,d=t.pixelRatio,s=1/d}const _=(o||l)&&r.vertical,g=r.metrics.advance*r.scale/2,y=r.metrics,x=r.rect;if(null===x)continue;l&&e.verticalizable&&(f=r.imageName?g-r.metrics.width*r.scale/2:0);const v=o?[r.x+g,r.y]:[0,0];let b=[0,0],w=[0,0],T=!1;o||(_?(w=[r.x+g+u[0],r.y+u[1]-f],T=!0):b=[r.x+g+i[0],r.y+i[1]-f]);const E=x.w*r.scale/(d*(r.localGlyph?2:1)),S=x.h*r.scale/(d*(r.localGlyph?2:1));let A,M,I,C;if(_){const t=r.y-m,e=new n(-g,g-t),i=-Math.PI/2,o=new n(...w);A=new n(-g+b[0],b[1]),A._rotateAround(i,e)._add(o),A.x+=-t+g,A.y-=(y.left-s)*r.scale;const a=r.imageName?y.advance*r.scale:su*r.scale,l=String.fromCharCode(r.glyph);fu(l)?A.x+=(1-s)*r.scale:mu(l)?A.x+=a-y.height*r.scale+(-s-1)*r.scale:A.x+=r.imageName||y.width+2*s===x.w&&y.height+2*s===x.h?(a-S)/2:(a-(y.height+2*s)*r.scale)/2,M=new n(A.x,A.y-E),I=new n(A.x+S,A.y),C=new n(A.x+S,A.y-E)}else{const t=(y.left-s)*r.scale-g+b[0],e=(-y.top-s)*r.scale+b[1],i=t+E,o=e+S;A=new n(t,e),M=new n(i,e),I=new n(t,o),C=new n(i,o)}if(h){let t;t=o?new n(0,0):T?new n(u[0],u[1]):new n(i[0],i[1]),A._rotateAround(h,t),M._rotateAround(h,t),I._rotateAround(h,t),C._rotateAround(h,t)}const z=new n(0,0),k=new n(0,0);c.push({tl:A,tr:M,bl:I,br:C,tex:t,writingMode:e.writingMode,glyphOffset:v,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:z,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}}return c}(0,r,c,s,a,l,o,t.allowVerticalPlacement),x=t.textSizeData;let v=null;"source"===x.kind?(v=[au*s.layout.get("text-size").evaluate(l,{},g)],v[0]>Fp&&P("".concat(t.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".'))):"composite"===x.kind&&(v=[au*m.compositeTextSizes[0].evaluate(l,{},g),au*m.compositeTextSizes[1].evaluate(l,{},g)],(v[0]>Fp||v[1]>Fp)&&P("".concat(t.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".'))),t.addSymbols(t.text,y,v,c,a,l,u,e,i,h.lineStartIndex,h.lineLength,f,_,g);for(const n of p)d[n]=t.text.placedSymbolArray.length-1;return 4*y.length}function Up(t){for(const e in t)return t[e];return null}function Vp(t,e,i,r,o,s,a,c,h,u){let p=a.top,d=a.bottom,f=a.left,m=a.right;const _=a.collisionPadding;if(_&&(f-=_[0],p-=_[1],m+=_[2],d+=_[3]),h){const t=new n(f,p),e=new n(m,p),i=new n(f,d),r=new n(m,d),o=l(h);let s=new n(0,0);u&&(s=new n(u[0],u[1])),t._rotateAround(o,s),e._rotateAround(o,s),i._rotateAround(o,s),r._rotateAround(o,s),f=Math.min(t.x,e.x,i.x,r.x),m=Math.max(t.x,e.x,i.x,r.x),p=Math.min(t.y,e.y,i.y,r.y),d=Math.max(t.y,e.y,i.y,r.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,f,p,m,d,c,r,o,s),t.length-1}function jp(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Np(t,e,i,r){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}const Gp=Qo([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Zp}=Gp,qp=Qo([{name:"a_pos_3",components:3,type:"Int16"}]);var Wp=Qo([{name:"a_pos",type:"Int16",components:2}]);const Xp=wa/Math.PI/2,Hp=2*za(1,0)*Xp*Math.PI,Yp=[64,32,16],Kp=-Xp,Jp=Xp,Qp=[new ec([Kp,Kp,Kp],[Jp,Jp,Jp]),new ec([Kp,Kp,Kp],[0,0,Jp]),new ec([0,Kp,Kp],[Jp,0,Jp]),new ec([Kp,0,Kp],[0,Jp,Jp]),new ec([0,0,Kp],[Jp,Jp,Jp])];function $p(t,e,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const n=Bl([],t._camera.position,t.worldSize),o=[e,i,1,1];Xl(o,o,t.pixelMatrixInverse),Wl(o,o,1/o[3]);const s=Fl([],Gl([],o,n)),a=t.globeMatrix,l=[a[12],a[13],a[14]],h=Gl([],l,n),u=Il(h),p=Fl([],h),d=t.worldSize/(2*Math.PI),m=Ol(p,s),_=Math.asin(d/u);if(_<Math.acos(m)){if(!r)return null;const t=[],e=[];Bl(t,s,u/m),Fl(e,Gl(e,t,h)),Fl(s,zl(s,h,Bl(s,e,Math.tan(_)*u)))}const g=[];new Ql(n,s).closestPointOnSphere(l,d,g);const y=Fl([],U(a,0)),x=Fl([],U(a,1)),v=Fl([],U(a,2)),b=Ol(y,g),w=Ol(x,g),T=Ol(v,g),E=c(Math.asin(-w/d));let S=c(Math.atan2(b,T));S=t.center.lng+function(t,e){const i=(e-t+180)%360-180;return i<-180?i+360:i}(t.center.lng,S);const A=Ia(S),M=f(Ca(E),0,1);return new Ra(A,M)}class td{constructor(t,e,i){this.a=Gl([],t,i),this.b=Gl([],e,i),this.center=i;const r=Fl([],this.a),n=Fl([],this.b);this.angle=Math.acos(Ol(r,n))}}function ed(t,e){if(0===t.angle)return null;let i;return i=0===t.a[e]?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),i<0||i>
11?null:function(t,e,i,r){const n=Math.sin(i);return t*(Math.sin((1-r)*i)/n)+e*(Math.sin(r*i)/n)}(t.a[e],t.b[e],t.angle,f(i,0,1))+t.center[e]}function id(t){if(t.z<=1)return Qp[t.z+2*t.y+t.x];const e=ad(sd(t));return ec.fromPoints(e)}function rd(t,e){const i=_d(e.zoom);if(0===i)return id(t);const r=sd(t),n=ad(r),o=Ia(r.getWest())*e.worldSize,s=Ia(r.getEast())*e.worldSize,a=Ca(r.getNorth())*e.worldSize,l=Ca(r.getSouth())*e.worldSize,c=[o,a,0],h=[s,a,0],u=[o,l,0],p=[s,l,0],d=gl([],e.globeMatrix);return Vl(c,c,d),Vl(h,h,d),Vl(u,u,d),Vl(p,p,d),n[0]=xi(n[0],u,i),n[1]=xi(n[1],p,i),n[2]=xi(n[2],h,i),n[3]=xi(n[3],c,i),ec.fromPoints(n)}function nd(t,e,i,r,n){for(const o of i)Vl(o,o,r),Bl(o,o,n),Dl(t,t,o),Ll(e,e,o)}function od(t,e,i){const r=e/t.worldSize,n=Number.MAX_VALUE,o=[-n,-n,-n],s=[n,n,n],a=t.globeMatrix;if(i.z<=1)return nd(s,o,id(i).getCorners(),a,r),new ec(s,o);const c=sd(i),h=ad(c);if(nd(s,o,h,a,r),c.contains(t.center)){o[2]=0;const e=t.point,i=[e.x*r,e.y*r,0];return Dl(s,s,i),Ll(o,o,i),new ec(s,o)}const u=[a[12]*r,a[13]*r,a[14]*r],p=c.getCenter(),d=f(t.center.lat,-85.051129,La),m=f(p.lat,-85.051129,La),_=Ia(t.center.lng),g=Ca(d);let y=_-Ia(p.lng);const x=g-Ca(m);y>.5?y-=1:y<-.5&&(y+=1);let v=0;Math.abs(y)>Math.abs(x)?v=y>=0?1:3:(v=x>=0?0:2,Rl(u,u,[a[4]*r,a[5]*r,a[6]*r],-Math.sin(l(x>=0?c.getSouth():c.getNorth()))*Xp));const b=h[v],w=h[(v+1)%4],T=new td(b,w,u),E=[ed(T,0)||b[0],ed(T,1)||b[1],ed(T,2)||b[2]];return s[2]=Math.min(b[2],w[2]),Dl(s,s,E),Ll(o,o,E),new ec(s,o)}function sd(t){let{x:e,y:i,z:r}=t;const n=1/(1<<r),o=new Sa(Pa(e*n),ka((i+1)*n)),s=new Sa(Pa((e+1)*n),ka(i*n));return new Ta(o,s)}function ad(t){const e=l(t.getNorth()),i=l(t.getSouth()),r=Math.cos(e),n=Math.cos(i),o=Math.sin(e),s=Math.sin(i),a=t.getWest(),c=t.getEast();return[ld(n,s,a),ld(n,s,c),ld(r,o,c),ld(r,o,a)]}function ld(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Xp;return i=l(i),[t*Math.sin(i)*r,-e*r,t*Math.cos(i)*r]}function cd(t,e,i){return ld(Math.cos(l(t)),Math.sin(l(t)),e,i)}function hd(t,e,i,r){const n=1<<i.z,o=(t/wa+i.x)/n;return cd(ka((e/wa+i.y)/n),Pa(o),r)}function ud(t){let{min:e,max:i}=t;return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}const pd=new Float64Array(16);function dd(t){const e=ud(t),i=Tl(pd,[e,e,e]);return xl(i,i,((r=[])[0]=-(n=t.min)[0],r[1]=-n[1],r[2]=-n[2],r));var r,n}function fd(t){const e=(r=t.min,(i=pd)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=r[0],i[13]=r[1],i[14]=r[2],i[15]=1,i);var i,r;const n=1/ud(t);return vl(e,e,[n,n,n])}function md(t,e,i,r,n){const o=function(t){const e=wa/(2*Math.PI);return t/(2*Math.PI)/e}(i),s=[t,e,-i/(2*Math.PI)],a=_l(new Float64Array(16));return xl(a,a,s),vl(a,a,[o,o,o]),bl(a,a,l(-n)),wl(a,a,l(-r)),a}function _d(t){return m(5,6,t)}function gd(t,e){const i=cd(e.lat,e.lng);return o=(r=Pl([],function(t){const e=cd(t._center.lat,t._center.lng);let i=Ul([],Cl(0,1,0),e);const r=El([],-t.angle,e);i=Vl(i,i,r),El(r,-t._pitch,i);const n=Fl([],e);return Bl(n,n,t.cameraToCenterDistance/t.pixelsPerMeter*Hp),Vl(n,n,r),zl([],e,n)}(t),i))[0],s=r[1],a=r[2],l=(n=i)[0],c=n[1],h=n[2],p=(u=Math.sqrt(o*o+s*s+a*a)*Math.sqrt(l*l+c*c+h*h))&&Ol(r,n)/u,Math.acos(Math.min(Math.max(p,-1),1));var r,n,o,s,a,l,c,h,u,p}const yd=l(85),xd=Math.cos(yd),vd=Math.sin(yd);function bd(t,e){const i=t.fovAboveCenter,r=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,n=(t._camera.position[2]*t.worldSize-r)/Math.cos(t._pitch),o=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-t._pitch-i,.01)),s=Math.sin(t._pitch)*o+n;return Math.min(1.01*s,n*(1/t._horizonShift))}function wd(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const i=Math.pow(2,-t.z),r=t.x*i,n=(t.x+1)*i,o=t.y*i,s=(t.y+1)*i,a=Pa(r),l=Pa(n),c=ka(o),h=ka(s),u=e.project(a,c),p=e.project(l,c),d=e.project(l,h),f=e.project(a,h);let m=Math.min(u.x,p.x,d.x,f.x),_=Math.min(u.y,p.y,d.y,f.y),g=Math.max(u.x,p.x,d.x,f.x),y=Math.max(u.y,p.y,d.y,f.y);const x=i/16;function v(t,i,r,n,o,s){const a=(r+o)/2,l=(n+s)/2,c=e.project(Pa(a),ka(l)),h=Math.max(0,m-c.x,_-c.y,c.x-g,c.y-y);m=Math.min(m,c.x),g=Math.max(g,c.x),_=Math.min(_,c.y),y=Math.max(y,c.y),h>x&&(v(t,c,r,n,a,l),v(c,i,a,l,o,s))}v(u,p,r,o,n,o),v(p,d,n,o,n,s),v(d,f,n,s,r,s),v(f,u,r,s,r,o),m-=x,_-=x,g+=x,y+=x;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:e}}const Td=_l(new Float32Array(16));class Ed{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(t,e){return{x:0,y:0,z:0}}unproject(t,e){return new Sa(0,0)}projectTilePoint(t,e,i){return{x:t,y:e,z:0}}locationPoint(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t._coordinatePoint(t.locationCoordinate(e),i)}pixelsPerMeter(t,e){return za(1,t)*e}pixelSpaceConversion(t,e,i){return 1}farthestPixelDistance(t){return bd(t,t.pixelsPerMeter)}pointCoordinate(t,e,i,r){const o=t.horizonLineFromTop(!1),s=new n(e,Math.max(o,i));return t.rayIntersectionCoordinate(t.pointRayIntersection(s,r))}
vendor: 102,894 bytes, line 1
1pointCoordinate3D(t,e,i){const r=new n(e,i);if(t.elevation)return t.elevation.pointCoordinate(r);{const e=this.pointCoordinate(t,r.x,r.y,0);return[e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation)return!this.pointCoordinate3D(t,e.x,e.y);const i=t.horizonLineFromTop();return e.y<i}createInversionMatrix(t,e){return Td}createTileMatrix(t,e,i){let r,n,o;const s=i.canonical,a=_l(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=wd(s,this);r=1,n=l.x+i.wrap*l.scale,o=l.y,vl(a,a,[r/l.scale,r/l.scale,t.pixelsPerMeter/e])}else r=e/t.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return xl(a,a,[n,o,0]),vl(a,a,[r/wa,r/wa,1]),a}upVector(t,e,i){return[0,0,1]}upVectorScale(t,e,i){return{metersToTile:1}}}class Sd extends Ed{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[e,i]=this.parallels=t.parallels||[29.5,45.5],r=Math.sin(l(e));this.n=(r+Math.sin(l(i)))/2,this.c=1+r*(2*this.n-r),this.r0=Math.sqrt(this.c)/this.n}project(t,e){const{n:i,c:r,r0:n}=this,o=l(t-this.center[0]),s=l(e),a=Math.sqrt(r-2*i*Math.sin(s))/i;return{x:a*Math.sin(o*i),y:a*Math.cos(o*i)-n,z:0}}unproject(t,e){const{n:i,c:r,r0:n}=this,o=n+e;let s=Math.atan2(t,Math.abs(o))*Math.sign(o);o*i<0&&(s-=Math.PI*Math.sign(t)*Math.sign(o));const a=l(this.center[0])*i;s=_(s,-Math.PI-a,Math.PI-a);const h=c(s/i)+this.center[0],u=Math.asin(f((r-(t*t+o*o)*i*i)/(2*i),-1,1)),p=f(c(u),-85.051129,La);return new Sa(h,p)}}const Ad=1.340264,Md=-.081106,Id=893e-6,Cd=.003796,zd=Math.sqrt(3)/2;class Pd extends Ed{project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const i=Math.asin(zd*Math.sin(e)),r=i*i,n=r*r*r;return{x:.5*(t*Math.cos(i)/(zd*(Ad+3*Md*r+n*(7*Id+9*Cd*r)))/Math.PI+.5),y:1-.5*(i*(Ad+Md*r+n*(Id+Cd*r))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let i=e=(2*(1-e)-1)*Math.PI,r=i*i,n=r*r*r;for(let c,h,u,p=0;p<12&&(h=i*(Ad+Md*r+n*(Id+Cd*r))-e,u=Ad+3*Md*r+n*(7*Id+9*Cd*r),c=h/u,i=f(i-c,-Math.PI/3,Math.PI/3),r=i*i,n=r*r*r,!(Math.abs(c)<1e-12));++p);const o=zd*t*(Ad+3*Md*r+n*(7*Id+9*Cd*r))/Math.cos(i),s=Math.asin(Math.sin(i)/zd),a=f(180*o/Math.PI,-180,180),l=f(180*s/Math.PI,-85.051129,La);return new Sa(a,l)}}class kd extends Ed{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){return{x:.5+t/360,y:.5-e/360,z:0}}unproject(t,e){const i=360*(t-.5),r=f(360*(.5-e),-85.051129,La);return new Sa(i,r)}}const Dd=Math.PI/2;function Ld(t){return Math.tan((Dd+t)/2)}class Bd extends Ed{constructor(t){super(t),this.center=t.center||[0,30];const[e,i]=this.parallels=t.parallels||[30,30],r=l(e),n=l(i),o=Math.cos(r);this.n=r===n?Math.sin(r):Math.log(o/Math.cos(n))/Math.log(Ld(n)/Ld(r)),this.f=o*Math.pow(Ld(r),this.n)/this.n}project(t,e){e=l(e),t=l(t-this.center[0]);const i=1e-6,{n:r,f:n}=this;n>0?e<-Dd+i&&(e=-Dd+i):e>Dd-i&&(e=Dd-i);const o=n/Math.pow(Ld(e),r),s=o*Math.sin(r*t),a=n-o*Math.cos(r*t);return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+.5),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,e=(2*(1-e)-.5)*Math.PI;const{n:i,f:r}=this,n=r-e,o=Math.sign(n),s=Math.sign(i)*Math.sqrt(t*t+n*n);let a=Math.atan2(t,Math.abs(n))*o;n*i<0&&(a-=Math.PI*Math.sign(t)*o);const l=f(c(a/i)+this.center[0],-180,180),h=f(c(2*Math.atan(Math.pow(r/s,1/i))-Dd),-85.051129,La);return new Sa(l,h)}}class Rd extends Ed{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,e){return{x:Ia(t),y:Ca(e),z:0}}unproject(t,e){const i=Pa(t),r=ka(e);return new Sa(i,r)}}const Fd=l(La);class Od extends Ed{project(t,e){const i=(e=l(e))*e,r=i*i;return{x:.5*((t=l(t))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let i=e=(2*(1-e)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const t=o*o;n=(i*(1.007226+o*(.015085+t*(.028874*o-.044475-.005916*t)))-e)/(1.007226+o*(.045255+t*(.259866*o-.311325-.005916*11*t))),i=f(i-n,-Fd,Fd)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const s=f(c(t/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=c(i);return new Sa(s,a)}}const Ud=l(La);class Vd extends Ed{project(t,e){e=l(e),t=l(t);const i=Math.cos(e),r=2/Math.PI,n=Math.acos(i*Math.cos(t/2)),o=Math.sin(n)/n,s=.5*(t*r+2*i*Math.sin(t/2)/o)||0,a=.5*(e+Math.sin(e)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(t,e){let i=t=(2*t-.5)*Math.PI,r=e=(2*(1-e)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,h=n*n,u=Math.cos(i/2),p=Math.sin(i/2),d=2*u*p,m=p*p,_=1-h*u*u,g=_?1/_:0,y=_?Math.acos(n*u)*Math.sqrt(1/_):0,x=.5*(2*y*n*p+2*i/Math.PI)-t,v=.5*(y*o+r)-e,b=.5*g*(h*m+y*n*u*c)+1/Math.PI,w=g*(d*l/4-y*o*p),T=.125*g*(l*p-y*o*h*d),E=.5*g*(c*u+y*m*n)+.5,S=w*T-E*b;s=(v*w-x*E)/S,a=(x*T-v*b)/S,i=f(i-s,-Math.PI,Math.PI),r=f(r-a,-Ud,Ud)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new Sa(c(i),c(r))}}class jd extends Ed{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(l(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){const{scale:i,cosPhi:r}=this;return{x:l(t)*r*i+.5,y:-Math.sin(l(e))/r*i+.5,z:0}}unproject(t,e){const{scale:i,cosPhi:r}=this,n=-(e-.5)/i,o=f(c((t-.5)/i)/r,-180,180),s=Math.asin(f(n*r,-1,1)),a=f(c(s),-85.051129,La);return new Sa(o,a)}}class Nd extends Rd{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(t,e,i){const r=hd(t,e,i);return Vl(r,r,dd(id(i))),{x:r[0],y:r[1],z:r[2]}}locationPoint(t,e){const i=cd(e.lat,e.lng),r=Fl([],i),o=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;Rl(i,i,r,za(1,0)*wa*o);const s=_l(new Float64Array(16));return yl(s,t.pixelMatrix,t.globeMatrix),Vl(i,i,s),new n(i[0],i[1])}pixelsPerMeter(t,e){return za(1,0)*e}pixelSpaceConversion(t,e,i){const r=yi(za(1,45)*e,za(1,t)*e,i);return this.pixelsPerMeter(t,e)/r}createTileMatrix(t,e,i){const r=fd(id(i.canonical));return yl(new Float64Array(16),t.globeMatrix,r)}createInversionMatrix(t,e){const{center:i}=t,r=dd(id(e));return wl(r,r,l(i.lng)),bl(r,r,l(i.lat)),vl(r,r,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(r)}pointCoordinate(t,e,i,r){return $p(t,e,i,!0)||new Ra(0,0)}pointCoordinate3D(t,e,i){const r=this.pointCoordinate(t,e,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(t,e){return!$p(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const i=t.cameraToCenterDistance,r=t._centerAltitude*e,n=t._camera,o=t._camera.forward(),s=zl([],Bl([],o,-i),[0,0,r]),a=t.worldSize/(2*Math.PI),l=[0,0,-a],c=t.width/t.height,h=Math.tan(t.fovAboveCenter),u=Bl([],n.up(),h),p=Bl([],n.right(),h*c),d=Fl([],zl([],zl([],o,u),p)),f=[];let m;if(new Ql(s,d).closestPointOnSphere(l,a,f)){const e=zl([],f,l),i=Gl([],e,s);m=Math.cos(t.fovAboveCenter)*Il(i)}else{const t=Gl([],s,l),e=Gl([],l,s);Fl(e,e);const i=Il(t)-a;m=Math.sqrt(i*(i+2*a));const r=Math.acos(m/(a+i))-Math.acos(Ol(o,e));m*=Math.cos(r)}return 1.01*m}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),i=_d(t.zoom);if(i>0){const r=bd(t,za(1,t.center.lat)*t.worldSize),n=t.worldSize/(2*Math.PI),o=Math.max(t.width,t.height)/t.worldSize*Math.PI;return yi(e,r+n*(1-Math.cos(o)),Math.pow(i,10))}return e}upVector(t,e,i){return hd(e,i,t,1)}upVectorScale(t){return{metersToTile:Hp*ud(id(t))}}}function Gd(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Rd(t);case"equirectangular":return new kd(t);case"naturalEarth":return new Od(t);case"equalEarth":return new Pd(t);case"winkelTripel":return new Vd(t);case"albers":return i?new jd(t):new Sd(t);case"lambertConformalConic":return i?new jd(t):new Bd(t);case"globe":return new Nd(t)}throw new Error("Invalid projection name: ".concat(t.name))}const Zd=mh.VectorTileFeature.types,qd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Wd(t,e,i,r,n,o,s,a,l,c,h,u,p){const d=a?Math.min(Fp,Math.round(a[0])):0,f=a?Math.min(Fp,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,s,(d<<1)+(l?1:0),f,16*c,16*h,256*u,256*p)}function Xd(t,e,i,r,n,o,s){t.emplaceBack(e,i,r,n,o,s)}function Hd(t,e,i,r,n){t.emplaceBack(e,i,r,n),t.emplaceBack(e,i,r,n),t.emplaceBack(e,i,r,n),t.emplaceBack(e,i,r,n)}function Yd(t){for(const e of t.sections)if(vo(e.text))return!0;return!1}class Kd{constructor(t){this.layoutVertexArray=new ls,this.indexArray=new _s,this.programConfigurations=t,this.segments=new ba,this.dynamicLayoutVertexArray=new ns,this.opacityVertexArray=new hs,this.placedSymbolArray=new zs,this.globeExtVertexArray=new cs}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$h.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,eu.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,qd,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,tu.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Dn(Kd,"SymbolBuffers");class Jd{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new ba,this.collisionVertexArray=new fs,this.collisionVertexArrayExt=new ms}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,iu.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,ru.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Dn(Jd,"CollisionBuffers");class Qd{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_l([]),this.placementViewportMatrix=_l([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=lu(this.zoom,e["text-size"]),this.iconSizeData=lu(this.zoom,e["icon-size"]);const i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==r.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((t=>Zu[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection}createArrays(){this.text=new Kd(new ua(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Kd(new ua(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Ds,this.lineVertexArray=new Ls,this.symbolInstances=new ks}calculateGlyphDependencies(t,e,i,r,n){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,r&&n){const i=du[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(t,e,i,r){const n=this.layers[0],o=n.layout,s="globe"===this.projection.name,a=o.get("text-font"),l=o.get("text-field"),c=o.get("icon-image"),h=("constant"!==l.value.kind||l.value.value instanceof be&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!h&&!u)return;const d=e.iconDependencies,f=e.glyphDependencies,m=e.availableImages,_=new Do(this.zoom);for(const{feature:g,id:y,index:x,sourceLayerIndex:v}of t){const t=n._featureFilter.needGeometry,e=qa(g,t);if(!n._featureFilter.filter(_,e,i))continue;if(t||(e.geometry=Za(g,i,r)),s&&1!==g.type&&i.z<=5){const t=e.geometry,r=.98078528056;for(let e=0;e<t.length;e++)t[e]=Va(t[e],(t=>t),((t,e)=>Ol(hd(t.x,t.y,i,1),hd(e.x,e.y,i,1))<r))}let l,c;if(h){const t=n.getValueAndResolveTokens("text-field",e,i,m),r=be.factory(t);Yd(r)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===zo()||this.hasRTLText&&ko.isParsed())&&(l=pu(r,n,e))}if(u){const t=n.getValueAndResolveTokens("icon-image",e,i,m);c=t instanceof we?t:we.fromString(t)}if(!l&&!c)continue;const b=this.sortFeaturesByKey?p.evaluate(e,{},i):void 0;if(this.features.push({id:y,text:l,icon:c,index:x,sourceLayerIndex:v,geometry:e.geometry,properties:g.properties,type:Zd[g.type],sortKey:b}),c&&(d[c.name]=!0),l){const t=a.evaluate(e,{},i).join(","),r="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Zu.vertical)>=0;for(const e of l.sections)if(e.image)d[e.image.name]=!0;else{const i=po(l.toString()),n=e.fontStack||t,o=f[n]=f[n]||{};this.calculateGlyphDependencies(e.text,o,r,this.allowVerticalPlacement,i)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function o(e){r.push(t[e]),n++}function s(t,e,n){const o=i[t];return delete i[t],i[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(t,i,n){const o=e[i];return delete e[i],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return"".concat(t,":").concat(r.x,":").concat(r.y)}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){o(c);continue}const d=l(p,u),f=l(p,u,!0);if(d in i&&f in e&&i[d]!==e[f]){const t=a(d,f,u),n=s(d,f,r[t].geometry);delete e[d],delete i[f],i[l(p,r[n].geometry,!0)]=n,r[t].geometry=null}else d in i?s(d,f,u):f in e?a(d,f,u):(o(c),e[d]=n-1,i[f]=n-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Gd(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const i=this.lineVertexArray.length,r=t.segment;if(void 0!==r){let i=t.dist(e[r+1]),n=t.dist(e[r]);const o={};for(let t=r+1;t<e.length;t++)o[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:i},t<e.length-1&&(i+=e[t+1].dist(e[t]));for(let t=r||0;t>=0;t--)o[t]={x:e[t].x,y:e[t].y,tileUnitDistanceFromAnchor:n},t>0&&(n+=e[t-1].dist(e[t]));for(let t=0;t<e.length;t++){const e=o[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,e,i,r,n,o,s,a,l,c,h,u,p,d){const f=t.indexArray,m=t.layoutVertexArray,_=t.globeExtVertexArray,g=t.segments.prepareSegment(4*e.length,m,f,this.canOverlap?o.sortKey:void 0),y=this.glyphOffsetArray.length,x=g.vertexLength,v=this.allowVerticalPlacement&&s===Zu.vertical?Math.PI/2:0,b=o.text&&o.text.sections;for(let T=0;T<e.length;T++){const{tl:r,tr:n,bl:s,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:y,minFontScaleX:x,minFontScaleY:w,glyphOffset:E,isSDF:S,sectionIndex:A}=e[T],M=g.vertexLength,I=E[1];if(Wd(m,l.x,l.y,r.x,I+r.y,h.x,h.y,i,S,u.x,u.y,x,w),Wd(m,l.x,l.y,n.x,I+n.y,h.x+h.w,h.y,i,S,y.x,u.y,x,w),Wd(m,l.x,l.y,s.x,I+s.y,h.x,h.y+h.h,i,S,u.x,y.y,x,w),Wd(m,l.x,l.y,c.x,I+c.y,h.x+h.w,h.y+h.h,i,S,y.x,y.y,x,w),a){const e=a.anchor,i=a.up;Xd(_,e.x,e.y,e.z,i[0],i[1],i[2]),Xd(_,e.x,e.y,e.z,i[0],i[1],i[2]),Xd(_,e.x,e.y,e.z,i[0],i[1],i[2]),Xd(_,e.x,e.y,e.z,i[0],i[1],i[2]),Hd(t.dynamicLayoutVertexArray,e.x,e.y,e.z,v)}else Hd(t.dynamicLayoutVertexArray,l.x,l.y,l.z,v);f.emplaceBack(M,M+1,M+2),f.emplaceBack(M+1,M+2,M+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(E[0]),T!==e.length-1&&A===e[T+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{},p,d,b&&b[A])}const w=a?a.anchor:l;t.placedSymbolArray.emplaceBack(w.x,w.y,w.z,l.x,l.y,y,this.glyphOffsetArray.length-y,x,c,h,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,u,0)}_commitLayoutVertex(t,e,i,r,n,o,s){t.emplaceBack(e,i,r,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(t,e,i,r,o,s,a){const l=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),c=l.vertexLength,h=a.tileAnchorX,u=a.tileAnchorY;for(let n=0;n<4;n++)i.collisionVertexArray.emplaceBack(0,0,0,0);i.collisionVertexArrayExt.emplaceBack(e,-t.padding,-t.padding),i.collisionVertexArrayExt.emplaceBack(e,t.padding,-t.padding),i.collisionVertexArrayExt.emplaceBack(e,t.padding,t.padding),i.collisionVertexArrayExt.emplaceBack(e,-t.padding,t.padding),this._commitLayoutVertex(i.layoutVertexArray,r,o,s,h,u,new n(t.x1,t.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,o,s,h,u,new n(t.x2,t.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,o,s,h,u,new n(t.x2,t.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,o,s,h,u,new n(t.x1,t.y2)),l.vertexLength+=4;const p=i.indexArray;p.emplaceBack(c,c+1),p.emplaceBack(c+1,c+2),p.emplaceBack(c+2,c+3),p.emplaceBack(c+3,c),l.primitiveLength+=4}_addTextDebugCollisionBoxes(t,e,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(t,o,e,s);this._addCollisionDebugVertices(r,n,this.textCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(t,e,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceIconSize(t,e,s);this._addCollisionDebugVertices(r,n,this.iconCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Jd(ps,nu.members,ws),this.iconCollisionBox=new Jd(ps,nu.members,ws);const i=hu(this.iconSizeData,t),r=hu(this.textSizeData,t);for(let n=0;n<this.symbolInstances.length;n++){const o=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(r,t,e,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(r,t,e,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,t,e,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,t,e,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(t,e,i,r){const n=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:r),o=cu(this.textSizeData,t,n)/su;return this.tilePixelRatio*o}getSymbolInstanceIconSize(t,e,i){const r=this.icon.placedSymbolArray.get(i),n=cu(this.iconSizeData,t,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(t,e,i){t.emplaceBack(e,-i,-i),t.emplaceBack(e,i,-i),t.emplaceBack(e,i,i),t.emplaceBack(e,-i,i)}_updateTextDebugCollisionBoxes(t,e,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(t,o,e,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,r.padding)}}_updateIconDebugCollisionBoxes(t,e,i,r,n){for(let o=r;o<n;o++){const r=i.get(o),n=this.getSymbolInstanceIconSize(t,e,o);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,r.padding)}}updateCollisionDebugBuffers(t,e){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const i=hu(this.iconSizeData,t),r=hu(this.textSizeData,t);for(let n=0;n<this.symbolInstances.length;n++){const o=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(r,t,e,o.textBoxStartIndex,o.textBoxEndIndex,o),this._updateTextDebugCollisionBoxes(r,t,e,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._updateIconDebugCollisionBoxes(i,t,e,o.iconBoxStartIndex,o.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(i,t,e,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex)}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(t,e,i,r,n,o,s,a,l){const c={};for(let h=e;h<i;h++){const e=t.get(h);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},c.textFeatureIndex=e.featureIndex;break}for(let h=r;h<n;h++){const e=t.get(h);c.verticalTextBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},c.verticalTextFeatureIndex=e.featureIndex;break}for(let h=o;h<s;h++){const e=t.get(h);c.iconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},c.iconFeatureIndex=e.featureIndex;break}for(let h=a;h<l;h++){const e=t.get(h);c.verticalIconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,padding:e.padding,projectedAnchorX:e.projectedAnchorX,projectedAnchorY:e.projectedAnchorY,projectedAnchorZ:e.projectedAnchorZ,tileAnchorX:e.tileAnchorX,tileAnchorY:e.tileAnchorY},c.verticalIconFeatureIndex=e.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)t.indexArray.emplaceBack(n,n+1,n+2),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[];for(let s=0;s<this.symbolInstances.length;++s){o.push(s);const t=this.symbolInstances.get(s);r.push(0|Math.round(e*t.tileAnchorX+i*t.tileAnchorY)),n.push(t.featureIndex)}return o.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Dn(Qd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Qd.MAX_GLYPHS=65535,Qd.addDynamicAttributes=Hd;const $d=new Xo({"symbol-placement":new No(qt.layout_symbol["symbol-placement"]),"symbol-spacing":new No(qt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new No(qt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Go(qt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new No(qt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new No(qt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new No(qt.layout_symbol["icon-ignore-placement"]),"icon-optional":new No(qt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new No(qt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Go(qt.layout_symbol["icon-size"]),"icon-text-fit":new No(qt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new No(qt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Go(qt.layout_symbol["icon-image"]),"icon-rotate":new Go(qt.layout_symbol["icon-rotate"]),"icon-padding":new No(qt.layout_symbol["icon-padding"]),"icon-keep-upright":new No(qt.layout_symbol["icon-keep-upright"]),"icon-offset":new Go(qt.layout_symbol["icon-offset"]),"icon-anchor":new Go(qt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new No(qt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new No(qt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new No(qt.layout_symbol["text-rotation-alignment"]),"text-field":new Go(qt.layout_symbol["text-field"]),"text-font":new Go(qt.layout_symbol["text-font"]),"text-size":new Go(qt.layout_symbol["text-size"]),"text-max-width":new Go(qt.layout_symbol["text-max-width"]),"text-line-height":new Go(qt.layout_symbol["text-line-height"]),"text-letter-spacing":new Go(qt.layout_symbol["text-letter-spacing"]),"text-justify":new Go(qt.layout_symbol["text-justify"]),"text-radial-offset":new Go(qt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new No(qt.layout_symbol["text-variable-anchor"]),"text-anchor":new Go(qt.layout_symbol["text-anchor"]),"text-max-angle":new No(qt.layout_symbol["text-max-angle"]),"text-writing-mode":new No(qt.layout_symbol["text-writing-mode"]),"text-rotate":new Go(qt.layout_symbol["text-rotate"]),"text-padding":new No(qt.layout_symbol["text-padding"]),"text-keep-upright":new No(qt.layout_symbol["text-keep-upright"]),"text-transform":new Go(qt.layout_symbol["text-transform"]),"text-offset":new Go(qt.layout_symbol["text-offset"]),"text-allow-overlap":new No(qt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new No(qt.layout_symbol["text-ignore-placement"]),"text-optional":new No(qt.layout_symbol["text-optional"])});var tf={paint:new Xo({"icon-opacity":new Go(qt.paint_symbol["icon-opacity"]),"icon-color":new Go(qt.paint_symbol["icon-color"]),"icon-halo-color":new Go(qt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Go(qt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Go(qt.paint_symbol["icon-halo-blur"]),"icon-translate":new No(qt.paint_symbol["icon-translate"]),"icon-translate-anchor":new No(qt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Go(qt.paint_symbol["text-opacity"]),"text-color":new Go(qt.paint_symbol["text-color"],{runtimeType:re,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Go(qt.paint_symbol["text-halo-color"]),"text-halo-width":new Go(qt.paint_symbol["text-halo-width"]),"text-halo-blur":new Go(qt.paint_symbol["text-halo-blur"]),"text-translate":new No(qt.paint_symbol["text-translate"]),"text-translate-anchor":new No(qt.paint_symbol["text-translate-anchor"])}),layout:$d};class ef{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:$t,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Dn(ef,"FormatSectionOverride",{omit:["defaultValue"]});class rf extends ya{constructor(t){super(t,tf)}recalculate(t,e){super.recalculate(t,e),"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"));const i=this.layout.get("text-writing-mode");if(i){const t=[];for(const e of i)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Br(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Qd(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of tf.paint.overridableProperties){if(!rf.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new ef(e),r=new Lr(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new Fr("source",r):new Or("composite",r,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Vo(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&rf.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=tf.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof be)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof Ie&&Se(e.value)===ae?o(e.value.sections):e instanceof De?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}getProgramConfiguration(t){return new ha(this,t)}}var nf={paint:new Xo({"background-color":new No(qt.paint_background["background-color"]),"background-pattern":new qo(qt.paint_background["background-pattern"]),"background-opacity":new No(qt.paint_background["background-opacity"])})},of={paint:new Xo({"raster-opacity":new No(qt.paint_raster["raster-opacity"]),"raster-hue-rotate":new No(qt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new No(qt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new No(qt.paint_raster["raster-brightness-max"]),"raster-saturation":new No(qt.paint_raster["raster-saturation"]),"raster-contrast":new No(qt.paint_raster["raster-contrast"]),"raster-resampling":new No(qt.paint_raster["raster-resampling"]),"raster-fade-duration":new No(qt.paint_raster["raster-fade-duration"])})};class sf extends ya{constructor(t){super(t,{}),this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}var af={paint:new Xo({"sky-type":new No(qt.paint_sky["sky-type"]),"sky-atmosphere-sun":new No(qt.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new No(qt.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new No(qt.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new No(qt.paint_sky["sky-gradient-radius"]),"sky-gradient":new Wo(qt.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new No(qt.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new No(qt.paint_sky["sky-atmosphere-color"]),"sky-opacity":new No(qt.paint_sky["sky-opacity"])})};function lf(t,e,i){const r=[0,0,1],n=Yl([]);return Jl(n,n,i?-l(t)+Math.PI:l(t)),Kl(n,n,-l(e)),jl(r,r,n),Fl(r,r)}const cf={circle:class extends ya{constructor(t){super(t,pl)}createBucket(t){return new Ha(t)}queryRadius(t){const e=t;return al("circle-radius",this,e)+al("circle-stroke-width",this,e)+ll(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,r,n,o,s,a){const l=hl(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return ic(t,r,o,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getProgramConfiguration(t){return new ha(this,t)}},heatmap:class extends ya{createBucket(t){return new ac(t)}constructor(t){super(t,dc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=fc({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(t){return al("heatmap-radius",this,t)}queryIntersectsFeature(t,e,i,r,o,s,a,l){const c=this.paint.get("heatmap-radius").evaluate(e,i);return ic(t,r,s,a,l,!0,!0,new n(0,0),c)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(t){return new ha(this,t)}},hillshade:class extends ya{constructor(t){super(t,mc)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends ya{constructor(t){super(t,ih)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getProgramConfiguration(t){return new ha(this,t)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new th(t)}queryRadius(){return ll(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,r,n,o){return!t.queryGeometry.isAboveHorizon&&Ja(cl(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,t.pixelToTileUnitsFactor),r)}isTileClipped(){return!0}},"fill-extrusion":class extends ya{constructor(t){super(t,kh)}createBucket(t){return new wh(t)}queryRadius(){return ll(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(t){return new ha(this,t)}queryIntersectsFeature(t,e,i,r,o,s,a,l,c){const h=hl(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(e,i),p=this.paint.get("fill-extrusion-base").evaluate(e,i),d=[0,0],f=l&&s.elevation,m=s.elevation?s.elevation.exaggeration():1,_=t.tile.getBucket(this);if(f&&_ instanceof wh){const t=_.centroidVertexArray,e=c+1;if(e<t.length){const i=t.get(e);d[0]=i.a_centroid_pos0,d[1]=i.a_centroid_pos1}}if(0===d[0]&&1===d[1])return!1;"globe"===s.projection.name&&(r=zh([r],[new n(0,0),new n(wa,wa)],t.tileID.canonical).map((t=>t.polygon)).flat());const g=function(t,e,i,r,o,s,a,l,c,h,u){return"globe"===t.projection.name?function(t,e,i,r,n,o,s,a,l,c,h){const u=[],p=[],d=t.projection.upVectorScale(h,t.center.lat,t.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(t,e,i,r)=>{t[0]=e,t[1]=i,t[2]=r,t[3]=1},g=Ch();i>0&&(i+=g),r+=g;for(const y of e){const e=[],g=[];for(const u of y){const p=u.x+n.x,y=u.y+n.y,x=t.projection.projectTilePoint(p,y,h),v=t.projection.upVector(h,u.x,u.y);let b=i,w=r;if(s){const t=jh(p,y,i,r,s,a,l,c);b+=t.base,w+=t.top}0!==i?_(f,x.x+v[0]*d*b,x.y+v[1]*d*b,x.z+v[2]*d*b):_(f,x.x,x.y,x.z),_(m,x.x+v[0]*d*w,x.y+v[1]*d*w,x.z+v[2]*d*w),Vl(f,f,o),Vl(m,m,o),e.push(Vh(f)),g.push(Vh(m))}u.push(e),p.push(g)}return[u,p]}(t,e,i,r,o,s,a,l,c,h,u):a?function(t,e,i,r,n,o,s,a,l){const c=[],h=[],u=[0,0,0,1];for(const p of t){const t=[],d=[];for(const c of p){const h=c.x+r.x,p=c.y+r.y,f=jh(h,p,e,i,o,s,a,l);u[0]=h,u[1]=p,u[2]=f.base,u[3]=1,Xl(u,u,n),u[3]=Math.max(u[3],1e-5);const m=Vh([u[0]/u[3],u[1]/u[3],u[2]/u[3]]);u[0]=h,u[1]=p,u[2]=f.top,u[3]=1,Xl(u,u,n),u[3]=Math.max(u[3],1e-5);const _=Vh([u[0]/u[3],u[1]/u[3],u[2]/u[3]]);t.push(m),d.push(_)}c.push(t),h.push(d)}return[c,h]}(e,i,r,o,s,a,l,c,h):function(t,e,i,r,o){const s=[],a=[],l=o[8]*e,c=o[9]*e,h=o[10]*e,u=o[11]*e,p=o[8]*i,d=o[9]*i,f=o[10]*i,m=o[11]*i;for(const _ of t){const t=[],e=[];for(const i of _){const s=i.x+r.x,a=i.y+r.y,_=o[0]*s+o[4]*a+o[12],g=o[1]*s+o[5]*a+o[13],y=o[2]*s+o[6]*a+o[14],x=o[3]*s+o[7]*a+o[15],v=_+l,b=g+c,w=y+h,T=Math.max(x+u,1e-5),E=_+p,S=g+d,A=y+f,M=Math.max(x+m,1e-5),I=new n(v/T,b/T);I.z=w/T,t.push(I);const C=new n(E/M,S/M);C.z=A/M,e.push(C)}s.push(t),a.push(e)}return[s,a]}(e,i,r,o,s)}(s,r,p,u,h,a,f?l:null,d,m,s.center.lat,t.tileID.canonical),y=t.queryGeometry;return function(t,e,i){let r=1/0;Ja(i,e)&&(r=Uh(i,e[0]));for(let n=0;n<e.length;n++){const o=e[n],s=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],s[t+1],s[t],e];Ya(i,n)&&(r=Math.min(r,Uh(i,n)))}}return r!==1/0&&r}(g[0],g[1],y.isPointQuery()?y.screenBounds:y.screenGeometry)}},line:class extends ya{constructor(t){super(t,Kh),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof gi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Jh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Hh(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(t){return new ha(this,t)}queryRadius(t){const e=t,i=Qh(al("line-width",this,e),al("line-gap-width",this,e)),r=al("line-offset",this,e);return i/2+Math.abs(r)+ll(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,r,o,s){if(t.queryGeometry.isAboveHorizon)return!1;const a=cl(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),l=t.pixelToTileUnitsFactor/2*Qh(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(t,e){const i=[],r=new n(0,0);for(let n=0;n<t.length;n++){const o=t[n],s=[];for(let t=0;t<o.length;t++){const i=o[t-1],n=o[t],a=o[t+1],l=0===t?r:n.sub(i)._unit()._perp(),c=t===o.length-1?r:a.sub(n)._unit()._perp(),h=l._add(c)._unit();h._mult(1/(h.x*c.x+h.y*c.y)),s.push(h._mult(e)._add(n))}i.push(s)}return i}(r,c*t.pixelToTileUnitsFactor)),function(t,e,i){for(let r=0;r<e.length;r++){const n=e[r];if(t.length>=3)for(let e=0;e<n.length;e++)if(nl(t,n[e]))return!0;if(Qa(t,n,i))return!0}return!1}(a,r,l)}isTileClipped(){return!0}},symbol:rf,background:class extends ya{constructor(t){super(t,nf)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends ya{constructor(t){super(t,of)}getProgramIds(){return["raster"]}},sky:class extends ya{constructor(t){super(t,af),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"sky-gradient"===t?this._updateColorRamp():"sky-atmosphere-sun"!==t&&"sky-atmosphere-halo-color"!==t&&"sky-atmosphere-color"!==t&&"sky-atmosphere-sun-intensity"!==t||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=fc({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(t,e){if("atmosphere"===this.paint.get("sky-type")){const i=this.paint.get("sky-atmosphere-sun"),r=!i,n=t.style.light,o=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&P("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?lf(o.azimuthal,90-o.polar,e):lf(i[0],90-i[1],e)}const i=this.paint.get("sky-gradient-center");return lf(i[0],90-i[1],e)}is3D(){return!1}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return"atmosphere"===t?["skyboxCapture","skybox"]:"gradient"===t?["skyboxGradient"]:null}}};class hf{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(t,i,r){const{width:n,height:o}=t,{context:s}=this,{gl:a}=s,{HTMLImageElement:l,HTMLCanvasElement:c,HTMLVideoElement:h,ImageData:u,ImageBitmap:p}=e;if(a.bindTexture(a.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===a.RGBA&&(!i||!1!==i.premultiply)),r||this.size&&this.size[0]===n&&this.size[1]===o){const{x:e,y:i}=r||{x:0,y:0};t instanceof l||t instanceof c||t instanceof h||t instanceof u||p&&t instanceof p?a.texSubImage2D(a.TEXTURE_2D,0,e,i,a.RGBA,a.UNSIGNED_BYTE,t):a.texSubImage2D(a.TEXTURE_2D,0,e,i,n,o,a.RGBA,a.UNSIGNED_BYTE,t.data)}else this.size=[n,o],t instanceof l||t instanceof c||t instanceof h||t instanceof u||p&&t instanceof p?a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,a.UNSIGNED_BYTE,t):a.texImage2D(a.TEXTURE_2D,0,this.format,n,o,0,this.format,a.UNSIGNED_BYTE,t.data);this.useMipmap=Boolean(i&&i.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&a.generateMipmap(a.TEXTURE_2D)}bind(t,e){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.useMipmap?t===r.NEAREST?r.NEAREST_MIPMAP_NEAREST:r.LINEAR_MIPMAP_NEAREST:t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class uf{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new uc({width:t,height:e}),this.positions={},this.uploaded=!1}getDash(t,e){const i=this.getKey(t,e);return this.positions[i]}trim(){const t=this.width,e=this.height=T(this.nextRow);this.image.resize({width:t,height:e})}getKey(t,e){return t.join(",")+e}getDashRanges(t,e,i){const r=[];let n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:0===t[0]});let a=t[0];for(let l=1;l<t.length;l++){s=!s;const e=t[l];n=a*i,a+=e,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:0===e})}return r}addRoundDash(t,e,i){const r=e/2;for(let n=-i;n<=i;n++){const e=this.width*(this.nextRow+i+n);let o=0,s=t[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=t[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),h=Math.min(l,c);let u;const p=n/i*(r+1);if(s.isDash){const t=r-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+p*p);this.image.data[e+a]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t,e){for(let a=t.length-1;a>=0;--a){const e=t[a],i=t[a+1];e.zeroLength?t.splice(a,1):i&&i.isDash===e.isDash&&(i.left=e.left,t.splice(a,1))}const i=t[0],r=t[t.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,s=t[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=t[++o]);const i=Math.abs(a-s.left),r=Math.abs(a-s.right),l=Math.min(i,r);this.image.data[n+a]=Math.max(0,Math.min(255,(s.isDash?l:-l)+e+128))}}addDash(t,e){const i=this.getKey(t,e);if(this.positions[i])return this.positions[i];const r="round"===e,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return P("LineAtlas out of space"),null;0===t.length&&t.push(1);let s=0;for(let c=0;c<t.length;c++)t[c]<0&&(P("Negative value is found in line dasharray, replacing values with 0"),t[c]=0),s+=t[c];if(0!==s){const i=this.width/s,o=this.getDashRanges(t,this.width,i);r?this.addRoundDash(o,i,n):this.addRegularDash(o,"square"===e?.5*i:0)}const a=this.nextRow+n;this.nextRow+=o;const l={tl:[a,n],br:[s,0]};return this.positions[i]=l,l}}Dn(uf,"LineAtlas");class pf{constructor(t){this._callback=t,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 df{constructor(){this.tasks={},this.taskQueue=[],S(["process"],this),this.invoker=new pf(this.process),this.nextId=0}add(t,e){const i=this.nextId++,r=function(t){let{type:e,isSymbolTile:i,zoom:r}=t;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}(e);if(0===r){L();try{t()}finally{}return{cancel:()=>{}}}return this.tasks[i]={fn:t,metadata:e,priority:r,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){L();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let r=0;r<this.taskQueue.length;r++){const i=this.tasks[this.taskQueue[r]];i.priority<e&&(e=i.priority,t=r)}if(null===t)return null;const i=this.taskQueue[t];return this.taskQueue.splice(t,1),i}remove(){this.invoker.remove()}}class ff{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}const mf=["tile","layer","source","sourceLayer","state"];class _f{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,this._z=e,this._x=i,this._y=r,this.properties=t.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(t){this._geometry=t}toJSON(){const t={type:"Feature",geometry:this.geometry,properties:this.properties};void 0!==this.id&&(t.id=this.id);for(const e of mf)void 0!==this[e]&&(t[e]=this[e]);return t}}const gf=32,yf=33,xf=new Uint16Array(8184);for(let om=0;om<2046;om++){let t=om+2,e=0,i=0,r=0,n=0,o=0,s=0;for(1&t?r=n=o=gf:e=i=s=gf;(t>>=1)>1;){const a=e+r>>1,l=i+n>>1;1&t?(r=e,n=i,e=o,i=s):(e=r,i=n,r=o,n=s),o=a,s=l}const a=4*om;xf[a+0]=e,xf[a+1]=i,xf[a+2]=r,xf[a+3]=n}const vf=new Uint16Array(2178),bf=new Uint8Array(1089),wf=new Uint16Array(1089);function Tf(t){return 0===t?-.03125:32===t?.03125:0}var Ef=Qo([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Sf={type:2,extent:wa,loadGeometry:()=>[[new n(0,0),new n(8193,0),new n(8193,8193),new n(0,8193),new n(0,0)]]};class Af{constructor(t,e,i,r,n){this.tileID=t,this.uid=b(),this.uses=0,this.tileSize=e,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=n,this.expiredRequestCount=0,this.state="loading",r&&r.transform&&(this.projection=r.transform.projection)}registerFadeDuration(t){const e=t+this.timeAdded;e<X.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=wd(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,e,i){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Qd){if(this.hasSymbolBuckets=!0,!i)break;e.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof Qd&&e.hasRTLText){this.hasRTLText=!0,ko.isLoading()||ko.isLoaded()||"deferred"!==zo()||Po();break}}this.queryPadding=0;for(const t in this.buckets){const i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas)}else this.collisionBoxArray=new Is}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const i in this.buckets){const e=this.buckets[i];e.uploadPending()&&e.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new hf(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new hf(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new hf(t,this.lineAtlas.image,e.ALPHA),this.lineAtlas.uploaded=!0)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,s,a){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:s,transform:o,params:n,tileTransform:this.tileTransform},t,e,i):{}}querySourceFeatures(t,e){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const r=i.loadVTLayers(),n=e?e.sourceLayer:"",o=r._geojsonTileLayer||r[n];if(!o)return;const s=Jr(e&&e.filter),{z:a,x:l,y:c}=this.tileID.canonical,h={z:a,x:l,y:c};for(let u=0;u<o.length;u++){const e=o.feature(u);if(s.needGeometry){const t=qa(e,!0);if(!s.filter(new Do(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new Do(this.tileID.overscaledZ),e))continue;const r=i.getId(e,n),p=new _f(e,a,l,c,r);p.tile=h,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const e=this.expirationTime;if(t.cacheControl){const e=B(t.cacheControl);e["max-age"]&&(this.expirationTime=Date.now()+1e3*e["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let i=!1;if(this.expirationTime>t)i=!1;else if(e)if(this.expirationTime<e)i=!0;else{const r=this.expirationTime-e;r?this.expirationTime=t+Math.max(r,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(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length||!e)return;const i=this.latestFeatureIndex.loadVTLayers(),r=e.style.listImages();for(const n in this.buckets){if(!e.style.hasLayer(n))continue;const o=this.buckets[n],s=o.layers[0].sourceLayer||"_geojsonTileLayer",a=i[s],l=t[s];if(!a||!l||0===Object.keys(l).length)continue;if(o.update(l,a,r,this.imageAtlas&&this.imageAtlas.patternPositions||{}),o instanceof Hh||o instanceof th){const t=e.style._getSourceCache(o.layers[0].source);e._terrain&&e._terrain.enabled&&t&&o.programConfigurations.needsUpload&&e._terrain._clearRenderCacheForTile(t.id,this.tileID)}const c=e&&e.style&&e.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<X.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=X.now()+t}setTexture(t,e){const i=e.context,r=i.gl;this.texture=e.getTileTexture(t.width),this.texture?this.texture.update(t,{useMipmap:!0}):(this.texture=new hf(i,t,r.RGBA,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax))}setDependencies(t,e){const i={};for(const r of e)i[r]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,e){if(!e||"mercator"===e.name||this._tileDebugBuffer)return;const i=Za(Sf,this.tileID.canonical,this.tileTransform)[0],r=new ts,n=new Ts;for(let o=0;o<i.length;o++){const{x:t,y:e}=i[o];r.emplaceBack(t,e),n.emplaceBack(o)}n.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(n),this._tileDebugBuffer=t.createVertexBuffer(r,Wp.members),this._tileDebugSegments=ba.simpleSegment(0,0,r.length,n.length)}_makeTileBoundsBuffers(t,e){if(this._tileBoundsBuffer||!e||"mercator"===e.name)return;const i=Za(Sf,this.tileID.canonical,this.tileTransform)[0];let r,n;if(this.isRaster){const t=function(t,e){const i=wd(t,e),r=Math.pow(2,t.z);for(let c=0;c<yf;c++)for(let n=0;n<yf;n++){const o=Pa((t.x+(n+Tf(n))/gf)/r),s=ka((t.y+(c+Tf(c))/gf)/r),a=e.project(o,s),l=c*yf+n;vf[2*l+0]=Math.round((a.x*i.scale-i.x)*wa),vf[2*l+1]=Math.round((a.y*i.scale-i.y)*wa)}bf.fill(0),wf.fill(0);for(let c=2045;c>=0;c--){const t=4*c,e=xf[t+0],i=xf[t+1],r=xf[t+2],n=xf[t+3],o=e+r>>1,s=i+n>>1,a=o+s-i,l=s+e-o,h=i*yf+e,u=n*yf+r,p=s*yf+o,d=Math.hypot((vf[2*h+0]+vf[2*u+0])/2-vf[2*p+0],(vf[2*h+1]+vf[2*u+1])/2-vf[2*p+1])>=16;if(bf[p]=bf[p]||(d?1:0),c<1022){const t=(i+l>>1)*yf+(e+a>>1),o=(n+l>>1)*yf+(r+a>>1);bf[p]=bf[p]||bf[t]||bf[o]}}const n=new is,o=new _s;let s=0;function a(t,e){const i=e*yf+t;return 0===wf[i]&&(n.emplaceBack(vf[2*i+0],vf[2*i+1],t*wa/gf,e*wa/gf),wf[i]=++s),wf[i]-1}function l(t,e,i,r,n,s){const c=t+i>>1,h=e+r>>1;if(Math.abs(t-n)+Math.abs(e-s)>1&&bf[h*yf+c])l(n,s,t,e,c,h),l(i,r,n,s,c,h);else{const l=a(t,e),c=a(i,r),h=a(n,s);o.emplaceBack(l,c,h)}}return l(0,0,gf,gf,gf,0),l(gf,gf,0,0,0,gf),{vertices:n,indices:o}}(this.tileID.canonical,e);r=t.vertices,n=t.indices}else{r=new is,n=new _s;for(const{x:e,y:n}of i)r.emplaceBack(e,n,0,0);const t=yc(r.int16,void 0,4);for(let e=0;e<t.length;e+=3)n.emplaceBack(t[e],t[e+1],t[e+2])}this._tileBoundsBuffer=t.createVertexBuffer(r,Ef.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(n),this._tileBoundsSegments=ba.simpleSegment(0,0,r.length,n.length)}_makeGlobeTileDebugBuffers(t,e){const i=e.projection;if(!i||"globe"!==i.name||e.freezeTileCoverage)return;const r=this.tileID.canonical,n=dd(rd(r,e)),o=_d(e.zoom);let s;o>0&&(s=gl(new Float64Array(16),e.globeMatrix));const a=(r.x+.5)/(1<<r.z)-Ia(e.center.lng);let l=0;a>.5?l=-1:a<-.5&&(l=1),this._makeGlobeTileDebugBorderBuffer(t,r,e,n,s,o,l),this._makeGlobeTileDebugTextBuffer(t,r,e,n,s,o,l)}_globePoint(t,e,i,r,n,o,s,a){let l=hd(t,e,i);if(o){const n=1<<i.z,c=[((t/wa+i.x)/n+a)*r,(e/wa+i.y)/n*r,0];Vl(c,c,o),l=xi(l,c,s)}return Vl(l,l,n)}_makeGlobeTileDebugBorderBuffer(t,e,i,r,n,o,s){const a=new ts,l=new Ts,c=new es,h=(t,h,u,p,d)=>{const f=(u-t)/(d-1),m=(p-h)/(d-1),_=a.length;for(let g=0;g<d;g++){const u=t+g*f,p=h+g*m;a.emplaceBack(u,p);const d=this._globePoint(u,p,e,i.worldSize,r,n,o,s);c.emplaceBack(d[0],d[1],d[2]),l.emplaceBack(_+g)}},u=wa;h(0,0,u,0,16),h(u,0,u,u,16),h(u,u,0,u,16),h(0,u,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(a,Wp.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(c,qp.members),this._tileDebugSegments=ba.simpleSegment(0,0,a.length,l.length)}_makeGlobeTileDebugTextBuffer(t,e,i,r,n,o,s){const a=new ts,l=new _s,c=new es,h=25;l.reserve(32),a.reserve(h),c.reserve(h);const u=(t,e)=>h*t+e;for(let p=0;p<h;p++){const t=2048*p;for(let l=0;l<h;l++){const h=2048*l;a.emplaceBack(h,t);const u=this._globePoint(h,t,e,i.worldSize,r,n,o,s);c.emplaceBack(u[0],u[1],u[2])}}for(let p=0;p<4;p++)for(let t=0;t<4;t++){const e=u(p,t),i=u(p,t+1),r=u(p+1,t),n=u(p+1,t+1);l.emplaceBack(e,i,r),l.emplaceBack(r,i,n)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(l),this._tileDebugTextBuffer=t.createVertexBuffer(a,Wp.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(c,qp.members),this._tileDebugTextSegments=ba.simpleSegment(0,0,h,32)}}class Mf{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,i){const r=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},x(this.stateChanges[t][r],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])i[e]||(this.deletedStates[t][r][e]=null)}else for(const n in i)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][n]&&delete this.deletedStates[t][r][n]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,e){const i=String(e),r=x({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const i=this.deletedStates[t][e];if(null===i)return{};for(const t in i)delete r[t]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){const i={};for(const r in this.stateChanges){this.state[r]=this.state[r]||{};const t={};for(const e in this.stateChanges[r])this.state[r][e]||(this.state[r][e]={}),x(this.state[r][e],this.stateChanges[r][e]),t[e]=this.state[r][e];i[r]=t}for(const r in this.deletedStates){this.state[r]=this.state[r]||{};const t={};if(null===this.deletedStates[r])for(const e in this.state[r])t[e]={},this.state[r][e]={};else for(const e in this.deletedStates[r]){if(null===this.deletedStates[r][e])this.state[r][e]={};else for(const t of Object.keys(this.deletedStates[r][e]))delete this.state[r][e][t];t[e]=this.state[r][e]}i[r]=i[r]||{},x(i[r],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const r in t)t[r].setFeatureState(i,e)}}class If{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,e){const i=this.toIdx(t,e);return{min:this.minimums[i],max:this.maximums[i]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function Cf(t,e,i,r){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(Math.abs(r[s])<1e-15){if(i[s]<t[s]||i[s]>e[s])return null}else{const a=1/r[s];let l=(t[s]-i[s])*a,c=(e[s]-i[s])*a;if(l>c){const t=l;l=c,c=t}if(l>n&&(n=l),c<o&&(o=c),n>o)return null}return n}function zf(t,e,i,r,n,o,s,a,l,c,h){const u=r-t,p=n-e,d=o-i,f=s-t,m=a-e,_=l-i,g=h[1]*_-h[2]*m,y=h[2]*f-h[0]*_,x=h[0]*m-h[1]*f,v=u*g+p*y+d*x;if(Math.abs(v)<1e-15)return null;const b=1/v,w=c[0]-t,T=c[1]-e,E=c[2]-i,S=(w*g+T*y+E*x)*b;if(S<0||S>1)return null;const A=T*d-E*p,M=E*u-w*d,I=w*p-T*u,C=(h[0]*A+h[1]*M+h[2]*I)*b;return C<0||S+C>1?null:(f*A+m*M+_*I)*b}function Pf(t,e,i){return(t-e)/(i-e)}function kf(t,e,i,r,n,o,s,a,l){const c=1<<i,h=o-r,u=s-n,p=(t+1)/c*h+r,d=(e+0)/c*u+n,f=(e+1)/c*u+n;a[0]=(t+0)/c*h+r,a[1]=d,l[0]=p,l[1]=f}class Df{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const e=function(t){const e=Math.ceil(Math.log2(t.dim/8)),i=[];let r=Math.ceil(Math.pow(2,e));const n=1/r,o=(t,e,i,r,n)=>{const o=r?1:0,s=(t+1)*i-o,a=e*i,l=(e+1)*i-o;n[0]=t*i,n[1]=a,n[2]=s,n[3]=l};let s=new If(r);const a=[];for(let l=0;l<r*r;l++){o(l%r,Math.floor(l/r),n,!1,a);const e=Bf(a[0],a[1],t),i=Bf(a[2],a[1],t),c=Bf(a[2],a[3],t),h=Bf(a[0],a[3],t);s.minimums.push(Math.min(e,i,c,h)),s.maximums.push(Math.max(e,i,c,h)),s.leaves.push(1)}for(i.push(s),r/=2;r>=1;r/=2){const t=i[i.length-1];s=new If(r);for(let e=0;e<r*r;e++){o(e%r,Math.floor(e/r),2,!0,a);const i=t.getElevation(a[0],a[1]),n=t.getElevation(a[2],a[1]),l=t.getElevation(a[2],a[3]),c=t.getElevation(a[0],a[3]),h=t.isLeaf(a[0],a[1]),u=t.isLeaf(a[2],a[1]),p=t.isLeaf(a[2],a[3]),d=t.isLeaf(a[0],a[3]),f=Math.min(i.min,n.min,l.min,c.min),m=Math.max(i.max,n.max,l.max,c.max),_=h&&u&&p&&d;s.maximums.push(m),s.minimums.push(f),s.leaves.push(m-f<=5&&_?1:0)}i.push(s)}return i}(this.dem),i=e.length-1,r=e[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(e,0,0,i,0)}raycastRoot(t,e,i,r,n,o){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return Cf([t,e,-100],[i,r,this.maximums[0]*s],n,o)}raycast(t,e,i,r,n,o){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;if(!this.nodeCount)return null;const a=this.raycastRoot(t,e,i,r,n,o,s);if(null==a)return null;const l=[],c=[],h=[],u=[],p=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:a,t:d,nodex:f,nodey:m,depth:_}=p.pop();if(this.leaves[a]){kf(f,m,_,t,e,i,r,h,u);const a=1<<_,l=(f+0)/a,c=(f+1)/a,p=(m+0)/a,g=(m+1)/a,y=Bf(l,p,this.dem)*s,x=Bf(c,p,this.dem)*s,v=Bf(c,g,this.dem)*s,b=Bf(l,g,this.dem)*s,w=zf(h[0],h[1],y,u[0],h[1],x,u[0],u[1],v,n,o),T=zf(u[0],u[1],v,h[0],u[1],b,h[0],h[1],y,n,o),E=Math.min(null!==w?w:Number.MAX_VALUE,null!==T?T:Number.MAX_VALUE);if(E!==Number.MAX_VALUE)return E;{const t=Rl([],n,o,d);if(Lf(y,x,b,v,Pf(t[0],h[0],u[0]),Pf(t[1],h[1],u[1]))>=t[2])return d}continue}let g=0;for(let p=0;p<this._siblingOffset.length;p++){kf((f<<1)+this._siblingOffset[p][0],(m<<1)+this._siblingOffset[p][1],_+1,t,e,i,r,h,u),h[2]=-100,u[2]=this.maximums[this.childOffsets[a]+p]*s;const d=Cf(h,u,n,o);if(null!=d){const t=d;l[p]=t;let e=!1;for(let i=0;i<g&&!e;i++)t>=l[c[i]]&&(c.splice(i,0,p),e=!0);e||(c[g]=p),g++}}for(let t=0;t<g;t++){const e=c[t];p.push({idx:this.childOffsets[a]+e,t:l[e],nodex:(f<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:_+1})}}return null}_addNode(t,e,i){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,i,r,n){if(1===t[r].isLeaf(e,i))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=r-1,s=t[o];let a=0,l=0;for(let c=0;c<this._siblingOffset.length;c++){const t=2*e+this._siblingOffset[c][0],r=2*i+this._siblingOffset[c][1],n=s.getElevation(t,r),o=s.isLeaf(t,r),h=this._addNode(n.min,n.max,o);o&&(a|=1<<c),l||(l=h)}for(let c=0;c<this._siblingOffset.length;c++)a&1<<c||this._construct(t,2*e+this._siblingOffset[c][0],2*i+this._siblingOffset[c][1],o,l+c)}}function Lf(t,e,i,r,n,o){return yi(yi(t,i,o),yi(e,r,o),n)}function Bf(t,e,i){const r=i.dim,n=f(t*r-.5,0,r-1),o=f(e*r-.5,0,r-1),s=Math.floor(n),a=Math.floor(o),l=Math.min(s+1,r-1),c=Math.min(a+1,r-1);return Lf(i.get(s,a),i.get(l,a),i.get(s,c),i.get(l,c),n-s,o-a)}const Rf={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class Ff{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return P('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=e.height;const o=this.dim=e.height-2,s=new Uint32Array(e.data.buffer);if(this.pixels=new Uint8Array(e.data.buffer),this.encoding=i||"mapbox",this.borderReady=r,!r){for(let t=0;t<o;t++)s[this._idx(-1,t)]=s[this._idx(0,t)],s[this._idx(o,t)]=s[this._idx(o-1,t)],s[this._idx(t,-1)]=s[this._idx(t,0)],s[this._idx(t,o)]=s[this._idx(t,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)],n&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new Df(this)}get(t,e){arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(t=f(t,-1,this.dim),e=f(e,-1,this.dim));const i=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}static getUnpackVector(t){return Rf[t]}get unpackVector(){return Rf[this.encoding]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}static pack(t,e){const i=[0,0,0,0],r=Ff.getUnpackVector(e);let n=Math.floor((t+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new pc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-e*this.dim,l=-i*this.dim;for(let c=o;c<s;c++)for(let e=r;e<n;e++){const i=4*this._idx(e,c),r=4*this._idx(e+a,c+l);this.pixels[i+0]=t.pixels[r+0],this.pixels[i+1]=t.pixels[r+1],this.pixels[i+2]=t.pixels[r+2],this.pixels[i+3]=t.pixels[r+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Dn(Ff,"DEMData"),Dn(Df,"DemMinMaxQuadTree",{omit:["dem"]});class Of{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const i of e)this.remove(i.value.tileID,i)}}class Uf{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Uf.ReadOnly=!1,Uf.ReadWrite=!0,Uf.disabled=new Uf(519,Uf.ReadOnly,[0,1]);const Vf=7680;class jf{constructor(t,e,i,r,n,o){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}jf.disabled=new jf({func:519,mask:0},0,0,Vf,Vf,Vf);class Nf{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Nf.Replace=[1,0],Nf.disabled=new Nf(Nf.Replace,ye.transparent,[!1,!1,!1,!1]),Nf.unblended=new Nf(Nf.Replace,ye.transparent,[!0,!0,!0,!0]),Nf.alphaBlended=new Nf([1,771],ye.transparent,[!0,!0,!0,!0]);const Gf=1029,Zf=2305;class qf{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}qf.disabled=new qf(!1,Gf,Zf),qf.backCCW=new qf(!0,Gf,Zf),qf.backCW=new qf(!0,Gf,2304),qf.frontCW=new qf(!0,1028,2304),qf.frontCCW=new qf(!0,1028,Zf);class Wf extends Zt{constructor(t,e,i){super(),this.id=t,this._onlySymbols=i,e.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),e.on("error",(()=>{this._sourceErrored=!0})),this._source=e,this._tiles={},this._cache=new Of(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Mf,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(t){this.map=t,this._minTileCacheSize=void 0===this._minTileCacheSize&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(const e in this._tiles){const i=this._tiles[e];this._source.prepareTile(i)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,i.tileID),i.upload(t),i.prepare(this.map.style.imageManager)}else for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return y(this._tiles).map((t=>t.tileID)).sort(Xf).map((t=>t.key))}getRenderableIds(t){const e=[];for(const i in this._tiles)this._isIdRenderable(+i,t)&&e.push(this._tiles[i]);return t?e.sort(((t,e)=>{const i=t.tileID,r=e.tileID,o=new n(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),s=new n(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-r.overscaledZ||s.y-o.y||s.x-o.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(Xf).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(+t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(t,e,i,r){if(r)if(t.state="errored",404!==r.status)this._source.fire(new Gt(r,{tile:t}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const t=this.map.painter.terrain;this.update(this.transform,t.getScaledDemTileSize(),!0),t.resetTileLookupCache(this.id)}else this.update(this.transform);else t.timeAdded=X.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),"raster-dem"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Nt("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);i(t,e),i(e,t)}}function i(t,e){if(!t.dem||t.dem.borderReady)return;t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(s=t)}let a=s;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){r[s.key]=s;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const i=Math.ceil(t.width/e)+1,r=Math.ceil(t.height/e)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(t,e,i){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;let r;this.updateCacheSize(t,e),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new Rh(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(r=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const n=this._updateRetainedTiles(r);if(Hf(this._source.type)&&0!==r.length){const t={},e={},i=Object.keys(n);for(const r of i){const i=n[r],o=this._tiles[r];if(!o||o.fadeEndTime&&o.fadeEndTime<=X.now())continue;const s=this.findLoadedParent(i,Math.max(i.overscaledZ-Wf.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),t[s.tileID.key]=s.tileID),e[r]=i}const o=r[r.length-1].overscaledZ;for(const r in this._tiles){const t=this._tiles[r];if(n[r]||!t.hasData())continue;let i=t.tileID;for(;i.overscaledZ>o;){i=i.scaledTo(i.overscaledZ-1);const o=this._tiles[i.key];if(o&&o.hasData()&&e[i.key]){n[r]=t.tileID;break}}}for(const r in t)n[r]||(this._coveredTiles[r]=!0,n[r]=t[r])}for(const s in n)this._tiles[s].clearFadeHold();const o=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i}(this._tiles,n);for(const s of o){const t=this._tiles[s];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+s)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const i={},r=t.reduce(((t,e)=>Math.min(t,e.overscaledZ)),1/0),n=t[0].overscaledZ,o=Math.max(n-Wf.maxOverzooming,this._source.minzoom),s=Math.max(n+Wf.maxUnderzooming,this._source.minzoom),a={};for(const l of t){const t=this._addTile(l);e[l.key]=l,t.hasData()||r<this._source.maxzoom&&(a[l.key]=l)}this._retainLoadedChildren(a,r,s,e);for(const l of t){let t=this._tiles[l.key];if(t.hasData())continue;if(l.canonical.z>=this._source.maxzoom){const t=l.children(this._source.maxzoom)[0],i=this.getTile(t);if(i&&i.hasData()){e[t.key]=t;continue}}else{const t=l.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let r=t.wasRequested();for(let n=l.overscaledZ-1;n>=o;--n){const o=l.scaledTo(n);if(i[o.key])break;if(i[o.key]=!0,t=this.getTile(o),!t&&r&&(t=this._addTile(o)),t&&(e[o.key]=o,r=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(t){let e=this._tiles[t.key];if(e)return this._source.prepareTile&&this._source.prepareTile(e),e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const i=Boolean(e);if(!i){const i=this.map?this.map.painter:null;e=new Af(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,i,this._isRaster),this._source.prepareTile&&this._source.prepareTile(e)||this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))}return e?(e.uses++,this._tiles[t.key]=e,i||this._source.fire(new Nt("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);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(t,e,i){const r=[],n=this.transform;if(!n)return r;const o="globe"===n.projection.name,s=Ia(n.center.lng);for(const a in this._tiles){const l=this._tiles[a];if(i&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(o){const t=l.tileID.canonical;if(0===t.z){const e=[Math.abs(f(s,...Yf(t,-1))-s),Math.abs(f(s,...Yf(t,1))-s)];c=[0,2*e.indexOf(Math.min(...e))-1]}else{const e=[Math.abs(f(s,...Yf(t,-1))-s),Math.abs(f(s,...Yf(t,0))-s),Math.abs(f(s,...Yf(t,1))-s)];c=[e.indexOf(Math.min(...e))-1]}}else c=[0];for(const i of c){const o=t.containsTile(l,n,e,i);o&&r.push(o)}}return r}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const i of e)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(Hf(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=X.now())return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}_preloadTiles(t,e){const i=new Map,r=Array.isArray(t)?t:[t],n=this.map.painter.terrain,o=this.usedForTerrain&&n?n.getScaledDemTileSize():this._source.tileSize;for(const s of r){const t=s.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&s.updateElevation(!1)}g(Array.from(i.values()),((t,e)=>{const i=new Af(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(t=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),e(t,i)}))}),e)}}function Xf(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Hf(t){return"raster"===t||"image"===t||"video"===t}function Yf(t,e){const i=1<<t.z;return[t.x/i+e,(t.x+1)/i+e]}Wf.maxOverzooming=10,Wf.maxUnderzooming=3;class Kf{constructor(t,e,i){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=i}static create(t,e,i){const r=i||t.findDEMTileFor(e);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,s=1<<e.canonical.z-o.canonical.z;return new Kf(r,r.tileSize/wa/s,[(e.canonical.x/s-o.canonical.x)*n.dim,(e.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(t,e){const i=e*this._scale+this._offset[1],r=Math.floor(t*this._scale+this._offset[0]),o=Math.floor(i);return new n(r,o)}getElevationAt(t,e,i,r){const n=t*this._scale+this._offset[0],o=e*this._scale+this._offset[1],s=Math.floor(n),a=Math.floor(o),l=this._dem;return r=!!r,i?yi(yi(l.get(s,a,r),l.get(s,a+1,r),o-a),yi(l.get(s+1,a,r),l.get(s+1,a+1,r),o-a),n-s):l.get(s,a,r)}getElevationAtPixel(t,e,i){return this._dem.get(t,e,!!i)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*za(1,t)*this._dem.stride}}class Jf{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new zn(wa,16,0),this.featureIndexArray=new Rs,this.promoteId=e}insert(t,e,i,r,n){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,o);const a=this.grid;for(let l=0;l<e.length;l++){const t=e[l],i=[1/0,1/0,-1/0,-1/0];for(let e=0;e<t.length;e++){const r=t[e];i[0]=Math.min(i[0],r.x),i[1]=Math.min(i[1],r.y),i[2]=Math.max(i[2],r.x),i[3]=Math.max(i[3],r.y)}i[0]<wa&&i[1]<wa&&i[2]>=0&&i[3]>=0&&a.insert(s,i[0],i[1],i[2],i[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new mh.VectorTile(new yu(this.rawTileData)).layers,this.sourceLayerCoder=new ff(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,e,i,r){var n=this;this.loadVTLayers();const o=t.params||{},s=Jr(o.filter),a=t.tileResult,l=t.transform,c=a.bufferedTilespaceBounds,h=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,((t,e,i,r)=>ol(a.bufferedTilespaceGeometry,t,e,i,r)));h.sort($f);let u=null;l.elevation&&h.length>0&&(u=Kf.create(l.elevation,this.tileID));const p={};let d;for(let f=0;f<h.length;f++){const l=h[f];if(l===d)continue;d=l;const c=this.featureIndexArray.get(l);let m=null;this.loadMatchingFeature(p,c,s,o.layers,o.availableImages,e,i,r,(function(e,i,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return m||(m=Za(e,n.tileID.canonical,t.tileTransform)),i.queryIntersectsFeature(a,e,r,m,n.z,t.transform,t.pixelPosMatrix,u,o)}))}return p}loadMatchingFeature(t,e,i,r,n,o,s,a,l){const{featureIndex:c,bucketIndex:h,sourceLayerIndex:u,layoutVertexArrayOffset:p}=e,d=this.bucketLayerIDs[h];if(r&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(r,d))return;const f=this.sourceLayerCoder.decode(u),m=this.vtLayers[f].feature(c);if(i.needGeometry){const t=qa(m,!0);if(!i.filter(new Do(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Do(this.tileID.overscaledZ),m))return;const _=this.getId(m,f);for(let g=0;g<d.length;g++){const e=d[g];if(r&&r.indexOf(e)<0)continue;const i=o[e];if(!i)continue;let h={};void 0!==_&&a&&(h=a.getState(i.sourceLayer||"_geojsonTileLayer",_));const u=x({},s[e]);u.paint=Qf(u.paint,i.paint,m,h,n),u.layout=Qf(u.layout,i.layout,m,h,n);const f=!l||l(m,i,h,p);if(!f)continue;const y=new _f(m,this.z,this.x,this.y,_);y.layer=u;let v=t[e];void 0===v&&(v=t[e]=[]),v.push({featureIndex:c,feature:y,intersectionZ:f})}}lookupSymbolFeatures(t,e,i,r,n,o,s,a){const l={};this.loadVTLayers();const c=Jr(n);for(const h of t)this.loadMatchingFeature(l,{bucketIndex:i,sourceLayerIndex:r,featureIndex:h,layoutVertexArrayOffset:0},c,o,s,a,e);return l}loadFeature(t){const{featureIndex:e,sourceLayerIndex:i}=t;this.loadVTLayers();const r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[e])return n[e];const o=this.vtLayers[r].feature(e);return n[e]=o,o}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function Qf(t,e,i,r,n){return M(t,((t,o)=>{const s=e instanceof jo?e.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function $f(t,e){return e-t}Dn(Jf,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class tm{constructor(t){const e={},i=[];for(const s in t){const r=t[s],n=e[s]={};for(const t in r.glyphs){const e=r.glyphs[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const o=e.metrics.localGlyph?2:1,s={x:0,y:0,w:e.bitmap.width+2*o,h:e.bitmap.height+2*o};i.push(s),n[t]=s}}const{w:r,h:n}=ju(i),o=new uc({width:r||1,height:n||1});for(const s in t){const i=t[s];for(const t in i.glyphs){const r=i.glyphs[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const n=e[s][t],a=r.metrics.localGlyph?2:1;uc.copy(r.bitmap,o,{x:0,y:0},{x:n.x+a,y:n.y+a},r.bitmap)}}this.image=o,this.positions=e}}Dn(tm,"GlyphAtlas");class em{constructor(t){this.tileID=new Rh(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile,this.tileTransform=wd(t.tileID.canonical,t.projection),this.projection=t.projection}parse(t,e,i,r,n){this.status="parsing",this.data=t,this.collisionBoxArray=new Is;const o=new ff(Object.keys(t.layers).sort()),s=new Jf(this.tileID,this.promoteId);s.bucketLayerIDs=[];const a={},l=new uf(256,256),c={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:l,availableImages:i},h=e.familiesBySource[this.source];for(const y in h){const e=t.layers[y];if(!e)continue;let r=!1,n=!1;for(const t of h[y])"symbol"===t[0].type?r=!0:n=!0;if(!0===this.isSymbolTile&&!r)continue;if(!1===this.isSymbolTile&&!n)continue;1===e.version&&P('Vector tile source "'.concat(this.source,'" layer "').concat(y,'" does not use vector tile spec v2 and therefore may have some rendering errors.'));const l=o.encode(y),u=[];for(let t=0;t<e.length;t++){const i=e.feature(t),r=s.getId(i,y);u.push({feature:i,id:r,index:t,sourceLayerIndex:l})}for(const t of h[y]){const e=t[0];void 0!==this.isSymbolTile&&"symbol"===e.type!==this.isSymbolTile||e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(im(t,this.zoom,i),(a[e.id]=e.createBucket({index:s.bucketLayerIDs.length,layers:t,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:l,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(u,c,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(t.map((t=>t.id))))}}let u,p,d,f;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},_=M(c.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(_).length?r.send("getGlyphs",{uid:this.uid,stacks:_},((t,e)=>{u||(u=t,p=e,v.call(this))}),void 0,!1,m):p={};const g=Object.keys(c.iconDependencies);g.length?r.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{u||(u=t,d=e,v.call(this))}),void 0,!1,m):d={};const x=Object.keys(c.patternDependencies);function v(){if(u)return n(u);if(p&&d&&f){const t=new tm(p),e=new Gu(d,f);for(const r in a){const n=a[r];n instanceof Qd?(im(n.layers,this.zoom,i),Lp(n,p,t.positions,d,e.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):n.hasPattern&&(n instanceof Hh||n instanceof th||n instanceof wh)&&(im(n.layers,this.zoom,i),n.addFeatures(c,this.tileID.canonical,e.patternPositions,i,this.tileTransform))}this.status="done",n(null,{buckets:y(a).filter((t=>!t.isEmpty())),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?d:null,glyphPositions:this.returnDependencies?t.positions:null})}}x.length?r.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{u||(u=t,f=e,v.call(this))}),void 0,!1,m):f={},v.call(this)}}function im(t,e,i){const r=new Do(e);for(const n of t)n.recalculate(r,i)}class rm{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,r){const n=this.entries[t]=this.entries[t]||{callbacks:[]};if(n.result){const[t,i]=n.result;return this.scheduler?this.scheduler.add((()=>{r(t,i)}),e):r(t,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i(((i,r)=>{n.result=[i,r];for(const t of n.callbacks)this.scheduler?this.scheduler.add((()=>{t(i,r)}),e):t(i,r);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{n.result||(n.callbacks=n.callbacks.filter((t=>t!==r)),n.callbacks.length||(n.cancel(),delete this.entries[t]))}}}function nm(t,e,i){const r=JSON.stringify(t.request);return t.data&&(this.deduped.entries[r]={result:[null,t.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const r=kt(t.request,((t,r,n,o)=>{t?e(t):r&&e(null,{vectorTile:i?void 0:new mh.VectorTile(new yu(r)),rawData:r,cacheControl:n,expires:o})}));return()=>{r.cancel(),e()}}),e)}t.ARRAY_TYPE=fl,t.AUTH_ERR_MSG=rt,t.Aabb=ec,t.Actor=class{constructor(t,i,r){this.target=t,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},S(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=L()?t:e,this.scheduler=new df}send(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0;const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);const a=F(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Rn(e,a)},a),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t.cancel()}else if(e.mustQueue||L()){const t=this.callbacks[i];this.cancelCallbacks[i]=this.scheduler.add((()=>this.processTask(i,e)),t&&t.metadata||{type:"message"})}else this.processTask(i,e)}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Fn(e.error)):i(null,Fn(e.data)))}else{const i=F(this.globalScope)?void 0:[],r=e.hasCallback?(e,r)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Rn(e):null,data:Rn(r,i)},i)}:t=>{},n=Fn(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,n,r);else if(this.parent.getWorkerSource){const t=e.type.split(".");this.parent.getWorkerSource(e.sourceMapId,t[0],n.source)[t[1]](n,r)}else r(new Error("Could not find function ".concat(e.type)))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.CanonicalTileID=Lh,t.Color=ye,t.ColorMode=Nf,t.CullFaceMode=qf,t.DEMData=Ff,t.DataConstantProperty=No,t.DedupedRequest=rm,t.DepthMode=Uf,t.EXTENT=wa,t.Elevation=class{isDataAvailableAtPoint(t){const e=this._source();if(!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,r=1<<i,n=Math.floor(t.x),o=Math.floor((t.x-n)*r),s=Math.floor(t.y*r),a=this.findDEMTileFor(new Rh(i,n,i,o,s));return!(!a||!a.dem)}getAtPointOrZero(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.getAtPoint(t,e)||0}getAtPoint(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];null==e&&(e=null);const r=this._source();if(!r)return e;if(t.y<0||t.y>1)return e;const n=r.getSource().maxzoom,o=1<<n,s=Math.floor(t.x),a=t.x-s,l=new Rh(n,s,n,Math.floor(a*o),Math.floor(t.y*o)),c=this.findDEMTileFor(l);if(!c||!c.dem)return e;const h=c.dem,u=1<<c.tileID.canonical.z,p=(a*u-c.tileID.canonical.x)*h.dim,d=(t.y*u-c.tileID.canonical.y)*h.dim,f=Math.floor(p),m=Math.floor(d);return(i?this.exaggeration():1)*yi(yi(h.get(f,m),h.get(f,m+1),d-m),yi(h.get(f+1,m),h.get(f+1,m+1),d-m),p-f)}getAtTileOffset(t,e,i){const r=1<<t.canonical.z;return this.getAtPointOrZero(new Ra(t.wrap+(t.canonical.x+e/wa)/r,(t.canonical.y+i/wa)/r))}getAtTileOffsetFunc(t,e,i,r){return n=>{const o=this.getAtTileOffset(t,n.x,n.y),s=r.upVector(t.canonical,n.x,n.y);return Bl(s,s,o*r.upVectorScale(t.canonical,e,i).metersToTile),s}}getForTilePoints(t,e,i,r){const n=Kf.create(this,t,r);return!!n&&(e.forEach((t=>{t[2]=this.exaggeration()*n.getElevationAt(t[0],t[1],i)})),!0)}getMinMaxForTile(t){const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,r=e.tileID,n=1<<t.canonical.z-r.canonical.z;let o=t.canonical.x/n-r.canonical.x,s=t.canonical.y/n-r.canonical.y,a=0;for(let l=0;l<t.canonical.z-r.canonical.z&&!i.leaves[a];l++){o*=2,s*=2;const t=2*Math.floor(s)+Math.floor(o);a=i.childOffsets[a]+t,o%=1,s%=1}return{min:this.exaggeration()*i.minimums[a],max:this.exaggeration()*i.maximums[a]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(t){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}},t.ErrorEvent=Gt,t.EvaluationParameters=Do,t.Event=Nt,t.Evented=Zt,t.FillExtrusionBucket=wh,t.Frustum=tc,t.FrustumCorners=$l,t.GLOBE_METERS_TO_ECEF=Hp,t.GLOBE_RADIUS=Xp,t.GLOBE_SCALE_MATCH_LATITUDE=45,t.GLOBE_ZOOM_THRESHOLD_MAX=6,t.GLOBE_ZOOM_THRESHOLD_MIN=5,t.GlobeSharedBuffers=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.destroy();if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();for(const t of this._wireframeSegments)t.destroy()}}_createGrid(t){const e=new ts,i=new _s,r=65;for(let n=0;n<r;n++)for(let t=0;t<r;t++)e.emplaceBack(t,n);this._gridSegments=[];for(let n=0,o=0;n<Yp.length;n++){const t=Yp[n];for(let n=0;n<t;n++)for(let t=0;t<64;t++){const e=n*r+t;i.emplaceBack(e+1,e,e+r),i.emplaceBack(e+r,e+r+1,e+1)}const e=64*t*2;this._gridSegments.push(ba.simpleSegment(0,o,(t+1)*r,e)),o+=e}this._gridBuffer=t.createVertexBuffer(e,Wp.members),this._gridIndexBuffer=t.createIndexBuffer(i,!0)}_createPoles(t){const e=new _s;for(let n=0;n<=64;n++)e.emplaceBack(0,n+1,n+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const i=new vs,r=new vs;this._poleSegments=[];for(let n=0,o=0;n<5;n++){const t=360/(1<<n);i.emplaceBack(0,-Xp,0,.5,0),r.emplaceBack(0,-Xp,0,.5,1);for(let e=0;e<=64;e++){const n=e/64,o=yi(0,t,n),[s,a,l]=ld(xd,vd,o,Xp);i.emplaceBack(s,a,l,n,0),r.emplaceBack(s,a,l,n,1)}
1this._poleSegments.push(ba.simpleSegment(o,0,66,64)),o+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(i,Zp,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(r,Zp,!1)}getGridBuffers(t){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[t]]}getPoleBuffers(t){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}getWirefameBuffers(t,e){if(!this._wireframeSegments){const e=new ws,i=64,r=i+1;this._wireframeSegments=[];for(let t=0,n=0;t<Yp.length;t++){const o=Yp[t];for(let t=0;t<o;t++)for(let n=0;n<i;n++){const i=t*r+n;e.emplaceBack(i,i+1),e.emplaceBack(i,i+r),e.emplaceBack(i,i+r+1)}const s=o*i*3;this._wireframeSegments.push(ba.simpleSegment(0,n,(o+1)*r,s)),n+=s}this._wireframeIndexBuffer=t.createIndexBuffer(e)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[e]]}},t.GlyphManager=xp,t.ImagePosition=Nu,t.LineAtlas=uf,t.LngLat=Sa,t.LngLatBounds=Ta,t.LocalGlyphMode=yp,t.MAX_MERCATOR_LATITUDE=La,t.MercatorCoordinate=Ra,t.ONE_EM=su,t.OverscaledTileID=Rh,t.Properties=Xo,t.RGBAImage=pc,t.Ray=Ql,t.RequestManager=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let t="";for(let e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",it,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!nt(t))return t;const i=at(t);return i.path="/styles/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!nt(t))return t;const i=at(t);return i.path="/fonts/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||e)}normalizeSourceURL(t,e,i,r){if(!nt(t))return t;const n=at(t);return n.path="/v4/".concat(n.authority,".json"),n.params.push("secure"),i&&n.params.push("language=".concat(i)),r&&n.params.push("worldview=".concat(r)),this._makeAPIURL(n,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,r){const n=at(t);return nt(t)?(n.path="/styles/v1".concat(n.path,"/sprite").concat(e).concat(i),this._makeAPIURL(n,this._customAccessToken||r)):(n.path+="".concat(e).concat(i),lt(n))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!nt(t))return t;const r=at(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(e||i&&"raster"!==r.authority&&512===i?"@2x":"").concat(K.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(Y.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(Y.TILE_URL_VERSION).concat(r.path));const n=this._customAccessToken||function(t){for(const e of t){const t=e.match(/^access_token=(.*)$/);if(t)return t[1]}return null}(r.params)||Y.ACCESS_TOKEN;return Y.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku=".concat(this._skuToken)),this._makeAPIURL(r,n)}canonicalizeTileURL(t,e){const i=at(t);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let r="mapbox://";i.path.match(/^\/raster\/v1\//)?r+="raster/".concat(i.path.replace("/".concat(Y.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(i.path.replace("/".concat(Y.TILE_URL_VERSION,"/"),""));let n=i.params;return e&&(n=n.filter((t=>!t.match(/^access_token=/)))),n.length&&(r+="?".concat(n.join("&"))),r}canonicalizeTileset(t,e){const i=!!e&&nt(e),r=[];for(const n of t.tiles||[])ot(n)?r.push(this.canonicalizeTileURL(n,i)):r.push(n);return r}_makeAPIURL(t,e){const i="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",r=at(Y.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"http"===t.protocol){const e=t.params.indexOf("secure");e>=0&&t.params.splice(e,1)}if("/"!==r.path&&(t.path="".concat(r.path).concat(t.path)),!Y.REQUIRE_ACCESS_TOKEN)return lt(t);if(e=e||Y.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error("An API access token is required to use Mapbox GL. ".concat(i));if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(i))}return t.params=t.params.filter((t=>-1===t.indexOf("access_token"))),t.params.push("access_token=".concat(e||"")),lt(t)}},t.ResourceType=It,t.SegmentVector=ba,t.SourceCache=Wf,t.StencilMode=jf,t.StructArrayLayout1ui2=Ts,t.StructArrayLayout2f1f2i16=ds,t.StructArrayLayout2i4=ts,t.StructArrayLayout2ui4=ws,t.StructArrayLayout3f12=ms,t.StructArrayLayout3ui6=_s,t.StructArrayLayout4i8=is,t.StructArrayLayout5f20=vs,t.Texture=hf,t.Tile=Af,t.Transitionable=Ro,t.Uniform1f=Qs,t.Uniform1i=class extends Js{constructor(t){super(t),this.current=0}set(t,e,i){this.fetchUniformLocation(t,e)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},t.Uniform2f=class extends Js{constructor(t){super(t),this.current=[0,0]}set(t,e,i){this.fetchUniformLocation(t,e)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}},t.Uniform3f=class extends Js{constructor(t){super(t),this.current=[0,0,0]}set(t,e,i){this.fetchUniformLocation(t,e)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}},t.Uniform4f=$s,t.UniformColor=ta,t.UniformMatrix2f=class extends Js{constructor(t){super(t),this.current=ra}set(t,e,i){if(this.fetchUniformLocation(t,e))for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},t.UniformMatrix3f=class extends Js{constructor(t){super(t),this.current=ia}set(t,e,i){if(this.fetchUniformLocation(t,e))for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},t.UniformMatrix4f=class extends Js{constructor(t){super(t),this.current=ea}set(t,e,i){if(this.fetchUniformLocation(t,e)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}},t.UnwrappedTileID=Bh,t.ValidationError=Nr,t.VectorTileWorkerSource=class extends Zt{constructor(t,e,i,r,n){super(),this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||nm,this.loading={},this.loaded={},this.deduped=new rm(t.scheduler),this.isSpriteLoaded=r,this.scheduler
vendor: 4,277 bytes, line 1
1=t.scheduler}loadTile(t,e){const i=t.uid,r=t&&t.request,n=r&&r.collectResourceTiming,o=this.loading[i]=new em(t);o.abort=this.loadVectorData(t,((s,a)=>{const l=!this.loading[i];if(delete this.loading[i],l||s||!a)return o.status="done",l||(this.loaded[i]=o),e(s);const c=a.rawData,h={};a.expires&&(h.expires=a.expires),a.cacheControl&&(h.cacheControl=a.cacheControl),o.vectorTile=a.vectorTile||new mh.VectorTile(new yu(c));const u=()=>{o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,i)=>{if(t||!i)return e(t);const o={};if(n){const t=j(r);t.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(t)))}e(null,x({rawTileData:c.slice(0)},i,h,o))}))};this.isSpriteLoaded?u():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(u,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):u()})),this.loaded=this.loaded||{},this.loaded[i]=o}))}reloadTile(t,e){const i=this.loaded,r=t.uid,n=this;if(i&&i[r]){const o=i[r];o.showCollisionBoxes=t.showCollisionBoxes,o.enableTerrain=!!t.enableTerrain,o.projection=t.projection,o.tileTransform=wd(t.tileID.canonical,t.projection);const s=(t,i)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,n.layerIndex,this.availableImages,n.actor,r)),e(t,i)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}abortTile(t,e){const i=t.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),e()}removeTile(t,e){const i=this.loaded,r=t.uid;i&&i[r]&&delete i[r],e()}},t.WritingMode=Zu,t.ZoomHistory=On,t.add=zl,t.addDynamicAttributes=Hd,t.adjoint=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t[0]=s*h-a*c,t[1]=n*c-r*h,t[2]=r*a-n*s,t[3]=a*l-o*h,t[4]=i*h-n*l,t[5]=n*o-i*a,t[6]=o*c-s*l,t[7]=r*l-i*c,t[8]=i*s-r*o,t},t.asyncAll=g,t.bezier=p,t.bindAll=S,t.boundsAttributes=Ef,t.bufferConvexPolygon=function(t,e){const i=[];for(let r=0;r<t.length;r++){const n=_(r-1,-1,t.length-1),o=_(r+1,-1,t.length-1),s=t[r],a=t[o],l=t[n].sub(s).unit(),c=a.sub(s).unit(),h=c.angleWithSep(l.x,l.y),u=l.add(c).unit().mult(-1*e/Math.sin(h/2));i.push(s.add(u))}return i},t.cacheEntryPossiblyAdded=function(t){Mt++,Mt>vt&&(t.getActor().send("enforceCacheSizeLimit",xt),Mt=0)},t.calculateGlobeLabelMatrix=function(t,e){const{x:i,y:r}=t.point,n=md(i,r,t.worldSize/t._pixelsPerMercatorPixel,0,0);return yl(n,n,fd(id(e)))},t.calculateGlobeMatrix=function(t){const{x:e,y:i}=t.point,{lng:r,lat:n}=t._center;return md(e,i,t.worldSize,r,n)},t.calculateGlobeMercatorMatrix=function(t){const e=t.pixelsPerMeter,i=e/za(1,t.center.lat),r=_l(new Float64Array(16));return xl(r,r,[t.point.x,t.point.y,0]),vl(r,r,[i,i,e]),Float32Array.from(r)},t.circumferenceAtLatitude=Ma,t.clamp=f,t.clearTileCache=function(t){const e=Tt(),i=[];for(const r in bt)e&&i.push(e.delete(r)),delete bt[r];t&&Promise.all(i).catch(t).then((()=>t()))},t.clipLine=fp,t.clone=function(t){var e=new fl(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=C,t.collisionCircleLayout=ou,t.config=Y,t.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},t.create=function(){var t=new fl(16);return fl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=ml,t.createExpression=Rr,t.createLayout=Qo,t.createStyleLayer=function(t){return"custom"===t.type?new sf(t):new cf[t.type](t)},t.cross=Ul,t.degToRad=l,t.distance=function(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},t.div=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t},t.dot=Ol,t.ease=d,t.easeCubicInOut=u,t.emitValidationErrors=Cn,t.endsWith=A,t.enforceCacheSizeLimit=function(t){for(const e in bt)Et(e),bt[e].then((e=>{e.keys().then((i=>{for(let r=0;r<i.length-t;r++)e.delete(i[r])}))}))},t.evaluateSizeForFeature=cu,t.evaluateSizeForZoom=hu,t.evaluateVariableOffset=Dp,t.evented=Co,t.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},t.exactEquals$1=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}
1,t.exported=X,t.exported$1=K,t.extend=x,t.extend$1=Wt,t.fillExtrusionHeightLift=Ch,t.filterObject=I,t.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},t.fromQuat=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=i+i,a=r+r,l=n+n,c=i*s,h=r*s,u=r*a,p=n*s,d=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return t[0]=1-u-f,t[1]=h+g,t[2]=p-_,t[3]=0,t[4]=h-g,t[5]=1-c-f,t[6]=d+m,t[7]=0,t[8]=p+_,t[9]=d-m,t[10]=1-c-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.fromRotation=function(t,e){var i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.fromScaling=Tl,t.furthestTileCorner=function(t){const e=Math.round((t+45+360)%360/90)%4;return h[e]},t.getAABBPointSquareDist=function(t,e,i){let r=0;for(let n=0;n<2;++n){const o=i?i[n]:0;t[n]>o&&(r+=(t[n]-o)*(t[n]-o)),e[n]<o&&(r+=(o-e[n])*(o-e[n]))}return r},t.getAnchorAlignment=ip,t.getAnchorJustification=Bp,t.getBounds=function(t){let e=1/0,i=1/0,r=-1/0,o=-1/0;for(const n of t)e=Math.min(e,n.x),i=Math.min(i,n.y),r=Math.max(r,n.x),o=Math.max(o,n.y);return{min:new n(e,i),max:new n(r,o)}},t.getColumn=U,t.getGridMatrix=function(t,e,i){const r=e.getNorth(),n=e.getSouth(),o=e.getWest(),s=.015625;return[0,(e.getEast()-o)*s,1<<t.z,(n-r)/Yp[i],0,t.y,r,o,s]},t.getImage=Ut,t.getJSON=function(t,e){return Pt(x(t,{type:"json"}),e)},t.getLatitudinalLod=function(t){const e=80.051129;t=f(t,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(l(t))),3);return Math.round(i*(Yp.length-1))},t.getMapSessionAPI=_t,t.getPerformanceMeasurement=j,t.getProjection=Gd,t.getRTLTextPluginStatus=zo,t.getReferrer=zt,t.getTilePoint=function(t,e){let{x:i,y:r}=e;return new n(((i-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*t.scale-t.x)*wa,(r*t.scale-t.y)*wa)},t.getTileVec3=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Cl(((e.x-i)*t.scale-t.x)*wa,(e.y*t.scale-t.y)*wa,Da(e.z,e.y))},t.getVideo=function(t,i){const r=e.document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let n=0;n<t.length;n++){const i=e.document.createElement("source");Bt(t[n])||(r.crossOrigin="Anonymous"),i.src=t[n],r.appendChild(i)}return{cancel:()=>{}}},t.globeCenterToScreenPoint=function(t){const e=[0,0,0],i=_l(new Float64Array(16));return yl(i,t.pixelMatrix,t.globeMatrix),Vl(e,e,i),new n(e[0],e[1])},t.globeDenormalizeECEF=fd,t.globeECEFOrigin=function(t,e){const i=[0,0,0];return Vl(i,i,dd(id(e.canonical))),Vl(i,i,t),i},t.globeNormalizeECEF=dd,t.globePixelsToTileUnits=function(t,e){return wa/(512*Math.pow(2,t))*ud(id(e))},t.globePoleMatrixForTile=function(t,e,i){const r=_l(new Float64Array(16)),n=(e/(1<<t)-.5)*Math.PI*2;return wl(r,i.globeMatrix,n),Float32Array.from(r)},t.globeTileBounds=id,t.globeTiltAtLngLat=gd,t.globeToMercatorTransition=_d,t.globeUseCustomAntiAliasing=function(t,e,i){const r=_d(i.zoom),n=t.style.map._antialias,o=!!e.extStandardDerivatives,s=e.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return 0===r&&!n&&!s&&o},t.identity=_l,t.identity$1=Yl,t.invert=gl,t.isFullscreen=function(){return!!e.document.fullscreenElement||!!e.document.webkitFullscreenElement},t.isLngLatBehindGlobe=function(t,e){return gd(t,e)>Math.PI/2*1.01},t.isMapAuthenticated=function(t){return gt.has(t)},t.isMapboxURL=nt,t.isSafariWithAntialiasingBug=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!F(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},t.latFromMercatorY=ka,t.len=ql,t.length=Il,t.length$1=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},t.loadVectorTile=nm,t.makeRequest=Pt,t.mapValue=function(t,e,i,r,n){return f((t-e)/(i-e)*(n-r)+r,r,n)},t.mercatorScale=Ba,t.mercatorXfromLng=Ia,t.mercatorYfromLat=Ca,t.mercatorZfromAltitude=za,t.mul=Sl,t.mul$1=Zl,t.multiply=yl,t.multiply$1=function(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=i[0],d=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],x=i[7],v=i[8];return t[0]=p*r+d*s+f*c,t[1]=p*n+d*a+f*h,t[2]=p*o+d*l+f*u,t[3]=m*r+_*s+g*c,t[4]=m*n+_*a+g*h,t[5]=m*o+_*l+g*u,t[6]=y*r
1+x*s+v*c,t[7]=y*n+x*a+v*h,t[8]=y*o+x*l+v*u,t},t.multiply$2=kl,t.nextPowerOfTwo=T,t.normalize=Fl,t.normalize$1=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=i*i+r*r+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=i*s,t[1]=r*s,t[2]=n*s,t[3]=o*s,t},t.number=yi,t.ortho=function(t,e,i,r,n,o,s){var a=1/(e-i),l=1/(r-n),c=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*l,t[14]=(s+o)*c,t[15]=1,t},t.pbf=yu,t.perspective=function(t,e,i,r,n){var o,s=1/Math.tan(e/2);return t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(o=1/(r-n)),t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){const i={};for(let r=0;r<e.length;r++){const n=e[r];n in t&&(i[n]=t[n])}return i},t.plugin=ko,t.pointGeometry=n,t.polygonContainsPoint=nl,t.polygonIntersectsBox=ol,t.polygonIntersectsPolygon=Ya,t.polygonizeBounds=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const o=new n(i,i),s=t.sub(o),a=e.add(o),l=[s,new n(a.x,s.y),a,new n(s.x,a.y)];return r&&l.push(s.clone()),l},t.posAttributes=Wp,t.postMapLoadEvent=ft,t.postTurnstileEvent=pt,t.potpack=ju,t.prevPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},t.radToDeg=c,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.registerForPluginStateChange=function(t){return t({pluginStatus:So,pluginURL:Ao}),Co.on("pluginStateChange",t),t},t.removeAuthState=function(t){gt.delete(t)},t.renderColorRamp=fc,t.resample=Oa,t.rotateX=bl,t.rotateX$1=Kl,t.rotateY=wl,t.rotateY$1=Jl,t.rotateZ=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*r,t[1]=s*n+h*r,t[2]=a*n+u*r,t[3]=l*n+p*r,t[4]=c*n-o*r,t[5]=h*n-s*r,t[6]=u*n-a*r,t[7]=p*n-l*r,t},t.rotateZ$1=function(t,e,i){i*=.5;var r=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);return t[0]=r*l+n*a,t[1]=n*l-r*a,t[2]=o*l+s*a,t[3]=s*l-o*a,t},t.scale=vl,t.scale$1=Wl,t.scale$2=Bl,t.scaleAndAdd=Rl,t.setCacheLimits=function(t,e){xt=t,vt=e},t.setColumn=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},t.setRTLTextPlugin=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(So===bo||So===wo||So===To)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ao=X.resolveURL(t),So=bo,Eo=e,Io(),i||Po()},t.smoothstep=m,t.spec=qt,t.storeAuthState=function(t,e){e?gt.add(t):gt.delete(t)},t.sub=Gl,t.subtract=Pl,t.symbolSize=uu,t.tileAABB=function(t,e,i,r,n,o,s,a,l){if("globe"===l.name)return od(t,e,new Lh(i,r,n));const c=wd({z:i,x:r,y:n},l);return new ec([(o+c.x/c.scale)*e,e*(c.y/c.scale),s],[(o+c.x2/c.scale)*e,e*(c.y2/c.scale),a])},t.tileCornersToBounds=sd,t.tileTransform=wd,t.transformMat3=function(t,e,i){var r=e[0],n=e[1],o=e[2];return t[0]=r*i[0]+n*i[3]+o*i[6],t[1]=r*i[1]+n*i[4]+o*i[7],t[2]=r*i[2]+n*i[5]+o*i[8],t},t.transformMat4=Vl,t.transformMat4$1=Xl,t.transformQuat=jl,t.transitionTileAABBinECEF=rd,t.translate=xl,t.transpose=function(t,e){if(t===e){var i=e[1],r=e[2],n=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=r,t[7]=n}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},t.triggerPluginCompletionEvent=Mo,t.uniqueId=b,t.updateGlobeVertexNormal=function(t,e,i,r,n){const o=5*e+2;t.float32[o+0]=i,t.float32[o+1]=r,t.float32[o+2]=n},t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:"layers.".concat(i,': missing required property "id"')}),void 0===t.render&&e.push({message:"layers.".concat(i,': missing required method "render"')}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),e},t.validateFilter=t=>In(hn(t)),t.validateFog=t=>In(bn(t)),t.validateLayer=t=>In(mn(t)),t.validateLight=t=>In(xn(t)),t.validateSource=t=>In(yn(t)),t.validateStyle=Sn,t.validateTerrain=t=>In(vn(t)),t.values=y,t.vectorTile=mh,t.version=N,t.warnOnce=P,t.window=e,t.wrap=_})),r(["./shared"],(function(t){function e(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t||null==t)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(const r of t)i+="".concat(e(r),",");return"".concat(i,"]")}let i="{";for(const r of Object.keys(t).sort())i+="".concat(r,":").concat(e(t[r]),",");return"".concat(i,"}")}function i(i){let r="";for(const n of t.refProperties)r+="/".concat(e(i[n]));return r}
vendor: 31,647 bytes, line 1
1class r{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,r){for(const i of e)this._layerConfigs[i.id]=i,(this._layers[i.id]=t.createStyleLayer(i)).compileFilter(),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=function(t,e){const r={};for(let o=0;o<t.length;o++){const n=e&&e[t[o].id]||i(t[o]);e&&(e[t[o].id]=n);let s=r[n];s||(s=r[n]=[]),s.push(t[o])}const n=[];for(const i in r)n.push(r[i]);return n}(t.values(this._layerConfigs),this.keyCache);for(const t of n){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(e)}}}class n{loadTile(e,i){const{uid:r,encoding:n,rawImageData:o,padding:s,buildQuadTree:a}=e,l=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap?this.getImageData(o,s):o;i(null,new t.DEMData(r,l,n,s<1,a))}getImageData(t,e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const i=this.offscreenCanvasContext.getImageData(-e,-e,t.width+2*e,t.height+2*e);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}var o=function t(e,i){var r,n=e&&e.type;if("FeatureCollection"===n)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===n)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===n)t(e.geometry,i);else if("Polygon"===n)s(e.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<e.coordinates.length;r++)s(e.coordinates[r],i);return e};function s(t,e){if(0!==t.length){a(t[0],e);for(var i=1;i<t.length;i++)a(t[i],!e)}}function a(t,e){for(var i=0,r=0,n=0,o=t.length,s=o-1;n<o;s=n++){var a=(t[n][0]-t[s][0])*(t[s][1]+t[n][1]),l=i+a;r+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+r>=0!=!!e&&t.reverse()}const l=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class c{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.pointGeometry(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.pointGeometry(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return l.call(this,t,e,i)}}class h{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new c(this._features[t])}}var u=t.vectorTile.VectorTileFeature,p=d;function d(t,e){this.options=e||{},this.features=t,this.length=t.length}function f(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}d.prototype.feature=function(t){return new f(this.features[t],this.options.extent)},f.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i<e.length;i++){for(var r=e[i],n=[],o=0;o<r.length;o++)n.push(new t.pointGeometry(r[o][0],r[o][1]));this.geometry.push(n)}return this.geometry},f.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<t.length;o++)for(var s=t[o],a=0;a<s.length;a++){var l=s[a];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},f.prototype.toGeoJSON=u.prototype.toGeoJSON;var m=g,_=p;function g(e){var i=new t.pbf;return function(t,e){for(var i in t.layers)e.writeMessage(3,y,t.layers[i])}(e,i),i.finish()}function y(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,x,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var o=r.values;for(i=0;i<o.length;i++)e.writeMessage(4,E,o[i])}function x(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,v,t),e.writeVarintField(3,i.type),e.writeMessage(4,T,i)}function v(t,e){var i=t.feature,r=t.keys,n=t.values,o=t.keycache,s=t.valuecache;for(var a in i.properties){var l=i.properties[a],c=o[a];if(null!==l){void 0===c&&(r.push(a),o[a]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=s[u];void 0===p&&(n.push(l),s[u]=p=n.length-1),e.writeVarint(p)}}}function b(t,e){return(e<<3)+(7&t)}function w(t){return t<<1^t>>31}function T(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,o=0,s=i.length,a=0;a<s;a++){var l=i[a],c=1;1===r&&(c=l.length),e.writeVarint(b(1,c));for(var h=3===r?l.length-1:l.length,u=0;u<h;u++){1===u&&1!==r&&e.writeVarint(b(2,h-1));var p=l[u].x-n,d=l[u].y-o;e.writeVarint(w(p)),e.writeVarint(w(d)),n+=p,o+=d}3===r&&e.writeVarint(b(7,1))}}function E(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function S(t,e,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;A(t,e,s,r,n,o%2),S(t,e,i,r,s-1,o+1),S(t,e,i,s+1,n,o+1)}function A(t,e,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);A(t,e,i,Math.max(r,Math.floor(i-a*c/s+h)),Math.min(n,Math.floor(i+(s-a)*c/s+h)),o)}const s=e[2*i+o];let a=r,l=n;for(M(t,e,r,i),e[2*n+o]>s&&M(t,e,r,n);a<l;){for(M(t,e,a,l),a++,l--;e[2*a+o]<s;)a++;for(;e[2*l+o]>s;)l--}e[2*r+o]===s?M(t,e,r,l):(l++,M(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function M(t,e,i,r){I(t,i,r),I(e,2*i,2*r),I(e,2*i+1,2*r+1)}function I(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function C(t,e,i,r){const n=t-i,o=e-r;return n*n+o*o}m.fromVectorTileJs=g,m.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new p(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return g({layers:i})},m.GeoJSONWrapper=_;const z=t=>t[0],P=t=>t[1];class k{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:z,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Float64Array;this.nodeSize=r,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,s=this.ids=new o(t.length),a=this.coords=new n(2*t.length);for(let l=0;l<t.length;l++)s[l]=l,a[2*l]=e(t[l]),a[2*l+1]=i(t[l]);S(s,a,r,0,s.length-1,0)}range(t,e,i,r){return function(t,e,i,r,n,o,s){const a=[0,t.length-1,0],l=[];let c,h;for(;a.length;){const u=a.pop(),p=a.pop(),d=a.pop();if(p-d<=s){for(let s=d;s<=p;s++)c=e[2*s],h=e[2*s+1],c>=i&&c<=n&&h>=r&&h<=o&&l.push(t[s]);continue}const f=Math.floor((d+p)/2);c=e[2*f],h=e[2*f+1],c>=i&&c<=n&&h>=r&&h<=o&&l.push(t[f]);const m=(u+1)%2;(0===u?i<=c:r<=h)&&(a.push(d),a.push(f-1),a.push(m)),(0===u?n>=c:o>=h)&&(a.push(f+1),a.push(p),a.push(m))}return l}(this.ids,this.coords,t,e,i,r,this.nodeSize)}within(t,e,i){return function(t,e,i,r,n,o){const s=[0,t.length-1,0],a=[],l=n*n;for(;s.length;){const c=s.pop(),h=s.pop(),u=s.pop();if(h-u<=o){for(let n=u;n<=h;n++)C(e[2*n],e[2*n+1],i,r)<=l&&a.push(t[n]);continue}const p=Math.floor((u+h)/2),d=e[2*p],f=e[2*p+1];C(d,f,i,r)<=l&&a.push(t[p]);const m=(c+1)%2;(0===c?i-n<=d:r-n<=f)&&(s.push(u),s.push(p-1),s.push(m)),(0===c?i+n>=d:r+n>=f)&&(s.push(p+1),s.push(h),s.push(m))}return a}(this.ids,this.coords,t,e,i,this.nodeSize)}}const D={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},L=Math.fround||(B=new Float32Array(1),t=>(B[0]=+t,B[0]));var B;class R{constructor(t){this.options=Z(Object.create(D),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:i,maxZoom:r,nodeSize:n}=this.options;e&&console.time("total time");const o="prepare ".concat(t.length," points");e&&console.time(o),this.points=t;let s=[];for(let a=0;a<t.length;a++)t[a].geometry&&s.push(O(t[a],a));this.trees[r+1]=new k(s,q,W,n,Float32Array),e&&console.timeEnd(o);for(let a=r;a>=i;a--){const t=+Date.now();s=this._cluster(s,a),this.trees[a]=new k(s,q,W,n,Float32Array),e&&console.log("z%d: %d clusters in %dms",a,s.length,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,r,180,o],e),s=this.getClusters([-180,r,n,o],e);return t.concat(s)}const s=this.trees[this._limitZoom(e)],a=s.range(j(i),N(o),j(n),N(r)),l=[];for(const c of a){const t=s.points[c];l.push(t.numPoints?U(t):this.points[t.index])}return l}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.points[e];if(!o)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o.x,o.y,s),l=[];for(const c of a){const e=n.points[c];e.parentId===t&&l.push(e.numPoints?U(e):this.points[e.index])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,h={features:[]};return this._addTileFeatures(r.range((e-a)/n,l,(e+1+a)/n,c),r.points,e,i,n,h),0===e&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.points,n,i,n,h),e===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.points,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,n){const o=this.getChildren(e);for(const s of o){const e=s.properties;if(e&&e.cluster?n+e.point_count<=r?n+=e.point_count:n=this._appendLeaves(t,e.cluster_id,i,r,n):n<r?n++:t.push(s),t.length===i)break}return n}_addTileFeatures(t,e,i,r,n,o){for(const s of t){const t=e[s],a=t.numPoints;let l,c,h;if(a)l=V(t),c=t.x,h=t.y;else{const e=this.points[t.index];l=e.properties,c=j(e.geometry.coordinates[0]),h=N(e.geometry.coordinates[1])}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let p;a?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(u.id=p),o.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const i=[],{radius:r,extent:n,reduce:o,minPoints:s}=this.options,a=r/(n*Math.pow(2,e));for(let l=0;l<t.length;l++){const r=t[l];if(r.zoom<=e)continue;r.zoom=e;const n=this.trees[e+1],c=n.within(r.x,r.y,a),h=r.numPoints||1;let u=h;for(const t of c){const i=n.points[t];i.zoom>e&&(u+=i.numPoints||1)}if(u>h&&u>=s){let t=r.x*h,s=r.y*h,a=o&&h>1?this._map(r,!0):null;const p=(l<<5)+(e+1)+this.points.length;for(const i of c){const l=n.points[i];if(l.zoom<=e)continue;l.zoom=e;const c=l.numPoints||1;t+=l.x*c,s+=l.y*c,l.parentId=p,o&&(a||(a=this._map(r,!0)),o(a,this._map(l)))}r.parentId=p,i.push(F(t/u,s/u,p,u,a))}else if(i.push(r),u>1)for(const t of c){const r=n.points[t];r.zoom<=e||(r.zoom=e,i.push(r))}}return i}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?Z({},t.properties):t.properties;const i=this.points[t.index].properties,r=this.options.map(i);return e&&r===i?Z({},r):r}}function F(t,e,i,r,n){return{x:L(t),y:L(e),zoom:1/0,id:i,parentId:-1,numPoints:r,properties:n}}function O(t,e){const[i,r]=t.geometry.coordinates;return{x:L(j(i)),y:L(N(r)),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:V(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),G(t.y)]}};var e}function V(t){const e=t.numPoints,i=e>=1e4?"".concat(Math.round(e/1e3),"k"):e>=1e3?Math.round(e/100)/10+"k":e;return Z(Z({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function j(t){return t/360+.5}function N(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function G(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Z(t,e){for(const i in e)t[i]=e[i];return t}function q(t){return t.x}function W(t){return t.y}function X(t,e,i,r){for(var n,o=r,s=i-e>>1,a=i-e,l=t[e],c=t[e+1],h=t[i],u=t[i+1],p=e+3;p<i;p+=3){var d=H(t[p],t[p+1],l,c,h,u);if(d>o)n=p,o=d;else if(d===o){var f=Math.abs(p-s);f<a&&(n=p,a=f)}}o>r&&(n-e>3&&X(t,e,n,r),t[n+2]=o,i-n>3&&X(t,n,i,r))}function H(t,e,i,r,n,o){var s=n-i,a=o-r;if(0!==s||0!==a){var l=((t-i)*s+(e-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return(s=t-i)*s+(a=e-r)*a}function Y(t,e,i,r){var n={id:void 0===t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)K(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<e.length;r++)K(t,e[r]);else if("MultiPolygon"===i)for(r=0;r<e.length;r++)for(var n=0;n<e[r].length;n++)K(t,e[r][n])}(n),n}function K(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function J(t,e,i,r){if(e.geometry){var n=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)Q(n,a);else if("MultiPoint"===o)for(var c=0;c<n.length;c++)Q(n[c],a);else if("LineString"===o)$(n,a,s,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(c=0;c<n.length;c++)$(n[c],a=[],s,!1),t.push(Y(l,"LineString",a,e.properties));return}tt(n,a,s,!1)}else if("Polygon"===o)tt(n,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)J(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<n.length;c++){var h=[];tt(n[c],h,s,!0),a.push(h)}}t.push(Y(l,o,a,e.properties))}}function Q(t,e){e.push(et(t[0])),e.push(it(t[1])),e.push(0)}function $(t,e,i,r){for(var n,o,s=0,a=0;a<t.length;a++){var l=et(t[a][0]),c=it(t[a][1]);e.push(l),e.push(c),e.push(0),a>0&&(s+=r?(n*c-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(c-o,2))),n=l,o=c}var h=e.length-3;e[2]=1,X(e,0,h,i),e[h+2]=1,e.size=Math.abs(s),e.start=0,e.end=e.size}function tt(t,e,i,r){for(var n=0;n<t.length;n++){var o=[];$(t[n],o,i,r),e.push(o)}}function et(t){return t/360+.5}function it(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function rt(t,e,i,r,n,o,s,a){if(r/=e,o>=(i/=e)&&s<r)return t;if(s<i||o>=r)return null;for(var l=[],c=0;c<t.length;c++){var h=t[c],u=h.geometry,p=h.type,d=0===n?h.minX:h.minY,f=0===n?h.maxX:h.maxY;if(d>=i&&f<r)l.push(h);else if(!(f<i||d>=r)){var m=[];if("Point"===p||"MultiPoint"===p)nt(u,m,i,r,n);else if("LineString"===p)ot(u,m,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===p)at(u,m,i,r,n,!1);else if("Polygon"===p)at(u,m,i,r,n,!0);else if("MultiPolygon"===p)for(var _=0;_<u.length;_++){var g=[];at(u[_],g,i,r,n,!0),g.length&&m.push(g)}if(m.length){if(a.lineMetrics&&"LineString"===p){for(_=0;_<m.length;_++)l.push(Y(h.id,p,m[_],h.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===m.length?(p="LineString",m=m[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===m.length?"Point":"MultiPoint"),l.push(Y(h.id,p,m,h.tags))}}}return l.length?l:null}function nt(t,e,i,r,n){for(var o=0;o<t.length;o+=3){var s=t[o+n];s>=i&&s<=r&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function ot(t,e,i,r,n,o,s){for(var a,l,c=st(t),h=0===n?ct:ht,u=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],m=t[p+2],_=t[p+3],g=t[p+4],y=0===n?d:f,x=0===n?_:g,v=!1;s&&(a=Math.sqrt(Math.pow(d-_,2)+Math.pow(f-g,2))),y<i?x>i&&(l=h(c,d,f,_,g,i),s&&(c.start=u+a*l)):y>r?x<r&&(l=h(c,d,f,_,g,r),s&&(c.start=u+a*l)):lt(c,d,f,m),x<i&&y>=i&&(l=h(c,d,f,_,g,i),v=!0),x>r&&y<=r&&(l=h(c,d,f,_,g,r),v=!0),!o&&v&&(s&&(c.end=u+a*l),e.push(c),c=st(t)),s&&(u+=a)}var b=t.length-3;d=t[b],f=t[b+1],m=t[b+2],(y=0===n?d:f)>=i&&y<=r&<(c,d,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&<(c,c[0],c[1],c[2]),c.length&&e.push(c)}function st(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,i,r,n,o){for(var s=0;s<t.length;s++)ot(t[s],e,i,r,n,o,!1)}function lt(t,e,i,r){t.push(e),t.push(i),t.push(r)}function ct(t,e,i,r,n,o){var s=(o-e)/(r-e);return t.push(o),t.push(i+(n-i)*s),t.push(1),s}function ht(t,e,i,r,n,o){var s=(o-i)/(n-i);return t.push(e+(r-e)*s),t.push(o),t.push(1),s}function ut(t,e){for(var i=[],r=0;r<t.length;r++){var n,o=t[r],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)n=pt(o.geometry,e);else if("MultiLineString"===s||"Polygon"===s){n=[];for(var a=0;a<o.geometry.length;a++)n.push(pt(o.geometry[a],e))}else if("MultiPolygon"===s)for(n=[],a=0;a<o.geometry.length;a++){for(var l=[],c=0;c<o.geometry[a].length;c++)l.push(pt(o.geometry[a][c],e));n.push(l)}i.push(Y(o.id,s,n,o.tags))}return i}function pt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function dt(t,e){if(t.transformed)return t;var i,r,n,o=1<<t.z,s=t.x,a=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],c=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<c.length;r+=2)l.geometry.push(ft(c[r],c[r+1],e,o,s,a));else for(r=0;r<c.length;r++){var u=[];for(n=0;n<c[r].length;n+=2)u.push(ft(c[r][n],c[r][n+1],e,o,s,a));l.geometry.push(u)}}return t.transformed=!0,t}function ft(t,e,i,r,n,o){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-o))]}function mt(t,e,i,r,n){for(var o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){s.numFeatures++,_t(s,t[a],o,n);var l=t[a].minX,c=t[a].minY,h=t[a].maxX,u=t[a].maxY;l<s.minX&&(s.minX=l),c<s.minY&&(s.minY=c),h>s.maxX&&(s.maxX=h),u>s.maxY&&(s.maxY=u)}return s}function _t(t,e,i,r){var n=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<n.length;a+=3)s.push(n[a]),s.push(n[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)gt(s,n,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<n.length;a++)gt(s,n[a],t,i,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<n.length;l++){var c=n[l];for(a=0;a<c.length;a++)gt(s,c[a],t,i,!0,0===a)}if(s.length){var h=e.tags||null;if("LineString"===o&&r.lineMetrics){for(var u in h={},e.tags)h[u]=e.tags[u];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var p={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:h};null!==e.id&&(p.id=e.id),t.features.push(p)}}function gt(t,e,i,r,n,o){var s=r*r;if(r>0&&e.size<(n?s:r))i.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>s)&&(i.numSimplified++,a.push(e[l]),a.push(e[l+1])),i.numPoints++;n&&function(t,e){for(var i=0,r=0,n=t.length,o=n-2;r<n;o=r,r+=2)i+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(i>0===e)for(r=0,n=t.length;r<n/2;r+=2){var s=t[r],a=t[r+1];t[r]=t[n-2-r],t[r+1]=t[n-1-r],t[n-2-r]=s,t[n-1-r]=a}}(a,o),t.push(a)}}function yt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)J(i,t.features[r],e,r);else J(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(r=function(t,e){var i=e.buffer/e.extent,r=t,n=rt(t,1,-1-i,i,0,-1,2,e),o=rt(t,1,1-i,2+i,0,-1,2,e);return(n||o)&&(r=rt(t,1,-i,1+i,0,-1,2,e)||[],n&&(r=ut(n,1).concat(r)),o&&(r=r.concat(ut(o,-1)))),r}(r,e)).length&&this.splitTile(r,0,0,0),i&&(r.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 xt(t,e,i){return 32*((1<<t)*i+e)+t}function vt(t,e){const i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return e(null,null);const n=new h(r.features);let o=m(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:n,rawData:o.buffer})}yt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},yt.prototype.splitTile=function(t,e,i,r,n,o,s){for(var a=[t,e,i,r],l=this.options,c=l.debug;a.length;){r=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();var h=1<<e,u=xt(e,i,r),p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=mt(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,n){if(e===l.maxZoom||e===n)continue;var f=1<<n-e;if(i!==Math.floor(o/f)||r!==Math.floor(s/f))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){c>1&&console.time("clipping");var m,_,g,y,x,v,b=.5*l.buffer/l.extent,w=.5-b,T=.5+b,E=1+b;m=_=g=y=null,x=rt(t,h,i-b,i+T,0,p.minX,p.maxX,l),v=rt(t,h,i+w,i+E,0,p.minX,p.maxX,l),t=null,x&&(m=rt(x,h,r-b,r+T,1,p.minY,p.maxY,l),_=rt(x,h,r+w,r+E,1,p.minY,p.maxY,l),x=null),v&&(g=rt(v,h,r-b,r+T,1,p.minY,p.maxY,l),y=rt(v,h,r+w,r+E,1,p.minY,p.maxY,l),v=null),c>1&&console.timeEnd("clipping"),a.push(m||[],e+1,2*i,2*r),a.push(_||[],e+1,2*i,2*r+1),a.push(g||[],e+1,2*i+1,2*r),a.push(y||[],e+1,2*i+1,2*r+1)}}},yt.prototype.getTile=function(t,e,i){var r=this.options,n=r.extent,o=r.debug;if(t<0||t>24)return null;var s=1<<t,a=xt(t,e=(e%s+s)%s,i);if(this.tiles[a])return dt(this.tiles[a],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,c=t,h=e,u=i;!l&&c>0;)c--,h=Math.floor(h/2),u=Math.floor(u/2),l=this.tiles[xt(c,h,u)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,h,u),o>1&&console.time("drilling down"),this.splitTile(l.source,c,h,u,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?dt(this.tiles[a],n):null):null};class bt extends t.VectorTileWorkerSource{constructor(t,e,i,r,n){super(t,e,i,r,vt),n&&(this.loadGeoJSON=n)}loadData(e,i){const r=e&&e.request,n=r&&r.collectResourceTiming;this.loadGeoJSON(e,((s,a)=>{if(s||!a)return i(s);if("object"!=typeof a)return i(new Error("Input data given to '".concat(e.source,"' is not a valid GeoJSON object.")));{o(a,!0);try{if(e.filter){const i=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>"".concat(t.key,": ").concat(t.message))).join(", "));const r=a.features.filter((t=>i.value.evaluate({zoom:0},t)));a={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new R(function(e){let{superclusterOptions:i,clusterProperties:r}=e;if(!r||!i)return i;const n={},o={},s={accumulated:null,zoom:0},a={properties:null},l=Object.keys(r);for(const c of l){const[e,i]=r[c],s=t.createExpression(i),a=t.createExpression("string"==typeof e?[e,["accumulated"],["get",c]]:e);n[c]=s.value,o[c]=a.value}return i.map=t=>{a.properties=t;const e={};for(const i of l)e[i]=n[i].evaluate(s,a);return e},i.reduce=(t,e)=>{a.properties=e;for(const i of l)s.accumulated=t[i],t[i]=o[i].evaluate(s,a)},i}(e)).load(a.features):function(t,e){return new yt(t,e)}(a,e.geojsonVtOptions)}catch(s){return i(s)}this.loaded={};const l={};if(n){const i=t.getPerformanceMeasurement(r);i&&(l.resourceTiming={},l.resourceTiming[e.source]=JSON.parse(JSON.stringify(i)))}i(null,l)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,i){if(e.request)t.getJSON(e.request,i);else{if("string"!=typeof e.data)return i(new Error("Input data given to '".concat(e.source,"' is not a valid GeoJSON object.")));try{return i(null,JSON.parse(e.data))}catch(t){return i(new Error("Input data given to '".concat(e.source,"' is not a valid GeoJSON object.")))}}}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class wt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=t.getProjection({name:"mercator"}),this.workerSourceTypes={vector:t.VectorTileWorkerSource,geojson:bt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error('Worker source with name "'.concat(t,'" already registered.'));this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}clearCaches(t,e,i){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],i()}checkIfReady(t,e,i){i()}setReferrer(t,e){this.referrer=e}spriteLoaded(e,i){this.isSpriteLoaded[e]=i;for(const r in this.workerSources[e]){const n=this.workerSources[e][r];for(const e in n)n[e]instanceof t.VectorTileWorkerSource&&(n[e].isSpriteLoaded=i,n[e].fire(new t.Event("isSpriteLoaded")))}}setImages(t,e,i){this.availableImages[t]=e;for(const r in this.workerSources[t]){const i=this.workerSources[t][r];for(const t in i)i[t].availableImages=e}i()}enableTerrain(t,e,i){this.terrain=e,i()}setProjection(e,i){this.projections[e]=t.getProjection(i)}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(e,i,r){const n=this.enableTerrain?t.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source).loadTile(n,r)}loadDEMTile(e,i,r){const n=this.enableTerrain?t.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(e,i.source).loadTile(n,r)}reloadTile(e,i,r){const n=this.enableTerrain?t.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source).reloadTile(n,r)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,r){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();r(i?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(e)),i)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new r),e}getWorkerSource(t,e,i){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][i]||(this.workerSources[t][e][i]=new this.workerSourceTypes[e]({send:(e,i,r,n,o,s)=>{this.actor.send(e,i,r,t,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(t),this.getAvailableImages(t),this.isSpriteLoaded[t])),this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new n),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,i){t.enforceCacheSizeLimit(i)}getWorkerPerformanceMetrics(t,e,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new wt(self)),wt})),r(["./shared"],(function(t){function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const r in t)if(!e(t[r],i[r]))return!1;return!0}return t===i}var i=r;function r(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{e=new Worker(r),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===n[e=t&&t.failIfMajorPerformanceCaveat]&&(n[e]=function(t){var e,i=function(t){var e=document.createElement("canvas"),i=Object.create(r.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,e.getContext("webgl",i)||e.getContext("experimental-webgl",i)}(t);if(!i)return!1;try{e=i.createShader(i.VERTEX_SHADER)}catch(t){return!1}return!(!e||i.isContextLost())&&(i.shaderSource(e,"void main() {}
1"),i.compileShader(e),!0===i.getShaderParameter(e,i.COMPILE_STATUS))}(e)),n[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var n={};function o(e,i,r){const n=t.window.document.createElement(e);return void 0!==i&&(n.className=i),r&&r.appendChild(n),n}function s(e,i,r){const n=t.window.document.createElementNS("http://www.w3.org/2000/svg",e);for(const t of Object.keys(i))n.setAttributeNS(null,t,i[t]);return r&&r.appendChild(n),n}r.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const a=t.window.document&&t.window.document.documentElement.style,l=a&&void 0!==a.userSelect?"userSelect":"WebkitUserSelect";let c;function h(){a&&l&&(c=a[l],a[l]="none")}function u(){a&&l&&(a[l]=c)}function p(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",p,!0)}function d(){t.window.addEventListener("click",p,!0),t.window.setTimeout((()=>{t.window.removeEventListener("click",p,!0)}),0)}function f(t,e){const i=t.getBoundingClientRect();return g(t,i,e)}function m(t,e){const i=t.getBoundingClientRect(),r=[];for(let n=0;n<e.length;n++)r.push(g(t,i,e[n]));return r}function _(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function g(e,i,r){const n=e.offsetWidth===i.width?1:e.offsetWidth/i.width;return new t.pointGeometry((r.clientX-i.left)*n,(r.clientY-i.top)*n)}function y(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=i*o-n*r;return s?(t[0]=o*(s=1/s),t[1]=-r*s,t[2]=-n*s,t[3]=i*s,t):null}function x(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class v extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}hasImage(t){return!!this.getImage(t)}getImage(t){return this.images[t]}addImage(t,e){this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "content" value')))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const r of t)this.images[r]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const r={};for(const n of e){this.images[n]||this.fire(new t.Event("styleimagemissing",{id:n}));const e=this.images[n];e?r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce('Image "'.concat(n,'" 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.'))}i(null,r)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.ImagePosition(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.potpack(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const o in this.patterns){const{bin:e}=this.patterns[o],i=e.x+1,r=e.y+1,s=this.images[o].data,a=s.width,l=s.height;t.RGBAImage.copy(s,n,{x:0,y:0},{x:i,y:r},{width:a,height:l}),t.RGBAImage.copy(s,n,{x:0,y:l-1},{x:i,y:r-1},{width:a,height:1}),t.RGBAImage.copy(s,n,{x:0,y:0},{x:i,y:r+l},{width:a,height:1}),t.RGBAImage.copy(s,n,{x:a-1,y:0},{x:i-1,y:r},{width:1,height:l}),t.RGBAImage.copy(s,n,{x:0,y:0},{x:i+a,y:r},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}
vendor: 41,170 bytes, line 1
1dispatchRenderCallbacks(t){for(const e of t){if(this.callbackDispatchedThisFrame[e])continue;this.callbackDispatchedThisFrame[e]=!0;const t=this.images[e];x(t)&&this.updateImage(e,t)}}}const b=new t.Properties({anchor:new t.DataConstantProperty(t.spec.light.anchor),position:new class{constructor(){this.specification=t.spec.light.position}possiblyEvaluate(e,i){return function(e){let[i,r,n]=e;const o=t.degToRad(r+90),s=t.degToRad(n);return{x:i*Math.cos(o)*Math.sin(s),y:i*Math.sin(o)*Math.sin(s),z:i*Math.cos(s),azimuthal:r,polar:n}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.number(e.x,i.x,r),y:t.number(e.y,i.y,r),z:t.number(e.z,i.z,r),azimuthal:t.number(e.azimuthal,i.azimuthal,r),polar:t.number(e.polar,i.polar,r)}}},color:new t.DataConstantProperty(t.spec.light.color),intensity:new t.DataConstantProperty(t.spec.light.intensity)}),w="-transition";class T extends t.Evented{constructor(e){super(),this._transitionable=new t.Transitionable(b),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(t.validateLight,e,i))for(const r in e){const i=e[r];t.endsWith(r,w)?this._transitionable.setTransition(r.slice(0,-w.length),i):this._transitionable.setValue(r,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))}}const E=new t.Properties({source:new t.DataConstantProperty(t.spec.terrain.source),exaggeration:new t.DataConstantProperty(t.spec.terrain.exaggeration)}),S="-transition";class A extends t.Evented{constructor(e,i){super(),this._transitionable=new t.Transitionable(E),this.set(e),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i}get(){return this._transitionable.serialize()}set(e){for(const i in e){const r=e[i];t.endsWith(i,S)?this._transitionable.setTransition(i.slice(0,-S.length),r):this._transitionable.setValue(i,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}}function M(e,i,r,n){const o=t.smoothstep(45,65,r),[s,a]=I(e,n),l=t.length(i);let c=1-Math.min(1,Math.exp((l-s)/(a-s)*-6));return c*=c*c,c=Math.min(1,1.00747*c),c*o*e.alpha}function I(t,e){const i=.5/Math.tan(.5*e);return[t.range[0]+i,t.range[1]+i]}const C=new t.Properties({range:new t.DataConstantProperty(t.spec.fog.range),color:new t.DataConstantProperty(t.spec.fog.color),"high-color":new t.DataConstantProperty(t.spec.fog["high-color"]),"space-color":new t.DataConstantProperty(t.spec.fog["space-color"]),"horizon-blend":new t.DataConstantProperty(t.spec.fog["horizon-blend"]),"star-intensity":new t.DataConstantProperty(t.spec.fog["star-intensity"])}),z="-transition";class P extends t.Evented{constructor(e,i){super(),this._transitionable=new t.Transitionable(C),this.set(e),this._transitioning=this._transitionable.untransitioned(),this._transform=i}get state(){const e=this._transform,i="globe"===e.projection.name,r=t.globeToMercatorTransition(e.zoom),n=this.properties.get("range"),o=[.5,3];return{range:i?[t.number(o[0],n[0],r),t.number(o[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(t.validateFog,e,i)){for(const i of Object.keys(t.spec.fog))e&&void 0===e[i]&&(e[i]=t.spec.fog[i].default);for(const i in e){const r=e[i];t.endsWith(i,z)?this._transitionable.setTransition(i.slice(0,-z.length),r):this._transitionable.setValue(i,r)}}}getOpacity(e){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:t.smoothstep(45,65,e))*i.a}getOpacityAtLatLng(e,i){return this._transform.projection.supportsFog?function(e,i,r){const n=t.MercatorCoordinate.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0,s=[n.x,n.y,o];return t.transformMat4(s,s,r.mercatorFogMatrix),M(e,s,r.pitch,r._fov)}(this.state,e,i):0}getFovAdjustedRange(t){return this._transform.projection.supportsFog?I(this.state,t):[0,1]}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))}}class k{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t.uniqueId();const r=this.workerPool.acquire(this.id);for(let t=0;t<r.length;t++){const e=new k.Actor(r[t],i,this.id);e.name="Worker ".concat(t),this.actors.push(e)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(e,i,r){t.asyncAll(this.actors,((t,r)=>{t.send(e,i,r)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove()})),this.actors=[],this.workerPool.release(this.id)}}function D(e,i,r){return i*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}k.Actor=t.Actor;class L{constructor(t,e,i,r){this.screenBounds=t,this.cameraPoint=e,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,r)}static createFromScreenPoints(e,i){let r,n;if(e instanceof t.pointGeometry||"number"==typeof e[0]){const o=t.pointGeometry.convert(e);r=[t.pointGeometry.convert(e)],n=i.isPointAboveHorizon(o)}else{const o=t.pointGeometry.convert(e[0]),s=t.pointGeometry.convert(e[1]);r=[o,s],n=t.polygonizeBounds(o,s).every((t=>i.isPointAboveHorizon(t)))}return new L(r,i.getCameraPoint(),n,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(e){return t.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)}bufferedCameraGeometry(e){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new t.pointGeometry(1,1)):this.screenBounds[1],n=t.polygonizeBounds(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),t.bufferConvexPolygon(n,e)}bufferedCameraGeometryGlobe(e){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new t.pointGeometry(1,1)):this.screenBounds[1],n=t.polygonizeBounds(i,r,e),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>r.y))+((o.x>i.x)+(o.x>r.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(e,i,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const o=e.queryPadding/i._pixelsPerMercatorPixel+1,s=r?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=e.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map((i=>t.getTilePoint(e.tileTransform,i,a)));if(!t.polygonIntersectsBox(l,0,0,t.EXTENT,t.EXTENT))return;a=e.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map((i=>t.getTileVec3(e.tileTransform,i,a))),h=c.map((e=>new t.pointGeometry(e[0],e[1]))),u=i.getFreeCameraOptions().position||new t.MercatorCoordinate(0,0,0),p=t.getTileVec3(e.tileTransform,u,a),d=c.map((e=>{const i=t.sub(e,e,p);return t.normalize(i,i),new t.Ray(p,i)})),f=D(e,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:d,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=t.getBounds(l),m.min.x=t.clamp(m.min.x,0,t.EXTENT),m.min.y=t.clamp(m.min.y,0,t.EXTENT),m.max.x=t.clamp(m.max.x,0,t.EXTENT),m.max.y=t.clamp(m.max.y,0,t.EXTENT),m),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(t,e){const i=F(t);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===e.projection.name?this._projectAndResample(this.bufferedScreenGeometry(t),e):{polygon:this.bufferedScreenGeometry(t).map((t=>e.pointCoordinate3D(t))),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(t,e){const i=F(t);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===e.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),e):{polygon:this.bufferedCameraGeometry(t).map((t=>e.pointCoordinate3D(t))),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(e,i){const r=function(e,i){const r=t.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-t.GLOBE_RADIUS,0,1],o=[0,t.GLOBE_RADIUS,0,1],s=[0,0,0,1];t.transformMat4$1(n,n,r),t.transformMat4$1(o,o,r),t.transformMat4$1(s,s,r);const a=new t.pointGeometry(n[0]/n[3],n[1]/n[3]),l=new t.pointGeometry(o[0]/o[3],o[1]/o[3]),c=t.polygonContainsPoint(e,a)&&n[3]<s[3],h=t.polygonContainsPoint(e,l)&&o[3]<s[3];if(!c&&!h)return null;const u=function(t,e,i){for(let r=1;r<t.length;r++){const n=R(e.pointCoordinate3D(t[r-1]).x),o=R(e.pointCoordinate3D(t[r]).x);if(i<0){if(n<o)return{idx:r,t:-n/(o-1-n)}}else if(o<n)return{idx:r,t:(1-n)/(o+1-n)}}return null}(e,i,c?-1:1);if(!u)return null;const{idx:p,t:d}=u;let f=p>1?B(e.slice(0,p),i):[],m=p<e.length?B(e.slice(p),i):[];f=f.map((e=>new t.pointGeometry(R(e.x),e.y))),m=m.map((e=>new t.pointGeometry(R(e.x),e.y)));const _=[...f];0===_.length&&_.push(m[m.length-1]);const g=t.number(_[_.length-1].y,(0===m.length?f[0]:m[0]).y,d);let y;return y=c?[new t.pointGeometry(0,g),new t.pointGeometry(0,0),new t.pointGeometry(1,0),new t.pointGeometry(1,g)]:[new t.pointGeometry(1,g),new t.pointGeometry(1,1),new t.pointGeometry(0,1),new t.pointGeometry(0,g)],_.push(...y),0===m.length?_.push(f[0]):_.push(...m),{polygon:_.map((e=>new t.MercatorCoordinate(e.x,e.y))),unwrapped:!1}}(e,i);if(r)return r;const n=function(e,i){let r=!1,n=-1/0,o=0;for(let t=0;t<e.length-1;t++)e[t].x>n&&(n=e[t].x,o=t);for(let t=0;t<e.length-1;t++){const i=(o+t)%(e.length-1),n=e[i],s=e[i+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===i&&(e[e.length-1].x+=1)):(s.x+=1,i+1===e.length-1&&(e[0].x+=1)),r=!0)}const s=t.mercatorXfromLng(i.center.lng);return r&&s<Math.abs(s-1)&&e.forEach((t=>{t.x-=1})),{polygon:e,unwrapped:r}}(B(e,i).map((e=>new t.pointGeometry(R(e.x),e.y))),i);return{polygon:n.polygon.map((e=>new t.MercatorCoordinate(e.x,e.y))),unwrapped:n.unwrapped}}}function B(e,i){return t.resample(e,(t=>{const e=i.pointCoordinate3D(t);t.x=e.x,t.y=e.y}),1/256)}function R(t){return t<0?1+t%1:t%1}function F(t){return 100*t|0}function O(e,i,r,n,o){const s=function(r,n){if(r)return o(r);if(n){const r=t.pick(t.extend(n,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(r.vectorLayers=n.vector_layers,r.vectorLayerIds=r.vectorLayers.map((t=>t.id))),n.language_options&&(r.languageOptions=n.language_options),n.language&&n.language[n.id]&&(r.language=n.language[n.id]),n.worldview_options&&(r.worldviewOptions=n.worldview_options),n.worldview?r.worldview=n.worldview[n.id]:n.worldview_default&&(r.worldview=n.worldview_default),r.tiles=i.canonicalizeTileset(r,e.url),o(null,r)}};return e.url?t.getJSON(i.transformRequest(i.normalizeSourceURL(e.url,null,r,n),t.ResourceType.Source),s):t.exported.frame((()=>s(null,e)))}class U{constructor(e,i,r){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=r&&e.x<o&&e.y>=n&&e.y<s}}class V{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||e.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const j={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class N{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||e.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[j[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class G{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Z extends G{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class q extends G{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class W extends G{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class X extends G{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class H extends G{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Y extends G{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class K extends G{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class J extends G{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Q extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class $ extends G{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class tt extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class et extends G{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class it extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class rt extends G{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class nt extends G{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ot extends G{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class st extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class at extends G{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class lt extends G{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ct extends G{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ht extends G{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ut extends G{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pt extends G{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class dt extends G{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ft extends G{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class mt extends G{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _t extends G{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class gt extends G{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class yt extends G{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class xt extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class vt extends G{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class bt extends G{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class wt extends bt{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Tt extends bt{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,this.attachment(),e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Et extends Tt{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class St{constructor(t,e,i,r){this.context=t,this.width=e,this.height=i;const n=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new wt(t,n),r&&(this.depthAttachment=new Tt(t,n))}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class At{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Z(this),this.clearDepth=new q(this),this.clearStencil=new W(this),this.colorMask=new X(this),this.depthMask=new H(this),this.stencilMask=new Y(this),this.stencilFunc=new K(this),this.stencilOp=new J(this),this.stencilTest=new Q(this),this.depthRange=new $(this),this.depthTest=new tt(this),this.depthFunc=new et(this),this.blend=new it(this),this.blendFunc=new rt(this),this.blendColor=new nt(this),this.blendEquation=new ot(this),this.cullFace=new st(this),this.cullFaceSide=new at(this),this.frontFace=new lt(this),this.program=new ct(this),this.activeTexture=new ht(this),this.viewport=new ut(this),this.bindFramebuffer=new pt(this),this.bindRenderbuffer=new dt(this),this.bindTexture=new ft(this),this.bindVertexBuffer=new mt(this),this.bindElementBuffer=new _t(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new gt(this),this.pixelStoreUnpack=new yt(this),this.pixelStoreUnpackPremultiplyAlpha=new xt(this),this.pixelStoreUnpackFlipY=new vt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=t.getExtension("OES_standard_derivatives"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new V(this,t,e)}createVertexBuffer(t,e,i){return new N(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i){return new St(this,t,e,i)}clear(t){let{color:e,depth:i,stencil:r}=t;const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!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(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(i){e(i.blendFunction,t.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Mt extends t.Evented{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=O(this._options,this.map._requestManager,null,null,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new U(i.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(i.tiles),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const r=t.exported.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),((r,n,o,s)=>(delete e.request,e.aborted?(e.state="unloaded",i(null)):r?(e.state="errored",i(r)):n?(this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:o,expires:s}),e.setTexture(n,this.map.painter),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),void i(null)):i(null))))}static loadTileData(t,e,i){t.setTexture(e,i)}static unloadTileData(t,e){t.texture&&e.saveTileTexture(t.texture)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let It;function Ct(e,i,r,n,o,s,a,l){const c=[e,r,o,i,n,s,1,1,1],h=[a,l,1],u=t.adjoint([],c),[p,d,f]=t.transformMat3(h,h,t.transpose(u,u));return t.multiply$1(c,[p,0,0,0,d,0,0,0,f],c)}class zt extends t.Evented{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(e,i){this._loaded=i||!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),((i,r)=>{if(this._loaded=!0,i)this.fire(new t.ErrorEvent(i));else if(r){const{HTMLImageElement:i}=t.window;this.image=r instanceof i?t.exported.getImageData(r):r,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading()}}))}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this.texture&&this.texture.destroy()}setCoordinates(e){this.coordinates=e,this._boundsArray=void 0;const i=e.map(t.MercatorCoordinate.fromLngLat);return this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const s=Math.max(n-i,o-r),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.CanonicalTileID(a,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(e){for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray)return;const i=t.tileTransform(this.tileID,this.map.transform.projection),[r,n,o,s]=this.coordinates.map((e=>{const r=i.projection.project(e[0],e[1]);return t.getTilePoint(i,r)._round()}));this.perspectiveTransform=function(e,i,r,n,o,s,a,l,c,h){const u=Ct(0,0,e,0,0,i,e,i),p=Ct(r,n,o,s,a,l,c,h);return t.multiply$1(p,t.adjoint(u,u),p),[p[6]/p[8]*e/t.EXTENT,p[7]/p[8]*i/t.EXTENT]}(this.width,this.height,r.x,r.y,n.x,n.y,s.x,s.y,o.x,o.y);const a=this._boundsArray=new t.StructArrayLayout4i8;a.emplaceBack(r.x,r.y,0,0),a.emplaceBack(n.x,n.y,t.EXTENT,0),a.emplaceBack(s.x,s.y,0,t.EXTENT),a.emplaceBack(o.x,o.y,t.EXTENT,t.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=e.createVertexBuffer(a,t.boundsAttributes.members),this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture?this.texture.update(this.image):(this.texture=new t.Texture(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._prepareData(e)}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Pt={vector:class extends t.Evented{constructor(e,i,r,n){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new t.DedupedRequest}load(e){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"}));const i=this.language||this.map._language,r=this.worldview||this.map._worldview;this._tileJSONRequest=O(this._options,this.map._requestManager,i,r,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn("Ensure that your requested language string is a valid BCP-47 code. Found: ".concat(i)),r&&2!==r.length&&console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(r)),this.fire(new t.ErrorEvent(n))):o&&(t.extend(this,o),o.bounds&&(this.tileBounds=new U(o.bounds,this.minzoom,this.maxzoom)),t.postTurnstileEvent(o.tiles,this.map._requestManager._customAccessToken),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"}))),e&&e(n)}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load((()=>{const t=this.map.style._getSourceCaches(this.id);for(const e of t)e.clearTiles()}))}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}_setLanguage(t){return t===this.language||this.setSourceProperty((()=>{this.language=t})),this}_setWorldview(t){return t===this.worldview?this:this.worldviewOptions&&t&&!this.worldviewOptions[t]?(console.warn('Vector tile source "'.concat(this.id,'" does not support worldview "').concat(t,'".')),this):(this.setSourceProperty((()=>{this.worldview=t})),this)}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,i){const r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,t.ResourceType.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile};if(n.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state)"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",n,o.bind(this));else if(e.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor(),this.dispatcher.ready)e.request=e.actor.send("loadTile",n,o.bind(this),void 0,!0);else{const i=t.loadVectorTile.call({deduped:this._deduped},n,((t,i)=>{t||!i?o.call(this,t):(n.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},e.actor&&e.actor.send("loadTile",n,o.bind(this),void 0,!0))}),!0);e.request={cancel:i}}function o(r,n){return delete e.request,e.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id})}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:Mt,"raster-dem":class extends Mt{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(e,i){const r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(t,r){t&&(e.state="errored",i(t)),r&&(e.dem=r,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(r,t.ResourceType.Tile),function(r,o,s,a){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(r)e.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:s,expires:a});const i=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&(null==It&&(It=t.window.OffscreenCanvas&&new t.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof t.window.createImageBitmap),It),r=1-(o.width-t.prevPowerOfTwo(o.width))/2;r<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));const l=i?o:t.exported.getImageData(o,r),c={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:r};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,a=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded"}},geojson:class extends t.Evented{constructor(e,i,r,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(void 0!==i.clusterRadius?i.clusterRadius:50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}onAdd(t){this.map=t,this.setData(this._data)}setData(t){return this._data=t,this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},r),this}_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new t.Event("dataloading",{dataType:"source"})),this._loaded=!1;const e=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(e.request=this.map._requestManager.transformRequest(t.exported.resolveURL(i),t.ResourceType.Source),e.request.collectResourceTiming=this._collectResourceTiming):e.data=JSON.stringify(i),this._pendingLoad=this.actor.send("".concat(this.type,".loadData"),e,((e,i)=>{if(this._loaded=!0,this._pendingLoad=null,e)this.fire(new t.ErrorEvent(e));else{const e={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&i&&i.resourceTiming&&i.resourceTiming[this.id]&&(e.resourceTiming=i.resourceTiming[this.id]),this.fire(new t.Event("data",e)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(e,i){const r=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(r,{type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((t,n)=>(delete e.request,e.unloadVectorData(),e.aborted?i(null):t?i(t):(e.loadVectorData(n,this.map.painter,"reloadTile"===r),i(null)))),void 0,"loadTile"===r)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.t
1ype,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends zt{constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,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(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(i.start(0)," and ").concat(i.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(e)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:zt,canvas:class extends zt{constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(e),null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources.".concat(e),null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}},custom:class extends t.Evented{constructor(e,i,r,n){super(),this.id=e,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=i,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 t.ErrorEvent(new Error("Missing implementation for ".concat(this.id," custom source")))),this._implementation.loadTile||this.fire(new t.ErrorEvent(new Error("Missing loadTile implementation for ".concat(this.id," custom source")))),this._implementation.bounds&&(this.tileBounds=new U(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.coveringTiles=this._coveringTiles.bind(this),t.extend(this,t.pick(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileC
1acheSize"]))}serialize(){return t.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(e){this._map=e,this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(e),this.load()}onRemove(t){this._implementation.onRemove&&this._implementation.onRemove(t)}hasTile(t){if(this._implementation.hasTile){const{x:e,y:i,z:r}=t.canonical;return this._implementation.hasTile({x:e,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const{x:r,y:n,z:o}=e.tileID.canonical,s=new t.window.AbortController,a=this._implementation.loadTile({x:r,y:n,z:o},{signal:s.signal});if(!a)return this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null);a.cancel=()=>s.abort(),e.request=a.then(function(r){return delete e.request,e.aborted?(e.state="unloaded",i(null)):r?function(e){return e instanceof t.window.ImageData||e instanceof t.window.ImageBitmap||e instanceof t.window.HTMLCanvasElement}(r)?(this.loadTileData(e,r),e.state="loaded",void i(null)):(e.state="errored",i(new Error("Can't infer data type for ".concat(this.id,", only raster data supported at the moment")))):(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null))}.bind(this)).catch((t=>{20!==t.code&&(e.state="errored",i(t))}))}loadTileData(t,e){Mt.loadTileData(t,e,this._map.painter)}unloadTileData(t){Mt.unloadTileData(t,this._map.painter)}prepareTile(t){if(!this._implementation.prepareTile)return null;const{x:e,y:i,z:r}=t.tileID.canonical,n=this._implementation.prepareTile({x:e,y:i,z:r});return n?(this.loadTileData(t,n),t.state="loaded",n):null}unloadTile(t,e){if(this.unloadTileData(t),this._implementation.unloadTile){const{x:e,y:i,z:r}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:r})}e()}abortTile(t,e){t.request&&t.request.cancel&&(t.request.cancel(),delete t.request),e()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((t=>({x:t.canonical.x,y:t.canonical.y,z:t.canonical.z})))}_update(){this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"}))}}},kt=function(e,i,r,n){const o=new Pt[i.type](e,i,r,n);if(o.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(o.id));return t.bindAll(["load","abort","unload","serialize","prepare"],o),o};function Dt(e,i){const r=t.identity([]);return t.scale(r,r,[.5*e.width,.5*-e.height,1]),t.translate(r,r,[1,-1,0]),t.multiply(r,r,e.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(r)}function Lt(t,e,i,r,n,o,s){let a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];const l=t.tilesIn(r,s,a);l.sort(Rt);const c=[];for(const u of l)c.push({wrappedTileID:u.tile.tileID.wrapped().key,queryResults:u.tile.queryRenderedFeatures(e,i,t._state,u,n,o,Dt(t.transform,u.tile.tileID),a)});const h=function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in t){const r=t[i],n=o[i]=o[i]||{},s=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,s.push(t))}}return e}(c);for(const u in h)h[u].forEach((e=>{const i=e.feature,r=i.layer;r&&"background"!==r.type&&"sky"!==r.type&&(i.source=r.source,r["source-layer"]&&(i.sourceLayer=r["source-layer"]),i.state=void 0!==i.id?t.getFeatureState(r["source-layer"],i.id):{})}));return h}function Bt(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let o=0;o<i.length;o++){const t=i[o],s=t.tileID.canonical.key;n[s]||(n[s]=!0,t.querySourceFeatures(r,e))}return r}function Rt(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Ft(){return null!=go.workerClass?new go.workerClass:new t.window.Worker(go.workerUrl)}const Ot="mapboxgl_preloaded_worker_pool";class Ut{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ut.workerCount;)this.workers.push(new Ft);return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEac
vendor: 57,602 bytes, line 1
1h((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Ot]}numActive(){return Object.keys(this.active).length}}let Vt;function jt(){return Vt||(Vt=new Ut),Vt}function Nt(e,i){const r={};for(const t in e)"ref"!==t&&(r[t]=e[t]);return t.refProperties.forEach((t=>{t in i&&(r[t]=i[t])})),r}function Gt(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Nt(t[i],e[t[i].ref]));return t}Ut.workerCount=2;const Zt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",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",setProjection:"setProjection"};function qt(t,e,i){i.push({command:Zt.addSource,args:[t,e[t]]})}function Wt(t,e,i){e.push({command:Zt.removeSource,args:[t]}),i[t]=!0}function Xt(t,e,i,r){Wt(t,i,r),qt(t,e,i)}function Ht(t,i,r){let n;for(n in t[r])if(t[r].hasOwnProperty(n)&&"data"!==n&&!e(t[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!e(t[r][n],i[r][n]))return!1;return!0}function Yt(t,i,r,n,o,s){let a;for(a in i=i||{},t=t||{})t.hasOwnProperty(a)&&(e(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}));for(a in i)i.hasOwnProperty(a)&&!t.hasOwnProperty(a)&&(e(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}))}function Kt(t){return t.id}function Jt(t,e){return t[e.id]=e,t}class Qt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,r=this._distances[i];const n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,s=this._distances[o],a=r-s,l=a>0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class $t{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,i,r,n,o){this.circleCells[n].push(o)}_query(t,e,i,r,n,o){if(i<0||t>this.width||r<0||e>this.height)return!n&&[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}return o?s.filter(o):s}return this._forEachCell(t,e,i,r,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(t,e,i,r,n){const o=t-i,s=t+i,a=e-i,l=e+i;if(s<0||o>this.width||l<0||a>this.height)return!r&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),r?c.length>0:c}query(t,e,i,r,n){return this._query(t,e,i,r,!1,n)}hitTest(t,e,i,r,n){return this._query(t,e,i,r,!0,n)}hitTestCircle(t,e,i,r){return this._queryCircle(t,e,i,!0,r)}_queryCell(t,e,i,r,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const h of c)if(!l.box[h]){l.box[h]=!0;const c=4*h;if(t<=n[c+2]&&e<=n[c+3]&&i>=n[c+0]&&r>=n[c+1]&&(!a||a(this.boxKeys[h]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[h],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const h=this.circleCells[n];if(null!==h){const n=this.circles;for(const c of h)if(!l.circle[c]){l.circle[c]=!0;const h=3*c;if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],t,e,i,r)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const t=n[h],e=n[h+1],i=n[h+2];o.push({key:this.circleKeys[c],x1:t-i,y1:e-i,x2:t+i,y2:e+i})}}}}}_queryCellCircle(t,e,i,r,n,o,s,a){const l=s.circle,c=s.seenUids,h=this.boxCells[n];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const i=4*e;if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(this.boxKeys[e])))return o.push(!0),!0}}const u=this.circleCells[n];if(null!==u){const t=this.circles;for(const e of u)if(!c.circle[e]){c.circle[e]=!0;const i=3*e;if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[e])))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,s,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+p,o,s,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){const s=r-t,a=n-e,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(t,e,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(t-(r+a));if(l>a+i)return!1;const c=(s-n)/2,h=Math.abs(e-(n+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const u=l-a,p=h-c;return u*u+p*p<=i*i}}const te=Math.tan(85*Math.PI/180);function ee(e,i,r,n,o,s,a){const l=t.create();if(r)if("globe"===s.name){const e=t.calculateGlobeLabelMatrix(o,i);t.multiply(l,l,e)}else{const e=y([],a);l[0]=e[0],l[1]=e[1],l[4]=e[2],l[5]=e[3],n||t.rotateZ(l,l,o.angle)}else t.multiply(l,o.labelPlaneMatrix,e);return l}function ie(t,e,i,r,n,o,s){const a=ee(t,e,i,r,n,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function re(e,i,r,n,o,s,a){if(r){if("globe"===s.name){const l=ee(e,i,r,n,o,s,a);return t.invert(l,l),t.multiply(l,e,l),l}{const i=t.clone(e),r=t.identity([]);return r[0]=a[0],r[1]=a[1],r[4]=a[2],r[5]=a[3],t.multiply(i,i,r),n||t.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function ne(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=[e.x,e.y,r,1];r?t.transformMat4$1(n,n,i):ge(n,n,i);const o=n[3];return{point:[n[0]/o,n[1]/o,n[2]/o],signedDistanceFromCamera:o}}function oe(e,i){const r=[e[0],e[1],e[2],1];t.transformMat4$1(r,r,i);const n=r[3];return{point:[r[0]/n,r[1]/n,r[2]/n],signedDistanceFromCamera:n}}function se(t,e){return Math.min(.5+t/e*.5,1.5)}function ae(t,e){const i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function le(e,i,r,n,o,s,a,l,c,h){const u=r.transform,p=n?e.textSizeData:e.iconSizeData,d=t.evaluateSizeForZoom(p,r.transform.zoom),f="globe"===u.projection.name,m=[256/r.width*2+1,256/r.height*2+1],_=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let g=null;f&&(g=n?e.text.globeExtVertexArray:e.icon.globeExtVertexArray);const y=e.lineVertexArray,x=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=r.transform.width/r.transform.height;let b=!1;for(let w=0;w<x.length;w++){const n=x.get(w);if(n.writingMode!==t.WritingMode.vertical||b||0!==w&&x.get(w-1).writingMode===t.WritingMode.horizontal||(b=!0),(n.hidden||n.writingMode===t.WritingMode.vertical)&&!b){_e(n.numGlyphs,_);continue}b=!1;const f=new t.pointGeometry(n.tileAnchorX,n.tileAnchorY),T=c?c(f):[0,0,0],E=u.projection.projectTilePoint(f.x,f.y,h.canonical),S=[E.x+T[0],E.y+T[1],E.z+T[2]],A=[...S,1];if(t.transformMat4$1(A,A,i),!ae(A,m)){_e(n.numGlyphs,_);continue}const M=se(r.transform.cameraToCenterDistance,A[3]),I=t.evaluateSizeForFeature(p,d,n),C=a?I/M:I*M,z=ne(new t.pointGeometry(S[0],S[1]),o,S[2]);if(z.signedDistanceFromCamera<=0){_e(n.numGlyphs,_);continue}let P={};const k=a?null:c,D=ue(n,C,!1,l,i,o,s,e.glyphOffsetArray,y,_,g,z.point,f,P,v,k,u.projection,h,a);b=D.useVertical,k&&D.needsFlipping&&(P={}),(D.notEnoughRoom||b||D.needsFlipping&&ue(n,C,!0,l,i,o,s,e.glyphOffsetArray,y,_,g,z.point,f,P,v,k,u.projection,h,a).notEnoughRoom)&&_e(n.numGlyphs,_)}n?(e.text.dynamicLayoutVertexBuffer.updateData(_),g&&e.text.globeExtVertexBuffer.updateData(g)):(e.icon.dynamicLayoutVertexBuffer.updateData(_),g&&e.icon.globeExtVertexBuffer.updateData(g))}function ce(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m){const _=a.glyphStartIndex+a.numGlyphs,g=a.lineStartIndex,y=a.lineStartIndex+a.lineLength,x=e.getoffsetX(a.glyphStartIndex),v=e.getoffsetX(_-1),b=fe(t*x,i,r,n,o,s,a.segment,g,y,l,c,h,u,p,!0,d,f,m);if(!b)return null;const w=fe(t*v,i,r,n,o,s,a.segment,g,y,l,c,h,u,p,!0,d,f,m);return w?{first:b,last:w}:null}function he(e,i,r,n){return e.writingMode===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:e.writingMode===t.WritingMode.vertical?i.y<r.y?{needsFlipping:!0}:null:0!==e.flipState&&function(t,e,i){const r=(e.x-t.x)*i;return 0===r||Math.abs((e.y-t.y)/r)>te}(i,r,n)?1===e.flipState?{needsFlipping:!0}:null:i.x>r.x?{needsFlipping:!0}:null}function ue(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y,x){const v=i/24,b=e.lineOffsetX*v,w=e.lineOffsetY*v;let T;if(e.numGlyphs>1){const i=e.glyphStartIndex+e.numGlyphs,o=e.lineStartIndex,h=e.lineStartIndex+e.lineLength,u=ce(v,l,b,w,r,p,d,e,c,s,f,_,!1,g,y,x);if(!u)return{notEnoughRoom:!0};const E=oe(u.first.point,a).point,S=oe(u.last.point,a).point,A=new t.pointGeometry(E[0],E[1]),M=new t.pointGeometry(S[0],S[1]);if(n&&!r){const t=he(e,A,M,m);if(e.flipState=t&&t.needsFlipping?1:2,t)return t}T=[u.first];for(let t=e.glyphStartIndex+1;t<i-1;t++)T.push(fe(v*l.getoffsetX(t),b,w,r,p,d,e.segment,o,h,c,s,f,_,!1,!1,g,y,x));T.push(u.last)}else{if(n&&!r){const i=ne(d,o).point,r=e.lineStartIndex+e.segment+1,n=new t.pointGeometry(c.getx(r),c.gety(r)),s=ne(n,o),a=s.signedDistanceFromCamera>0?s.point:de(d,n,i,1,o,void 0,g,y.canonical),l=he(e,new t.pointGeometry(i[0],i[1]),new t.pointGeometry(a[0],a[1]),m);if(e.flipState=l&&l.needsFlipping?1:2,l)return l}const i=fe(v*l.getoffsetX(e.glyphStartIndex),b,w,r,p,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,s,f,_,!1,!1,g,y,x);if(!i)return{notEnoughRoom:!0};T=[i]}if(u)for(const E of T)t.updateGlobeVertexNormal(u,h.length+0,E.up[0],E.up[1],E.up[2]),t.updateGlobeVertexNormal(u,h.length+1,E.up[0],E.up[1],E.up[2]),t.updateGlobeVertexNormal(u,h.length+2,E.up[0],E.up[1],E.up[2]),t.updateGlobeVertexNormal(u,h.length+3,E.up[0],E.up[1],E.up[2]),t.addDynamicAttributes(h,E.point[0],E.point[1],E.point[2],E.angle);else for(const E of T)t.addDynamicAttributes(h,E.point[0],E.point[1],E.point[2],E.angle);return{}}function pe(e,i,r,n,o){const s=n.projectTilePoint(e.x,e.y,i);if(!o)return ne(s,r,s.z);const a=o(e);return ne(new t.pointGeometry(s.x+a[0],s.y+a[1]),r,s.z+a[2])}function de(e,i,r,n,o,s,a,l){const c=pe(e.add(e.sub(i)._unit()),l,o,a,s).point,h=t.sub([],r,c);return t.scaleAndAdd([],r,h,n/t.length(h))}function fe(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g,y){const x=n?e-i:e+i;let v=x>0?1:-1,b=0;n&&(v*=-1,b=Math.PI),v<0&&(b+=Math.PI);let w=v>0?l+a:l+a+1,T=o,E=o,S=0,A=0;const M=Math.abs(x),I=[],C=[];let z=s;const P=()=>{const e=w-v;return 0===S?s:new t.pointGeometry(h.getx(e),h.gety(e))},k=()=>de(P(),z,E,M-S+1,u,d,_,g.canonical);for(;S+A<=M;){if(w+=v,w<l||w>=c)return null;if(E=T,I.push(T),f&&C.push(z||P()),T=p[w],void 0===T){z=new t.pointGeometry(h.getx(w),h.gety(w));const e=pe(z,g.canonical,u,_,d);T=e.signedDistanceFromCamera>0?p[w]=e.point:k()}else z=null;S+=A,A=t.distance(E,T)}z=z||new t.pointGeometry(h.getx(w),h.gety(w));const D=P();m&&d&&(p[w]=T=void 0===p[w]?T:k(),A=t.distance(E,T));const L=(M-S)/A,B=z.sub(D).mult(L)._add(D),R=t.sub([],T,E),F=t.scaleAndAdd([],E,R,L);let O=[0,0,1],U=R[0],V=R[1];if(y&&(O=_.upVector(g.canonical,B.x,B.y),0!==O[0]||0!==O[1]||1!==O[2])){const e=[1,0,0],i=[0,1,0];e[0]=O[2],e[1]=0,e[2]=-O[0],t.cross(i,O,e),t.normalize(e,e),t.normalize(i,i),U=t.dot(R,e),V=t.dot(R,i)}if(r){const e=t.cross([],O,R);t.normalize(e,e),t.scaleAndAdd(F,F,e,r*v)}const j=b+Math.atan2(V,U);return I.push(F),f&&C.push(B),{point:F,angle:j,path:I,tilePath:C,up:O}}const me=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function _e(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(me,4*t)}}function ge(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}const ye=100;class xe{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new $t(t.width+200,t.height+200,25),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new $t(t.width+200,t.height+200,25);this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ye,this.screenBottomBoundary=t.height+ye,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=e}placeCollisionBox(t,e,i,r,n,o,s,a){let l=i.projectedAnchorX,c=i.projectedAnchorY,h=i.projectedAnchorZ;const u=i.elevation,p=i.tileID;if(u&&p){const e=t.getProjection().upVector(p.canonical,i.tileAnchorX,i.tileAnchorY),r=t.getProjection().upVectorScale(p.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e[0]*u*r,c+=e[1]*u*r,h+=e[2]*u*r}const d=this.projectAndGetPerspectiveRatio(s,[l,c,h],i.tileID,"globe"===t.projection.name||!!u||this.transform.pitch>0,t.getProjection()),f=o*d.perspectiveRatio,m=(i.x1*e+r.x-i.padding)*f+d.point.x,_=(i.y1*e+r.y-i.padding)*f+d.point.y,g=(i.x2*e+r.x+i.padding)*f+d.point.x,y=(i.y2*e+r.y+i.padding)*f+d.point.y,x=d.perspectiveRatio<=.55||d.occluded;return!this.isInsideGrid(m,_,g,y)||!n&&this.grid.hitTest(m,_,g,y,a)||x?{box:[],offscreen:!1,occluded:d.occluded}:{box:[m,_,g,y],offscreen:this.isOffscreen(m,_,g,y),occluded:!1}}placeCollisionCircles(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m){const _=[],g=this.transform.elevation,y=g?g.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,e.getProjection()):t=>[0,0,0],x=new t.pointGeometry(r.tileAnchorX,r.tileAnchorY),v=e.getProjection().projectTilePoint(r.tileAnchorX,r.tileAnchorY,m.canonical),b=y(x),w=[v.x+b[0],v.y+b[1],v.z+b[2]],T="globe"===e.projection.name,E=this.projectAndGetPerspectiveRatio(a,[w[0],w[1],w[2]],m,T||!!g||this.transform.pitch>0,e.getProjection()),{perspectiveRatio:S}=E,A=(u?s/S:s*S)/t.ONE_EM,M=ne(new t.pointGeometry(w[0],w[1]),l,w[2]).point,I=E.signedDistanceFromCamera>0?ce(A,o,r.lineOffsetX*A,r.lineOffsetY*A,!1,M,x,r,n,l,{},g&&!u?y:null,u&&!!g,e.getProjection(),m,u):null;let C=!1,z=!1,P=!0;if(I&&!E.occluded){const e=.5*d*S+f,r=new t.pointGeometry(-100,-100),n=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new Qt,s=I.first,a=I.last;let l=[];for(let t=s.path.length-1;t>=1;t--)l.push(s.path[t]);for(let t=1;t<a.path.length;t++)l.push(a.path[t]);const u=2.5*e;if(c){const t=l.map(g&&!T?(t,e)=>{const i=y(e<s.path.length-1?s.tilePath[s.path.length-1-e]:a.tilePath[e-s.path.length+2]);return t[2]=i[2],oe(t,c)}:t=>oe(t,c));l=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let m=[];if(l.length>0){const e=l.map((e=>new t.pointGeometry(e[0],e[1])));let i=1/0,o=-1/0,s=1/0,a=-1/0;for(let t=0;t<e.length;t++)i=Math.min(i,e[t].x),s=Math.min(s,e[t].y),o=Math.max(o,e[t].x),a=Math.max(a,e[t].y);m=i>=r.x&&o<=n.x&&s>=r.y&&a<=n.y?[e]:o<r.x||i>n.x||a<r.y||s>n.y?[]:t.clipLine([e],r.x,r.y,n.x,n.y)}for(const t of m){o.reset(t,.25*e);let r=0;r=o.length<=.5*e?1:Math.ceil(o.paddedLength/u)+1;for(let t=0;t<r;t++){const n=t/Math.max(r-1,1),s=o.lerp(n),a=s.x+ye,l=s.y+ye;_.push(a,l,e,0);const c=a-e,u=l-e,d=a+e,f=l+e;if(P=P&&this.isOffscreen(c,u,d,f),z=z||this.isInsideGrid(c,u,d,f),!i&&this.grid.hitTestCircle(a,l,e,p)&&(C=!0,!h))return{circles:[],offscreen:!1,collisionDetected:C,occluded:!1}}}}return{circles:!h&&C||!z?[]:_,offscreen:P,collisionDetected:C,occluded:E.occluded}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,s=-1/0;for(const h of e){const e=new t.pointGeometry(h.x+ye,h.y+ye);r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),i.push(e)}const a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),l={},c={};for(const h of a){const e=h.key;if(void 0===l[e.bucketInstanceId]&&(l[e.bucketInstanceId]={}),l[e.bucketInstanceId][e.featureIndex])continue;const r=[new t.pointGeometry(h.x1,h.y1),new t.pointGeometry(h.x2,h.y1),new t.pointGeometry(h.x2,h.y2),new t.pointGeometry(h.x1,h.y2)];t.polygonIntersectsPolygon(i,r)&&(l[e.bucketInstanceId][e.featureIndex]=!0,void 0===c[e.bucketInstanceId]&&(c[e.bucketInstanceId]=[]),c[e.bucketInstanceId].push(e.featureIndex))}return c}insertCollisionBox(t,e,i,r,n){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n){const o=e?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:r,collisionGroupID:n};for(let a=0;a<t.length;a+=4)o.insertCircle(s,t[a],t[a+1],t[a+2])}projectAndGetPerspectiveRatio(e,i,r,n,o){const s=[i[0],i[1],i[2],1];let a=!1;if(i[2]||this.transform.pitch>0){t.transformMat4$1(s,s,e);const n="globe"===o.name;this.fogState&&r&&!n&&(a=function(e,i,r,n,o,s){const a=s.calculateFogTileMatrix(o),l=[i,r,n];return t.transformMat4(l,l,a),M(e,l,s.pitch,s._fov)}(this.fogState,i[0],i[1],i[2],r.toUnwrapped(),this.transform)>.9)}else ge(s,s,e);return{point:new t.pointGeometry((s[0]/s[3]+1)/2*this.transform.width+ye,(-s[1]/s[3]+1)/2*this.transform.height+ye),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(o)/s[3]*.5,1.5),signedDistanceFromCamera:s[3],occluded:n&&s[2]>s[3]||a}}isOffscreen(t,e,i,r){return i<ye||t>=this.screenRightBoundary||r<ye||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function ve(e,i,r){const n=i.createTileMatrix(e,e.worldSize,r.toUnwrapped());return t.multiply(new Float32Array(16),e.projMatrix,n)}function be(t,e,i){if(e.projection.name===i.projection.name)return t.projMatrix;const r=i.clone();return r.setProjection(e.projection),ve(r,e.getProjection(),t)}function we(t,e,i){return e.name===i.projection.name?t.projMatrix:ve(i,e,t)}class Te{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Ee{constructor(t,e,i,r,n){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];this.text=new Te(t?t.text:null,e,i,n),this.icon=new Te(t?t.icon:null,e,r,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Se{constructor(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.text=t,this.icon=e,this.skipFade=i,this.clipped=r}}class Ae{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Me{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Ie{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Ce(e,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=t.getAnchorAlignment(e),l=-(s-.5)*i,c=-(a-.5)*r,h=t.evaluateVariableOffset(e,n);return new t.pointGeometry(l+h[0]*o,c+h[1]*o)}function ze(e,i,r,n,o){const s=new t.pointGeometry(e,i);return r&&s._rotate(n?o:-o),s}class Pe{constructor(t,e,i,r,n){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new xe(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new Ie(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,r,n){const o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=o.layers[0].layout,l=r.collisionBoxArray,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.EXTENT,u=r.tileID.toUnwrapped();this.transform.setProjection(o.projection);const p=(d=r.tileID,f=o.getProjection(),m=this.transform,f.name===this.projection?m.calculateProjMatrix(d.toUnwrapped()):ve(m,f,d));var d,f,m;const _="map"===a.get("text-pitch-alignment"),g="map"===a.get("text-rotation-alignment");i.compileFilter();const y=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),v=this.transform.calculatePixelsToTileUnitsMatrix(r),b=ie(p,r.tileID.canonical,_,g,this.transform,o.getProjection(),v);let w=null;if(_){const e=re(p,r.tileID.canonical,_,g,this.transform,o.getProjection(),v);w=t.multiply([],this.transform.labelPlaneMatrix,e)}let T=null;y&&r.latestFeatureIndex&&(T={unwrappedTileID:u,dynamicFilter:y,dynamicFilterNeedsFeature:x,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[o.bucketInstanceId]=new Me(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const E={bucket:o,layout:a,posMatrix:p,textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:T,scale:c,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:t.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:E})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:E})}attemptAnchorPlacement(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g){const y=[u.textOffset0,u.textOffset1],x=Ce(t,i,r,y,n),v=this.collisionIndex.placeCollisionBox(d,n,e,ze(x.x,x.y,o,s,this.transform.angle),h,a,l,c.predicate);if((!m||0!==this.collisionIndex.placeCollisionBox(d,d.getSymbolInstanceIconSize(g,this.transform.zoom,p),m,ze(x.x,x.y,o,s,this.transform.angle),h,a,l,c.predicate).box.length)&&v.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(e=this.prevPlacement.variableOffsets[u.crossTileID].anchor),this.variableOffsets[u.crossTileID]={textOffset:y,width:i,height:r,anchor:t,textScale:n,prevAnchor:e},this.markUsedJustification(d,t,u,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,u),this.placedOrientations[u.crossTileID]=f),{shift:x,placedGlyphBoxes:v}}}placeLayerBucketPart(e,i,r,n){const{bucket:o,layout:s,posMatrix:a,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:h,textPixelRatio:u,holdingForFade:p,collisionBoxArray:d,partiallyEvaluatedTextSize:f,partiallyEvaluatedIconSize:m,collisionGroup:_}=e.parameters,g=s.get("text-optional"),y=s.get("icon-optional"),x=s.get("text-allow-overlap"),v=s.get("icon-allow-overlap"),b="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),T="none"!==s.get("icon-text-fit"),E="viewport-y"===s.get("symbol-z-order");this.transform.setProjection(o.projection);let S=x&&(v||!o.hasIconData()||y),A=v&&(x||!o.hasTextData()||g);!o.collisionArrays&&d&&o.deserializeCollisionBoxes(d),r&&n&&o.updateCollisionDebugBuffers(this.transform.zoom,d);const M=(e,n,d)=>{if(h){const r={zoom:this.transform.zoom,pitch:this.transform.pitch};let n=null;if(h.dynamicFilterNeedsFeature){const t=this.retainedQueryData[o.bucketInstanceId];n=h.featureIndex.loadFeature({featureIndex:e.featureIndex,bucketIndex:t.bucketIndex,sourceLayerIndex:t.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,h.dynamicFilter)(r,n,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new t.pointGeometry(e.tileAnchorX,e.tileAnchorY),this.transform.calculateDistanceTileData(h.unwrappedTileID)))return this.placements[e.crossTileID]=new Se(!1,!1,!1,!0),void(i[e.crossTileID]=!0)}if(i[e.crossTileID])return;if(p)return void(this.placements[e.crossTileID]=new Se(!1,!1,!1));let E=!1,M=!1,I=!0,C=!1,z=!1,P=null,k={box:null,offscreen:null,occluded:null},D={box:null,offscreen:null,occluded:null},L=null,B=null,R=null,F=0,O=0,U=0;d.textFeatureIndex?F=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(F=e.featureIndex),d.verticalTextFeatureIndex&&(O=d.verticalTextFeatureIndex);const V=t=>{t.tileID=this.retainedQueryData[o.bucketInstanceId].tileID,(this.transform.elevation||t.elevation)&&(t.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[o.bucketInstanceId].tileID,t.tileAnchorX,t.tileAnchorY):0)},j=d.textBox;if(j){V(j);const i=i=>{let r=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(o,r,e))}return r},r=(i,r)=>{if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of o.writingModes)if(e===t.WritingMode.vertical?(k=r(),D=k):k=i(),k&&k.box&&k.box.length)break}else k=i()};if(s.get("text-variable-anchor")){let l=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];l.indexOf(t.anchor)>0&&(l=l.filter((e=>e!==t.anchor)),l.unshift(t.anchor))}const c=(t,i,r)=>{const s=o.getSymbolInstanceTextSize(f,e,this.transform.zoom,n),c=(t.x2-t.x1)*s+2*t.padding,h=(t.y2-t.y1)*s+2*t.padding,p=T&&!v?i:null;p&&V(p);let d={box:[],offscreen:!1,occluded:!1};const g=x?2*l.length:l.length;for(let y=0;y<g;++y){const i=this.attemptAnchorPlacement(l[y%l.length],t,c,h,s,b,w,u,a,_,y>=l.length,e,n,o,r,p,f,m);if(i&&(d=i.placedGlyphBoxes,d&&d.box&&d.box.length)){E=!0,P=i.shift;break}}return d};r((()=>c(j,d.iconBox,t.WritingMode.horizontal)),(()=>{const i=d.verticalTextBox;return i&&V(i),o.allowVerticalPlacement&&!(k&&k.box&&k.box.length)&&e.numVerticalGlyphVertices>0&&i?c(i,d.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),k&&(E=k.box,I=k.offscreen,C=k.occluded);const h=i(k&&k.box);if(!E&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(o,t.anchor,e,h))}}else{const s=(i,r)=>{const s=o.getSymbolInstanceTextSize(f,e,this.transform.zoom,n),l=this.collisionIndex.placeCollisionBox(o,s,i,new t.pointGeometry(0,0),x,u,a,_.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,r,e),this.placedOrientations[e.crossTileID]=r),l};r((()=>s(j,t.WritingMode.horizontal)),(()=>{const i=d.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?(V(i),s(i,t.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),i(k&&k.box&&k.box.length)}}if(L=k,E=L&&L.box&&L.box.length>0,I=L&&L.offscreen,C=L&&L.occluded,e.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex),n=t.evaluateSizeForFeature(o.textSizeData,f,i),h=s.get("text-padding");B=this.collisionIndex.placeCollisionCircles(o,x,i,o.lineVertexArray,o.glyphOffsetArray,n,a,l,c,r,w,_.predicate,e.collisionCircleDiameter*n/t.ONE_EM,h,this.retainedQueryData[o.bucketInstanceId].tileID),E=x||B.circles.length>0&&!B.collisionDetected,I=I&&B.offscreen,C=B.occluded}if(d.iconFeatureIndex&&(U=d.iconFeatureIndex),d.iconBox){const e=e=>{V(e);const i=T&&P?ze(P.x,P.y,b,w,this.transform.angle):new t.pointGeometry(0,0),r=o.getSymbolInstanceIconSize(m,this.transform.zoom,n);return this.collisionIndex.placeCollisionBox(o,r,e,i,v,u,a,_.predicate)};D&&D.box&&D.box.length&&d.verticalIconBox?(R=e(d.verticalIconBox),M=R.box.length>0):(R=e(d.iconBox),M=R.box.length>0),I=I&&R.offscreen,z=R.occluded}const N=g||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=y||0===e.numIconVertices;if(N||G?G?N||(M=M&&E):E=M&&E:M=E=M&&E,E&&L&&L.box&&this.collisionIndex.insertCollisionBox(L.box,s.get("text-ignore-placement"),o.bucketInstanceId,D&&D.box&&O?O:F,_.ID),M&&R&&this.collisionIndex.insertCollisionBox(R.box,s.get("icon-ignore-placement"),o.bucketInstanceId,U,_.ID),B&&(E&&this.collisionIndex.insertCollisionCircles(B.circles,s.get("text-ignore-placement"),o.bucketInstanceId,F,_.ID),r)){const t=o.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Ae);for(let i=0;i<B.circles.length;i+=4)e.circles.push(B.circles[i+0]),e.circles.push(B.circles[i+1]),e.circles.push(B.circles[i+2]),e.circles.push(B.collisionDetected?1:0)}const Z="globe"!==o.projection.name;S=S&&(Z||!C),A=A&&(Z||!z),this.placements[e.crossTileID]=new Se(E||S,M||A,I||o.justReloaded),i[e.crossTileID]=!0};if(E){const t=o.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];M(o.symbolInstances.get(i),i,o.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)M(o.symbolInstances.get(t),t,o.collisionArrays[t]);if(r&&o.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[o.bucketInstanceId];t.invert(e.invProjMatrix,a),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}markUsedJustification(e,i,r,n){let o;o=n===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(const a in this.placements){const t=this.placements[a],e=n[a];e?(this.opacities[a]=new Ee(e,r,t.text,t.icon,null,t.clipped),i=i||t.text!==e.text.placed||t.icon!==e.icon.placed):(this.opacities[a]=new Ee(null,r,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const a in n){const t=n[a];if(!this.opacities[a]){const e=new Ee(t,r,!1,!1);e.isHidden()||(this.opacities[a]=e,i=i||t.text.placed||t.icon.placed)}}for(const a in o)this.variableOffsets[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.variableOffsets[a]=o[a]);for(const a in s)this.placedOrientations[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.placedOrientations[a]=s[a]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const n=e.layers[0].layout,o=!!e.layers[0].dynamicFilter(),s=new Ee(null,0,!1,!1,!0),a=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),c=n.get("text-variable-anchor"),h="map"===n.get("text-rotation-alignment"),u="map"===n.get("text-pitch-alignment"),p="none"!==n.get("icon-text-fit"),d=new Ee(null,0,a&&(l||!e.hasIconData()||n.get("icon-optional")),l&&(a||!e.hasTextData()||n.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const f=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i)};let m=0;for(let _=0;_<e.symbolInstances.length;_++){const r=e.symbolInstances.get(_),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:a,crossTileID:l}=r;let g=this.opacities[l];i[l]?g=s:g||(g=d,this.opacities[l]=g),i[l]=!0;const y=n>0||a>0,x=r.numIconVertices>0,v=this.placedOrientations[r.crossTileID],b=v===t.WritingMode.vertical,w=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(!y&&!x||g.isHidden()||m++,y){const t=Ve(g.text);f(e.text,n,b?je:t),f(e.text,a,w?je:t);const i=g.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||b?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||w?1:0);const o=this.variableOffsets[r.crossTileID];o&&this.markUsedJustification(e,o.anchor,r,v);const s=this.placedOrientations[r.crossTileID];s&&(this.markUsedJustification(e,"left",r,s),this.markUsedOrientation(e,s,r))}if(x){const t=Ve(g.icon);r.placedIconSymbolIndex>=0&&(f(e.icon,r.numIconVertices,b?je:t),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=g.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(f(e.icon,r.numVerticalIconVertices,w?je:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[_];if(i){let r=new t.pointGeometry(0,0),n=!0;if(i.textBox||i.verticalTextBox){if(c){const t=this.variableOffsets[l];t?(r=Ce(t.anchor,t.width,t.height,t.textOffset,t.textScale),h&&r._rotate(u?this.transform.angle:-this.transform.angle)):n=!1}o&&(n=!g.clipped),i.textBox&&ke(e.textCollisionBox.collisionVertexArray,g.text.placed,!n||b,r.x,r.y),i.verticalTextBox&&ke(e.textCollisionBox.collisionVertexArray,g.text.placed,!n||w,r.x,r.y)}const s=n&&Boolean(!w&&i.verticalIconBox);i.iconBox&&ke(e.iconCollisionBox.collisionVertexArray,g.icon.placed,s,p?r.x:0,p?r.y:0),i.verticalIconBox&&ke(e.iconCollisionBox.collisionVertexArray,g.icon.placed,!s,p?r.x:0,p?r.y:0)}}}if(e.fullyClipped=0===m,e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function ke(t,e,i,r,n){t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0)}const De=Math.pow(2,25),Le=Math.pow(2,24),Be=Math.pow(2,17),Re=Math.pow(2,16),Fe=Math.pow(2,9),Oe=Math.pow(2,8),Ue=Math.pow(2,1);function Ve(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*De+e*Le+i*Be+e*Re+i*Fe+e*Oe+i*Ue+e}const je=0;class Ne{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;){const t=o[this._currentPartIndex];if(e.placeLayerBucketPart(t,this._seenCrossTileIDs,i,0===t.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}class Ge{constructor(t,e,i,r,n,o,s,a){this.placement=new Pe(t,n,o,s,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(e,i,r){const n=t.exported.now(),o=()=>{const e=t.exported.now()-n;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=n)&&(!t.maxzoom||t.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Ne(t)),this._inProgressLayer.continuePlacement(r[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ze=512/t.EXTENT/2;class qe{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let r=0;r<e.length;r++){const i=e.get(r),n=i.key;this.indexedSymbolInstances[n]||(this.indexedSymbolInstances[n]=[]),this.indexedSymbolInstances[n].push({crossTileID:i.crossTileID,coord:this.getScaledCoordinates(i,t)})}}getScaledCoordinates(e,i){const r=Ze/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.tileAnchorX)*r),y:Math.floor((i.canonical.y*t.EXTENT+e.tileAnchorY)*r)}}findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const o=t.get(n);if(o.crossTileID)continue;const s=this.indexedSymbolInstances[o.key];if(!s)continue;const a=this.getScaledCoordinates(o,e);for(const t of s)if(Math.abs(t.coord.x-a.x)<=r&&Math.abs(t.coord.y-a.y)<=r&&!i[t.crossTileID]){i[t.crossTileID]=!0,o.crossTileID=t.crossTileID;break}}}}class We{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Xe{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const i in this.indexes){const t=this.indexes[i],r={};for(const i in t){const n=t[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[i]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const n in this.indexes){const i=this.indexes[n];if(Number(n)>t.overscaledZ)for(const n in i){const o=i[n];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,r)}else{const o=i[t.scaledTo(Number(n)).key];o&&o.findMatches(e.symbolInstances,t,r)}}for(let n=0;n<e.symbolInstances.length;n++){const t=e.symbolInstances.get(n);t.crossTileID||(t.crossTileID=i.generate(),r[t.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new qe(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i in e.indexedSymbolInstances)for(const r of e.indexedSymbolInstances[i])delete this.usedCrossTileIDs[t][r.crossTileID]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class He{constructor(){this.layerIndexes={},this.crossTileIDs=new We,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i,r){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Xe);let o=!1;const s={};"globe"!==r.name&&n.handleWrapJump(i);for(const a of e){const e=a.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(a.tileID,e,this.crossTileIDs)&&(o=!0),s[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const i in this.layerIndexes)e[i]||delete this.layerIndexes[i]}}const Ye=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),Ke=t.pick(Zt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Je=t.pick(Zt,["setCenter","setZoom","setBearing","setPitch"]),Qe={version:8,layers:[],sources:{}},$e={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class ti extends t.Evented{constructor(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.map=e,this.dispatcher=new k(jt(),this),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new t.GlyphManager(e._requestManager,i.localFontFamily?t.LocalGlyphMode.all:i.localIdeographFontFamily?t.LocalGlyphMode.ideographs:t.LocalGlyphMode.none,i.localFontFamily||i.localIdeographFontFamily),this.lineAtlas=new t.LineAtlas(256,512),this.crossTileSymbolIndex=new He,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const r=this;this._rtlTextPluginCallback=ti.registerForPluginStateChange((e=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in r._sourceCaches){const e=r._sourceCaches[t],i=e.getSource().type;"vector"!==i&&"geojson"!==i||e.reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.getSource(t.sourceId);if(e&&e.vectorLayerIds)for(const i in this._layers){const t=this._layers[i];t.source===e.id&&this._validateLayer(t)}}))}loadURL(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new t.Event("dataloading",{dataType:"style"}));const r="boolean"==typeof i.validate?i.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,i.accessToken);const n=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(n,((e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,r)}))}loadJSON(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,this._load(e,!1!==i.validate)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Qe,!1)}_updateLayerCount(t,e){const i=e?1:-1;t.is3D()&&(this._num3DLayers+=i),"circle"===t.type&&(this._numCircleLayers+=i),"symbol"===t.type&&(this._numSymbolLayers+=i)}_load(e,i){if(i&&Ye(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=t.clone$1(e),this._updateMapProjection();for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});this._changed=!1,e.sprite?this._loadSprite(e.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(e.glyphs);const r=Gt(this.stylesheet.layers);this._order=r.map((t=>t.id)),this._layers={},this._serializedLayers={};for(let n of r)n=t.createStyleLayer(n),n.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=n,this._serializedLayers[n.id]=n.serialize(),this._updateLayerCount(n,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new T(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(e){this._spriteRequest=function(e,i,r){let n,o,s;const a=t.exported.devicePixelRatio>1?"@2x":"";let l=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,a,".json"),t.ResourceType.SpriteJSON),((t,e)=>{l=null,s||(s=t,n=e,h())})),c=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,a,".png"),t.ResourceType.SpriteImage),((t,e)=>{c=null,s||(s=t,o=e,h())}));function h(){if(s)r(s);else if(n&&o){const e=t.exported.getImageData(o),i={};for(const r in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d}=n[r],f=new t.RGBAImage({width:o,height:s});t.RGBAImage.copy(e,f,{x:a,y:l},{x:0,y:0},{width:o,height:s}),i[r]={data:f,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d}}r(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,((e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new t.Event("data",{dataType:"style"}))}))}_validateLayer(e){const i=this.getSource(e.source);if(!i)return;const r=e.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error('Source layer "'.concat(r,'" does not exist on source "').concat(i.id,'" as specified by style layer "').concat(e.id,'"'))))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(t){return!!this.terrain&&$e[t.type]}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];"reload"===t?this._reloadSource(e):"clear"===t&&this._clearSource(e)}this._updateTilesForChangedImages();for(const r in this._updatedPaintProps)this._layers[r].updateTransitions(e);this.light.updateTransitions(e),this.fog&&this.fog.updateTransitions(e),this._resetUpdates()}const r={};for(const t in this._sourceCaches){const e=this._sourceCaches[t];r[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];if(i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)){const t=this._getLayerSourceCache(i);t&&(t.used=!0)}const r=this.map.painter;if(r){const t=i.getProgramIds();if(!t)continue;const n=i.getProgramConfiguration(e.zoom);for(const e of t)r.useProgram(e,n)}}for(const n in r){const e=this._sourceCaches[n];r[n]!==e.used&&e.getSource().fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e.getSource().id}))}this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.fog&&this.fog.recalculate(e),this.z=e.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this._sourceCaches)this._sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(i){if(this._checkLoaded(),Ye(this,t.validateStyle(i)))return!1;(i=t.clone$1(i)).layers=Gt(i.layers);const r=function(t,i){if(!t)return[{command:Zt.setStyle,args:[i]}];let r=[];try{if(!e(t.version,i.version))return[{command:Zt.setStyle,args:[i]}];e(t.center,i.center)||r.push({command:Zt.setCenter,args:[i.center]}),e(t.zoom,i.zoom)||r.push({command:Zt.setZoom,args:[i.zoom]}),e(t.bearing,i.bearing)||r.push({command:Zt.setBearing,args:[i.bearing]}),e(t.pitch,i.pitch)||r.push({command:Zt.setPitch,args:[i.pitch]}),e(t.sprite,i.sprite)||r.push({command:Zt.setSprite,args:[i.sprite]}),e(t.glyphs,i.glyphs)||r.push({command:Zt.setGlyphs,args:[i.glyphs]}),e(t.transition,i.transition)||r.push({command:Zt.setTransition,args:[i.transition]}),e(t.light,i.light)||r.push({command:Zt.setLight,args:[i.light]}),e(t.fog,i.fog)||r.push({command:Zt.setFog,args:[i.fog]}),e(t.projection,i.projection)||r.push({command:Zt.setProjection,args:[i.projection]});const n={},o=[];!function(t,i,r,n){let o;for(o in i=i||{},t=t||{})t.hasOwnProperty(o)&&(i.hasOwnProperty(o)||Wt(o,r,n));for(o in i)i.hasOwnProperty(o)&&(t.hasOwnProperty(o)?e(t[o],i[o])||("geojson"===t[o].type&&"geojson"===i[o].type&&Ht(t,i,o)?r.push({command:Zt.setGeoJSONSourceData,args:[o,i[o].data]}):Xt(o,i,r,n)):qt(o,i,r))}(t.sources,i.sources,o,n);const s=[];t.layers&&t.layers.forEach((t=>{t.source&&n[t.source]?r.push({command:Zt.removeLayer,args:[t.id]}):s.push(t)}));let a=t.terrain;a&&n[a.source]&&(r.push({command:Zt.setTerrain,args:[void 0]}),a=void 0),r=r.concat(o),e(a,i.terrain)||r.push({command:Zt.setTerrain,args:[i.terrain]}),function(t,i,r){i=i||[];const n=(t=t||[]).map(Kt),o=i.map(Kt),s=t.reduce(Jt,{}),a=i.reduce(Jt,{}),l=n.slice(),c=Object.create(null);let h,u,p,d,f,m,_;for(h=0,u=0;h<n.length;h++)p=n[h],a.hasOwnProperty(p)?u++:(r.push({command:Zt.removeLayer,args:[p]}),l.splice(l.indexOf(p,u),1));for(h=0,u=0;h<o.length;h++)p=o[o.length-1-h],l[l.length-1-h]!==p&&(s.hasOwnProperty(p)?(r.push({command:Zt.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-u),1)):u++,m=l[l.length-h],r.push({command:Zt.addLayer,args:[a[p],m]}),l.splice(l.length-h,0,p),c[p]=!0);for(h=0;h<o.length;h++)if(p=o[h],d=s[p],f=a[p],!c[p]&&!e(d,f))if(e(d.source,f.source)&&e(d["source-layer"],f["source-layer"])&&e(d.type,f.type)){for(_ in Yt(d.layout,f.layout,r,p,null,Zt.setLayoutProperty),Yt(d.paint,f.paint,r,p,null,Zt.setPaintProperty),e(d.filter,f.filter)||r.push({command:Zt.setFilter,args:[p,f.filter]}),e(d.minzoom,f.minzoom)&&e(d.maxzoom,f.maxzoom)||r.push({command:Zt.setLayerZoomRange,args:[p,f.minzoom,f.maxzoom]}),d)d.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&(0===_.indexOf("paint.")?Yt(d[_],f[_],r,p,_.slice(6),Zt.setPaintProperty):e(d[_],f[_])||r.push({command:Zt.setLayerProperty,args:[p,_,f[_]]}));for(_ in f)f.hasOwnProperty(_)&&!d.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&(0===_.indexOf("paint.")?Yt(d[_],f[_],r,p,_.slice(6),Zt.setPaintProperty):e(d[_],f[_])||r.push({command:Zt.setLayerProperty,args:[p,_,f[_]]}))}else r.push({command:Zt.removeLayer,args:[p]}),m=l[l.lastIndexOf(p)+1],r.push({command:Zt.addLayer,args:[f,m]})}(s,i.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:Zt.setStyle,args:[i]}]}return r}(this.serialize(),i).filter((t=>!(t.command in Je)));if(0===r.length)return!1;const n=r.filter((t=>!(t.command in Ke)));if(n.length>0)throw new Error("Unimplemented: ".concat(n.map((t=>t.command)).join(", "),"."));return r.forEach((t=>{"setTransition"!==t.command&&"setProjection"!==t.command&&this[t.command].apply(this,t.args)})),this.stylesheet=i,this._updateMapProjection(),!0}addImage(e,i){return this.getImage(e)?this.fire(new t.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(e,i),this._afterImageUpdated(e),this)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){return this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e),this):this.fire(new t.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._checkLoaded(),void 0!==this.getSource(e))throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateSource,"sources.".concat(e),i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=kt(e,i,this.dispatcher,this);n.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(e),source:n.serialize(),sourceId:e})));const o=i=>{const r=(i?"symbol:":"other:")+e,o=this._sourceCaches[r]=new t.SourceCache(r,n,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[e]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),n.onAdd&&n.onAdd(this.map),this._changed=!0}removeSource(e){this._checkLoaded();const i=this.getSource(e);if(!i)throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(n,'" is using it.'))));if(this.terrain&&this.terrain.get().source===e)return this.fire(new t.ErrorEvent(new Error('Source "'.concat(e,'" cannot be removed while terrain is using it.'))));const r=this._getSourceCaches(e);for(const n of r)delete this._sourceCaches[n.id],delete this._updatedSources[n.id],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:n.getSource().id})),n.setEventedParent(null),n.clearTiles();return delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}
1setGeoJSONSourceData(t,e){this._checkLoaded(),this.getSource(t).setData(e),this._changed=!0}getSource(t){const e=this._getSourceCache(t);return e&&e.getSource()}addLayer(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.ErrorEvent(new Error('Layer with id "'.concat(n,'" already exists on this map'))));let o;if("custom"===e.type){if(Ye(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(n,e.source),e=t.clone$1(e),e=t.extend(e,{source:n})),this._validate(t.validateLayer,"layers.".concat(n),e,{arrayIndex:-1},r))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)return void this.fire(new t.ErrorEvent(new Error('Layer with id "'.concat(i,'" does not exist on this map.'))));this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o;const a=this._getLayerSourceCache(o);if(this._removedLayers[n]&&o.source&&a&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;
1i&&-1===n?this.fire(new t.ErrorEvent(new Error('Layer with id "'.concat(i,'" does not exist on this map.')))):(this._order.splice(n,0,e),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be removed."))));i.setEventedParent(null),this._updateLayerCount(i,!1);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}hasLayerType(t){for(const e in this._layers)if(this._layers[e].type===t)return!0;return!1}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot have zoom extent."))))}setFilter(i,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();const o=this.getLayer(i);if(o){if(!e(o.filter,r))return null==r?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateFilter,"layers.".concat(o.id,".filter"),r,{layerType:o.type},n)||(o.filter=t.clone$1(r),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be filtered."))))}getFilter(e){const i=this.getLayer(e);return i&&t.clone$1(i.filter)}setLayoutProperty(i,r,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();const s=this.getLayer(i);s?e(s.getLayoutProperty(r),n)||(s.setLayoutProperty(r,n,o),this._updateLayer(s)):this.fire(new t.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be styled."))))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style."))))}setPaintProperty(i,r,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();const s=this.getLayer(i);s?e(s.getPaintProperty(r),n)||(s.setPaintProperty(r,n,o)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new t.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be styled."))))}getPaintProperty(t,e){const i=this.getLayer(t);return i&&i.getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.getSource(r);if(!o)return void this.fire(new t.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))));const s=o.type;if("geojson"===s&&n)return void this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided.")));const a=this._getSourceCaches(r);for(const t of a)t.setFeatureState(n,e.id,i)}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.getSource(r);if(!n)return void this.fire(new t.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))));const o=n.type,s="vector"===o?e.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof e.id&&"number"!=typeof e.id)return void this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const a=this._getSourceCaches(r);for(const t of a)t.removeFeatureState(s,e.id,i)}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.getSource(i);if(n){if("vector"!==n.type||r)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(r,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '".concat(i,"' does not exist in the map's style."))))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,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:e,layers:this._serializeLayers(this._order)},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0;const e=this._getLayerSourceCache(t);t.source&&!this._updatedSources[t.source]&&e&&"raster"!==e.getSource().type&&(this._updatedSources[t.source]="reload",e.pause()),this._changed=!0,t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let o=this._order.length-1;o>=0;o--){const n=this._order[o];if(e(n)){i[n]=o;
vendor: 13,519 bytes, line 1
1for(const e of t){const t=e[n];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(e(s))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<o)break;n.push(e),r.pop()}else for(const e of t){const t=e[s];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(e,i,r){i&&i.filter&&this._validate(t.validateFilter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be queried for features.")))),[];n[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const s=i&&i.layers?i.layers.some((t=>{const e=this.getLayer(t);return e&&e.is3D()})):this.has3DLayers(),a=L.createFromScreenPoints(e,r);for(const t in this._sourceCaches){const e=this._sourceCaches[t].getSource().id;i.layers&&!n[e]||o.push(Lt(this._sourceCaches[t],this._layers,this._serializedLayers,a,i,r,s,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(t,e,i,r,n,o,s){const a={},l=o.queryRenderedSymbols(r),c=[];for(const h of Object.keys(l).map(Number))c.push(s[h]);c.sort(Rt);for(const h of c){const i=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],e,h.bucketIndex,h.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in i){const e=a[t]=a[t]||[],r=i[t];r.sort(((t,e)=>{const i=h.featureSortOrder;if(i){const r=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-r}return e.featureIndex-t.featureIndex}));for(const t of r)e.push(t)}}for(const h in a)a[h].forEach((e=>{const r=e.feature,n=i(t[h]).getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=n}));return a}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),a.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateFilter,"querySourceFeatures.filter",i.filter,null,i);const r=this._getSourceCaches(e);let n=[];for(const t of r)n=n.concat(Bt(t,i));return n}addSourceType(t,e,i){return ti.getSourceType(t)?i(new Error('A source type called "'.concat(t,'" already exists.'))):(ti.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._checkLoaded();const r=this.light.getLight();let n=!1;for(const s in t)if(!e(t[s],r[s])){n=!0;break}if(!n)return;const o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(t,i),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(i){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===r){if("object"==typeof i.source){const e="terrain-dem-src";this.addSource(e,i.source),i=t.clone$1(i),i=t.extend(i,{source:e})}if(this._validate(t.validateTerrain,"terrain",i))return}if(!this.terrain||this.terrain&&r!==this.terrain.drapeRenderMode)this._createTerrain(i,r);else{const r=this.terrain,n=r.get();for(const e of Object.keys(t.spec.terrain))!i.hasOwnProperty(e)&&t.spec.terrain[e].default&&(i[e]=t.spec.terrain[e].default);for(const t in i)if(!e(i[t],n[t])){r.set(i),this.stylesheet.terrain=i;const t=this._setTransitionParameters({duration:0});r.updateTransitions(t);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const e=this.fog=new P(t,this.map.transform);this.stylesheet.fog=t;const i=this._setTransitionParameters({duration:0});e.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const t of this.map._markers)t._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog,r=i.get();0===Object.keys(t).length&&i.set(t);for(const n in t)if(!e(t[n],r[n])){i.set(t),this.stylesheet.fog=t;const e=this._setTransitionParameters({duration:0});i.updateTransitions(e);break}}else this._createFog(t);this._markersNeedUpdate=!0}_setTransitionParameters(e){return{now:t.exported.now(),transition:t.extend(e,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const t=this._order.filter((t=>this.isLayerDraped(this._layers[t]))),e=this._order.filter((t=>!this.isLayerDraped(this._layers[t])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...e)}_createTerrain(t,e){const i=this.terrain=new A(t,e);this.stylesheet.terrain=t,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const r=this._setTransitionParameters({duration:0});i.updateTransitions(r)}_force3DLayerUpdate(){for(const t in this._layers){const e=this._layers[t];"fill-extrusion"===e.type&&this._updateLayer(e)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const e=this._layers[t];"symbol"===e.type&&this._updateLayer(e)}}_validate(e,i,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!o||!1!==o.validate)&&Ye(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:r,styleSpec:t.spec},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this._sourceCaches)this._sourceCaches[t].clearTiles(),this._sourceCaches[t].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){const e=this._getSourceCaches(t);for(const i of e)i.clearTiles()}_reloadSource(t){const e=this._getSourceCaches(t);for(const i of e)i.resume(),i.reload()}_updateSources(t){for(const e in this._sourceCaches)this._sourceCaches[e].update(t)}_generateCollisionBoxes(){for(const t in this._sourceCaches){const e=this._sourceCaches[t];e.resume(),e.reload()}}_updatePlacement(e,i,r,n){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=!1,a=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this._getLayerSourceCache(i);if(!t)continue;l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng,e.projection);s=s||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new t.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Ge(e,this._order,o,i,r,n,this.placement,this.fog&&e.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const r=t=>{t&&t.setDependencies(e.tileID.key,e.type,e.icons)};r(this._otherSourceCaches[e.source]),r(this._symbolSourceCaches[e.source])}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)}getResource(e,i,r){return t.makeRequest(i,r)}_getSourceCache(t){return this._otherSourceCaches[t]}_getLayerSourceCache(t){return"symbol"===t.type?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}_getSourceCaches(t){const e=[];return this._otherSourceCaches[t]&&e.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&e.push(this._symbolSourceCaches[t]),e}_isSourceCacheLoaded(e){const i=this._getSourceCaches(e);return 0===i.length?(this.fire(new t.ErrorEvent(new Error("There is no source with ID '".concat(e,"'")))),!1):i.every((t=>t.loaded()))}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}ti.getSourceType=function(t){return Pt[t]},ti.setSourceType=function(t,e){Pt[t]=e},ti.registerForPluginStateChange=t.registerForPluginStateChange;var ei="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.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",ii="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying 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;}",ri="\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\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;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 decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}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*texture2D(u_dem,pos).a;\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=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));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*texture2D(u_dem_prev,pos).a;\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=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));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) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return 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(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;
1vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn 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;vec4 bounds=vec4(d,vec2(1.0)-d);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",ni="#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;varying 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",oi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying 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 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,opacity);}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;}
1vec3 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;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let si={},ai={};const li=[];di(ei,li),di(ri,li),di(ni,li),di(oi,li),si=fi("",ri),ai=fi(oi,ni);const ci=fi("\nhighp 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;}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;}","\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);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),hi=ei,ui="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var pi={background:fi("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:fi("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
1uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:fi("varying vec3 v_data;varying 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\nvoid 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/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\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;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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\nvarying vec3 v_data;varying 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);\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(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);vec4 world_center=vec4(pos,1);
1\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 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,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 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:fi("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:fi("uniform highp float u_intensity;varying 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);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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\nvarying 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);\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;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=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:fi("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:fi("varying float v_placed;varying 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);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*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:fi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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:fi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying 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
1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:fi("#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\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute 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:fi("varying 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\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 FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying 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:fi("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:fi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:fi("uniform lowp vec3 u_lightpos;varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;varying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvoid main() {vec4 color=v_color;\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
1),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);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(v_normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying highp vec3 v_normal;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 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));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\nfloat ele=0.0;float h=0.0;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float 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);vec3 pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;vec3 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 hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_normal=normal;v_depth=gl_Position.w;\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}\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
1ntroid_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);directional*=(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\nv_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:fi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\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),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\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;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_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;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;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float 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);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=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_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}
1\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=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(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\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:fi("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}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);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=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+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:fi("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:fi("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\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_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);
1float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nhighp vec4 out_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nvec4 out_color=color;\n#endif\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);}}\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute 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;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\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_from\n#pragma mapbox: define lowp vec4 dash_to\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\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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\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 tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.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:fi("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute 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;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\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_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\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_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\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\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:fi("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\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 FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:fi("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute 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 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\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\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;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetProjected_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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\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,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat 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\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:fi("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_
1color\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\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\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;if (u_is_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute 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;\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\nvarying vec2 v_data0;varying 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\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\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;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetprojected_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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\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,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;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));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:f
vendor: 6,676 bytes, line 1
1i("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying 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\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\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=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;if (u_is_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute 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;\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\nvarying vec4 v_data0;varying 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\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\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;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 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;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float 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);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_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 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\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\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,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;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\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:
1fi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\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.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:fi("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:fi("\nvarying 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
1nd-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=textureCube(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);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",ii),skyboxGradient:fi("varying 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=texture2D(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);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",ii),skyboxCapture:f
vendor: 3,852 bytes, line 1
1i("\nvarying 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;\n#ifdef GL_ES\nprecision highp float;\n#endif\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;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:
1fi("uniform sampler2D u_image0;varying 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() {\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=texture2D(u_image0,v_pos0);vec4 color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\nvec4 color=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+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);}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 idy=u_grid_matrix[1][2];float S=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=a_pos[0]*S;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;\n#ifdef GLOBE_POLES\nvec3 up_vector=normalize(globe_pos)*u_tile_up_scale;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\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,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:fi("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));
1return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));float 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\nfloat horizon_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;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute 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;varying highp vec3 v_ray_dir;varying 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);}")};function di(t,e){const i=t.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let r of i)if(r=r.trim(),"#"===r[0]&&r.includes("if")&&!r.includes("endif")){r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const t=r.split(" ");for(const i of t)e.includes(i)||e.push(i)}}function fi(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),n={},o=[...li];return di(t,o),di(e,o),{fragmentSource:t=t.replace(i,((t,e,i,r,o)=>(n[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_".concat(o,"\nvarying ").concat(i," ").concat(r," ").concat(o,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(o,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(o,"\n ").concat(i," ").concat(r," ").concat(o," = u_").concat(o,";\n#endif\n")))),vertexSource:e=e.replace(i,((t,e,i,r,o)=>{const s="float"===r?"vec2":"vec4",a=o.match(/color/)?"color":s;return n[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_".concat(o,"\nuniform lowp float u_").concat(o,"_t;
1\nattribute ").concat(i," ").concat(s," a_").concat(o,";\nvarying ").concat(i," ").concat(r," ").concat(o,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(o,";\n#endif\n"):"vec4"===a?"\n#ifndef HAS_UNIFORM_u_".concat(o,"\n ").concat(o," = a_").concat(o,";\n#else\n ").concat(i," ").concat(r," ").concat(o," = u_").concat(o,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(o,"\n ").concat(o," = unpack_mix_").concat(a,"(a_").concat(o,", u_").concat(o,"_t);\n#else\n ").concat(i," ").concat(r," ").concat(o," = u_").concat(o,";\n#endif\n"):"define"===e?"\n#ifndef HAS_UNIFORM_u_".concat(o,"\nuniform lowp float u_").concat(o,"_t;\nattribute ").concat(i," ").concat(s," a_").concat(o,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(o,";\n#endif\n"):"vec4"===a?"\n#ifndef HAS_UNIFORM_u_".concat(o,"\n ").concat(i," ").concat(r," ").concat(o," = a_").concat(o,";\n#else\n ").concat(i," ").concat(r," ").concat(o," = u_").concat(o,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(o,"\n ").concat(i," ").concat(r," ").concat(o," = unpack_mix_").concat(a,"(a_").concat(o,", u_").concat(o,"_t);\n#else\n ").concat(i," ").concat(r," ").concat(o," = u_").concat(o,";\n#endif\n")})),staticAttributes:r,usedDefines:o}}class mi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,e,i,r,n,o,s){this.context=t;let a=this.boundPaintVertexBuffers.length!==r.length;for(let c=0;!a&&c<r.length;c++)this.boundPaintVertexBuffers[c]!==r[c]&&(a=!0);let l=this.boundDynamicVertexBuffers.length!==s.length;for(let c=0;!l&&c<s.length;c++)this.boundDynamicVertexBuffers[c]!==s[c]&&(l=!0);if(!t.extVertexArrayObject||!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||a||l||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(e,i,r,n,o,s);else{t.bindVertexArrayOES.set(this.vao);for(const t of s)t&&t.bind();n&&n.dynamicDraw&&n.bind()}}freshBind(t,e,i,r,n,o){let s;const a=t.numAttributes,l=this.context,c=l.gl;if(l.extVertexArrayObject)this.vao&&this.destroy(),this.vao=l.extVertexArrayObject.createVertexArrayOES(),l.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o;else{s=l.currentNumAttributes||0;for(let t=a;t<s;t++)c.disableVertexAttribArray(t)}e.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,n);for(const h of i)h.enableAttributes(c,t),h.bind(),h.setVertexAttribPointers(c,t,n);for(const h of o)h&&(h.enableAttributes(c,t),h.bind(),h.setVertexAttribPointers(c,t,n));r&&r.bind(),l.currentNumAttributes=a}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function _i(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.MercatorCoordinate(0,n/r).toLngLat().lat,new t.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}function gi(e,i,r,n,o,s,a){const l=e.context,c=l.gl,h=r.fbo;if(!h)return;e.prepareDrawTile();const u=e.useProgram("hillshade");l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,h.colorAttachment.get());const p=((t,e,i,r)=>{const n=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:r||t.transform.calculateProjMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:_i(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:n,u_highlight:o,u_accent:s}})(e,r,n,e.terrain?i.projMatrix:null);e.prepareDrawProgram(l,u,i.toUnwrapped());const{tileBoundsBuffer:d,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=e.getTileBoundsBuffers(r);u.draw(l,c.TRIANGLES,o,s,a,t.CullFaceMode.disabled,p,n.id,d,f,m)}function yi(e,i,r){if(!i.needsDEMTextureUpload)return;const n=e.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(r.stride);const s=r.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new t.Texture(n,s,o.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}function xi(e,i,r,n,o,s){const a=e.context,l=a.gl;if(!i.dem)return;const c=i.dem;if(a.activeTexture.set(l.TEXTURE1),yi(e,i,c),!i.demTexture)return;i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const h=c.dim;a.activeTexture.set(l.TEXTURE0);let u=i.fbo;if(!u){const e=new t.Texture(a,{width:h,height:h,data:null},l.RGBA);e.bind(l.LINEAR,l.CLAMP_TO_EDGE),u=i.fbo=a.createFramebuffer(h,h,!0),u.colorAttachment.set(e.texture)}a.bindFramebuffer.set(u.framebuffer),a.viewport.set([0,0,h,h]);const{tileBoundsBuffer:p,tileBoundsIndexBuffer:d,tileBoundsSegments:f}=e.getMercatorTileBoundsBuffers();e.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,n,o,s,t.CullFaceMode.disabled,((e,i)=>{const r=i.stride,n=t.create();return t.ortho(n,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(n,n,[0,-t.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.unpackVector}})(i.tileID,c),r.id,p,d,f),i.needsHillshadePrepare=!1}const vi=e=>({u_matrix:new t.UniformMatrix4f(e),u_image0:new t.Uniform1i(e),u_skirt_height:new t.Uniform1f(e)}),bi=(t,e)=>({u_matrix:t,u_image0:0,u_skirt_height:e}),wi=(t,e,i,r,n,o,s,a,l,c,h,u,p,d)=>({u_proj_matrix:Float32Array.from(t),u_globe_matrix:e,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:h,u_globe_radius:u,u_viewport:p,u_grid_matrix:d?Float32Array.from(d):new Float32Array(9)});function Ti(t,e){return null!=t&&null!=e&&!(!t.hasData()||!e.hasData())&&null!=t.demTexture&&null!=e.demTexture&&t.tileID.key!==e.tileID.key}const Ei=new class{constructor(){this.operations={}}newMorphing(t,e,i,r,n){if(t in this.operations){const e=this.operations[t];e.to.tileID.key!==i.tileID.key&&(e.queued=i)}else this.operations[t]={startTime:r,phase:0,duration:n,from:e,to:i,queued:null}}getMorphValuesForProxy(t){if(!(t in this.operations))return null;const e=this.operations[t];return{from:e.from,to:e.to,phase:e.phase}}update(t){for(const e in this.operations){const i=this.operations[e];for(i.phase=(t-i.startTime)/i.duration;i.phase>
vendor: 28,660 bytes, line 1
1=1||!this._validOp(i);)if(!this._nextOp(i,t)){delete this.operations[e];break}}}_nextOp(t,e){return!!t.queued&&(t.from=t.to,t.to=t.queued,t.queued=null,t.phase=0,t.startTime=e,!0)}_validOp(t){return t.from.hasData()&&t.to.hasData()}},Si={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ai(t,e){const i=1<<t.z;return!e&&(0===t.x||t.x===i-1)||0===t.y||t.y===i-1}const Mi=t=>({u_matrix:t});function Ii(e,i,r,n,o){if(o>0){const s=t.exported.now(),a=(s-e.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=r.getSource(),h=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=u&&e.refreshedUponExpiration?1:t.clamp(u?a:1-l,0,1);return e.refreshedUponExpiration&&a>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}class Ci extends t.SourceCache{constructor(t){const e={type:"raster-dem",maxzoom:t.transform.maxZoom},i=new k(jt(),null),r=kt("mock-dem",e,i,t.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,e){t.state="loaded",e(null)}}class zi extends t.SourceCache{constructor(t){const e=kt("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new k(jt(),null),t.style);super("proxy",e,!1),e.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,i,r){if(e.freezeTileCoverage)return;this.transform=e;const n=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]){const i=new t.Tile(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i}),{});for(const t in this._tiles)t in n||(this.freeFBO(t),this._tiles[t].unloadVectorData(),delete this._tiles[t])}freeFBO(t){const e=this.proxyCachedFBO[t];if(void 0!==e){const i=Object.values(e);this.renderCachePool.push(...i),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach((t=>t.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Pi extends t.OverscaledTileID{constructor(t,e,i){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=e,this.projMatrix=i}}class ki extends t.Elevation{constructor(e,i){super(),this.painter=e,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,o]=function(e){const i=new t.StructArrayLayout4i8,r=new t.StructArrayLayout3ui6,n=131;i.reserve(17161),r.reserve(33800);const o=t.EXTENT/128,s=t.EXTENT+o/2,a=s+o;for(let c=-o;c<a;c+=o)for(let e=-o;e<a;e+=o){const r=e<0||e>s||c<0||c>s?24575:0,n=t.clamp(Math.round(e),0,t.EXTENT),o=t.clamp(Math.round(c),0,t.EXTENT);i.emplaceBack(n+r,o,n,o)}const l=(t,e)=>{const i=e*n+t;r.emplaceBack(i+1,i,i+n),r.emplaceBack(i+n,i+n+1,i+1)};for(let t=1;t<129;t++)for(let e=1;e<129;e++)l(e,t);return[0,129].forEach((t=>{for(let e=0;e<130;e++)l(e,t),l(t,e)})),[i,r,32768]}(),s=e.context;this.gridBuffer=s.createVertexBuffer(r,t.boundsAttributes.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=t.SegmentVector.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=t.SegmentVector.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new zi(i.map),this.orthoMatrix=t.create(),t.ortho(this.orthoMatrix,0,t.EXTENT,0,t.EXTENT,0,1);const a=s.gl;this._overlapStencilMode=new t.StencilMode({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=e.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ci(i.map)}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),t.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=t,this._checkRenderCacheEfficiency()}update(e,i,r){if(e&&e.terrain){this._style!==e&&(this.style=e),this.enabled=!0;const n=e.terrain.properties;this.sourceCache=0===e.terrain.drapeRenderMode?this._mockSourceCache:e._getSourceCache(n.get("source")),this._exaggeration=n.get("exaggeration");const o=()=>{this.sourceCache.used&&t.warnOnce("Raster DEM source '".concat(this.sourceCache.id,"' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source."));const e=this.getScaledDemTileSize();this.sourceCache.update(i,e,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),i.updateElevation(!r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const e=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==e.efficiency&&t.warnOnce("Terrain render cache efficiency is not optimal (".concat(e.efficiency,"%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '").concat(e.firstUndrapedLayer,"' or create a map using optimizeForTerrain: true option."))}_onStyleDataEvent(t){t.coord&&"source"===t.dataType?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):"style"===t.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._sourceCaches)this._style._sourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((t=>t.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(e){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map((t=>{const e=i.getTileByID(t).tileID;return e.projMatrix=r.calculateProjMatrix(e.toUnwrapped()),e}));!function(e,i){const r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new t.pointGeometry(r.x,r.y);e.sort(((e,i)=>{if(i.overscaledZ-e.overscaledZ)return i.overscaledZ-e.overscaledZ;const r=new t.pointGeometry(e.canonical.x+(1<<e.canonical.z)*e.wrap,e.canonical.y),o=new t.pointGeometry(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),s=n.mult(1<<e.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(r)-s.distSqr(o)}))}(n,this.painter),this._previousZoom=r.zoom;const o=this.proxyToSource||{};this.proxyToSource={},n.forEach((t=>{this.proxyToSource[t.key]={}})),this.terrainTileForTile={};const s=this._style._sourceCaches;for(const t in s){const i=s[t];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,e[t],o),i.usedForTerrain)continue;const r=e[t];i.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[i.id]=n.map((t=>new Pi(t,t.key,this.orthoMatrix))),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=t.exported.now();const a={};this._visibleDemTiles=[];for(const t of this.proxyCoords){const e=this.terrainTileForTile[t.key];if(!e)continue;const i=e.tileID.key;i in a||(this._visibleDemTiles.push(e),a[i]=i)}}_assignTerrainTiles(t){this._initializing||t.forEach((t=>{if(this.terrainTileForTile[t.key])return;const e=this._findTileCoveringTileID(t,this.sourceCache);e&&(this.terrainTileForTile[t.key]=e)}))}_prepareDEMTextures(){const t=this.painter.context,e=t.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(t.activeTexture.set(e.TEXTURE1),yi(this.painter,r,n))}}_prepareDemTileUniforms(t,e,i,r){if(!e||null==e.demTexture)return!1;const n=t.tileID.canonical,o=Math.pow(2,e.tileID.canonical.z-n.z),s=r||"";return i["u_dem_tl".concat(s)]=[n.x*o%1,n.y*o%1],i["u_dem_scale".concat(s)]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const e=this.painter.context,i=e.gl;if(!this._emptyDepthBufferTexture){const r=new t.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new t.Texture(e,r,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let t=0;const e=this._visibleDemTiles.reduce(((e,i)=>{if(!i.dem)return e;const r=i.dem.tree.minimums[0];return r>0&&t++,e+r}),0);return t?e/t:0}_updateEmptyDEMTexture(){const e=this.painter.context,i=e.gl;e.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),n=new t.RGBAImage({width:1,height:1},new Uint8Array(t.DEMData.pack(r,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new t.Texture(e,n,i.RGBA,{premultiply:!1}),o}setupElevationDraw(e,i,r){const n=this.painter.context,o=n.gl,s=(a=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:t.DEMData.getUnpackVector(a),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,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});var a;s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();const l=this.painter.transform,c=l.projection,h=e.tileID.canonical;s.u_tile_tl_up=c.upVector(h,0,0),s.u_tile_tr_up=c.upVector(h,t.EXTENT,0),s.u_tile_br_up=c.upVector(h,t.EXTENT,t.EXTENT),s.u_tile_bl_up=c.upVector(h,0,t.EXTENT),s.u_tile_up_scale=r&&r.useDenormalizedUpVectorScale?t.GLOBE_METERS_TO_ECEF:c.upVectorScale(h,l.center.lat,l.worldSize).metersToTile;let u=null,p=null,d=1;if(r&&r.morphing&&this._useVertexMorphing){const t=r.morphing.srcDemTile,i=r.morphing.dstDemTile;d=r.morphing.phase,t&&i&&(this._prepareDemTileUniforms(e,t,s,"_prev")&&(p=t),this._prepareDemTileUniforms(e,i,s)&&(u=i))}if(p&&u?(n.activeTexture.set(o.TEXTURE2),u.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),n.activeTexture.set(o.TEXTURE4),p.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),s.u_dem_lerp=d):(u=this.terrainTileForTile[e.tileID.key],n.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(e,u,s)?u.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),n.activeTexture.set(o.TEXTURE3),r&&r.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]),r&&r.useMeterToDem&&u){const e=(1<<u.tileID.canonical.z)*t.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=e}r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(n,s)}renderToBackBuffer(e){const i=this.painter,r=this.painter.context;0!==e.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(e,i,r,n,o){if("globe"===e.transform.projection.name)!function(e,i,r,n,o){const s=e.context,a=s.gl;let l,c;const h=e.options.showTerrainWireframe?2:0,u=e.transform,p=t.globeUseCustomAntiAliasing(e,s,u),d=(t,i)=>{if(c===t)return;const r=[Si[t],"PROJECTION_GLOBE_VIEW"];p&&r.push("CUSTOM_ANTIALIASING"),i&&r.push(Si[h]),l=e.useProgram("globeRaster",null,r),c=t},f=e.colorModeForRenderPass(),m=new t.DepthMode(a.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);Ei.update(o);const _=t.calculateGlobeMercatorMatrix(u),g=[t.mercatorXfromLng(u.center.lng),t.mercatorYfromLat(u.center.lat)],y=h?[!1,!0]:[!1],x=e.globeSharedBuffers,v=[u.width*t.exported.devicePixelRatio,u.height*t.exported.devicePixelRatio],b=Float32Array.from(u.globeMatrix),w={useDenormalizedUpVectorScale:!0};if(y.forEach((h=>{c=-1;const p=h?a.LINES:a.TRIANGLES;for(const c of n){const n=r.getTile(c),y=t.StencilMode.disabled,T=i.prevTerrainTileForTile[c.key],E=i.terrainTileForTile[c.key];Ti(T,E)&&Ei.newMorphing(c.key,T,E,o,250),s.activeTexture.set(a.TEXTURE0),n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const S=Ei.getMorphValuesForProxy(c.key),A=S?1:0;S&&t.extend$1(w,{morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:t.easeCubicInOut(S.phase)}});const M=t.tileCornersToBounds(c.canonical),I=t.getLatitudinalLod(M.getCenter().lat),C=t.getGridMatrix(c.canonical,M,I),z=t.globeNormalizeECEF(t.globeTileBounds(c.canonical)),P=wi(u.projMatrix,b,_,z,t.globeToMercatorTransition(u.zoom),g,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,v,C);if(d(A,h),i.setupElevationDraw(n,l,w),e.prepareDrawProgram(s,l,c.toUnwrapped()),x){const[i,r,n]=h?x.getWirefameBuffers(e.context,I):x.getGridBuffers(I);l.draw(s,p,m,y,f,t.CullFaceMode.backCCW,P,"globe_raster",i,r,n)}}})),x){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];p&&o.push("CUSTOM_ANTIALIASING"),l=e.useProgram("globeRaster",null,o);for(const c of n){const{x:n,y:o,z:h}=c.canonical,p=0===o,d=o===(1<<h)-1,[_,y,b,T]=x.getPoleBuffers(h);if(T&&(p||d)){const o=r.getTile(c);s.activeTexture.set(a.TEXTURE0),o.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let x=t.globePoleMatrixForTile(h,n,u);const E=t.globeNormalizeECEF(t.globeTileBounds(c.canonical)),S=(e,i)=>e.draw(s,a.TRIANGLES,m,t.StencilMode.disabled,f,t.CullFaceMode.disabled,wi(u.projMatrix,x,x,E,0,g,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,v),"globe_pole_raster",i,b,T);i.setupElevationDraw(o,l,w),e.prepareDrawProgram(s,l,c.toUnwrapped()),p&&S(l,_),d&&(x=t.scale(t.create(),x,[1,-1,1]),S(l,y))}}}}(e,i,r,n,o);else{const s=e.context,a=s.gl;let l,c;const h=e.options.showTerrainWireframe?2:0,u=(t,i)=>{if(c===t)return;const r=[Si[t]];i&&r.push(Si[h]),l=e.useProgram("terrainRaster",null,r),c=t},p=e.colorModeForRenderPass(),d=new t.DepthMode(a.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);Ei.update(o);const f=e.transform,m=6*Math.pow(1.5,22-f.zoom)*i.exaggeration();(h?[!1,!0]:[!1]).forEach((h=>{c=-1;const _=h?a.LINES:a.TRIANGLES,[g,y]=h?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments];for(const c of n){const n=r.getTile(c),x=t.StencilMode.disabled,v=i.prevTerrainTileForTile[c.key],b=i.terrainTileForTile[c.key];Ti(v,b)&&Ei.newMorphing(c.key,v,b,o,250),s.activeTexture.set(a.TEXTURE0),n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST);const w=Ei.getMorphValuesForProxy(c.key),T=w?1:0;let E;w&&(E={morphing:{srcDemTile:w.from,dstDemTile:w.to,phase:t.easeCubicInOut(w.phase)}});const S=bi(c.projMatrix,Ai(c.canonical,f.renderWorldCopies)?m/10:m);u(T,h),i.setupElevationDraw(n,l,E),e.prepareDrawProgram(s,l,c.toUnwrapped()),l.draw(s,_,d,x,p,t.CullFaceMode.backCCW,S,"terrain_raster",i.gridBuffer,g,y)}}))}}(i,this,this.proxySourceCache,e,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),e.splice(0,e.length))}renderBatch(e){if(0===this._drapedRenderBatches.length)return e+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=[],l=i.style.order;let c=0;for(const h of o){const o=n.getTileByID(h.proxyTileKey),u=n.proxyCachedFBO[h.key]?n.proxyCachedFBO[h.key][e]:void 0,p=void 0!==u?n.renderCache[u]:this.pool[c++],d=void 0!==u;if(o.texture=p.tex,d&&!p.dirty){a.push(o.tileID);continue}let f;r.bindFramebuffer.set(p.fb.framebuffer),this.renderedToTile=!1,p.dirty&&(r.clear({color:t.Color.transparent,stencil:0}),p.dirty=!1);for(let t=s.start;t<=s.end;++t){const e=i.style._layers[l[t]];if(e.isHidden(i.transform.zoom))continue;const n=i.style._getLayerSourceCache(e),o=n?this.proxyToSource[h.key][n.id]:[h];if(!o)continue;const s=o;r.viewport.set([0,0,p.fb.width,p.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(p,o,e,n),f=n?n.id:null),i.renderLayer(i,n,e,s)}this.renderedToTile?(p.dirty=!0,a.push(o.tileID)):d||--c,5===c&&(c=0,this.renderToBackBuffer(a))}return this.renderToBackBuffer(a),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}renderCacheEfficiency(t){const e=t.order.length;if(0===e)return{efficiency:100};let i,r=0,n=0,o=!1;for(let s=0;s<e;++s){const e=t._layers[t.order[s]];this._style.isLayerDraped(e)?(o&&++r,++n):o||(o=!0,i=e.id)}return 0===n?{efficiency:100}:{efficiency:100*(1-r/n),firstUndrapedLayer:i}}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter((t=>t.dem)).forEach((e=>{t=Math.min(t,e.dem.tree.minimums[0])})),0===t?t:(t-30)*this._exaggeration}raycast(t,e,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter((t=>t.dem)).map((r=>{const n=r.tileID,o=1<<n.overscaledZ,{x:s,y:a}=n.canonical,l=s/o,c=(s+1)/o,h=a/o,u=(a+1)/o;return{minx:l,miny:h,maxx:c,maxy:u,t:r.dem.tree.raycastRoot(l,h,c,u,t,e,i),tile:r}}));r.sort(((t,e)=>(null!==t.t?t.t:Number.MAX_VALUE)-(null!==e.t?e.t:Number.MAX_VALUE)));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,t,e,i);if(null!=r)return r}return null}_createFBO(){const e=this.painter.context,i=e.gl,r=this.drapeBufferSize;e.activeTexture.set(i.TEXTURE0);const n=new t.Texture(e,{width:r[0],height:r[1],data:null},i.RGBA);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=e.createFramebuffer(r[0],r[1],!1);return o.colorAttachment.set(n.texture),o.depthAttachment=new Et(e,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=e.createRenderbuffer(e.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),e.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),e.extTextureFilterAnisotropic&&!e.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.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._style.light&&this._style.light.hasTransition())return!0;for(const t in this._style._sourceCaches)if(this._style._sourceCaches[t].hasTransition())return!0;return this._style.order.some((t=>{const e=this._style._layers[t],i=e.isHidden(this.painter.transform.zoom),r=e.getCrossfadeParameters(),n=!!r&&1!==r.t,o=e.hasTransition();return"custom"!==e.type&&!i&&(n||o)}))}_clearRasterFadeFromRenderCache(){let t=!1;for(const e in this._style._sourceCaches)if(this._style._sourceCaches[e]._source instanceof Mt){t=!0;break}if(t)for(let e=0;e<this._style.order.length;++e){const t=this._style._layers[this._style.order[e]],i=t.isHidden(this.painter.transform.zoom),r=this._style._getLayerSourceCache(t);if("raster"!==t.type||i||!r)continue;const n=t.paint.get("raster-fade-duration");for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][r.id];if(t)for(const e of t){const t=Ii(r.getTile(e),r.findLoadedParent(e,0),r,this.painter.transform,n);(1!==t.opacity||0!==t.mix)&&this._clearRenderCacheForTile(r.id,e)}}}}_setupDrapedRenderBatches(){const t=this._style.order,e=t.length;if(0===e)return;const i=[];let r,n=0,o=this._style._layers[t[n]];for(;!this._style.isLayerDraped(o)&&o.isHidden(this.painter.transform.zoom)&&++n<e;)o=this._style._layers[t[n]];for(;n<e;++n){const e=this._style._layers[t[n]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===r&&(r=n):void 0!==r&&(i.push({start:r,end:n-1}),r=void 0))}void 0!==r&&i.push({start:r,end:n-1}),this._drapedRenderBatches=i}_setupRenderCache(t){const e=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,e.renderCache.length>e.renderCachePool.length){const t=Object.values(e.proxyCachedFBO);e.proxyCachedFBO={};for(let i=0;i<t.length;++i){const r=Object.values(t[i]);e.renderCachePool.push(...r)}}return}this._clearRasterFadeFromRenderCache();const i=this.proxyCoords,r=this._tilesDirty;for(let o=i.length-1;o>=0;o--){const n=i[o];if(e.getTileByID(n.key),void 0!==e.proxyCachedFBO[n.key]){const i=t[n.key],o=this.proxyToSource[n.key];let s=0;for(const t in o){const e=o[t],n=i[t];if(!n||n.length!==e.length||e.some(((e,i)=>e!==n[i]||r[t]&&r[t].hasOwnProperty(e.key)))){s=-1;break}++s}for(const t in e.proxyCachedFBO[n.key])e.renderCache[e.proxyCachedFBO[n.key][t]].dirty=s<0||s!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort(((t,e)=>e.end-e.start-(t.end-t.start)));for(const o of n)for(const t of i){if(e.proxyCachedFBO[t.key])continue;let i=e.renderCachePool.pop();void 0===i&&e.renderCache.length<50&&(i=e.renderCache.length,e.renderCache.push(this._createFBO())),void 0!==i&&(e.proxyCachedFBO[t.key]={},e.proxyCachedFBO[t.key][o.start]=i,e.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(t,e,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(e.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=e.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(e[0].overscaledZ>e[e.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(e,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):t.StencilMode.disabled}_renderTileClippingMasks(e,i){const r=this.painter,n=this.painter.context,o=n.gl;r._tileClippingMaskIDs={},n.setColorMode(t.ColorMode.disabled),n.setDepthMode(t.DepthMode.disabled);const s=r.useProgram("clippingMask");for(const a of e){const e=r._tileClippingMaskIDs[a.key]=--i;s.draw(n,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,Mi(a.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(e){const i=this.painter.transform;if(e.x<0||e.x>i.width||e.y<0||e.y>i.height)return null;const r=[e.x,e.y,1,1];t.transformMat4$1(r,r,i.pixelMatrixInverse),t.scale$1(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,o=t.mercatorZfromAltitude(1,i.center.lat),s=[n[0],n[1],n[2]/o,0],a=t.subtract([],r.slice(0,3),s);t.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(t.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}drawDepth(){const e=this.painter,i=e.context,r=this.proxySourceCache,n=Math.ceil(e.width),o=Math.ceil(e.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){const e=i.gl,r=i.createFramebuffer(n,o,!0);i.activeTexture.set(e.TEXTURE0);const s=new t.Texture(i,{width:n,height:o,data:null},e.RGBA);s.bind(e.NEAREST,e.CLAMP_TO_EDGE),r.colorAttachment.set(s.texture);const a=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,n,o);r.depthAttachment.set(a),this._depthFBO=r,this._depthTexture=s}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,n,o]),function(e,i,r,n){if("globe"===e.transform.projection.name)return;const o=e.context,s=o.gl;o.clear({depth:1});const a=e.useProgram("terrainDepth"),l=new t.DepthMode(s.LESS,t.DepthMode.ReadWrite,e.depthRangeFor3D);for(const c of n){const e=r.getTile(c),n=bi(c.projMatrix,0);i.setupElevationDraw(e,a),a.draw(o,s.TRIANGLES,l,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.backCCW,n,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(e,this,r,this.proxyCoords)}_setupProxiedCoordsForOrtho(t,e,i){if(t.getSource()instanceof zt)return this._setupProxiedCoordsForImageSource(t,e,i);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const r=this.proxiedCoords[t.id]=[],n=this.proxyCoords;for(let s=0;s<n.length;s++){const e=n[s],o=this._findTileCoveringTileID(e,t);if(o){const n=this._createProxiedId(e,o,i[e.key]&&i[e.key][t.id]);r.push(n),this.proxyToSource[e.key][t.id]=[n]}}let o=!1;for(let s=0;s<e.length;s++){const n=t.getTile(e[s]);if(!n||!n.hasData())continue;const a=this._findTileCoveringTileID(n.tileID,this.proxySourceCache);if(a&&a.tileID.canonical.z!==n.tileID.canonical.z){const e=this.proxyToSource[a.tileID.key][t.id],s=this._createProxiedId(a.tileID,n,i[a.tileID.key]&&i[a.tileID.key][t.id]);e?e.splice(e.length-1,0,s):this.proxyToSource[a.tileID.key][t.id]=[s],r.push(s),o=!0}}this._sourceTilesOverlap[t.id]=o}_setupProxiedCoordsForImageSource(e,i,r){if(!e.getSource().loaded())return;const n=this.proxiedCoords[e.id]=[],o=this.proxyCoords,s=e.getSource(),a=new t.pointGeometry(s.tileID.x,s.tileID.y)._div(1<<s.tileID.z),l=s.coordinates.map(t.MercatorCoordinate.fromLngLat).reduce(((t,e)=>(t.min.x=Math.min(t.min.x,e.x-a.x),t.min.y=Math.min(t.min.y,e.y-a.y),t.max.x=Math.max(t.max.x,e.x-a.x),t.max.y=Math.max(t.max.y,e.y-a.y),t)),{min:new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new t.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(e,i)=>{const r=e.wrap+e.canonical.x/(1<<e.canonical.z),n=e.canonical.y/(1<<e.canonical.z),o=t.EXTENT/(1<<e.canonical.z),s=i.wrap+i.canonical.x/(1<<i.canonical.z),a=i.canonical.y/(1<<i.canonical.z);return r+o<s+l.min.x||r>s+l.max.x||n+o<a+l.min.y||n>a+l.max.y};for(let t=0;t<o.length;t++){const s=o[t];for(let t=0;t<i.length;t++){const o=e.getTile(i[t]);if(!o||!o.hasData())continue;if(c(s,o.tileID))continue;const a=this._createProxiedId(s,o,r[s.key]&&r[s.key][e.id]),l=this.proxyToSource[s.key][e.id];l?l.push(a):this.proxyToSource[s.key][e.id]=[a],n.push(a)}}}_createProxiedId(e,i,r){let n=this.orthoMatrix;if(r){const t=r.find((t=>t.key===i.tileID.key));if(t)return t}if(i.tileID.key!==e.key){const r=e.canonical.z-i.tileID.canonical.z;let o,s,a;n=t.create();const l=i.tileID.wrap-e.wrap<<e.overscaledZ;r>0?(o=t.EXTENT>>r,s=o*((i.tileID.canonical.x<<r)-e.canonical.x+l),a=o*((i.tileID.canonical.y<<r)-e.canonical.y)):(o=t.EXTENT<<-r,s=t.EXTENT*(i.tileID.canonical.x-(e.canonical.x+l<<-r)),a=t.EXTENT*(i.tileID.canonical.y-(e.canonical.y<<-r))),t.ortho(n,0,o,0,o,0,1),t.translate(n,n,[s,a,0])}return new Pi(i.tileID,e.key,n)}_findTileCoveringTileID(e,i){let r=i.getTile(e);if(r&&r.hasData())return r;const n=this._findCoveringTileCache[i.id],o=n[e.key];if(r=o?i.getTileByID(o):null,r&&r.hasData()||null===o)return r;let s=r?r.tileID:e,a=s.overscaledZ;const l=i.getSource().minzoom,c=[];if(!o){const n=i.getSource().maxzoom;if(e.canonical.z>=n){const r=e.canonical.z-n;i.getSource().reparseOverscaled?(a=Math.max(e.canonical.z+2,i.transform.tileZoom),s=new t.OverscaledTileID(a,e.wrap,n,e.canonical.x>>r,e.canonical.y>>r)):0!==r&&(a=n,s=new t.OverscaledTileID(a,e.wrap,n,e.canonical.x>>r,e.canonical.y>>r))}s.key!==e.key&&(c.push(s.key),r=i.getTile(s))}const h=t=>
1{c.forEach((e=>{n[e]=t})),c.length=0};for(a-=1;a>=l&&(!r||!r.hasData());a--){r&&h(r.tileID.key);const t=s.calculateScaledKey(a);if(r=i.getTileByID(t),r&&r.hasData())break;const e=n[t];if(null===e)break;void 0===e?c.push(t):r=i.getTileByID(e)}return h(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,e){let i=this._tilesDirty[t];i||(i=this._tilesDirty[t]={}),i[e.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const e=function(e){let i=0;const r=new t.StructArrayLayout2ui4,n=131;for(let t=1;t<129;t++){for(let e=1;e<129;e++)i=t*n+e,r.emplaceBack(i,i+1),r.emplaceBack(i,i+n),r.emplaceBack(i+1,i+n),128===t&&r.emplaceBack(i+n,i+n+1);r.emplaceBack(i+1,i+1+n)}return r}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(e),this.wireframeSegments=t.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,e.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class Di{static cacheKey(t,e,i,r){let n="".concat(e).concat(r?r.cacheKey:"");for(const o of i)t.usedDefines.includes(o)&&(n+="/".concat(o));return n}constructor(e,i,r,n,o,s){const a=e.gl;this.program=a.createProgram();const l=function(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}(r.staticAttributes),c=n?n.getBinderAttributes():[],h=l.concat(c);let u=n?n.defines():[];u=u.concat(s.map((t=>"#define ".concat(t))));const p=u.concat(e.extStandardDerivatives?"#extension GL_OES_standard_derivatives : enable\n".concat(ui):ui,ui,hi,ci.fragmentSource,ai.fragmentSource,r.fragmentSource).join("\n"),d=u.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",hi,ci.vertexSource,ai.vertexSource,si.vertexSource,r.vertexSource).join("\n"),f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,p),a.compileShader(f),a.attachShader(this.program,f);const m=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(m,d),a.compileShader(m),a.attachShader(this.program,m),this.attributes={},this.numAttributes=h.length;for(let t=0;t<this.numAttributes;t++)h[t]&&(a.bindAttribLocation(this.program,t,h[t]),this.attributes[h[t]]=t);a.linkProgram(this.program),a.deleteShader(m),a.deleteShader(f),this.fixedUniforms=o(e),this.binderUniforms=n?n.getUniforms(e):[],-1!==s.indexOf("TERRAIN")&&(this.terrainUniforms=(e=>({u_dem:new t.Uniform1i(e),u_dem_prev:new t.Uniform1i(e),u_dem_unpack:new t.Uniform4f(e),u_dem_tl:new t.Uniform2f(e),u_dem_scale:new t.Uniform1f(e),u_dem_tl_prev:new t.Uniform2f(e),u_dem_scale_prev:new t.Uniform1f(e),u_dem_size:new t.Uniform1f(e),u_dem_lerp:new t.Uniform1f(e),u_exaggeration:new t.Uniform1f(e),u_depth:new t.Uniform1i(e),u_depth_size_inv:new t.Uniform2f(e),u_meter_to_dem:new t.Uniform1f(e),u_label_plane_matrix_inv:new t.UniformMatrix4f(e),u_tile_tl_up:new t.Uniform3f(e),u_tile_tr_up:new t.Uniform3f(e),u_tile_br_up:new t.Uniform3f(e),u_tile_bl_up:new t.Uniform3f(e),u_tile_up_scale:new t.Uniform1f(e)}))(e)),-1!==s.indexOf("FOG")&&(this.fogUniforms=(e=>({u_fog_matrix:new t.UniformMatrix4f(e),u_fog_range:new t.Uniform2f(e),u_fog_color:new t.Uniform4f(e),u_fog_horizon_blend:new t.Uniform1f(e),u_fog_temporal_offset:new t.Uniform1f(e),u_frustum_tl:new t.Uniform3f(e),u_frustum_tr:new t.Uniform3f(e),u_frustum_br:new t.Uniform3f(e),u_frustum_bl:new t.Uniform3f(e),u_globe_pos:new t.Uniform3f(e),u_globe_radius:new t.Uniform1f(e),u_globe_transition:new t.Uniform1f(e),u_is_globe:new t.Uniform1i(e),u_viewport:new t.Uniform2f(e)}))(e))}}setTerrainUniformValues(t,e){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const t in e)i[t].set(this.program,t,e[t])}}setFogUniformValues(t,e){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const t in e)i[t].set(this.program,t,e[t])}}draw(t,e,i,r,n,o,s,a,l,c,h,u,p,d,f){const m=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o);for(const g of Object.keys(this.fixedUniforms))this.fixedUniforms[g].set(this.program,g,s[g]);d&&d.setUniforms(this.program,t,this.binderUniforms,u,{zoom:p});const _={[m.LINES]:2,[m.TRIANGLES]:3,[m.LINE_STRIP]:1}[e];for(const g of h.get()){const i=g.vaos||(g.vaos={});(i[a]||(i[a]=new mi)).bind(t,this,l,d?d.getPaintVertexBuffers():[],c,g.vertexOffset,f||[]),m.drawElements(e,g.primitiveLength*_,m.UNSIGNED_SHORT,g.primitiveOffset*_*2)}}}
vendor: 32,092 bytes, line 1
1function Li(t,e,i){const r=1/D(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,s=o*(i.tileID.canonical.x+i.tileID.wrap*n),a=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a]}}const Bi=t.create(),Ri=(e,i,r,n,o,s,a,l,c,h,u)=>{const p=i.style.light,d=p.properties.get("position"),f=[d.x,d.y,d.z],m=t.create$1();"viewport"===p.properties.get("anchor")&&(t.fromRotation(m,-i.transform.angle),t.transformMat3(f,f,m));const _=p.properties.get("color"),g=i.transform,y={u_matrix:e,u_lightpos:f,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Bi,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:s};return"globe"===g.projection.name&&(y.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],y.u_zoom_transition=c,y.u_inv_rot_matrix=u,y.u_merc_center=h,y.u_up_dir=g.projection.upVector(new t.CanonicalTileID(0,0,0),h[0]*t.EXTENT,h[1]*t.EXTENT),y.u_height_lift=l),y},Fi=(e,i,r,n,o,s,a,l,c,h,u,p,d)=>{const f=Ri(e,i,r,n,o,s,a,h,u,p,d),m={u_height_factor:-Math.pow(2,a.overscaledZ)/c.tileSize/8};return t.extend(f,Li(l,i,c),m)},Oi=t=>({u_matrix:t}),Ui=(e,i,r,n)=>t.extend(Oi(e),Li(r,i,n)),Vi=(t,e)=>({u_matrix:t,u_world:e}),ji=(e,i,r,n,o)=>t.extend(Ui(e,i,r,n),{u_world:o}),Ni=t.create(),Gi=(e,i,r,n,o,s)=>{const a=e.transform,l="globe"===a.projection.name;let c;if("map"===s.paint.get("circle-pitch-alignment"))if(l){const e=t.globePixelsToTileUnits(a.zoom,i.canonical)*a._pixelsPerMercatorPixel;c=Float32Array.from([e,0,0,e])}else c=a.calculatePixelsToTileUnitsMatrix(r);else c=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const h={u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:e.translatePosMatrix(i.projMatrix,r,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:t.exported.devicePixelRatio,u_extrude_scale:c,u_inv_rot_matrix:Ni,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){h.u_inv_rot_matrix=n,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],h.u_zoom_transition=t.globeToMercatorTransition(a.zoom);const e=o[0]*t.EXTENT,r=o[1]*t.EXTENT;h.u_up_dir=a.projection.upVector(new t.CanonicalTileID(0,0,0),e,r)}return h},Zi=t=>{const e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e},qi=(e,i,r,n)=>{const o=t.EXTENT/r.tileSize;return{u_matrix:e,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},Wi=function(t,e){return{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:arguments.length>2&&void 0!==arguments[2]?arguments[2]:1}},Xi=t.create(),Hi=(e,i,r,n,o,s,a)=>{const l=e.transform,c="globe"===l.projection.name,h=c?t.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:D(r,1,s),u={u_matrix:i.projMatrix,u_extrude_scale:h,u_intensity:a,u_inv_rot_matrix:Xi,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){u.u_inv_rot_matrix=n,u.u_merc_center=o,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=t.globeToMercatorTransition(l.zoom);const e=o[0]*t.EXTENT,r=o[1]*t.EXTENT;u.u_up_dir=l.projection.upVector(new t.CanonicalTileID(0,0,0),e,r)}return u},Yi=(t,e,i,r,n,o,s,a)=>{const l=t.transform,c=l.calculatePixelsToTileUnitsMatrix(e),h={u_matrix:Qi(t,e,i,n),u_pixels_to_tile_units:c,u_device_pixel_ratio:s,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0,u_trim_offset:a};if($i(i)){const i=Ji(e,t.transform);h.u_texsize=e.lineAtlasTexture.size,h.u_scale=[i,r.fromScale,r.toScale],h.u_mix=r.t}return h},Ki=(t,e,i,r,n,o)=>{const s=t.transform,a=Ji(e,s);return{u_matrix:Qi(t,e,i,n),u_texsize:e.imageAtlasTexture.size,u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:o,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Ji(t,e){return 1/D(t,1,e.tileZoom)}function Qi(t,e,i,r){return t.translatePosMatrix(r||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function $i(t){const e=t.paint.get("line-dasharray").value;return e.value||"constant"!==e.kind}const tr=(t,e,i,r,n,o)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(a=n.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(s=n.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:er(n.paint.get("raster-hue-rotate")),u_perspective_transform:o};var s,a};function er(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const ir=t.create(),rr=(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_)=>{const g=o.transform,y={u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:g.cameraToCenterDistance,u_rotate_symbol:+r,u_aspect_ratio:g.width/g.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+n,u_texsize:h,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ir,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:ir,u_up_vector:[0,-1,0]};return"globe"===_.name&&(y.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],y.u_zoom_transition=p,y.u_inv_rot_matrix=f,y.u_merc_center=d,y.u_camera_forward=g._camera.forward(),y.u_ecef_origin=t.globeECEFOrigin(g.globeMatrix,u.toUnwrapped()),y.u_tile_matrix=Float32Array.from(g.globeMatrix),y.u_up_vector=m),y},nr=(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_,g)=>t.extend(rr(e,i,r,n,o,s,a,l,c,h,p,d,f,m,_,g),{u_gamma_scale:n?o.transform.cameraToCenterDistance*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:t.exported.devicePixelRatio,u_is_halo:+u}),or=(e,i,r,n,o,s,a,l,c,h,u,p,d,f,m,_)=>t.extend(nr(e,i,r,n,o,s,a,l,!0,c,!0,u,p,d,f,m,_),{u_texsize_icon:h,u_texture_icon:1}),sr=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),ar=(e,i,r,n,o,s)=>t.extend(function(t,e,i,r){const n=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:s,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(r.tileID.canonical.x+r.tileID.wrap*l),u=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,a],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/D(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(n,s,r,o),{u_matrix:e,u_opacity:i}),lr={fillExtrusion:e=>({u_matrix:new t.UniformMatrix4f(e),u_lightpos:new t.Uniform3f(e),u_lightintensity:new t.Uniform1f(e),u_lightcolor:new t.Uniform3f(e),u_vertical_gradient:new t.Uniform1f(e),u_opacity:new t.Uniform1f(e),u_edge_radius:new t.Uniform1f(e),u_ao:new t.Uniform2f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_up_dir:new t.Uniform3f(e),u_height_lift:new t.Uniform1f(e)}),fillExtrusionPattern:e=>({u_matrix:new t.UniformMatrix4f(e),u_lightpos:new t.Uniform3f(e),u_lightintensity:new t.Uniform1f(e),u_lightcolor:new t.Uniform3f(e),u_vertical_gradient:new t.Uniform1f(e),u_height_factor:new t.Uniform1f(e),u_edge_radius:new t.Uniform1f(e),u_ao:new t.Uniform2f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_up_dir:new t.Uniform3f(e),u_height_lift:new t.Uniform1f(e),u_image:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_pixel_coord_upper:new t.Uniform2f(e),u_pixel_coord_lower:new t.Uniform2f(e),u_scale:new t.Uniform3f(e),u_fade:new t.Uniform1f(e),u_opacity:new t.Uniform1f(e)}),fill:e=>({u_matrix:new t.UniformMatrix4f(e)}),fillPattern:e=>({u_matrix:new t.UniformMatrix4f(e),u_image:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_pixel_coord_upper:new t.Uniform2f(e),u_pixel_coord_lower:new t.Uniform2f(e),u_scale:new t.Uniform3f(e),u_fade:new t.Uniform1f(e)}),fillOutline:e=>({u_matrix:new t.UniformMatrix4f(e),u_world:new t.Uniform2f(e)}),fillOutlinePattern:e=>({u_matrix:new t.UniformMatrix4f(e),u_world:new t.Uniform2f(e),u_image:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_pixel_coord_upper:new t.Uniform2f(e),u_pixel_coord_lower:new t.Uniform2f(e),u_scale:new t.Uniform3f(e),u_fade:new t.Uniform1f(e)}),circle:e=>({u_camera_to_center_distance:new t.Uniform1f(e),u_extrude_scale:new t.UniformMatrix2f(e),u_device_pixel_ratio:new t.Uniform1f(e),u_matrix:new t.UniformMatrix4f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_up_dir:new t.Uniform3f(e)}),collisionBox:e=>({u_matrix:new t.UniformMatrix4f(e),u_camera_to_center_distance:new t.Uniform1f(e),u_extrude_scale:new t.Uniform2f(e)}),collisionCircle:e=>({u_matrix:new t.UniformMatrix4f(e),u_inv_matrix:new t.UniformMatrix4f(e),u_camera_to_center_distance:new t.Uniform1f(e),u_viewport_size:new t.Uniform2f(e)}),debug:e=>({u_color:new t.UniformColor(e),u_matrix:new t.UniformMatrix4f(e),u_overlay:new t.Uniform1i(e),u_overlay_scale:new t.Uniform1f(e)}),clippingMask:e=>({u_matrix:new t.UniformMatrix4f(e)}),heatmap:e=>({u_extrude_scale:new t.Uniform1f(e),u_intensity:new t.Uniform1f(e),u_matrix:new t.UniformMatrix4f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_up_dir:new t.Uniform3f(e)}),heatmapTexture:e=>({u_image:new t.Uniform1i(e),u_color_ramp:new t.Uniform1i(e),u_opacity:new t.Uniform1f(e)}),hillshade:e=>({u_matrix:new t.UniformMatrix4f(e),u_image:new t.Uniform1i(e),u_latrange:new t.Uniform2f(e),u_light:new t.Uniform2f(e),u_shadow:new t.UniformColor(e),u_highlight:new t.UniformColor(e),u_accent:new t.UniformColor(e)}),hillshadePrepare:e=>({u_matrix:new t.UniformMatrix4f(e),u_image:new t.Uniform1i(e),u_dimension:new t.Uniform2f(e),u_zoom:new t.Uniform1f(e),u_unpack:new t.Uniform4f(e)}),line:e=>({u_matrix:new t.UniformMatrix4f(e),u_pixels_to_tile_units:new t.UniformMatrix2f(e),u_device_pixel_ratio:new t.Uniform1f(e),u_units_to_pixels:new t.Uniform2f(e),u_dash_image:new t.Uniform1i(e),u_gradient_image:new t.Uniform1i(e),u_image_height:new t.Uniform1f(e),u_texsize:new t.Uniform2f(e),u_scale:new t.Uniform3f(e),u_mix:new t.Uniform1f(e),u_alpha_discard_threshold:new t.Uniform1f(e),u_trim_offset:new t.Uniform2f(e)}),linePattern:e=>({u_matrix:new t.UniformMatrix4f(e),u_texsize:new t.Uniform2f(e),u_pixels_to_tile_units:new t.UniformMatrix2f(e),u_device_pixel_ratio:new t.Uniform1f(e),u_image:new t.Uniform1i(e),u_units_to_pixels:new t.Uniform2f(e),u_scale:new t.Uniform3f(e),u_fade:new t.Uniform1f(e),u_alpha_discard_threshold:new t.Uniform1f(e)}),raster:e=>({u_matrix:new t.UniformMatrix4f(e),u_tl_parent:new t.Uniform2f(e),u_scale_parent:new t.Uniform1f(e),u_fade_t:new t.Uniform1f(e),u_opacity:new t.Uniform1f(e),u_image0:new t.Uniform1i(e),u_image1:new t.Uniform1i(e),u_brightness_low:new t.Uniform1f(e),u_brightness_high:new t.Uniform1f(e),u_saturation_factor:new t.Uniform1f(e),u_contrast_factor:new t.Uniform1f(e),u_spin_weights:new t.Uniform3f(e),u_perspective_transform:new t.Uniform2f(e)}),symbolIcon:e=>({u_is_size_zoom_constant:new t.Uniform1i(e),u_is_size_feature_constant:new t.Uniform1i(e),u_size_t:new t.Uniform1f(e),u_size:new t.Uniform1f(e),u_camera_to_center_distance:new t.Uniform1f(e),u_rotate_symbol:new t.Uniform1i(e),u_aspect_ratio:new t.Uniform1f(e),u_fade_change:new t.Uniform1f(e),u_matrix:new t.UniformMatrix4f(e),u_label_plane_matrix:new t.UniformMatrix4f(e),u_coord_matrix:new t.UniformMatrix4f(e),u_is_text:new t.Uniform1i(e),u_pitch_with_map:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_camera_forward:new t.Uniform3f(e),u_tile_matrix:new t.UniformMatrix4f(e),u_up_vector:new t.Uniform3f(e),u_ecef_origin:new t.Uniform3f(e),u_texture:new t.Uniform1i(e)}),symbolSDF:e=>({u_is_size_zoom_constant:new t.Uniform1i(e),u_is_size_feature_constant:new t.Uniform1i(e),u_size_t:new t.Uniform1f(e),u_size:new t.Uniform1f(e),u_camera_to_center_distance:new t.Uniform1f(e),u_rotate_symbol:new t.Uniform1i(e),u_aspect_ratio:new t.Uniform1f(e),u_fade_change:new t.Uniform1f(e),u_matrix:new t.UniformMatrix4f(e),u_label_plane_matrix:new t.UniformMatrix4f(e),u_coord_matrix:new t.UniformMatrix4f(e),u_is_text:new t.Uniform1i(e),u_pitch_with_map:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_texture:new t.Uniform1i(e),u_gamma_scale:new t.Uniform1f(e),u_device_pixel_ratio:new t.Uniform1f(e),u_tile_id:new t.Uniform3f(e),u_zoom_transition:new t.Uniform1f(e),u_inv_rot_matrix:new t.UniformMatrix4f(e),u_merc_center:new t.Uniform2f(e),u_camera_forward:new t.Uniform3f(e),u_tile_matrix:new t.UniformMatrix4f(e),u_up_vector:new t.Uniform3f(e),u_ecef_origin:new t.Uniform3f(e),u_is_halo:new t.Uniform1i(e)}),symbolTextAndIcon:e=>({u_is_size_zoom_constant:new t.Uniform1i(e),u_is_size_feature_constant:new t.Uniform1i(e),u_size_t:new t.Uniform1f(e),u_size:new t.Uniform1f(e),u_camera_to_center_distance:new t.Uniform1f(e),u_rotate_symbol:new t.Uniform1i(e),u_aspect_ratio:new t.Uniform1f(e),u_fade_change:new t.Uniform1f(e),u_matrix:new t.UniformMatrix4f(e),u_label_plane_matrix:new t.UniformMatrix4f(e),u_coord_matrix:new t.UniformMatrix4f(e),u_is_text:new t.Uniform1i(e),u_pitch_with_map:new t.Uniform1i(e),u_texsize:new t.Uniform2f(e),u_texsize_icon:new t.Uniform2f(e),u_texture:new t.Uniform1i(e),u_texture_icon:new t.Uniform1i(e),u_gamma_scale:new t.Uniform1f(e),u_device_pixel_ratio:new t.Uniform1f(e),u_is_halo:new t.Uniform1i(e)}),background:e=>({u_matrix:new t.UniformMatrix4f(e),u_opacity:new t.Uniform1f(e),u_color:new t.UniformColor(e)}),backgroundPattern:e=>({u_matrix:new t.UniformMatrix4f(e),u_opacity:new t.Uniform1f(e),u_image:new t.Uniform1i(e),u_pattern_tl_a:new t.Uniform2f(e),u_pattern_br_a:new t.Uniform2f(e),u_pattern_tl_b:new t.Uniform2f(e),u_pattern_br_b:new t.Uniform2f(e),u_texsize:new t.Uniform2f(e),u_mix:new t.Uniform1f(e),u_pattern_size_a:new t.Uniform2f(e),u_pattern_size_b:new t.Uniform2f(e),u_scale_a:new t.Uniform1f(e),u_scale_b:new t.Uniform1f(e),u_pixel_coord_upper:new t.Uniform2f(e),u_pixel_coord_lower:new t.Uniform2f(e),u_tile_units_to_pixels:new t.Uniform1f(e)}),terrainRaster:vi,terrainDepth:vi,skybox:e=>({u_matrix:new t.UniformMatrix4f(e),u_sun_direction:new t.Uniform3f(e),u_cubemap:new t.Uniform1i(e),u_opacity:new t.Uniform1f(e),u_temporal_offset:new t.Uniform1f(e)}),skyboxGradient:e=>({u_matrix:new t.UniformMatrix4f(e),u_color_ramp:new t.Uniform1i(e),u_center_direction:new t.Uniform3f(e),u_radius:new t.Uniform1f(e),u_opacity:new t.Uniform1f(e),u_temporal_offset:new t.Uniform1f(e)}),skyboxCapture:e=>({u_matrix_3f:new t.UniformMatrix3f(e),u_sun_direction:new t.Uniform3f(e),u_sun_intensity:new t.Uniform1f(e),u_color_tint_r:new t.Uniform4f(e),u_color_tint_m:new t.Uniform4f(e),u_luminance:new t.Uniform1f(e)}),globeRaster:e=>({u_proj_matrix:new t.UniformMatrix4f(e),u_globe_matrix:new t.UniformMatrix4f(e),u_normalize_matrix:new t.UniformMatrix4f(e),u_merc_matrix:new t.UniformMatrix4f(e),u_zoom_transition:new t.Uniform1f(e),u_merc_center:new t.Uniform2f(e),u_image0:new t.Uniform1i(e),u_grid_matrix:new t.UniformMatrix3f(e),u_frustum_tl:new t.Uniform3f(e),u_frustum_tr:new t.Uniform3f(e),u_frustum_br:new t.Uniform3f(e),u_frustum_bl:new t.Uniform3f(e),u_globe_pos:new t.Uniform3f(e),u_globe_radius:new t.Uniform1f(e),u_viewport:new t.Uniform2f(e)}),globeAtmosphere:e=>({u_frustum_tl:new t.Uniform3f(e),u_frustum_tr:new t.Uniform3f(e),u_frustum_br:new t.Uniform3f(e),u_frustum_bl:new t.Uniform3f(e),u_horizon:new t.Uniform1f(e),u_transition:new t.Uniform1f(e),u_fadeout_range:new t.Uniform1f(e),u_color:new t.Uniform4f(e),u_high_color:new t.Uniform4f(e),u_space_color:new t.Uniform4f(e),u_star_intensity:new t.Uniform1f(e),u_star_density:new t.Uniform1f(e),u_star_size:new t.Uniform1f(e),u_temporal_offset:new t.Uniform1f(e),u_horizon_angle:new t.Uniform1f(e),u_rotation_matrix:new t.UniformMatrix4f(e)})};let cr;function hr(e,i,r,n,o,s,a){const l=e.context,c=l.gl,h=e.transform,u=e.useProgram("collisionBox"),p=[];let d=0,f=0;for(let b=0;b<n.length;b++){const m=n[b],_=i.getTile(m),g=_.getBucket(r);if(!g)continue;const y=be(m,g,h);let x=y;0===o[0]&&0===o[1]||(x=e.translatePosMatrix(y,_,o,s));const v=a?g.textCollisionBox:g.iconCollisionBox,w=g.collisionCircleArray;if(w.length>0){const e=t.create(),i=x;t.mul(e,g.placementInvProjMatrix,h.glCoordMatrix),t.mul(e,e,g.placementViewportMatrix),p.push({circleArray:w,circleOffset:f,transform:i,invTransform:e,projection:g.getProjection()}),d+=w.length/4,f=d}v&&(e.terrain&&e.terrain.setupElevationDraw(_,u),u.draw(l,c.LINES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,qi(x,h,_,g.getProjection()),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,h.zoom,null,[v.collisionVertexBuffer,v.collisionVertexBufferExt]))}if(!a||!p.length)return;const m=e.useProgram("collisionCircle"),_=new t.StructArrayLayout2f1f2i16;_.resize(4*d),_._trim();let g=0;for(const t of p)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,r=t.circleArray[i+0],n=t.circleArray[i+1],o=t.circleArray[i+2],s=t.circleArray[i+3];_.emplace(g++,r,n,o,s,0),_.emplace(g++,r,n,o,s,1),_.emplace(g++,r,n,o,s,2),_.emplace(g++,r,n,o,s,3)}(!cr||cr.length<2*d)&&(cr=function(e){const i=2*e,r=new t.StructArrayLayout3ui6;r.resize(i),r._trim();for(let t=0;t<i;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(d));const y=l.createIndexBuffer(cr,!0),x=l.createVertexBuffer(_,t.collisionCircleLayout.members,!0);for(const b of p){const i={u_matrix:b.transform,u_inv_matrix:b.invTransform,u_camera_to_center_distance:(v=h).getCameraToCenterDistance(b.projection),u_viewport_size:[v.width,v.height]};m.draw(l,c.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,i,r.id,x,y,t.SegmentVector.simpleSegment(0,2*b.circleOffset,b.circleArray.length,b.circleArray.length/2),null,h.zoom)}var v;x.destroy(),y.destroy()}const ur=t.create();function pr(e,i,r,n,o,s){const{horizontalAlign:a,verticalAlign:l}=t.getAnchorAlignment(e),c=-(a-.5)*i,h=-(l-.5)*r,u=t.evaluateVariableOffset(e,n);return new t.pointGeometry((c/o+u[0])*s,(h/o+u[1])*s)}function dr(e,i,r,n,o,s,a,l,c,h,u){const p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,m={},_=we(l,e.getProjection(),s),g=s.elevation,y=e.getProjection().upVectorScale(l.canonical,s.center.lat,s.worldSize);d.clear();for(let x=0;x<p.length;x++){const f=p.get(x),v=e.allowVerticalPlacement&&!f.placedOrientation,b=f.hidden||!f.crossTileID||v?null:n[f.crossTileID];if(b){const n=new t.pointGeometry(f.tileAnchorX,f.tileAnchorY),p=e.getProjection().upVector(l.canonical,n.x,n.y),x=g?g.getAtTileOffset(l,n.x,n.y):0,v=oe([f.projectedAnchorX+x*p[0]*y.metersToTile,f.projectedAnchorY+x*p[1]*y.metersToTile,f.projectedAnchorZ+x*p[2]*y.metersToTile],r?_:a),w=se(s.getCameraToCenterDistance(e.getProjection()),v.signedDistanceFromCamera);let T=o.evaluateSizeForFeature(e.textSizeData,h,f)*w/t.ONE_EM;r&&(T*=e.tilePixelRatio/c);const{width:E,height:S,anchor:A,textOffset:M,textScale:I}=b,C=pr(A,E,S,M,I,T);let z;if(r){const t=n.add(C),{x:i,y:r,z:o}=e.getProjection().projectTilePoint(t.x,t.y,l.canonical);z=oe([i+x*p[0]*y.metersToTile,r+x*p[1]*y.metersToTile,o+x*p[2]*y.metersToTile],a).point}else{const t=i?C.rotate(-s.angle):C;z=[v.point[0]+t.x,v.point[1]+t.y,0]}const P=e.allowVerticalPlacement&&f.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<f.numGlyphs;e++)t.addDynamicAttributes(d,z[0],z[1],z[2],P);u&&f.associatedIconIndex>=0&&(m[f.associatedIconIndex]={shiftedAnchor:z,angle:P})}else _e(f.numGlyphs,d)}if(u){f.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const r=i.get(e);if(r.hidden)_e(r.numGlyphs,f);else{const i=m[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.addDynamicAttributes(f,i.shiftedAnchor[0],i.shiftedAnchor[1],i.shiftedAnchor[2],i.angle);else _e(r.numGlyphs,f)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function fr(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function mr(e,i,r,n,o,s,a,l,c,h,u,p){const d=e.context,f=d.gl,m=e.transform,_="map"===l,g="map"===c,y=_&&"point"!==r.layout.get("symbol-placement"),x=_&&!g&&!y,v=void 0!==r.layout.get("symbol-sort-key").constantOr(1);let b=!1;const w=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),T=[t.mercatorXfromLng(m.center.lng),t.mercatorYfromLat(m.center.lat)],E=r.layout.get("text-variable-anchor"),S="globe"===m.projection.name,A=[],M=[0,-1,0];let I=M;!S&&!m.mercatorFromTransition||_||(I=function(e){const i=e._camera.getWorldToCamera(e.worldSize,1),r=t.multiply([],i,e.globeMatrix);t.invert(r,r);const n=[0,0,0],o=[0,1,0,0];return t.transformMat4$1(o,o,r),n[0]=o[0],n[1]=o[1],n[2]=o[2],t.normalize(n,n),n}(m));for(const C of n){const n=i.getTile(C),l=n.getBucket(r);if(!l)continue;if("mercator"===l.projection.name&&S)continue;const c=o?l.text:l.icon;if(!c||l.fullyClipped||!c.segments.get().length)continue;const u=c.programConfigurations.get(r.id),p=o||l.sdfIcons,d=o?l.textSizeData:l.iconSizeData,w=g||0!==m.pitch,z=t.evaluateSizeForZoom(d,m.zoom);let P,k,D,L,B=[0,0],R=null;if(o){if(k=n.glyphAtlasTexture,D=f.LINEAR,P=n.glyphAtlasTexture.size,l.iconsInText){B=n.imageAtlasTexture.size,R=n.imageAtlasTexture;const t="composite"===d.kind||"camera"===d.kind;L=w||e.options.rotating||e.options.zooming||t?f.LINEAR:f.NEAREST}}else{const t=1!==r.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;k=n.imageAtlasTexture,D=p||e.options.rotating||e.options.zooming||t||w?f.LINEAR:f.NEAREST,P=n.imageAtlasTexture.size}const F="globe"===l.projection.name,O=F?I:M,U=F?t.globeToMercatorTransition(m.zoom):0,V=we(C,l.getProjection(),m),j=m.calculatePixelsToTileUnitsMatrix(n),N=ee(V,n.tileID.canonical,g,_,m,l.getProjection(),j),G=e.terrain&&g&&y?t.invert(t.create(),N):ur,Z=re(V,n.tileID.canonical,g,_,m,l.getProjection(),j),q=E&&l.hasTextData(),W="none"!==r.layout.get("icon-text-fit")&&q&&l.hasIconData();if(y){const t=m.elevation,i=t?t.getAtTileOffsetFunc(C,m.center.lat,m.worldSize,l.getProjection()):t=>[0,0,0],r=ie(V,n.tileID.canonical,g,_,m,l.getProjection(),j);le(l,V,e,o,r,Z,g,h,i,C)}const X=y||o&&E||W,H=e.translatePosMatrix(V,n,s,a),Y=X?ur:N,K=e.translatePosMatrix(Z,n,s,a,!0),J=l.getProjection().createInversionMatrix(m,C.canonical),Q=[];e.terrain&&g&&Q.push("PITCH_WITH_MAP_TERRAIN"),F&&Q.push("PROJECTION_GLOBE_VIEW"),X&&Q.push("PROJECTED_POS_ON_VIEWPORT");const $=p&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let tt;tt=p?l.iconsInText?or(d.kind,z,x,g,e,H,Y,K,P,B,C,U,T,J,O,l.getProjection()):nr(d.kind,z,x,g,e,H,Y,K,o,P,!0,C,U,T,J,O,l.getProjection()):rr(d.kind,z,x,g,e,H,Y,K,o,P,C,U,T,J,O,l.getProjection());const et={program:e.useProgram(fr(p,o,l),u,Q),buffers:c,uniformValues:tt,atlasTexture:k,atlasTextureIcon:R,atlasInterpolation:D,atlasInterpolationIcon:L,isSDF:p,hasHalo:$,tile:n,labelPlaneMatrixInv:G};if(v&&l.canOverlap){b=!0;const e=c.segments.get();for(const i of e)A.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:et})}else A.push({segments:c.segments,sortKey:0,state:et})}b&&A.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of A){const i=t.state;if(e.terrain&&e.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:!S,labelPlaneMatrixInv:i.labelPlaneMatrixInv}),d.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,_r(i.buffers,t.segments,r,e,i.program,w,u,p,n)),n.u_is_halo=0}_r(i.buffers,t.segments,r,e,i.program,w,u,p,i.uniformValues)}}function _r(e,i,r,n,o,s,a,l,c){const h=n.context,u=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.globeExtVertexBuffer];o.draw(h,h.gl.TRIANGLES,s,a,l,t.CullFaceMode.disabled,c,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,n.transform.zoom,e.programConfigurations.get(r.id),u)}function gr(e,i,r,n,o,s,a){const l=e.context.gl,c=r.paint.get("fill-pattern"),h=c&&c.constantOr(1),u=r.getCrossfadeParameters();let p,d,f,m,_;a?(d=h&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=l.LINES):(d=h?"fillPattern":"fill",p=l.TRIANGLES);for(const g of n){const n=i.getTile(g);if(h&&!n.patternsLoaded())continue;const y=n.getBucket(r);if(!y)continue;e.prepareDrawTile();const x=y.programConfigurations.get(r.id),v=e.useProgram(d,x);h&&(e.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),x.updatePaintBuffers(u));const b=c.constantOr(null);if(b&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[b.to.toString()],i=t.patternPositions[b.from.toString()];e&&i&&x.setConstantPatternPositions(e,i)}const w=e.translatePosMatrix(g.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(a){m=y.indexBuffer2,_=y.segments2;const t=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];f="fillOutlinePattern"===d&&h?ji(w,e,u,n,t):Vi(w,t)}else m=y.indexBuffer,_=y.segments,f=h?Ui(w,e,u,n):Oi(w);e.prepareDrawProgram(e.context,v,g.toUnwrapped()),v.draw(e.context,p,o,e.stencilModeForClipping(g),s,t.CullFaceMode.disabled,f,r.id,y.layoutVertexBuffer,m,_,r.paint,e.transform.zoom,x)}}function yr(e,i,r,n,o,s,a){const l=e.context,c=l.gl,h=e.transform,u=r.paint.get("fill-extrusion-pattern"),p=u.constantOr(1),d=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),m=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),r.paint.get("fill-extrusion-ambient-occlusion-radius")],_=r.layout.get("fill-extrusion-edge-radius"),g="globe"===h.projection.name?t.fillExtrusionHeightLift():0,y="globe"===h.projection.name,x=y?t.globeToMercatorTransition(h.zoom):0,v=[t.mercatorXfromLng(h.center.lng),t.mercatorYfromLat(h.center.lat)],b=[];y&&(b.push("PROJECTION_GLOBE_VIEW"),e.style.terrainSetForDrapingOnly()&&b.push("TERRAIN")),m[0]>0&&b.push("FAUX_AO");for(const w of n){const n=i.getTile(w),T=n.getBucket(r);if(!T||T.projection.name!==h.projection.name)continue;const E=T.programConfigurations.get(r.id),S=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",E,b);if(e.terrain){const t=e.terrain;if(e.style.terrainSetForDrapingOnly())t.setupElevationDraw(n,S,{useMeterToDem:!0});else{if(!T.enableTerrain)continue;if(t.setupElevationDraw(n,S,{useMeterToDem:!0}),xr(l,i,w,T,r,t),!T.centroidVertexBuffer){const t=S.attributes.a_centroid_pos;void 0!==t&&c.vertexAttrib2f(t,0,0)}}}p&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),E.updatePaintBuffers(d));const A=u.constantOr(null);if(A&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[A.to.toString()],i=t.patternPositions[A.from.toString()];e&&i&&E.setConstantPatternPositions(e,i)}const M=e.translatePosMatrix(w.projMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),I=h.projection.createInversionMatrix(h,w.canonical),C=r.paint.get("fill-extrusion-vertical-gradient"),z=p?Fi(M,e,C,f,m,_,w,d,n,g,x,v,I):Ri(M,e,C,f,m,_,w,g,x,v,I);e.prepareDrawProgram(l,S,w.toUnwrapped());const P=[];e.terrain&&P.push(T.centroidVertexBuffer),y&&P.push(T.layoutVertexExtBuffer),S.draw(l,l.gl.TRIANGLES,o,s,a,t.CullFaceMode.backCCW,z,r.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,r.paint,e.transform.zoom,E,P)}}function xr(e,i,r,n,o,s){const a=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new t.OverscaledTileID(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 t.OverscaledTileID(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new t.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)],l=t=>{const e=i.getSource().minzoom,r=t=>{const e=i.getTileByID(t);if(e&&e.hasData())return e.getBucket(o)},n=[0,-1,1];for(const i of n){if(t.overscaledZ+i<e)continue;const n=r(t.calculateScaledKey(t.overscaledZ+i));if(n)return n}},c=[0,0,0],h=(e,i)=>(c[0]=Math.min(e.min.y,i.min.y),c[1]=Math.max(e.max.y,i.max.y),c[2]=t.EXTENT-i.min.x>e.max.x?i.min.x-t.EXTENT:e.max.x,c),u=(e,i)=>(c[0]=Math.min(e.min.x,i.min.x),c[1]=Math.max(e.max.x,i.max.x),c[2]=t.EXTENT-i.min.y>e.max.y?i.min.y-t.EXTENT:e.max.y,c),p=[(t,e)=>h(t,e),(t,e)=>h(e,t),(t,e)=>u(t,e),(t,e)=>u(e,t)],d=new t.pointGeometry(0,0);let f,m,_;const g=(e,i,n,o,a)=>{const l=[[o?n:e,o?e:n,0],[o?n:i,o?i:n,0]],c=a<0?t.EXTENT+a:a,h=[o?c:(e+i)/2,o?(e+i)/2:c,0];return 0===n&&a<0||0!==n&&a>0?s.getForTilePoints(_,[h],!0,m):l.push(h),s.getForTilePoints(r,l,!0,f),Math.max(l[0][2],l[1][2],h[2])/s.exaggeration()};for(let y=0;y<4;y++){const e=(y<2?1:5)-y,i=n.borders[y];if(0===i.length)continue;const o=_=a[y](r),c=l(o);if(!(c&&c instanceof t.FillExtrusionBucket&&c.enableTerrain))continue;if(n.borderDoneWithNeighborZ[y]===c.canonical.z&&c.borderDoneWithNeighborZ[e]===n.canonical.z)continue;if(m=s.findDEMTileFor(o),!m||!m.dem)continue;if(!f){const t=s.findDEMTileFor(r);if(!t||!t.dem)return;f=t}const h=c.borders[e];let u=0;const x=c.borderDoneWithNeighborZ[e]!==n.canonical.z;if(n.canonical.z===c.canonical.z){for(let r=0;r<i.length;r++){const o=n.featuresOnBorder[i[r]],s=o.borders[y];let a;for(;u<h.length&&(a=c.featuresOnBorder[h[u]],!(a.borders[e][1]>s[0]+3));)x&&c.encodeCentroid(void 0,a,!1),u++;if(a&&u<h.length){const i=u;let r=0;for(;!(a.borders[e][0]>s[1]-3)&&(r++,++u!==h.length);)a=c.featuresOnBorder[h[u]];if(a=c.featuresOnBorder[h[i]],o.intersectsCount()>1||a.intersectsCount()>1||1!==r){1!==r&&(u=i),n.encodeCentroid(void 0,o,!1),x&&c.encodeCentroid(void 0,a,!1);continue}const l=p[y](o,a),f=y%2?t.EXTENT-1:0;d.x=g(l[0],Math.min(t.EXTENT-1,l[1]),f,y<2,l[2]),d.y=0,n.encodeCentroid(d,o,!1),x&&c.encodeCentroid(d,a,!1)}else n.encodeCentroid(void 0,o,!1)}n.borderDoneWithNeighborZ[y]=c.canonical.z,n.needsCentroidUpdate=!0,x&&(c.borderDoneWithNeighborZ[e]=n.canonical.z,c.needsCentroidUpdate=!0)}else{for(const t of i)n.encodeCentroid(void 0,n.featuresOnBorder[t],!1);if(x){for(const t of h)c.encodeCentroid(void 0,c.featuresOnBorder[t],!1);c.borderDoneWithNeighborZ[e]=n.canonical.z,c.needsCentroidUpdate=!0}n.borderDoneWithNeighborZ[y]=c.canonical.z,n.needsCentroidUpdate=!0}}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(e)}const vr=new t.Color(1,0,0,1),br=new t.Color(0,1,0,1),wr=new t.Color(0,0,1,1),Tr=new t.Color(1,0,1,1),Er=new t.Color(0,1,1,1);function Sr(e,i,r){const n=e.context,o=e.transform,s=n.gl,a="globe"===o.projection.name,l=a?["PROJECTION_GLOBE_VIEW"]:null;
1let c=r.projMatrix;if(a&&t.globeToMercatorTransition(o.zoom)>0){const e=t.transitionTileAABBinECEF(r.canonical,o),i=t.globeDenormalizeECEF(e);c=t.multiply(new Float32Array(16),o.globeMatrix,i),t.multiply(c,o.projMatrix,c)}const h=e.useProgram("debug",null,l),u=i.getTileByID(r.key);e.terrain&&e.terrain.setupElevationDraw(u,h);const p=t.DepthMode.disabled,d=t.StencilMode.disabled,f=e.colorModeForRenderPass(),m="$debug";n.activeTexture.set(s.TEXTURE0),e.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a?u._makeGlobeTileDebugBuffers(e.context,o):u._makeDebugTileBoundsBuffers(e.context,o.projection);const _=u._tileDebugBuffer||e.debugBuffer,g=u._tileDebugIndexBuffer||e.debugIndexBuffer,y=u._tileDebugSegments||e.debugSegments;h.draw(n,s.LINE_STRIP,p,d,f,t.CullFaceMode.disabled,Wi(c,t.Color.red),m,_,g,y,null,null,null,[u._globeTileDebugBorderBuffer]);const x=u.latestRawTileData,v=Math.floor((x&&x.byteLength||0)/1024),b=i.getTile(r).tileSize,w=512/Math.min(b,512)*(r.overscaledZ/o.zoom)*.5;let T=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(T+=" => ".concat(r.overscaledZ)),T+=" ".concat(v,"kb"),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.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(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,T);const E=u._tileDebugTextBuffer||e.debugBuffer,S=u._tileDebugTextIndexBuffer||e.quadTriangleIndexBuffer,A=u._tileDebugTextSegments||e.debugSegments;h.draw(n,s.TRIANGLES,p,d,t.ColorMode.alphaBlended,t.CullFaceMode.disabled,Wi(c,t.Color.transparent,w),m,E,S,A,null,null,null,[u._globeTileDebugTextBuffer])}function Ar(t,e,i,r){Ir(t,0,e+i/2,t.transform.width,i,r)}function Mr(t,e,i,r){Ir(t,e-i/2,0,i,t.transform.height,r)}function Ir(e,i,r,n,o,s){const a=e.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.exported.devicePixelRatio,r*t.exported.devicePixelRatio,n*t.exported.devicePixelRatio,o*t.exported.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Cr=t.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:zr}=Cr;function Pr(t,e,i,r){t.emplaceBack(e,i,r)}class kr{constructor(e){this.vertexArray=new t.StructArrayLayout3f12,this.indices=new t.StructArrayLayout3ui6,Pr(this.vertexArray,-1,-1,1),Pr(this.vertexArray,1,-1,1),Pr(this.vertexArray,-1,1,1),Pr(this.vertexArray,1,1,1),Pr(this.vertexArray,-1,-1,-1),Pr(this.vertexArray,1,-1,-1),Pr(this.vertexArray,-1,1,-1),Pr(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=e.createVertexBuffer(this.vertexArray,zr),this.indexBuffer=e.createIndexBuffer(this.indices),this.segment=t.SegmentVector.simpleSegment(0,0,36,12)}}function Dr(e,i,r,n,o,s){const a=e.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),h=i.paint.get("sky-atmosphere-sun-intensity"),u=((t,e,i,r,n)=>({u_matrix_3f:t,u_sun_direction:e,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(t.fromMat4(t.create$1(),n),o,h,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),r.draw(e,a.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,t.ColorMode.unblended,t.CullFaceMode.frontCW,u,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const Lr=t.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Br{constructor(e){const i=new t.StructArrayLayout5f20;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new t.StructArrayLayout3ui6;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=e.createVertexBuffer(i,Lr.members),this.indexBuffer=e.createIndexBuffer(r),this.segments=t.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Rr={symbol:function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const s=t.StencilMode.disabled,a=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,i,r,n,o,s,a){const l=i.transform,c="map"===o,h="map"===s;for(const u of e){const e=n.getTile(u),i=e.getBucket(r);
vendor: 41,647 bytes, line 1
1if(!i||!i.text||!i.text.segments.get().length)continue;const o=t.evaluateSizeForZoom(i.textSizeData,l.zoom),s=we(u,i.getProjection(),l),p=l.calculatePixelsToTileUnitsMatrix(e),d=ee(s,e.tileID.canonical,h,c,l,i.getProjection(),p),f="none"!==r.layout.get("icon-text-fit")&&i.hasIconData();if(o){const r=Math.pow(2,l.zoom-e.tileID.overscaledZ);dr(i,c,h,a,t.symbolSize,l,d,u,r,o,f)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&mr(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),s,a),0!==r.paint.get("text-opacity").constantOr(1)&&mr(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),s,a),i.map.showCollisionBoxes&&(hr(e,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),hr(e,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(e,i,r,n){if("translucent"!==e.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const c=e.context,h=c.gl,u=e.transform,p=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),d=t.StencilMode.disabled,f=e.colorModeForRenderPass(),m="globe"===u.projection.name,_=[t.mercatorXfromLng(u.center.lng),t.mercatorYfromLat(u.center.lat)],g=[];for(let x=0;x<n.length;x++){const o=n[x],s=i.getTile(o),a=s.getBucket(r);if(!a||a.projection.name!==u.projection.name)continue;const c=a.programConfigurations.get(r.id),h=Zi(r);m&&h.push("PROJECTION_GLOBE_VIEW");const p=e.useProgram("circle",c,h),d=a.layoutVertexBuffer,f=a.globeExtVertexBuffer,y=a.indexBuffer,v=u.projection.createInversionMatrix(u,o.canonical),b={programConfiguration:c,program:p,layoutVertexBuffer:d,globeExtVertexBuffer:f,indexBuffer:y,uniformValues:Gi(e,o,s,v,_,r),tile:s};if(l){const e=a.segments.get();for(const i of e)g.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:b})}else g.push({segments:a.segments,sortKey:0,state:b})}l&&g.sort(((t,e)=>t.sortKey-e.sortKey));const y={useDepthForOcclusion:!m};for(const x of g){const{programConfiguration:i,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:a,uniformValues:l,tile:m}=x.state,_=x.segments;e.terrain&&e.terrain.setupElevationDraw(m,n,y),e.prepareDrawProgram(c,n,m.tileID.toUnwrapped()),n.draw(c,h.TRIANGLES,p,d,f,t.CullFaceMode.disabled,l,r.id,o,a,_,r.paint,u.zoom,i,[s])}},heatmap:function(e,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,s=o.gl,a=t.StencilMode.disabled,l=new t.ColorMode([s.ONE,s.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i,r){const n=t.gl,o=e.width*r,s=e.height*r;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const e=n.createTexture();n.bindTexture(n.TEXTURE_2D,e),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.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),a=i.heatmapFbo=t.createFramebuffer(o,s,!1),function(t,e,i,r,n,o){const s=t.gl;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,n,o,0,s.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(t,0,e,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),t.bindFramebuffer.set(a.framebuffer)}(o,e,r,"globe"===e.transform.projection.name?.5:.25),o.clear({color:t.Color.transparent});const c=e.transform,h="globe"===c.projection.name,u=h?["PROJECTION_GLOBE_VIEW"]:null,p=h?t.CullFaceMode.frontCCW:t.CullFaceMode.disabled,d=[t.mercatorXfromLng(c.center.lng),t.mercatorYfromLat(c.center.lat)];for(let f=0;f<n.length;f++){const m=n[f];if(i.hasRenderableParent(m))continue;const _=i.getTile(m),g=_.getBucket(r);if(!g||g.projection.name!==c.projection.name)continue;const y=g.programConfigurations.get(r.id),x=e.useProgram("heatmap",y,u),{zoom:v}=e.transform;e.terrain&&e.terrain.setupElevationDraw(_,x),e.prepareDrawProgram(o,x,m.toUnwrapped());const b=c.projection.createInversionMatrix(c,m.canonical);x.draw(o,s.TRIANGLES,t.DepthMode.disabled,a,l,p,Hi(e,m,_,b,d,v,r.paint.get("heatmap-intensity")),r.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,r.paint,e.transform.zoom,y,h?[g.globeExtVertexBuffer]:null)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const r=e.context,n=r.gl,o=i.heatmapFbo;if(!o)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);let s=i.colorRampTexture;s||(s=i.colorRampTexture=new t.Texture(r,i.colorRamp,n.RGBA)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,t.DepthMode.disabled,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.disabled,((t,e,i,r)=>({u_image:0,u_color_ramp:1,u_opacity:e.paint.get("heatmap-opacity")}))(0,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,r))},line:function(e,i,r,n){if("translucent"!==e.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),l=e.colorModeForRenderPass(),c=e.terrain&&e.terrain.renderingToTexture?1:t.exported.devicePixelRatio,h=r.paint.get("line-dasharray"),u=h.constantOr(1),p=r.layout.get("line-cap"),d=r.paint.get("line-pattern"),f=d.constantOr(1),m=r.paint.get("line-gradient"),_=r.getCrossfadeParameters(),g=f?"linePattern":"line",y=e.context,x=y.gl,v=(t=>{const e=[];$i(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");0===i[0]&&0===i[1]||e.push("RENDER_LINE_TRIM_OFFSET");const r=t.paint.get("line-pattern").constantOr(1),n=1!==t.paint.get("line-opacity").constantOr(1);return!r&&n&&e.push("RENDER_LINE_ALPHA_DISCARD"),e})(r);let b=v.includes("RENDER_LINE_ALPHA_DISCARD");e.terrain&&e.terrain.clipOrMaskOverlapStencilType()&&(b=!1);for(const w of n){const n=i.getTile(w);if(f&&!n.patternsLoaded())continue;const o=n.getBucket(r);if(!o)continue;e.prepareDrawTile();const s=o.programConfigurations.get(r.id),T=e.useProgram(g,s,v),E=d.constantOr(null);if(E&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&s.setConstantPatternPositions(e,i)}const S=h.constantOr(null),A=p.constantOr(null);if(!f&&S&&A&&n.lineAtlas){const t=n.lineAtlas,e=t.getDash(S.to,A),i=t.getDash(S.from,A);e&&i&&s.setConstantPatternPositions(e,i)}let[M,I]=r.paint.get("line-trim-offset");if("round"===A||"square"===A){const t=1;M!==I&&(0===M&&(M-=t),1===I&&(I+=t))}const C=e.terrain?w.projMatrix:null,z=f?Ki(e,n,r,_,C,c):Yi(e,n,r,_,C,o.lineClipsArray.length,c,[M,I]);if(m){const n=o.gradients[r.id];let s=n.texture;if(r.gradientVersion!==n.version){let a=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=w.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-w.canonical.z):1;a=t.clamp(t.nextPowerOfTwo(o.maxLineLength/t.EXTENT*1024*n),256,y.maxTextureSize)}n.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:a,image:n.gradient||void 0,clips:o.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new t.Texture(y,n.gradient,x.RGBA),n.version=r.gradientVersion,s=n.texture}y.activeTexture.set(x.TEXTURE1),s.bind(r.stepInterpolant?x.NEAREST:x.LINEAR,x.CLAMP_TO_EDGE)}u&&(y.activeTexture.set(x.TEXTURE0),n.lineAtlasTexture.bind(x.LINEAR,x.REPEAT),s.updatePaintBuffers(_)),f&&(y.activeTexture.set(x.TEXTURE0),n.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),s.updatePaintBuffers(_)),e.prepareDrawProgram(y,T,w.toUnwrapped());const P=i=>{T.draw(y,x.TRIANGLES,a,i,l,t.CullFaceMode.disabled,z,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,e.transform.zoom,s,[o.layoutVertexBuffer2])};if(b){const i=e.stencilModeForClipping(w).ref;0===i&&e.terrain&&y.clear({stencil:0});const r={func:x.EQUAL,mask:255};z.u_alpha_discard_threshold=.8,P(new t.StencilMode(r,i,255,x.KEEP,x.KEEP,x.INVERT)),z.u_alpha_discard_threshold=0,P(new t.StencilMode(r,i,255,x.KEEP,x.KEEP,x.KEEP))}else P(e.stencilModeForClipping(w))}b&&(e.resetStencilClippingMasks(),e.terrain&&y.clear({stencil:0}))},fill:function(e,i,r,n){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){const o=e.depthModeForSublayer(1,"opaque"===e.renderPass?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly);gr(e,i,r,n,o,a,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const o=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,t.DepthMode.ReadOnly);gr(e,i,r,n,o,a,!0)}},"fill-extrusion":function(e,i,r,n){const o=r.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===e.renderPass){const s=new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))yr(e,i,r,n,s,t.StencilMode.disabled,t.ColorMode.disabled),yr(e,i,r,n,s,e.stencilModeFor3D(),e.colorModeForRenderPass()),e.resetStencilClippingMasks();else{const o=e.colorModeForRenderPass();yr(e,i,r,n,s,t.StencilMode.disabled,o)}}},hillshade:function(e,i,r,n){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const o=e.context,s=e.depthModeForSublayer(0,t.DepthMode.ReadOnly),a=e.colorModeForRenderPass(),l=e.terrain&&e.terrain.renderingToTexture,[c,h]="translucent"!==e.renderPass||l?[{},n]:e.stencilConfigForOverlap(n);for(const u of h){const n=i.getTile(u);if(n.needsHillshadePrepare&&"offscreen"===e.renderPass)xi(e,n,r,s,t.StencilMode.disabled,a);else if("translucent"===e.renderPass){const t=l&&e.terrain?e.terrain.stencilModeForRTTOverlap(u):c[u.overscaledZ];gi(e,u,n,r,s,t,a)}}o.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()},raster:function(e,i,r,n,o,s){if("translucent"!==e.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!n.length)return;const a=e.context,l=a.gl,c=i.getSource(),h=e.useProgram("raster"),u=e.colorModeForRenderPass(),p=e.terrain&&e.terrain.renderingToTexture,[d,f]=c instanceof zt||p?[{},n]:e.stencilConfigForOverlap(n),m=f[f.length-1].overscaledZ,_=!e.options.moving;for(const g of f){const n=p?t.DepthMode.disabled:e.depthModeForSublayer(g.overscaledZ-m,1===r.paint.get("raster-opacity")?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly,l.LESS),o=g.toUnwrapped(),f=i.getTile(g);if(p&&(!f||!f.hasData()))continue;const y=p?g.projMatrix:e.transform.calculateProjMatrix(o,_),x=e.terrain&&p?e.terrain.stencilModeForRTTOverlap(g):d[g.overscaledZ],v=s?0:r.paint.get("raster-fade-duration");f.registerFadeDuration(v);const b=i.findLoadedParent(g,0),w=Ii(f,b,i,e.transform,v);let T,E;e.terrain&&e.terrain.prepareDrawTile();const S="nearest"===r.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;a.activeTexture.set(l.TEXTURE0),f.texture.bind(S,l.CLAMP_TO_EDGE),a.activeTexture.set(l.TEXTURE1),b?(b.texture.bind(S,l.CLAMP_TO_EDGE),T=Math.pow(2,b.tileID.overscaledZ-f.tileID.overscaledZ),E=[f.tileID.canonical.x*T%1,f.tileID.canonical.y*T%1]):f.texture.bind(S,l.CLAMP_TO_EDGE);const A=tr(y,E||[0,0],T||1,w,r,c instanceof zt?c.perspectiveTransform:[0,0]);if(e.prepareDrawProgram(a,h,o),c instanceof zt)c.boundsBuffer&&c.boundsSegments&&h.draw(a,l.TRIANGLES,n,t.StencilMode.disabled,u,t.CullFaceMode.disabled,A,r.id,c.boundsBuffer,e.quadTriangleIndexBuffer,c.boundsSegments);else{const{tileBoundsBuffer:i,tileBoundsIndexBuffer:o,tileBoundsSegments:s}=e.getTileBoundsBuffers(f);h.draw(a,l.TRIANGLES,n,x,u,t.CullFaceMode.disabled,A,r.id,i,o,s)}}e.resetStencilClippingMasks()},background:function(e,i,r,n){const o=r.paint.get("background-color"),s=r.paint.get("background-opacity");if(0===s)return;const a=e.context,l=a.gl,c=e.transform,h=c.tileSize,u=r.paint.get("background-pattern");if(e.isPatternMissing(u))return;const p=!u&&1===o.a&&1===s&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==p)return;const d=t.StencilMode.disabled,f=e.depthModeForSublayer(0,"opaque"===p?t.DepthMode.ReadWrite:t.DepthMode.ReadOnly),m=e.colorModeForRenderPass(),_=e.useProgram(u?"backgroundPattern":"background");let g,y=n;y||(g=e.getBackgroundTiles(),y=Object.values(g).map((t=>t.tileID))),u&&(a.activeTexture.set(l.TEXTURE0),e.imageManager.bind(e.context));const x=r.getCrossfadeParameters();for(const v of y){const p=v.toUnwrapped(),y=n?v.projMatrix:e.transform.calculateProjMatrix(p);e.prepareDrawTile();const b=i?i.getTile(v):g?g[v.key]:new t.Tile(v,h,c.zoom,e),w=u?ar(y,s,e,u,{tileID:v,tileSize:h},x):sr(y,s,o);e.prepareDrawProgram(a,_,p);const{tileBoundsBuffer:T,tileBoundsIndexBuffer:E,tileBoundsSegments:S}=e.getTileBoundsBuffers(b);_.draw(a,l.TRIANGLES,f,d,m,t.CullFaceMode.disabled,w,r.id,T,E,S)}},sky:function(e,i,r){const n=e.transform,o="mercator"===n.projection.name||"globe"===n.projection.name?1:t.smoothstep(7,8,n.zoom),s=r.paint.get("sky-opacity")*o;if(0===s)return;const a=e.context,l=r.paint.get("sky-type"),c=new t.DepthMode(a.gl.LEQUAL,t.DepthMode.ReadOnly,[0,1]),h=e.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===e.renderPass?r.needsSkyboxCapture(e)&&(function(e,i,r,n){const o=e.context,s=o.gl;let a=i.skyboxFbo;if(!a){a=i.skyboxFbo=o.createFramebuffer(32,32,!1),i.skyboxGeometry=new kr(o),i.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,i.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 t=0;t<6;++t)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(a.framebuffer),o.viewport.set([0,0,32,32]);const l=i.getCenter(e,!0),c=e.useProgram("skyboxCapture"),h=new Float64Array(16);t.identity(h),t.rotateY(h,h,.5*-Math.PI),Dr(o,i,c,h,l,0),t.identity(h),t.rotateY(h,h,.5*Math.PI),Dr(o,i,c,h,l,1),t.identity(h),t.rotateX(h,h,.5*-Math.PI),Dr(o,i,c,h,l,2),t.identity(h),t.rotateX(h,h,.5*Math.PI),Dr(o,i,c,h,l,3),t.identity(h),Dr(o,i,c,h,l,4),t.identity(h),t.rotateY(h,h,Math.PI),Dr(o,i,c,h,l,5),o.viewport.set([0,0,e.width,e.height])}(e,r),r.markSkyboxValid(e)):"sky"===e.renderPass&&function(e,i,r,n,o){const s=e.context,a=s.gl,l=e.transform,c=e.useProgram("skybox");s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxTexture);const h=((t,e,i,r,n)=>({u_matrix:t,u_sun_direction:e,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(l.skyboxMatrix,i.getCenter(e,!1),0,n,o);e.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,r,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,h,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(e,r,c,s,h):"gradient"===l&&"sky"===e.renderPass&&function(e,i,r,n,o){const s=e.context,a=s.gl,l=e.transform,c=e.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new kr(s)),s.activeTexture.set(a.TEXTURE0);let h=i.colorRampTexture;h||(h=i.colorRampTexture=new t.Texture(s,i.colorRamp,a.RGBA)),h.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=((e,i,r,n,o)=>({u_matrix:e,u_color_ramp:0,u_center_direction:i,u_radius:t.degToRad(r),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(e,!1),i.paint.get("sky-gradient-radius"),n,o);e.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,r,t.StencilMode.disabled,e.colorModeForRenderPass(),t.CullFaceMode.backCW,u,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(e,r,c,s,h)},debug:function(t,e,i){for(let r=0;r<i.length;r++)Sr(t,e,i[r])},custom:function(e,i,r){const n=e.context,o=r.implementation;if(e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes("custom"))t.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if("offscreen"===e.renderPass){const t=o.prerender;t&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),t.call(o,n.gl,e.transform.customLayerMatrix()),n.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(t.StencilMode.disabled);const i="3d"===o.renderingMode?new t.DepthMode(e.context.gl.LEQUAL,t.DepthMode.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,t.DepthMode.ReadOnly);n.setDepthMode(i),o.render(n.gl,e.transform.customLayerMatrix()),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}};class Fr{constructor(e,i){this.context=new At(e),this.transform=i,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=t.SourceCache.maxUnderzooming+t.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new He,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(t,e){const i=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new ki(this,t));const r=this._terrain;this.transform.elevation=i?r:null,r.update(t,this.transform,e)}_updateFog(t){const e=t.fog;if(!e||"globe"===this.transform.projection.name||e.getOpacity(this.transform.pitch)<1||e.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=e.getFovAdjustedRange(this.transform._fov);if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(e,i){if(this.width=e*t.exported.devicePixelRatio,this.height=i*t.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style.order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,t.posAttributes.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,t.posAttributes.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const n=new t.StructArrayLayout2i4;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(n,t.posAttributes.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.StructArrayLayout4i8;o.emplaceBack(0,0,0,0),o.emplaceBack(t.EXTENT,0,t.EXTENT,0),o.emplaceBack(0,t.EXTENT,0,t.EXTENT),o.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.mercatorBoundsBuffer=e.createVertexBuffer(o,t.boundsAttributes.members),this.mercatorBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);const a=new t.StructArrayLayout1ui2;for(const t of[0,1,3,2,0])a.emplaceBack(t);this.debugIndexBuffer=e.createIndexBuffer(a),this.emptyTexture=new t.Texture(e,new t.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),e.gl.RGBA),this.identityMat=t.create();const l=this.context.gl;this.stencilClearMode=new t.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(t.window.performance.now()),this.atmosphereBuffer=new Br(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(e,i.TRIANGLES,t.DepthMode.disabled,this.stencilClearMode,t.ColorMode.disabled,t.CullFaceMode.disabled,Mi(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 t=!1;for(const e of r)if(void 0===this._tileClippingMaskIDs[e.key]){t=!0;break}if(!t)return}this.currentStencilSource=i.id;const n=this.context,o=n.gl;this.nextStencilID+r.length>256&&this.clearStencil(),n.setColorMode(t.ColorMode.disabled),n.setDepthMode(t.DepthMode.disabled);const s=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const a of r){const e=i.getTile(a),r=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:h}=this.getTileBoundsBuffers(e);s.draw(n,o.TRIANGLES,t.DepthMode.disabled,new t.StencilMode({func:o.ALWAYS,mask:0},r,255,o.KEEP,o.KEEP,o.REPLACE),t.ColorMode.disabled,t.CullFaceMode.disabled,Mi(a.projMatrix),"$clipping",l,c,h)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new t.StencilMode({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const i=this.context.gl;return new t.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(e){const i=this.context.gl,r=e.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),n=r[r.length-1].overscaledZ,o=r[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const e={};for(let r=0;r<o;r++)e[r+n]=new t.StencilMode({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[e,r]}return[{[n]:t.StencilMode.disabled},r]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new t.ColorMode([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?t.ColorMode.unblended:t.ColorMode.alphaBlended}depthModeForSublayer(e,i,r){if(!this.opaquePassEnabledForLayer())return t.DepthMode.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new t.DepthMode(r||this.context.gl.LEQUAL,i,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame();const r=this.style.order,n=this.style._sourceCaches;for(const t in n){const e=n[t];e.used&&e.prepare(this.context)}const o={},s={},a={};for(const t in n){const e=n[t];o[t]=e.getVisibleCoordinates(),s[t]=o[t].slice().reverse(),a[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}if(this.terrain&&(this.terrain.updateTileBinding(a),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new t.GlobeSharedBuffers(this.context)),t.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";for(const t of r){const i=this.style._layers[t],r=e._getLayerSourceCache(i);if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;const n=r?s[r.id]:void 0;("custom"===i.type||i.isSky()||n&&n.length)&&this.renderLayer(this,r,i,n)}if(this.depthRangeFor3D=[0,1-(e.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],i=e._getLayerSourceCache(t);if(t.isSky())continue;const n=i?s[i.id]:void 0;this._renderTileClippingMasks(t,i,n),this.renderLayer(this,i,t,n)}if(this.style.fog&&this.transform.projection.supportsFog&&function(e,i){const r=e.context,n=r.gl,o=e.transform,s=new t.DepthMode(n.LEQUAL,t.DepthMode.ReadOnly,[0,1]),a=e.useProgram("globeAtmosphere",null,"globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=t.globeToMercatorTransition(o.zoom),c=i.properties.get("color").toArray01(),h=i.properties.get("high-color").toArray01(),u=i.properties.get("space-color").toArray01PremultipliedAlpha(),p=t.identity$1([]);t.rotateY$1(p,p,-t.degToRad(o._center.lng)),t.rotateX$1(p,p,t.degToRad(o._center.lat)),t.rotateZ$1(p,p,o.angle),t.rotateX$1(p,p,-o._pitch);const d=t.fromQuat(new Float32Array(16),p),f=t.mapValue(i.properties.get("star-intensity"),0,1,0,.25),m=5e-4,_=t.mapValue(i.properties.get("horizon-blend"),0,1,m,.25),g=t.globeUseCustomAntiAliasing(e,r,o)&&_===m?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=e.frameCounter/1e3%1,x=t.length(o.globeCenterInViewSpace),v=Math.sqrt(Math.pow(x,2)-Math.pow(g,2)),b=Math.acos(v/x),w=((e,i,r,n,o,s,a,l,c,h,u,p,d,f)=>({u_frustum_tl:e,u_frustum_tr:i,u_frustum_br:r,u_frustum_bl:n,u_horizon:o,u_transition:s,u_fadeout_range:a,u_color:l,u_high_color:c,u_space_color:h,u_star_intensity:u,u_star_size:5*t.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:p,u_horizon_angle:d,u_rotation_matrix:f}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,l,_,c,h,u,f,y,b,d);e.prepareDrawProgram(r,a);const T=e.atmosphereBuffer;T&&a.draw(r,n.TRIANGLES,s,t.StencilMode.disabled,t.ColorMode.alphaBlended,t.CullFaceMode.backCW,w,"skybox",T.vertexBuffer,T.indexBuffer,T.segments)}(this,this.style.fog),this.renderPass="sky",(t.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],i=e._getLayerSourceCache(t);t.isSky()&&this.renderLayer(this,i,t,i?s[i.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;){const t=this.style._layers[r[this.currentLayer]],i=e._getLayerSourceCache(t);if(t.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(t)){if(t.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}const n=i?("symbol"===t.type?a:s)[i.id]:void 0;this._renderTileClippingMasks(t,i,i?o[i.id]:void 0),this.renderLayer(this,i,t,n),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry){let i=null;t.values(this.style._layers).forEach((t=>{const r=e._getLayerSourceCache(t);r&&!t.isHidden(this.transform.zoom)&&(!i||i.getSource().maxzoom<r.getSource().maxzoom)&&(i=r)})),i&&this.options.showTileBoundaries&&Rr.debug(this,i,i.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Ar(t,t.transform.height-(e.top||0),3,vr),Ar(t,e.bottom||0,3,br),Mr(t,e.left||0,3,wr),Mr(t,t.transform.width-(e.right||0),3,Tr);const i=t.transform.centerPoint;!function(t,e,i,r){Ir(t,e-1,i-10,2,20,r),Ir(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,Er)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(t.window.performance.now()),this.saveCanvasCopy())}}renderLayer(t,e,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(i.type)||Rr[i.type](t,e,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;let i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,e=t.createQueryEXT();this.deferredRenderGpuTimeQueries.push(e),t.beginQueryEXT(t.TIME_ELAPSED_EXT,e)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const e={};for(const i in t){const r=t[i],n=this.context.extTimerQuery,o=n.getQueryObjectEXT(r.query,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(r.query),e[i]=o}return e}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const e=this.context.extTimerQuery;let i=0;for(const r of t)i+=e.getQueryObjectEXT(r,e.QUERY_RESULT_EXT)/1e6,e.deleteQueryEXT(r);return i}translatePosMatrix(e,i,r,n,o){if(!r[0]&&!r[1])return e;const s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){const t=Math.sin(s),e=Math.cos(s);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}const a=[o?r[0]:D(i,r[0],this.transform.zoom),o?r[1]:D(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}currentGlobalDefines(){const t=this.terrain&&this.terrain.renderingToTexture,e=this.style&&this.style.fog,i=[];return this.terrain&&!this.terrain.renderingToTexture&&i.push("TERRAIN"),e&&!t&&0!==e.getOpacity(this.transform.pitch)&&i.push("FOG"),t&&i.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&i.push("OVERDRAW_INSPECTOR"),i}useProgram(t,e,i){this.cache=this.cache||{};const r=i||[],n=this.currentGlobalDefines().concat(r),o=Di.cacheKey(pi[t],t,n,e);return this.cache[o]||(this.cache[o]=new Di(this.context,t,pi[t],e,lr[t],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(e,i,r){if(this.terrain&&this.terrain.renderingToTexture)return;const n=this.style.fog;if(n){const o=n.getOpacity(this.transform.pitch),s=((e,i,r,n,o,s,a,l,c,h,u)=>{const p=e.transform,d=i.properties.get("color").toArray01();d[3]=n;const f=e.frameCounter/1e3%1;return{u_fog_matrix:r?p.calculateFogTileMatrix(r):e.identityMat,u_fog_range:i.getFovAdjustedRange(p._fov),u_fog_color:d,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:f,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:h,u_viewport:u,u_globe_transition:t.globeToMercatorTransition(p.zoom),u_is_globe:+("globe"===p.projection.name)}})(this,n,r,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*t.exported.devicePixelRatio,this.transform.height*t.exported.devicePixelRatio]);i.setFogUniformValues(e,s)}}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const t=this.context.gl,e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),e}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&0!==t.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,i=this._backgroundTiles={},r=this.transform.coveringTiles({tileSize:512});for(const n of r)i[n.key]=e[n.key]||new t.Tile(n,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}}class Or{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.clamp((this.left+e-this.right)/2,0,e),n=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Or(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ur(e,i){const r=t.getColumn(e,3);t.fromQuat(e,i),t.setColumn(e,3,r)}function Vr(e,i){const r=t.identity$1([]);return t.rotateZ$1(r,r,-i),t.rotateX$1(r,r,-e),r}function jr(e,i){const r=[e[0],e[1],0],n=[i[0],i[1],0];if(t.length(r)>=1e-15){const e=t.normalize([],r);t.scale$2(n,e,t.dot(n,e)),i[0]=n[0],i[1]=n[1]}const o=t.cross([],i,e);if(t.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Vr(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),s)}class Nr{constructor(t,e){this.position=t,this.orientation=e}get position(){return this._position}set position(e){if(e){const i=e instanceof t.MercatorCoordinate?e:new t.MercatorCoordinate(e[0],e[1],e[2]);this._renderWorldCopies&&(i.x=t.wrap(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(e,i){if(this.orientation=null,!this.position)return;const r=this._elevation?this._elevation.getAtPointOrZero(t.MercatorCoordinate.fromLngLat(e)):0,n=this.position,o=t.MercatorCoordinate.fromLngLat(e,r),s=[o.x-n.x,o.y-n.y,o.z-n.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=jr(s,i)}setPitchBearing(e,i){this.orientation=Vr(t.degToRad(e),t.degToRad(-i))}}class Gr{constructor(e,i){this._transform=t.identity([]),this.orientation=i,this.position=e}get mercatorPosition(){const e=this.position;return new t.MercatorCoordinate(e[0],e[1],e[2])}get position(){const e=t.getColumn(this._transform,3);return[e[0],e[1],e[2]]}set position(e){var i;e&&t.setColumn(this._transform,3,[(i=e)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(e){this._orientation=e||t.identity$1([]),e&&Ur(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),e=this.right();return{bearing:Math.atan2(-e[1],e[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,e){this._orientation=Vr(t,e),Ur(this._transform,this._orientation)}forward(){const e=t.getColumn(this._transform,2);return[-e[0],-e[1],-e[2]]}up(){const e=t.getColumn(this._transform,1);return[-e[0],-e[1],-e[2]]}right(){const e=t.getColumn(this._transform,0);return[e[0],e[1],e[2]]}getCameraToWorld(e,i){const r=new Float64Array(16);return t.invert(r,this.getWorldToCamera(e,i)),r}getWorldToCameraPosition(e,i,r){const n=this.position;t.scale$2(n,n,-e);const o=new Float64Array(16);return t.fromScaling(o,[r,r,r]),t.translate(o,o,n),o[10]*=i,o}getWorldToCamera(e,i){const r=new Float64Array(16),n=new Float64Array(4),o=this.position;return t.conjugate(n,this._orientation),t.scale$2(o,o,-e),t.fromQuat(r,n),t.translate(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(e,i,r,n){const o=new Float64Array(16);return t.perspective(o,e,i,r,n),o}getDistanceToElevation(e){const i=0===e?0:t.mercatorZfromAltitude(e,this.position[1]),r=this.forward();return(i-this.position[2])/r[2]}clone(){return new Gr([...this.position],[...this.orientation])}}function Zr(e,i){const r=Wr(e.projection,e.zoom,e.width,e.height),n=function(e,i,r,n,o){const s=new t.LngLat(r.lng-180*Xr,r.lat),a=new t.LngLat(r.lng+180*Xr,r.lat),l=e.project(s.lng,s.lat),c=e.project(a.lng,a.lat),h=-Math.atan2(c.y-l.y,c.x-l.x),u=t.MercatorCoordinate.fromLngLat(r);u.y=t.clamp(u.y,-.999975,.999975);const p=u.toLngLat(),d=e.project(p.lng,p.lat),f=t.MercatorCoordinate.fromLngLat(p);f.x+=Xr;const m=f.toLngLat(),_=e.project(m.lng,m.lat),g=Yr(_.x-d.x,_.y-d.y,h),y=t.MercatorCoordinate.fromLngLat(p);y.y+=Xr;const x=y.toLngLat(),v=e.project(x.lng,x.lat),b=Yr(v.x-d.x,v.y-d.y,h),w=Math.abs(g.x)/Math.abs(b.y),T=t.identity([]);t.rotateZ(T,T,-h*(1-(o?0:n)));const E=t.identity([]);return t.scale(E,E,[1,1-(1-w)*n,1]),E[4]=-b.x/b.y*n,t.rotateZ(E,E,h),t.multiply(E,T,E),E}(e.projection,0,e.center,r,i),o=qr(e);return t.scale(n,n,[o,o,1]),n}function qr(e){const i=e.projection,r=Wr(e.projection,e.zoom,e.width,e.height),n=Hr(i,e.center),o=Hr(i,t.LngLat.convert(i.center));return Math.pow(2,n*r+(1-r)*o)}function Wr(e,i,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0;const s=e.range;if(!s)return 0;const a=Math.min(o,Math.max(r,n)),l=Math.log(a/1024)/Math.LN2;return t.smoothstep(s[0]+l,s[1]+l,i)}const Xr=1/4e4;function Hr(e,i){const r=t.clamp(i.lat,-t.MAX_MERCATOR_LATITUDE,t.MAX_MERCATOR_LATITUDE),n=new t.LngLat(i.lng-180*Xr,r),o=new t.LngLat(i.lng+180*Xr,r),s=e.project(n.lng,r),a=e.project(o.lng,r),l=t.MercatorCoordinate.fromLngLat(n),c=t.MercatorCoordinate.fromLngLat(o),h=a.x-s.x,u=a.y-s.y,p=c.x-l.x,d=c.y-l.y,f=Math.sqrt((p*p+d*d)/(h*h+u*u));return Math.log(f)/Math.LN2}function Yr(t,e,i){const r=Math.cos(i),n=Math.sin(i);return{x:t*r-e*n,y:t*n+e*r}}class Kr{constructor(e,i,r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==n?60:n,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new t.LngLat(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 Or,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Gr,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const t=new Kr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
1xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(t){const e=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||e)&&this._updateCameraOnTerrain(),(t||e)&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return t.pick(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const r=this.projection?this.getProjection():void 0;this.projection=t.getProjection(this.projectionOptions);const n=!e(r,this.getProjection());return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setMercatorFromTransition(){const e=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=t.getProjection({name:"mercator"});const i=e!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return t.mercatorZfromAltitude(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return t.wrap(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(e){const i=-e*Math.PI/180;var r;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(r=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r),function(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=r*l+o*a,t[1]=n*l+s*a,t[2]=r*-a+o*l,t[3]=n*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._setZoom(e),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForE
vendor: 56,483 bytes, line 1
1xaggeration=void 0);const t=this._elevation;this._centerAltitude=t.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=t.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;const e=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s<i.length;s++){const a=new t.pointGeometry(i[s][0]*this.width,r+i[s][1]*(this.height-r)),l=e.pointCoordinate(a);if(!l)continue;const c=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*c,o+=c}return 0===o?NaN:n/o}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const t=this._seaLevelZoom,e=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*e,r=this._mercatorZfromZoom(t),n=this._mercatorZfromZoom(this._maxZoom),o=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(o))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(e){const i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude()));let r;r=e.z<this._camera.position[2]?[i.x,i.y,i.z]:[e.x,e.y,e.z];const n=t.length(t.sub([],this._camera.position,r));return t.clamp(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(e){if(!this.height)return;if(!e.position&&!e.orientation)return;this._updateCameraState();let i=!1;if(e.orientation&&!t.exactEquals(e.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(e.orientation)),e.position){const r=[e.position.x,e.position.y,e.position.z];t.exactEquals$1(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const e=this._camera.position,i=new Nr;return i.position=new t.MercatorCoordinate(e[0],e[1],e[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}_setCameraOrientation(e){if(!t.length$1(e))return!1;t.normalize$1(e,e);const i=t.transformQuat([],[0,0,-1],e),r=t.transformQuat([],[0,-1,0],e);if(r[2]<0)return!1;const n=jr(i,r);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(e){const i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;e[2]=t.clamp(e[2],n/r,n/i),this._camera.position=e}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this.renderWorldCopies){const r=this.pointCoordinate(new t.pointGeometry(0,0)),n=this.pointCoordinate(new t.pointGeometry(this.width,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),s=this.pointCoordinate(new t.pointGeometry(0,this.height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let h=a-c;h<=l+c;h++)0!==h&&i.push(new t.UnwrappedTileID(h,e))}return i}coveringTiles(e){let i=this.coveringZoomLevel(e);const r=i,n=this.elevation&&!e.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);const s=this.locationCoordinate(this.center),a=this.center.lat,l=1<<i,c=[l*s.x,l*s.y,0],h="globe"===this.projection.name,u=!h,p=t.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,u),d=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),f=l*t.mercatorZfromAltitude(1,this.center.lat),m=this._camera.position[2]/t.mercatorZfromAltitude(1,this.center.lat),_=[l*d.x,l*d.y,m*(u?1:f)],g=this.cameraToCenterDistance/e.tileSize*(e.roundZoom?1:.502),y=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?i:0,x=e.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,v=e.isTerrainDEM?-x:this._elevation?this._elevation.getMinElevationBelowMSL():0,b=this.projection.isReprojectedInTileSpace?qr(this):1,w=e=>{const i=1/4e4,r=new t.MercatorCoordinate(e.x+i,e.y,e.z),n=new t.MercatorCoordinate(e.x,e.y+i,e.z),o=e.toLngLat(),s=r.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),h=this.locationCoordinate(a),u=Math.hypot(c.x-l.x,c.y-l.y),p=Math.hypot(h.x-l.x,h.y-l.y);return Math.sqrt(u*p)*b/i},T=e=>{const i=x,r=v;return{aabb:t.tileAABB(this,l,0,0,0,e,r,i,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:i,wrap:e,fullyVisible:!1}},E=[];let S=[];const A=i,M=e.reparseOverscaled?r:i,I=t=>t*t,C=I((m-this._centerAltitude)*f),z=t=>{if(!this._elevation||!t.tileID||!o)return;const e=this._elevation.getMinMaxForTile(t.tileID),i=t.aabb;e?(i.min[2]=e.min,i.max[2]=e.max,i.center[2]=(i.min[2]+i.max[2])/2):(t.shouldSplit=P(t),t.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},P=e=>{if(e.zoom<y)return!0;if(e.zoom===A)return!1;if(null!=e.shouldSplit)return e.shouldSplit;const i=e.aabb.distanceX(_),o=e.aabb.distanceY(_);let s=C,l=1;if(h){s=I(e.aabb.distanceZ(_));const i=Math.pow(2,e.zoom),r=t.latFromMercatorY((e.y+1)/i),n=t.latFromMercatorY(e.y/i),o=Math.min(Math.max(a,r),n),c=t.circumferenceAtLatitude(o)/t.circumferenceAtLatitude(a);if(l=o===a?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,c/this._mercatorScaleRatio),this.zoom<=t.GLOBE_ZOOM_THRESHOLD_MIN&&e.zoom===A-1&&c>=.9)return!0}else if(n&&(s=I(e.aabb.distanceZ(_)*f)),this.projection.isReprojectedInTileSpace&&r<=5){const i=Math.pow(2,e.zoom),r=w(new t.MercatorCoordinate((e.x+.5)/i,(e.y+.5)/i));l=r>.85?1:r}const c=i*i+o*o+s;return c<I((1<<A-e.zoom)*g*l*((t,e)=>{if(e*I(.707)<t)return 1;const i=Math.sqrt(e/t);return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(s,C),c))};if(this.renderWorldCopies)for(let t=1;t<=3;t++)E.push(T(-t)),E.push(T(t));for(E.push(T(0));E.length>0;){const r=E.pop(),s=r.x,a=r.y;let u=r.fullyVisible;if(!u){const t=r.aabb.intersects(p);if(0===t)continue;u=2===t}if(r.zoom!==A&&P(r))for(let e=0;e<4;e++){const i=(s<<1)+e%2,c=(a<<1)+(e>>1),p={aabb:o?r.aabb.quadrant(e):t.tileAABB(this,l,r.zoom+1,i,c,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:i,y:c,wrap:r.wrap,fullyVisible:u,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};n&&!h&&(p.tileID=new t.OverscaledTileID(r.zoom+1===A?M:r.zoom+1,r.wrap,r.zoom+1,i,c),z(p)),E.push(p)}else{const n=r.zoom===A?M:r.zoom;if(e.minzoom&&e.minzoom>n)continue;const o=c[0]-(.5+s+(r.wrap<<r.zoom))*(1<<i-r.zoom),l=c[1]-.5-a,h=r.tileID?r.tileID:new t.OverscaledTileID(n,r.wrap,r.zoom,s,a);S.push({tileID:h,distanceSq:o*o+l*l})}}if(this.fogCullDistSq){const i=this.fogCullDistSq,r=this.horizonLineFromTop();S=S.filter((n=>{const o=[0,0,0,1],s=[t.EXTENT,t.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());t.transformMat4$1(o,o,a),t.transformMat4$1(s,s,a);const l=t.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const h=this._elevation;if(h&&l>i&&0!==r){const i=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;e.isTerrainDEM||(o=h.getMinMaxForTile(n.tileID)),o||(o={min:v,max:x});const s=t.furthestTileCorner(this.rotation),a=[s[0]*t.EXTENT,s[1]*t.EXTENT,o.max];t.transformMat4(a,a,i),c=(1-a[1])*this.height*.5<r}return l<i||c}))}return S.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-t.MAX_MERCATOR_LATITUDE,t.MAX_MERCATOR_LATITUDE),r=this.projection.project(e.lng,i);return new t.pointGeometry(r.x*this.worldSize,r.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(e,i){let r,n;const o=this.centerPoint;if("globe"===this.projection.name){const t=this.worldSize;r=(i.x-o.x)/t,n=(i.y-o.y)/t}else{const t=this.pointCoordinate(i),e=this.pointCoordinate(o);r=t.x-e.x,n=t.y-e.y}const s=this.locationCoordinate(e);this.setLocation(new t.MercatorCoordinate(s.x-r,s.y-n))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t){return this.projection.locationPoint(this,t)}locationPoint3D(t){return this.projection.locationPoint(this,t,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t){return this.coordinateLocation(this.pointCoordinate3D(t))}locationCoordinate(e,i){const r=i?t.mercatorZfromAltitude(i,e.lat):void 0,n=this.projection.project(e.lng,e.lat);return new t.MercatorCoordinate(n.x,n.y,r)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(e,i){const r=null!=i?i:this._centerAltitude,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4$1(n,n,this.pixelMatrixInverse),t.transformMat4$1(o,o,this.pixelMatrixInverse);const s=o[3];t.scale$1(n,n,1/n[3]),t.scale$1(o,o,1/s);const a=n[2],l=o[2];return{p0:n,p1:o,t:a===l?0:(r-a)/(l-a)}}screenPointToMercatorRay(e){const i=[e.x,e.y,0,1],r=[e.x,e.y,1,1];return t.transformMat4$1(i,i,this.pixelMatrixInverse),t.transformMat4$1(r,r,this.pixelMatrixInverse),t.scale$1(i,i,1/i[3]),t.scale$1(r,r,1/r[3]),i[2]=t.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,r[2]=t.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,t.scale$1(i,i,1/this.worldSize),t.scale$1(r,r,1/this.worldSize),new t.Ray([i[0],i[1],i[2]],t.normalize([],t.sub([],r,i)))}rayIntersectionCoordinate(e){const{p0:i,p1:r,t:n}=e,o=t.mercatorZfromAltitude(i[2],this._center.lat),s=t.mercatorZfromAltitude(r[2],this._center.lat);return new t.MercatorCoordinate(t.number(i[0],r[0],n)/this.worldSize,t.number(i[1],r[1],n)/this.worldSize,t.number(o,s,n))}pointCoordinate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._centerAltitude;return this.projection.pointCoordinate(this,t.x,t.y,e)}pointCoordinate3D(e){if(!this.elevation)return this.pointCoordinate(e);let i=this.projection.pointCoordinate3D(this,e.x,e.y);if(i)return new t.MercatorCoordinate(i[0],i[1],i[2]);let r=0,n=this.horizonLineFromTop();if(e.y>n)return this.pointCoordinate(e);const o=.02*n,s=e.clone();for(let a=0;a<10&&n-r>o;a++){s.y=t.number(r,n,.66);const e=this.projection.pointCoordinate3D(this,s.x,s.y);e?(n=s.y,i=e):r=s.y}return i?new t.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(e)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}_coordinatePoint(e,i){const r=i&&this.elevation?this.elevation.getAtPointOrZero(e,this._centerAltitude):this._centerAltitude,n=[e.x*this.worldSize,e.y*this.worldSize,r+e.toAltitude(),1];return t.transformMat4$1(n,n,this.pixelMatrix),n[3]>0?new t.pointGeometry(n[0]/n[3],n[1]/n[3]):new t.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(e,i){const r=new t.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),n=new t.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),o=new t.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),s=new t.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let a=this.pointCoordinate(r,e),l=this.pointCoordinate(n,e);const c=this.pointCoordinate(o,i),h=this.pointCoordinate(s,i),u=(t,e)=>(e.y-t.y)/(e.x-t.x);return a.y>1&&l.y>=0?a=new t.MercatorCoordinate((1-h.y)/u(h,a)+h.x,1):a.y<0&&l.y<=1&&(a=new t.MercatorCoordinate(-h.y/u(h,a)+h.x,0)),l.y>1&&a.y>=0?l=new t.MercatorCoordinate((1-c.y)/u(c,l)+c.x,1):l.y<0&&a.y<=1&&(l=new t.MercatorCoordinate(-c.y/u(c,l)+c.x,0)),(new t.LngLatBounds).extend(this.coordinateLocation(a)).extend(this.coordinateLocation(l)).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(c))}_getBounds3D(){const t=this.elevation;if(!t.visibleDemTiles.length)return this._getBounds(0,0);const e=t.visibleDemTiles.reduce(((t,e)=>{if(e.dem){const i=e.dem.tree;t.min=Math.min(t.min,i.minimums[0]),t.max=Math.max(t.max,i.maximums[0])}return t}),{min:Number.MAX_VALUE,max:0});return this._getBounds(e.min*t.exaggeration(),e.max*t.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-e*(1-this._horizonShift);return t?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(e){this.maxBounds=e,this.minLat=-t.MAX_MERCATOR_LATITUDE,this.maxLat=t.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,e&&(this.minLat=e.getSouth(),this.maxLat=e.getNorth(),this.minLng=e.getWest(),this.maxLng=e.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=t.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=t.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=t.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=t.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,e){return this.projection.createTileMatrix(this,e,t)}calculateDistanceTileData(e){const i=e.key,r=this._distanceTileDataCache;if(r[i])return r[i];const n=e.canonical,o=1/this.height,s=this.cameraWorldSize/this.zoomScale(n.z),a=(n.x+Math.pow(2,n.z)*e.wrap)*s,l=n.y*s,c=this.point,h=this.angle,u=Math.sin(-h),p=-Math.cos(-h);return r[i]={bearing:[u,p],center:[(c.x-a)*o,(c.y-l)*o],scale:s/t.EXTENT*o},r[i]}calculateFogTileMatrix(e){const i=e.key,r=this._fogTileMatrixCache;if(r[i])return r[i];const n=this.projection.createTileMatrix(this,this.cameraWorldSize,e);return t.multiply(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}calculateProjMatrix(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.key,n=i?this._alignedProjMatrixCache:this._projMatrixCache;if(n[r])return n[r];const o=this.calculatePosMatrix(e,this.worldSize);return t.multiply(o,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:i?this.alignedProjMatrix:this.projMatrix,o),n[r]=new Float32Array(o),n[r]}calculatePixelsToTileUnitsMatrix(e){const i=e.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];const n=function(e,i){const{scale:r}=e.tileTransform,n=r*t.EXTENT/(e.tileSize*Math.pow(2,i.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return o=new Float32Array(4),l=(s=i.inverseAdjustmentMatrix)[1],c=s[2],h=s[3],p=(a=[n,n])[1],o[0]=s[0]*(u=a[0]),o[1]=l*u,o[2]=c*p,o[3]=h*p,o;var o,s,a,l,c,h,u,p}(e,this);return r[i]=n,r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const e=this._elevation;this._updateCameraState();const i=t.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),o=t.mercatorZfromAltitude(1,this._center.lat);r[2]/=o,n[2]/=o,t.normalize(n,n);const s=e.raycast(r,n,e.exaggeration());if(s){const e=t.scaleAndAdd([],r,n,s),i=new t.MercatorCoordinate(e[0],e[1],t.mercatorZfromAltitude(e[2],t.latFromMercatorY(e[1]))),a=(i.z+t.length([i.x-r[0],i.y-r[1],i.z-r[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=i.toAltitude(),this._center=this.coordinateLocation(i),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCameraAltitude(){if(!this._elevation)return;const e=this._elevation;this._updateCameraState();const i=t.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=e.getAtPointOrZero(new t.MercatorCoordinate(...r)),o=this._minimumHeightOverTerrain()*Math.cos(t.degToRad(this._maxPitch)),s=this._camera.position[2]-this.pixelsPerMeter/this.worldSize*n;if(s<o){const e=this.locationCoordinate(this._center,this._centerAltitude),i=[e.x-r[0],e.y-r[1],e.z-r[2]],n=t.length(i);i[2]-=(o-s)/this._pixelsPerMercatorPixel;const a=t.length(i);if(0===a)return;t.scale$2(i,i,n/a*this._pixelsPerMercatorPixel),this._camera.position=[e.x-i[0],e.y-i[1],e.z*this._pixelsPerMercatorPixel-i[2]],this._camera.orientation=jr(i,this._camera.up()),this._updateStateFromCamera()}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||e){const i=this.center;return i.lat=t.clamp(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!e)&&(i.lng=t.clamp(i.lng,this.minLng,this.maxLng)),this.center=i,void(this._constraining=!1)}const i=this._unmodified,{x:r,y:n}=this.point;let o=0,s=r,a=n;const l=this.width/2,c=this.height/2,h=this.worldMinY*this.scale,u=this.worldMaxY*this.scale;if(n-c<h&&(a=h+c),n+c>u&&(a=u-c),u-h<this.height&&(o=Math.max(o,this.height/(u-h)),a=(u+h)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const t=this.worldMinX*this.scale,e=this.worldMaxX*this.scale,i=this.worldSize/2-(t+e)/2;s=(r+i+this.worldSize)%this.worldSize-i,s-l<t&&(s=t+l),s+l>e&&(s=e-l),e-t<this.width&&(o=Math.max(o,this.width/(e-t)),s=(e+t)/2)}s===r&&a===n||(this.center=this.unproject(new t.pointGeometry(s,a))),o&&(this.zoom+=this.scaleZoom(o)),this._constrainCameraAltitude(),this._unmodified=i,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=t.mercatorZfromAltitude(1,this.center.lat)/t.mercatorZfromAltitude(1,t.GLOBE_SCALE_MATCH_LATITUDE));const r=Wr(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,r),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const n=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?i:1),o=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height;let s=t.mul([],o,n);if(this.projection.isReprojectedInTileSpace){const e=this.locationCoordinate(this.center),i=t.identity([]);t.translate(i,i,[e.x*this.worldSize,e.y*this.worldSize,0]),t.multiply(i,i,Zr(this)),t.translate(i,i,[-e.x*this.worldSize,-e.y*this.worldSize,0]),t.multiply(s,s,i),this.inverseAdjustmentMatrix=function(t){const e=Zr(t,!0);return y([],[e[0],e[1],e[4],e[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=t.scale([],s,[this.worldSize,this.worldSize,this.worldSize/i,1]),this.projMatrix=s,this.invProjMatrix=t.invert(new Float64Array(16),this.projMatrix);const a=t.invert([],o);this.frustumCorners=t.FrustumCorners.fromInvProjectionMatrix(a,this.horizonLineFromTop(),this.height);const l=new Float32Array(16);t.identity(l),t.scale(l,l,[1,-1,1]),t.rotateX(l,l,this._pitch),t.rotateZ(l,l,this.angle);const c=t.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),h=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;c[8]=2*-e.x/this.width,c[9]=2*(e.y+h)/this.height,this.skyboxMatrix=t.multiply(l,c,l);const u=this.point,p=u.x,d=u.y,f=this.width%2/2,m=this.height%2/2,_=Math.cos(this.angle),g=Math.sin(this.angle),x=p-Math.round(p)+_*f+g*m,v=d-Math.round(d)+_*m+g*f,b=new Float64Array(s);if(t.translate(b,b,[x>.5?x-1:x,v>.5?v-1:v,0]),this.alignedProjMatrix=b,s=t.create(),t.scale(s,s,[this.width/2,-this.height/2,1]),t.translate(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=t.create(),t.scale(s,s,[1,-1,1]),t.translate(s,s,[-1,-1,0]),t.scale(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},s=t.invert(new Float64Array(16),this.pixelMatrix),!s)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=s,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=t.calculateGlobeMatrix(this);const e=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=t.transformMat4(e,e,n),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=s;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSize,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[e,e,i];t.scale$2(o,o,n),t.scale$2(r,r,-1),t.multiply$2(r,r,o);const s=t.create();t.translate(s,s,r),t.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,i,n)}_computeCameraPosition(t){const e=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*e-t/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,t/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(e){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=e[2];let n=1;r>0&&(n=Math.min((i-this._camera.position[2])/r,1)),this._camera.position=t.scaleAndAdd([],this._camera.position,e,n),this._updateStateFromCamera(),this.projection.wrap&&(this.center=this.center.wrap())}_updateStateFromCamera(){const e=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),o=t.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(t.degToRad(this._maxPitch)),a=Math.max((e[2]-o)/Math.cos(r),s),l=this._zoomFromMercatorZ(a);t.scaleAndAdd(e,e,i,a),this._pitch=t.clamp(r,t.degToRad(this.minPitch),t.degToRad(this.maxPitch)),this.angle=t.wrap(n,-Math.PI,Math.PI),this._setZoom(t.clamp(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new t.MercatorCoordinate(e[0],e[1],e[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(t*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(t.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(e,i){const r=Math.min(e.x,i.x),n=Math.max(e.x,i.x),o=Math.min(e.y,i.y),s=Math.max(e.y,i.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const a=[new t.pointGeometry(r,o),new t.pointGeometry(n,s),new t.pointGeometry(r,s),new t.pointGeometry(n,o)],l=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(const t of a){const e=this.pointRayIntersection(t);if(e.t<0)return!0;const i=this.rayIntersectionCoordinate(e);if(i.x<l||i.y<0||i.x>c||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+t.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new t.pointGeometry(0,0),new t.pointGeometry(this.width,this.height))}zoomDeltaToMovement(e,i){const r=t.length(t.sub([],this._camera.position,e)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const e=function(e,i){const r=[e[0],e[1],e[2],1];t.transformMat4$1(r,r,i);const n=Math.max(r[3],1e-6);return[r[0]/n,r[1]/n,r[2]/n,n]}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new t.pointGeometry(e[0],e[1])}{const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}}getCameraToCenterDistance(t){const e=Wr(t,this.zoom,this.width,this.height,1024),i=t.pixelSpaceConversion(this.center.lat,this.worldSize,e);return.5/Math.tan(.5*this._fov)*this.height*i}}function Jr(t,e){let i=!1,r=null;const n=()=>{r=null,i&&(t(),r=setTimeout(n,e),i=!1)};return()=>(i=!0,r||n(),r)}class Qr{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Jr(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),t.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const i=$r(e);if(this._hashName){const e=this._hashName;let r=!1;const n=t.window.location.hash.slice(1).split("&").map((t=>{const n=t.split("=")[0];return n===e?(r=!0,"".concat(n,"=").concat(i)):t})).filter((t=>t));return r||n.push("".concat(e,"=").concat(i)),"#".concat(n.join("&"))}return"#".concat(i)}_getCurrentHash(){const e=t.window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((t=>t.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const e=this._getCurrentHash();if(e.length>=3&&!e.some((t=>isNaN(t)))){const i=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(e[3]||0):t.getBearing();return t.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:i,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){const e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());t.window.history.replaceState(t.window.history.state,null,e)}}function $r(t,e){const i=t.getCenter(),r=Math.round(100*t.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=t.getBearing(),c=t.getPitch();let h=e?"/".concat(s,"/").concat(a,"/").concat(r):"".concat(r,"/").concat(a,"/").concat(s);return(l||c)&&(h+="/"+Math.round(10*l)/10),c&&(h+="/".concat(Math.round(c))),h}const tn={linearity:.3,easing:t.bezier(0,0,.3,1)},en=t.extend({deceleration:2500,maxSpeed:1400},tn),rn=t.extend({deceleration:20,maxSpeed:1400},tn),nn=t.extend({deceleration:1e3,maxSpeed:360},tn),on=t.extend({deceleration:1e3,maxSpeed:90},tn);class sn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=ln(i.pan.mag(),r,t.extend({},en,e||{}));n.offset=i.pan.mult(o.amount/i.pan.mag()),n.center=this._map.transform.center,an(n,o)}if(i.zoom){const t=ln(i.zoom,r,rn);n.zoom=this._map.transform.zoom+t.amount,an(n,t)}if(i.bearing){const e=ln(i.bearing,r,nn);n.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),an(n,e)}if(i.pitch){const t=ln(i.pitch,r,on);n.pitch=this._map.transform.pitch+t.amount,an(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function an(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function ln(e,i,r){const{maxSpeed:n,linearity:o,deceleration:s}=r,a=t.clamp(e*o/(i/1e3),-n,n),l=Math.abs(a)/(s*o);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class cn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=f(i.getCanvasContainer(),r),s=i.unproject(o);super(e,t.extend({point:o,lngLat:s,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class hn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){const n="touchend"===e?r.changedTouches:r.touches,o=m(i.getCanvasContainer(),n),s=o.map((t=>i.unproject(t))),a=o.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new t.pointGeometry(0,0));super(e,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class un extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class pn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new un(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new cn(t.type,this._map,t))}mouseup(t){this._map.fire(new cn(t.type,this._map,t))}preclick(e){const i=t.extend({},e);i.type="preclick",this._map.fire(new cn(i.type,this._map,i))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||(this.preclick(t),this._map.fire(new cn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new cn(t.type,this._map,t))}mouseover(t){this._map.fire(new cn(t.type,this._map,t))}mouseout(t){this._map.fire(new cn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new hn(t.type,this._map,t))}touchmove(t){this._map.fire(new hn(t.type,this._map,t))}touchend(t){this._map.fire(new hn(t.type,this._map,t))}touchcancel(t){this._map.fire(new hn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class dn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new cn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new cn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fn{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(h(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=o("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(r.x,i.x),s=Math.max(r.x,i.x),a=Math.min(r.y,i.y),l=Math.max(r.y,i.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform="translate(".concat(n,"px,").concat(a,"px)"),this._box.style.width=s-n+"px",this._box.style.height=l-a+"px")}))}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const r=this._startPos,n=i;if(this.reset(),d(),r.x!==n.x||r.y!==n.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),u(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function mn(t,e){const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class _n{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=mn(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=mn(i,e);for(const n in this.touches){const t=this.touches[n],e=r[n];(!e||e.dist(t)>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class gn{constructor(t){this.singleTap=new _n(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class yn{constructor(){this._zoomIn=new gn({numTouches:1,numTaps:2}),this._zoomOut=new gn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i);return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const xn={0:1,2:2};class vn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const i=_(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),null!=this._eventButton&&function(t,e){const i=xn[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(i,e)}mouseupWindow(t){this._lastPoint&&_(t)===this._eventButton&&(this._moved&&d(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bn extends vn{mousedown(t,e){super.mousedown(t,e),this._lastPoint&&(this._active=!0)}_correctButton(t,e){return 0===e&&!t.ctrlKey}_move(t,e){return{around:e,panDelta:e.sub(t)}}}class wn extends vn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(t){t.preventDefault()}}class Tn extends vn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(t){t.preventDefault()}}class En{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._minTouches=1,this._clickTolerance=i.clickTolerance||1,this.reset(),t.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new t.pointGeometry(0,0)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(e,i,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!t.isFullscreen())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return e.cancelable&&e.preventDefault(),this._calculateTransform(e,i,r)}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=mn(r,i),o=new t.pointGeometry(0,0),s=new t.pointGeometry(0,0);let a=0;for(const t in n){const e=n[t],i=this._touches[t];i&&(o._add(e),s._add(e.sub(i)),a++,n[t]=e)}if(this._touches=n,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}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=o("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize="".concat(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.setAttribute("role","null")}),500)}}class Sn{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,e,i){return{}}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){const r=this._firstTwoTouches;if(!r)return;t.preventDefault();const[n,o]=r,s=An(i,e,n),a=An(i,e,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=An(i,e,r),s=An(i,e,n);o&&s||(this._active&&d(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function An(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Mn(t,e){return Math.log(t/e)/Math.LN2}class In extends Sn{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Mn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Mn(this._distance,i),pinchAround:e}}}function Cn(t,e){return 180*t.angleWith(e)/Math.PI}class zn extends Sn{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Cn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Cn(t,this._startVector);return Math.abs(i)<e}}function Pn(t){return Math.abs(t.y)>Math.abs(t.x)}class kn extends Sn{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,Pn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){const r=this._lastPoints;if(!r)return;const n=t[0].sub(r[0]),o=t[1].sub(r[1]);return this._map._cooperativeGestures&&i.touches.length<3||(this._valid=this.gestureBeginsVertically(n,o,i.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+o.y)/2*-.5})}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Pn(t)&&Pn(e)&&o}}const Dn={panStep:100,bearingStep:15,pitchStep:10};class Ln{constructor(){const t=Dn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Bn,zoom:e?Math.round(a)+e*(t.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Bn(t){return t*(2-t)}const Rn=4.000244140625;class Fn{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(e.ctrlKey||e.metaKey||this.isZooming()||t.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const r=t.exported.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Rn==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){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);const e=f(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:e,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform,i=()=>e._terrainEnabled()&&this._aroundCoord?e.computeZoomRelativeTo(this._aroundCoord):e.zoom;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Rn?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==r&&(r=1/r);const n=i(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(s*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:i(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),i=o(e);s=t.number(n,r,i),e<1?this._frameId||(this._frameId=!0):a=!0}else s=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:s-i(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,r=(t.exported.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=t.bezier(o,s,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=o("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(t.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize="".concat(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.setAttribute("role","null")}),200)}}class On{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 Un{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vn{constructor(){this._tap=new gn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jn{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Nn{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}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 Gn{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(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()}}const Zn=t=>t.zoom||t.drag||t.pitch||t.rotate;class qn extends t.Event{}class Wn{constructor(){this.constants=[1,1,.01],this.radius=0}setup(e,i){const r=t.sub([],i,e);this.radius=t.length(r[2]<0?t.div([],r,this.constants):[r[0],r[1],0])}projectRay(e){t.div(e,e,this.constants),t.normalize(e,e),t.mul$1(e,e,this.constants);const i=t.scale$2([],e,this.radius);if(i[2]>0){const e=t.scale$2([],[0,0,1],t.dot(i,[0,0,1])),r=t.scale$2([],t.normalize([],[i[0],i[1],0]),this.radius),n=t.add([],i,t.scale$2([],t.sub([],t.add([],r,e),i),2));i[0]=n[0],i[1]=n[1]}return i}}function Xn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class Hn{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sn(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Wn,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[t.window,"blur",void 0]];for(const[n,o,s]of this._listeners)n.addEventListener(o,n===t.window.document?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(const[e,i,r]of this._listeners)e.removeEventListener(i,e===t.window.document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new pn(e,t));const r=e.boxZoom=new fn(e,t);this._add("boxZoom",r);const n=new yn,o=new Un;e.doubleClickZoom=new On(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new Vn;this._add("tapDragZoom",s);const a=e.touchPitch=new kn(e);this._add("touchPitch",a);const l=new wn(t),c=new Tn(t);e.dragRotate=new Nn(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const h=new bn(t),u=new En(e,t);e.dragPan=new jn(i,h,u),this._add("mousePan",h),this._add("touchPan",u,["touchZoom","touchRotate"]);const p=new zn,d=new In;e.touchZoomRotate=new Gn(i,d,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),this._add("blockableMapEvent",new dn(e));const f=e.scrollZoom=new Fn(e,this);this._add("scrollZoom",f,["mousePan"]);const m=e.keyboard=new Ln;this._add("keyboard",m);for(const _ of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[_]&&e[_].enable(t[_])}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Zn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,"".concat(t.type,"Window"))}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){this._updatingCamera=!0;const i="renderFrame"===t.type,r=i?void 0:t,n={needsRenderFrame:!1},o={},s={},a=t.touches?this._getMapTouches(t.touches):void 0,l=a?m(this._el,a):i?void 0:f(this._el,t);for(const{handlerName:u,handler:p,allowed:d}of this._handlers){if(!p.isEnabled())continue;let i;this._blockedByActive(s,d,u)?p.reset():p[e||t.type]&&(i=p[e||t.type](t,l,a),this.mergeHandlerResult(n,o,i,u,r),i&&i.needsRenderFrame&&this._triggerRe
1nderFrame()),(i||p.isActive())&&(s[u]=p)}const c={};for(const u in this._previousActiveHandlers)s[u]||(c[u]=r);this._previousActiveHandlers=s,(Object.keys(c).length||Xn(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||Xn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.extend(e,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.aroundCoord&&(e.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.extend(i,o),t.extend(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,i,r){const n=this._map,o=n.transform,s=t=>[t.x,t.y,t.z];if((t=>{const e=this._eventsInProgress.drag;return e&&!this._handlersById[e.handlerName].isActive()})()&&!Xn(e)){const t=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",t!==o.zoom&&this._map._update(!0)}if(!Xn(e))return void this._fireEvents(i,r,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:h,around:u,aroundCoord:p,pinchAround:d}=e;void 0!==d&&(u=d),(t=>i.drag&&!this._eventsInProgress.drag)()&&u&&(this._dragOrigin=s(o.pointCoordinate3D(u)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),u=u||n.transform.centerPoint,c&&(o.bearing+=c),h&&(o.pitch+=h),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(u).dir),e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(u.sub(a)).dir);f[0]=e[0]-t[0],f[1]=e[1]-t[1]}else{const e=o.pointCoordinate(u);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*t.mercatorScale(t.latFromMercatorY(e.y))*i,f[1]=-a.y*t.mercatorScale(o.center.lat)*i}else{const t=o.pointCoordinate(u.sub(a));e&&t&&(f[0]=t.x-e.x,f[1]=t.y-e.y)}}const m=o.zoom,_=[0,0,0];if(l){const e=s(p||o.pointCoordinate3D(u)),i={dir:t.normalize([],t.sub([],e,o._camera.position))};if(i.dir[2]<0){const r=o.zoomDeltaToMovement(e,l);t.scale$2(_,i.dir,r)}}const g=t.add(f,f,_);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,r,!0)}_fireEvents(e,i,r){const n=Zn(this._eventsInProgress),o=Zn(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s["".concat(t,"start")]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||r,a["".concat(t,"end")]=l)}for(const t in a)this._fireEvent(t,a[t]);const c=Zn(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{this._frameId=void 0,this.handleEvent(new qn("renderFrame",{timeStamp:t})),this._applyChanges()}))}
vendor: 16,566 bytes, line 1
1_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Yn="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Kn extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,r){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.extend({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,r){return this.easeTo(t.extend({zoom:e},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,r){return this.easeTo(t.extend({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(e,i){"globe"===this.transform.projection.name&&t.warnOnce('Globe projection does not support cameraForBounds API, this API may behave unexpectedly."'),e=t.LngLatBounds.convert(e);const r=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,i)}_extendCameraOptions(e){const i={top:0,bottom:0,right:0,left:0};if("number"==typeof(e=t.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},e)).padding){const t=e.padding;e.padding={top:t,bottom:t,right:t,left:t}}return e.padding=t.extend(i,e.padding),e}_cameraForBoxAndBearing(e,i,r,n){const o=this._extendCameraOptions(n),s=this.transform,a=s.padding,l=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(i)),h=new t.pointGeometry(l.x,c.y),u=new t.pointGeometry(c.x,l.y),p=-t.degToRad(r),d=l.rotate(p),f=c.rotate(p),m=h.rotate(p),_=u.rotate(p),g=new t.pointGeometry(Math.max(d.x,f.x,m.x,_.x),Math.max(d.y,f.y,m.y,_.y)),y=new t.pointGeometry(Math.min(d.x,f.x,m.x,_.x),Math.min(d.y,f.y,m.y,_.y)),x=g.sub(y),v=(s.width-((a.left||0)+(a.right||0)+o.padding.left+o.padding.right))/x.x,b=(s.height-((a.top||0)+(a.bottom||0)+o.padding.top+o.padding.bottom))/x.y;if(b<0||v<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const w=Math.min(s.scaleZoom(s.scale*Math.min(v,b)),o.maxZoom),T="number"==typeof o.offset.x&&"number"==typeof o.offset.y?new t.pointGeometry(o.offset.x,o.offset.y):t.pointGeometry.convert(o.offset),E=new t.pointGeometry((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(r*Math.PI/180),S=T.add(E).mult(s.scale/s.zoomScale(w));return{center:s.unproject(l.add(c).div(2).sub(S)),zoom:w,bearing:r}}_cameraForBox(e,i,r,n,o){const s=this._extendCameraOptions(o);r=r||0,n=n||0,e=t.LngLat.convert(e),i=t.LngLat.convert(i);const a=this.transform.clone();a.padding=s.padding;const l=this.getFreeCameraOptions(),c=new t.LngLat(.5*(e.lng+i.lng),.5*(e.lat+i.lat)),h=.5*(r+n);if(a._camera.position[2]<t.mercatorZfromAltitude(h,c.lat))return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");l.lookAtPoint(c),a.setFreeCameraOptions(l);const u=t.MercatorCoordinate.fromLngLat(e),p=t.MercatorCoordinate.fromLngLat(i),d=a.pointRayIntersection(a.centerPoint,h),f=[(m=a.rayIntersectionCoordinate(d)).x,m.y,m.z];var m;const _=a.screenPointToMercatorRay(a.centerPoint),g="globe"!==a.projection.name;let y,x=0;do{const i=Math.floor(a.zoom),o=1<<i,s=Math.min(o*u.x,o*p.x),l=Math.min(o*u.y,o*p.y),c=Math.max(o*u.x,o*p.x),h=Math.max(o*u.y,o*p.y),d=new t.Aabb([s,l,r],[c,h,n]),m=t.Frustum.fromInvProjectionMatrix(a.invProjMatrix,a.worldSize,i,g);if(2!==d.intersects(m)){y&&(a._camera.position=t.scaleAndAdd([],a._camera.position,_.dir,-y),a._updateStateFromCamera());break}const x=t.sub([],a._camera.position,f);y=.5*t.length(x),a._camera.position=t.scaleAndAdd([],a._camera.position,_.dir,y);try{a._updateStateFromCamera()}catch(e){return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}}while(++x<10);return{center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}fitBounds(e,i,r){return"globe"===this.transform.projection.name&&t.warnOnce("Globe projection does not support fitBounds API, this API may behave unexpectedly."),this._fitInternal(this.cameraForBounds(e,i),i,r)}_raycastElevationBox(e,i){const r=this.transform.elevation;if(!r)return;const n=new t.pointGeometry(e.x,i.y),o=new t.pointGeometry(i.x,e.y),s=r.pointCoordinate(e);if(!s)return;const a=r.pointCoordinate(i);if(!a)return;const l=r.pointCoordinate(n);if(!l)return;const c=r.pointCoordinate(o);if(!c)return;const h=new t.MercatorCoordinate(s[0],s[1]).toLngLat(),u=new t.MercatorCoordinate(a[0],a[1]).toLngLat(),p=new t.MercatorCoordinate(l[0],l[1]).toLngLat(),d=new t.MercatorCoordinate(c[0],c[1]).toLngLat(),f=Math.min(h.lng,Math.min(u.lng,Math.min(p.lng,d.lng))),m=Math.min(h.lat,Math.min(u.lat,Math.min(p.lat,d.lat))),_=Math.max(h.lng,Math.max(u.lng,Math.max(p.lng,d.lng))),g=Math.max(h.lat,Math.max(u.lat,Math.max(p.lat,d.lat))),y=Math.min(s[3],Math.min(a[3],Math.min(l[3],c[3]))),x=Math.max(s[3],Math.max(a[3],Math.max(l[3],c[3])));return{minLngLat:new t.LngLat(f,m),maxLngLat:new t.LngLat(_,g),minAltitude:y,maxAltitude:x}}fitScreenCoordinates(e,i,r,n,o){let s,a,l,c;"globe"===this.transform.projection.name&&t.warnOnce("Globe projection does not support fitScreenCoordinates API, this API may behave unexpectedly.");const h=t.pointGeometry.convert(e),u=t.pointGeometry.convert(i),p=this._raycastElevationBox(h,u);if(p)s=p.minLngLat,a=p.maxLngLat,l=p.minAltitude,c=p.maxAltitude;else{if(this.transform.anyCornerOffEdge(h,u))return this;s=this.transform.pointLocation(h),a=this.transform.pointLocation(u)}return this._fitInternal(0===this.transform.pitch?this._cameraForBoxAndBearing(this.transform.pointLocation(t.pointGeometry.convert(e)),this.transform.pointLocation(t.pointGeometry.convert(i)),r,n):this._cameraForBox(s,a,l,c,n),n,o)}_fitInternal(e,i,r){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop();const r=e.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(n=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(o=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(s=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),e.preloadOnly?(this._preloadTiles(r),this):(this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),n&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),s&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||t.warnOnce(Yn),this.transform.getFreeCameraOptions()}setFreeCameraOptions(e,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return t.warnOnce(Yn),this;this.stop();const n=r.zoom,o=r.pitch,s=r.bearing;r.setFreeCameraOptions(e);const a=n!==r.zoom,l=o!==r.pitch,c=s!==r.bearing;return this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),a&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),c&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),l&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i)),this}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?+e.zoom:n,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:s,u="padding"in e?e.padding:r.padding,p=t.pointGeometry.convert(e.offset);let d,f,m;if("globe"===r.projection.name){const i=t.MercatorCoordinate.fromLngLat(r.center),n=p.rotate(-r.angle);i.x+=n.x/r.worldSize,i.y+=n.y/r.worldSize;const o=i.toLngLat(),s=t.LngLat.convert(e.center||o);this._normalizeCenter(s),d=r.centerPoint.add(n),f=new t.pointGeometry(i.x,i.y).mult(r.worldSize),m=new t.pointGeometry(t.mercatorXfromLng(s.lng),t.mercatorYfromLat(s.lat)).mult(r.worldSize).sub(f)}else{d=r.centerPoint.add(p);const i=r.pointLocation(d),n=t.LngLat.convert(e.center||i);this._normalizeCenter(n),f=r.project(i),m=r.project(n).sub(f)}const _=r.zoomScale(l-n);let g,y;e.around&&(g=t.LngLat.convert(e.around),y=r.locationPoint(g));const x=this._zooming||l!==n,v=this._rotating||o!==c,b=this._pitching||h!==s,w=!r.isPaddingEqual(u),T=r=>T=>{if(x&&(r.zoom=t.number(n,l,T)),v&&(r.bearing=t.number(o,c,T)),b&&(r.pitch=t.number(s,h,T)),w&&(r.interpolatePadding(a,u,T),d=r.centerPoint.add(p)),g)r.setLocationAtPoint(g,y);else{const t=r.zoomScale(r.zoom-n),e=l>n?Math.min(2,_):Math.max(.5,_),i=Math.pow(e,1-T),o=r.unproject(f.add(m.mult(T*i)).mult(t));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,d)}return e.preloadOnly||this._fireMoveEvents(i),r};if(e.preloadOnly){const t=this._emulate(T,e.duration,r);return this._preloadTiles(t),this}const E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=v,this._pitching=b,this._padding=w,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,E),this._ease(T(r),(t=>{r.recenterOnTerrain(),this._afterEase(i,t)}),e),this}_prepareEase(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._moving=!0,this.transform.cameraElevationReference="sea",i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const r=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,r.minZoom,r.maxZoom):n,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:s,u="padding"in e?e.padding:r.padding,p=r.zoomScale(l-n),d=t.pointGeometry.convert(e.offset);let f=r.centerPoint.add(d);const m=r.pointLocation(f),_=t.LngLat.convert(e.center||m);this._normalizeCenter(_);const g=r.project(m),y=r.project(_).sub(g);let x=e.curve;const v=Math.max(r.width,r.height),b=v/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,n,l),r.minZoom,r.maxZoom),o=v/r.zoomScale(i-n);x=Math.sqrt(o/w*2)}const T=x*x;function E(t){const e=(b*b-v*v+(t?-1:1)*T*T*w*w)/(2*(t?b:v)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}const M=E(0);let I=function(t){return A(M)/A(M+x*t)},C=function(t){return v*((A(M)*(S(e=M+x*t)/A(e))-S(M))/T)/w;var e},z=(E(1)-M)/x;if(Math.abs(w)<1e-6||!isFinite(z)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,i);const t=b<v?-1:1;z=Math.abs(Math.log(b/v))/x,C=function(){return 0},I=function(e){return Math.exp(t*x*e)}}e.duration="duration"in e?+e.duration:1e3*z/("screenSpeed"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0);const P=o!==c,k=h!==s,D=!r.isPaddingEqual(u),L=r=>p=>{const m=p*z,x=1/I(m);r.zoom=1===p?l:n+r.scaleZoom(x),P&&(r.bearing=t.number(o,c,p)),k&&(r.pitch=t.number(s,h,p)),D&&(r.interpolatePadding(a,u,p),f=r.centerPoint.add(d));const v=1===p?_:r.unproject(g.add(y.mult(C(m))).mult(x));return r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,f),r._updateCameraOnTerrain(),e.preloadOnly||this._fireMoveEvents(i),r};if(e.preloadOnly){const t=this._emulate(L,e.duration,r);return this._preloadTiles(t),this}return this._zooming=!0,this._rotating=P,this._pitching=k,this._padding=D,this._prepareEase(i,!1),this._ease(L(r),(()=>this._afterEase(i)),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const t=this._onEaseEnd;this._onEaseEnd=void 0,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.maxBounds)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}_emulate(t,e,i){const r=Math.ceil(15*e/1e3),n=[],o=t(i.clone());for(let s=0;s<=r;s++){const t=o(s/r);n.push(t.clone())}return n}}class Jn{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const e=this.options&&this.options.compact;return this._map=t,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o("button","mapboxgl-ctrl-attrib-button",this._container),o("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=o("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&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===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString("AttributionControl.".concat(e));t.setAttribute("aria-label",i),t.removeAttribute("title"),t.firstElementChild&&t.firstElementChild.setAttribute("title",i)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
1se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){const r=i.reduce(((t,e,r)=>(e.value&&(t+="".concat(e.key,"=").concat(e.value).concat(r<i.length-1?"&":"")),t)),"?");e.href="".concat(t.config.FEEDBACK_URL,"/").concat(r,"#").concat($r(this._map,!0)),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style._sourceCaches;for(const r in e){const i=e[r];if(i.used){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,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 Qn{constructor(){t.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=o("div","mapboxgl-ctrl");const e=o("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(0===Object.entries(t).length)return!0;for(const e in t){const i=t[e].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}}}class $n{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const r of i)if(r.id===t)return void(r.cancelled=!0)}run(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function to(e,i,r){if(e=new t.LngLat(e.lng,e.lat),i){const n=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),s=360*Math.ceil(Math.abs(e.lng-r.center.lng)/360),a=r.locationPoint(e).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint(n).distSqr(i)<a&&(l||Math.abs(n.lng-r.center.lng)<s)?e=n:r.locationPoint(o).distSqr(i)<a&&(l||Math.abs(o.lng-r.center.lng)<s)&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}
vendor: 4,501 bytes, line 1
1const eo={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 io extends t.Evented{constructor(e,i){if(super(),(e instanceof t.window.HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=o("div");const i=41,r=27,n=s("svg",{display:"block",height:i*this._scale+"px",width:r*this._scale+"px",viewBox:"0 0 ".concat(r," ").concat(i)},this._element),a=s("radialGradient",{id:"shadowGradient"},s("defs",{},n));s("stop",{offset:"10%","stop-opacity":.4},a),s("stop",{offset:"100%","stop-opacity":.05},a),s("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n),s("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"},n),s("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"},n),s("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()}));const r=this._element.classList;for(const t in eo)r.remove("mapboxgl-marker-anchor-".concat(t));r.add("mapboxgl-marker-anchor-".concat(this._anchor)),this._popup=null}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(t){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")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,t._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","fal
1se")}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map;if(!t)return!1;const e=t.unproject(this._pos),i=t.getFreeCameraOptions();if(!i.position)return!1;const r=i.position.toLngLat();return r.distanceTo(e)<.9*r.distanceTo(this._lngLat)}_evaluateOpacity(){const e=this._map;if(!e)return;const i=this._pos;if(!i||i.x<0||i.x>e.transform.width||i.y<0||i.y>e.transform.height)return void this._clearFadeTimer();const r=e.unproject(i);let n;e._showingGlobe()&&t.isLngLatBehindGlobe(e.transform,this._lngLat)?n=0:(n=1-e._queryFogOpacity(r),e.transform._terrainEnabled()&&e.getTerrain()&&this._behindTerrain()&&(n*=.2)),this._element.style.opacity="".concat(n),this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const e=this._offset.mult(this._scale);this._element.style.transform="\n translate(".concat(t.x,"px,").concat(t.y,"px)\n ").concat(eo[this._anchor],"\n ").concat(this._calculateXYTransform()," ").concat(this._calculateZTransform(),"\n translate(").concat(e.x,"px,").concat(e.y,"px)\n ")}_calculateXYTransform(){const e=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!e||"map"!==r)return"";if(!i._showingGlobe()){const t=i.getPitch();return t?"rotateX(".concat(t,"deg)"):""}const n=t.radToDeg(t.globeTiltAtLngLat(i.transform,this._lngLat)),o=e.sub(t.globeCenterToScreenPoint(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return"rotateX(".concat(-o.y*a,"deg) rotateY(").concat(o.x*a,"deg)")}_calculateZTransform(){const e=this._pos,i=this._map;if(!i||!e)return"";let r=0;const n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){const e=i.project(new t.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),n=i.project(new t.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(e);r=t.radToDeg(Math.atan2(n.y,n.x))-90}else r=-i.getBearing();else if("horizon"===n){const n=t.smoothstep(4,6,i.getZoom()),o=t.globeCenterToScreenPoint(i.transform);o.y+=n*i.transform.height;const s=e.sub(o),a=t.radToDeg(Math.atan2(s.y,s.x));r=(a>90?a-270:a+90)*(1-n)}return r+=this._rotation,r?"rotateZ(".concat(r,"deg)"):""}_update(e){t.window.cancelAnimationFrame(this._updateFrameId);const i=this._map;
vendor: 4,185 bytes, line 1
1i&&(i.transform.renderWorldCopies&&(this._lngLat=to(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===e?this._updateFrameId=t.window.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(e){return this._offset=t.pointGeometry.convert(e),this._update(),this}_onMove(e){const i=this._map;if(i){if(!this._isDragging){const t=this._clickTolerance||i._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const e=this._map;e&&(e.off("mousemove",this._onMove),e.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"}_addDragHandler(t){const e=this._map;e&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos),this._pointerdownPos=t.point,this._state="pending",e.on("mousemove",this._onMove),e.on("touchmove",this._onMove),e.once("mouseup",this._onUp),e.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const e=this._map;return e&&(t?(e.on("mousedown",this._addDragHandler),e.on("touchstart",this._addDragHandler)):(e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}}class ro{constructor(t){this.jumpTo(t)}getValue(e){if(e<=this._startTime)return this._start;if(e>=this._endTime)return this._end;const i=t.easeCubicInOut((e-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,e,i){this._start=this.getValue(e),this._end=t,this._startTime=e,this._endTime=e+i}}const no={"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 \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},oo={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,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
1acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function so(t){t.parentNode&&t.parentNode.removeChild(t)}const ao={showCompass:!0,showZoom:!0,visualizePitch:!1};class lo{constructor(e,i){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._clickTolerance=10,this.element=i,this.mouseRotate=new wn({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,r&&(this.mousePitch=new Tn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),h()}move(t,e){const i=this.map,r=this.mouseRotate.mousemoveWindow(t,e),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(t,e),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart,{passive:!1}),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){u(),t.window.removeEventListener("mousemove",this.mousemove),t.window.removeEventListener("mouseup",this.mouseup)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),f(this.element,e)),t.window.addEventListener("mousemove",this.mousemove),t.window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,f(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=m(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=m(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.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()}}const co={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},ho={maxWidth:100,unit:"metric"};function uo(t,e,i){const r=po(e),n=r/e,o={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[i];this._map._requestDomTask((()=>{this._container.style.width=t*n+"px",this._container.innerHTML="".concat(r," ").concat(o)}))}function po(t){const e=Math.pow(10,"".concat(Math.floor(t)).length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}const fo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},mo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function _o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new t.pointGeometry(0,0),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom";if("number"==typeof e){const r=Math.round(Math.sqrt(.5*Math.pow(e,2)));switch(i){case"top":return new t.pointGeometry(0,e);case"top-left":return new t.pointGeometry(r,r);case"top-right":return new t.pointGeometry(-r,r);case"bottom":return new t.pointGeometry(0,-e);case"bottom-left":return new t.pointGeometry(r,-r);case"bottom-right":return new t.pointGeometry(-r,-r);case"left":return new t.pointGeometry(e,0);case"right":return new t.pointGeometry(-e,0)}return new t.pointGeometry(0,0)}return e instanceof t.pointGeometry||Array.isArray(e)?t.pointGeometry.convert(e):t.pointGeometry.convert(e[i]||[0,0])}const go={version:t.version,supported:i,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends Kn{constructor(e){if(null!=(e=t.extend({}
vendor: 4,703 bytes, line 1
1,oo,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(e.antialias&&t.isSafariWithAntialiasingBug(t.window)&&(e.antialias=!1,t.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Kr(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),e),this._interactive=e.interactive,this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._optimizeForTerrain=e.optimizeForTerrain,this._language="auto"===e.language?t.window.navigator.language:e.language,this._worldview=e.worldview,this._renderTaskQueue=new $n,this._domRenderTaskQueue=new $n,this._controls=[],this._markers=[],this._mapId=t.uniqueId(),this._locale=t.extend({},no,e.locale),this._clickTolerance=e.clickTolerance,this._cooperativeGestures=e.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ro(0),this._useExplicitProjection=!1,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken,e.testMode),this._silenceAuthErrors=!!e.testMode,"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '".concat(e.container,"' not found."))}else{if(!(e.container instanceof t.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(this._container.childNodes.length>0&&t.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1),t.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new Hn(this,e),this._localFontFamily=e.localFontFamily,this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),e.projection&&this.setProjection(e.projection),this._hash=e.hash&&new Qr("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),e.attributionControl&&this.addControl(new Jn({customAttribution:e.customAttribution})),this._logoControl=new Qn,this.addControl(this._logoControl,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event("".concat(e.dataType,"data"),e))})),this.on("dataloading",(e=>{this.fire(new t.Event("".concat(e.dataType,"dataloading"),e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];
1return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(e){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));const i=!this._moving;return i&&this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)),this.fire(new t.Event("resize",e)),i&&this.fire(new t.Event("moveend",e)),this}getBounds(){return"globe"===this.transform.projection.name&&t.warnOnce('Globe projection does not support getBounds API, this API may behave unexpectedly."'),this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e?this.setZoom(e):this.fire(new t.Event("zoomstart")).fire(new t.Event("zoom")).fire(new t.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e?this.setZoom(e):this.fire(new t.Event("zoomstart")).fire(new t.Event("zoom")).fire(new t.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e?this.setPitch(e):this.fire(new t.Event("pitchstart")).fire(new t.Event("pitch")).fire(new t.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?85:e)>85)throw new Error("maxPitch must be less than or equal to 85");if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e?this.setPitch(e):this.fire(new t.Event("pitchstart")).fire(new t.Event("pitch")).fire(new t.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getLanguage(){return this._language}setLanguage(e){if(this._language="auto"===e?t.window.navigator.language:e,this.style)for(const t in this.style._sourceCaches){const e=this.style._sourceCaches[t]._source;e._setLanguage&&e._setLanguage(this._language)}for(const t of this._controls)t._setLanguage&&t._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(t){if(this._worldview=t,this.style)for(const e in this.style._sourceCaches){const i=this.style._sourceCaches[e]._source;i._setWorldview&&i._setWorldview(t)}return this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(t){return this._lazyInitEmptyStyle(),t?"string"==typeof t&&(t={name:t}):t=null,this._useExplicitProjection=!!t,this._prioritizeAndUpdateProjection(t,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const e=this.transform,i=e.projection.name;let r;"globe"===i&&e.zoom>=t.GLOBE_ZOOM_THRESHOLD_MAX?(e.setMercatorFromTransition(),r=!0):"mercator"===i&&e.zoom<t.GLOBE_ZOOM_THRESHOLD_MAX&&(e.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
vendor: 10,534 bytes, line 1
1Update())}_prioritizeAndUpdateProjection(t,e){return this._updateProjection(t||e||{name:"mercator"})}_updateProjection(e){let i;if(i="globe"===e.name&&this.transform.zoom>=t.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(e),this.style.applyProjectionUpdate(),i){this.painter.clearBackgroundTiles();for(const t in this.style._sourceCaches)this.style._sourceCaches[t].clearTiles();this._update(!0)}return this}project(e){return this.transform.locationPoint3D(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation3D(t.pointGeometry.convert(e))}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}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t))),s=o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?r||(r=!0,i.call(this,new cn(t,this,n.originalEvent,{features:s}))):r=!1},o=()=>{r=!1};return{layers:new Set(e),listener:i,delegates:{mousemove:n,mouseout:o}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t)));(o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new cn(t,this,n.originalEvent)))},o=e=>{r&&(r=!1,i.call(this,new cn(t,this,e.originalEvent)))};return{layers:new Set(e),listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=t=>{const r=e.filter((t=>this.getLayer(t))),n=r.length?this.queryRenderedFeatures(t.point,{layers:r}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layers:new Set(e),listener:i,delegates:{[t]:r}}}}on(t,e,i){if(void 0===i)return super.on(t,e);Array.isArray(e)||(e=[e]);const r=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r);for(const n in r.delegates)this.on(n,r.delegates[n]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);Array.isArray(e)||(e=[e]);const r=this._createDelegatedListener(t,e,i);for(const n in r.delegates)this.once(n,r.delegates[n]);return this}off(t,e,i){if(void 0===i)return super.off(t,e);e=new Set(Array.isArray(e)?e:[e]);const r=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},n=this._delegatedListeners?this._delegatedListeners[t]:void 0;return n&&(t=>{for(let n=0;n<t.length;n++){const o=t[n];if(o.listener===i&&r(o.layers,e)){for(const t in o.delegates)this.off(t,o.delegates[t]);return t.splice(n,1),this}}})(n),this}queryRenderedFeatures(e,i){return this.style?(void 0!==i||void 0===e||e instanceof t.pointGeometry||Array.isArray(e)||(i=e,e=void 0),this.style.queryRenderedFeatures(e=e||[[0,0],[this.transform.width,this.transform.height]],i=i||{},this.transform)):[]}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}queryTerrainElevation(e,i){const r=this.transform.elevation;return r?(i=t.extend({},{exaggerated:!0},i),r.getAtPoint(t.MercatorCoordinate.fromLngLat(e),null,i.exaggerated)):null}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&i.localFontFamily===this._localFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(e,i))}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error("Missing UI string '".concat(t,"'"));return e}_updateStyle(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t&&(this.style=new ti(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ti(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.normalizeStyleURL(e),n=this._requestManager.transformRequest(r,t.ResourceType.Style);t.getJSON(n,((e,r)=>{e?this.fire(new t.ErrorEvent(e)):r&&this._updateDiff(r,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0)}catch(r){t.warnOnce("Unable to perform style diff: ".concat(r.message||r.error||r,". Rebuilding the style from scratch.")),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(t.warnOnce("There is no style added to the map."),!1)}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){return!!this.style&&this.style._isSourceCacheLoaded(t)}areTilesLoaded(){const t=this.style&&this.style._sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._updateTerrain(),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i){let{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._lazyInitEmptyStyle(),i instanceof t.window.HTMLImageElement||t.window.ImageBitmap&&i instanceof t.window.ImageBitmap){const{width:l,height:c,data:h}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},h),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=i,h=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(h.data)),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return void this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof t.window.HTMLImageElement||t.window.ImageBitmap&&i instanceof t.window.ImageBitmap?t.exported.getImageData(i):i,{width:o,height:s}=n;void 0!==o&&void 0!==s?o===r.data.width&&s===r.data.height?(r.data.replace(n.data,!(i instanceof t.window.HTMLImageElement||t.window.ImageBitmap&&i instanceof t.window.ImageBitmap)),this.style.updateImage(e,r)):this.fire(new t.ErrorEvent(new Error("The width and height of the updated image (".concat(o,", ").concat(s,")\n must be that same as the previous version of the image\n (").concat(r.data.width,", ").concat(r.data.height,")")))):this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),((e,r)=>{i(e,r instanceof t.window.HTMLImageElement?t.exported.getImageData(r):r)}))}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(t){return this._lazyInitEmptyStyle(),!t&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(t),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(t){return this._lazyInitEmptyStyle(),this.style.setFog(t),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(e){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(t.LngLat.convert(e),this.transform):0}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let r,n,o,s=this._container;for(;s&&(!n||!o);){const e=t.window.getComputedStyle(s).transform;e&&"none"!==e&&(r=e.match(/matrix.*\((.+)\)/)[1].split(", "),r[0]&&"0"!==r[0]&&"1"!==r[0]&&(n=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(o=r[3])),s=s.parentElement}this._containerWidth=n?Math.abs(e/n):e,this._containerHeight=o?Math.abs(i/o):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("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
1in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=o("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();const e=this._canvasContainer=o("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=o("canvas","mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=o("div","mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=o("div","mapboxgl-ctrl-".concat(t),i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,i){const r=t.exported.devicePixelRatio||1;this._canvas.width=r*Math.ceil(e),this._canvas.height=r*Math.ceil(i),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(i,"px")}_addMarker(t){this._markers.push(t)}_removeMarker(t){const e=this._markers.indexOf(t);-1!==e&&this._markers.splice(e,1)}_setupPainter(){const e=t.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",e)||this._canvas.getContext("experimental-webgl",e);r?(t.storeAuthState(r,!0),this.painter=new Fr(r,this.transform),this.on("data",(t=>{"source"===t.dataType&&this.painter.setTileLoadedFlag(!0)})),t.exported$1.testSupport(r)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.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(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_requestDomTask(t){!this.loaded()||this.loaded()&&!this.isMoving()?t():this._domRenderTaskQueue.add(t)}_render(e){let i;const r=this.painter.context.extTimerQuery,n=t.exported.now();if(this.listens("gpu-timing-frame")&&(i=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),this._removed)return;this._updateProjectionTransition();let o=!1;const s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=this.transform.pitch,r=t.exported.now();this.style.zoomHistory.update(e,r);const n=new t.EvaluationParameters(e,{now:r,fadeDuration:s,pitch:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=n.crossFadingFactor();1===a&&a===this._crossFadingFactor||(o=!0,this._crossFadingFactor=a),this.style.update(n)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(n),this.style._updateSources(this.transform),this._forceMarkerUpdate()):a=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,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const e=t.exported.now()-n;r.endQueryEXT(r.TIME_ELAPSED_EXT,i),setTimeout((()=>{const o=r.getQueryObjectEXT(i,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:o})),t.window.performance.mark("frame-gpu",{startTime:n,detail:{gpuTime:o}})}),50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const e=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(e);this.fire(new t.Event("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const l=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(l||this._repaint)this.triggerRepaint();else{const e=!this.isMoving()&&this.loaded();if(e&&(a=this._updateAverageElevation(n,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),e&&(this.fire(new t.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const e=this._calculateSpeedIndex();this.fire(new t.Event("speedindexcompleted",{speedIndex:e})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||l||(this._fullyLoaded=!0,this._authenticate())}
vendor: 15,231 bytes, line 1
1_forceMarkerUpdate(){for(const t of this._markers)t._update()}_updateAverageElevation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=t=>(this.transform.averageElevation=t,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);if((e||t-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(t)){const e=this.transform.averageElevation;let r=this.transform.sampleAverageElevation(),n=!1;this.transform.elevation&&(n=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(r)?r=0:this._averageElevationLastSampledAt=t;const o=Math.abs(e-r);if(o>1){if(this._isInitialLoad||n)return this._averageElevation.jumpTo(r),i(r);this._averageElevation.easeTo(r,t,300)}else if(o>1e-4)return this._averageElevation.jumpTo(r),i(r)}return!!this._averageElevation.isEasing(t)&&i(this._averageElevation.getValue(t))}_authenticate(){t.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(e=>{if(e&&(e.message===t.AUTH_ERR_MSG||401===e.status)){const e=this.painter.context.gl;t.storeAuthState(e,!1),this._logoControl instanceof Qn&&this._logoControl._updateLogo(),e&&e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT|e.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new t.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),t.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const t=this.painter.canvasCopy(),e=this.painter.getCanvasCopiesAndTimestamps();e.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(t){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0);const e=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,e),e}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(t),e.canvasCopies.map(n),e.timeStamps)}_canvasPixelComparison(t,e,i){let r=i[1]-i[0];const n=t.length/4;for(let o=0;o<e.length;o++){const s=e[o];let a=0;for(let e=0;e<s.length;e+=4)s[e]===t[e]&&s[e+1]===t[e+1]&&s[e+2]===t[e+2]&&s[e+3]===t[e+3]&&(a+=1);r+=(i[o+2]-i[o+1])*(1-a/n)}return r}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.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),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),so(this._canvasContainer),so(this._controlContainer),so(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),t.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(e){this._renderNextFrame=this._renderNextFrame||e,this.style&&!this._frame&&(this._frame=t.exported.frame((t=>{const e=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,e&&this._render(t)})))}_preloadTiles(e){const i=this.style?Object.values(this.style._sourceCaches):[];return t.asyncAll(i,((t,i)=>t._preloadTiles(e,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(t){this._showTerrainWireframe!==t&&(this._showTerrainWireframe=t,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(t){this._speedIndexTiming!==t&&(this._speedIndexTiming=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}_setCacheLimits(e,i){t.setCacheLimits(e,i)}get version(){return t.version}},NavigationControl:class{constructor(e){this.options=t.extend({},ao,e),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(t=>{this._map&&this._map.zoomIn({},{originalEvent:t})})),o("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(t=>{this._map&&this._map.zoomOut({},{originalEvent:t})})),o("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(t=>{const e=this._map;e&&(this.options.visualizePitch?e.resetNorthPitch({},{originalEvent:t}):e.resetNorth({},{originalEvent:t}))})),this._compassIcon=o("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const t=this._map;if(!t)return;const e=t.getZoom(),i=e===t.getMaxZoom(),r=e===t.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const t=this._map;if(!t)return;const e=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(t.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(t.transform.pitch,"deg) rotateZ(").concat(t.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(t.transform.angle*(180/Math.PI),"deg)");t._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=e)}))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),t.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&t.on("pitch",this._rotateCompassArrow),t.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new lo(t,this._compass,this.options.visualizePitch)),this._container}onRemove(){const t=this._map;t&&(this._container.remove(),this.options.showZoom&&t.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&t.off("pitch",this._rotateCompassArrow),t.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(t,e){const i=o("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){if(!this._map)return;const i=this._map._getUIString("NavigationControl.".concat(e));t.setAttribute("aria-label",i),t.firstElementChild&&t.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({geolocation:t.window.navigator.geolocation},co,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Jr(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(t){return this._map=t,this._container=o("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){void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((t=>{this._supportsGeolocation="denied"!==t.state,e(this._supportsGeolocation)})):(this._supportsGeolocation=!!this.options.geolocation,e(this._supportsGeolocation))}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return!!e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.extend({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const e=this._map.transform,i=t.mercatorZfromAltitude(1,e._center.lat)*e.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width="".concat(r,"px"),this._circleElement.style.height="".concat(r,"px")}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.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;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=o("button","mapboxgl-ctrl-geolocate",this._container),o("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o("div","mapboxgl-user-location"),this._dotElement.appendChild(o("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(o("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new io({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=o("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new io({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",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}_onDeviceOrientation(t){this._userLocationDotMarker&&(t.webkitCompassHeading?this._heading=t.webkitCompassHeading:!0===t.absolute&&(this._heading=-1*t.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return t.warnOnce("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 t.Event("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 t.Event("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 t.Event("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 t;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(t={maximumAge:6e5,timeout:0},this._noTimeout=!0):(t=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,t),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(){const e=()=>{t.window.addEventListener("ondeviceorientationabsolute"in t.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==t.window.DeviceMotionEvent&&"function"==typeof t.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),t.window.removeEventListener("deviceorientation",this._onDeviceOrientation),t.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Jn,ScaleControl:class{constructor(e){this.options=t.extend({},ho,e),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(t){return!1}}()||(this._setScale=uo.bind(this)),t.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const t=this.options.maxWidth||100,e=this._map,i=e._containerHeight/2,r=e._containerWidth/2-t/2,n=e.unproject([r,i]),o=e.unproject([r+t,i]),s=n.distanceTo(o);if("imperial"===this.options.unit){const e=3.2808*s;e>5280?this._setScale(t,e/5280,"mile"):this._setScale(t,e,"foot")}else"nautical"===this.options.unit?this._setScale(t,s/1852,"nautical-mile"):s>=1e3?this._setScale(t,s/1e3,"kilometer"):this._setScale(t,s,"meter")}_setScale(t,e,i){const r=po(e),n=r/e;this._map._requestDomTask((()=>{this._container.style.width=t*n+"px",this._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:i}).format(r):"".concat(r," nm")}))}onAdd(t){return this._map=t,this._language=t.getLanguage(),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.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(t){this._language=t,this._update()}setUnit(t){this.options.unit=t,this._update()}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in t.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!t.window.document.fullscreenEnabled&&!t.window.document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=o("button","mapboxgl-ctrl-fullscreen",this._controlContainer);o("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",t)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(t.window.document.fullscreenElement||t.window.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()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(fo),e),t.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(e&&e.className?e.className.trim().split(/\s+/):[])}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&e.on("preclick",this._onClose),this.options.closeOnMove&&e.on("move",this._onClose),e.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(e.on("mousemove",this._onMouseEvent),e.on("mouseup",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")):e.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const e=this._map;return e&&(e.off("move",this._update),e.off("move",this._onClose),e.off("preclick",this._onClose),e.off("click",this._onClose),e.off("remove",this.remove),e.off("mousemove",this._onMouseEvent),e.off("mouseup",this._onMouseEvent),e.off("drag",this._onMouseEvent),this._map=void 0),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}
vendor: 4,876 bytes, lines 1-2
1setLngLat(e){this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const t=this._map;return t&&(t.off("move",this._update),t.on("mousemove",this._onMouseEvent),t.on("drag",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(t.window.document.createTextNode(e))}setHTML(e){const i=t.window.document.createDocumentFragment(),r=t.window.document.createElement("body");let n;for(r.innerHTML=e;n=r.firstChild,n;)i.appendChild(n);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){let e=this._content;if(e)for(;e.hasChildNodes();)e.firstChild&&e.removeChild(e.firstChild);else e=this._content=o("div","mapboxgl-popup-content",this._container||void 0);if(e.appendChild(t),this.options.closeButton){const t=this._closeButton=o("button","mapboxgl-popup-close-button",e);t.type="button",t.setAttribute("aria-label","Close popup"),t.setAttribute("aria-hidden","true"),t.innerHTML="×",t.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(t){return this._classList.add(t),this._updateClassList(),this}removeClassName(t){return this._classList.delete(t),this._updateClassList(),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){let e;return this._classList.delete(t)?e=!1:(this._classList.add(t),e=!0),this._updateClassList(),e}_onMouseEvent(t){this._update(t.point)}_getAnchor(t){if(this.options.anchor)return this.options.anchor;const e=this._map,i=this._container,r=this._pos;if(!e||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,s=r.x<n/2,a=r.x>e.transform.width-n/2;if(r.y+t<o)return s?"top-left":a?"top-right":"top";if(r.y>e.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const t=this._container;if(!t)return;const e=[...this._classList];e.push("mapboxgl-popup"),this._anchor&&e.push("mapboxgl-popup-anchor-".concat(this._anchor)),this._trackPointer&&e.push("mapboxgl-popup-track-pointer"),t.className=e.join(" ")}_update(e){const i=this._map,r=this._content;if(!i||!this._lngLat&&!this._trackPointer||!r)return;let n=this._container;if(n||(n=this._container=o("div","mapboxgl-popup",i.getContainer()),this._tip=o("div","mapboxgl-popup-tip",n),n.appendChild(r)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=to(this._lngLat,this._pos,i.transform)),!this._trackPointer||e){const t=this._pos=this._trackPointer&&e?e:i.project(this._lngLat),r=_o(this.options.offset),n=this._anchor=this._getAnchor(r.y),o=_o(this.options.offset,n),s=t.add(o).round();i._requestDomTask((()=>{this._container&&n&&(this._container.style.transform="".concat(eo[n]," translate(").concat(s.x,"px,").concat(s.y,"px)"))}))}if(!this._marker&&i._showingGlobe()){const e=t.isLngLatBehindGlobe(i.transform,this._lngLat)?0:1;this._setOpacity(e)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(mo);t&&t.focus()}_onClose(){this.remove()}_setOpacity(t){this._container&&(this._container.style.opacity="".concat(t)),this._content&&(this._content.style.pointerEvents=t?"auto":"none")}},Marker:io,Style:ti,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,FreeCameraOptions:Nr,Evented:t.Evented,config:t.config,prewarm:function(){jt().acquire(Ot)},clearPrewarmedResources:function(){const t=Vt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Ot),Vt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Ut.workerCount},set workerCount(t){Ut.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",workerClass:null,setNow:t.exported.setNow,restoreNow:t.exported.restoreNow};return go})),i}()}}]); 2//# sourceMappingURL=483.88fd47c3.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.