PageSourceSearch

https://www.terrainscouts.com/Scripts/mapbox-gl/mapbox-gl.js?version=3.0.1

js terrainscouts.com collected 2026-10-08 10:29:35 UTC 1,475,543 bytes, 54 lines download raw bytes

1/* Mapbox GL JS is Copyright © 2020 Mapbox and subject to the Mapbox Terms of Service ((https://www.mapbox.com/legal/tos/). */
2(function (global, factory) {
3    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4        typeof define === 'function' && define.amd ? define(factory) :
5            (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mapboxgl = factory());
6})(this, (function () {
7    'use strict';
8
9    /* eslint-disable */
10
11    var shared, worker, mapboxgl;
12    // define gets called three times: one for each chunk. we rely on the order
13    // they're imported to know which is which
14    function define(_, chunk) {
15        if (!shared) {
16            shared = chunk;
17        } else if (!worker) {
18            worker = chunk;
19        } else {
20            var workerBundleString = "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 = {}; (" + shared + ")(sharedChunk); (" + worker + ")(sharedChunk); self.onerror = null;"
21
22            var sharedChunk = {};
23            shared(sharedChunk);
24            mapboxgl = chunk(sharedChunk);
25            if (typeof window !== 'undefined' && window && window.URL && window.URL.createObjectURL) {
26                mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));
27            }
28        }
29    }
30
31
32    define(["exports"], (function (t) {
33        "use strict"; var e = "3.2.0"; let r; const n = { API_URL: "https://api.mapbox.com", get API_URL_REGEX() { if (null == r) { const t = /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i; try { r = null != process.env.API_URL_REGEX ? new RegExp(process.env.API_URL_REGEX) : t; } catch (e) { r = t; } } return r }, get API_TILEJSON_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i }, get API_SPRITE_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i }, get API_FONTS_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i }, get API_STYLE_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i }, get API_CDN_URL_REGEX() { return /^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i }, get EVENTS_URL() { if (!n.API_URL) return null; try { const t = new URL(n.API_URL); return "api.mapbox.cn" === t.hostname ? "https://events.mapbox.cn/events/v2" : "api.mapbox.com" === t.hostname ? "https://events.mapbox.com/events/v2" : null } catch (t) { return null } }, SESSION_PATH: "/map-sessions/v1", FEEDBACK_URL: "https://apps.mapbox.com/feedback", TILE_URL_VERSION: "v4", RASTER_URL_PREFIX: "raster/v1", REQUIRE_ACCESS_TOKEN: !0, ACCESS_TOKEN: null, DEFAULT_STYLE: "mapbox://styles/mapbox/standard", MAX_PARALLEL_IMAGE_REQUESTS: 16, DRACO_URL: "https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm", GLYPHS_URL: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf" }, i = { supported: !1, testSupport: function (t) { !o && a && (l ? c(t) : s = t); } }; let s, a, o = !1, l = !1; const u = "undefined" != typeof self ? self : {}; function c(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, a), t.isContextLost()) return; i.supported = !0; } catch (t) { } t.deleteTexture(e), o = !0; } u.document && (a = u.document.createElement("img"), a.onload = function () { s && c(s), s = null, l = !0; }, a.onerror = function () { o = !0, s = null; }, a.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="); const h = "01"; function p(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t } var f = d; function d(t, e, r, n) { this.cx = 3 * t, this.bx = 3 * (r - t) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e, this.by = 3 * (n - e) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t, this.p1y = e, this.p2x = r, this.p2y = n; } d.prototype = { sampleCurveX: function (t) { return ((this.ax * t + this.bx) * t + this.cx) * t }, sampleCurveY: function (t) { return ((this.ay * t + this.by) * t + this.cy) * t }, sampleCurveDerivativeX: function (t) { return (3 * this.ax * t + 2 * this.bx) * t + this.cx }, solveCurveX: function (t, e) { if (void 0 === e && (e = 1e-6), t < 0) return 0; if (t > 1) return 1; for (var r = t, n = 0; n < 8; n++) { var i = this.sampleCurveX(r) - t; if (Math.abs(i) < e) return r; var s = this.sampleCurveDerivativeX(r); if (Math.abs(s) < 1e-6) break; r -= i / s; } var a = 0, o = 1; for (r = t, n = 0; n < 20 && (i = this.sampleCurveX(r), !(Math.abs(i - t) < e)); n++)t > i ? a = r : o = r, r = .5 * (o - a) + a; return r }
vendor: 2,310 bytes, line 33
33, solve: function (t, e) { return this.sampleCurveY(this.solveCurveX(t, e)) } }; var m = p(f), y = g; function g(t, e) { this.x = t, this.y = e; } g.prototype = { clone: function () { return new g(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, r = t.y - this.y; return e * e + r * r }, 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), r = Math.sin(t), n = r * this.x + e * this.y; return this.x = e * this.x - r * this.y, this.y = n, this }
vendor: 2,409 bytes, line 33
33, _rotateAround: function (t, e) { var r = Math.cos(t), n = Math.sin(t), i = e.y + n * (this.x - e.x) + r * (this.y - e.y); return this.x = e.x + r * (this.x - e.x) - n * (this.y - e.y), this.y = i, this }, _round: function () { return this.x = Math.round(this.x), this.y = Math.round(this.y), this } }, g.convert = function (t) { return t instanceof g ? t : Array.isArray(t) ? new g(t[0], t[1]) : t }; var x = p(y); const v = Math.PI / 180, b = 180 / Math.PI; function _(t) { return t * v } function w(t) { return t * b } const M = [[0, 0], [1, 0], [1, 1], [0, 1]]; function A(t) { if (t <= 0) return 0; if (t >= 1) return 1; const e = t * t, r = e * t; return 4 * (t < .5 ? r : 3 * (t - e) + r - .75) } function S(t, e, r, n) { const i = new m(t, e, r, n); return function (t) { return i.solve(t) } } const I = S(.25, .1, .25, 1); function k(t, e, r) { return Math.min(r, Math.max(e, t)) } function T(t, e, r) { return (r = k((r - t) / (e - t), 0, 1)) * r * (3 - 2 * r) } function P(t, e, r) { const n = r - e, i = ((t - e) % n + n) % n + e; return i === e ? r : i } function z(t, e, r) { if (!t.length) return r(null, []); let n = t.length; const i = new Array(t.length); let s = null; t.forEach(((t, a) => { e(t, ((t, e) => { t && (s = t), i[a] = e, 0 == --n && r(s, i); })); })); } function E(t) { const e = []; for (const r in t) e.push(t[r]); return e } function B(t, ...e) { for (const r of e) for (const e in r) t[e] = r[e]; return t } let D = 1; function C() { return D++ } function R() { return function t(e) { return e ? (e ^ Math.random() * (16 >> e / 4)).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, t) }() } function L(t) { return t <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t) / Math.LN2)) } function V(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 O(t, e) { t.forEach((t => { e[t] && (e[t] = e[t].bind(e)); })); } function F(t, e) { return -1 !== t.indexOf(e, t.length - e.length) } function j(t, e, r) { const n = {}; for (const i in t) n[i] = e.call(r || this, t[i], i, t); return n } function U(t, e, r) { const n = {}; for (const i in t) e.call(r || this, t[i], i, t) && (n[i] = t[i]); return n } function N(t) { return Array.isArray(t) ? t.map(N) : "object" == typeof t && t ? j(t, N) : t } const $ = {}; function q(t) { $[t] || ("undefined" != typeof console && console.warn(t), $[t] = !0); }
33 function G(t, e, r) { return (r.y - t.y) * (e.x - t.x) > (e.y - t.y) * (r.x - t.x) } function Y(t) { let e = 0; for (let r, n, i = 0, s = t.length, a = s - 1; i < s; a = i++)r = t[i], n = t[a], e += (n.x - r.x) * (r.y + n.y); return e } function Z([t, e, r]) { const n = _(e + 90), i = _(r); return { x: t * Math.cos(n) * Math.sin(i), y: t * Math.sin(n) * Math.sin(i), z: t * Math.cos(i), azimuthal: e, polar: r } } function X() { return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope } function K(t) { const e = {}; if (t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, ((t, r, n, i) => { const s = n || i; return e[r] = !s || s.toLowerCase(), "" })), e["max-age"]) { const t = parseInt(e["max-age"], 10); isNaN(t) ? delete e["max-age"] : e["max-age"] = t; } return e } let W = null; function H(t) { try { const e = self[t]; return e.setItem("_mapbox_test_", 1), e.removeItem("_mapbox_test_"), !0 } catch (t) { return !1 } } function J(t, e) { return [t[4 * e], t[4 * e + 1], t[4 * e + 2], t[4 * e + 3]] } function Q(t, e, r, n) { for (; e < r;) { const i = e + r >> 1; t[i] < n ? e = i + 1 : r = i; } return e } function tt(t, e, r, n) { for (; e < r;) { const i = e + r >> 1; t[i] <= n ? e = i + 1 : r = i; } return e } const et = "mapbox-tiles"; let rt = 500, nt = 50; let it, st; function at() { try { return caches } catch (t) { } } function ot() { const t = at(); t && !it && (it = t.open(et)); } function lt(t) { const e = t.indexOf("?"); if (e < 0) return t; const r = function (t) { const e = t.indexOf("?"); return e > 0 ? t.slice(e + 1).split("&") : [] }(t), n = r.filter((t => { const e = t.split("="); return "language" === e[0] || "worldview" === e[0] })); return n.length ? `${t.slice(0, e)}?${n.join("&")}` : t.slice(0, e) } let ut = 1 / 0; const ct = { Unknown: "Unknown", Style: "Style", Source: "Source", Tile: "Tile", Glyphs: "Glyphs", SpriteImage: "SpriteImage", SpriteJSON: "SpriteJSON", Image: "Image", Model: "Model" }; "function" == typeof Object.freeze && Object.freeze(ct); class ht extends Error { constructor(t, e, r) { 401 === e && wt(r) && (t += ": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"), super(t), this.status = e, this.url = r; } toString() { return `${this.name}: ${this.message} (${this.status}): ${this.url}` } } const pt = X() ? () => self.worker && self.worker.referrer : () => ("blob:" === location.protocol ? parent : self).location.href; const ft = function (t, e) { if (!(/^file:/.test(r = t.url) || /^file:/.test(pt()) && !/^\w+:/.test(r))) { if (self.fetch && self.Request && self.AbortController && Request.prototype.hasOwnProperty("signal")) return function (t, e) { const r = new AbortController, n = new Request(t.url, { method: t.method || "GET", body: t.body, credentials: t.credentials, headers: t.headers, referrer: pt(), referrerPolicy: t.referrerPolicy, signal: r.signal }); let i = !1, s = !1; const a = (o = n.url).indexOf("sku=") > 0 && wt(o); var o; "json" === t.type && n.headers.set("Accept", "application/json"); const l = (r, i, o) => { if (s) return; if (r && "SecurityError" !== r.message && q(r.toString()), i && o) return u(i); const l = Date.now(); fetch(n).then((r => { if (r.ok) { const t = a ? r.clone() : null; return u(r, t, l) } return e(new ht(r.statusText, r.status, t.url)) })).catch((r => { "AbortError" !== r.name && e(new Error(`${r.message} ${t.url}`)); })); }, u = (r, a, o) => { ("arrayBuffer" === t.type ? r.arrayBuffer() : "json" === t.type ? r.json() : r.text()).then((t => { s || (a && o && function (t, e, r) { if (ot(), !it) return; const n = { status: e.status, statusText: e.statusText, headers: new Headers }; e.headers.forEach(((t, e) => n.headers.set(e, t))); const i = K(e.headers.get("Cache-Control") || ""); if (i["no-store"]) return; i["max-age"] && n.headers.set("Expires", new Date(r + 1e3 * i["max-age"]).toUTCString()); const s = n.headers.get("Expires"); s && (new Date(s).getTime() - r < 42e4 || function (t, e) { if (void 0 === st) try { new Response(new ReadableStream), st = !0; } catch (t) { st = !1; } st ? e(t.body) : t.blob().then(e); }(e, (e => { const r = new Response(e, n); ot(), it && it.then((e => e.put(lt(t.url), r))).catch((t => q(t.message))); }))); }(n, a, o), i = !0, e(null, t, r.headers.get("Cache-Control"), r.headers.get("Expires"))); })).catch((t => { s || e(new Error(t.message)); })); }; return a ? function (t, e) { if (ot(), !it) return e(null); const r = lt(t.url); it.then((t => { t.match(r).then((n => { const i = function (t) { if (!t) return !1; const e = new Date(t.headers.get("Expires") || 0), r = K(t.headers.get("Cache-Control") || ""); return e > Date.now() && !r["no-cache"] }(n); t.delete(r), i && t.put(r, n.clone()), e(null, n, i); })).catch(e); })).catch(e); }(n, l) : l(null, null), { cancel: () => { s = !0, i || r.abort(); } } }(t, e); if (X() && self.worker && self.worker.actor) return self.worker.actor.send("getResource", t, e, void 0, !0) } var r; return function (t, e) { const r = new 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 = () => { e(new Error(r.statusText)); }, r.onload = () => { if ((r.status >= 200 && r.status < 300 || 0 === r.status) && null !== r.response) { let n = r.response; if ("json" === t.type) try { n = JSON.parse(r.response); } catch (t) { return e(t) }
33 e(null, n, r.getResponseHeader("Cache-Control"), r.getResponseHeader("Expires")); } else e(new ht(r.statusText, r.status, t.url)); }, r.send(t.body), { cancel: () => r.abort() } }(t, e) }, dt = function (t, e) { return ft(B(t, { type: "arrayBuffer" }), e) }; function mt(t) { const e = document.createElement("a"); return e.href = t, e.protocol === location.protocol && e.host === location.host } const yt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="; let gt, xt; gt = [], xt = 0; const vt = function (t, e) { if (i.supported && (t.headers || (t.headers = {}), t.headers.accept = "image/webp,*/*"), xt >= n.MAX_PARALLEL_IMAGE_REQUESTS) { const r = { requestParameters: t, callback: e, cancelled: !1, cancel() { this.cancelled = !0; } }; return gt.push(r), r } xt++; let r = !1; const s = () => { if (!r) for (r = !0, xt--; gt.length && xt < n.MAX_PARALLEL_IMAGE_REQUESTS;) { const t = gt.shift(), { requestParameters: e, callback: r, cancelled: n } = t; n || (t.cancel = vt(e, r).cancel); } }, a = dt(t, ((t, r, n, i) => { s(), t ? e(t) : r && (self.createImageBitmap ? function (t, e) { const r = new Blob([new Uint8Array(t)], { type: "image/png" }); createImageBitmap(r).then((t => { e(null, t); })).catch((t => { e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)); })); }(r, ((t, r) => e(t, r, n, i))) : function (t, e) { const r = new Image; r.onload = () => { e(null, r), URL.revokeObjectURL(r.src), r.onload = null, requestAnimationFrame((() => { r.src = yt; })); }, r.onerror = () => e(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 n = new Blob([new Uint8Array(t)], { type: "image/png" }); r.src = t.byteLength ? URL.createObjectURL(n) : yt; }(r, ((t, r) => e(t, r, n, i)))); })); return { cancel: () => { a.cancel(), s(); } } }, bt = "NO_ACCESS_TOKEN"; function _t(t) { return 0 === t.indexOf("mapbox:") } function wt(t) { return n.API_URL_REGEX.test(t) } function Mt(t) { return n.API_CDN_URL_REGEX.test(t) } function At(t) { return n.API_STYLE_REGEX.test(t) && !St(t) } function St(t) { return n.API_SPRITE_REGEX.test(t) } const It = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/; function kt(t) { const e = t.match(It); 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 Tt(t) { const e = t.params.length ? `?${t.params.join("&")}` : ""; return `${t.protocol}://${t.authority}${t.path}${e}` } const Pt = "mapbox.eventData"; function zt(t) { if (!t) return null; const e = t.split("."); if (!e || 3 !== e.length) return null; try { return JSON.parse(decodeURIComponent(atob(e[1]).split("").map((t => "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2))).join(""))) } catch (t) { return null } } class Et { constructor(t) { this.type = t, this.anonId = null, this.eventData = {}, this.queue = [], this.pendingRequest = null; } getStorageKey(t) { const e = zt(n.ACCESS_TOKEN); let r = ""; return r = e && e.u ? btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g, ((t, e) => String.fromCharCode(Number("0x" + e))))) : n.ACCESS_TOKEN || "", t ? `${Pt}.${t}:${r}` : `${Pt}:${r}` } fetchEventData() { const t = H("localStorage"), e = this.getStorageKey(), r = this.getStorageKey("uuid"); if (t) try { const t = localStorage.getItem(e); t && (this.eventData = JSON.parse(t)); const n = localStorage.getItem(r); n && (this.anonId = n); } catch (t) { q("Unable to read from LocalStorage"); } } saveEventData() { const t = H("localStorage"), e = this.getStorageKey(), r = this.getStorageKey("uuid"), n = this.anonId; if (t && n) try { localStorage.setItem(r, n), Object.keys(this.eventData).length >= 1 && localStorage.setItem(e, JSON.stringify(this.eventData)); } catch (t) { q("Unable to write to LocalStorage"); } } processRequests(t) { } postEvent(t, e, r, i) { if (!n.EVENTS_URL) return; const s = kt(n.EVENTS_URL); s.params.push(`access_token=${i || n.ACCESS_TOKEN || ""}`); const a = { event: this.type, created: new Date(t).toISOString() }, o = e ? B(a, e) : a, l = { url: Tt(s), headers: { "Content-Type": "text/plain" }, body: JSON.stringify([o]) }; this.pendingRequest = function (t, e) { return ft(B(t, { method: "POST" }), e) }(l, (t => { this.pendingRequest = null, r(t), this.saveEventData(), this.processRequests(i); })); } queueRequest(t, e) { this.queue.push(t), this.processRequests(e); } }
33 const Bt = new class extends Et { constructor(t) { super("appUserTurnstile"), this._customAccessToken = t; } postTurnstileEvent(t, e) { n.EVENTS_URL && n.ACCESS_TOKEN && Array.isArray(t) && t.some((t => _t(t) || wt(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 r = zt(n.ACCESS_TOKEN), i = r ? r.u : n.ACCESS_TOKEN; let s = i !== this.eventData.tokenU; V(this.anonId) || (this.anonId = R(), s = !0); const a = this.queue.shift(); if (this.eventData.lastSuccess) { const t = new Date(this.eventData.lastSuccess), e = new Date(a), r = (a - this.eventData.lastSuccess) / 864e5; s = s || r >= 1 || r < -1 || t.getDate() !== e.getDate(); } else s = !0; s ? this.postEvent(a, { sdkIdentifier: "mapbox-gl-js", sdkVersion: e, skuId: h, "enabled.telemetry": !1, userId: this.anonId }, (t => { t || (this.eventData.lastSuccess = a, this.eventData.tokenU = i); }), t) : this.processRequests(); } }, Dt = Bt.postTurnstileEvent.bind(Bt), Ct = new class extends Et { constructor() { super("map.load"), this.success = {}, this.skuToken = ""; } postMapLoadEvent(t, e, r, i) { this.skuToken = e, this.errorCb = i, n.EVENTS_URL && (r || n.ACCESS_TOKEN ? this.queueRequest({ id: t, timestamp: Date.now() }, r) : this.errorCb(new Error(bt))); } processRequests(t) { if (this.pendingRequest || 0 === this.queue.length) return; const { id: r, timestamp: n } = this.queue.shift(); r && this.success[r] || (this.anonId || this.fetchEventData(), V(this.anonId) || (this.anonId = R()), this.postEvent(n, { sdkIdentifier: "mapbox-gl-js", sdkVersion: e, skuId: h, skuToken: this.skuToken, userId: this.anonId }, (t => { t ? this.errorCb(t) : r && (this.success[r] = !0); }), t)); } }, Rt = Ct.postMapLoadEvent.bind(Ct), Lt = new class extends Et { constructor() { super("gljs.performance"); } postPerformanceEvent(t, e) { n.EVENTS_URL && (t || n.ACCESS_TOKEN) && this.queueRequest({ timestamp: Date.now(), performanceData: e }, t); } processRequests(t) { if (this.pendingRequest || 0 === this.queue.length) return; const { timestamp: r, performanceData: n } = this.queue.shift(), i = function (t) { const r = performance.getEntriesByType("resource"), n = performance.getEntriesByType("mark"), i = function (t) { const e = {}; if (t) for (const r in t) if ("other" !== r) for (const n of t[r]) { const t = `${r}ResolveRangeMin`, i = `${r}ResolveRangeMax`, s = `${r}RequestCount`, a = `${r}RequestCachedCount`; e[t] = Math.min(e[t] || 1 / 0, n.startTime), e[i] = Math.max(e[i] || -1 / 0, n.responseEnd); const o = t => { void 0 === e[t] && (e[t] = 0), ++e[t]; }; void 0 !== n.transferSize && 0 === n.transferSize && o(a), o(s); } return e }(function (t, e) { const r = {}; if (t) for (const n of t) { const t = e(n); void 0 === r[t] && (r[t] = []), r[t].push(n); } return r }(r, Nt)), s = window.devicePixelRatio, a = navigator.connection || navigator.mozConnection || navigator.webkitConnection, o = a ? a.effectiveType : void 0, l = { counters: [], metadata: [], attributes: [] }, u = (t, e, r) => { null != r && t.push({ name: e, value: r.toString() }); }; for (const t in i) u(l.counters, t, i[t]); if (t.interactionRange[0] !== 1 / 0 && t.interactionRange[1] !== -1 / 0 && (u(l.counters, "interactionRangeMin", t.interactionRange[0]), u(l.counters, "interactionRangeMax", t.interactionRange[1])), n) for (const t of Object.keys(Ut)) { const e = Ut[t], r = n.find((t => t.name === e)); r && u(l.counters, e, r.startTime); } return u(l.counters, "visibilityHidden", t.visibilityHidden), u(l.attributes, "style", function (t) { if (t) for (const e of t) { const t = e.name.split("?")[0]; if (At(t)) { const e = t.split("/").slice(-2); if (2 === e.length) return `mapbox://styles/${e[0]}/${e[1]}` } } }(r)), u(l.attributes, "terrainEnabled", t.terrainEnabled ? "true" : "false"), u(l.attributes, "fogEnabled", t.fogEnabled ? "true" : "false"), u(l.attributes, "projection", t.projection), u(l.attributes, "zoom", t.zoom), u(l.metadata, "devicePixelRatio", s), u(l.metadata, "connectionEffectiveType", o), u(l.metadata, "navigatorUserAgent", navigator.userAgent), u(l.metadata, "screenWidth", window.screen.width), u(l.metadata, "screenHeight", window.screen.height), u(l.metadata, "windowWidth", window.innerWidth), u(l.metadata, "windowHeight", window.innerHeight), u(l.metadata, "mapWidth", t.width / s), u(l.metadata, "mapHeight", t.height / s), u(l.metadata, "webglRenderer", t.renderer), u(l.metadata, "webglVendor", t.vend
33or), u(l.metadata, "sdkVersion", e), u(l.metadata, "sdkIdentifier", "mapbox-gl-js"), l }(n); for (const t of i.metadata); for (const t of i.counters); for (const t of i.attributes); this.postEvent(r, i, (() => { }), t); } }, Vt = Lt.postPerformanceEvent.bind(Lt), Ot = new class extends Et { constructor() { super("map.auth"), this.success = {}, this.skuToken = ""; } getSession(t, e, r, i) { if (!n.API_URL || !n.SESSION_PATH) return; const s = kt(n.API_URL + n.SESSION_PATH); s.params.push(`sku=${e || ""}`), s.params.push(`access_token=${i || n.ACCESS_TOKEN || ""}`); const a = { url: Tt(s), headers: { "Content-Type": "text/plain" } }; this.pendingRequest = function (t, e) { return ft(B(t, { method: "GET" }), e) }(a, (t => { this.pendingRequest = null, r(t), this.saveEventData(), this.processRequests(i); })); } getSessionAPI(t, e, r, i) { this.skuToken = e, this.errorCb = i, n.SESSION_PATH && n.API_URL && (r || n.ACCESS_TOKEN ? this.queueRequest({ id: t, timestamp: Date.now() }, r) : this.errorCb(new Error(bt))); } processRequests(t) { if (this.pendingRequest || 0 === this.queue.length) return; const { id: e, timestamp: r } = this.queue.shift();
33 e && this.success[e] || this.getSession(r, this.skuToken, (t => { t ? this.errorCb(t) : e && (this.success[e] = !0); }), t); } }, Ft = Ot.getSessionAPI.bind(Ot), jt = new Set, Ut = { create: "create", load: "load", fullLoad: "fullLoad" }; function Nt(t) { const e = t.name.split("?")[0]; return Mt(e) && e.includes("mapbox-gl.js") ? "javascript" : Mt(e) && e.includes("mapbox-gl.css") ? "css" : function (t) { return n.API_FONTS_REGEX.test(t) }(e) ? "fontRange" : St(e) ? "sprite" : At(e) ? "style" : function (t) { return n.API_TILEJSON_REGEX.test(t) }(e) ? "tilejson" : "other" } function $t(t) { const e = t ? t.url.toString() : void 0; return e ? performance.getEntriesByName(e) : [] } let qt, Gt, Yt, Zt, Xt; function Kt() { return null == qt && (qt = self.OffscreenCanvas && new OffscreenCanvas(1, 1).getContext("2d") && "function" == typeof self.createImageBitmap), qt } const Wt = { now: () => void 0 !== Zt ? Zt : performance.now(), setNow(t) { Zt = t; }, restoreNow() { Zt = void 0; }, frame(t) { const e = requestAnimationFrame(t); return { cancel: () => cancelAnimationFrame(e) } }, getImageData(t, e = 0) { const { width: r, height: n } = t; Xt || (Xt = document.createElement("canvas")); const i = Xt.getContext("2d", { willReadFrequently: !0 }); if (!i) throw new Error("failed to create canvas 2d context"); return (r > Xt.width || n > Xt.height) && (Xt.width = r, Xt.height = n), i.clearRect(-e, -e, r + 2 * e, n + 2 * e), i.drawImage(t, 0, 0, r, n), i.getImageData(-e, -e, r + 2 * e, n + 2 * e) }, resolveURL: t => (Gt || (Gt = document.createElement("a")), Gt.href = t, Gt.href), get devicePixelRatio() { return window.devicePixelRatio }, get prefersReducedMotion() { return !!window.matchMedia && (null == Yt && (Yt = window.matchMedia("(prefers-reduced-motion: reduce)")), Yt.matches) }, hasCanvasFingerprintNoise() { if (!Kt()) return !1; const t = new OffscreenCanvas(85, 1), e = t.getContext("2d", { willReadFrequently: !0 }); let r = 0; for (let n = 0; n < t.width; ++n)e.fillStyle = `rgba(${r++},${r++},${r++}, 255)`, e.fillRect(n, 0, 1, 1); const n = e.getImageData(0, 0, t.width, t.height); r = 0; for (let t = 0; t < n.data.length; ++t)if (t % 4 != 3 && r++ !== n.data[t]) return !0; return !1 } }; function Ht(t, e, r) { r[t] && -1 !== r[t].indexOf(e) || (r[t] = r[t] || [], r[t].push(e)); } function Jt(t, e, r) { if (r && r[t]) { const n = r[t].indexOf(e); -1 !== n && r[t].splice(n, 1); } } class Qt { constructor(t, e = {}) { B(this, e), this.type = t; } } class te extends Qt { constructor(t, e = {}) { super("error", B({ error: t }, e)); } } class ee { on(t, e) { return this._listeners = this._listeners || {}, Ht(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 || {}, Ht(t, e, this._oneTimeListeners), this) : new Promise((e => this.once(t, e))) } fire(t, e) { "string" == typeof t && (t = new Qt(t, e || {})); const r = t.type; if (this.listens(r)) { t.target = this; const e = this._listeners && this._listeners[r] ? this._listeners[r].slice() : []; for (const r of e) r.call(this, t); const n = this._oneTimeListeners && this._oneTimeListeners[r] ? this._oneTimeListeners[r].slice() : []; for (const e of n) Jt(r, e, this._oneTimeListeners), e.call(this, t); const i = this._eventedParent; i && (B(t, "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData), i.fire(t)); } else t instanceof te && 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 re = JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}}
33,"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
33,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
33,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
33,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","default":[0,1],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":[
33"feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}'); class ne { constructor(t, e, r, n) { this.message = (t ? `${t}: ` : "") + r, n && (this.identifier = n), null != e && e.__line__ && (this.line = e.__line__); } } class ie extends ne { } function se(t, ...e) { for (const r of e) for (const e in r) t[e] = r[e]; return t } function ae(t) { return t instanceof Number || t instanceof String || t instanceof Boolean ? t.valueOf() : t } function oe(t) { if (Array.isArray(t)) return t.map(oe); if (t instanceof Object && !(t instanceof Number || t instanceof String || t instanceof Boolean)) { const e = {}; for (const r in t) e[r] = oe(t[r]); return e } return ae(t) } class le extends Error { constructor(t, e) { super(e), this.message = e, this.key = t; } } var ue = le; class ce { constructor(t, e = []) { this.parent = t, this.bindings = {}; for (const [t, r] of e) this.bindings[t] = r; } concat(t) { return new ce(this, t) } get(t) { if (this.bindings[t]) return this.bindings[t]; if (this.parent) return this.parent.get(t); throw new Error(`${t} not found in scope.`) } has(t) { return !!this.bindings[t] || !!this.parent && this.parent.has(t) } } var he = ce; const pe = { kind: "null" }, fe = { kind: "number" }, de = { kind: "string" }, me = { kind: "boolean" }, ye = { kind: "color" }, ge = { kind: "object" }, xe = { kind: "value" }, ve = { kind: "collator" }, be = { kind: "formatted" }, _e = { kind: "resolvedImage" }; function we(t, e) { return { kind: "array", itemType: t, N: e } } function Me(t) { if ("array" === t.kind) { const e = Me(t.itemType); return "number" == typeof t.N ? `array<${e}, ${t.N}>` : "value" === t.itemType.kind ? "array" : `array<${e}>` } return t.kind } const Ae = [pe, fe, de, me, ye, be, ge, we(xe), _e]; function Se(t, e) { if ("error" === e.kind) return null; if ("array" === t.kind) { if ("array" === e.kind && (0 === e.N && "value" === e.itemType.kind || !Se(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 Ae) if (!Se(t, e)) return null } return `Expected ${Me(t)} but found ${Me(e)} instead.` } function Ie(t, e) { return e.some((e => e.kind === t.kind)) } function ke(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)) } var Te, Pe = { 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], ol
vendor: 9,674 bytes, line 33
33ive: [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 ze(t) { return (t = Math.round(t)) < 0 ? 0 : t > 255 ? 255 : t } function Ee(t) { return ze("%" === t[t.length - 1] ? parseFloat(t) / 100 * 255 : parseInt(t)) } function Be(t) { return (e = "%" === t[t.length - 1] ? parseFloat(t) / 100 : parseFloat(t)) < 0 ? 0 : e > 1 ? 1 : e; var e; } function De(t, e, r) { return r < 0 ? r += 1 : r > 1 && (r -= 1), 6 * r < 1 ? t + (e - t) * r * 6 : 2 * r < 1 ? e : 3 * r < 2 ? t + (e - t) * (2 / 3 - r) * 6 : t } try { Te = {}.parseCSSColor = function (t) { var e, r = t.replace(/ /g, "").toLowerCase(); if (r in Pe) return Pe[r].slice(); if ("#" === r[0]) return 4 === r.length ? (e = parseInt(r.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 === r.length && (e = parseInt(r.substr(1), 16)) >= 0 && e <= 16777215 ? [(16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 1] : null; var n = r.indexOf("("), i = r.indexOf(")"); if (-1 !== n && i + 1 === r.length) { var s = r.substr(0, n), a = r.substr(n + 1, i - (n + 1)).split(","), o = 1; switch (s) { case "rgba": if (4 !== a.length) return null; o = Be(a.pop()); case "rgb": return 3 !== a.length ? null : [Ee(a[0]), Ee(a[1]), Ee(a[2]), o]; case "hsla": if (4 !== a.length) return null; o = Be(a.pop()); case "hsl": if (3 !== a.length) return null; var l = (parseFloat(a[0]) % 360 + 360) % 360 / 360, u = Be(a[1]), c = Be(a[2]), h = c <= .5 ? c * (u + 1) : c + u - c * u, p = 2 * c - h; return [ze(255 * De(p, h, l + 1 / 3)), ze(255 * De(p, h, l)), ze(255 * De(p, h, l - 1 / 3)), o]; default: return null } } return null }; } catch (t) { } class Ce { constructor(t, e, r, n = 1) { this.r = t, this.g = e, this.b = r, this.a = n; } static parse(t) { if (!t) return; if (t instanceof Ce) return t; if ("string" != typeof t) return; const e = Te(t); return e ? new Ce(e[0] / 255 * e[3], e[1] / 255 * e[3], e[2] / 255 * e[3], e[3]) : void 0 } toString() { const [t, e, r, n] = this.toArray(); return `rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})` } toArray() { const { r: t, g: e, b: r, a: n } = this; return 0 === n ? [0, 0, 0, 0] : [255 * t / n, 255 * e / n, 255 * r / n, n] } toArray01() { const { r: t, g: e, b: r, a: n } = this; return 0 === n ? [0, 0, 0, 0] : [t / n, e / n, r / n, n] } toArray01Scaled(t) { const { r: e, g: r, b: n, a: i } = this; return 0 === i ? [0, 0, 0] : [e / i * t, r / i * t, n / i * t] } toArray01PremultipliedAlpha() { const { r: t, g: e, b: r, a: n } = this; return [t, e, r, n] } toArray01Linear() { const { r: t, g: e, b: r, a: n } = this; return 0 === n ? [0, 0, 0, 0] : [Math.pow(t / n, 2.2), Math.pow(e / n, 2.2), Math.pow(r / n, 2.2), n] } } Ce.black = new Ce(0, 0, 0, 1), Ce.white = new Ce(1, 1, 1, 1), Ce.transparent = new Ce(0, 0, 0, 0), Ce.red = new Ce(1, 0, 0, 1), Ce.blue = new Ce(0, 0, 1, 1); var Re = Ce; class Le { constructor(t, e, r) { this.sensitivity = t ? e ? "variant" : "case" : e ? "accent" : "base", this.locale = r, 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, r, n, i) { this.text = t.normalize ? t.normalize() : t, this.image = e, this.scale = r, this.fontStack = n, this.textColor = i; } } class Oe { constructor(t) { this.sections = t; } static fromString(t) { return new Oe([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.namePrimary.length)) } static factory(t) { return t instanceof Oe ? t : Oe.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.namePrimary]); continue } t.push(e.text); const r = {}; e.fontStack && (r["text-font"] = ["literal", e.fontStack.split(",")]), e.scale && (r["font-scale"] = e.scale), e.textColor && (r["text-color"] = ["rgba"].concat(e.textColor.toArray())), t.push(r); } return t } } class Fe { constructor(t) { this.namePrimary = t.namePrimary, t.nameSecondary && (this.nameSecondary = t.nameSecondary), this.available = t.available; } toString() { return this.nameSecondary ? `[${this.namePrimary},${this.nameSecondary}]` : this.namePrimary } static fromString(t, e) { return t ? new Fe({ namePrimary: t, nameSecondary: e, available: !1 }) : null } serialize() { return this.nameSecondary ? ["image", this.namePrimary, this.nameSecondary] : ["image", this.namePrimary] } } function je(t, e, r, n) { return "number" == typeof t && t >= 0 && t <= 255 && "number" == typeof e && e >= 0 && e <= 255 && "number" == typeof r && r >= 0 && r <= 255 ? void 0 === n || "number" == typeof n && n >= 0 && n <= 1 ? null : `Invalid rgba value [${[t, e, r, n].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${("number" == typeof n ? [t, e, r, n] : [t, e, r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.` } function Ue(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 Re) return !0; if (t instanceof Le) return !0; if (t instanceof Oe) return !0; if (t instanceof Fe) return !0; if (Array.isArray(t)) { for (const e of t) if (!Ue(e)) return !1; return !0 } if ("object" == typeof t) { for (const e in t) if (!Ue(t[e])) return !1; return !0 } return !1 } function Ne(t) { if (null === t) return pe; if ("string" == typeof t) return de; if ("boolean" == typeof t) return me; if ("number" == typeof t) return fe; if (t instanceof Re) return ye; if (t instanceof Le) return ve; if (t instanceof Oe) return be; if (t instanceof Fe) return _e; if (Array.isArray(t)) { const e = t.length; let r; for (const e of t) { const t = Ne(e); if (r) { if (r === t) continue; r = xe; break } r = t; } return we(r || xe, e) } return ge } function $e(t) { const e = typeof t; return null === t ? "" : "string" === e || "number" === e || "boolean" === e ? String(t) : t instanceof Re || t instanceof Oe || t instanceof Fe ? t.toString() : JSON.stringify(t) } class qe { 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 ${t.length - 1} instead.`); if (!Ue(t[1])) return e.error("invalid value"); const r = t[1]; let n = Ne(r); const i = e.expectedType; return "array" !== n.kind || 0 !== n.N || !i || "array" !== i.kind || "number" == typeof i.N && 0 !== i.N || (n = i), new qe(n, r) } evaluate() { return this.value } eachChild() { } outputDefined() { return !0 } serialize() { return "array" === this.type.kind || "object" === this.type.kind ? ["literal", this.value] : this.value instanceof Re ? ["rgba"].concat(this.value.toArray()) : this.value instanceof Oe ? this.value.serialize() : this.value } } var Ge = qe, Ye = class { constructor(t) { this.name = "ExpressionEvaluationError", this.message = t; } toJSON() { return this.message } }; const Ze = { string: de, number: fe, boolean: me, object: ge }; class Xe { 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 r, n = 1; const i = t[0]; if ("array" === i) { let i, s; if (t.length > 2) { const r = t[1]; if ("string" != typeof r || !(r in Ze) || "object" === r) return e.error('The item type argument of "array" must be one of string, number, boolean', 1); i = Ze[r], n++; } else i = xe; 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); s = t[2], n++; } r = we(i, s); } else r = Ze[i]; const s = []; for (; n < t.length; n++) { const r = e.parse(t[n], n, xe); if (!r) return null; s.push(r); } return new Xe(r, s) } evaluate(t) { for (let e = 0; e < this.args.length; e++) { const r = this.args[e].evaluate(t); if (!Se(this.type, Ne(r))) return r; if (e === this.args.length - 1) throw new Ye(`Expected value to be of type ${Me(this.type)}, but found ${Me(Ne(r))} instead.`) } return null }
33 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 r = t.itemType; if ("string" === r.kind || "number" === r.kind || "boolean" === r.kind) { e.push(r.kind); const n = t.N; ("number" == typeof n || this.args.length > 1) && e.push(n); } } return e.concat(this.args.map((t => t.serialize()))) } } var Ke = Xe; class We { constructor(t) { this.type = be, this.sections = t; } static parse(t, e) { if (t.length < 2) return e.error("Expected at least one argument."); const r = t[1]; if (!Array.isArray(r) && "object" == typeof r) return e.error("First argument must be an image or text section."); const n = []; let i = !1; for (let r = 1; r <= t.length - 1; ++r) { const s = t[r]; if (i && "object" == typeof s && !Array.isArray(s)) { i = !1; let t = null; if (s["font-scale"] && (t = e.parse(s["font-scale"], 1, fe), !t)) return null; let r = null; if (s["text-font"] && (r = e.parse(s["text-font"], 1, we(de)), !r)) return null; let a = null; if (s["text-color"] && (a = e.parse(s["text-color"], 1, ye), !a)) return null; const o = n[n.length - 1]; o.scale = t, o.font = r, o.textColor = a; } else { const s = e.parse(t[r], 1, xe); if (!s) return null; const a = s.type.kind; if ("string" !== a && "value" !== a && "null" !== a && "resolvedImage" !== a) return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'."); i = !0, n.push({ content: s, scale: null, font: null, textColor: null }); } } return new We(n) } evaluate(t) { return new Oe(this.sections.map((e => { const r = e.content.evaluate(t); return Ne(r) === _e ? new Ve("", r, null, null, null) : new Ve($e(r), 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 r = {}; e.scale && (r["font-scale"] = e.scale.serialize()), e.font && (r["text-font"] = e.font.serialize()), e.textColor && (r["text-color"] = e.textColor.serialize()), t.push(r); } return t } } class He { constructor(t, e) { this.type = _e, this.inputPrimary = t, this.inputSecondary = e; } static parse(t, e) { if (t.length < 2) return e.error("Expected two or more arguments."); const r = e.parse(t[1], 1, de); if (!r) return e.error("No image name provided."); if (2 === t.length) return new He(r); const n = e.parse(t[2], 1, de); return n ? new He(r, n) : e.error("Secondary image variant is not a string.") } evaluate(t) { const e = Fe.fromString(this.inputPrimary.evaluate(t), this.inputSecondary ? this.inputSecondary.evaluate(t) : void 0); return e && t.availableImages && (e.available = t.availableImages.indexOf(e.namePrimary) > -1, e.nameSecondary && e.available && t.availableImages && (e.available = t.availableImages.indexOf(e.nameSecondary) > -1)), e } eachChild(t) { t(this.inputPrimary), this.inputSecondary && t(this.inputSecondary); } outputDefined() { return !1 } serialize() { return this.inputSecondary ? ["image", this.inputPrimary.serialize(), this.inputSecondary.serialize()] : ["image", this.inputPrimary.serialize()] } } function Je(t) { return t instanceof Number ? "number" : t instanceof String ? "string" : t instanceof Boolean ? "boolean" : Array.isArray(t) ? "array" : null === t ? "null" : typeof t } const Qe = { "to-boolean": me, "to-color": ye, "to-number": fe, "to-string": de }; class tr { 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 r = t[0], n = []; let i = pe; if ("to-array" === r) { if (!Array.isArray(t[1])) return null; const r = t[1].length; if (e.expectedType) { if ("array" !== e.expectedType.kind) return e.error(`Expected ${e.expectedType.kind} but found array.`); i = we(e.expectedType.itemType, r); } else { if (!(r > 0 && Ue(t[1][0]))) return null; i = we(Ne(t[1][0]), r); } for (let s = 0; s < r; s++) { const r = t[1][s]; let a; if ("array" === Je(r)) a = e.parse(r, void 0, i.itemType); else { const t = Je(r); if (t !== i.itemType.kind) return e.error(`Expected ${i.itemType.kind} but found ${t}.`); a = e.registry.literal.parse(["literal", void 0 === r ? null : r], e); } if (!a) return null; n.push(a); } } else { if (("to-boolean" === r || "to-string" === r) && 2 !== t.length) return e.error("Expected one argument."); i = Qe[r]; for (let r = 1; r < t.length; r++) { const i = e.parse(t[r], r, xe); if (!i) return null; n.push(i); } } return new tr(i, n) } evaluate(t) { if ("boolean" === this.type.kind) return Boolean(this.args[0].evaluate(t)); if ("color" === this.type.kind) { let e, r; for (const n of this.args) { if (e = n.evaluate(t), r = null, e instanceof Re) return e; if ("string" == typeof e) { const r = t.parseColor(e); if (r) return r } else if (Array.isArray(e) && (r = e.length < 3 || e.length > 4 ? `Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.` : je(e[0], e[1], e[2], e[3]), !r)) return new Re(e[0] / 25
vendor: 11,794 bytes, line 33
335, e[1] / 255, e[2] / 255, e[3]) } throw new Ye(r || `Could not parse color from value '${"string" == typeof e ? e : String(JSON.stringify(e))}'`) } if ("number" === this.type.kind) { let e = null; for (const r of this.args) { if (e = r.evaluate(t), null === e) return 0; const n = Number(e); if (!isNaN(n)) return n } throw new Ye(`Could not convert ${JSON.stringify(e)} to number.`) } return "formatted" === this.type.kind ? Oe.fromString($e(this.args[0].evaluate(t))) : "resolvedImage" === this.type.kind ? Fe.fromString($e(this.args[0].evaluate(t))) : "array" === this.type.kind ? this.args.map((e => e.evaluate(t))) : $e(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 We([{ content: this.args[0], scale: null, font: null, textColor: null }]).serialize(); if ("resolvedImage" === this.type.kind) return new He(this.args[0]).serialize(); const t = "array" === this.type.kind ? [] : [`to-${this.type.kind}`]; return this.eachChild((e => { t.push(e.serialize()); })), t } } var er = tr; const rr = ["Unknown", "Point", "LineString", "Polygon"]; var nr = class { constructor(t, e) { this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null, this.canonical = null, this.featureTileCoord = null, this.featureDistanceData = null, this.scope = t, this.options = e; } id() { return this.feature && void 0 !== this.feature.id ? this.feature.id : null } geometryType() { return this.feature ? "number" == typeof this.feature.type ? rr[this.feature.type] : this.feature.type : null } geometry() { return this.feature && "geometry" in this.feature ? this.feature.geometry : null } canonicalID() { return this.canonical } properties() { return this.feature && this.feature.properties || {} } measureLight(t) { return this.globals.brightness || 0 } distanceFromCenter() { if (this.featureTileCoord && this.featureDistanceData) { const t = this.featureDistanceData.center, e = this.featureDistanceData.scale, { x: r, y: n } = this.featureTileCoord; return this.featureDistanceData.bearing[0] * (r * e - t[0]) + this.featureDistanceData.bearing[1] * (n * e - t[1]) } return 0 } parseColor(t) { let e = this._parseColorCache[t]; return e || (e = this._parseColorCache[t] = Re.parse(t)), e } getConfig(t) { return this.options ? this.options.get(t) : null } }; class ir { constructor(t, e, r, n, i) { this.name = t, this.type = e, this._evaluate = r, this.args = n, this._overloadIndex = i; } evaluate(t) { if (!this._evaluate) { const t = ir.definitions[this.name]; this._evaluate = Array.isArray(t) ? t[2] : t.overloads[this._overloadIndex][1]; } return this._evaluate(t, this.args) } eachChild(t) { this.args.forEach(t); } outputDefined() { return !1 } serialize() { return [this.name].concat(this.args.map((t => t.serialize()))) } static parse(t, e) { const r = t[0], n = ir.definitions[r]; if (!n) return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`, 0); const i = Array.isArray(n) ? n[0] : n.type, s = Array.isArray(n) ? [[n[1], n[2]]] : n.overloads, a = []; let o = null, l = -1; for (const [n, u] of s) { if (Array.isArray(n) && n.length !== t.length - 1) continue; a.push(n), l++, o = new xn(e.registry, e.path, null, e.scope, void 0, e._scope, e.options); const s = []; let c = !1; for (let e = 1; e < t.length; e++) { const r = t[e], i = Array.isArray(n) ? n[e - 1] : n.type, a = o.parse(r, 1 + s.length, i); if (!a) { c = !0; break } s.push(a); } if (!c) if (Array.isArray(n) && n.length !== s.length) o.error(`Expected ${n.length} arguments, but found ${s.length} instead.`); else { for (let t = 0; t < s.length; t++) { const e = Array.isArray(n) ? n[t] : n.type, r = s[t]; o.concat(t + 1).checkSubtype(e, r.type); } if (0 === o.errors.length) return new ir(r, i, u, s, l) } } if (1 === a.length) e.errors.push(...o.errors); else { const r = (a.length ? a : s.map((([t]) => t))).map(sr).join(" | "), n = []; for (let r = 1; r < t.length; r++) { const i = e.parse(t[r], 1 + n.length); if (!i) return null; n.push(Me(i.type)); } e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`); } return null } static register(t, e) { ir.definitions = e; for (const r in e) t[r] = ir; } } function sr(t) { return Array.isArray(t) ? `(${t.map(Me).join(", ")})` : `(${Me(t.type)}...)` } var ar = ir; class or { constructor(t, e, r) { this.type = ve, this.locale = r, this.caseSensitive = t, this.diacriticSensitive = e; } static parse(t, e) { if (2 !== t.length) return e.error("Expected one argument."); const r = t[1]; if ("object" != typeof r || Array.isArray(r)) return e.error("Collator options argument must be an object."); const n = e.parse(void 0 !== r["case-sensitive"] && r["case-sensitive"], 1, me); if (!n) return null; const i = e.parse(void 0 !== r["diacritic-sensitive"] && r["diacritic-sensitive"], 1, me); if (!i) return null; let s = null; return r.locale && (s = e.parse(r.locale, 1, de), !s) ? null : new or(n, i, s) } evaluate(t) { return new Le(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] } } var lr = { exports: {} }; lr.exports = function () { function t(r, n, i, s, a) { for (; s > i;) { if (s - i > 600) { var o = s - i + 1, l = n - i + 1, u = Math.log(o), c = .5 * Math.exp(2 * u / 3), h = .5 * Math.sqrt(u * c * (o - c) / o) * (l - o / 2 < 0 ? -1 : 1); t(r, n, Math.max(i, Math.floor(n - l * c / o + h)), Math.min(s, Math.floor(n + (o - l) * c / o + h)), a); } var p = r[n], f = i, d = s; for (e(r, i, n), a(r[s], p) > 0 && e(r, i, s); f < d;) { for (e(r, f, d), f++, d--; a(r[f], p) < 0;)f++; for (; a(r[d], p) > 0;)d--; } 0 === a(r[i], p) ? e(r, i, d) : e(r, ++d, s), d <= n && (i = d + 1), n <= d && (s = d - 1); } } function e(t, e, r) { var n = t[e]; t[e] = t[r], t[r] = n; } function r(t, e) { return t < e ? -1 : t > e ? 1 : 0 } return function (e, n, i, s, a) { t(e, n, i || 0, s || e.length - 1, a || r); } }(); var ur = p(lr.exports); function cr(t) { let e = 0; for (let r, n, i = 0, s = t.length, a = s - 1; i < s; a = i++)r = t[i], n = t[a], e += (n.x - r.x) * (r.y + n.y); return e } function hr(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 pr(t, e) { return !(t[0] <= e[0] || t[2] >= e[2] || t[1] <= e[1] || t[3] >= e[3]) } function fr(t, e, r) { const n = t[0] - e[0], i = t[1] - e[1], s = t[0] - r[0], a = t[1] - r[1]; return n * a - s * i == 0 && n * s <= 0 && i * a <= 0 } function dr(t, e, r = !1) { let n = !1; for (let o = 0, l = e.length; o < l; o++) { const l = e[o]; for (let e = 0, o = l.length, u = o - 1; e < o; u = e++) { const o = l[u], c = l[e]; if (fr(t, o, c)) return r; (s = o)[1] > (i = t)[1] != (a = c)[1] > i[1] && i[0] < (a[0] - s[0]) * (i[1] - s[1]) / (a[1] - s[1]) + s[0] && (n = !n); } } var i, s, a; return n } function mr(t, e, r, n) { const i = n[0] - r[0], s = n[1] - r[1], a = (t[0] - r[0]) * s - i * (t[1] - r[1]), o = (e[0] - r[0]) * s - i * (e[1] - r[1]); return a > 0 && o < 0 || a < 0 && o > 0 } function yr(t, e, r, n) { return 0 != (i = [n[0] - r[0], n[1] - r[1]])[0] * (s = [e[0] - t[0], e[1] - t[1]])[1] - i[1] * s[0] && !(!mr(t, e, r, n) || !mr(r, n, t, e)); var i, s; } const gr = 8192; function xr(t, e) { const r = (180 + t[0]) / 360, n = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t[1] * Math.PI / 360))) / 360, i = Math.pow(2, e.z); return [Math.round(r * i * gr), Math.round(n * i * gr)] } function vr(t, e) { for (let r = 0; r < e.length; r++)if (dr(t, e[r])) return !0; return !1 } function br(t, e, r) { for (const n of r) for (let r = 0, i = n.length, s = i - 1; r < i; s = r++)if (yr(t, e, n[s], n[r])) return !0; return !1 } function _r(t, e) { for (let r = 0; r < t.length; ++r)if (!dr(t[r], e)) return !1; for (let r = 0; r < t.length - 1; ++r)if (br(t[r], t[r + 1], e)) return !1; return !0 } function wr(t, e) { for (let r = 0; r < e.length; r++)if (_r(t, e[r])) return !0; return !1 } function Mr(t, e, r) { const n = []; for (let i = 0; i < t.length; i++) { const s = []; for (let n = 0; n < t[i].length; n++) { const a = xr(t[i][n], r); hr(e, a), s.push(a); } n.push(s); } return n } function Ar(t, e, r) { const n = []; for (let i = 0; i < t.length; i++) { const s = Mr(t[i], e, r); n.push(s); } return n } function Sr(t, e, r, n) { if (t[0] < r[0] || t[0] > r[2]) { const e = .5 * n; let i = t[0] - r[0] > e ? -n : r[0] - t[0] > e ? n : 0; 0 === i && (i = t[0] - r[2] > e ? -n : r[2] - t[0] > e ? n : 0), t[0] += i; } hr(e, t); } function Ir(t, e, r, n) { const i = Math.pow(2, n.z) * gr, s = [n.x * gr, n.y * gr], a = []; if (!t) return a; for (const n of t) for (const t of n) { const n = [t.x + s[0], t.y + s[1]]; Sr(n, e, r, i), a.push(n); } return a } function kr(t, e, r, n) { const i = Math.pow(2, n.z) * gr, s = [n.x * gr, n.y * gr], a = []; if (!t) return a; for (const r of t) { const t = []; for (const n of r) { const r = [n.x + s[0], n.y + s[1]]; hr(e, r), t.push(r); } a.push(t); } if (e[2] - e[0] <= i / 2) { (o = e)[0] = o[1] = 1 / 0, o[2] = o[3] = -1 / 0; for (const t of a) for (const n of t) Sr(n, e, r, i); } var o; return a } class Tr { constructor(t, e) { this.type = me, 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 ${t.length - 1} instead.`); if (Ue(t[1])) { const e = t[1]; if ("FeatureCollection" === e.type) for (let t = 0; t < e.features.length; ++t) { const r = e.features[t].geometry.type; if ("Polygon" === r || "MultiPolygon" === r) return new Tr(e, e.features[t].geometry) } else if ("Feature" === e.type) { const t = e.geometry.type; if ("Polygon" === t || "MultiPolygon" === t) return new Tr(e, e.geometry) } else if ("Polygon" === e.type || "MultiPolygon" === e.type) return new Tr(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 r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i = t.canonicalID(); if (!i) return !1; if ("Polygon" === e.type) { const s = Mr(e.coordinates, n, i), a = Ir(t.geometry(), r, n, i); if (!pr(r, n)) return !1; for (const t of a) if (!dr(t, s)) return !1 } if ("MultiPolygon" === e.type) { const s = Ar(e.coordinates, n, i), a = Ir(t.geometry(), r, n, i); if (!pr(r, n)) return !1; for (const t of a) if (!vr(t, s)) return !1 } return !0 }(t, this.geometries); if ("LineString" === t.geometryType()) return function (t, e) { const r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i = t.canonicalID(); if (!i) return !1; if ("Polygon" === e.type) { const s = Mr(e.coordinates, n, i), a = kr(t.geometry(), r, n, i); if (!pr(r, n)) return !1; for (const t of a) if (!_r(t, s)) return !1 } if ("MultiPolygon" === e.type) { const s = Ar(e.coordinates, n, i), a = kr(t.geometry(), r, n, i); if (!pr(r, n)) return !1; for (const t of a) if (!wr(t, s)) return !1 } return !0 }(t, this.geometries) } return !1 } eachChild() { } outputDefined() { return !0 } serialize() { return ["within", this.geojson] } } var Pr = Tr, zr = { exports: {} };
33 zr.exports = function () { var t = { kilometers: 1, miles: 1e3 / 1609.344, nauticalmiles: 1e3 / 1852, meters: 1e3, metres: 1e3, yards: 1e3 / .9144, feet: 1e3 / .3048, inches: 1e3 / .0254 }, e = 1 / 298.257223563, r = e * (2 - e), n = Math.PI / 180, i = function (e, i) { if (void 0 === e) throw new Error("No latitude given."); if (i && !t[i]) throw new Error("Unknown unit " + i + ". Use one of: " + Object.keys(t).join(", ")); var s = 6378.137 * n * (i ? t[i] : 1), a = Math.cos(e * n), o = 1 / (1 - r * (1 - a * a)), l = Math.sqrt(o); this.kx = s * l * a, this.ky = s * l * o * (1 - r); }, s = { units: { configurable: !0 } }; function a(t, e) { return t[0] === e[0] && t[1] === e[1] } function o(t, e, r) { var n = l(e[0] - t[0]); return [t[0] + n * r, t[1] + (e[1] - t[1]) * r] } function l(t) { for (; t < -180;)t += 360; for (; t > 180;)t -= 360; return t } return i.fromTile = function (t, e, r) { var s = Math.PI * (1 - 2 * (t + .5) / Math.pow(2, e)), a = Math.atan(.5 * (Math.exp(s) - Math.exp(-s))) / n; return new i(a, r) }, s.units.get = function () { return t }, i.prototype.distance = function (t, e) { var r = l(t[0] - e[0]) * this.kx, n = (t[1] - e[1]) * this.ky; return Math.sqrt(r * r + n * n) }, i.prototype.bearing = function (t, e) { var r = l(e[0] - t[0]) * this.kx; return Math.atan2(r, (e[1] - t[1]) * this.ky) / n }, i.prototype.destination = function (t, e, r) { var i = r * n; return this.offset(t, Math.sin(i) * e, Math.cos(i) * e) }, i.prototype.offset = function (t, e, r) { return [t[0] + e / this.kx, t[1] + r / this.ky] }, i.prototype.lineDistance = function (t) { for (var e = 0, r = 0; r < t.length - 1; r++)e += this.distance(t[r], t[r + 1]); return e }, i.prototype.area = function (t) { for (var e = 0, r = 0; r < t.length; r++)for (var n = t[r], i = 0, s = n.length, a = s - 1; i < s; a = i++)e += l(n[i][0] - n[a][0]) * (n[i][1] + n[a][1]) * (r ? -1 : 1); return Math.abs(e) / 2 * this.kx * this.ky }, i.prototype.along = function (t, e) { var r = 0; if (e <= 0) return t[0]; for (var n = 0; n < t.length - 1; n++) { var i = t[n], s = t[n + 1], a = this.distance(i, s); if ((r += a) > e) return o(i, s, (e - (r - a)) / a) } return t[t.length - 1] }, i.prototype.pointToSegmentDistance = function (t, e, r) { var n = e[0], i = e[1], s = l(r[0] - n) * this.kx, a = (r[1] - i) * this.ky, o = 0; return 0 === s && 0 === a || ((o = (l(t[0] - n) * this.kx * s + (t[1] - i) * this.ky * a) / (s * s + a * a)) > 1 ? (n = r[0], i = r[1]) : o > 0 && (n += s / this.kx * o, i += a / this.ky * o)), s = l(t[0] - n) * this.kx, a = (t[1] - i) * this.ky, Math.sqrt(s * s + a * a) }, i.prototype.pointOnLine = function (t, e) { for (var r, n, i, s, a = 1 / 0, o = 0; o < t.length - 1; o++) { var u = t[o][0], c = t[o][1], h = l(t[o + 1][0] - u) * this.kx, p = (t[o + 1][1] - c) * this.ky, f = 0; 0 === h && 0 === p || ((f = (l(e[0] - u) * this.kx * h + (e[1] - c) * this.ky * p) / (h * h + p * p)) > 1 ? (u = t[o + 1][0], c = t[o + 1][1]) : f > 0 && (u += h / this.kx * f, c += p / this.ky * f)); var d = (h = l(e[0] - u) * this.kx) * h + (p = (e[1] - c) * this.ky) * p; d < a && (a = d, r = u, n = c, i = o, s = f); } return { point: [r, n], index: i, t: Math.max(0, Math.min(1, s)) } }, i.prototype.lineSlice = function (t, e, r) { var n = this.pointOnLine(r, t), i = this.pointOnLine(r, e); if (n.index > i.index || n.index === i.index && n.t > i.t) { var s = n; n = i, i = s; } var o = [n.point], l = n.index + 1, u = i.index; !a(r[l], o[0]) && l <= u && o.push(r[l]); for (var c = l + 1; c <= u; c++)o.push(r[c]); return a(r[u], i.point) || o.push(i.point), o }, i.prototype.lineSliceAlong = function (t, e, r) { for (var n = 0, i = [], s = 0; s < r.length - 1; s++) { var a = r[s], l = r[s + 1], u = this.distance(a, l); if ((n += u) > t && 0 === i.length && i.push(o(a, l, (t - (n - u)) / u)), n >= e) return i.push(o(a, l, (e - (n - u)) / u)), i; n > t && i.push(l); } return i }, i.prototype.bufferPoint = function (t, e) { var r = e / this.ky, n = e / this.kx; return [t[0] - n, t[1] - r, t[0] + n, t[1] + r] }, i.prototype.bufferBBox = function (t, e) { var r = e / this.ky, n = e / this.kx; return [t[0] - n, t[1] - r, t[2] + n, t[3] + r] }, i.prototype.insideBBox = function (t, e) { return l(t[0] - e[0]) >= 0 && l(t[0] - e[2]) <= 0 && t[1] >= e[1] && t[1] <= e[3] }, Object.defineProperties(i, s), i }(); var Er = p(zr.exports), Br = { exports: {} }; Br.exports = function () { var t = function (t, r) { if (void 0 === t && (t = []), void 0 === r && (r = e), this.data = t, this.length = this.data.length, this.compare = r, this.length > 0) for (var n = (this.length >> 1) - 1; n >= 0; n--)this._down(n); }; function e(t, e) { return t < e ? -1 : t > e ? 1 : 0 } return t.prototype.push = function (t) { this.data.push(t), this.length++, this._up(this.length - 1); }, t.prototype.pop = function () { if (0 !== this.length) { var t = this.data[0], e = this.data.pop(); return this.length--, this.length > 0 && (this.data[0] = e, this._down(0)), t } }, t.prototype.peek = function () { return this.data[0] }, t.prototype._up = function (t) { for (var e = this.data, r = this.compare, n = e[t]; t > 0;) { var i = t - 1 >> 1, s = e[i]; if (r(n, s) >= 0) break; e[t] = s, t = i; } e[t] = n; }, t.prototype._down = function (t) { for (var e = this.data, r = this.compare, n = this.length >> 1, i = e[t]; t < n;) { var s = 1 + (t << 1), a = e[s], o = s + 1; if (o < this.length && r(e[o], a) < 0 && (s = o, a = e[o]), r(a, i) >= 0) break; e[t] = a, t = s; } e[t] = i; }, t }(); var Dr = p(Br.exports), Cr = 8192; function Rr(t, e) { return e.dist - t.dist } const Lr = 100, Vr = 50; function Or(t) { const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; if (e.length !== t.length) return !1; for (let r = 0; r < e.length; r++)if (e[r] !== t[r]) return !1; return !0 } function Fr(t) { return t[1] - t[0] + 1 } function jr(t, e) { const r = t[1] >= t[0] && t[1] < e; return r || console.warn("Distance Expression: Index is out of range"), r } function Ur(t, e) { if (t[0] > t[1]) return [null, null]; const r = Fr(t); if (e) { if (2 === r) return [t, null]; const e = Math.floor(r / 2); return [[t[0], t[0] + e], [t[0] + e, t[1]]] } { if (1 === r) return [t, null]; const e = Math.floor(r / 2) - 1; return [[t[0], t[0] + e], [t[0] + e + 1, t[1]]] } } function Nr(t, e) { const r = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; if (!jr(e, t.length)) return r; for (let n = e[0]; n <= e[1]; ++n)hr(r, t[n]); return r } function $r(t) { const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; for (let r = 0; r < t.length; ++r)for (let n = 0; n < t[r].length; ++n)hr(e, t[r][n]); return e } function qr(t, e, r) { if (Or(t) || Or(e)) return NaN; let n = 0, i = 0; return t[2] < e[0] && (n = e[0] - t[2]), t[0] > e[2] && (n = t[0] - e[2]), t[1] > e[3] && (i = t[1] - e[3]), t[3] < e[1] && (i = e[1] - t[3]), r.distance([0, 0], [n, i]) } function Gr(t, e) { const r = Math.pow(2, e.z); return [(i = (t.x / Cr + e.x) / r, 360 * i - 180), (n = (t.y / Cr + e.y
vendor: 3,161 bytes, line 33
33) / r, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * n) * Math.PI / 180)) - 90)]; var n, i; } function Yr(t, e) { const r = []; for (let n = 0; n < t.length; ++n)r.push(Gr(t[n], e)); return r } function Zr(t, e, r) { const n = r.pointOnLine(e, t).point; return r.distance(t, n) } function Xr(t, e, r, n, i) { const s = r.slice(n[0], n[1] + 1); let a = 1 / 0; for (let r = e[0]; r <= e[1]; ++r)if (0 === (a = Math.min(a, Zr(t[r], s, i)))) return 0; return a } function Kr(t, e, r, n, i) { const s = Math.min(i.pointToSegmentDistance(t, r, n), i.pointToSegmentDistance(e, r, n)), a = Math.min(i.pointToSegmentDistance(r, t, e), i.pointToSegmentDistance(n, t, e)); return Math.min(s, a) } function Wr(t, e, r, n, i) { if (!jr(e, t.length) || !jr(n, r.length)) return NaN; let s = 1 / 0; for (let a = e[0]; a < e[1]; ++a)for (let e = n[0]; e < n[1]; ++e) { if (yr(t[a], t[a + 1], r[e], r[e + 1])) return 0; s = Math.min(s, Kr(t[a], t[a + 1], r[e], r[e + 1], i)); } return s } function Hr(t, e, r, n, i) { if (!jr(e, t.length) || !jr(n, r.length)) return NaN; let s = 1 / 0; for (let a = e[0]; a <= e[1]; ++a)for (let e = n[0]; e <= n[1]; ++e)if (0 === (s = Math.min(s, i.distance(t[a], r[e])))) return s; return s } function Jr(t, e, r) { if (dr(t, e, !0)) return 0; let n = 1 / 0; for (const i of e) { const e = i.length; if (e < 2) return console.warn("Distance Expression: Invalid polygon!"), NaN; if (i[0] !== i[e - 1] && 0 === (n = Math.min(n, r.pointToSegmentDistance(t, i[e - 1], i[0])))) return n; if (0 === (n = Math.min(n, Zr(t, i, r)))) return n } return n } function Qr(t, e, r, n) { if (!jr(e, t.length)) return NaN; for (let n = e[0]; n <= e[1]; ++n)if (dr(t[n], r, !0)) return 0; let i = 1 / 0; for (let s = e[0]; s < e[1]; ++s)for (const e of r) for (let r = 0, a = e.length, o = a - 1; r < a; o = r++) { if (yr(t[s], t[s + 1], e[o], e[r])) return 0; i = Math.min(i, Kr(t[s], t[s + 1], e[o], e[r], n)); } return i } function tn(t, e) { for (const r of t) for (let t = 0; t <= r.length - 1; ++t)if (dr(r[t], e, !0)) return !0; return !1 } function en(t, e, r, n = 1 / 0) { const i = $r(t), s = $r(e); if (n !== 1 / 0 && qr(i, s, r) >= n) return n; if (pr(i, s)) { if (tn(t, e)) return 0 } else if (tn(e, t)) return 0; let a = n; for (const n of t) for (let t = 0, i = n.length, s = i - 1; t < i; s = t++)for (const i of e) for (let e = 0, o = i.length, l = o - 1; e < o; l = e++) { if (yr(n[s], n[t], i[l], i[e])) return 0; a = Math.min(a, Kr(n[s], n[t], i[l], i[e], r)); } return a } function rn(t, e, r, n, i, s, a) { if (null === s || null === a) return; const o = qr(Nr(n, s), Nr(i, a), r); o < e && t.push({ dist: o, range1: s, range2: a }); } function nn(t, e, r, n, i = 1 / 0) { let s = Math.min(n.distance(t[0], r[0][0]), i); if (0 === s) return s; const a = new Dr([{ dist: 0, range1: [0, t.length - 1], range2: [0, 0] }], Rr), o = e ? Vr : Lr, l = $r(r); for (; a.length;) { const i = a.pop(); if (i.dist >= s) continue; const u = i.range1; if (Fr(u) <= o) { if (!jr(u, t.length)) return NaN; if (e) { const e = Qr(t, u, r, n); if (0 === (s = Math.min(s, e))) return s } else for (let e = u[0]; e <= u[1]; ++e) { const i = Jr(t[e], r, n);
33 if (0 === (s = Math.min(s, i))) return s } } else { const r = Ur(u, e); if (null !== r[0]) { const e = qr(Nr(t, r[0]), l, n); e < s && a.push({ dist: e, range1: r[0], range2: [0, 0] }); } if (null !== r[1]) { const e = qr(Nr(t, r[1]), l, n); e < s && a.push({ dist: e, range1: r[1], range2: [0, 0] }); } } } return s } function sn(t, e, r, n, i, s = 1 / 0) { let a = Math.min(s, i.distance(t[0], r[0])); if (0 === a) return a; const o = new Dr([{ dist: 0, range1: [0, t.length - 1], range2: [0, r.length - 1] }], Rr), l = e ? Vr : Lr, u = n ? Vr : Lr; for (; o.length;) { const s = o.pop(); if (s.dist >= a) continue; const c = s.range1, h = s.range2; if (Fr(c) <= l && Fr(h) <= u) { if (!jr(c, t.length) || !jr(h, r.length)) return NaN; if (e && n ? a = Math.min(a, Wr(t, c, r, h, i)) : e || n ? e && !n ? a = Math.min(a, Xr(r, h, t, c, i)) : !e && n && (a = Math.min(a, Xr(t, c, r, h, i))) : a = Math.min(a, Hr(t, c, r, h, i)), 0 === a) return a } else { const s = Ur(c, e), l = Ur(h, n); rn(o, a, i, t, r, s[0], l[0]), rn(o, a, i, t, r, s[0], l[1]), rn(o, a, i, t, r, s[1], l[0]), rn(o, a, i, t, r, s[1], l[1]); } } return a } function an(t, e, r, n, i = 1 / 0) { let s = i; const a = Nr(t, [0, t.length - 1]); for (const i of r) if (!(s !== 1 / 0 && qr(a, Nr(i, [0, i.length - 1]), n) >= s) && (s = Math.min(s, sn(t, e, i, !0, n, s)), 0 === s)) return s; return s } function on(t, e, r, n, i = 1 / 0) { let s = i; const a = Nr(t, [0, t.length - 1]); for (const i of r) { if (s !== 1 / 0 && qr(a, $r(i), n) >= s) continue; const r = nn(t, e, i, n, s); if (isNaN(r)) return r; if (0 === (s = Math.min(s, r))) return s } return s } function ln(t) { return "Point" === t || "MultiPoint" === t || "LineString" === t || "MultiLineString" === t || "Polygon" === t || "MultiPolygon" === t } class un { constructor(t, e) { this.type = fe, this.geojson = t, this.geometries = e; } static parse(t, e) { if (2 !== t.length) return e.error(`'distance' expression requires either one argument, but found ' ${t.length - 1} instead.`); if (Ue(t[1])) { const e = t[1]; if ("FeatureCollection" === e.type) { for (let t = 0; t < e.features.length; ++t)if (ln(e.features[t].geometry.type)) return new un(e, e.features[t].geometry) } else if ("Feature" === e.type) { if (ln(e.geometry.type)) return new un(e, e.geometry) } else if (ln(e.type)) return new un(e, e) } return e.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].") } evaluate(t) { const e = t.geometry(), r = t.canonicalID(); if (null != e && null != r) { if ("Point" === t.geometryType()) return function (t, e, r) { const n = []; for (const r of t) for (const t of r) n.push(Gr(t, e)); const i = new Er(n[0][1], "meters"); return "Point" === r.type || "MultiPoint" === r.type || "LineString" === r.type ? sn(n, !1, "Point" === r.type ? [r.coordinates] : r.coordinates, "LineString" === r.type, i) : "MultiLineString" === r.type ? an(n, !1, r.coordinates, i) : "Polygon" === r.type || "MultiPolygon" === r.type ? on(n, !1, "Polygon" === r.type ? [r.coordinates] : r.coordinates, i) : null }(e, r, this.geometries); if ("LineString" === t.geometryType()) return function (t, e, r) { const n = []; for (const r of t) { const t = []; for (const n of r) t.push(Gr(n, e)); n.push(t); } const i = new Er(n[0][0][1], "meters"); if ("Point" === r.type || "MultiPoint" === r.type || "LineString" === r.type) return an("Point" === r.type ? [r.coordinates] : r.coordinates, "LineString" === r.type, n, i); if ("MultiLineString" === r.type) { let t = 1 / 0; for (let e = 0; e < r.coordinates.length; e++) { const s = an(r.coordinates[e], !0, n, i, t); if (isNaN(s)) return s; if (0 === (t = Math.min(t, s))) return t } return t } if ("Polygon" === r.type || "MultiPolygon" === r.type) { let t = 1 / 0; for (let e = 0; e < n.length; e++) { const s = on(n[e], !0, "Polygon" === r.type ? [r.coordinates] : r.coordinates, i, t); if (isNaN(s)) return s; if (0 === (t = Math.min(t, s))) return t } return t } return null }(e, r, this.geometries); if ("Polygon" === t.geometryType()) return function (t, e, r) { const n = []; for (const r of function (t, e) { const r = t.length; if (r <= 1) return [t]; const n = []; let i, s; for (let e = 0; e < r; e++) { const r = cr(t[e]); 0 !== r && (t[e].area = Math.abs(r), void 0 === s && (s = r < 0), s === r < 0 ? (i && n.push(i), i = [t[e]
33]) : i.push(t[e])); } return i && n.push(i), n }(t)) { const t = []; for (let n = 0; n < r.length; ++n)t.push(Yr(r[n], e)); n.push(t); } const i = new Er(n[0][0][0][1], "meters"); if ("Point" === r.type || "MultiPoint" === r.type || "LineString" === r.type) return on("Point" === r.type ? [r.coordinates] : r.coordinates, "LineString" === r.type, n, i); if ("MultiLineString" === r.type) { let t = 1 / 0; for (let e = 0; e < r.coordinates.length; e++) { const s = on(r.coordinates[e], !0, n, i, t); if (isNaN(s)) return s; if (0 === (t = Math.min(t, s))) return t } return t } return "Polygon" === r.type || "MultiPolygon" === r.type ? function (t, e, r) { let n = 1 / 0; for (const i of t) for (const t of e) { const e = en(i, t, r, n); if (isNaN(e)) return e; if (0 === (n = Math.min(n, e))) return n } return n }("Polygon" === r.type ? [r.coordinates] : r.coordinates, n, i) : null }(e, r, this.geometries); console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."); } else console.warn("Distance Expression: requirs valid feature and canonical information."); return null } eachChild() { } outputDefined() { return !0 } serialize() { return ["distance", this.geojson] } } var cn = un; function hn(t) { if (t instanceof ar) { 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 Pr) return !1; if (t instanceof cn) return !1; let e = !0; return t.eachChild((t => { e && !hn(t) && (e = !1); })), e } function pn(t) { if (t instanceof ar && "feature-state" === t.name) return !1; let e = !0; return t.eachChild((t => { e && !pn(t) && (e = !1); })), e } function fn(t) { if (t instanceof ar && "config" === t.name) return !1; let e = !0; return t.eachChild((t => { e && !fn(t) && (e = !1); })), e } function dn(t, e) { if (t instanceof ar && e.indexOf(t.name) >= 0) return !1; let r = !0; return t.eachChild((t => { r && !dn(t, e) && (r = !1); })), r } class mn { 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 r = t[1]; return e.scope.has(r) ? new mn(r, e.scope.get(r)) : e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`, 1) } evaluate(t) { return this.boundExpression.evaluate(t) } eachChild() { } outputDefined() { return !1 } serialize() { return ["var", this.name] } } var yn = mn; class gn { constructor(t, e = [], r, n = new he, i = [], s, a) { this.registry = t, this.path = e, this.key = e.map((t => `[${t}]`)).join(""), this.scope = n, this.errors = i, this.expectedType = r, this._scope = s, this.options = a; } parse(t, e, r, n, i = {}) { return e || r ? this.concat(e, r, n)._parse(t, i) : this._parse(t, i) } _parse(t, e) { function r(t, e, r) { return "assert" === r ? new Ke(e, [t]) : "coerce" === r ? new er(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 n = "string" == typeof t[0] ? this.registry[t[0]] : void 0; if (n) { let i = n.parse(t, this); if (!i) return null; if (this.expectedType) { const t = this.expectedType, n = i.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 i = r(i, t, e.typeAnnotation || "coerce"); else i = r(i, t, e.typeAnnotation || "assert"); } if (!(i instanceof Ge) && "resolvedImage" !== i.type.kind && vn(i)) { const t = new nr(this._scope, this.options); try { i = new Ge(i.type, i.evaluate(t)); } catch (t) { return this.error(t.message), null } } return i } return er.parse(["to-array", t], this) } 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 ${typeof t} instead.`) } concat(t, e, r) { const n = "number" == typeof t ? this.path.concat(t) : this.path, i = r ? this.scope.concat(r) : this.scope; return new gn(this.registry, n, e || null, i, this.errors, this._scope, this.options) } error(t, ...e) { const r = `${this.key}${e.map((t => `[${t}]`)).join("")}`; this.errors.push(new ue(r, t)); } checkSubtype(t, e) { const r = Se(t, e); return r && this.error(r), r } } var xn = gn; function vn(t) { if (t instanceof yn) return vn(t.boundExpression); if (t instanceof ar && "error" === t.name) return !1; if (t instanceof ar && "config" === t.name) return !1; if (t instanceof or) return !1; if (t instanceof Pr) return !1; if (t instanceof cn) return !1; const e = t instanceof er || t instanceof Ke; let r = !0; return t.eachChild((t => { r = e ? r && vn(t) : r && t instanceof Ge; })), !!r && hn(t) && dn(t, ["zoom", "heatmap-density", "line-progress", "raster-value", "sky-radial-progress", "accumulated", "is-supported-script", "pitch", "distance-from-center", "measure-light"]) } function bn(t, e) { const r = t.length - 1; let n, i, s = 0, a = r, o = 0; for (; s <= a;)if (o = Math.floor((s + a) / 2), n = t[o], i = t[o + 1], n <= e) { if (o === r || e < i) return o; s = o + 1; } else { if (!(n > e)) throw new Ye("Input is not a number."); a = o - 1; } return 0 } class _n { constructor(t, e, r) { this.type = t, this.input = e, this.labels = [], this.outputs = []; for (const [t, e] of r) this.labels.push(t), this.outputs.push(e); } static parse(t, e) { if (t.length - 1 < 4) return e.error(`Expected at least 4 arguments, but found only ${t.length - 1}.`); if ((t.length - 1) % 2 != 0) return e.error("Expected an even number of arguments."); const r = e.parse(t[1], 1, fe); if (!r) return null; const n = []; let i = null; e.expectedType && "value" !== e.expectedType.kind && (i = e.expectedType); for (let r = 1; r < t.length; r += 2) { const s = 1 === r ? -1 / 0 : t[r], a = t[r + 1], o = r, l = r + 1; if ("number" != typeof s) return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
33omputed expressions) for the input values.', o); if (n.length && n[n.length - 1][0] >= s) return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', o); const u = e.parse(a, l, i); if (!u) return null; i = i || u.type, n.push([s, u]); } return new _n(i, r, n) } evaluate(t) { const e = this.labels, r = this.outputs; if (1 === e.length) return r[0].evaluate(t); const n = this.input.evaluate(t); if (n <= e[0]) return r[0].evaluate(t); const i = e.length; return n >= e[i - 1] ? r[i - 1].evaluate(t) : r[bn(e, n)].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 wn = _n; function Mn(t, e, r) { return t * (1 - r) + e * r } function An(t, e, r) { return t.map(((t, n) => Mn(t, e[n], r))) } var Sn = Object.freeze({ __proto__: null, array: An, color: function (t, e, r) { return new Re(Mn(t.r, e.r, r), Mn(t.g, e.g, r), Mn(t.b, e.b, r), Mn(t.a, e.a, r)) }, number: Mn }); const In = .95047, kn = 1.08883, Tn = 4 / 29, Pn = 6 / 29, zn = 3 * Pn * Pn, En = Pn * Pn * Pn, Bn = Math.PI / 180, Dn = 180 / Math.PI; function Cn(t) { return t > En ? Math.pow(t, 1 / 3) : t / zn + Tn } function Rn(t) { return t > Pn ? t * t * t : zn * (t - Tn) } function Ln(t) { return 255 * (t <= .0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - .055) } function Vn(t) { return (t /= 255) <= .04045 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4) } function On(t) { const e = Vn(t.r), r = Vn(t.g), n = Vn(t.b), i = Cn((.4124564 * e + .3575761 * r + .1804375 * n) / In), s = Cn((.2126729 * e + .7151522 * r + .072175 * n) / 1); return { l: 116 * s - 16, a: 500 * (i - s), b: 200 * (s - Cn((.0193339 * e + .119192 * r + .9503041 * n) / kn)), alpha: t.a } } function Fn(t) { let e = (t.l + 16) / 116, r = isNaN(t.a) ? e : e + t.a / 500, n = isNaN(t.b) ? e : e - t.b / 200; return e = 1 * Rn(e), r = In * Rn(r), n = kn * Rn(n), new Re(Ln(3.2404542 * r - 1.5371385 * e - .4985314 * n), Ln(-.969266 * r + 1.8760108 * e + .041556 * n), Ln(.0556434 * r - .2040259 * e + 1.0572252 * n), t.alpha) } function jn(t, e, r) { const n = e - t; return t + r * (n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n) } const Un = { forward: On, reverse: Fn, interpolate: function (t, e, r) { return { l: Mn(t.l, e.l, r), a: Mn(t.a, e.a, r), b: Mn(t.b, e.b, r), alpha: Mn(t.alpha, e.alpha, r) } } }, Nn = { forward: function (t) { const { l: e, a: r, b: n } = On(t), i = Math.atan2(n, r) * Dn; return { h: i < 0 ? i + 360 : i, c: Math.sqrt(r * r + n * n), l: e, alpha: t.a } }, reverse: function (t) { const e = t.h * Bn, r = t.c; return Fn({ l: t.l, a: Math.cos(e) * r, b: Math.sin(e) * r, alpha: t.alpha }) }, interpolate: function (t, e, r) { return { h: jn(t.h, e.h, r), c: Mn(t.c, e.c, r), l: Mn(t.l, e.l, r), alpha: Mn(t.alpha, e.alpha, r) } } }; var $n = Object.freeze({ __proto__: null, hcl: Nn, lab: Un }); class qn { constructor(t, e, r, n, i) { this.type = t, this.operator = e, this.interpolation = r, this.input = n, this.labels = [], this.outputs = []; for (const [t, e] of i) this.labels.push(t), this.outputs.push(e); } static interpolationFactor(t, e, r, n) { let i = 0; if ("exponential" === t.name) i = Gn(e, t.base, r, n);
vendor: 19,474 bytes, line 33
33 else if ("linear" === t.name) i = Gn(e, 1, r, n); else if ("cubic-bezier" === t.name) { const s = t.controlPoints; i = new m(s[0], s[1], s[2], s[3]).solve(Gn(e, 1, r, n)); } return i } static parse(t, e) { let [r, n, i, ...s] = t; if (!Array.isArray(n) || 0 === n.length) return e.error("Expected an interpolation type expression.", 1); if ("linear" === n[0]) n = { name: "linear" }; else if ("exponential" === n[0]) { const t = n[1]; if ("number" != typeof t) return e.error("Exponential interpolation requires a numeric base.", 1, 1); n = { name: "exponential", base: t }; } else { if ("cubic-bezier" !== n[0]) return e.error(`Unknown interpolation type ${String(n[0])}`, 1, 0); { const t = n.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); n = { name: "cubic-bezier", controlPoints: t }; } } if (t.length - 1 < 4) return e.error(`Expected at least 4 arguments, but found only ${t.length - 1}.`); if ((t.length - 1) % 2 != 0) return e.error("Expected an even number of arguments."); if (i = e.parse(i, 2, fe), !i) return null; const a = []; let o = null; "interpolate-hcl" === r || "interpolate-lab" === r ? o = ye : e.expectedType && "value" !== e.expectedType.kind && (o = e.expectedType); for (let t = 0; t < s.length; t += 2) { const r = s[t], n = s[t + 1], i = t + 3, l = t + 4; if ("number" != typeof r) return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', i); if (a.length && a[a.length - 1][0] >= r) return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', i); const u = e.parse(n, l, o); if (!u) return null; o = o || u.type, a.push([r, u]); } return "number" === o.kind || "color" === o.kind || "array" === o.kind && "number" === o.itemType.kind && "number" == typeof o.N ? new qn(o, r, n, i, a) : e.error(`Type ${Me(o)} is not interpolatable.`) } evaluate(t) { const e = this.labels, r = this.outputs; if (1 === e.length) return r[0].evaluate(t); const n = this.input.evaluate(t); if (n <= e[0]) return r[0].evaluate(t); const i = e.length; if (n >= e[i - 1]) return r[i - 1].evaluate(t); const s = bn(e, n), a = qn.interpolationFactor(this.interpolation, n, e[s], e[s + 1]), o = r[s].evaluate(t), l = r[s + 1].evaluate(t); return "interpolate" === this.operator ? Sn[this.type.kind.toLowerCase()](o, l, a) : "interpolate-hcl" === this.operator ? Nn.reverse(Nn.interpolate(Nn.forward(o), Nn.forward(l), a)) : Un.reverse(Un.interpolate(Un.forward(o), Un.forward(l), a)) } 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 t = 0; t < this.labels.length; t++)e.push(this.labels[t], this.outputs[t].serialize()); return e } } function Gn(t, e, r, n) { const i = n - r, s = t - r; return 0 === i ? 0 : 1 === e ? s / i : (Math.pow(e, s) - 1) / (Math.pow(e, i) - 1) } var Yn = qn; class Zn { 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 r = null; const n = e.expectedType; n && "value" !== n.kind && (r = n); const i = []; for (const n of t.slice(1)) { const t = e.parse(n, 1 + i.length, r, void 0, { typeAnnotation: "omit" }); if (!t) return null; r = r || t.type, i.push(t); } const s = n && i.some((t => Se(n, t.type))); return new Zn(s ? xe : r, i) } evaluate(t) { let e, r = null, n = 0; for (const i of this.args) { if (n++, r = i.evaluate(t), r && r instanceof Fe && !r.available && (e || (e = r), r = null, n === this.args.length)) return e; if (null !== r) break } return r } 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 Xn = Zn; class Kn { 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 ${t.length - 1} instead.`); const r = []; for (let n = 1; n < t.length - 1; n += 2) { const i = t[n]; if ("string" != typeof i) return e.error(`Expected string, but found ${typeof i} instead.`, n); if (/[^a-zA-Z0-9_]/.test(i)) return e.error("Variable names must contain only alphanumeric characters or '_'.", n); const s = e.parse(t[n + 1], n + 1); if (!s) return null; r.push([i, s]); } const n = e.parse(t[t.length - 1], t.length - 1, e.expectedType, r); return n ? new Kn(r, n) : null } outputDefined() { return this.result.outputDefined() } serialize() { const t = ["let"]; for (const [e, r] of this.bindings) t.push(e, r.serialize()); return t.push(this.result.serialize()), t } } var Wn = Kn; class Hn { constructor(t, e, r) { this.type = t, this.index = e, this.input = r; } static parse(t, e) { if (3 !== t.length) return e.error(`Expected 2 arguments, but found ${t.length - 1} instead.`); const r = e.parse(t[1], 1, fe), n = e.parse(t[2], 2, we(e.expectedType || xe)); return r && n ? new Hn(n.type.itemType, r, n) : null } evaluate(t) { const e = this.index.evaluate(t), r = this.input.evaluate(t); if (e < 0) throw new Ye(`Array index out of bounds: ${e} < 0.`); if (e >= r.length) throw new Ye(`Array index out of bounds: ${e} > ${r.length - 1}.`); if (e !== Math.floor(e)) throw new Ye(`Array index must be an integer, but found ${e} instead.`); return r[e] } eachChild(t) { t(this.index), t(this.input); } outputDefined() { return !1 } serialize() { return ["at", this.index.serialize(), this.input.serialize()] } } var Jn = Hn; class Qn { constructor(t, e) { this.type = me, this.needle = t, this.haystack = e; } static parse(t, e) { if (3 !== t.length) return e.error(`Expected 2 arguments, but found ${t.length - 1} instead.`); const r = e.parse(t[1], 1, xe), n = e.parse(t[2], 2, xe); return r && n ? Ie(r.type, [me, de, fe, pe, xe]) ? new Qn(r, n) : e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Me(r.type)} instead`) : null } evaluate(t) { const e = this.needle.evaluate(t), r = this.haystack.evaluate(t); if (null == r) return !1; if (!ke(e, ["boolean", "string", "number", "null"])) throw new Ye(`Expected first argument to be of type boolean, string, number or null, but found ${Me(Ne(e))} instead.`); if (!ke(r, ["string", "array"])) throw new Ye(`Expected second argument to be of type array or string, but found ${Me(Ne(r))} instead.`); return r.indexOf(e) >= 0 } eachChild(t) { t(this.needle), t(this.haystack); } outputDefined() { return !0 } serialize() { return ["in", this.needle.serialize(), this.haystack.serialize()] } } var ti = Qn; class ei { constructor(t, e, r) { this.type = fe, this.needle = t, this.haystack = e, this.fromIndex = r; } static parse(t, e) { if (t.length <= 2 || t.length >= 5) return e.error(`Expected 3 or 4 arguments, but found ${t.length - 1} instead.`); const r = e.parse(t[1], 1, xe), n = e.parse(t[2], 2, xe); if (!r || !n) return null; if (!Ie(r.type, [me, de, fe, pe, xe])) return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Me(r.type)} instead`); if (4 === t.length) { const i = e.parse(t[3], 3, fe); return i ? new ei(r, n, i) : null } return new ei(r, n) } evaluate(t) { const e = this.needle.evaluate(t), r = this.haystack.evaluate(t); if (!ke(e, ["boolean", "string", "number", "null"])) throw new Ye(`Expected first argument to be of type boolean, string, number or null, but found ${Me(Ne(e))} instead.`); if (!ke(r, ["string", "array"])) throw new Ye(`Expected second argument to be of type array or string, but found ${Me(Ne(r))} instead.`); if (this.fromIndex) { const n = this.fromIndex.evaluate(t); return r.indexOf(e, n) } return r.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 ri = ei; class ni { constructor(t, e, r, n, i, s) { this.inputType = t, this.type = e, this.input = r, this.cases = n, this.outputs = i, this.otherwise = s; } static parse(t, e) { if (t.length < 5) return e.error(`Expected at least 4 arguments, but found only ${t.length - 1}.`); if (t.length % 2 != 1) return e.error("Expected an even number of arguments."); let r, n; e.expectedType && "value" !== e.expectedType.kind && (n = e.expectedType); const i = {}, s = []; for (let a = 2; a < t.length - 1; a += 2) { let o = t[a]; const l = t[a + 1]; Array.isArray(o) || (o = [o]); const u = e.concat(a); if (0 === o.length) return u.error("Expected at least one branch label."); for (const t of o) { if ("number" != typeof t && "string" != typeof t) return u.error("Branch labels must be numbers or strings."); if ("number" == typeof t && Math.abs(t) > Number.MAX_SAFE_INTEGER) return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`); if ("number" == typeof t && Math.floor(t) !== t) return u.error("Numeric branch labels must be integer values."); if (r) { if (u.checkSubtype(r, Ne(t))) return null } else r = Ne(t); if (void 0 !== i[String(t)]) return u.error("Branch labels must be unique."); i[String(t)] = s.length; } const c = e.parse(l, a, n); if (!c) return null; n = n || c.type, s.push(c); } const a = e.parse(t[1], 1, xe); if (!a) return null; const o = e.parse(t[t.length - 1], t.length - 1, n); return o ? "value" !== a.type.kind && e.concat(1).checkSubtype(r, a.type) ? null : new ni(r, n, a, i, s, o) : null } evaluate(t) { const e = this.input.evaluate(t); return (Ne(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(), r = [], n = {}; for (const t of e) { const e = n[this.cases[t]]; void 0 === e ? (n[this.cases[t]] = r.length, r.push([this.cases[t], [t]])) : r[e][1].push(t); } const i = t => "number" === this.inputType.kind ? Number(t) : t; for (const [e, n] of r) t.push(1 === n.length ? i(n[0]) : n.map(i)), t.push(this.outputs[e].serialize()); return t.push(this.otherwise.serialize()), t } } var ii = ni; class si { constructor(t, e, r) { this.type = t, this.branches = e, this.otherwise = r; } static parse(t, e) { if (t.length < 4) return e.error(`Expected at least 3 arguments, but found only ${t.length - 1}.`); if (t.length % 2 != 0) return e.error("Expected an odd number of arguments."); let r; e.expectedType && "value" !== e.expectedType.kind && (r = e.expectedType); const n = []; for (let i = 1; i < t.length - 1; i += 2) { const s = e.parse(t[i], i, me); if (!s) return null; const a = e.parse(t[i + 1], i + 1, r); if (!a) return null; n.push([s, a]), r = r || a.type; } const i = e.parse(t[t.length - 1], t.length - 1, r); return i ? new si(r, n, i) : null } evaluate(t) { for (const [e, r] of this.branches) if (e.evaluate(t)) return r.evaluate(t); return this.otherwise.evaluate(t) } eachChild(t) { for (const [e, r] of this.branches) t(e), t(r); t(this.otherwise); } outputDefined() { return this.branches.every((([t, e]) => e.outputDefined())) && this.otherwise.outputDefined() } serialize() { const t = ["case"]; return this.eachChild((e => { t.push(e.serialize()); })), t } } var ai = si; class oi { constructor(t, e, r, n) { this.type = t, this.input = e, this.beginIndex = r, this.endIndex = n; } static parse(t, e) { if (t.length <= 2 || t.length >= 5) return e.error(`Expected 3 or 4 arguments, but found ${t.length - 1} instead.`); const r = e.parse(t[1], 1, xe), n = e.parse(t[2], 2, fe); if (!r || !n) return null; if (!Ie(r.type, [we(xe), de, xe])) return e.error(`Expected first argument to be of type array or string, but found ${Me(r.type)} instead`); if (4 === t.length) { const i = e.parse(t[3], 3, fe); return i ? new oi(r.type, r, n, i) : null } return new oi(r.type, r, n) } evaluate(t) { const e = this.input.evaluate(t), r = this.beginIndex.evaluate(t); if (!ke(e, ["string", "array"])) throw new Ye(`Expected first argument to be of type array or string, but found ${Me(Ne(e))} instead.`); if (this.endIndex) { const n = this.endIndex.evaluate(t); return e.slice(r, n) } return e.slice(r) } 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 li = oi; function ui(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 ci(t, e, r, n) { return 0 === n.compare(e, r) } function hi(t, e, r) { const n = "==" !== t && "!=" !== t; return class i { constructor(t, e, r) { this.type = me, this.lhs = t, this.rhs = e, this.collator = r, 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 r = t[0]; let s = e.parse(t[1], 1, xe); if (!s) return null; if (!ui(r, s.type)) return e.concat(1).error(`"${r}" comparisons are not supported for type '${Me(s.type)}'.`); let a = e.parse(t[2], 2, xe); if (!a) return null; if (!ui(r, a.type)) return e.concat(2).error(`"${r}" comparisons are not supported for type '${Me(a.type)}'.`); if (s.type.kind !== a.type.kind && "value" !== s.type.kind && "value" !== a.type.kind) return e.error(`Cannot compare types '${Me(s.type)}' and '${Me(a.type)}'.`); n && ("value" === s.type.kind && "value" !== a.type.kind ? s = new Ke(a.type, [s]) : "value" !== s.type.kind && "value" === a.type.kind && (a = new Ke(s.type, [a]))); let o = null; if (4 === t.length) { if ("string" !== s.type.kind && "string" !== a.type.kind && "value" !== s.type.kind && "value" !== a.type.kind) return e.error("Cannot use collator to compare non-string types."); if (o = e.parse(t[3], 3, ve), !o) return null } return new i(s, a, o) } evaluate(i) { const s = this.lhs.evaluate(i), a = this.rhs.evaluate(i); if (n && this.hasUntypedArgument) { const e = Ne(s), r = Ne(a); if (e.kind !== r.kind || "string" !== e.kind && "number" !== e.kind) throw new Ye(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`) } if (this.collator && !n && this.hasUntypedArgument) { const t = Ne(s), r = Ne(a); if ("string" !== t.kind || "string" !== r.kind) return e(i, s, a) } return this.collator ? r(i, s, a, this.collator.evaluate(i)) : e(i, s, a) } 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 } } } const pi = hi("==", (function (t, e, r) { return e === r }), ci), fi = hi("!=", (function (t, e, r) { return e !== r }), (function (t, e, r, n) { return !ci(0, e, r, n) })), di = hi("<", (function (t, e, r) { return e < r }), (function (t, e, r, n) { return n.compare(e, r) < 0 })), mi = hi(">", (function (t, e, r) { return e > r }), (function (t, e, r, n) { return n.compare(e, r) > 0 })), yi = hi("<=", (function (t, e, r) { return e <= r }), (function (t, e, r, n) { return n.compare(e, r) <= 0 })), gi = hi(">=", (function (t, e, r) { return e >= r }), (function (t, e, r, n) { return n.compare(e, r) >= 0 })); class xi { constructor(t, e, r, n, i, s) { this.type = de, this.number = t, this.locale = e, this.currency = r, this.unit = n, this.minFractionDigits = i, this.maxFractionDigits = s; } static parse(t, e) { if (3 !== t.length) return e.error("Expected two arguments."); const r = e.parse(t[1], 1, fe); if (!r) return null; const n = t[2]; if ("object" != typeof n || Array.isArray(n)) return e.error("NumberFormat options argument must be an object."); let i = null; if (n.locale && (i = e.parse(n.locale, 1, de), !i)) return null; let s = null; if (n.currency && (s = e.parse(n.currency, 1, de), !s)) return null; let a = null; if (n.unit && (a = e.parse(n.unit, 1, de), !a)) return null; let o = null; if (n["min-fraction-digits"] && (o = e.parse(n["min-fraction-digits"], 1, fe), !o)) return null; let l = null; return n["max-fraction-digits"] && (l = e.parse(n["max-fraction-digits"], 1, fe), !l) ? null : new xi(r, i, s, a, o, 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 vi { constructor(t) { this.type = fe, this.input = t; } static parse(t, e) { if (2 !== t.length) return e.error(`Expected 1 argument, but found ${t.length - 1} instead.`); const r = e.parse(t[1], 1); return r ? "array" !== r.type.kind && "string" !== r.type.kind && "value" !== r.type.kind ? e.error(`Expected argument of type string or array, but found ${Me(r.type)} instead.`) : new vi(r) : 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 Ye(`Expected value to be of type string or array, but found ${Me(Ne(e))} instead.`) } eachChild(t) { t(this.input); } outputDefined() { return !1 } serialize() { const t = ["length"]; return this.eachChild((e => { t.push(e.serialize()); })), t } }
vendor: 5,364 bytes, line 33
33 function bi(t) { return function () { t = 1831565813 + (t |= 0) | 0; let e = Math.imul(t ^ t >>> 15, 1 | t); return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296 } } const _i = { "==": pi, "!=": fi, ">": mi, "<": di, ">=": gi, "<=": yi, array: Ke, at: Jn, boolean: Ke, case: ai, coalesce: Xn, collator: or, format: We, image: He, in: ti, "index-of": ri, interpolate: Yn, "interpolate-hcl": Yn, "interpolate-lab": Yn, length: vi, let: Wn, literal: Ge, match: ii, number: Ke, "number-format": xi, object: Ke, slice: li, step: wn, string: Ke, "to-boolean": er, "to-color": er, "to-number": er, "to-string": er, var: yn, within: Pr, distance: cn }; function wi(t, [e, r, n, i]) { e = e.evaluate(t), r = r.evaluate(t), n = n.evaluate(t); const s = i ? i.evaluate(t) : 1, a = je(e, r, n, s); if (a) throw new Ye(a); return new Re(e / 255 * s, r / 255 * s, n / 255 * s, s) } function Mi(t, [e, r, n, i]) { e = e.evaluate(t), r = r.evaluate(t), n = n.evaluate(t); const s = i ? i.evaluate(t) : 1, a = function (t, e, r, n) { return "number" == typeof t && t >= 0 && t <= 360 ? "number" == typeof e && e >= 0 && e <= 100 && "number" == typeof r && r >= 0 && r <= 100 ? void 0 === n || "number" == typeof n && n >= 0 && n <= 1 ? null : `Invalid hsla value [${[t, e, r, n].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid hsla value [${("number" == typeof n ? [t, e, r, n] : [t, e, r]).join(", ")}]: 's', and 'l' must be between 0 and 100.` : `Invalid hsla value [${("number" == typeof n ? [t, e, r, n] : [t, e, r]).join(", ")}]: 'h' must be between 0 and 360.` }(e, r, n, s); if (a) throw new Ye(a); const o = `hsla(${e}, ${r}%, ${n}%, ${s})`, l = Re.parse(o); if (!l) throw new Ye(`Failed to parse HSLA color: ${o}`); return l } function Ai(t, e) { return t in e } function Si(t, e) { const r = e[t]; return void 0 === r ? null : r } function Ii(t, e) { switch (t) { case "string": return String(e); case "number": return +e; case "boolean": return !!e; case "color": return Re.parse(e) }return e } function ki(t, e, r, n) { return void 0 !== n && (t = n * Math.round(t / n)), void 0 !== e && t < e && (t = e), void 0 !== r && t > r && (t = r), t } function Ti(t, e, r) { e = [e, r, t.scope].filter(Boolean).join("�"); const n = t.getConfig(e); if (!n) return null; const { type: i, value: s, values: a, minValue: o, maxValue: l, stepValue: u } = n, c = n.default.evaluate(t); let h = c; if (s) { const e = t.scope; t.scope = (e || "").split("�").slice(1).join("�"), h = s.evaluate(t), t.scope = e; } return i && (h = Ii(i, h)), void 0 !== s && void 0 !== h && a && !a.includes(h) && (h = c, i && (h = Ii(i, h))), void 0 === h || void 0 === o && void 0 === l && void 0 === u || ("number" == typeof h ? h = ki(h, o, l, u) : Array.isArray(h) && (h = h.map((t => "number" == typeof t ? ki(t, o, l, u) : t)))), h } function Pi(t) { return { type: t } } ar.register(_i, { error: [{ kind: "error" }, [de], (t, [e]) => { throw new Ye(e.evaluate(t)) }], typeof: [de, [xe], (t, [e]) => Me(Ne(e.evaluate(t)))], "to-rgba": [we(fe, 4), [ye], (t, [e]) => e.evaluate(t).toArray()], rgb: [ye, [fe, fe, fe], wi], rgba: [ye, [fe, fe, fe, fe], wi], hsl: [ye, [fe, fe, fe], Mi], hsla: [ye, [fe, fe, fe, fe], Mi], has: { type: me, overloads: [[[de], (t, [e]) => Ai(e.evaluate(t), t.properties())], [[de, ge], (t, [e, r]) => Ai(e.evaluate(t), r.evaluate(t))]] }, get: { type: xe, overloads: [[[de], (t, [e]) => Si(e.evaluate(t), t.properties())], [[de, ge], (t, [e, r]) => Si(e.evaluate(t), r.evaluate(t))]] }, config: { type: xe, overloads: [[[de], (t, [e]) => Ti(t, e.evaluate(t))], [[de, de], (t, [e, r]) => Ti(t, e.evaluate(t), r.evaluate(t))]] }, "feature-state": [xe, [de], (t, [e]) => Si(e.evaluate(t), t.featureState || {})], properties: [ge, [], t => t.properties()], "geometry-type": [de, [], t => t.geometryType()], id: [xe, [], t => t.id()], zoom: [fe, [], t => t.globals.zoom], pitch: [fe, [], t => t.globals.pitch || 0], "distance-from-center": [fe, [], t => t.distanceFromCenter()], "measure-light": [fe, [de], (t, [e]) => t.measureLight(e.evaluate(t))], "heatmap-density": [fe, [], t => t.globals.heatmapDensity || 0], "line-progress": [fe, [], t => t.globals.lineProgress || 0], "raster-value": [fe, [], t => t.globals.rasterValue || 0], "sky-radial-progress": [fe, [], t => t.globals.skyRadialProgress || 0], accumulated: [xe, [], t => void 0 === t.globals.accumulated ? null : t.globals.accumulated], "+": [fe, Pi(fe), (t, e) => { let r = 0; for (const n of e) r += n.evaluate(t); return r }], "*": [fe, Pi(fe), (t, e) => { let r = 1; for (const n of e) r *= n.evaluate(t); return r }], "-": { type: fe, overloads: [[[fe, fe], (t, [e, r]) => e.evaluate(t) - r.evaluate(t)], [[fe], (t, [e]) => -e.evaluate(t)]] }, "/": [fe, [fe, fe], (t, [e, r]) => e.evaluate(t) / r.evaluate(t)], "%": [fe, [fe, fe], (t, [e, r]) => e.evaluate(t) % r.evaluate(t)], ln2: [fe, [], () => Math.LN2], pi: [fe, [], () => Math.PI], e: [fe, [], () => Math.E], "^": [fe, [fe, fe], (t, [e, r]) => Math.pow(e.evaluate(t), r.evaluate(t))], sqrt: [fe, [fe], (t, [e]) => Math.sqrt(e.evaluate(t))], log10: [fe, [fe], (t, [e]) => Math.log(e.evaluate(t)) / Math.LN10], ln: [fe, [fe], (t, [e]) => Math.log(e.evaluate(t))], log2: [fe, [fe], (t, [e]) => Math.log(e.evaluate(t)) / Math.LN2], sin: [fe, [fe], (t, [e]) => Math.sin(e.evaluate(t))], cos: [fe, [fe], (t, [e]) =>
vendor: 5,672 bytes, line 33
33 Math.cos(e.evaluate(t))], tan: [fe, [fe], (t, [e]) => Math.tan(e.evaluate(t))], asin: [fe, [fe], (t, [e]) => Math.asin(e.evaluate(t))], acos: [fe, [fe], (t, [e]) => Math.acos(e.evaluate(t))], atan: [fe, [fe], (t, [e]) => Math.atan(e.evaluate(t))], min: [fe, Pi(fe), (t, e) => Math.min(...e.map((e => e.evaluate(t))))], max: [fe, Pi(fe), (t, e) => Math.max(...e.map((e => e.evaluate(t))))], abs: [fe, [fe], (t, [e]) => Math.abs(e.evaluate(t))], round: [fe, [fe], (t, [e]) => { const r = e.evaluate(t); return r < 0 ? -Math.round(-r) : Math.round(r) }], floor: [fe, [fe], (t, [e]) => Math.floor(e.evaluate(t))], ceil: [fe, [fe], (t, [e]) => Math.ceil(e.evaluate(t))], "filter-==": [me, [de, xe], (t, [e, r]) => t.properties()[e.value] === r.value], "filter-id-==": [me, [xe], (t, [e]) => t.id() === e.value], "filter-type-==": [me, [de], (t, [e]) => t.geometryType() === e.value], "filter-<": [me, [de, xe], (t, [e, r]) => { const n = t.properties()[e.value], i = r.value; return typeof n == typeof i && n < i }], "filter-id-<": [me, [xe], (t, [e]) => { const r = t.id(), n = e.value; return typeof r == typeof n && r < n }], "filter->": [me, [de, xe], (t, [e, r]) => { const n = t.properties()[e.value], i = r.value; return typeof n == typeof i && n > i }], "filter-id->": [me, [xe], (t, [e]) => { const r = t.id(), n = e.value; return typeof r == typeof n && r > n }], "filter-<=": [me, [de, xe], (t, [e, r]) => { const n = t.properties()[e.value], i = r.value; return typeof n == typeof i && n <= i }], "filter-id-<=": [me, [xe], (t, [e]) => { const r = t.id(), n = e.value; return typeof r == typeof n && r <= n }], "filter->=": [me, [de, xe], (t, [e, r]) => { const n = t.properties()[e.value], i = r.value; return typeof n == typeof i && n >= i }], "filter-id->=": [me, [xe], (t, [e]) => { const r = t.id(), n = e.value; return typeof r == typeof n && r >= n }], "filter-has": [me, [xe], (t, [e]) => e.value in t.properties()], "filter-has-id": [me, [], t => null !== t.id() && void 0 !== t.id()], "filter-type-in": [me, [we(de)], (t, [e]) => e.value.indexOf(t.geometryType()) >= 0], "filter-id-in": [me, [we(xe)], (t, [e]) => e.value.indexOf(t.id()) >= 0], "filter-in-small": [me, [de, we(xe)], (t, [e, r]) => r.value.indexOf(t.properties()[e.value]) >= 0], "filter-in-large": [me, [de, we(xe)], (t, [e, r]) => function (t, e, r, n) { for (; r <= n;) { const i = r + n >> 1; if (e[i] === t) return !0; e[i] > t ? n = i - 1 : r = i + 1; } return !1 }(t.properties()[e.value], r.value, 0, r.value.length - 1)], all: { type: me, overloads: [[[me, me], (t, [e, r]) => e.evaluate(t) && r.evaluate(t)], [Pi(me), (t, e) => { for (const r of e) if (!r.evaluate(t)) return !1; return !0 }]] }, any: { type: me, overloads: [[[me, me], (t, [e, r]) => e.evaluate(t) || r.evaluate(t)], [Pi(me), (t, e) => { for (const r of e) if (r.evaluate(t)) return !0; return !1 }]] }, "!": [me, [me], (t, [e]) => !e.evaluate(t)], "is-supported-script": [me, [de], (t, [e]) => { const r = t.globals && t.globals.isSupportedScript; return !r || r(e.evaluate(t)) }], upcase: [de, [de], (t, [e]) => e.evaluate(t).toUpperCase()], downcase: [de, [de], (t, [e]) => e.evaluate(t).toLowerCase()], concat: [de, Pi(xe), (t, e) => e.map((e => $e(e.evaluate(t)))).join("")], "resolved-locale": [de, [ve], (t, [e]) => e.evaluate(t).resolvedLocale()], random: [fe, [fe, fe, xe], (t, e) => { const [r, n, i] = e.map((e => e.evaluate(t))); if (r > n) return r; if (r === n) return r; let s; if ("string" == typeof i) s = function (t) { let e = 0; if (0 === t.length) return e; for (let r = 0; r < t.length; r++)e = (e << 5) - e + t.charCodeAt(r), e &= e; return e }(i); else { if ("number" != typeof i) throw new Ye(`Invalid seed input: ${i}`); s = i; } return r + bi(s)() * (n - r) }] }); var zi = _i; function Ei(t) { return { result: "success", value: t } } function Bi(t) { return { result: "error", value: t } } function Di(t, e) { return !!t && !!t.parameters && t.parameters.indexOf(e) > -1 } function Ci(t) { return "data-driven" === t["property-type"] } function Ri(t) { return Di(t.expression, "measure-light") } function Li(t) { return Di(t.expression, "zoom") } function Vi(t) { return !!t.expression && t.expression.interpolated } function Oi(t) { return "object" == typeof t && null !== t && !Array.isArray(t) } function Fi(t) { return t } function ji(t, e) { const r = "color" === e.type, n = t.stops && "object" == typeof t.stops[0][0], i = n || !(n || void 0 !== t.property), s = t.type || (Vi(e) ? "exponential" : "interval"); if (r && ((t = se({}, t)).stops && (t.stops = t.stops.map((t => [t[0], Re.parse(t[1])]))), t.default = Re.parse(t.default ? t.default : e.default)), t.colorSpace && "rgb" !== t.colorSpace && !$n[t.colorSpace]) throw new Error(`Unknown color space: ${t.colorSpace}`); let a, o, l; if ("exponential" === s) a = qi; else if ("interval" === s) a = $i; else if ("categorical" === s) { a = Ni, o = Object.create(null); for (const e of t.stops) o[e[0]] = e[1]; l = typeof t.stops[0][0]; } else { if ("identity" !== s) throw new Error(`Unknown function type "${s}"`); a = Gi; } if (n) { const r = {}, n = []; for (let e = 0; e < t.stops.length; e++) { const i = t.stops[e], s = i[0].zoom; void 0 === r[s] && (r[s] = { zoom: s, type: t.type, property: t.property, default: t.default, stops: [] }, n.push(s)), r[s].stops.push([i[0].value, i[1]]); } const i = []; for (const t of n) i.push([r[t].zoom, ji(r[t], e)]); const s = { name: "linear" }; return { kind: "composite", interpolationType: s, interpolationFactor: Yn.interpolationFactor.bind(void 0, s), zoomStops: i.map((t => t[0])), evaluate: ({ zoom: r }, n) => qi({ stops: i, base: t.base }, e, r).evaluate(r, n) } }
vendor: 13,465 bytes, line 33
33 if (i) { const r = "exponential" === s ? { name: "exponential", base: void 0 !== t.base ? t.base : 1 } : null; return { kind: "camera", interpolationType: r, interpolationFactor: Yn.interpolationFactor.bind(void 0, r), zoomStops: t.stops.map((t => t[0])), evaluate: ({ zoom: r }) => a(t, e, r, o, l) } } return { kind: "source", evaluate(r, n) { const i = n && n.properties ? n.properties[t.property] : void 0; return void 0 === i ? Ui(t.default, e.default) : a(t, e, i, o, l) } } } function Ui(t, e, r) { return void 0 !== t ? t : void 0 !== e ? e : void 0 !== r ? r : void 0 } function Ni(t, e, r, n, i) { return Ui(typeof r === i ? n[r] : void 0, t.default, e.default) } function $i(t, e, r) { if ("number" !== Je(r)) return Ui(t.default, e.default); const n = t.stops.length; if (1 === n) return t.stops[0][1]; if (r <= t.stops[0][0]) return t.stops[0][1]; if (r >= t.stops[n - 1][0]) return t.stops[n - 1][1]; const i = bn(t.stops.map((t => t[0])), r); return t.stops[i][1] } function qi(t, e, r) { const n = void 0 !== t.base ? t.base : 1; if ("number" !== Je(r)) return Ui(t.default, e.default); const i = t.stops.length; if (1 === i) return t.stops[0][1]; if (r <= t.stops[0][0]) return t.stops[0][1]; if (r >= t.stops[i - 1][0]) return t.stops[i - 1][1]; const s = bn(t.stops.map((t => t[0])), r), a = function (t, e, r, n) { const i = n - r, s = t - r; return 0 === i ? 0 : 1 === e ? s / i : (Math.pow(e, s) - 1) / (Math.pow(e, i) - 1) }(r, n, t.stops[s][0], t.stops[s + 1][0]), o = t.stops[s][1], l = t.stops[s + 1][1]; let u = Sn[e.type] || Fi; if (t.colorSpace && "rgb" !== t.colorSpace) { const e = $n[t.colorSpace]; u = (t, r) => e.reverse(e.interpolate(e.forward(t), e.forward(r), a)); } return "function" == typeof o.evaluate ? { evaluate(...t) { const e = o.evaluate.apply(void 0, t), r = l.evaluate.apply(void 0, t); if (void 0 !== e && void 0 !== r) return u(e, r, a) } } : u(o, l, a) } function Gi(t, e, r) { return "color" === e.type ? r = Re.parse(r) : "formatted" === e.type ? r = Oe.fromString(r.toString()) : "resolvedImage" === e.type ? r = Fe.fromString(r.toString()) : Je(r) === e.type || "enum" === e.type && e.values[r] || (r = void 0), Ui(r, t.default, e.default) } class Yi { constructor(t, e, r, n) { this.expression = t, this._warningHistory = {}, this._evaluator = new nr(r, n), this._defaultValue = e ? function (t) { return "color" === t.type && (Oi(t.default) || Array.isArray(t.default)) ? new Re(0, 0, 0, 0) : "color" === t.type ? Re.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, r, n, i, s, a, o) { return this._evaluator.globals = t, this._evaluator.feature = e, this._evaluator.featureState = r, this._evaluator.canonical = n || null, this._evaluator.availableImages = i || null, this._evaluator.formattedSection = s, this._evaluator.featureTileCoord = a || null, this._evaluator.featureDistanceData = o || null, this.expression.evaluate(this._evaluator) } evaluate(t, e, r, n, i, s, a, o) { this._evaluator.globals = t, this._evaluator.feature = e || null, this._evaluator.featureState = r || null, this._evaluator.canonical = n || null, this._evaluator.availableImages = i || null, this._evaluator.formattedSection = s || null, this._evaluator.featureTileCoord = a || null, this._evaluator.featureDistanceData = o || 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 Ye(`Expected value to be one of ${Object.keys(this._enumValues).map((t => JSON.stringify(t))).join(", ")}, but found ${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 Zi(t) { return Array.isArray(t) && t.length > 0 && "string" == typeof t[0] && t[0] in zi } function Xi(t, e, r, n) { const i = new xn(zi, [], e ? function (t) { const e = { color: ye, string: de, number: fe, enum: de, boolean: me, formatted: be, resolvedImage: _e }; return "array" === t.type ? we(e[t.value] || xe, t.length) : e[t.type] }(e) : void 0, void 0, void 0, r, n), s = i.parse(t, void 0, void 0, void 0, e && "string" === e.type ? { typeAnnotation: "coerce" } : void 0); return s ? Ei(new Yi(s, e, r, n)) : Bi(i.errors) } class Ki { constructor(t, e, r) { this.kind = t, this._styleExpression = e, this.isLightConstant = r, this.isStateDependent = "constant" !== t && !pn(e.expression), this.isConfigDependent = !fn(e.expression); } evaluateWithoutErrorHandling(t, e, r, n, i, s) { return this._styleExpression.evaluateWithoutErrorHandling(t, e, r, n, i, s) } evaluate(t, e, r, n, i, s) { return this._styleExpression.evaluate(t, e, r, n, i, s) } } class Wi { constructor(t, e, r, n, i) { this.kind = t, this.zoomStops = r, this._styleExpression = e, this.isStateDependent = "camera" !== t && !pn(e.expression), this.isLightConstant = i, this.isConfigDependent = !fn(e.expression), this.interpolationType = n; } evaluateWithoutErrorHandling(t, e, r, n, i, s) { return this._styleExpression.evaluateWithoutErrorHandling(t, e, r, n, i, s) } evaluate(t, e, r, n, i, s) { return this._styleExpression.evaluate(t, e, r, n, i, s) } interpolationFactor(t, e, r) { return this.interpolationType ? Yn.interpolationFactor(this.interpolationType, t, e, r) : 0 } } function Hi(t, e, r, n) { if ("error" === (t = Xi(t, e, r, n)).result) return t; const i = t.value.expression, s = hn(i); if (!s && !Ci(e)) return Bi([new ue("", "data expressions not supported")]); const a = dn(i, ["zoom", "pitch", "distance-from-center"]); if (!a && !Li(e)) return Bi([new ue("", "zoom expressions not supported")]); const o = dn(i, ["measure-light"]); if (!o && !Ri(e)) return Bi([new ue("", "measure-light expression not supported")]); const l = e.expression && e.expression.relaxZoomRestriction, u = Qi(i); return u || a || l ? u instanceof ue ? Bi([u]) : u instanceof Yn && !Vi(e) ? Bi([new ue("", '"interpolate" expressions cannot be used with this property')]) : Ei(u ? new Wi(s ? "camera" : "composite", t.value, u.labels, u instanceof Yn ? u.interpolation : void 0, o) : new Ki(s ? "constant" : "source", t.value, o)) : Bi([new ue("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')]) } class Ji { constructor(t, e) { this._parameters = t, this._specification = e, se(this, ji(this._parameters, this._specification)); } static deserialize(t) { return new Ji(t._parameters, t._specification) } static serialize(t) { return { _parameters: t._parameters, _specification: t._specification } } } function Qi(t) { let e = null; if (t instanceof Wn) e = Qi(t.result); else if (t instanceof Xn) { for (const r of t.args) if (e = Qi(r), e) break } else (t instanceof wn || t instanceof Yn) && t.input instanceof ar && "zoom" === t.input.name && (e = t); return e instanceof ue || t.eachChild((t => { const r = Qi(t); r instanceof ue ? e = r : e && r && e !== r && (e = new ue("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.')); })), e } function ts(t) { const e = t.key, r = t.value, n = t.valueSpec || {}, i = t.objectElementValidators || {}, s = t.style, a = t.styleSpec; let o = []; const l = Je(r); if ("object" !== l) return [new ne(e, r, `object expected, ${l} found`)]; for (const t in r) { const l = t.split(".")[0]; let u; i[l] ? u = i[l] : n[l] ? u = Ls : i["*"] ? u = i["*"] : n["*"] && (u = Ls), u ? o = o.concat(u({ key: (e ? `${e}.` : e) + t, value: r[t], valueSpec: n[l] || n["*"], style: s, styleSpec: a, object: r, objectKey: t }, r)) : o.push(new ie(e, r[t], `unknown property "${t}"`)); } for (const t in n) i[t] || n[t].required && void 0 === n[t].default && void 0 === r[t] && o.push(new ne(e, r, `missing required property "${t}"`)); return o } function es(t) { const e = t.value, r = t.valueSpec, n = t.style, i = t.styleSpec, s = t.key, a = t.arrayElementValidator || Ls; if ("array" !== Je(e)) return [new ne(s, e, `array expected, ${Je(e)} found`)]; if (r.length && e.length !== r.length) return [new ne(s, e, `array length ${r.length} expected, length ${e.length} found`)]; if (r["min-length"] && e.length < r["min-length"]) return [new ne(s, e, `array length at least ${r["min-length"]} expected, length ${e.length} found`)]; let o = { type: r.value, values: r.values, minimum: r.minimum, maximum: r.maximum, function: void 0 }; i.$version < 7 && (o.function = r.function), "object" === Je(r.value) && (o = r.value); let l = []; for (let t = 0; t < e.length; t++)l = l.concat(a({ array: e, arrayIndex: t, value: e[t], valueSpec: o, style: n, styleSpec: i, key: `${s}[${t}]` }, !0)); return l } function rs(t) { const e = t.key, r = t.value, n = t.valueSpec; let i = Je(r); if ("number" === i && r != r && (i = "NaN"), "number" !== i) return [new ne(e, r, `number expected, ${i} found`)]; if ("minimum" in n) { let i = n.minimum; if ("array" === Je(n.minimum) && (i = n.minimum[t.arrayIndex]), r < i) return [new ne(e, r, `${r} is less than the minimum value ${i}`)] } if ("maximum" in n) { let i = n.maximum; if ("array" === Je(n.maximum) && (i = n.maximum[t.arrayIndex]), r > i) return [new ne(e, r, `${r} is greater than the maximum value ${i}`)] } return [] } function ns(t) { const e = t.valueSpec, r = ae(t.value.type); let n, i, s, a = {}; const o = "categorical" !== r && void 0 === t.value.property, l = !o, u = "array" === Je(t.value.stops) && "array" === Je(t.value.stops[0]) && "object" === Je(t.value.stops[0][0]), c = ts({ key: t.key, value: t.value, valueSpec: t.styleSpec.function, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { stops: function (t) { if ("identity" === r) return [new ne(t.key, t.value, 'identity function may not have a "stops" property')]; let e = []; const n = t.value; return e = e.concat(es({ key: t.key, value: n, valueSpec: t.valueSpec, style: t.style, styleSpec: t.styleSpec, arrayElementValidator: h })), "array" === Je(n) && 0 === n.length && e.push(new ne(t.key, n, "array must have at least one stop")), e }, default: function (t) { return Ls({ key: t.key, value: t.value, valueSpec: e, style: t.style, styleSpec: t.styleSpec }) } } }); return "identity" === r && o && c.push(new ne(t.key, t.value, 'missing required property "property"')), "identity" === r || t.value.stops || c.push(new ne(t.key, t.value, 'missing required property "stops"')), "exponential" === r && t.valueSpec.expression && !Vi(t.valueSpec) && c.push(new ne(t.key, t.value, "exponential functions not supported")), t.styleSpec.$version >= 8 && (l && !Ci(t.valueSpec) ? c.push(new ne(t.key, t.value, "property functions not supported")) : o && !Li(t.valueSpec) && c.push(new ne(t.key, t.value, "zoom functions not supported"))), "categorical" !== r && !u || void 0 !== t.value.property || c.push(new ne(t.key, t.value, '"property" property is required')), c; function h(t) { let r = []; const n = t.value, o = t.key; if ("array" !== Je(n)) return [new ne(o, n, `array expected, ${Je(n)} found`)]; if (2 !== n.length) return [new ne(o, n, `array length 2 expected, length ${n.length} found`)]; if (u) { if ("object" !== Je(n[0])) return [new ne(o, n, `object expected, ${Je(n[0])} found`)]; if (void 0 === n[0].zoom) return [new ne(o, n, "object stop key must have zoom")]; if (void 0 === n[0].value) return [new ne(o, n, "object stop key must have value")]; const e = ae(n[0].zoom); if ("number" != typeof e) return [new ne(o, n[0].zoom, "stop zoom values must be numbers")]; if (s && s > e) return [new ne(o, n[0].zoom, "stop zoom values must appear in ascending order")]; e !== s && (s = e, i = void 0, a = {}), r = r.concat(ts({ key: `${o}[0]`, value: n[0], valueSpec: { zoom: {} }, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { zoom: rs, value: p } })); } else r = r.concat(p({ key: `${o}[0]`, value: n[0], valueSpec: {}, style: t.style, styleSpec: t.styleSpec }, n)); return Zi(oe(n[1])) ? r.concat([new ne(`${o}[1]`, n[1], "expressions are not allowed in function stops.")]) : r.concat(Ls({ key: `${o}[1]`, value: n[1], valueSpec: e, style: t.style, styleSpec: t.styleSpec })) } function p(t, s) { const o = Je(t.value), l = ae(t.value), u = null !== t.value ? t.value : s; if (n) { if (o !== n) return [new ne(t.key, u, `${o} stop domain type must match previous stop domain type ${n}`)] } else n = o; if ("number" !== o && "string" !== o && "boolean" !== o && "number" != typeof l && "string" != typeof l && "boolean" != typeof l) return [new ne(t.key, u, "stop domain value must be a number, string, or boolean")]; if ("number" !== o && "categorical" !== r) { let n = `number expected, ${o} found`; return Ci(e) && void 0 === r && (n += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new ne(t.key, u, n)] } return "categorical" !== r || "number" !== o || "number" == typeof l && isFinite(l) && Math.floor(l) === l ? "categorical" !== r && "number" === o && "number" == typeof l && "number" == typeof i && void 0 !== i && l < i ? [new ne(t.key, u, "stop domain values must appear in ascending order")] : (i = l, "categorical" === r && l in a ? [new ne(t.key, u, "stop domain values must be unique")] : (a[l] = !0, [])) : [new ne(t.key, u, `integer expected, found ${String(l)}
33`)] } } function is(t) { const e = ("property" === t.expressionContext ? Hi : Xi)(oe(t.value), t.valueSpec); if ("error" === e.result) return e.value.map((e => new ne(`${t.key}${e.key}`, t.value, e.message))); const r = e.value.expression || e.value._styleExpression.expression; if ("property" === t.expressionContext && "text-font" === t.propertyKey && !r.outputDefined()) return [new ne(t.key, t.value, `Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)]; if ("property" === t.expressionContext && "layout" === t.propertyType && !pn(r)) return [new ne(t.key, t.value, '"feature-state" data expressions are not supported with layout properties.')]; if ("filter" === t.expressionContext) return ss(r, t); if (t.expressionContext && 0 === t.expressionContext.indexOf("cluster")) { if (!dn(r, ["zoom", "feature-state"])) return [new ne(t.key, t.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')]; if ("cluster-initial" === t.expressionContext && !hn(r)) return [new ne(t.key, t.value, "Feature data expressions are not supported with initial expression part of cluster properties.")] } return [] } function ss(t, e) { const r = new Set(["zoom", "feature-state", "pitch", "distance-from-center"]); if (e.valueSpec && e.valueSpec.expression) for (const t of e.valueSpec.expression.parameters) r.delete(t); if (0 === r.size) return []; const n = []; return t instanceof ar && r.has(t.name) ? [new ne(e.key, e.value, `["${t.name}"] expression is not supported in a filter for a ${e.object.type} layer with id: ${e.object.id}`)] : (t.eachChild((t => { n.push(...ss(t, e)); })), n) } function as(t) { const e = t.key, r = t.value, n = t.valueSpec, i = []; return Array.isArray(n.values) ? -1 === n.values.indexOf(ae(r)) && i.push(new ne(e, r, `expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)) : -1 === Object.keys(n.values).indexOf(ae(r)) && i.push(new ne(e, r, `expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)), i } function os(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 >
vendor: 8,141 bytes, line 33
33= 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 (!os(e) && "boolean" != typeof e) return !1; return !0; default: return !0 } } function ls(t, e = "fill") { if (null == t) return { filter: () => !0, needGeometry: !1, needFeature: !1 }; os(t) || (t = ms(t)); const r = t; let n = !0; try { n = function (t) { if (!hs(t)) return t; let e = oe(t); return cs(e), e = us(e), e }(r); } 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${JSON.stringify(r, null, 2)}\n        `); } const i = re[`filter_${e}`], s = Xi(n, i); let a = null; if ("error" === s.result) throw new Error(s.value.map((t => `${t.key}: ${t.message}`)).join(", ")); a = (t, e, r) => s.value.evaluate(t, e, {}, r); let o = null, l = null; if (n !== r) { const t = Xi(r, i); if ("error" === t.result) throw new Error(t.value.map((t => `${t.key}: ${t.message}`)).join(", ")); o = (e, r, n, i, s) => t.value.evaluate(e, r, {}, n, void 0, void 0, i, s), l = !hn(t.value.expression); } return { filter: a, dynamicFilter: o || void 0, needGeometry: ds(n), needFeature: !!l } } function us(t) { if (!Array.isArray(t)) return t; const e = function (t) { if (ps.has(t[0])) for (let e = 1; e < t.length; e++)if (hs(t[e])) return !0; return t }(t); return !0 === e ? e : e.map((t => us(t))) } function cs(t) { let e = !1; const r = []; if ("case" === t[0]) { for (let n = 1; n < t.length - 1; n += 2)e = e || hs(t[n]), r.push(t[n + 1]); r.push(t[t.length - 1]); } else if ("match" === t[0]) { e = e || hs(t[1]); for (let e = 2; e < t.length - 1; e += 2)r.push(t[e + 1]); r.push(t[t.length - 1]); } else if ("step" === t[0]) { e = e || hs(t[1]); for (let e = 1; e < t.length - 1; e += 2)r.push(t[e + 1]); } e && (t.length = 0, t.push("any", ...r)); for (let e = 1; e < t.length; e++)cs(t[e]); } function hs(t) { if (!Array.isArray(t)) return !1; if ("pitch" === (e = t[0]) || "distance-from-center" === e) return !0; var e; for (let e = 1; e < t.length; e++)if (hs(t[e])) return !0; return !1 } const ps = new Set(["in", "==", "!=", ">", ">=", "<", "<=", "to-boolean"]); function fs(t, e) { return t < e ? -1 : t > e ? 1 : 0 } function ds(t) { if (!Array.isArray(t)) return !1; if ("within" === t[0] || "distance" === t[0]) return !0; for (let e = 1; e < t.length; e++)if (ds(t[e])) return !0; return !1 } function ms(t) { if (!t) return !0; const e = t[0]; return t.length <= 1 ? "any" !== e : "==" === e ? ys(t[1], t[2], "==") : "!=" === e ? vs(ys(t[1], t[2], "==")) : "<" === e || ">" === e || "<=" === e || ">=" === e ? ys(t[1], t[2], e) : "any" === e ? (r = t.slice(1), ["any"].concat(r.map(ms))) : "all" === e ? ["all"].concat(t.slice(1).map(ms)) : "none" === e ? ["all"].concat(t.slice(1).map(ms).map(vs)) : "in" === e ? gs(t[1], t.slice(2)) : "!in" === e ? vs(gs(t[1], t.slice(2))) : "has" === e ? xs(t[1]) : "!has" !== e || vs(xs(t[1])); var r; } function ys(t, e, r) { switch (t) { case "$type": return [`filter-type-${r}`, e]; case "$id": return [`filter-id-${r}`, e]; default: return [`filter-${r}`, t, e] } } function gs(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(fs)]] : ["filter-in-small", t, ["literal", e]] } } function xs(t) { switch (t) { case "$type": return !0; case "$id": return ["filter-has-id"]; default: return ["filter-has", t] } } function vs(t) { return ["!", t] } function bs(t) { return os(oe(t.value)) ? is(se({}, t, { expressionContext: "filter", valueSpec: t.styleSpec[`filter_${t.layerType || "fill"}`] })) : _s(t) } function _s(t) { const e = t.value, r = t.key; if ("array" !== Je(e)) return [new ne(r, e, `array expected, ${Je(e)} found`)]; const n = t.styleSpec; let i, s = []; if (e.length < 1) return [new ne(r, e, "filter array must have at least 1 element")]; switch (s = s.concat(as({ key: `${r}[0]`, value: e[0], valueSpec: n.filter_operator, style: t.style, styleSpec: t.styleSpec })), ae(e[0])) { case "<": case "<=": case ">": case ">=": e.length >= 2 && "$type" === ae(e[1]) && s.push(new ne(r, e, `"$type" cannot be use with operator "${e[0]}"`)); case "==": case "!=": 3 !== e.length && s.push(new ne(r, e, `filter array for operator "${e[0]}" must have 3 elements`)); case "in": case "!in": e.length >= 2 && (i = Je(e[1]), "string" !== i && s.push(new ne(`${r}[1]`, e[1], `string expected, ${i} found`))); for (let a = 2; a < e.length; a++)i = Je(e[a]), "$type" === ae(e[1]) ? s = s.concat(as({ key: `${r}[${a}]`, value: e[a], valueSpec: n.geometry_type, style: t.style, styleSpec: t.styleSpec })) : "string" !== i && "number" !== i && "boolean" !== i && s.push(new ne(`${r}[${a}]`, e[a], `string, number, or boolean expected, ${i} found`)); break; case "any": case "all": case "none": for (let n = 1; n < e.length; n++)s = s.concat(_s({ key: `${r}[${n}]`, value: e[n], style: t.style, styleSpec: t.styleSpec })); break; case "has": case "!has": i = Je(e[1]), 2 !== e.length ? s.push(new ne(r, e, `filter array for "${e[0]}" operator must have 2 elements`)) : "string" !== i && s.push(new ne(`${r}[1]`, e[1], `string expected, ${i} found`)); }return s } function ws(t, e) { const r = t.key, n = t.style, i = t.layer, s = t.styleSpec, a = t.value, o = t.objectKey, l = s[`${e}_${t.layerType}`]; if (!l) return []; const u = o.match(/^(.*)-transition$/); if ("paint" === e && u && l[u[1]] && l[u[1]].transition) return Ls({ key: r, value: a, valueSpec: s.transition, style: n, styleSpec: s }); const c = t.valueSpec || l[o]; if (!c) return [new ie(r, a, `unknown property "${o}"`)]; let h; if ("string" === Je(a) && Ci(c) && !c.tokens && (h = /^{([^}]+)}$/.exec(a))) { const t = `\`{ "type": "identity", "property": ${h ? JSON.stringify(h[1]) : '"_"'} }\``; return [new ne(r, a, `"${o}" does not support interpolation syntax\nUse an identity property function instead: ${t}.`)] } const p = []; if ("symbol" === t.layerType) "text-field" !== o || !n || n.glyphs || n.imports || p.push(new ne(r, a, 'use of "text-field" requires a style "glyphs" property')), "text-font" === o && Oi(oe(a)) && "identity" === ae(a.type) && p.push(new ne(r, a, '"text-font" does not support identity functions')); else if ("model" === t.layerType && "paint" === e && i && i.layout && i.layout.hasOwnProperty("model-id") && Ci(c) && (Ri(c) || Li(c))) { const t = Hi(oe(a), c), e = t.value.expression || t.value._styleExpression.expression; e && !dn(e, ["measure-light"]) && ("model-emissive-strength" === o && hn(e) && pn(e) || p.push(new ne(r, a, `${o} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`))); } return p.concat(Ls({ key: t.key, value: a, valueSpec: c, style: n, styleSpec: s, expressionContext: "property", propertyType: e, propertyKey: o })) } function Ms(t) { return ws(t, "paint") } function As(t) { return ws(t, "layout") } function Ss(t) { let e = []; const r = t.value, n = t.key, i = t.style, s = t.styleSpec; r.type || r.ref || e.push(new ne(n, r, 'either "type" or "ref" is required')); let a = ae(r.type); const o = ae(r.ref); if (r.id) { const s = ae(r.id); for (let a = 0; a < t.arrayIndex; a++) { const t = i.layers[a]; ae(t.id) === s && e.push(new ne(n, r.id, `duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`)); } } if ("ref" in r) { let t;["type", "source", "source-layer", "filter", "layout"].forEach((t => { t in r && e.push(new ne(n, r[t], `"${t}" is prohibited for ref layers`)); }
33)), i.layers.forEach((e => { ae(e.id) === o && (t = e); })), t ? t.ref ? e.push(new ne(n, r.ref, "ref cannot reference another ref layer")) : a = ae(t.type) : "string" == typeof o && e.push(new ne(n, r.ref, `ref layer "${o}" not found`)); } else if ("background" !== a && "sky" !== a && "slot" !== a) if (r.source) { const t = i.sources && i.sources[r.source], s = t && ae(t.type); t ? "vector" === s && "raster" === a ? e.push(new ne(n, r.source, `layer "${r.id}" requires a raster source`)) : "raster" === s && "raster" !== a ? e.push(new ne(n, r.source, `layer "${r.id}" requires a vector source`)) : "vector" !== s || r["source-layer"] ? "raster-dem" === s && "hillshade" !== a ? e.push(new ne(n, r.source, "raster-dem source can only be used with layer type 'hillshade'.")) : "line" !== a || !r.paint || !r.paint["line-gradient"] && !r.paint["line-trim-offset"] || "geojson" === s && t.lineMetrics || e.push(new ne(n, r, `layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : e.push(new ne(n, r, `layer "${r.id}" must specify a "source-layer"`)) : e.push(new ne(n, r.source, `source "${r.source}" not found`)); } else e.push(new ne(n, r, 'missing required property "source"')); return e = e.concat(ts({ key: n, value: r, valueSpec: s.layer, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": () => [], type: () => Ls({ key: `${n}.type`, value: r.type, valueSpec: s.layer.type, style: t.style, styleSpec: t.styleSpec, object: r, objectKey: "type" }), filter: t => bs(se({ layerType: a }, t)), layout: t => ts({ layer: r, key: t.key, value: t.value, valueSpec: {}, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": t => As(se({ layerType: a }, t)) } }), paint: t => ts({ layer: r, key: t.key, value: t.value, valueSpec: {}, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": t => Ms(se({ layerType: a, layer: r }, t)) } }) } })), e } function Is(t) { const e = t.value, r = t.key, n = Je(e); return "string" !== n ? [new ne(r, e, `string expected, ${n} found`)] : [] } const ks = { promoteId: function ({ key: t, value: e }) { if ("string" === Je(e)) return Is({ key: t, value: e }); { const r = []; for (const n in e) r.push(...Is({ key: `${t}.${n}`, value: e[n] })); return r } } }; function Ts(t) { const e = t.value, r = t.key, n = t.styleSpec, i = t.style; if (!e.type) return [new ne(r, e, '"type" is required')]; const s = ae(e.type); let a = []; switch (["vector", "raster", "raster-dem"].includes(s) && (e.url || e.tiles || a.push(new ie(r, e, 'Either "url" or "tiles" is required.'))), s) { case "vector": case "raster": case "raster-dem": return a = a.concat(ts({ key: r, value: e, valueSpec: n[`source_${s.replace("-", "_")}`], style: t.style, styleSpec: n, objectElementValidators: ks })), a; case "geojson": if (a = ts({ key: r, value: e, valueSpec: n.source_geojson, style: i, styleSpec: n, objectElementValidators: ks }), e.cluster) for (const t in e.clusterProperties) { const [n, i] = e.clusterProperties[t], s = "string" == typeof n ? [n, ["accumulated"], ["get", t]] : n; a.push(...is({ key: `${r}.${t}.map`, value: i, expressionContext: "cluster-map" })), a.push(...is({ key: `${r}.${t}.reduce`, value: s, expressionContext: "cluster-reduce" })); } return a; case "video": return ts({ key: r, value: e, valueSpec: n.source_video, style: i, styleSpec: n }); case "image": return ts({ key: r, value: e, valueSpec: n.source_image, style: i, styleSpec: n }); case "canvas": return [new ne(r, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")]; default: return as({ key: `${r}.type`, value: e.type, valueSpec: { values: Ps(n) }, style: i, styleSpec: n }) } } function Ps(t) { return t.source.reduce(((e, r) => { const n = t[r]; return "enum" === n.type.type && (e = e.concat(Object.keys(n.type.values))), e }), []) } function zs(t) { const e = t.value; let r = []; if (!e) return r; const n = Je(e); return "string" !== n ? (r = r.concat([new ne(t.key, e, `string expected, "${n}
33" found`)]), r) : (function (t) { const e = -1 === t.indexOf("://"); try { return new URL(t, e ? "http://example.com" : void 0), !0 } catch (t) { return !1 } }(e) || (r = r.concat([new ne(t.key, e, `invalid url "${e}"`)])), r) } function Es(t) { const e = t.value, r = t.styleSpec, n = r.light, i = t.style; let s = []; const a = Je(e); if (void 0 === e) return s; if ("object" !== a) return s = s.concat([new ne("light", e, `object expected, ${a} found`)]), s; for (const t in e) { const a = t.match(/^(.*)-transition$/); s = s.concat(a && n[a[1]] && n[a[1]].transition ? Ls({ key: t, value: e[t], valueSpec: r.transition, style: i, styleSpec: r }) : n[t] ? Ls({ key: t, value: e[t], valueSpec: n[t], style: i, styleSpec: r }) : [new ne(t, e[t], `unknown property "${t}"`)]); } return s } function Bs(t) { const e = t.value; let r = []; if (!e) return r; const n = Je(e); if ("object" !== n) return r = r.concat([new ne("light-3d", e, `object expected, ${n} found`)]), r; const i = t.styleSpec, s = i["light-3d"], a = t.key, o = t.style, l = t.style.lights; for (const t of ["type", "id"]) if (!(t in e)) return r = r.concat([new ne("light-3d", e, `missing property ${t} on light`)]), r; if (e.type && l) for (let n = 0; n < t.arrayIndex; n++) { const t = ae(e.type), i = l[n]; ae(i.type) === t && r.push(new ne(a, e.id, `duplicate light type "${e.type}", previously defined at line ${i.id.__line__}`)); } const u = `properties_light_${e.type}`; if (!(u in i)) return r = r.concat([new ne("light-3d", e, `Invalid light type ${e.type}`)]), r; const c = i[u]; for (const n in e) if ("properties" === n) { const s = e[n], a = Je(s); if ("object" !== a) return r = r.concat([new ne("properties", s, `object expected, ${a} found`)]), r; for (const e in s) r = r.concat(c[e] ? Ls({ key: e, value: s[e], valueSpec: c[e], style: o, styleSpec: i }) : [new ie(t.key, s[e], `unknown property "${e}"`)]); } else { const t = n.match(/^(.*)-transition$/); r = r.concat(t && s[t[1]] && s[t[1]].transition ? Ls({ key: n, value: e[n], valueSpec: i.transition, style: o, styleSpec: i }) : s[n] ? Ls({ key: n, value: e[n], valueSpec: s[n], style: o, styleSpec: i }) : [new ie(n, e[n], `unknown property "${n}"`)]); } return r } function Ds(t) { const e = t.value, r = t.key, n = t.style, i = t.styleSpec, s = i.terrain; let a = []; const o = Je(e); if (void 0 === e) return a; if ("null" === o) return a; if ("object" !== o) return a = a.concat([new ne("terrain", e, `object expected, ${o} found`)]), a; for (const t in e) { const r = t.match(/^(.*)-transition$/); a = a.concat(r && s[r[1]] && s[r[1]].transition ? Ls({ key: t, value: e[t], valueSpec: i.transition, style: n, styleSpec: i }) : s[t] ? Ls({ key: t, value: e[t], valueSpec: s[t], style: n, styleSpec: i }) : [new ie(t, e[t], `unknown property "${t}"`)]); } if (e.source) { const t = n.sources && n.sources[e.source], i = t && ae(t.type); t ? "raster-dem" !== i && a.push(new ne(r, e.source, `terrain cannot be used with a source of type ${String(i)}, it only be used with a "raster-dem" source type`)) : a.push(new ne(r, e.source, `source "${e.source}" not found`)); } else a.push(new ne(r, e, 'terrain is missing required property "source"')); return a } function Cs(t) { const e = t.value, r = t.style, n = t.styleSpec, i = n.fog; let s = []; const a = Je(e); if (void 0 === e) return s; if ("object" !== a) return s = s.concat([new ne("fog", e, `object expected, ${a} found`)]), s; for (const t in e) { const a = t.match(/^(.*)-transition$/); s = s.concat(a && i[a[1]] && i[a[1]].transition ? Ls({ key: t, value: e[t], valueSpec: n.transition, style: r, styleSpec: n }) : i[t] ? Ls({ key: t, value: e[t], valueSpec: i[t], style: r, styleSpec: n }) : [new ie(t, e[t], `unknown property "${t}"`)]); } return s } const Rs = { "*": () => [], array: es, boolean: function (t) { const e = t.value, r = t.key, n = Je(e); return "boolean" !== n ? [new ne(r, e, `boolean expected, ${n} found`)] : [] }, number: rs, color: function (t) { const e = t.key, r = t.value, n = Je(r); return "string" !== n ? [new ne(e, r, `color expected, ${n}
33 found`)] : null === Te(r) ? [new ne(e, r, `color expected, "${r}" found`)] : [] }, enum: as, filter: bs, function: ns, layer: Ss, object: ts, source: Ts, model: zs, light: Es, "light-3d": Bs, terrain: Ds, fog: Cs, string: Is, formatted: function (t) { return 0 === Is(t).length ? [] : is(t) }, resolvedImage: function (t) { return 0 === Is(t).length ? [] : is(t) }, projection: function (t) { const e = t.value, r = t.styleSpec, n = r.projection, i = t.style; let s = []; const a = Je(e); if ("object" === a) for (const t in e) s = s.concat(Ls({ key: t, value: e[t], valueSpec: n[t], style: i, styleSpec: r })); else "string" !== a && (s = s.concat([new ne("projection", e, `object or string expected, ${a} found`)])); return s }, import: function (t) { const { value: e, styleSpec: r } = t, { data: n, ...i } = e; Object.defineProperty(i, "__line__", { value: e.__line__, enumerable: !1 }); let s = ts(se({}, t, { value: i, valueSpec: r.import })); return "" === ae(i.id) && s.push(new ne(`${t.key}.id`, i, "import id can't be an empty string")), n && (s = s.concat(Os(n, r, { key: `${t.key}.data` }))), s } }; function Ls(t, e = !1) { const r = t.value, n = t.valueSpec, i = t.styleSpec; if (n.expression && Oi(ae(r))) return ns(t); if (n.expression && Zi(oe(r))) return is(t); if (n.type && Rs[n.type]) { const r = Rs[n.type](t); return !0 === e && r.length > 0 && "array" === Je(t.value) ? is(t) : r } return ts(se({}, t, { valueSpec: n.type ? i[n.type] : n })) } function Vs(t) { const e = t.value, r = t.key, n = Is(t); return n.length || (-1 === e.indexOf("{fontstack}") && n.push(new ne(r, e, '"glyphs" url must include a "{fontstack}" token')), -1 === e.indexOf("{range}") && n.push(new ne(r, e, '"glyphs" url must include a "{range}" token'))), n } function Os(t, e = re, r = {}) { return Ls({ key: r.key || "", value: t, valueSpec: e.$root, styleSpec: e, style: t, objectElementValidators: { glyphs: Vs, "*": () => [] } }) } function Fs(t, e = re) { return Ns(Os(t, e)) } const js = t => Ns(Ms(t)), Us = t => Ns(As(t)); function Ns(t) { return t.slice().sort(((t, e) => t.line && e.line ? t.line - e.line : 0)) } function $s(t, e) { let r = !1; if (e && e.length) for (const n of e) n instanceof ie ? q(n.message) : (t.fire(new te(new Error(n.message))), r = !0); return r } var qs = Ys, Gs = 3; function Ys(t, e, r) { var n = this.cells = []; if (t instanceof ArrayBuffer) { this.arrayBuffer = t; var i = new Int32Array(this.arrayBuffer); t = i[0], this.d = (e = i[1]) + 2 * (r = i[2]); for (var s = 0; s < this.d * this.d; s++) { var a = i[Gs + s], o = i[Gs + s + 1]; n.push(a === o ? null : i.subarray(a, o)); } var l = i[Gs + n.length + 1]; this.keys = i.subarray(i[Gs + n.length], l), this.bboxes = i.subarray(l), this.insert = this._insertReadonly; } else { this.d = e + 2 * r; for (var u = 0; u < this.d * this.d; u++)n.push([]); this.keys = [], this.bboxes = []; } this.n = e, this.extent = t, this.padding = r, this.scale = e / t, this.uid = 0; var c = r / e * t; this.min = -c, this.max = t + c; } Ys.prototype.insert = function (t, e, r, n, i) { this._forEachCell(e, r, n, i, this._insertCell, this.uid++), this.keys.push(t), this.bboxes.push(e), this.bboxes.push(r), this.bboxes.push(n), this.bboxes.push(i); }, Ys.prototype._insertReadonly = function () { throw "Cannot insert into a GridIndex created from an ArrayBuffer." }, Ys.prototype._insertCell = function (t, e, r, n, i, s) { this.cells[i].push(s); }, Ys.prototype.query = function (t, e, r, n, i) { var s = this.min, a = this.max; if (t <= s && e <= s && a <= r && a <= n && !i) return Array.prototype.slice.call(this.keys); var o = []; return this._forEachCell(t, e, r, n, this._queryCell, o, {}, i), o }, Ys.prototype._queryCell = function (t, e, r, n, i, s, a, o) { var l = this.cells[i]; if (null !== l) for (var u = this.keys, c = this.bboxes, h = 0; h < l.length; h++) { var p = l[h]; if (void 0 === a[p]) { var f = 4 * p; (o ? o(c[f + 0], c[f + 1], c[f + 2], c[f + 3]) : t <= c[f + 2] && e <= c[f + 3] && r >= c[f + 0] && n >= c[f + 1]) ? (a[p] = !0, s.push(u[p])) : a[p] = !1; } } }, Ys.prototype._forEachCell = function (t, e, r, n, i, s, a, o) { for (var l = this._convertToCellCoord(t), u = this._convertToCellCoord(e), c = this._convertToCellCoord(r), h = this._convertToCellCoord(n), p = l; p <= c; p++)for (var f = u; f <= h; f++) { var d = this.d * f + p; if ((!o || o(this._convertFromCellCoord(p), this._convertFromCellCoord(f), this._convertFromCellCoord(p + 1), this._convertFromCellCoord(f + 1))) && i.call(this, t, e, r, n, d, s, a, o)) return } }, Ys.prototype._convertFromCellCoord = function (t) { return (t - this.padding) / this.scale }, Ys.prototype._convertToCellCoord = function (t) { return Math.max(0, Math.min(this.d - 1, Math.floor(t * this.scale) + this.padding)) }, Ys.prototype.toArrayBuffer = function () { if (this.arrayBuffer) return this.arrayBuffer; for (var t = this.cells, e = Gs + this.cells.length + 1 + 1, r = 0, n = 0; n < this.cells.length;
33 n++)r += this.cells[n].length; var i = new Int32Array(e + r + this.keys.length + this.bboxes.length); i[0] = this.extent, i[1] = this.n, i[2] = this.padding; for (var s = e, a = 0; a < t.length; a++) { var o = t[a]; i[Gs + a] = s, i.set(o, s), s += o.length; } return i[Gs + t.length] = s, i.set(this.keys, s), i[Gs + t.length + 1] = s += this.keys.length, i.set(this.bboxes, s), s += this.bboxes.length, i.buffer }; var Zs = p(qs); const Xs = {}; function Ks(t, e, r = {}) { Object.defineProperty(t, "_classRegistryKey", { value: e, writeable: !1 }), Xs[e] = { klass: t, omit: r.omit || [] }; } Ks(Object, "Object"), Zs.serialize = function (t, e) { const r = t.toArrayBuffer(); return e && e.add(r), { buffer: r } }, Zs.deserialize = function (t) { return new Zs(t.buffer) }, Object.defineProperty(Zs, "name", { value: "Grid" }), Ks(Zs, "Grid"), Ks(Re, "Color"), Ks(Error, "Error"), Ks(Oe, "Formatted"), Ks(Ve, "FormattedSection"), Ks(ht, "AJAXError"), Ks(Fe, "ResolvedImage"), Ks(Ji, "StylePropertyFunction"), Ks(Yi, "StyleExpression", { omit: ["_evaluator"] }), Ks(Wi, "ZoomDependentExpression"), Ks(Ki, "ZoomConstantExpression"), Ks(ar, "CompoundExpression", { omit: ["_evaluate"] }); for (const t in zi) Xs[zi[t]._classRegistryKey] || Ks(zi[t], `Expression${t}`); function Ws(t) { return t && "undefined" != typeof ArrayBuffer && (t instanceof ArrayBuffer || t.constructor && "ArrayBuffer" === t.constructor.name) } function Hs(t) { return self.ImageBitmap && t instanceof ImageBitmap } function Js(t, e) { 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 (Ws(t) || Hs(t)) return e && e.add(t), t; if (ArrayBuffer.isView(t)) { const r = t; return e && e.add(r.buffer), r } if (t instanceof ImageData) return e && e.add(t.data.buffer), t; if (Array.isArray(t)) { const r = []; for (const n of t) r.push(Js(n, e)); return r } if (t instanceof Map) { const e = { $name: "Map" }; for (const [r, n] of t.entries()) e[r] = Js(n); return e } if ("object" == typeof t) { const r = t.constructor, n = r._classRegistryKey; if (!n) throw new Error(`can't serialize object of unregistered class ${n}`); const i = r.serialize ? r.serialize(t, e) : {}; if (!r.serialize) { for (const r in t) t.hasOwnProperty(r) && (Xs[n].omit.indexOf(r) >= 0 || (i[r] = Js(t[r], e))); t instanceof Error && (i.message = t.message); } if (i.$name) throw new Error("$name property is reserved for worker serialization logic."); return "Object" !== n && (i.$name = n), i } throw new Error("can't serialize object of type " + typeof t) } function Qs(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 || Ws(t) || Hs(t) || ArrayBuffer.isView(t) || t instanceof ImageData) return t; if (Array.isArray(t)) return t.map(Qs); if ("object" == typeof t) { const e = t.$name || "Object"; if ("Map" === e) { const e = new Map; for (const r of Object.keys(t)) "$name" !== r && e.set(r, Qs(t[r])); return e } const { klass: r } = Xs[e]; if (!r) throw new Error(`can't deserialize unregistered class ${e}`); if (r.deserialize) return r.deserialize(t); const n = Object.create(r.prototype); for (const e of Object.keys(t)) "$name" !== e && (n[e] = Qs(t[e])); return n } throw new Error("can't deserialize object of type " + typeof t) } const ta = { "Latin-1 Supplement": t => t >= 128 && t <= 255, Arabic: t => t >= 1536 && t <= 1791, "Arabic Supplement": t => t >= 1872 && t <= 1919, "Arabic Extended-A": t => t >= 2208 && t <= 2303, "Hangul Jamo": t => t >= 4352 && t <= 4607, "Unified Canadian Aboriginal Syllabics": t => t >= 5120 && t <= 5759, Khmer: t => t >= 6016 && t <= 6143, "Unified Canadian Aboriginal Syllabics Extended": t => t >= 6320 && t <= 6399, "General Punctuation": t => t >= 8192 && t <= 8303, "Letterlike Symbols": t => t >= 8448 && t <= 8527, "Number Forms": t => t >= 8528 && t <= 8591, "Miscellaneous Technical": t => t >= 8960 && t <= 9215, "Control Pictures": t => t >= 9216 && t <= 9279, "Optical Character Recognition": t => t >= 9280 && t <= 9311, "Enclosed Alphanumerics": t => t >= 9312 && t <= 9471, "Geometric Shapes": t => t >= 9632 && t <= 9727, "Miscellaneous Symbols": t => t >= 9728 && t <= 9983, "Miscellaneous Symbols and Arrows": t => t >= 11008 && t <= 11263, "CJK Radicals Supplement": t => t >= 11904 && t <= 12031, "Kangxi Radicals": t => t >= 12032 && t <= 12255, "Ideographic Description Characters": t => t >= 12272 && t <= 12287, "CJK Symbols and Punctuation": t => t >= 12288 && t <= 12351, Hiragana: t => t >= 12352 && t <= 12447, Katakana: t => t >= 12448 && t <= 12543, Bopomofo: t => t >= 12544 && t <= 12591, "Hangul Compatibility Jamo": t => t >= 12592 && t <= 12687, Kanbun: t => t >= 12688 && t <= 12703, "Bopomofo Extended": t => t >= 12704 && t <= 12735, "CJK Strokes": t => t >
vendor: 4,255 bytes, line 33
33= 12736 && t <= 12783, "Katakana Phonetic Extensions": t => t >= 12784 && t <= 12799, "Enclosed CJK Letters and Months": t => t >= 12800 && t <= 13055, "CJK Compatibility": t => t >= 13056 && t <= 13311, "CJK Unified Ideographs Extension A": t => t >= 13312 && t <= 19903, "Yijing Hexagram Symbols": t => t >= 19904 && t <= 19967, "CJK Unified Ideographs": t => t >= 19968 && t <= 40959, "Yi Syllables": t => t >= 40960 && t <= 42127, "Yi Radicals": t => t >= 42128 && t <= 42191, "Hangul Jamo Extended-A": t => t >= 43360 && t <= 43391, "Hangul Syllables": t => t >= 44032 && t <= 55215, "Hangul Jamo Extended-B": t => t >= 55216 && t <= 55295, "Private Use Area": t => t >= 57344 && t <= 63743, "CJK Compatibility Ideographs": t => t >= 63744 && t <= 64255, "Arabic Presentation Forms-A": t => t >= 64336 && t <= 65023, "Vertical Forms": t => t >= 65040 && t <= 65055, "CJK Compatibility Forms": t => t >= 65072 && t <= 65103, "Small Form Variants": t => t >= 65104 && t <= 65135, "Arabic Presentation Forms-B": t => t >= 65136 && t <= 65279, "Halfwidth and Fullwidth Forms": t => t >= 65280 && t <= 65519, "CJK Unified Ideographs Extension B": t => t >= 131072 && t <= 173791 }; function ea(t) { for (const e of t) if (ia(e.charCodeAt(0))) return !0; return !1 } function ra(t) { for (const e of t) if (!na(e.charCodeAt(0))) return !1; return !0 } function na(t) { return !(ta.Arabic(t) || ta["Arabic Supplement"](t) || ta["Arabic Extended-A"](t) || ta["Arabic Presentation Forms-A"](t) || ta["Arabic Presentation Forms-B"](t)) } function ia(t) { return !(746 !== t && 747 !== t && (t < 4352 || !(ta["Bopomofo Extended"](t) || ta.Bopomofo(t) || ta["CJK Compatibility Forms"](t) && !(t >= 65097 && t <= 65103) || ta["CJK Compatibility Ideographs"](t) || ta["CJK Compatibility"](t) || ta["CJK Radicals Supplement"](t) || ta["CJK Strokes"](t) || !(!ta["CJK Symbols and Punctuation"](t) || t >= 12296 && t <= 12305 || t >= 12308 && t <= 12319 || 12336 === t) || ta["CJK Unified Ideographs Extension A"](t) || ta["CJK Unified Ideographs"](t) || ta["Enclosed CJK Letters and Months"](t) || ta["Hangul Compatibility Jamo"](t) || ta["Hangul Jamo Extended-A"](t) || ta["Hangul Jamo Extended-B"](t) || ta["Hangul Jamo"](t) || ta["Hangul Syllables"](t) || ta.Hiragana(t) || ta["Ideographic Description Characters"](t) || ta.Kanbun(t) || ta["Kangxi Radicals"](t) || ta["Katakana Phonetic Extensions"](t) || ta.Katakana(t) && 12540 !== t || !(!ta["Halfwidth and Fullwidth Forms"](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) || !(!ta["Small Form Variants"](t) || t >= 65112 && t <= 65118 || t >= 65123 && t <= 65126) || ta["Unified Canadian Aboriginal Syllabics"](t) || ta["Unified Canadian Aboriginal Syllabics Extended"](t) || ta["Vertical Forms"](t) || ta["Yijing Hexagram Symbols"](t) || ta["Yi Syllables"](t) || ta["Yi Radicals"](t)))) } function sa(t) { return !(ia(t) || function (t) { return !!(ta["Latin-1 Supplement"](t) && (167 === t || 169 === t || 174 === t || 177 === t || 188 === t || 189 === t || 190 === t || 215 === t || 247 === t) || ta["General Punctuation"](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) || ta["Letterlike Symbols"](t) || ta["Number Forms"](t) || ta["Miscellaneous Technical"](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) || ta["Control Pictures"](t) && 9251 !== t || ta["Optical Character Recognition"](t) || ta["Enclosed Alphanumerics"](t) || ta["Geometric Shapes"](t) || ta["Miscellaneous Symbols"](t) && !(t >= 9754 && t <= 9759) || ta["Miscellaneous Symbols and Arrows"](t) && (t >= 11026 && t <= 11055 || t >= 11088 && t <= 11097 || t >= 11192 && t <= 11243) || ta["CJK Symbols and Punctuation"](t) || ta.Katakana(t) || ta["Private Use Area"](t) || ta["CJK Compatibility Forms"](t) || ta["Small Form Variants"](t) || ta["Halfwidth and Fullwidth Forms"](t) || 8734 === t || 8756 
33=== t || 8757 === t || t >= 9984 && t <= 10087 || t >= 10102 && t <= 10131 || 65532 === t || 65533 === t) }(t)) } function aa(t) { return t >= 1424 && t <= 2303 || ta["Arabic Presentation Forms-A"](t) || ta["Arabic Presentation Forms-B"](t) } function oa(t, e) { return !(!e && aa(t) || t >= 2304 && t <= 3583 || t >= 3840 && t <= 4255 || ta.Khmer(t)) } function la(t) { for (const e of t) if (aa(e.charCodeAt(0))) return !0; return !1 } const ua = "deferred", ca = "loading", ha = "loaded"; let pa = null, fa = "unavailable", da = null; const ma = function (t) { t && "string" == typeof t && t.indexOf("NetworkError") > -1 && (fa = "error"), pa && pa(t); }; function ya() { ga.fire(new Qt("pluginStateChange", { pluginStatus: fa, pluginURL: da })); } const ga = new ee, xa = function () { return fa }, va = function () { if (fa !== ua || !da) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified"); fa = ca, ya(), da && dt({ url: da }, (t => { t ? ma(t) : (fa = ha, ya()); })); }, ba = { applyArabicShaping: null, processBidirectionalText: null, processStyledBidirectionalText: null, isLoaded: () => fa === ha || null != ba.applyArabicShaping, isLoading: () => fa === ca, setState(t) { fa = t.pluginStatus, da = t.pluginURL; }, isParsed: () => null != ba.applyArabicShaping && null != ba.processBidirectionalText && null != ba.processStyledBidirectionalText, getPluginURL: () => da }; class _a { constructor(t, e) { this.zoom = t, e ? (this.now = e.now, this.fadeDuration = e.fadeDuration, this.transition = e.transition, this.pitch = e.pitch, this.brightness = e.brightness) : (this.now = 0, this.fadeDuration = 0, this.transition = {}, this.pitch = 0, this.brightness = 0); } isSupportedScript(t) { return function (t, e) { for (const r of t) if (!oa(r.charCodeAt(0), e)) return !1; return !0 }(t, ba.isLoaded()) } } class wa { constructor(t, e, r, n) { this.property = t, this.value = e, this.expression = function (t, e, r, n) { if (Oi(t)) return new Ji(t, e); if (Zi(t) || Array.isArray(t) && t.length > 0) { const i = Hi(t, e, r, n); if ("error" === i.result) throw new Error(i.value.map((t => `${t.key}: ${t.message}`)).join(", ")); return i.value } { let r = t; return "string" == typeof t && "color" === e.type && (r = Re.parse(t)), { kind: "constant", isConfigDependent: !1, evaluate: () => r } } }(void 0 === e ? t.specification.default : e, t.specification, r, n); } isDataDriven() { return "source" === this.expression.kind || "composite" === this.expression.kind } possiblyEvaluate(t, e, r) { return this.property.possiblyEvaluate(this, t, e, r) } } class Ma { constructor(t, e, r) { this.property = t, this.value = new wa(t, void 0, e, r); } transitioned(t, e) { return new Sa(this.property, this.value, e, B({}, t.transition, this.transition), t.now) } untransitioned() { return new Sa(this.property, this.value, null, {}, 0) } } class Aa { constructor(t, e, r) { this._properties = t, this._values = Object.create(t.defaultTransitionablePropertyValues), this._scope = e, this._options = r, this.isConfigDependent = !1; } getValue(t) { return N(this._values[t].value.value) } setValue(t, e) { this._values.hasOwnProperty(t) || (this._values[t] = new Ma(this._values[t].property, this._scope, this._options)), this._values[t].value = new wa(this._values[t].property, null === e ? void 0 : N(e), this._scope, this._options), this.isConfigDependent = this.isConfigDependent || this._values[t].value.expression.isConfigDependent; } setTransitionOrValue(t, e) { e && (this._options = e); const r = this._properties.properties; if (t) for (const e in t) { const n = t[e]; if (F(e, "-transition")) { const t = e.slice(0, -11); r[t] && this.setTransition(t, n); } else r[e] && this.setValue(e, n); } } getTransition(t) { return N(this._values[t].transition) } setTransition(t, e) { this._values.hasOwnProperty(t) || (this._values[t] = new Ma(this._values[t].property)), this._values[t].transition = N(e) || void 0; } serialize() { const t = {}; for (const e of Object.keys(this._values)) { const r = this.getValue(e); void 0 !== r && (t[e] = r); const n = this.getTransition(e); void 0 !== n && (t[`${e}-transition`] = n); } return t } transitioned(t, e) { const r = new Ia(this._properties); for (const n of Object.keys(this._values)) r._values[n] = this._values[n].transitioned(t, e._values[n]); return r } untransitioned() { const t = new Ia(this._properties); for (const e of Object.keys(this._values)) t._values[e] = this._values[e].untransitioned(); return t } } class Sa { constructor(t, e, r, n, i) { const s = n.delay || 0, a = n.duration || 0; i = i || 0, this.property = t, this.value = e, this.begin = i + s, this.end = this.begin + a, t.specification.transition && (n.delay || n.duration) && (this.prior = r); } possiblyEvaluate(t, e, r) { const n = t.now || 0, i = this.value.possiblyEvaluate(t, e, r), s = this.prior; if (s) { if (n > this.end) return this.prior = null, i; if (this.value.isDataDriven()) return this.prior = null, i; if (n < this.begin) return s.possiblyEvaluate(t, e, r);
vendor: 4,649 bytes, line 33
33 { const a = (n - this.begin) / (this.end - this.begin); return this.property.interpolate(s.possiblyEvaluate(t, e, r), i, A(a)) } } return i } } class Ia { constructor(t) { this._properties = t, this._values = Object.create(t.defaultTransitioningPropertyValues); } possiblyEvaluate(t, e, r) { const n = new Pa(this._properties); for (const i of Object.keys(this._values)) n._values[i] = this._values[i].possiblyEvaluate(t, e, r); return n } hasTransition() { for (const t of Object.keys(this._values)) if (this._values[t].prior) return !0; return !1 } } class ka { constructor(t, e, r) { this._properties = t, this._values = Object.create(t.defaultPropertyValues), this._scope = e, this._options = r, this.isConfigDependent = !1; } getValue(t) { return N(this._values[t].value) } setValue(t, e) { this._values[t] = new wa(this._values[t].property, null === e ? void 0 : N(e), this._scope, this._options), this.isConfigDependent = this.isConfigDependent || this._values[t].expression.isConfigDependent; } serialize() { const t = {}; for (const e of Object.keys(this._values)) { const r = this.getValue(e); void 0 !== r && (t[e] = r); } return t } possiblyEvaluate(t, e, r) { const n = new Pa(this._properties); for (const i of Object.keys(this._values)) n._values[i] = this._values[i].possiblyEvaluate(t, e, r); return n } } class Ta { constructor(t, e, r) { this.property = t, this.value = e, this.parameters = r; } isConstant() { return "constant" === this.value.kind } constantOr(t) { return "constant" === this.value.kind ? this.value.value : t } evaluate(t, e, r, n) { return this.property.evaluate(this.value, this.parameters, t, e, r, n) } } class Pa { constructor(t) { this._properties = t, this._values = Object.create(t.defaultPossiblyEvaluatedValues); } get(t) { return this._values[t] } } class za { constructor(t) { this.specification = t; } possiblyEvaluate(t, e) { return t.expression.evaluate(e) } interpolate(t, e, r) { const n = Sn[this.specification.type]; return n ? n(t, e, r) : t } } class Ea { constructor(t, e) { this.specification = t, this.overrides = e; } possiblyEvaluate(t, e, r, n) { return new Ta(this, "constant" === t.expression.kind || "camera" === t.expression.kind ? { kind: "constant", value: t.expression.evaluate(e, null, {}, r, n) } : t.expression, e) } interpolate(t, e, r) { if ("constant" !== t.value.kind || "constant" !== e.value.kind) return t; if (void 0 === t.value.value || void 0 === e.value.value) return new Ta(this, { kind: "constant", value: void 0 }, t.parameters); const n = Sn[this.specification.type]; return n ? new Ta(this, { kind: "constant", value: n(t.value.value, e.value.value, r) }, t.parameters) : t } evaluate(t, e, r, n, i, s) { return "constant" === t.kind ? t.value : t.evaluate(e, r, n, i, s) } } class Ba { constructor(t) { this.specification = t; } possiblyEvaluate(t, e, r, n) { return !!t.expression.evaluate(e, null, {}, r, n) } interpolate() { return !1 } } class Da { constructor(t) { this.properties = t, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = []; const e = new _a(0, {}); for (const r in t) { const n = t[r]; n.specification.overridable && this.overridableProperties.push(r); const i = this.defaultPropertyValues[r] = new wa(n, void 0), s = this.defaultTransitionablePropertyValues[r] = new Ma(n); this.defaultTransitioningPropertyValues[r] = s.untransitioned(), this.defaultPossiblyEvaluatedValues[r] = i.possiblyEvaluate(e); } } } Ks(Ea, "DataDrivenProperty"), Ks(za, "DataConstantProperty"), Ks(Ba, "ColorRampProperty"); const Ca = "�"; function Ra(t, e) { return e ? `${t}${Ca}${e}` : t } const La = "-transition"; class Va extends ee { constructor(t, e, r, n) { if (super(), this.id = t.id, this.fqid = Ra(this.id, r), this.type = t.type, this.scope = r, this.options = n, this._featureFilter = { filter: () => !0, needGeometry: !1, needFeature: !1 }, this._filterCompiled = !1, this.isConfigDependent = !1, "custom" !== t.type && (this.metadata = t.metadata, this.minzoom = t.minzoom, this.maxzoom = t.maxzoom, "background" !== t.type && "sky" !== t.type && "slot" !== t.type && (this.source = t.source, this.sourceLayer = t["source-layer"], this.filter = t.filter), t.slot && (this.slot = t.slot), e.layout && (this._unevaluatedLayout = new ka(e.layout, this.scope, n), this.isConfigDependent = this.isConfigDependent || this._unevaluatedLayout.isConfigDependent), e.paint)) { this._transitionablePaint = new Aa(e.paint, this.scope, n); for (const e in t.paint) this.setPaintProperty(e, t.paint[e], { val
33idate: !1 }); for (const e in t.layout) this.setLayoutProperty(e, t.layout[e], { validate: !1 }); this.isConfigDependent = this.isConfigDependent || this._transitionablePaint.isConfigDependent, this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new Pa(e.paint); } } getLayoutProperty(t) { return "visibility" === t ? this.visibility : this._unevaluatedLayout.getValue(t) } setLayoutProperty(t, e, r = {}) { if (null != e && this._validate(Us, `layers.${this.id}.layout.${t}`, t, e, r)) return; if ("custom" === this.type && "visibility" === t) return void (this.visibility = e); const n = this._unevaluatedLayout; n._properties.properties[t] && (n.setValue(t, e), this.isConfigDependent = this.isConfigDependent || n.isConfigDependent, "visibility" === t && this.possiblyEvaluateVisibility()); } possiblyEvaluateVisibility() { this.visibility = this._unevaluatedLayout._values.visibility.possiblyEvaluate({ zoom: 0 }); } getPaintProperty(t) { return F(t, La) ? this._transitionablePaint.getTransition(t.slice(0, -11)) : this._transitionablePaint.getValue(t) } setPaintProperty(t, e, r = {}) { if (null != e && this._validate(js, `layers.${this.id}.paint.${t}`, t, e, r)) return !1; const n = this._transitionablePaint, i = n._properties.properties; if (F(t, La)) { const r = t.slice(0, -11); return i[r] && n.setTransition(r, e || void 0), !1 } if (!i[t]) return !1; const s = n._values[t], a = s.value.isDataDriven(), o = s.value; n.setValue(t, e), this.isConfigDependent = this.isConfigDependent || n.isConfigDependent, this._handleSpecialPaintPropertyUpdate(t); const l = n._values[t].value, u = l.isDataDriven(), c = F(t, "pattern") || "line-dasharray" === t; return u || a || c || this._handleOverridablePaintPropertyUpdate(t, o, l) } _handleSpecialPaintPropertyUpdate(t) { } getProgramIds() { return null } getDefaultProgramParams(t, e) { return null } _handleOverridablePaintPropertyUpdate(t, e, r) { 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) { this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t, void 0, e)), this.paint = this._transitioningPaint.possiblyEvaluate(t, void 0, e); } serialize() { return U({ id: this.id, type: this.type, slot: this.slot, source: this.source, "source-layer": this.sourceLayer, metadata: this.metadata, minzoom: this.minzoom, maxzoom: this.maxzoom, filter: this.filter, layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), paint: this._transitionablePaint && this._transitionablePaint.serialize() }, ((t, e) => !(void 0 === t || "layout" === e && !Object.keys(t).length || "paint" === e && !Object.keys(t).length))) } _validate(t, e, r, n, i = {}) { return (!i || !1 !== i.validate) && $s(this, t.call(Fs, { key: e, layerType: this.type, objectKey: r, value: n, styleSpec: re, style: { glyphs: !0, sprite: !0 } })) } is3D() { return !1 } isSky() { return !1 } isTileClipped() { return !1 } hasOffscreenPass() { return !1 } hasShadowPass() { return !1 } canCastShadows() { return !1 } hasLightBeamPass() { return !1 } cutoffRange() { return 0 } resize() { } isStateDependent() { for (const t in this.paint._values) { const e = this.paint.get(t); if (e instanceof Ta && Ci(e.property.specification) && ("source" === e.value.kind || "composite" === e.value.kind) && e.value.isStateDependent) return !0 } return !1 } compileFilter() { this._filterCompiled || (this._featureFilter = ls(this.filter), this._filterCompiled = !0); } invalidateCompiledFilter() { this._filterCompiled = !1; } dynamicFilter() { return this._featureFilter.dynamicFilter } dynamicFilterNeedsFeature() { return this._featureFilter.needFeature } getLayerRenderingStats() { return this._stats } resetLayerRenderingStats() { this._stats && (this._stats.numRenderedVerticesInShadowPass = 0, this._stats.numRen
vendor: 4,250 bytes, line 33
33deredVerticesInTransparentPass = 0); } } const Oa = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array }; class Fa { 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 ja { constructor() { this.isTransferred = !1, this.capacity = -1, this.resize(0); } static serialize(t, e) { return t._trim(), e && (t.isTransferred = !0, e.add(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 Ua(t, e = 1) { let r = 0, n = 0; return { members: t.map((t => { const i = Oa[t.type].BYTES_PER_ELEMENT, s = r = Na(r, Math.max(e, i)), a = t.components || 1; return n = Math.max(n, i), r += i * a, { name: t.name, type: t.type, components: a, offset: s } })), size: Na(r, Math.max(n, e)), alignment: e } } function Na(t, e) { return Math.ceil(t / e) * e } class $a extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e) { const r = this.length; return this.resize(r + 1), this.emplace(r, t, e) } emplace(t, e, r) { const n = 2 * t; return this.int16[n + 0] = e, this.int16[n + 1] = r, t } } $a.prototype.bytesPerElement = 4, Ks($a, "StructArrayLayout2i4"); class qa extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r) { const n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) } emplace(t, e, r, n) { const i = 3 * t; return this.int16[i + 0] = e, this.int16[i + 1] = r, this.int16[i + 2] = n, t } } qa.prototype.bytesPerElement = 6, Ks(qa, "StructArrayLayout3i6"); class Ga extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r, n) { const i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) } emplace(t, e, r, n, i) { const s = 4 * t; return this.int16[s + 0] = e, this.int16[s + 1] = r, this.int16[s + 2] = n, this.int16[s + 3] = i, t } } Ga.prototype.bytesPerElement = 8, Ks(Ga, "StructArrayLayout4i8"); class Ya extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i) { const s = this.length; return this.resize(s + 1), this.emplace(s, t, e, r, n, i) } emplace(t, e, r, n, i, s) { const a = 5 * t; return this.int16[a + 0] = e, this.int16[a + 1] = r, this.int16[a + 2] = n, this.int16[a + 3] = i, this.int16[a + 4] = s, t } } Ya.prototype.bytesPerElement = 10, Ks(Ya, "StructArrayLayout5i10"); class Za extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a) { const o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, s, a) } emplace(t, e, r, n, i, s, a, o) { const l = 6 * t, u = 12 * t, c = 3 * t; return this.int16[l + 0] = e, this.int16[l + 1] = r, this.uint8[u + 4] = n, this.uint8[u + 5] = i, this.uint8[u + 6] = s, this.uint8[u + 7] = a, this.float32[c + 2] = o, t } }
vendor: 22,370 bytes, line 33
33 Za.prototype.bytesPerElement = 12, Ks(Za, "StructArrayLayout2i4ub1f12"); class Xa extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n) { const i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) } emplace(t, e, r, n, i) { const s = 4 * t; return this.float32[s + 0] = e, this.float32[s + 1] = r, this.float32[s + 2] = n, this.float32[s + 3] = i, t } } Xa.prototype.bytesPerElement = 16, Ks(Xa, "StructArrayLayout4f16"); class Ka extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i) { const s = this.length; return this.resize(s + 1), this.emplace(s, t, e, r, n, i) } emplace(t, e, r, n, i, s) { const a = 6 * t, o = 3 * t; return this.uint16[a + 0] = e, this.uint16[a + 1] = r, this.uint16[a + 2] = n, this.uint16[a + 3] = i, this.float32[o + 2] = s, t } } Ka.prototype.bytesPerElement = 12, Ks(Ka, "StructArrayLayout4ui1f12"); class Wa extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t, e, r, n) { const i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) } emplace(t, e, r, n, i) { const s = 4 * t; return this.uint16[s + 0] = e, this.uint16[s + 1] = r, this.uint16[s + 2] = n, this.uint16[s + 3] = i, t } } Wa.prototype.bytesPerElement = 8, Ks(Wa, "StructArrayLayout4ui8"); class Ha extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s) { const a = this.length; return this.resize(a + 1), this.emplace(a, t, e, r, n, i, s) } emplace(t, e, r, n, i, s, a) { const o = 6 * t; return this.int16[o + 0] = e, this.int16[o + 1] = r, this.int16[o + 2] = n, this.int16[o + 3] = i, this.int16[o + 4] = s, this.int16[o + 5] = a, t } } Ha.prototype.bytesPerElement = 12, Ks(Ha, "StructArrayLayout6i12"); class Ja extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a, o, l, u, c, h) { const p = this.length; return this.resize(p + 1), this.emplace(p, t, e, r, n, i, s, a, o, l, u, c, h) } emplace(t, e, r, n, i, s, a, o, l, u, c, h, p) { const f = 12 * t; return this.int16[f + 0] = e, this.int16[f + 1] = r, this.int16[f + 2] = n, this.int16[f + 3] = i, this.uint16[f + 4] = s, this.uint16[f + 5] = a, this.uint16[f + 6] = o, this.uint16[f + 7] = l, this.int16[f + 8] = u, this.int16[f + 9] = c, this.int16[f + 10] = h, this.int16[f + 11] = p, t } } Ja.prototype.bytesPerElement = 24, Ks(Ja, "StructArrayLayout4i4ui4i24"); class Qa extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s) { const a = this.length; return this.resize(a + 1), this.emplace(a, t, e, r, n, i, s) } emplace(t, e, r, n, i, s, a) { const o = 10 * t, l = 5 * t; return this.int16[o + 0] = e, this.int16[o + 1] = r, this.int16[o + 2] = n, this.float32[l + 2] = i, this.float32[l + 3] = s, this.float32[l + 4] = a, t } } Qa.prototype.bytesPerElement = 20, Ks(Qa, "StructArrayLayout3i3f20"); class to extends ja { _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 } } to.prototype.bytesPerElement = 4, Ks(to, "StructArrayLayout1ul4"); class eo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t, e) { const r = this.length; return this.resize(r + 1), this.emplace(r, t, e) } emplace(t, e, r) { const n = 2 * t; return this.uint16[n + 0] = e, this.uint16[n + 1] = r, t } } eo.prototype.bytesPerElement = 4, Ks(eo, "StructArrayLayout2ui4"); class ro extends ja { _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, r, n, i, s, a, o, l, u, c, h, p) { const f = this.length; return this.resize(f + 1), this.emplace(f, t, e, r, n, i, s, a, o, l, u, c, h, p) } emplace(t, e, r, n, i, s, a, o, l, u, c, h, p, f) { const d = 20 * t, m = 10 * t; return this.int16[d + 0] = e, this.int16[d + 1] = r, this.int16[d + 2] = n, this.int16[d + 3] = i, this.int16[d + 4] = s, this.float32[m + 3] = a, this.float32[m + 4] = o, this.float32[m + 5] = l, this.float32[m + 6] = u, this.int16[d + 14] = c, this.uint32[m + 8] = h, this.uint16[d + 18] = p, this.uint16[d + 19] = f, t } } ro.prototype.bytesPerElement = 40, Ks(ro, "StructArrayLayout5i4f1i1ul2ui40"); class no extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a) { const o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, s, a) } emplace(t, e, r, n, i, s, a, o) { const l = 8 * t; return this.int16[l + 0] = e, this.int16[l + 1] = r, this.int16[l + 2] = n, this.int16[l + 4] = i, this.int16[l + 5] = s, this.int16[l + 6] = a, this.int16[l + 7] = o, t } } no.prototype.bytesPerElement = 16, Ks(no, "StructArrayLayout3i2i2i16"); class io extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i) { const s = this.length; return this.resize(s + 1), this.emplace(s, t, e, r, n, i) } emplace(t, e, r, n, i, s) { const a = 4 * t, o = 8 * t; return this.float32[a + 0] = e, this.float32[a + 1] = r, this.float32[a + 2] = n, this.int16[o + 6] = i, this.int16[o + 7] = s, t } } io.prototype.bytesPerElement = 16, Ks(io, "StructArrayLayout2f1f2i16"); class so extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n) { const i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) } emplace(t, e, r, n, i) { const s = 12 * t, a = 3 * t; return this.uint8[s + 0] = e, this.uint8[s + 1] = r, this.float32[a + 1] = n, this.float32[a + 2] = i, t } } so.prototype.bytesPerElement = 12, Ks(so, "StructArrayLayout2ub2f12"); class ao extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t, e, r) { const n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) } emplace(t, e, r, n) { const i = 3 * t; return this.uint16[i + 0] = e, this.uint16[i + 1] = r, this.uint16[i + 2] = n, t } } ao.prototype.bytesPerElement = 6, Ks(ao, "StructArrayLayout3ui6"); class oo extends ja { _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, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b) { const _ = this.length; return this.resize(_ + 1), this.emplace(_, t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b) } emplace(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _) { const w = 30 * t, M = 15 * t, A = 60 * t; return this.int16[w + 0] = e, this.int16[w + 1] = r, this.int16[w + 2] = n, this.float32[M + 2] = i, this.float32[M + 3] = s, this.uint16[w + 8] = a, this.uint16[w + 9] = o, this.uint32[M + 5] = l, this.uint32[M + 6] = u, this.uint32[M + 7] = c, this.uint16[w + 16] = h, this.uint16[w + 17] = p, this.uint16[w + 18] = f, this.float32[M + 10] = d, this.float32[M + 11] = m, this.uint8[A + 48] = y, this.uint8[A + 49] = g, this.uint8[A + 50] = x, this.uint32[M + 13] = v, this.int16[w + 28] = b, this.uint8[A + 58] = _, t } } oo.prototype.bytesPerElement = 60, Ks(oo, "StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60"); class lo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _, w, M, A, S, I, k, T, P, z, E) { const B = this.length; return this.resize(B + 1), this.emplace(B, t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _, w, M, A, S, I, k, T, P, z, E) } emplace(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _, w, M, A, S, I, k, T, P, z, E, B) { const D = 20 * t, C = 40 * t, R = 80 * t; return this.float32[D + 0] = e, this.float32[D + 1] = r, this.int16[C + 4] = n, this.int16[C + 5] = i, this.int16[C + 6] = s, this.int16[C + 7] = a, this.int16[C + 8] = o, this.int16[C + 9] = l, this.int16[C + 10] = u, this.int16[C + 11] = c, this.int16[C + 12] = h, this.uint16[C + 13] = p, this.uint16[C + 14] = f, this.uint16[C + 15] = d, this.uint16[C + 16] = m, this.uint16[C + 17] = y, this.uint16[C + 18] = g, this.uint16[C + 19] = x, this.uint16[C + 20] = v, this.uint16[C + 21] = b, this.uint16[C + 22] = _, this.uint16[C + 23] = w, this.uint16[C + 24] = M, this.uint16[C + 25] = A, this.uint16[C + 26] = S, this.uint16[C + 27] = I, this.uint32[D + 14] = k, this.float32[D + 15] = T, this.float32[D + 16] = P, this.float32[D + 17] = z, this.float32[D + 18] = E, this.uint8[R + 76] = B, t } } lo.prototype.bytesPerElement = 80, Ks(lo, "StructArrayLayout2f9i15ui1ul4f1ub80"); class uo extends ja { _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 } } uo.prototype.bytesPerElement = 4, Ks(uo, "StructArrayLayout1f4"); class co extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i) { const s = this.length; return this.resize(s + 1), this.emplace(s, t, e, r, n, i) } emplace(t, e, r, n, i, s) { const a = 5 * t; return this.float32[a + 0] = e, this.float32[a + 1] = r, this.float32[a + 2] = n, this.float32[a + 3] = i, this.float32[a + 4] = s, t } } co.prototype.bytesPerElement = 20, Ks(co, "StructArrayLayout5f20"); class ho extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a) { const o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, s, a) } emplace(t, e, r, n, i, s, a, o) { const l = 7 * t; return this.float32[l + 0] = e, this.float32[l + 1] = r, this.float32[l + 2] = n, this.float32[l + 3] = i, this.float32[l + 4] = s, this.float32[l + 5] = a, this.float32[l + 6] = o, t } } ho.prototype.bytesPerElement = 28, Ks(ho, "StructArrayLayout7f28"); class po extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t, e, r, n) { const i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) } emplace(t, e, r, n, i) { const s = 6 * t; return this.uint32[3 * t + 0] = e, this.uint16[s + 2] = r, this.uint16[s + 3] = n, this.uint16[s + 4] = i, t } } po.prototype.bytesPerElement = 12, Ks(po, "StructArrayLayout1ul3ui12"); class fo extends ja { _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 } } fo.prototype.bytesPerElement = 2, Ks(fo, "StructArrayLayout1ui2"); class mo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r) { const n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) } emplace(t, e, r, n) { const i = 3 * t; return this.float32[i + 0] = e, this.float32[i + 1] = r, this.float32[i + 2] = n, t } } mo.prototype.bytesPerElement = 12, Ks(mo, "StructArrayLayout3f12"); class yo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e) { const r = this.length; return this.resize(r + 1), this.emplace(r, t, e) } emplace(t, e, r) { const n = 2 * t; return this.float32[n + 0] = e, this.float32[n + 1] = r, t } } yo.prototype.bytesPerElement = 8, Ks(yo, "StructArrayLayout2f8"); class go extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m) { const y = this.length; return this.resize(y + 1), this.emplace(y, t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m) } emplace(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y) { const g = 16 * t; return this.float32[g + 0] = e, this.float32[g + 1] = r, this.float32[g + 2] = n, this.float32[g + 3] = i, this.float32[g + 4] = s, this.float32[g + 5] = a, this.float32[g + 6] = o, this.float32[g + 7] = l, this.float32[g + 8] = u, this.float32[g + 9] = c, this.float32[g + 10] = h, this.float32[g + 11] = p, this.float32[g + 12] = f, this.float32[g + 13] = d, this.float32[g + 14] = m, this.float32[g + 15] = y, t } } go.prototype.bytesPerElement = 64, Ks(go, "StructArrayLayout16f64"); class xo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t, e, r, n, i, s, a) { const o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, s, a) } emplace(t, e, r, n, i, s, a, o) { const l = 10 * t, u = 5 * t; return this.uint16[l + 0] = e, this.uint16[l + 1] = r, this.uint16[l + 2] = n, this.uint16[l + 3] = i, this.float32[u + 2] = s, this.float32[u + 3] = a, this.float32[u + 4] = o, t } } xo.prototype.bytesPerElement = 20, Ks(xo, "StructArrayLayout4ui3f20"); class vo extends ja { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer); } emplaceBack(t) { const e = this.length; return this.resize(e + 1), this.emplace(e, t) } emplace(t, e) { return this.uint8[1 * t + 0] = e, t } } vo.prototype.bytesPerElement = 1, Ks(vo, "StructArrayLayout1ub1"); class bo extends Fa { 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] } } bo.prototype.size = 40; class _o extends ro { get(t) { return new bo(this, t) } } Ks(_o, "CollisionBoxArray"); class wo extends Fa { 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; } } wo.prototype.size = 60; class Mo extends oo { get(t) { return new wo(this, t) } } Ks(Mo, "PlacedSymbolArray"); class Ao extends Fa { get tileAnchorX() { return this._structArray.float32[this._pos4 + 0] } get tileAnchorY() { return this._structArray.float32[this._pos4 + 1] } get projectedAnchorX() { return this._structArray.int16[this._pos2 + 4] } get projectedAnchorY() { return this._structArray.int16[this._pos2 + 5] } get projectedAnchorZ() { return this._structArray.int16[this._pos2 + 6] } get rightJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 7] } get centerJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 8] } get leftJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 9] } get verticalPlacedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 10] } get placedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 11] } get verticalPlacedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 12] } get key() { return this._structArray.uint16[this._pos2 + 13] } get textBoxStartIndex() { return this._structArray.uint16[this._pos2 + 14] } get textBoxEndIndex() { return this._structArray.uint16[this._pos2 + 15] } get verticalTextBoxStartIndex() { return this._structArray.uint16[this._pos2 + 16] } get verticalTextBoxEndIndex() { return this._structArray.uint16[this._pos2 + 17] } get iconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 18] } get iconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 19] } get verticalIconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 20] } get verticalIconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 21] } get featureIndex() { return this._structArray.uint16[this._pos2 + 22] } get numHorizontalGlyphVertices() { return this._structArray.uint16[this._pos2 + 23] } get numVerticalGlyphVertices() { return this._structArray.uint16[this._pos2 + 24] } get numIconVertices() { return this._structArray.uint16[this._pos2 + 25] } get numVerticalIconVertices() { return this._structArray.uint16[this._pos2 + 26] } get useRuntimeCollisionCircles() { return this._structArray.uint16[this._pos2 + 27] } get crossTileID() { return this._structArray.uint32[this._pos4 + 14] } set crossTileID(t) { this._structArray.uint32[this._pos4 + 14] = t; } get textOffset0() { return this._structArray.float32[this._pos4 + 15] } get textOffset1() { return this._structArray.float32[this._pos4 + 16] } get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 17] } get zOffset() { return this._structArray.float32[this._pos4 + 18] } set zOffset(t) { this._structArray.float32[this._pos4 + 18] = t; } get hasIconTextFit() { return this._structArray.uint8[this._pos1 + 76] } } Ao.prototype.size = 80; class So extends lo { get(t) { return new Ao(this, t) } } Ks(So, "SymbolInstanceArray"); class Io extends uo { getoffsetX(t) { return this.float32[1 * t + 0] } } Ks(Io, "GlyphOffsetArray"); class ko extends $a { getx(t) { return this.int16[2 * t + 0] } gety(t) { return this.int16[2 * t + 1] } } Ks(ko, "SymbolLineVertexArray"); class To extends Fa { 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] } } To.prototype.size = 12; class Po extends po { get(t) { return new To(this, t) } } Ks(Po, "FeatureIndexArray"); class zo extends eo { geta_centroid_pos0(t) { return this.uint16[2 * t + 0] } geta_centroid_pos1(t) { return this.uint16[2 * t + 1] } } Ks(zo, "FillExtrusionCentroidArray"); const Eo = Ua([{ name: "a_pos", components: 2, type: "Int16" }], 4), Bo = Ua([{ name: "a_pos_3", components: 3, type: "Int16" }, { name: "a_pos_normal_3", components: 3, type: "Int16" }]); class Do { constructor(t = []) { this.segments = t; } _prepareSegment(t, e, r, n) { let i = this.segments[this.segments.length - 1]; return t > Do.MAX_VERTEX_ARRAY_LENGTH && q(`Max vertices per segment is ${Do.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`), (!i || i.vertexLength + t > Do.MAX_VERTEX_ARRAY_LENGTH || i.sortKey !== n) && (i = { vertexOffset: e, primitiveOffset: r, vertexLength: 0, primitiveLength: 0 }, void 0 !== n && (i.sortKey = n), this.segments.push(i)), i } prepareSegment(t, e, r, n) { return this._prepareSegment(t, e.length, r.length, n) } get() { return this.segments } destroy() { for (const t of this.segments) for (const e in t.vaos) t.vaos[e].destroy(); }
33 static simpleSegment(t, e, r, n) { return new Do([{ vertexOffset: t, primitiveOffset: e, vertexLength: r, primitiveLength: n, vaos: {}, sortKey: 0 }]) } } function Co(t, e) { return 256 * (t = k(Math.floor(t), 0, 255)) + k(Math.floor(e), 0, 255) } Do.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, Ks(Do, "SegmentVector"); const Ro = Ua([{ name: "a_pattern", components: 4, type: "Uint16" }, { name: "a_pixel_ratio", components: 1, type: "Float32" }]), Lo = Ua([{ name: "a_dash", components: 4, type: "Uint16" }]); var Vo = { exports: {} }, Oo = { exports: {} }; !function (t) { t.exports = function (t, e) { var r, n, i, s, a, o, l, u; for (n = t.length - (r = 3 & t.length), i = e, a = 3432918353, o = 461845907, u = 0; u < n;)l = 255 & t.charCodeAt(u) | (255 & t.charCodeAt(++u)) << 8 | (255 & t.charCodeAt(++u)) << 16 | (255 & t.charCodeAt(++u)) << 24, ++u, i = 27492 + (65535 & (s = 5 * (65535 & (i = (i ^= l = (65535 & (l = (l = (65535 & l) * a + (((l >>> 16) * a & 65535) << 16) & 4294967295) << 15 | l >>> 17)) * o + (((l >>> 16) * o & 65535) << 16) & 4294967295) << 13 | i >>> 19)) + ((5 * (i >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (s >>> 16) & 65535) << 16); switch (l = 0, r) { case 3: l ^= (255 & t.charCodeAt(u + 2)) << 16; case 2: l ^= (255 & t.charCodeAt(u + 1)) << 8; case 1: i ^= l = (65535 & (l = (l = (65535 & (l ^= 255 & t.charCodeAt(u))) * a + (((l >>> 16) * a & 65535) << 16) & 4294967295) << 15 | l >>> 17)) * o + (((l >>> 16) * o & 65535) << 16) & 4294967295; }return i ^= t.length, i = 2246822507 * (65535 & (i ^= i >>> 16)) + ((2246822507 * (i >>> 16) & 65535) << 16) & 4294967295, i = 3266489909 * (65535 & (i ^= i >>> 13)) + ((3266489909 * (i >>> 16) & 65535) << 16) & 4294967295, (i ^= i >>> 16) >>> 0 }; }(Oo); var Fo = Oo.exports, jo = { exports: {} }; !function (t) { t.exports = function (t, e) { for (var r, n = t.length, i = e ^ n, s = 0; n >= 4;)r = 1540483477 * (65535 & (r = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (r >>> 16) & 65535) << 16), i = 1540483477 * (65535 & i) + ((1540483477 * (i >>> 16) & 65535) << 16) ^ (r = 1540483477 * (65535 & (r ^= r >>> 24)) + ((1540483477 * (r >>> 16) & 65535) << 16)), n -= 4, ++s; switch (n) { case 3: i ^= (255 & t.charCodeAt(s + 2)) << 16; case 2: i ^= (255 & t.charCodeAt(s + 1)) << 8; case 1: i = 1540483477 * (65535 & (i ^= 255 & t.charCodeAt(s))) + ((1540483477 * (i >>> 16) & 65535) << 16); }return i = 1540483477 * (65535 & (i ^= i >>> 13)) + ((1540483477 * (i >>> 16) & 65535) << 16), (i ^= i >>> 15) >>> 0 }; }(jo); var Uo = Fo, No = jo.exports; Vo.exports = Uo, Vo.exports.murmur3 = Uo, Vo.exports.murmur2 = No; var $o = p(Vo.exports); class qo { constructor() { this.ids = [], this.uniqueIds = [], this.positions = [], this.indexed = !1; } add(t, e, r, n) { this.ids.push(Go(t)), this.positions.push(e, r, n); } eachPosition(t, e) { const r = Go(t); let n = 0, i = this.ids.length - 1; for (; n < i;) { const t = n + i >> 1; this.ids[t] >= r ? i = t : n = t + 1; } for (; this.ids[n] === r;)e(this.positions[3 * n], this.positions[3 * n + 1], this.positions[3 * n + 2]), n++; } static serialize(t, e) { const r = new Float64Array(t.ids), n = new Uint32Array(t.positions); return Yo(r, n, 0, r.length - 1), e && (e.add(r.buffer), e.add(n.buffer)), { ids: r, positions: n } } static deserialize(t) { const e = new qo; let r; e.ids = t.ids, e.positions = t.positions; for (const t of e.ids) t !== r && e.uniqueIds.push(t), r = t; return e.indexed = !0, e } } function Go(t) { const e = +t; return !isNaN(e) && Number.MIN_SAFE_INTEGER <= e && e <= Number.MAX_SAFE_INTEGER ? e : $o(String(t)) } function Yo(t, e, r, n) { for (; r < n;) { const i = t[r + n >> 1]; let s = r - 1, a = n + 1; for (; ;) { do { s++; } while (t[s] < i); do { a--; } while (t[a] > i); if (s >= a) break; Zo(t, s, a), Zo(e, 3 * s, 3 * a), Zo(e, 3 * s + 1, 3 * a + 1), Zo(e, 3 * s + 2, 3 * a + 2); } a - r < n - a ? (Yo(t, e, r, a), r = a + 1) : (Yo(t, e, a + 1, n), n = a); } } function Zo(t, e, r) { const n = t[e]; t[e] = t[r], t[r] = n; } Ks(qo, "FeaturePositionMap"); class Xo { 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 Ko extends Xo { constructor(t) { super(t), this.current = 0; }
33 set(t, e, r) { this.fetchUniformLocation(t, e) && this.current !== r && (this.current = r, this.gl.uniform1i(this.location, r)); } } class Wo extends Xo { constructor(t) { super(t), this.current = 0; } set(t, e, r) { this.fetchUniformLocation(t, e) && this.current !== r && (this.current = r, this.gl.uniform1f(this.location, r)); } } class Ho extends Xo { constructor(t) { super(t), this.current = [0, 0]; } set(t, e, r) { this.fetchUniformLocation(t, e) && (r[0] === this.current[0] && r[1] === this.current[1] || (this.current = r, this.gl.uniform2f(this.location, r[0], r[1]))); } } class Jo extends Xo { constructor(t) { super(t), this.current = [0, 0, 0]; } set(t, e, r) { this.fetchUniformLocation(t, e) && (r[0] === this.current[0] && r[1] === this.current[1] && r[2] === this.current[2] || (this.current = r, this.gl.uniform3f(this.location, r[0], r[1], r[2]))); } } class Qo extends Xo { constructor(t) { super(t), this.current = [0, 0, 0, 0]; } set(t, e, r) { this.fetchUniformLocation(t, e) && (r[0] === this.current[0] && r[1] === this.current[1] && r[2] === this.current[2] && r[3] === this.current[3] || (this.current = r, this.gl.uniform4f(this.location, r[0], r[1], r[2], r[3]))); } } class tl extends Xo { constructor(t) { super(t), this.current = Re.transparent; } set(t, e, r) { this.fetchUniformLocation(t, e) && (r.r === this.current.r && r.g === this.current.g && r.b === this.current.b && r.a === this.current.a || (this.current = r, this.gl.uniform4f(this.location, r.r, r.g, r.b, r.a))); } } const el = new Float32Array(16); class rl extends Xo { constructor(t) { super(t), this.current = el; } set(t, e, r) { if (this.fetchUniformLocation(t, e)) { if (r[12] !== this.current[12] || r[0] !== this.current[0]) return this.current = r, void this.gl.uniformMatrix4fv(this.location, !1, r); for (let t = 1; t < 16; t++)if (r[t] !== this.current[t]) { this.current = r, this.gl.uniformMatrix4fv(this.location, !1, r); break } } } } const nl = new Float32Array(9), il = new Float32Array(4); class sl extends Xo { constructor(t) { super(t), this.current = il; } set(t, e, r) { if (this.fetchUniformLocation(t, e)) for (let t = 0; t < 4; t++)if (r[t] !== this.current[t]) { this.current = r, this.gl.uniformMatrix2fv(this.location, !1, r); break } } } function al(t) { return [Co(255 * t.r, 255 * t.g), Co(255 * t.b, 255 * t.a)] } class ol { constructor(t, e, r) { this.value = t, this.uniformNames = e.map((t => `u_${t}`)), this.type = r; } setUniform(t, e, r, n, i) { e.set(t, i, n.constantOr(this.value)); } getBinding(t, e) { return "color" === this.type ? new tl(t) : new Wo(t) } } class ll { constructor(t, e) { this.uniformNames = e.map((t => `u_${t}`)), this.pattern = null, this.pixelRatio = 1; } setConstantPatternPositions(t) { this.pixelRatio = t.pixelRatio || 1, this.pattern = t.tl.concat(t.br); } setUniform(t, e, r, n, i) { const s = "u_pattern" === i || "u_dash" === i ? this.pattern : "u_pixel_ratio" === i ? this.pixelRatio : null; s && e.set(t, i, s); } getBinding(t, e) { return "u_pattern" === e || "u_dash" === e ? new Qo(t) : new Wo(t) } } class ul { constructor(t, e, r, n) { this.expression = t, this.type = r, this.maxValue = 0, this.paintVertexAttributes = e.map((t => ({ name: `a_${t}`, type: "Float32", components: "color" === r ? 2 : 1, offset: 0 }))), this.paintVertexArray = new n; } populatePaintArray(t, e, r, n, i, s, a) { const o = this.paintVertexArray.length, l = this.expression.evaluate(new _a(0, { brightness: s }), e, {}, i, n, a); this.paintVertexArray.resize(t), this._setPaintValue(o, t, l); } updatePaintArray(t, e, r, n, i, s, a) { const o = this.expression.evaluate({ zoom: 0, brightness: a }, r, n, void 0, i); this._setPaintValue(t, e, o); } _setPaintValue(t, e, r) { if ("color" === this.type) { const n = al(r); for (let r = t; r < e; r++)this.paintVertexArray.emplace(r, n[0], n[1]); } else { for (let n = t; n < e; n++)this.paintVertexArray.emplace(n, r); this.maxValue = Math.max(this.maxValue, 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 || !this.expression.isLightConstant)); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); } } class cl { constructor(t, e, r, n, i, s) { this.expression = t, this.uniformNames = e.map((t => `u_${t}_t`)), this.type = r, this.useIntegerZoom = n, this.zoom = i, this.maxValue = 0, this.paintVertexAttributes = e.map((t => ({ name: `a_${t}
33`, type: "Float32", components: "color" === r ? 4 : 2, offset: 0 }))), this.paintVertexArray = new s; } populatePaintArray(t, e, r, n, i, s, a) { const o = this.expression.evaluate(new _a(this.zoom, { brightness: s }), e, {}, i, n, a), l = this.expression.evaluate(new _a(this.zoom + 1, { brightness: s }), e, {}, i, n, a), u = this.paintVertexArray.length; this.paintVertexArray.resize(t), this._setPaintValue(u, t, o, l); } updatePaintArray(t, e, r, n, i, s, a) { const o = this.expression.evaluate({ zoom: this.zoom, brightness: a }, r, n, void 0, i), l = this.expression.evaluate({ zoom: this.zoom + 1, brightness: a }, r, n, void 0, i); this._setPaintValue(t, e, o, l); } _setPaintValue(t, e, r, n) { if ("color" === this.type) { const i = al(r), s = al(n); for (let r = t; r < e; r++)this.paintVertexArray.emplace(r, i[0], i[1], s[0], s[1]); } else { for (let i = t; i < e; i++)this.paintVertexArray.emplace(i, r, n); this.maxValue = Math.max(this.maxValue, Math.abs(r), Math.abs(n)); } } 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 || !this.expression.isLightConstant)); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); } setUniform(t, e, r, n, i) { const s = this.useIntegerZoom ? Math.floor(r.zoom) : r.zoom, a = k(this.expression.interpolationFactor(s, this.zoom, this.zoom + 1), 0, 1); e.set(t, i, a); } getBinding(t, e) { return new Wo(t) } } class hl { constructor(t, e, r, n, i) { this.expression = t, this.layerId = i, this.paintVertexAttributes = ("array" === r ? Lo : Ro).members; for (let t = 0; t < e.length; ++t); this.paintVertexArray = new n; } populatePaintArray(t, e, r) { const n = this.paintVertexArray.length; this.paintVertexArray.resize(t), this._setPaintValues(n, t, e.patterns && e.patterns[this.layerId], r); } updatePaintArray(t, e, r, n, i, s, a) { this._setPaintValues(t, e, r.patterns && r.patterns[this.layerId], s); } _setPaintValues(t, e, r, n) { if (!n || !r) return; const i = n[r]; if (!i) return; const { tl: s, br: a, pixelRatio: o } = i; for (let r = t; r < e; r++)this.paintVertexArray.emplace(r, s[0], s[1], a[0], a[1], o); } upload(t) { this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer = t.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent || !this.expression.isLightConstant)); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); } } class pl { constructor(t, e, r = (() => !0)) { this.binders = {}, this._buffers = []; const n = []; for (const i in t.paint._values) { const s = t.paint.get(i); if (!r(i)) continue; if (!(s instanceof Ta && Ci(s.property.specification))) continue; const a = ml(i, t.type), o = s.value, l = s.property.specification.type, u = !!s.property.useIntegerZoom, c = "line-dasharray" === i || i.endsWith("pattern"), h = "line-dasharray" === i && "constant" !== t.layout.get("line-cap").value.kind; if ("constant" !== o.kind || h) if ("source" === o.kind || h || c) { const e = xl(i, l, "source"); this.binders[i] = c ? new hl(o, a, l, e, t.id) : new ul(o, a, l, e), n.push(`/a_${i}`); } else { const t = xl(i, l, "composite"); this.binders[i] = new cl(o, a, l, u, e, t), n.push(`/z_${i}`); } else this.binders[i] = c ? new ll(o.value, a) : new ol(o.value, a, l), n.push(`/u_${i}`); } this.cacheKey = n.sort().join(""); } getMaxValue(t) { const e = this.binders[t]; return e instanceof ul || e instanceof cl ? e.maxValue : 0 } populatePaintArrays(t, e, r, n, i, s, a) { for (const o in this.binders) { const l = this.binders[o]; (l instanceof ul || l instanceof cl || l instanceof hl) && l.populatePaintArray(t, e, r, n, i, s, a); } } setConstantPatternPositions(t) { for (const e in this.binders) { const r = this.binders[e]; r instanceof ll && r.setConstantPatternPositions(t); } } updatePaintArrays(t, e, r, n, i, s, a, o) { let l = !1;
33 const u = Object.keys(t), c = 0 !== u.length, h = c ? u : e.uniqueIds; for (const u in this.binders) { const p = this.binders[u]; if ((p instanceof ul || p instanceof cl || p instanceof hl) && (!0 === p.expression.isStateDependent || !1 === p.expression.isLightConstant)) { const f = i.paint.get(u); p.expression = f.value; for (const r of h) { const i = t[r.toString()]; e.eachPosition(r, ((t, e, r) => { const l = n.feature(t); p.updatePaintArray(e, r, l, i, s, a, o); })); } if (!c) for (const e of r.uniqueIds) { const i = t[e.toString()]; r.eachPosition(e, ((t, e, r) => { const l = n.feature(t); p.updatePaintArray(e, r, l, i, s, a, o); })); } l = !0; } } return l } defines() { const t = []; for (const e in this.binders) { const r = this.binders[e]; (r instanceof ol || r instanceof ll) && t.push(...r.uniformNames.map((t => `#define HAS_UNIFORM_${t}`))); } return t } getBinderAttributes() { const t = []; for (const e in this.binders) { const r = this.binders[e]; if (r instanceof ul || r instanceof cl || r instanceof hl) for (let e = 0; e < r.paintVertexAttributes.length; e++)t.push(r.paintVertexAttributes[e].name); } return t } getBinderUniforms() { const t = []; for (const e in this.binders) { const r = this.binders[e]; if (r instanceof ol || r instanceof ll || r instanceof cl) for (const e of r.uniformNames) t.push(e); } return t } getPaintVertexBuffers() { return this._buffers } getUniforms(t) { const e = []; for (const r in this.binders) { const n = this.binders[r]; if (n instanceof ol || n instanceof ll || n instanceof cl) for (const i of n.uniformNames) e.push({ name: i, property: r, binding: n.getBinding(t, i) }); } return e } setUniforms(t, e, r, n, i) { for (const { name: e, property: s, binding: a } of r) this.binders[s].setUniform(t, a, i, n.get(s), e); } updatePaintBuffers() { this._buffers = []; for (const t in this.binders) { const e = this.binders[t]; (e instanceof ul || e instanceof cl || e instanceof hl) && e.paintVertexBuffer && this._buffers.push(e.paintVertexBuffer); } } upload(t) { for (const e in this.binders) { const r = this.binders[e]; (r instanceof ul || r instanceof cl || r instanceof hl) && r.upload(t); } this.updatePaintBuffers(); } destroy() { for (const t in this.binders) { const e = this.binders[t]; (e instanceof ul || e instanceof cl || e instanceof hl) && e.destroy(); } } } class fl { constructor(t, e, r = (() => !0)) { this.programConfigurations = {}; for (const n of t) this.programConfigurations[n.id] = new pl(n, e, r); this.needsUpload = !1, this._featureMap = new qo, this._featureMapWithoutIds = new qo, this._bufferOffset = 0, this._idlessCounter = 0; } populatePaintArrays(t, e, r, n, i, s, a, o) { for (const r in this.programConfigurations) this.programConfigurations[r].populatePaintArrays(t, e, n, i, s, a, o); void 0 !== e.id ? this._featureMap.add(e.id, r, this._bufferOffset, t) : (this._featureMapWithoutIds.add(this._idlessCounter, r, this._bufferOffset, t), this._idlessCounter += 1), this._bufferOffset = t, this.needsUpload = !0; } updatePaintArrays(t, e, r, n, i, s) { for (const a of r) this.needsUpload = this.programConfigurations[a.id].updatePaintArrays(t, this._featureMap, this._featureMapWithoutIds, e, a, n, i, s || 0) || 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 dl = { "text-opacity": ["opacity"], "icon-opacity": ["opacity"], "text-color": ["fill_color"], "icon-color": ["fill_color"], "text-emissive-strength": ["emissive_strength"], "icon-emissive-strength": ["emissive_strength"], "text-halo-color": ["halo_color"], "icon-halo-color": ["halo_color"], "text-halo-blur": ["halo_blur"], "icon-halo-blur": ["halo_blur"], "text-halo-width": ["halo_width"], "icon-halo-width": ["halo_width"], "line-gap-width": ["gapwidth"], "line-pattern": ["pattern", "pixel_ratio"], "fill-pattern": ["pattern", "pixel_ratio"], "fill-extrusion-pattern": ["pattern", "pixel_ratio"], "line-dasharray": ["dash"] }; function ml(t, e) { return dl[t] || [t.replace(`${e}-`, "").replace(/-/g, "_")] } const yl = { "line-pattern": { source: Ka, composite: Ka }, "fill-pattern": { source: Ka, composite: Ka }, "fill-extrusion-pattern": { source: Ka, composite: Ka }, "line-dasharray": { source: Wa, composite: Wa } }, gl = { color: { source: yo, composite: Xa }, number: { source: uo, composite: yo } }; function xl(t, e, r) { const n = yl[t]; return n && n[r] || gl[e][r] } Ks(ol, "ConstantBinder"), Ks(ll, "PatternConstantBinder"), Ks(ul, "SourceExpressionBinder"), Ks(hl, "PatternCompositeBinder"), Ks(cl, "CompositeExpressionBinder"), Ks(pl, "ProgramConfiguration", { omit: ["_buffers"] }), Ks(fl, "ProgramConfigurationSet");
vendor: 1,179 bytes, line 33
33 class vl { 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 Zh ? new Zh(t.lng, t.lat) : Zh.convert(t), this } setSouthWest(t) { return this._sw = t instanceof Zh ? new Zh(t.lng, t.lat) : Zh.convert(t), this } extend(t) { const e = this._sw, r = this._ne; let n, i; if (t instanceof Zh) n = t, i = t; else { if (!(t instanceof vl)) return Array.isArray(t) ? 4 === t.length || t.every(Array.isArray) ? this.extend(vl.convert(t)) : this.extend(Zh.convert(t)) : "object" == typeof t && null !== t && t.hasOwnProperty("lat") && (t.hasOwnProperty("lon") || t.hasOwnProperty("lng")) ? this.extend(Zh.convert(t)) : this; if (n = t._sw, i = t._ne, !n || !i) return this } return e || r ? (e.lng = Math.min(n.lng, e.lng), e.lat = Math.min(n.lat, e.lat), r.lng = Math.max(i.lng, r.lng), r.lat = Math.max(i.lat, r.lat)) : (this._sw = new Zh(n.lng, n.lat), this._ne = new Zh(i.lng, i.lat)), this } getCenter() { return new Zh((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2) }
33 getSouthWest() { return this._sw } getNorthEast() { return this._ne } getNorthWest() { return new Zh(this.getWest(), this.getNorth()) } getSouthEast() { return new Zh(this.getEast(), this.getSouth()) } getWest() { return this._sw.lng } getSouth() { return this._sw.lat } getEast() { return this._ne.lng } getNorth() { return this._ne.lat } toArray() { return [this._sw.toArray(), this._ne.toArray()] } toString() { return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})` } isEmpty() { return !(this._sw && this._ne) } contains(t) { const { lng: e, lat: r } = Zh.convert(t); let n = this._sw.lng <= e && e <= this._ne.lng; return this._sw.lng > this._ne.lng && (n = this._sw.lng >= e && e >= this._ne.lng), this._sw.lat <= r && r <= this._ne.lat && n } static convert(t) { return !t || t instanceof vl ? t : new vl(t) } } var bl = {}, _l = {}; Object.defineProperty(_l, "__esModule", { value: !0 }), _l.setMatrixArrayType = function (t) { _l.ARRAY_TYPE = Ml = t; }, _l.toRadian = function (t) { return t * Sl }, _l.equals = function (t, e) { return Math.abs(t - e) <= wl * Math.max(1, Math.abs(t), Math.abs(e)) }, _l.RANDOM = _l.ARRAY_TYPE = _l.EPSILON = void 0; var wl = 1e-6; _l.EPSILON = wl; var Ml = "undefined" != typeof Float32Array ? Float32Array : Array; _l.ARRAY_TYPE = Ml; var Al = Math.random; _l.RANDOM = Al; var Sl = Math.PI / 180; Math.hypot || (Math.hypot = function () { for (var t = 0, e = arguments.length; e--;)t += arguments[e] * arguments[e]; return Math.sqrt(t) }); var Il = {}; function kl(t) { return kl = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, kl(t) } Object.defineProperty(Il, "__esModule", { value: !0 }), Il.create = function () { var t = new Tl.ARRAY_TYPE(4); return Tl.ARRAY_TYPE != Float32Array && (t[1] = 0, t[2] = 0), t[0] = 1, t[3] = 1, t }, Il.clone = function (t) { var e = new Tl.ARRAY_TYPE(4); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e }, Il.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t }, Il.identity = function (t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t }, Il.fromValues = function (t, e, r, n) { var i = new Tl.ARRAY_TYPE(4); return i[0] = t, i[1] = e, i[2] = r, i[3] = n, i }, Il.set = function (t, e, r, n, i) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t }, Il.transpose = function (t, e) { if (t === e) { var r = e[1]; t[1] = e[2], t[2] = r; } else t[0] = e[0], t[1] = e[2], t[2] = e[1], t[3] = e[3]; return t }, Il.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = r * s - i * n; return a ? (t[0] = s * (a = 1 / a), t[1] = -n * a, t[2] = -i * a, t[3] = r * a, t) : null }, Il.adjoint = function (t, e) { var r = e[0]; return t[0] = e[3], t[1] = -e[1], t[2] = -e[2], t[3] = r, t }, Il.determinant = function (t) { return t[0] * t[3] - t[2] * t[1] }, Il.multiply = zl, Il.rotate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = Math.sin(r), l = Math.cos(r); return t[0] = n * l + s * o, t[1] = i * l + a * o, t[2] = n * -o + s * l, t[3] = i * -o + a * l, t }, Il.scale = function (t, e, r) { var n = e[1], i = e[2], s = e[3], a = r[0], o = r[1]; return t[0] = e[0] * a, t[1] = n * a, t[2] = i * o, t[3] = s * o, t }, Il.fromRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = -r, t[3] = n, t }, Il.fromScaling = function (t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = e[1], t }, Il.str = function (t) { return "mat2(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" }, Il.frob = function (t) { return Math.hypot(t[0], t[1], t[2], t[3]) }, Il.LDU = function (t, e, r, n) { return t[2] = n[2] / n[0], r[0] = n[0], r[1] = n[1], r[3] = n[3] - t[2] * r[1], [t, e, r] }, Il.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t }, Il.subtract = El, Il.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] }, Il.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = e[0], o = e[1], l = e[2], u = e[3]; return Math.abs(r - a) <= Tl.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)
33) && Math.abs(n - o) <= Tl.EPSILON * Math.max(1, Math.abs(n), Math.abs(o)) && Math.abs(i - l) <= Tl.EPSILON * Math.max(1, Math.abs(i), Math.abs(l)) && Math.abs(s - u) <= Tl.EPSILON * Math.max(1, Math.abs(s), Math.abs(u)) }, Il.multiplyScalar = function (t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t }, Il.multiplyScalarAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t }, Il.sub = Il.mul = void 0; var Tl = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== kl(t) && "function" != typeof t) return { default: t }; var r = Pl(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function Pl(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Pl = function (t) { return t ? r : e })(t) } function zl(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = r[0], l = r[1], u = r[2], c = r[3]; return t[0] = n * o + s * l, t[1] = i * o + a * l, t[2] = n * u + s * c, t[3] = i * u + a * c, t } function El(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t } Il.mul = zl, Il.sub = El; var Bl = {}; function Dl(t) { return Dl = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, Dl(t) } Object.defineProperty(Bl, "__esModule", { value: !0 }), Bl.create = function () { var t = new Cl.ARRAY_TYPE(6); return Cl.ARRAY_TYPE != Float32Array && (t[1] = 0, t[2] = 0, t[4] = 0, t[5] = 0), t[0] = 1, t[3] = 1, t }, Bl.clone = function (t) { var e = new Cl.ARRAY_TYPE(6); 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 }, Bl.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t }, Bl.identity = function (t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = 0, t[5] = 0, t }, Bl.fromValues = function (t, e, r, n, i, s) { var a = new Cl.ARRAY_TYPE(6); return a[0] = t, a[1] = e, a[2] = r, a[3] = n, a[4] = i, a[5] = s, a }, Bl.set = function (t, e, r, n, i, s, a) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = s, t[5] = a, t }, Bl.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = r * s - n * i; return l ? (t[0] = s * (l = 1 / l), t[1] = -n * l, t[2] = -i * l, t[3] = r * l, t[4] = (i * o - s * a) * l, t[5] = (n * a - r * o) * l, t) : null }, Bl.determinant = function (t) { return t[0] * t[3] - t[1] * t[2] }, Bl.multiply = Ll, Bl.rotate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = Math.sin(r), c = Math.cos(r); return t[0] = n * c + s * u, t[1] = i * c + a * u, t[2] = n * -u + s * c, t[3] = i * -u + a * c, t[4] = o, t[5] = l, t }, Bl.scale = function (t, e, r) { var n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = r[0], u = r[1]; return t[0] = e[0] * l, t[1] = n * l, t[2] = i * u, t[3] = s * u, t[4] = a, t[5] = o, t }, Bl.translate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = r[0], c = r[1]; return t[0] = n, t[1] = i, t[2] = s, t[3] = a, t[4] = n * u + s * c + o, t[5] = i * u + a * c + l, t }, Bl.fromRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = -r, t[3] = n, t[4] = 0, t[5] = 0, t }, Bl.fromScaling = function (t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = e[1], t[4] = 0, t[5] = 0, t }, Bl.fromTranslation = function (t, e) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = e[0], t[5] = e[1], t }, Bl.str = function (t) { return "mat2d(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ")" }, Bl.frob = function (t) { return Math.hypot(t[0], t[1], t[2], t[3], t[4], t[5], 1) }, Bl.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t }, Bl.subtract = Vl, Bl.multiplyScalar = function (t, e, r) { 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] * r, t[5] = e[5] * r, t }, Bl.multiplyScalarAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t }, Bl.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] }, Bl.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], l = e[0], u = e[1], c = e[2], h = e[3], p = e[4], f = e[5]; return Math.abs(r - l) <= Cl.EPSILON * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(n - u) <= Cl.EPSILON * Math.max(1, Math.abs(n), Math.abs(u)) && Math.abs(i - c) <= Cl.EPSILON * Math.max(1, Math.abs(i), Math.abs(c)) && Math.abs(s - h) <= Cl.EPSILON * Math.max(1, Math.abs(s), Math.abs(h)) && Math.abs(a - p) <= Cl.EPSILON * Math.max(1, Math.abs(a), Math.abs(p)) && Math.abs(o - f) <= Cl.EPSILON * Math.max(1, Math.abs(o), Math.abs(f)) }, Bl.sub = Bl.mul = void 0; var Cl = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== Dl(t) && "function" != typeof t) return { default: t }; var r = Rl(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor;
33 for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function Rl(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Rl = function (t) { return t ? r : e })(t) } function Ll(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = r[0], c = r[1], h = r[2], p = r[3], f = r[4], d = r[5]; return t[0] = n * u + s * c, t[1] = i * u + a * c, t[2] = n * h + s * p, t[3] = i * h + a * p, t[4] = n * f + s * d + o, t[5] = i * f + a * d + l, t } function Vl(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t } Bl.mul = Ll, Bl.sub = Vl; var Ol = {}; function Fl(t) { return Fl = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, Fl(t) } Object.defineProperty(Ol, "__esModule", { value: !0 }), Ol.create = function () { var t = new jl.ARRAY_TYPE(9); return jl.ARRAY_TYPE != 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 }, Ol.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 }, Ol.clone = function (t) { var e = new jl.ARRAY_TYPE(9); 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 }, Ol.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t }, Ol.fromValues = function (t, e, r, n, i, s, a, o, l) { var u = new jl.ARRAY_TYPE(9); return u[0] = t, u[1] = e, u[2] = r, u[3] = n, u[4] = i, u[5] = s, u[6] = a, u[7] = o, u[8] = l, u }, Ol.set = function (t, e, r, n, i, s, a, o, l, u) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = s, t[5] = a, t[6] = o, t[7] = l, t[8] = u, t }, Ol.identity = function (t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t }, Ol.transpose = function (t, e) { if (t === e) { var r = e[1], n = e[2], i = e[5]; t[1] = e[3], t[2] = e[6], t[3] = r, t[5] = e[7], t[6] = n, t[7] = i; } 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 }, Ol.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = e[6], u = e[7], c = e[8], h = c * a - o * u, p = -c * s + o * l, f = u * s - a * l, d = r * h + n * p + i * f; return d ? (t[0] = h * (d = 1 / d), t[1] = (-c * n + i * u) * d, t[2] = (o * n - i * a) * d, t[3] = p * d, t[4] = (c * r - i * l) * d, t[5] = (-o * r + i * s) * d, t[6] = f * d, t[7] = (-u * r + n * l) * d, t[8] = (a * r - n * s) * d, t) : null }, Ol.adjoint = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = e[6], u = e[7], c = e[8]; return t[0] = a * c - o * u, t[1] = i * u - n * c, t[2] = n * o - i * a, t[3] = o * l - s * c, t[4] = r * c - i * l, t[5] = i * s - r * o, t[6] = s * u - a * l, t[7] = n * l - r * u, t[8] = r * a - n * s, t }, Ol.determinant = function (t) { var e = t[3], r = t[4], n = t[5], i = t[6], s = t[7], a = t[8]; return t[0] * (a * r - n * s) + t[1] * (-a * e + n * i) + t[2] * (s * e - r * i) }, Ol.multiply = Nl, Ol.translate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = e[8], p = r[0], f = r[1]; return t[0] = n, t[1] = i, t[2] = s, t[3] = a, t[4] = o, t[5] = l, t[6] = p * n + f * a + u, t[7] = p * i + f * o + c, t[8] = p * s + f * l + h, t }, Ol.rotate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = e[8], p = Math.sin(r), f = Math.
vendor: 21,114 bytes, line 33
33cos(r); return t[0] = f * n + p * a, t[1] = f * i + p * o, t[2] = f * s + p * l, t[3] = f * a - p * n, t[4] = f * o - p * i, t[5] = f * l - p * s, t[6] = u, t[7] = c, t[8] = h, t }, Ol.scale = function (t, e, r) { var n = r[0], i = r[1]; return t[0] = n * e[0], t[1] = n * e[1], t[2] = n * e[2], t[3] = i * e[3], t[4] = i * e[4], t[5] = i * e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t }, Ol.fromTranslation = function (t, e) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = e[0], t[7] = e[1], t[8] = 1, t }, Ol.fromRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = -r, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t }, Ol.fromScaling = function (t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e[1], t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t }, Ol.fromMat2d = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = 0, t[3] = e[2], t[4] = e[3], t[5] = 0, t[6] = e[4], t[7] = e[5], t[8] = 1, t }, Ol.fromQuat = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = r + r, o = n + n, l = i + i, u = r * a, c = n * a, h = n * o, p = i * a, f = i * o, d = i * l, m = s * a, y = s * o, g = s * l; return t[0] = 1 - h - d, t[3] = c - g, t[6] = p + y, t[1] = c + g, t[4] = 1 - u - d, t[7] = f - m, t[2] = p - y, t[5] = f + m, t[8] = 1 - u - h, t }, Ol.normalFromMat4 = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = e[6], u = e[7], c = e[8], h = e[9], p = e[10], f = e[11], d = e[12], m = e[13], y = e[14], g = e[15], x = r * o - n * a, v = r * l - i * a, b = r * u - s * a, _ = n * l - i * o, w = n * u - s * o, M = i * u - s * l, A = c * m - h * d, S = c * y - p * d, I = c * g - f * d, k = h * y - p * m, T = h * g - f * m, P = p * g - f * y, z = x * P - v * T + b * k + _ * I - w * S + M * A; return z ? (t[0] = (o * P - l * T + u * k) * (z = 1 / z), t[1] = (l * I - a * P - u * S) * z, t[2] = (a * T - o * I + u * A) * z, t[3] = (i * T - n * P - s * k) * z, t[4] = (r * P - i * I + s * S) * z, t[5] = (n * I - r * T - s * A) * z, t[6] = (m * M - y * w + g * _) * z, t[7] = (y * b - d * M - g * v) * z, t[8] = (d * w - m * b + g * x) * z, t) : null }, Ol.projection = function (t, e, r) { return t[0] = 2 / e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = -2 / r, t[5] = 0, t[6] = -1, t[7] = 1, t[8] = 1, t }, Ol.str = function (t) { return "mat3(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ")" }, Ol.frob = function (t) { return Math.hypot(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8]) }, Ol.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t[8] = e[8] + r[8], t }, Ol.subtract = $l, Ol.multiplyScalar = function (t, e, r) { 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] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t[8] = e[8] * r, t }, Ol.multiplyScalarAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t[6] = e[6] + r[6] * n, t[7] = e[7] + r[7] * n, t[8] = e[8] + r[8] * n, t }, Ol.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] && t[8] === e[8] }, Ol.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], l = t[6], u = t[7], c = t[8], h = e[0], p = e[1], f = e[2], d = e[3], m = e[4], y = e[5], g = e[6], x = e[7], v = e[8]; return Math.abs(r - h) <= jl.EPSILON * Math.max(1, Math.abs(r), Math.abs(h)) && Math.abs(n - p) <= jl.EPSILON * Math.max(1, Math.abs(n), Math.abs(p)) && Math.abs(i - f) <= jl.EPSILON * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(s - d) <= jl.EPSILON * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(a - m) <= jl.EPSILON * Math.max(1, Math.abs(a), Math.abs(m)) && Math.abs(o - y) <= jl.EPSILON * Math.max(1, Math.abs(o), Math.abs(y)) && Math.abs(l - g) <= jl.EPSILON * Math.max(1, Math.abs(l), Math.abs(g)) && Math.abs(u - x) <= jl.EPSILON * Math.max(1, Math.abs(u), Math.abs(x)) && Math.abs(c - v) <= jl.EPSILON * Math.max(1, Math.abs(c), Math.abs(v)) }, Ol.sub = Ol.mul = void 0; var jl = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== Fl(t) && "function" != typeof t) return { default: t }; var r = Ul(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function Ul(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Ul = function (t) { return t ? r : e })(t) } function Nl(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = e[8], p = r[0], f = r[1], d = r[2], m = r[3], y = r[4], g = r[5], x = r[6], v = r[7], b = r[8]; return t[0] = p * n + f * a + d * u, t[1] = p * i + f * o + d * c, t[2] = p * s + f * l + d * h, t[3] = m * n + y * a + g * u, t[4] = m * i + y * o + g * c, t[5] = m * s + y * l + g * h, t[6] = x * n + v * a + b * u, t[7] = x * i + v * o + b * c, t[8] = x * s + v * l + b * h, t } function $l(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t[6] = e[6] - r[6], t[7] = e[7] - r[7], t[8] = e[8] - r[8], t } Ol.mul = Nl, Ol.sub = $l; var ql = {}; function Gl(t) { return Gl = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, Gl(t) } Object.defineProperty(ql, "__esModule", { value: !0 }), ql.create = function () { var t = new Yl.ARRAY_TYPE(16); return Yl.ARRAY_TYPE != 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 }, ql.clone = function (t) { var e = new Yl.ARRAY_TYPE(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 }, ql.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t }, ql.fromValues = function (t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m) { var y = new Yl.ARRAY_TYPE(16); return y[0] = t, y[1] = e, y[2] = r, y[3] = n, y[4] = i, y[5] = s, y[6] = a, y[7] = o, y[8] = l, y[9] = u, y[10] = c, y[11] = h, y[12] = p, y[13] = f, y[14] = d, y[15] = m, y }, ql.set = function (t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = s, t[5] = a, t[6] = o, t[7] = l, t[8] = u, t[9] = c, t[10] = h, t[11] = p, t[12] = f, t[13] = d, t[14] = m, t[15] = y, t }, ql.identity = Xl, ql.transpose = function (t, e) { if (t === e) { var r = e[1], n = e[2], i = e[3], s = e[6], a = e[7], o = e[11]; t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = r, t[6] = e[9], t[7] = e[13], t[8] = n, t[9] = s, t[11] = e[14], t[12] = i, t[13] = a, t[14] = o; } else t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = e[1], t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = e[2], t[9] = e[6], t[10] = e[10], t[11] = e[14], t[12] = e[3], t[13] = e[7], t[14] = e[11], t[15] = e[15]; return t }, ql.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = e[6], u = e[7], c = e[8], h = e[9], p = e[10], f = e[11], d = e[12], m = e[13], y = e[14], g = e[15], x = r * o - n * a, v = r * l - i * a, b = r * u - s * a, _ = n * l - i * o, w = n * u - s * o, M = i * u - s * l, A = c * m - h * d, S = c * y - p * d, I = c * g - f * d, k = h * y - p * m, T = h * g - f * m, P = p * g - f * y, z = x * P - v * T + b * k + _ * I - w * S + M * A; return z ? (t[0] = (o * P - l * T + u * k) * (z = 1 / z), t[1] = (i * T - n * P - s * k) * z, t[2] = (m * M - y * w + g * _) * z, t[3] = (p * w - h * M - f * _) * z, t[4] = (l * I - a * P - u * S) * z, t[5] = (r * P - i * I + s * S) * z, t[6] = (y * b - d * M - g * v) * z, t[7] = (c * M - p * b + f * v) * z, t[8] = (a * T - o * I + u * A) * z, t[9] = (n * I - r * T - s * A) * z, t[10] = (d * w - m * b + g * x) * z, t[11] = (h * b - c * w - f * x) * z, t[12] = (o * S - a * k - l * A) * z, t[13] = (r * k - n * S + i * A) * z, t[14] = (m * v - d * _ - y * x) * z, t[15] = (c * _ - h * v + p * x) * z, t) : null }, ql.adjoint = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = e[4], o = e[5], l = e[6], u = e[7], c = e[8], h = e[9], p = e[10], f = e[11], d = e[12], m = e[13], y = e[14], g = e[15]; return t[0] = o * (p * g - f * y) - h * (l * g - u * y) + m * (l * f - u * p), t[1] = -(n * (p * g - f * y) - h * (i * g - s * y) + m * (i * f - s * p)), t[2] = n * (l * g - u * y) - o * (i * g - s * y) + m * (i * u - s * l), t[3] = -(n * (l * f - u * p) - o * (i * f - s * p) + h * (i * u - s * l)), t[4] = -(a * (p * g - f * y) - c * (l * g - u * y) + d * (l * f - u * p)), t[5] = r * (p * g - f * y) - c * (i * g - s * y) + d * (i * f - s * p), t[6] = -(r * (l * g - u * y) - a * (i * g - s * y) + d * (i * u - s * l)), t[7] = r * (l * f - u * p) - a * (i * f - s * p) + c * (i * u - s * l), t[8] = a * (h * g - f * m) - c * (o * g - u * m) + d * (o * f - u * h), t[9] = -(r * (h * g - f * m) - c * (n * g - s * m) + d * (n * f - s * h)), t[10] = r * (o * g - u * m) - a * (n * g - s * m) + d * (n * u - s * o), t[11] = -(r * (o * f - u * h) - a * (n * f - s * h) + c * (n * u - s * o)), t[12] = -(a * (h * y - p * m) - c * (o * y - l * m) + d * (o * p - l * h)), t[13] = r * (h * y - p * m) - c * (n * y - i * m) + d * (n * p - i * h), t[14] = -(r * (o * y - l * m) - a * (n * y - i * m) + d * (n * l - i * o)), t[15] = r * (o * p - l * h) - a * (n * p - i * h) + c * (n * l - i * o), t }, ql.determinant = function (t) { var e = t[0], r = t[1], n = t[2], i = t[3], s = t[4], a = t[5], o = t[6], l = t[7], u = t[8], c = t[9], h = t[10], p = t[11], f = t[12], d = t[13], m = t[14], y = t[15]; return (e * a - r * s) * (h * y - p * m) - (e * o - n * s) * (c * y - p * d) + (e * l - i * s) * (c * m - h * d) + (r * o - n * a) * (u * y - p * f) - (r * l - i * a) * (u * m - h * f) + (n * l - i * o) * (u * d - c * f) }, ql.multiply = Kl, ql.translate = function (t, e, r) { var n, i, s, a, o, l, u, c, h, p, f, d, m = r[0], y = r[1], g = r[2]; return e === t ? (t[12] = e[0] * m + e[4] * y + e[8] * g + e[12], t[13] = e[1] * m + e[5] * y + e[9] * g + e[13], t[14] = e[2] * m + e[6] * y + e[10] * g + e[14], t[15] = e[3] * m + e[7] * y + e[11] * g + e[15]) : (i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = e[8], p = e[9], f = e[10], d = e[11], t[0] = n = e[0], t[1] = i, t[2] = s, t[3] = a, t[4] = o, t[5] = l, t[6] = u, t[7] = c, t[8] = h, t[9] = p, t[10] = f, t[11] = d, t[12] = n * m + o * y + h * g + e[12], t[13] = i * m + l * y + p * g + e[13], t[14] = s * m + u * y + f * g + e[14], t[15] = a * m + c * y + d * g + e[15]), t }, ql.scale = function (t, e, r) { var n = r[0], i = r[1], s = r[2]; return t[0] = e[0] * n, t[1] = e[1] * n, t[2] = e[2] * n, t[3] = e[3] * n, t[4] = e[4] * i, t[5] = e[5] * i, t[6] = e[6] * i, t[7] = e[7] * i, t[8] = e[8] * s, t[9] = e[9] * s, t[10] = e[10] * s, t[11] = e[11] * s, t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t }, ql.rotate = function (t, e, r, n) { var i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _, w, M, A, S, I, k, T = n[0], P = n[1], z = n[2], E = Math.hypot(T, P, z); return E < Yl.EPSILON ? null : (T *= E = 1 / E, P *= E, z *= E, i = Math.sin(r), s = Math.cos(r), l = e[1], u = e[2], c = e[3], p = e[5], f = e[6], d = e[7], y = e[9], g = e[10], x = e[11], w = T * P * (a = 1 - s) - z * i, M = P * P * a + s, A = z * P * a + T * i, S = T * z * a + P * i, I = P * z * a - T * i, k = z * z * a + s, t[0] = (o = e[0]) * (v = T * T * a + s) + (h = e[4]) * (b = P * T * a + z * i) + (m = e[8]) * (_ = z * T * a - P * i), t[1] = l * v + p * b + y * _, t[2] = u * v + f * b + g * _, t[3] = c * v + d * b + x * _, t[4] = o * w + h * M + m * A, t[5] = l * w + p * M + y * A, t[6] = u * w + f * M + g * A, t[7] = c * w + d * M + x * A, t[8] = o * S + h * I + m * k, t[9] = l * S + p * I + y * k, t[10] = u * S + f * I + g * k, t[11] = c * S + d * I + x * k, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t) }, ql.rotateX = function (t, e, r) { var n = Math.sin(r), i = Math.cos(r), s = e[4], a = e[5], o = e[6], l = e[7], u = e[8], c = e[9], h = 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] = s * i + u * n, t[5] = a * i + c * n, t[6] = o * i + h * n, t[7] = l * i + p * n, t[8] = u * i - s * n, t[9] = c * i - a * n, t[10] = h * i - o * n, t[11] = p * i - l * n, t }, ql.rotateY = function (t, e, r) { var n = Math.sin(r), i = Math.cos(r), s = e[0], a = e[1], o = e[2], l = e[3], u = e[8], c = e[9], h = 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] = s * i - u * n, t[1] = a * i - c * n, t[2] = o * i - h * n, t[3] = l * i - p * n, t[8] = s * n + u * i, t[9] = a * n + c * i, t[10] = o * n + h * i, t[11] = l * n + p * i, t }, ql.rotateZ = function (t, e, r) { var n = Math.sin(r), i = Math.cos(r), s = e[0], a = e[1], o = e[2], l = e[3], u = e[4], c = e[5], h = 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] = s * i + u * n, t[1] = a * i + c * n, t[2] = o * i + h * n, t[3] = l * i + p * n, t[4] = u * i - s * n, t[5] = c * i - a * n, t[6] = h * i - o * n, t[7] = p * i - l * n, t }, ql.fromTranslation = function (t, e) { 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] = e[0], t[13] = e[1], t[14] = e[2], t[15] = 1, t }, ql.fromScaling = function (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 }, ql.fromRotation = function (t, e, r) { var n, i, s, a = r[0], o = r[1], l = r[2], u = Math.hypot(a, o, l); return u < Yl.EPSILON ? null : (a *= u = 1 / u, o *= u, l *= u, n = Math.sin(e), i = Math.cos(e), t[0] = a * a * (s = 1 - i) + i, t[1] = o * a * s + l * n, t[2] = l * a * s - o * n, t[3] = 0, t[4] = a * o * s - l * n, t[5] = o * o * s + i, t[6] = l * o * s + a * n, t[7] = 0, t[8] = a * l * s + o * n, t[9] = o * l * s - a * n, t[10] = l * l * s + i, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) }, ql.fromXRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = n, t[6] = r, t[7] = 0, t[8] = 0, t[9] = -r, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, ql.fromYRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = 0, t[2] = -r, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = r, t[9] = 0, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, ql.fromZRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = 0, t[4] = -r, t[5] = n, 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 }, ql.fromRotationTranslation = Wl, ql.fromQuat2 = function (t, e) { var r = new Yl.ARRAY_TYPE(3), n = -e[0], i = -e[1], s = -e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = n * n + i * i + s * s + a * a; return h > 0 ? (r[0] = 2 * (o * a + c * n + l * s - u * i) / h, r[1] = 2 * (l * a + c * i + u * n - o * s) / h, r[2] = 2 * (u * a + c * s + o * i - l * n) / h) : (r[0] = 2 * (o * a + c * n + l * s - u * i), r[1] = 2 * (l * a + c * i + u * n - o * s), r[2] = 2 * (u * a + c * s + o * i - l * n)), Wl(t, e, r), t }, ql.getTranslation = function (t, e) { return t[0] = e[12], t[1] = e[13], t[2] = e[14], t }, ql.getScaling = Hl, ql.getRotation = function (t, e) { var r = new Yl.ARRAY_TYPE(3); Hl(r, e); var n = 1 / r[0], i = 1 / r[1], s = 1 / r[2], a = e[0] * n, o = e[1] * i, l = e[2] * s, u = e[4] * n, c = e[5] * i, h = e[6] * s, p = e[8] * n, f = e[9] * i, d = e[10] * s, m = a + c + d, y = 0; return m > 0 ? (y = 2 * Math.sqrt(m + 1), t[3] = .25 * y, t[0] = (h - f) / y, t[1] = (p - l) / y, t[2] = (o - u) / y) : a > c && a > d ? (y = 2 * Math.sqrt(1 + a - c - d), t[3] = (h - f) / y, t[0] = .25 * y, t[1] = (o + u) / y, t[2] = (p + l) / y) : c > d ? (y = 2 * Math.sqrt(1 + c - a - d), t[3] = (p - l) / y, t[0] = (o + u) / y, t[1] = .25 * y, t[2] = (h + f) / y) : (y = 2 * Math.sqrt(1 + d - a - c), t[3] = (o - u) / y, t[0] = (p + l) / y, t[1] = (h + f) / y, t[2] = .25 * y), t }, ql.fromRotationTranslationScale = function (t, e, r, n) { var i = e[0], s = e[1], a = e[2], o = e[3], l = i + i, u = s + s, c = a + a, h = i * l, p = i * u, f = i * c, d = s * u, m = s * c, y = a * c, g = o * l, x = o * u, v = o * c, b = n[0], _ = n[1], w = n[2]; return t[0] = (1 - (d + y)) * b, t[1] = (p + v) * b, t[2] = (f - x) * b, t[3] = 0, t[4] = (p - v) * _, t[5] = (1 - (h + y)) * _, t[6] = (m + g) * _, t[7] = 0, t[8] = (f + x) * w, t[9] = (m - g) * w, t[10] = (1 - (h + d)) * w, t[11] = 0, t[12] = r[0], t[13] = r[1], t[14] = r[2], t[15] = 1, t }, ql.fromRotationTranslationScaleOrigin = function (t, e, r, n, i) { var s = e[0], a = e[1], o = e[2], l = e[3], u = s + s, c = a + a, h = o + o, p = s * u, f = s * c, d = s * h, m = a * c, y = a * h, g = o * h, x = l * u, v = l * c, b = l * h, _ = n[0], w = n[1], M = n[2], A = i[0], S = i[1], I = i[2], k = (1 - (m + g)) * _, T = (f + b) * _, P = (d - v) * _, z = (f - b) * w, E = (1 - (p + g)) * w, B = (y + x) * w, D = (d + v) * M, C = (y - x) * M, R = (1 - (p + m)) * M; return t[0] = k, t[1] = T, t[2] = P, t[3] = 0, t[4] = z, t[5] = E, t[6] = B, t[7] = 0, t[8] = D, t[9] = C, t[10] = R, t[11] = 0, t[12] = r[0] + A - (k * A + z * S + D * I), t[13] = r[1] + S - (T * A + E * S + C * I), t[14] = r[2] + I - (P * A + B * S + R * I), t[15] = 1, t }, ql.fromQuat = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = r + r, o = n + n, l = i + i, u = r * a, c = n * a, h = n * o, p = i * a, f = i * o, d = i * l, m = s * a, y = s * o, g = s * l; return t[0] = 1 - h - d, t[1] = c + g, t[2] = p - y, t[3] = 0, t[4] = c - g, t[5] = 1 - u - d, t[6] = f + m, t[7] = 0, t[8] = p + y, t[9] = f - m, t[10] = 1 - u - h, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, ql.frustum = function (t, e, r, n, i, s, a) { var o = 1 / (r - e), l = 1 / (i - n), u = 1 / (s - a); return t[0] = 2 * s * o, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 2 * s * l, t[6] = 0, t[7] = 0, t[8] = (r + e) * o, t[9] = (i + n) * l, t[10] = (a + s) * u, t[11] = -1, t[12] = 0, t[13] = 0, t[14] = a * s * 2 * u, t[15] = 0, t }, ql.perspectiveNO = Jl, ql.perspectiveZO = function (t, e, r, n, i) { var s, a = 1 / Math.tan(e / 2); return t[0] = a / r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = a, 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 != i && i !== 1 / 0 ? (t[10] = i * (s = 1 / (n - i)), t[14] = i * n * s) : (t[10] = -1, t[14] = -n), t }, ql.perspectiveFromFieldOfView = function (t, e, r, n) { var i = Math.tan(e.upDegrees * Math.PI / 180), s = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), o = Math.tan(e.rightDegrees * Math.PI / 180), l = 2 / (a + o), u = 2 / (i + s); return t[0] = l, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = u, t[6] = 0, t[7] = 0, t[8] = -(a - o) * l * .5, t[9] = (i - s) * u * .5, t[10] = n / (r - n), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = n * r / (r - n), t[15] = 0, t }, ql.orthoNO = Ql, ql.orthoZO = function (t, e, r, n, i, s, a) { var o = 1 / (e - r), l = 1 / (n - i), u = 1 / (s - a); return t[0] = -2 * o, 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] = u, t[11] = 0, t[12] = (e + r) * o, t[13] = (i + n) * l, t[14] = s * u, t[15] = 1, t }, ql.lookAt = function (t, e, r, n) { var i, s, a, o, l, u, c, h, p, f, d = e[0], m = e[1], y = e[2], g = n[0], x = n[1], v = n[2], b = r[0], _ = r[1], w = r[2]; return Mat
33h.abs(d - b) < Yl.EPSILON && Math.abs(m - _) < Yl.EPSILON && Math.abs(y - w) < Yl.EPSILON ? Xl(t) : (c = d - b, h = m - _, p = y - w, i = x * (p *= f = 1 / Math.hypot(c, h, p)) - v * (h *= f), s = v * (c *= f) - g * p, a = g * h - x * c, (f = Math.hypot(i, s, a)) ? (i *= f = 1 / f, s *= f, a *= f) : (i = 0, s = 0, a = 0), o = h * a - p * s, l = p * i - c * a, u = c * s - h * i, (f = Math.hypot(o, l, u)) ? (o *= f = 1 / f, l *= f, u *= f) : (o = 0, l = 0, u = 0), t[0] = i, t[1] = o, t[2] = c, t[3] = 0, t[4] = s, t[5] = l, t[6] = h, t[7] = 0, t[8] = a, t[9] = u, t[10] = p, t[11] = 0, t[12] = -(i * d + s * m + a * y), t[13] = -(o * d + l * m + u * y), t[14] = -(c * d + h * m + p * y), t[15] = 1, t) }, ql.targetTo = function (t, e, r, n) { var i = e[0], s = e[1], a = e[2], o = n[0], l = n[1], u = n[2], c = i - r[0], h = s - r[1], p = a - r[2], f = c * c + h * h + p * p; f > 0 && (c *= f = 1 / Math.sqrt(f), h *= f, p *= f); var d = l * p - u * h, m = u * c - o * p, y = o * h - l * c; return (f = d * d + m * m + y * y) > 0 && (d *= f = 1 / Math.sqrt(f), m *= f, y *= f), t[0] = d, t[1] = m, t[2] = y, t[3] = 0, t[4] = h * y - p * m, t[5] = p * d - c * y, t[6] = c * m - h * d, t[7] = 0, t[8] = c, t[9] = h, t[10] = p, t[11] = 0, t[12] = i, t[13] = s, t[14] = a, t[15] = 1, t }, ql.str = function (t) { return "mat4(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ", " + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + ")" }, ql.frob = function (t) { return Math.hypot(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]) }, ql.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t[8] = e[8] + r[8], t[9] = e[9] + r[9], t[10] = e[10] + r[10], t[11] = e[11] + r[11], t[12] = e[12] + r[12], t[13] = e[13] + r[13], t[14] = e[14] + r[14], t[15] = e[15] + r[15], t }, ql.subtract = tu, ql.multiplyScalar = function (t, e, r) { 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] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t[8] = e[8] * r, t[9] = e[9] * r, t[10] = e[10] * r, t[11] = e[11] * r, t[12] = e[12] * r, t[13] = e[13] * r, t[14] = e[14] * r, t[15] = e[15] * r, t }, ql.multiplyScalarAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t[6] = e[6] + r[6] * n, t[7] = e[7] + r[7] * n, t[8] = e[8] + r[8] * n, t[9] = e[9] + r[9] * n, t[10] = e[10] + r[10] * n, t[11] = e[11] + r[11] * n, t[12] = e[12] + r[12] * n, t[13] = e[13] + r[13] * n, t[14] = e[14] + r[14] * n, t[15] = e[15] + r[15] * n, t }, ql.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] && t[8] === e[8] && t[9] === e[9] && t[10] === e[10] && t[11] === e[11] && t[12] === e[12] && t[13] === e[13] && t[14] === e[14] && t[15] === e[15] }, ql.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], l = t[6], u = t[7], c = t[8], h = t[9], p = t[10], f = t[11], d = t[12], m = t[13], y = t[14], g = t[15], x = e[0], v = e[1], b = e[2], _ = e[3], w = e[4], M = e[5], A = e[6], S = e[7], I = e[8], k = e[9], T = e[10], P = e[11], z = e[12], E = e[13], B = e[14], D = e[15]; return Math.abs(r - x) <= Yl.EPSILON * Math.max(1, Math.abs(r), Math.abs(x)) && Math.abs(n - v) <= Yl.EPSILON * Math.max(1, Math.abs(n), Math.abs(v)) && Math.abs(i - b) <= Yl.EPSILON * Math.max(1, Math.abs(i), Math.abs(b)) && Math.abs(s - _) <= Yl.EPSILON * Math.max(1, Math.abs(s), Math.abs(_)) && Math.abs(a - w) <= Yl.EPSILON * Math.max(1, Math.abs(a), Math.abs(w)) && Math.abs(o - M) <= Yl.EPSILON * Math.max(1, Math.abs(o), Math.abs(M)) && Math.abs(l - A) <= Yl.EPSILON * Math.max(1, Math.abs(l), Math.abs(A)) && Math.abs(u - S) <= Yl.EPSILON * Math.max(1, Math.abs(u), Math.abs(S)) && Math.abs(c - I) <= Yl.EPSILON * Math.max(1, Math.abs(c), Math.abs(I)) && Math.abs(h - k) <= Yl.EPSILON * Math.max(1, Math.abs(h), Math.abs(k)) && Math.abs(p - T) <= Yl.EPSILON * Math.max(1, Math.abs(p), Math.abs(T)) && Math.abs(f - P) <= Yl.EPSILON * Math.max(1, Math.abs(f), Math.abs(P)) && Math.abs(d - z) <= Yl.EPSILON * Math.max(1, Math.abs(d), Math.abs(z)) && Math.abs(m - E) <= Yl.EPSILON * Math.max(1, Math.abs(m), Math.abs(E)) && Math.abs(y - B) <= Yl.EPSILON * Math.max(1, Math.abs(y), Math.abs(B)) && Math.abs(g - D) <= Yl.EPSILON * Math.max(1, Math.abs(g), Math.abs(D)) }, ql.sub = ql.mul = ql.ortho = ql.perspective = void 0; var Yl = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== Gl(t) && "function" != typeof t) return { default: t }; var r = Zl(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor;
vendor: 8,547 bytes, line 33
33 for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function Zl(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Zl = function (t) { return t ? r : e })(t) } function Xl(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 Kl(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = e[8], p = e[9], f = e[10], d = e[11], m = e[12], y = e[13], g = e[14], x = e[15], v = r[0], b = r[1], _ = r[2], w = r[3]; return t[0] = v * n + b * o + _ * h + w * m, t[1] = v * i + b * l + _ * p + w * y, t[2] = v * s + b * u + _ * f + w * g, t[3] = v * a + b * c + _ * d + w * x, t[4] = (v = r[4]) * n + (b = r[5]) * o + (_ = r[6]) * h + (w = r[7]) * m, t[5] = v * i + b * l + _ * p + w * y, t[6] = v * s + b * u + _ * f + w * g, t[7] = v * a + b * c + _ * d + w * x, t[8] = (v = r[8]) * n + (b = r[9]) * o + (_ = r[10]) * h + (w = r[11]) * m, t[9] = v * i + b * l + _ * p + w * y, t[10] = v * s + b * u + _ * f + w * g, t[11] = v * a + b * c + _ * d + w * x, t[12] = (v = r[12]) * n + (b = r[13]) * o + (_ = r[14]) * h + (w = r[15]) * m, t[13] = v * i + b * l + _ * p + w * y, t[14] = v * s + b * u + _ * f + w * g, t[15] = v * a + b * c + _ * d + w * x, t } function Wl(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = n + n, l = i + i, u = s + s, c = n * o, h = n * l, p = n * u, f = i * l, d = i * u, m = s * u, y = a * o, g = a * l, x = a * u; return t[0] = 1 - (f + m), t[1] = h + x, t[2] = p - g, t[3] = 0, t[4] = h - x, t[5] = 1 - (c + m), t[6] = d + y, t[7] = 0, t[8] = p + g, t[9] = d - y, t[10] = 1 - (c + f), t[11] = 0, t[12] = r[0], t[13] = r[1], t[14] = r[2], t[15] = 1, t } function Hl(t, e) { var r = e[4], n = e[5], i = e[6], s = e[8], a = e[9], o = e[10]; return t[0] = Math.hypot(e[0], e[1], e[2]), t[1] = Math.hypot(r, n, i), t[2] = Math.hypot(s, a, o), t } function Jl(t, e, r, n, i) { var s, a = 1 / Math.tan(e / 2); return t[0] = a / r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = a, 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 != i && i !== 1 / 0 ? (t[10] = (i + n) * (s = 1 / (n - i)), t[14] = 2 * i * n * s) : (t[10] = -1, t[14] = -2 * n), t } function Ql(t, e, r, n, i, s, a) { var o = 1 / (e - r), l = 1 / (n - i), u = 1 / (s - a); return t[0] = -2 * o, 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 * u, t[11] = 0, t[12] = (e + r) * o, t[13] = (i + n) * l, t[14] = (a + s) * u, t[15] = 1, t } function tu(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t[6] = e[6] - r[6], t[7] = e[7] - r[7], t[8] = e[8] - r[8], t[9] = e[9] - r[9], t[10] = e[10] - r[10], t[11] = e[11] - r[11], t[12] = e[12] - r[12], t[13] = e[13] - r[13], t[14] = e[14] - r[14], t[15] = e[15] - r[15], t } ql.perspective = Jl, ql.ortho = Ql, ql.mul = Kl, ql.sub = tu; var eu = {}, ru = {}; function nu(t) { return nu = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, nu(t) } Object.defineProperty(ru, "__esModule", { value: !0 }), ru.create = au, ru.clone = function (t) { var e = new iu.ARRAY_TYPE(3); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e }, ru.length = ou, ru.fromValues = function (t, e, r) { var n = new iu.ARRAY_TYPE(3); return n[0] = t, n[1] = e, n[2] = r, n }, ru.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t }, ru.set = function (t, e, r, n) { return t[0] = e, t[1] = r, t[2] = n, t }, ru.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t }, ru.subtract = lu, ru.multiply = uu, ru.divide = cu, ru.ceil = function (t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t[2] = Math.ceil(e[2]), t }, ru.floor = function (t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t[2] = Math.floor(e[2]), t }, ru.min = function (t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t[2] = Math.min(e[2], r[2]), t }, ru.max = function (t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t[2] = Math.max(e[2], r[2]), t }, ru.round = function (t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t[2] = Math.round(e[2]), t }, ru.scale = function (t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t }, ru.scaleAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t }, ru.distance = hu, ru.squaredDistance = pu, ru.squaredLength = fu, ru.negate = function (t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t }, ru.inverse = function (t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t[2] = 1 / e[2], t }, ru.normalize = function (t, e) { var r = e[0], n = e[1], i = e[2], s = r * r + n * n + i * i; return s > 0 && (s = 1 / Math.sqrt(s)), t[0] = e[0] * s, t[1] = e[1] * s, t[2] = e[2] * s, t }, ru.dot = du, ru.cross = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = r[0], o = r[1], l = r[2]; return t[0] = i * l - s * o, t[1] = s * a - n * l, t[2] = n * o - i * a, t }, ru.lerp = function (t, e, r, n) { var i = e[0], s = e[1], a = e[2]; return t[0] = i + n * (r[0] - i), t[1] = s + n * (r[1] - s), t[2] = a + n * (r[2] - a), t }, ru.hermite = function (t, e, r, n, i, s) { var a = s * s, o = a * (2 * s - 3) + 1, l = a * (s - 2) + s, u = a * (s - 1), c = a * (3 - 2 * s); return t[0] = e[0] * o + r[0] * l + n[0] * u + i[0] * c, t[1] = e[1] * o + r[1] * l + n[1] * u + i[1] * c, t[2] = e[2] * o + r[2] * l + n[2] * u + i[2] * c, t }, ru.bezier = function (t, e, r, n, i, s) { var a = 1 - s, o = a * a, l = s * s, u = o * a, c = 3 * s * o, h = 3 * l * a, p = l * s; return t[0] = e[0] * u + r[0] * c + n[0] * h + i[0] * p, t[1] = e[1] * u + r[1] * c + n[1] * h + i[1] * p, t[2] = e[2] * u + r[2] * c + n[2] * h + i[2] * p, t }, ru.random = function (t, e) { e = e || 1; var r = 2 * iu.RANDOM() * Math.PI, n = 2 * iu.RANDOM() - 1, i = Math.sqrt(1 - n * n) * e; return t[0] = Math.cos(r) * i, t[1] = Math.sin(r) * i, t[2] = n * e, t }, ru.transformMat4 = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = r[3] * n + r[7] * i + r[11] * s + r[15]; return t[0] = (r[0] * n + r[4] * i + r[8] * s + r[12]) / (a = a || 1), t[1] = (r[1] * n + r[5] * i + r[9] * s + r[13]) / a, t[2] = (r[2] * n + r[6] * i + r[10] * s + r[14]) / a, t }, ru.transformMat3 = function (t, e, r) { var n = e[0], i = e[1], s = e[2]; return t[0] = n * r[0] + i * r[3] + s * r[6], t[1] = n * r[1] + i * r[4] + s * r[7], t[2] = n * r[2] + i * r[5] + s * r[8], t }, ru.transformQuat = function (t, e, r) { var n = r[0], i = r[1], s = r[2], a = e[0], o = e[1], l = e[2], u = i * l - s * o, c = s * a - n * l, h = n * o - i * a, p = i * h - s * c, f = s * u - n * h, d = n * c - i * u, m = 2 * r[3]; return c *= m, h *= m, f *= 2, d *= 2, t[0] = a + (u *= m) + (p *= 2), t[1] = o + c + f, t[2] = l + h + d, t }, ru.rotateX = function (t, e, r, n) { var i = [], s = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], s[0] = i[0], s[1] = i[1] * Math.cos(n) - i[2] * Math.sin(n), s[2] = i[1] * Math.sin(n) + i[2] * Math.cos(n), t[0] = s[0] + r[0], t[1] = s[1] + r[1], t[2] = s[2] + r[2], t }, ru.rotateY = function (t, e, r, n) { var i = [], s = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], s[0] = i[2] * Math.sin(n) + i[0] * Math.cos(n), s[1] = i[1], s[2] = i[2] * Math.cos(n) - i[0] * Math.sin(n), t[0] = s[0] + r[0], t[1] = s[1] + r[1], t[2] = s[2] + r[2], t }, ru.rotateZ = function (t, e, r, n) { var i = [], s = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], s[0] = i[0] * Math.cos(n) - i[1] * Math.sin(n), s[1] = i[0] * Math.sin(n) + i[1] * Math.cos(n), s[2] = i[2], t[0] = s[0] + r[0], t[1] = s[1] + r[1], t[2] = s[2] + r[2], t }, ru.angle = function (t, e) { var r = t[0], n = t[1], i = t[2], s = e[0], a = e[1], o = e[2], l = Math.sqrt(r * r + n * n + i * i) * Math.sqrt(s * s + a * a + o * o), u = l && du(t, e) / l;
33 return Math.acos(Math.min(Math.max(u, -1), 1)) }, ru.zero = function (t) { return t[0] = 0, t[1] = 0, t[2] = 0, t }, ru.str = function (t) { return "vec3(" + t[0] + ", " + t[1] + ", " + t[2] + ")" }, ru.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] }, ru.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = e[0], a = e[1], o = e[2]; return Math.abs(r - s) <= iu.EPSILON * Math.max(1, Math.abs(r), Math.abs(s)) && Math.abs(n - a) <= iu.EPSILON * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(i - o) <= iu.EPSILON * Math.max(1, Math.abs(i), Math.abs(o)) }, ru.forEach = ru.sqrLen = ru.len = ru.sqrDist = ru.dist = ru.div = ru.mul = ru.sub = void 0; var iu = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== nu(t) && "function" != typeof t) return { default: t }; var r = su(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function su(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (su = function (t) { return t ? r : e })(t) } function au() { var t = new iu.ARRAY_TYPE(3); return iu.ARRAY_TYPE != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t } function ou(t) { return Math.hypot(t[0], t[1], t[2]) } function lu(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t } function uu(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t[2] = e[2] * r[2], t } function cu(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t[2] = e[2] / r[2], t } function hu(t, e) { return Math.hypot(e[0] - t[0], e[1] - t[1], e[2] - t[2]) } function pu(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2]; return r * r + n * n + i * i } function fu(t) { var e = t[0], r = t[1], n = t[2]; return e * e + r * r + n * n } function du(t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] } ru.sub = lu, ru.mul = uu, ru.div = cu, ru.dist = hu, ru.sqrDist = pu, ru.len = ou, ru.sqrLen = fu; var mu, yu = (mu = au(), function (t, e, r, n, i, s) { var a, o; for (e || (e = 3), r || (r = 0), o = n ? Math.min(n * e + r, t.length) : t.length, a = r; a < o; a += e)mu[0] = t[a], mu[1] = t[a + 1], mu[2] = t[a + 2], i(mu, mu, s), t[a] = mu[0], t[a + 1] = mu[1], t[a + 2] = mu[2]; return t }); ru.forEach = yu; var gu = {}; function xu(t) { return xu = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, xu(t) } Object.defineProperty(gu, "__esModule", { value: !0 }), gu.create = _u, gu.clone = function (t) { var e = new vu.ARRAY_TYPE(4); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e }, gu.fromValues = function (t, e, r, n) { var i = new vu.ARRAY_TYPE(4); return i[0] = t, i[1] = e, i[2] = r, i[3] = n, i }, gu.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t }, gu.set = function (t, e, r, n, i) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t }, gu.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t }, gu.subtract = wu, gu.multiply = Mu, gu.divide = Au, gu.ceil = function (t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t[2] = Math.ceil(e[2]), t[3] = Math.ceil(e[3]), t }, gu.floor = function (t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t[2] = Math.floor(e[2]), t[3] = Math.floor(e[3]), t }, gu.min = function (t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t[2] = Math.min(e[2], r[2]), t[3] = Math.min(e[3], r[3]), t }, gu.max = function (t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t[2] = Math.max(e[2], r[2]), t[3] = Math.max(e[3], r[3]), t }, gu.round = function (t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t[2] = Math.round(e[2]), t[3] = Math.round(e[3]), t }, gu.scale = function (t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t }, gu.scaleAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t }, gu.distance = Su, gu.squaredDistance = Iu, gu.length = ku, gu.squaredLength = Tu, gu.negate = function (t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t }, gu.inverse = function (t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t[2] = 1 / e[2], t[3] = 1 / e[3], t }, gu.normalize = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = r * r + n * n + i * i + s * s; return a > 0 && (a = 1 / Math.sqrt(a)), t[0] = r * a, t[1] = n * a, t[2] = i * a, t[3] = s * a, t }, gu.dot = function (t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3] }, gu.cross = function (t, e, r, n) { var i = r[0] * n[1] - r[1] * n[0], s = r[0] * n[2] - r[2] * n[0], a = r[0] * n[3] - r[3] * n[0], o = r[1] * n[2] - r[2] * n[1], l = r[1] * n[3] - r[3] * n[1], u = r[2] * n[3] - r[3] * n[2], c = e[0], h = e[1], p = e[2], f = e[3]; return t[0] = h * u - p * l + f * o, t[1] = -c * u + p * a - f * s, t[2] = c * l - h * a + f * i, t[3] = -c * o + h * s - p * i, t }, gu.lerp = function (t, e, r, n) { var i = e[0], s = e[1], a = e[2], o = e[3]; return t[0] = i + n * (r[0] - i), t[1] = s + n * (r[1] - s), t[2] = a + n * (r[2] - a), t[3] = o + n * (r[3] - o), t }, gu.random = function (t, e) { var r, n, i, s, a, o; e = e || 1; do { a = (r = 2 * vu.RANDOM() - 1) * r + (n = 2 * vu.RANDOM() - 1) * n; } while (a >= 1); do { o = (i = 2 * vu.RANDOM() - 1) * i + (s = 2 * vu.RANDOM() - 1) * s; } while (o >= 1); var l = Math.sqrt((1 - a) / o); return t[0] = e * r, t[1] = e * n, t[2] = e * i * l, t[3] = e * s * l, t }, gu.transformMat4 = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3]; return t[0] = r[0] * n + r[4] * i + r[8] * s + r[12] * a, t[1] = r[1] * n + r[5] * i + r[9] * s + r[13] * a, t[2] = r[2] * n + r[6] * i + r[10] * s + r[14] * a, t[3] = r[3] * n + r[7] * i + r[11] * s + r[15] * a, t }, gu.transformQuat = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = r[0], o = r[1], l = r[2], u = r[3], c = u * n + o * s - l * i, h = u * i + l * n - a * s, p = u * s + a * i - o * n, f = -a * n - o * i - l * s; return t[0] = c * u + f * -a + h * -l - p * -o, t[1] = h * u + f * -o + p * -a - c * -l, t[2] = p * u + f * -l + c * -o - h * -a, t[3] = e[3], t }, gu.zero = function (t) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0, t }, gu.str = function (t) { return "vec4(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" }, gu.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] }, gu.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = e[0], o = e[1], l = e[2], u = e[3]; return Math.abs(r - a) <= vu.EPSILON * Math.max(1, Math.abs(r), Math.abs(a)
33) && Math.abs(n - o) <= vu.EPSILON * Math.max(1, Math.abs(n), Math.abs(o)) && Math.abs(i - l) <= vu.EPSILON * Math.max(1, Math.abs(i), Math.abs(l)) && Math.abs(s - u) <= vu.EPSILON * Math.max(1, Math.abs(s), Math.abs(u)) }, gu.forEach = gu.sqrLen = gu.len = gu.sqrDist = gu.dist = gu.div = gu.mul = gu.sub = void 0; var vu = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== xu(t) && "function" != typeof t) return { default: t }; var r = bu(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function bu(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (bu = function (t) { return t ? r : e })(t) } function _u() { var t = new vu.ARRAY_TYPE(4); return vu.ARRAY_TYPE != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0), t } function wu(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t } function Mu(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t[2] = e[2] * r[2], t[3] = e[3] * r[3], t } function Au(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t[2] = e[2] / r[2], t[3] = e[3] / r[3], t } function Su(t, e) { return Math.hypot(e[0] - t[0], e[1] - t[1], e[2] - t[2], e[3] - t[3]) } function Iu(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2], s = e[3] - t[3]; return r * r + n * n + i * i + s * s } function ku(t) { return Math.hypot(t[0], t[1], t[2], t[3]) } function Tu(t) { var e = t[0], r = t[1], n = t[2], i = t[3]; return e * e + r * r + n * n + i * i } gu.sub = wu, gu.mul = Mu, gu.div = Au, gu.dist = Su, gu.sqrDist = Iu, gu.len = ku, gu.sqrLen = Tu; var Pu = function () { var t = _u(); return function (e, r, n, i, s, a) { var o, l; for (r || (r = 4), n || (n = 0), l = i ? Math.min(i * r + n, e.length) : e.length, o = n; o < l; o += r)t[0] = e[o], t[1] = e[o + 1], t[2] = e[o + 2], t[3] = e[o + 3], s(t, t, a), e[o] = t[0], e[o + 1] = t[1], e[o + 2] = t[2], e[o + 3] = t[3]; return e } }(); function zu(t) { return zu = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, zu(t) } gu.forEach = Pu, Object.defineProperty(eu, "__esModule", { value: !0 }), eu.create = Vu, eu.identity = function (t) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t }, eu.setAxisAngle = Ou, eu.getAxisAngle = function (t, e) { var r = 2 * Math.acos(e[3]), n = Math.sin(r / 2); return n > Eu.EPSILON ? (t[0] = e[0] / n, t[1] = e[1] / n, t[2] = e[2] / n) : (t[0] = 1, t[1] = 0, t[2] = 0), r }, eu.getAngle = function (t, e) { var r = Gu(t, e); return Math.acos(2 * r * r - 1) }, eu.multiply = Fu, eu.rotateX = function (t, e, r) { r *= .5; var n = e[0], i = e[1], s = e[2], a = e[3], o = Math.sin(r), l = Math.cos(r); return t[0] = n * l + a * o, t[1] = i * l + s * o, t[2] = s * l - i * o, t[3] = a * l - n * o, t }, eu.rotateY = function (t, e, r) { r *= .5; var n = e[0], i = e[1], s = e[2], a = e[3], o = Math.sin(r), l = Math.cos(r); return t[0] = n * l - s * o, t[1] = i * l + a * o, t[2] = s * l + n * o, t[3] = a * l - i * o, t }, eu.rotateZ = function (t, e, r) { r *= .5; var n = e[0], i = e[1], s = e[2], a = e[3], o = Math.sin(r), l = Math.cos(r); return t[0] = n * l + i * o, t[1] = i * l - n * o, t[2] = s * l + a * o, t[3] = a * l - s * o, t }, eu.calculateW = function (t, e) { var r = e[0], n = e[1], i = e[2]; return t[0] = r, t[1] = n, t[2] = i, t[3] = Math.sqrt(Math.abs(1 - r * r - n * n - i * i)), t }, eu.exp = ju, eu.ln = Uu, eu.pow = function (t, e, r) { return Uu(t, e), qu(t, t, r), ju(t, t), t }, eu.slerp = Nu, eu.random = function (t) { var e = Eu.RANDOM(), r = Eu.RANDOM(), n = Eu.RANDOM(), i = Math.sqrt(1 - e), s = Math.sqrt(e); return t[0] = i * Math.sin(2 * Math.PI * r), t[1] = i * Math.cos(2 * Math.PI * r), t[2] = s * Math.sin(2 * Math.PI * n), t[3] = s * Math.cos(2 * Math.PI * n), t }, eu.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = r * r + n * n + i * i + s * s, o = a ? 1 / a : 0; return t[0] = -r * o, t[1] = -n * o, t[2] = -i * o, t[3] = s * o, t }, eu.conjugate = function (t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = e[3], t }
33, eu.fromMat3 = $u, eu.fromEuler = function (t, e, r, n) { var i = .5 * Math.PI / 180; e *= i, r *= i, n *= i; var s = Math.sin(e), a = Math.cos(e), o = Math.sin(r), l = Math.cos(r), u = Math.sin(n), c = Math.cos(n); return t[0] = s * l * c - a * o * u, t[1] = a * o * c + s * l * u, t[2] = a * l * u - s * o * c, t[3] = a * l * c + s * o * u, t }, eu.str = function (t) { return "quat(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" }, eu.setAxes = eu.sqlerp = eu.rotationTo = eu.equals = eu.exactEquals = eu.normalize = eu.sqrLen = eu.squaredLength = eu.len = eu.length = eu.lerp = eu.dot = eu.scale = eu.mul = eu.add = eu.set = eu.copy = eu.fromValues = eu.clone = void 0; var Eu = Lu(_l), Bu = Lu(Ol), Du = Lu(ru), Cu = Lu(gu); function Ru(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Ru = function (t) { return t ? r : e })(t) } function Lu(t, e) { if (!e && t && t.__esModule) return t; if (null === t || "object" !== zu(t) && "function" != typeof t) return { default: t }; var r = Ru(e); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n } function Vu() { var t = new Eu.ARRAY_TYPE(4); return Eu.ARRAY_TYPE != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t } function Ou(t, e, r) { r *= .5; var n = Math.sin(r); return t[0] = n * e[0], t[1] = n * e[1], t[2] = n * e[2], t[3] = Math.cos(r), t } function Fu(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = r[0], l = r[1], u = r[2], c = r[3]; return t[0] = n * c + a * o + i * u - s * l, t[1] = i * c + a * l + s * o - n * u, t[2] = s * c + a * u + n * l - i * o, t[3] = a * c - n * o - i * l - s * u, t } function ju(t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = Math.sqrt(r * r + n * n + i * i), o = Math.exp(s), l = a > 0 ? o * Math.sin(a) / a : 0; return t[0] = r * l, t[1] = n * l, t[2] = i * l, t[3] = o * Math.cos(a), t } function Uu(t, e) { var r = e[0], n = e[1], i = e[2], s = e[3], a = Math.sqrt(r * r + n * n + i * i), o = a > 0 ? Math.atan2(a, s) / a : 0; return t[0] = r * o, t[1] = n * o, t[2] = i * o, t[3] = .5 * Math.log(r * r + n * n + i * i + s * s), t } function Nu(t, e, r, n) { var i, s, a, o, l, u = e[0], c = e[1], h = e[2], p = e[3], f = r[0], d = r[1], m = r[2], y = r[3]; return (s = u * f + c * d + h * m + p * y) < 0 && (s = -s, f = -f, d = -d, m = -m, y = -y), 1 - s > Eu.EPSILON ? (i = Math.acos(s), a = Math.sin(i), o = Math.sin((1 - n) * i) / a, l = Math.sin(n * i) / a) : (o = 1 - n, l = n), t[0] = o * u + l * f, t[1] = o * c + l * d, t[2] = o * h + l * m, t[3] = o * p + l * y, t } function $u(t, e) { var r, n = e[0] + e[4] + e[8]; if (n > 0) r = Math.sqrt(n + 1), t[3] = .5 * r, t[0] = (e[5] - e[7]) * (r = .5 / r), t[1] = (e[6] - e[2]) * r, t[2] = (e[1] - e[3]) * r; else { var i = 0; e[4] > e[0] && (i = 1), e[8] > e[3 * i + i] && (i = 2); var s = (i + 1) % 3, a = (i + 2) % 3; r = Math.sqrt(e[3 * i + i] - e[3 * s + s] - e[3 * a + a] + 1), t[i] = .5 * r, t[3] = (e[3 * s + a] - e[3 * a + s]) * (r = .5 / r), t[s] = (e[3 * s + i] + e[3 * i + s]) * r, t[a] = (e[3 * a + i] + e[3 * i + a]) * r; } return t } eu.clone = Cu.clone, eu.fromValues = Cu.fromValues, eu.copy = Cu.copy, eu.set = Cu.set, eu.add = Cu.add, eu.mul = Fu; var qu = Cu.scale; eu.scale = qu; var Gu = Cu.dot; eu.dot = Gu, eu.lerp = Cu.lerp; var Yu = Cu.length; eu.length = Yu, eu.len = Yu; var Zu = Cu.squaredLength; eu.squaredLength = Zu, eu.sqrLen = Zu; var Xu = Cu.normalize; eu.normalize = Xu, eu.exactEquals = Cu.exactEquals, eu.equals = Cu.equals; var Ku, Wu, Hu, Ju = (Ku = Du.create(), Wu = Du.fromValues(1, 0, 0), Hu = Du.fromValues(0, 1, 0), function (t, e, r) { var n = Du.dot(e, r); return n < -.999999 ? (Du.cross(Ku, Wu, e), Du.len(Ku) < 1e-6 && Du.cross(Ku, Hu, e), Du.normalize(Ku, Ku), Ou(t, Ku, Math.PI), t) : n > .999999 ? (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t) : (Du.cross(Ku, e, r), t[0] = Ku[0], t[1] = Ku[1], t[2] = Ku[2], t[3] = 1 + n, Xu(t, t)) });
33 eu.rotationTo = Ju; var Qu, tc, ec = (Qu = Vu(), tc = Vu(), function (t, e, r, n, i, s) { return Nu(Qu, e, i, s), Nu(tc, r, n, s), Nu(t, Qu, tc, 2 * s * (1 - s)), t }); eu.sqlerp = ec; var rc, nc = (rc = Bu.create(), function (t, e, r, n) { return rc[0] = r[0], rc[3] = r[1], rc[6] = r[2], rc[1] = n[0], rc[4] = n[1], rc[7] = n[2], rc[2] = -e[0], rc[5] = -e[1], rc[8] = -e[2], Xu(t, $u(t, rc)) }); eu.setAxes = nc; var ic = {}; function sc(t) { return sc = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, sc(t) } Object.defineProperty(ic, "__esModule", { value: !0 }), ic.create = function () { var t = new ac.ARRAY_TYPE(8); return ac.ARRAY_TYPE != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[3] = 1, t }, ic.clone = function (t) { var e = new ac.ARRAY_TYPE(8); 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 }, ic.fromValues = function (t, e, r, n, i, s, a, o) { var l = new ac.ARRAY_TYPE(8); return l[0] = t, l[1] = e, l[2] = r, l[3] = n, l[4] = i, l[5] = s, l[6] = a, l[7] = o, l }, ic.fromRotationTranslationValues = function (t, e, r, n, i, s, a) { var o = new ac.ARRAY_TYPE(8); o[0] = t, o[1] = e, o[2] = r, o[3] = n; var l = .5 * i, u = .5 * s, c = .5 * a; return o[4] = l * n + u * r - c * e, o[5] = u * n + c * t - l * r, o[6] = c * n + l * e - u * t, o[7] = -l * t - u * e - c * r, o }, ic.fromRotationTranslation = hc, ic.fromTranslation = function (t, e) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = .5 * e[0], t[5] = .5 * e[1], t[6] = .5 * e[2], t[7] = 0, t }, ic.fromRotation = function (t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0, t }, ic.fromMat4 = function (t, e) { var r = oc.create(); lc.getRotation(r, e); var n = new ac.ARRAY_TYPE(3); return lc.getTranslation(n, e), hc(t, r, n), t }, ic.copy = pc, ic.identity = function (t) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0, t }, ic.set = function (t, e, r, n, i, s, a, o, l) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = s, t[5] = a, t[6] = o, t[7] = l, t }, ic.getDual = function (t, e) { return t[0] = e[4], t[1] = e[5], t[2] = e[6], t[3] = e[7], t }, ic.setDual = function (t, e) { return t[4] = e[0], t[5] = e[1], t[6] = e[2], t[7] = e[3], t }, ic.getTranslation = function (t, e) { var r = e[4], n = e[5], i = e[6], s = e[7], a = -e[0], o = -e[1], l = -e[2], u = e[3]; return t[0] = 2 * (r * u + s * a + n * l - i * o), t[1] = 2 * (n * u + s * o + i * a - r * l), t[2] = 2 * (i * u + s * l + r * o - n * a), t }, ic.translate = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = .5 * r[0], l = .5 * r[1], u = .5 * r[2], c = e[4], h = e[5], p = e[6], f = e[7]; return t[0] = n, t[1] = i, t[2] = s, t[3] = a, t[4] = a * o + i * u - s * l + c, t[5] = a * l + s * o - n * u + h, t[6] = a * u + n * l - i * o + p, t[7] = -n * o - i * l - s * u + f, t }, ic.rotateX = function (t, e, r) { var n = -e[0], i = -e[1], s = -e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = o * a + c * n + l * s - u * i, p = l * a + c * i + u * n - o * s, f = u * a + c * s + o * i - l * n, d = c * a - o * n - l * i - u * s; return oc.rotateX(t, e, r), t[4] = h * (a = t[3]) + d * (n = t[0]) + p * (s = t[2]) - f * (i = t[1]), t[5] = p * a + d * i + f * n - h * s, t[6] = f * a + d * s + h * i - p * n, t[7] = d * a - h * n - p * i - f * s, t }, ic.rotateY = function (t, e, r) { var n = -e[0], i = -e[1], s = -e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = o * a + c * n + l * s - u * i, p = l * a + c * i + u * n - o * s, f = u * a + c * s + o * i - l * n, d = c * a - o * n - l * i - u * s; return oc.rotateY(t, e, r), t[4] = h * (a = t[3]) + d * (n = t[0]) + p * (s = t[2]) - f * (i = t[1]), t[5] = p * a + d * i + f * n - h * s, t[6] = f * a + d * s + h * i - p * n, t[7] = d * a - h * n - p * i - f * s, t }, ic.rotateZ = function (t, e, r) { var n = -e[0], i = -e[1], s = -e[2], a = e[3], o = e[4], l = e[5], u = e[6], c = e[7], h = o * a + c * n + l * s - u * i, p = l * a + c * i + u * n - o * s, f = u * a + c * s + o * i - l * n, d = c * a - o * n - l * i - u * s; return oc.rotateZ(t, e, r), t[4] = h * (a = t[3]) + d * (n = t[0]) + p * (s = t[2]) - f * (i = t[1]), t[5] = p * a + d * i + f * n - h * s, t[6] = f * a + d * s + h * i - p * n, t[7] = d * a - h * n - p * i - f * s, t }, ic.rotateByQuatAppend = function (t, e, r) { var n = r[0], i = r[1], s = r[2], a = r[3], o = e[0], l = e[1], u = e[2], c = e[3]; return t[0] = o * a + c * n + l * s - u * i, t[1] = l * a + c * i + u * n - o * s, t[2] = u * a + c * s + o * i - l * n, t[3] = c * a - o * n - l * i - u * s, t[4] = (o = e[4]) * a + (c = e[7]) * n + (l = e[5]) * s - (u = e[6]) * i, t[5] = l * a + c * i + u * n - o * s, t[6] = u * a + c * s + o * i - l * n, t[7] = c * a - o * n - l * i - u * s, t }, ic.rotateByQuatPrepend = function (t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = r[0], l = r[1], u = r[2], c = r[3]; return t[0] = n * c + a * o + i * u - s * l, t[1] = i * c + a * l + s * o - n * u, t[2] = s * c + a * u + n * l - i * o, t[3] = a * c - n * o - i * l - s * u, t[4] = n * (c = r[7]) + a * (o = r[4]) + i * (u = r[6]) - s * (l = r[5]
33), t[5] = i * c + a * l + s * o - n * u, t[6] = s * c + a * u + n * l - i * o, t[7] = a * c - n * o - i * l - s * u, t }, ic.rotateAroundAxis = function (t, e, r, n) { if (Math.abs(n) < ac.EPSILON) return pc(t, e); var i = Math.hypot(r[0], r[1], r[2]); n *= .5; var s = Math.sin(n), a = s * r[0] / i, o = s * r[1] / i, l = s * r[2] / i, u = Math.cos(n), c = e[0], h = e[1], p = e[2], f = e[3]; t[0] = c * u + f * a + h * l - p * o, t[1] = h * u + f * o + p * a - c * l, t[2] = p * u + f * l + c * o - h * a, t[3] = f * u - c * a - h * o - p * l; var d = e[4], m = e[5], y = e[6], g = e[7]; return t[4] = d * u + g * a + m * l - y * o, t[5] = m * u + g * o + y * a - d * l, t[6] = y * u + g * l + d * o - m * a, t[7] = g * u - d * a - m * o - y * l, t }, ic.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t }, ic.multiply = fc, ic.scale = function (t, e, r) { 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] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t }, ic.lerp = function (t, e, r, n) { var i = 1 - n; return dc(e, r) < 0 && (n = -n), t[0] = e[0] * i + r[0] * n, t[1] = e[1] * i + r[1] * n, t[2] = e[2] * i + r[2] * n, t[3] = e[3] * i + r[3] * n, t[4] = e[4] * i + r[4] * n, t[5] = e[5] * i + r[5] * n, t[6] = e[6] * i + r[6] * n, t[7] = e[7] * i + r[7] * n, t }, ic.invert = function (t, e) { var r = yc(e); 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] / r, t[5] = -e[5] / r, t[6] = -e[6] / r, t[7] = e[7] / r, t }, ic.conjugate = function (t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = e[7], t }, ic.normalize = function (t, e) { var r = yc(e); if (r > 0) { r = Math.sqrt(r); var n = e[0] / r, i = e[1] / r, s = e[2] / r, a = e[3] / r, o = e[4], l = e[5], u = e[6], c = e[7], h = n * o + i * l + s * u + a * c; t[0] = n, t[1] = i, t[2] = s, t[3] = a, t[4] = (o - n * h) / r, t[5] = (l - i * h) / r, t[6] = (u - s * h) / r, t[7] = (c - a * h) / r; } return t }, ic.str = function (t) { return "quat2(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ")" }, ic.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] }, ic.equals = function (t, e) { var r = t[0], n = t[1], i = t[2], s = t[3], a = t[4], o = t[5], l = t[6], u = t[7], c = e[0], h = e[1], p = e[2], f = e[3], d = e[4], m = e[5], y = e[6], g = e[7]; return Math.abs(r - c) <= ac.EPSILON * Math.max(1, Math.abs(r), Math.abs(c)) && Math.abs(n - h) <= ac.EPSILON * Math.max(1, Math.abs(n), Math.abs(h)) && Math.abs(i - p) <= ac.EPSILON * Math.max(1, Math.abs(i), Math.abs(p)) && Math.abs(s - f) <= ac.EPSILON * Math.max(1, Math.abs(s), Math.abs(f)) && Math.abs(a - d) <= ac.EPSILON * Math.max(1, Math.abs(a), Math.abs(d)) && Math.abs(o - m) <= ac.EPSILON * Math.max(1, Math.abs(o), Math.abs(m)) && Math.abs(l - y) <= ac.EPSILON * Math.max(1, Math.abs(l), Math.abs(y)) && Math.abs(u - g) <= ac.EPSILON * Math.max(1, Math.abs(u), Math.abs(g)) }, ic.sqrLen = ic.squaredLength = ic.len = ic.length = ic.dot = ic.mul = ic.setReal = ic.getReal = void 0; var ac = cc(_l), oc = cc(eu), lc = cc(ql); function uc(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (uc = function (t) { return t ? r : e })(t) } function cc(t, e) { if (!e && t && t.__esModule) return t; if (null === t || "object" !== sc(t) && "function" != typeof t) return { default: t }; var r = uc(e); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n } function hc(t, e, r) { var n = .5 * r[0], i = .5 * r[1], s = .5 * r[2], a = e[0], o = e[1], l = e[2], u = e[3]; return t[0] = a, t[1] = o, t[2] = l, t[3] = u, t[4] = n * u + i * l - s * o, t[5] = i * u + s * a - n * l, t[6] = s * u + n * o - i * a, t[7] = -n * a - i * o - s * l, t } function pc(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t } function fc(t, e, r) { var n = e[0], i = e[1], s = e[2], a = e[3], o = r[4], l = r[5], u = r[6], c = r[7], h = e[4], p = e[5], f = e[6], d = e[7], m = r[0], y = r[1], g = r[2], x = r[3]; return t[0] = n * x + a * m + i * g - s * y, t[1] = i * x + a * y + s * m - n * g, t[2] = s * x + a * g + n * y - i * m, t[3] = a * x - n * m - i * y - s * g, t[4] = n * c + a * o + i * u - s * l + h * x + d * m + p * g - f * y, t[5] = i * c + a * l + s * o - n * u + p * x + d * y + f * m - h * g, t[6] = s * c + a * u + n * l - i * o + f * x + d * g + h * y - p * m, t[7] = a * c - n * o - i * l - s * u + d * x - h * m - p * y - f * g, t } ic.getReal = oc.copy, ic.setReal = oc.copy, ic.mul = fc; var dc = oc.dot; ic.dot = dc; var mc = oc.length; ic.length = mc, ic.len = mc; var yc = oc.squaredLength; ic.squaredLength = yc, ic.sqrLen = yc; var gc = {}; function xc(t) { return xc = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, xc(t) } Object.defineProperty(gc, "__esModule", { value: !0 }), gc.create = _c, gc.clone = function (t) { var e = new vc.ARRAY_TYPE(2); return e[0] = t[0], e[1] = t[1], e }, gc.fromValues = function (t, e) { var r = new vc.ARRAY_TYPE(2); return r[0] = t, r[1] = e, r }, gc.copy = function (t, e) { return t[0] = e[0], t[1] = e[1], t }, gc.set = function (t, e, r) { return t[0] = e, t[1] = r, t }, gc.add = function (t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t }, gc.subtract = wc, gc.multiply = Mc, gc.divide = Ac, gc.ceil = function (t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t }, gc.floor = function (t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t }, gc.min = function (t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t }, gc.max = function (t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t }
33, gc.round = function (t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t }, gc.scale = function (t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t }, gc.scaleAndAdd = function (t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t }, gc.distance = Sc, gc.squaredDistance = Ic, gc.length = kc, gc.squaredLength = Tc, gc.negate = function (t, e) { return t[0] = -e[0], t[1] = -e[1], t }, gc.inverse = function (t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t }, gc.normalize = function (t, e) { var r = e[0], n = e[1], i = r * r + n * n; return i > 0 && (i = 1 / Math.sqrt(i)), t[0] = e[0] * i, t[1] = e[1] * i, t }, gc.dot = function (t, e) { return t[0] * e[0] + t[1] * e[1] }, gc.cross = function (t, e, r) { var n = e[0] * r[1] - e[1] * r[0]; return t[0] = t[1] = 0, t[2] = n, t }, gc.lerp = function (t, e, r, n) { var i = e[0], s = e[1]; return t[0] = i + n * (r[0] - i), t[1] = s + n * (r[1] - s), t }, gc.random = function (t, e) { e = e || 1; var r = 2 * vc.RANDOM() * Math.PI; return t[0] = Math.cos(r) * e, t[1] = Math.sin(r) * e, t }, gc.transformMat2 = function (t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[2] * i, t[1] = r[1] * n + r[3] * i, t }, gc.transformMat2d = function (t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[2] * i + r[4], t[1] = r[1] * n + r[3] * i + r[5], t }, gc.transformMat3 = function (t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[3] * i + r[6], t[1] = r[1] * n + r[4] * i + r[7], t }, gc.transformMat4 = function (t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[4] * i + r[12], t[1] = r[1] * n + r[5] * i + r[13], t }, gc.rotate = function (t, e, r, n) { var i = e[0] - r[0], s = e[1] - r[1], a = Math.sin(n), o = Math.cos(n); return t[0] = i * o - s * a + r[0], t[1] = i * a + s * o + r[1], t }, gc.angle = function (t, e) { var r = t[0], n = t[1], i = e[0], s = e[1], a = Math.sqrt(r * r + n * n) * Math.sqrt(i * i + s * s); return Math.acos(Math.min(Math.max(a && (r * i + n * s) / a, -1), 1)) }, gc.zero = function (t) { return t[0] = 0, t[1] = 0, t }, gc.str = function (t) { return "vec2(" + t[0] + ", " + t[1] + ")" }, gc.exactEquals = function (t, e) { return t[0] === e[0] && t[1] === e[1] }, gc.equals = function (t, e) { var r = t[0], n = t[1], i = e[0], s = e[1]; return Math.abs(r - i) <= vc.EPSILON * Math.max(1, Math.abs(r), Math.abs(i)) && Math.abs(n - s) <= vc.EPSILON * Math.max(1, Math.abs(n), Math.abs(s)) }, gc.forEach = gc.sqrLen = gc.sqrDist = gc.dist = gc.div = gc.mul = gc.sub = gc.len = void 0; var vc = function (t, e) { if (t && t.__esModule) return t; if (null === t || "object" !== xc(t) && "function" != typeof t) return { default: t }; var r = bc(void 0); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n }(_l); function bc(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (bc = function (t) { return t ? r : e })(t) } function _c() { var t = new vc.ARRAY_TYPE(2); return vc.ARRAY_TYPE != Float32Array && (t[0] = 0, t[1] = 0), t } function wc(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t } function Mc(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t } function Ac(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t } function Sc(t, e) { return Math.hypot(e[0] - t[0], e[1] - t[1]) } function Ic(t, e) { var r = e[0] - t[0], n = e[1] - t[1]; return r * r + n * n } function kc(t) { return Math.hypot(t[0], t[1]) } function Tc(t) { var e = t[0], r = t[1]; return e * e + r * r } gc.len = kc, gc.sub = wc, gc.mul = Mc, gc.div = Ac, gc.dist = Sc, gc.sqrDist = Ic, gc.sqrLen = Tc; var Pc = function () { var t = _c(); return function (e, r, n, i, s, a) { var o, l; for (r || (r = 2), n || (n = 0), l = i ? Math.min(i * r + n, e.length) : e.length, o = n; o < l; o += r)t[0] = e[o], t[1] = e[o + 1], s(t, t, a), e[o] = t[0], e[o + 1] = t[1]; return e } }(); function zc(t) { return zc = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, zc(t) }
33 gc.forEach = Pc, Object.defineProperty(bl, "__esModule", { value: !0 }), t.e = bl.vec4 = t.v = bl.vec3 = bl.vec2 = bl.quat2 = t.q = bl.quat = t.m = bl.mat4 = t.bx = bl.mat3 = bl.mat2d = t.h = bl.mat2 = bl.glMatrix = void 0; var Ec = Nc(_l); bl.glMatrix = Ec; var Bc = Nc(Il); t.h = bl.mat2 = Bc; var Dc = Nc(Bl); bl.mat2d = Dc; var Cc = Nc(Ol); t.bx = bl.mat3 = Cc; var Rc = Nc(ql); t.m = bl.mat4 = Rc; var Lc = Nc(eu); t.q = bl.quat = Lc; var Vc = Nc(ic); bl.quat2 = Vc; var Oc = Nc(gc); bl.vec2 = Oc; var Fc = Nc(ru); t.v = bl.vec3 = Fc; var jc = Nc(gu); function Uc(t) { if ("function" != typeof WeakMap) return null; var e = new WeakMap, r = new WeakMap; return (Uc = function (t) { return t ? r : e })(t) } function Nc(t, e) { if (!e && t && t.__esModule) return t; if (null === t || "object" !== zc(t) && "function" != typeof t) return { default: t }; var r = Uc(e); if (r && r.has(t)) return r.get(t); var n = {}, i = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in t) if ("default" !== s && Object.prototype.hasOwnProperty.call(t, s)) { var a = i ? Object.getOwnPropertyDescriptor(t, s) : null; a && (a.get || a.set) ? Object.defineProperty(n, s, a) : n[s] = t[s]; } return n.default = t, r && r.set(t, n), n } t.e = bl.vec4 = jc; const $c = Ua([{ type: "Float32", name: "a_globe_pos", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }]), { members: qc } = $c, Gc = Ua([{ name: "a_pos_3", components: 3, type: "Int16" }]); var Yc = Ua([{ name: "a_pos", type: "Int16", components: 2 }]), Zc = {}; !function (t, e) { !function (t) { function e(t, e, n) { var i = r(256 * t, 256 * (e = Math.pow(2, n) - e - 1), n), s = r(256 * (t + 1), 256 * (e + 1), n); return i[0] + "," + i[1] + "," + s[0] + "," + s[1] } function r(t, e, r) { var n = 2 * Math.PI * 6378137 / 256 / Math.pow(2, r); return [t * n - 2 * Math.PI * 6378137 / 2, e * n - 2 * Math.PI * 6378137 / 2] } t.getURL = function (t, r, n, i, s, a) { return a = a || {}, t + "?" + ["bbox=" + e(n, i, s), "format=" + (a.format || "image/png"), "service=" + (a.service || "WMS"), "version=" + (a.version || "1.1.1"), "request=" + (a.request || "GetMap"), "srs=" + (a.srs || "EPSG:3857"), "width=" + (a.width || 256), "height=" + (a.height || 256), "layers=" + r].join("&") }, t.getTileBBox = e, t.getMercCoords = r, Object.defineProperty(t, "__esModule", { value: !0 }); }(e); }(0, Zc); var Xc = Zc; class Kc { constructor(t, e, r) { this.z = t, this.x = e, this.y = r, this.key = Jc(0, t, t, e, r); } equals(t) { return this.z === t.z && this.x === t.x && this.y === t.y } url(t, e) { const r = Xc.getTileBBox(this.x, this.y, this.z), n = function (t, e, r) { let n, i = ""; for (let s = t; s > 0; s--)n = 1 << s - 1, i += (e & n ? 1 : 0) + (r & n ? 2 : 0); return i }(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}", n).replace("{bbox-epsg-3857}", r) } toString() { return `${this.z}/${this.x}/${this.y}` } } class Wc { constructor(t, e) { this.wrap = t, this.canonical = e, this.key = Jc(t, e.z, e.z, e.x, e.y); } } class Hc { constructor(t, e, r, n, i) { this.overscaledZ = t, this.wrap = e, this.canonical = new Kc(r, +n, +i), this.key = 0 === e && t === r ? this.canonical.key : Jc(e, t, r, n, i); } 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 Hc(t, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new Hc(t, this.wrap, t, this.canonical.x >> e, this.canonical.y >> e) } calculateScaledKey(t, e = !0) { if (this.overscaledZ === t && e) return this.key; if (t > this.canonical.z) return Jc(this.wrap * +e, t, this.canonical.z, this.canonical.x, this.canonical.y); { const r = this.canonical.z - t; return Jc(this.wrap * +e, t, t, this.canonical.x >> r, this.canonical.y >> r) } } 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.z < this.canonical.z && t.canonical.x === this.canonical.x >> e && t.canonical.y === this.canonical.y >> e } children(t) { if (this.overscaledZ >= t) return [new Hc(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)]; const e = this.canonical.z + 1, r = 2 * this.canonical.x, n = 2 * this.canonical.y; return [new Hc(e, this.wrap, e, r, n), new Hc(e, this.wrap, e, r + 1, n), new Hc(e, this.wrap, e, r, n + 1), new Hc(e, this.wrap, e, r + 1, n + 1)] } isLessThan(t) { return this.wrap < t.wrap || !(this.wrap > t.wrap) && (this.overscaledZ < t.overscaledZ || !(this.overscaledZ >
vendor: 4,829 bytes, line 33
33 t.overscaledZ) && (this.canonical.x < t.canonical.x || !(this.canonical.x > t.canonical.x) && this.canonical.y < t.canonical.y)) } wrapped() { return new Hc(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y) } unwrapTo(t) { return new Hc(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 Wc(this.wrap, this.canonical) } toString() { return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}` } } function Jc(t, e, r, n, i) { const s = 1 << Math.min(r, 22); let a = s * (i % s) + n % s; return t && r < 22 && (a += s * s * ((t < 0 ? -2 * t - 1 : 2 * t) % (1 << 2 * (22 - r)))), 16 * (32 * a + r) + (e - r) } const Qc = [t => { let e = t.canonical.x - 1, r = t.wrap; return e < 0 && (e = (1 << t.canonical.z) - 1, r--), new Hc(t.overscaledZ, r, t.canonical.z, e, t.canonical.y) }, t => { let e = t.canonical.x + 1, r = t.wrap; return e === 1 << t.canonical.z && (e = 0, r++), new Hc(t.overscaledZ, r, t.canonical.z, e, t.canonical.y) }, t => new Hc(t.overscaledZ, t.wrap, t.canonical.z, t.canonical.x, (0 === t.canonical.y ? 1 << t.canonical.z : t.canonical.y) - 1), t => new Hc(t.overscaledZ, t.wrap, t.canonical.z, t.canonical.x, t.canonical.y === (1 << t.canonical.z) - 1 ? 0 : t.canonical.y + 1)]; Ks(Kc, "CanonicalTileID"), Ks(Hc, "OverscaledTileID", { omit: ["projMatrix", "expandedProjMatrix"] }); class th { constructor(t, e) { this.pos = t, this.dir = e; } intersectsPlane(e, r, n) { const i = t.v.dot(r, this.dir); if (Math.abs(i) < 1e-6) return !1; const s = ((e[0] - this.pos[0]) * r[0] + (e[1] - this.pos[1]) * r[1] + (e[2] - this.pos[2]) * r[2]) / i; return n[0] = this.pos[0] + this.dir[0] * s, n[1] = this.pos[1] + this.dir[1] * s, n[2] = this.pos[2] + this.dir[2] * s, !0 } closestPointOnSphere(e, r, n) { if (t.v.equals(this.pos, e) || 0 === r) return n[0] = n[1] = n[2] = 0, !1; const [i, s, a] = this.dir, o = this.pos[0] - e[0], l = this.pos[1] - e[1], u = this.pos[2] - e[2], c = i * i + s * s + a * a, h = 2 * (o * i + l * s + u * a), p = h * h - 4 * c * (o * o + l * l + u * u - r * r); if (p < 0) { const t = Math.max(-h / 2, 0), e = o + i * t, c = l + s * t, p = u + a * t, f = Math.hypot(e, c, p); return n[0] = e * r / f, n[1] = c * r / f, n[2] = p * r / f, !1 } { const t = (-h - Math.sqrt(p)) / (2 * c); if (t < 0) { const t = Math.hypot(o, l, u); return n[0] = o * r / t, n[1] = l * r / t, n[2] = u * r / t, !1 } return n[0] = o + i * t, n[1] = l + s * t, n[2] = u + a * t, !0 } } } class eh { constructor(t, e, r, n, i) { this.TL = t, this.TR = e, this.BR = r, this.BL = n, this.horizon = i; } static fromInvProjectionMatrix(e, r, n) { const i = [-1, 1, 1], s = [1, 1, 1], a = [1, -1, 1], o = [-1, -1, 1], l = t.v.transformMat4(i, i, e), u = t.v.transformMat4(s, s, e), c = t.v.transformMat4(a, a, e), h = t.v.transformMat4(o, o, e); return new eh(l, u, c, h, r / n) } } function rh(e, r, n) { let i = 1 / 0, s = -1 / 0; const a = []; for (const o of e) { t.v.sub(a, o, r); const e = t.v.dot(a, n); i = Math.min(i, e), s = Math.max(s, e); } return [i, s] } function nh(e, r) { let n = !0; for (let i = 0; i < e.planes.length; i++) { const s = e.planes[i]; let a = 0; for (let e = 0; e < r.length; e++)a += t.v.dot(s, r[e]) + s[3] >= 0; if (0 === a) return 0; a !== r.length && (n = !1); } return n ? 2 : 1 } function ih(t, e) { for (const r of t.projections) { const n = rh(e, t.points[0], r.axis); if (r.projection[1] < n[0] || r.projection[0] > n[1]) return 0 } return 1 } function sh(e, r) { let n = 0; const i = [0, 0, 0, 0]; for (let s = 0; s < e.length; s++)i[0] = e[s][0], i[1] = e[s][1], i[2] = e[s][2], i[3] = 1, t.e.dot(i, r) >= 0 && n++; return n } class ah { constructor(e, r) { this.points = e || new Array(8).fill([0, 0, 0]), this.planes = r || new Array(6).fill([0, 0, 0, 0]), this.bounds = oh.fromPoints(this.points), this.projections = [], this.frustumEdges = [t.v.sub([], this.points[2], this.points[3]), t.v.sub([], this.points[0], this.points[3]), t.v.sub([], this.points[4], this.points[0]), t.v.sub([], this.points[5], this.points[1]), t.v.sub([], this.points[6], this.points[2]), t.v.sub([], this.points[7], this.points[3])]; for (const t of this.frustumEdges) { const e = [0, -t[2], t[1]], r = [t[2], 0, -t[0]]; this.projections.push({ axis: e, projection: rh(this.points, this.points[0], e) }), this.projections.push({ axis: r, projection: rh(this.points, this.points[0], r) }); } } static fromInvProjectionMatrix(e, r, n, i) { const s = Math.pow(2, n), a = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]].map((n => { const a = t.e.transformMat4([], n, e), o = 1 / a[3] / r * s; return t.e.mul(a, a, [o, o, i ? 1 / a[3] : o, o]) }
33)), o = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((e => { const r = t.v.sub([], a[e[0]], a[e[1]]), n = t.v.sub([], a[e[2]], a[e[1]]), i = t.v.normalize([], t.v.cross([], r, n)), s = -t.v.dot(i, a[e[1]]); return i.concat(s) })), l = []; for (let t = 0; t < a.length; t++)l.push([a[t][0], a[t][1], a[t][2]]); return new ah(l, o) } intersectsPrecise(e, r, n) { for (let t = 0; t < r.length; t++)if (!sh(e, r[t])) return 0; for (let t = 0; t < this.planes.length; t++)if (!sh(e, this.planes[t])) return 0; for (const r of n) for (const n of this.frustumEdges) { const i = t.v.cross([], r, n), s = t.v.length(i); if (0 === s) continue; t.v.scale(i, i, 1 / s); const a = rh(this.points, this.points[0], i), o = rh(e, this.points[0], i); if (a[0] > o[1] || o[0] > a[1]) return 0 } return 1 } } class oh { static fromPoints(e) { const r = [1 / 0, 1 / 0, 1 / 0], n = [-1 / 0, -1 / 0, -1 / 0]; for (const i of e) t.v.min(r, r, i), t.v.max(n, n, i); return new oh(r, n) } static fromTileIdAndHeight(t, e, r) { const n = 1 << t.canonical.z, i = t.canonical.x, s = t.canonical.y; return new oh([i / n, s / n, e], [(i + 1) / n, (s + 1) / n, r]) } static applyTransform(e, r) { const n = e.getCorners(); for (let e = 0; e < n.length; ++e)t.v.transformMat4(n[e], n[e], r); return oh.fromPoints(n) } static projectAabbCorners(e, r) { const n = e.getCorners(); for (let e = 0; e < n.length; ++e)t.v.transformMat4(n[e], n[e], r); return n } constructor(e, r) { this.min = e, this.max = r, this.center = t.v.scale([], t.v.add([], this.min, this.max), .5); } quadrant(e) { const r = [e % 2 == 0, e < 2], n = t.v.clone(this.min), i = t.v.clone(this.max); for (let t = 0; t < r.length; t++)n[t] = r[t] ? this.min[t] : this.center[t], i[t] = r[t] ? this.center[t] : this.max[t]; return i[2] = this.max[2], new oh(n, i) } 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) { return this.intersectsAabb(t.bounds) ? nh(t, this.getCorners()) : 0 } intersectsFlat(t) { return this.intersectsAabb(t.bounds) ? nh(t, [[this.min[0], this.min[1], 0], [this.max[0], this.min[1], 0], [this.max[0], this.max[1], 0], [this.min[0], this.max[1], 0]]) : 0 } intersectsPrecise(t, e) { return e || this.intersects(t) ? ih(t, this.getCorners()) : 0 } intersectsPreciseFlat(t, e) { return e || this.intersectsFlat(t) ? ih(t, [[this.min[0], this.min[1], 0], [this.max[0], this.min[1], 0], [this.max[0], this.max[1], 0], [this.min[0], this.max[1], 0]]) : 0 } intersectsAabb(t) { for (let e = 0; e < 3; ++e)if (this.min[e] > t.max[e] || t.min[e] > this.max[e]) return !1; return !0 } intersectsAabbXY(t) { return !(this.min[0] > t.max[0] || t.min[0] > this.max[0] || this.min[1] > t.max[1] || t.min[1] > this.max[1]) } encapsulate(t) { for (let e = 0; e < 3; e++)this.min[e] = Math.min(this.min[e], t.min[e]), this.max[e] = Math.max(this.max[e], t.max[e]); } encapsulatePoint(t) { for (let e = 0; e < 3; e++)this.min[e] = Math.min(this.min[e], t[e]), this.max[e] = Math.max(this.max[e], t[e]); } closestPoint(t) { return [Math.max(Math.min(this.max[0], t[0]), this.min[0]), Math.max(Math.min(this.max[1], t[1]), this.min[1]), Math.max(Math.min(this.max[2], t[2]), this.min[2])] } } Ks(oh, "Aabb"); const lh = 5, uh = 6, ch = Cr / Math.PI / 2, hh = 16383, ph = 64, fh = [ph, 32, 16], dh = -ch, mh = ch, yh = [new oh([dh, dh, dh], [mh, mh, mh]), new oh([dh, dh, dh], [0, 0, mh]), new oh([0, dh, dh], [mh, 0, mh]), new oh([dh, 0, dh], [0, mh, mh]), new oh([0, 0, dh], [mh, mh, mh])]; function gh(t) { return t * ch / qh } function xh(e, r, n, i = !0) { const s = t.v.scale([], e._camera.position, e.worldSize), a = [r, n, 1, 1]; t.e.transformMat4(a, a, e.pixelMatrixInverse), t.e.scale(a, a, 1 / a[3]); const o = t.v.sub([], a, s), l = t.v.normalize([], o), u = e.globeMatrix, c = [u[12], u[13], u[14]], h = t.v.sub([], c, s), p = t.v.length(h), f = t.v.normalize([], h), d = e.worldSize / (2 * Math.PI), m = t.v.dot(f, l), y = Math.asin(d / p); if (y < Math.acos(m)) { if (!i) return null; const e = [], r = []; t.v.scale(e, l, p / m), t.v.normalize(r, t.v.sub(r, e, h)), t.v.normalize(l, t.v.add(l, h, t.v.scale(l, r, Math.tan(y) * p))); } const g = []; new th(s, l).closestPointOnSphere(c, d, g); const x = t.v.normalize([], J(u, 0)), v = t.v.normalize([], J(u, 1)), b = t.v.normalize([], J(u, 2)), _ = t.v.dot(x, g), M = t.v.dot(v, g), A = t.v.dot(b, g), S = w(Math.asin(-M / d)); let I = w(Math.atan2(_, A)); I = e.center.lng + function (t, e) { const r = (e - t + 180) % 360 - 180; return r < -180 ? r + 360 : r }(e.center.lng, I); const T = Hh(I), P = k(Jh(S), 0, 1); return new lp(T, P) } class vh { constructor(e, r, n) { this.a = t.v.sub([], e, n), this.b = t.v.sub([], r, n), this.center = n; const i = t.v.normalize([], this.a), s = t.v.normalize([], this.b); this.angle = Math.acos(t.v.dot(i, s)); } } function bh(t, e) { if (0 === t.angle) return null; let r; return r = 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)), r < 0 || r > 1 ? null : function (t, e, r, n) { const i = Math.sin(r); return t * (Math.sin((1 - n) * r) / i) + e * (Math.sin(n * r) / i) }(t.a[e], t.b[e], t.angle, k(r, 0, 1)) + t.center[e] } function _h(t) { if (t.z <= 1) return yh[t.z + 2 * t.y + t.x]; const e = kh(Ih(t)); return oh.fromPoints(e) } function wh(e, r, n) { return t.v.scale(e, e, 1 - n), t.v.scaleAndAdd(e, e, r, n) } function Mh(e, r) { const n = Oh(r.zoom); if (0 === n) return _h(e); const i = Ih(e), s = kh(i), a = Hh(i.getWest()) * r.worldSize, o = Hh(i.getEast()) * r.worldSize, l = Jh(i.getNorth()) * r.worldSize, u = Jh(i.getSouth()) * r.worldSize, c = [a, l, 0], h = [o, l, 0], p = [a, u, 0], f = [o, u, 0], d = t.m.invert([], r.globeMatrix); return t.v.transformMat4(c, c, d), t.v.transformMat4(h, h, d), t.v.transformMat4(p, p, d), t.v.transformMat4(f, f, d), s[0] = wh(s[0], p, n), s[1] = wh(s[1], f, n), s[2] = wh(s[2], h, n), s[3] = wh(s[3], c, n), oh.fromPoints(s) } function Ah(e, r, n) { for (const i of e) t.v.transformMat4(i, i, r), t.v.scale(i, i, n); } function Sh(e, r, n, i) { const s = r / e.worldSize, a = e.globeMatrix; if (n.z <= 1) { const t = _h(n).getCorners(); return Ah(t, a, s), oh.fromPoints(t) } const o = Ih(n, i), l = kh(o); Ah(l, a, s);
33 const u = Number.MAX_VALUE, c = [-u, -u, -u], h = [u, u, u]; if (o.contains(e.center)) { for (const e of l) t.v.min(h, h, e), t.v.max(c, c, e); c[2] = 0; const r = e.point, n = [r.x * s, r.y * s, 0]; return t.v.min(h, h, n), t.v.max(c, c, n), new oh(h, c) } const p = [a[12] * s, a[13] * s, a[14] * s], f = o.getCenter(), d = k(e.center.lat, -np, np), m = k(f.lat, -np, np), y = Hh(e.center.lng), g = Jh(d); let x = y - Hh(f.lng); const v = g - Jh(m); x > .5 ? x -= 1 : x < -.5 && (x += 1); let b = 0; if (Math.abs(x) > Math.abs(v)) b = x >= 0 ? 1 : 3; else { b = v >= 0 ? 0 : 2; const e = [a[4] * s, a[5] * s, a[6] * s], r = -Math.sin(_(v >= 0 ? o.getSouth() : o.getNorth())) * ch; t.v.scaleAndAdd(p, p, e, r); } const w = l[b], M = l[(b + 1) % 4], A = new vh(w, M, p), S = [bh(A, 0) || w[0], bh(A, 1) || w[1], bh(A, 2) || w[2]], I = Oh(e.zoom); if (I > 0) { const i = function ({ x: t, y: e, z: r }, n, i, s, a) { const o = 1 / (1 << r); let l = t * o, u = l + o, c = e * o, h = c + o, p = 0; const f = (l + u) / 2 - s; return f > .5 ? p = -1 : f < -.5 && (p = 1), l = ((l + p) * n - (s *= n)) * i + s, u = ((u + p) * n - s) * i + s, c = (c * n - (a *= n)) * i + a, h = (h * n - a) * i + a, [[l, h, 0], [u, h, 0], [u, c, 0], [l, c, 0]] }(n, r, e._pixelsPerMercatorPixel, y, g); for (let t = 0; t < l.length; t++)wh(l[t], i[t], I); const s = t.v.add([], i[b], i[(b + 1) % 4]); t.v.scale(s, s, .5), wh(S, s, I); } for (const e of l) t.v.min(h, h, e), t.v.max(c, c, e); return h[2] = Math.min(w[2], M[2]), t.v.min(h, h, S), t.v.max(c, c, S), new oh(h, c) } function Ih({ x: t, y: e, z: r }, n = !1) { const i = 1 / (1 << r), s = new Zh(tp(t * i), e === (1 << r) - 1 && n ? -90 : ep((e + 1) * i)), a = new Zh(tp((t + 1) * i), 0 === e && n ? 90 : ep(e * i)); return new vl(s, a) } function kh(t) { const e = _(t.getNorth()), r = _(t.getSouth()), n = Math.cos(e), i = Math.cos(r), s = Math.sin(e), a = Math.sin(r), o = t.getWest(), l = t.getEast(); return [Th(i, a, o), Th(i, a, l), Th(n, s, l), Th(n, s, o)] } function Th(t, e, r, n = ch) { return r = _(r), [t * Math.sin(r) * n, -e * n, t * Math.cos(r) * n] } function Ph(t, e, r) { return Th(Math.cos(_(t)), Math.sin(_(t)), e, r) } function zh(t, e, r, n) { const i = 1 << r.z, s = (t / Cr + r.x) / i; return Ph(ep((e / Cr + r.y) / i), tp(s), n) } function Eh({ min: t, max: e }) { return hh / Math.max(e[0] - t[0], e[1] - t[1], e[2] - t[2]) } const Bh = new Float64Array(16); function Dh(e) { const r = Eh(e), n = t.m.fromScaling(Bh, [r, r, r]); return t.m.translate(n, n, t.v.negate([], e.min)) } function Ch(e) { const r = t.m.fromTranslation(Bh, e.min), n = 1 / Eh(e); return t.m.scale(r, r, [n, n, n]) } function Rh(t) { const e = Cr / (2 * Math.PI); return t / (2 * Math.PI) / e } function Lh(t, e) { return Cr / (512 * Math.pow(2, t)) * Eh(_h(e)) } function Vh(e, r, n, i, s) { const a = Rh(n), o = [e, r, -n / (2 * Math.PI)], l = t.m.identity(new Float64Array(16)); return t.m.translate(l, l, o), t.m.scale(l, l, [a, a, a]), t.m.rotateX(l, l, _(-s)), t.m.rotateY(l, l, _(-i)), l } function Oh(t) { return T(lh, uh, t) } function Fh(e, r) { const n = Ph(r.lat, r.lng), i = function (e) { const r = Ph(e._center.lat, e._center.lng), n = t.v.fromValues(0, 1, 0); let i = t.v.cross([], n, r); const s = t.m.fromRotation([], -e.angle, r); i = t.v.transformMat4(i, i, s), t.m.fromRotation(s, -e._pitch, i); const a = t.v.normalize([], r); return t.v.scale(a, a, gh(e.cameraToCenterDistance / e.pixelsPerMeter)), t.v.transformMat4(a, a, s), t.v.add([], r, a) }(e), s = t.v.subtract([], i, n); return t.v.angle(s, n) } function jh(t, e) { return Fh(t, e) > Math.PI / 2 * 1.01 } const Uh = _(85), Nh = Math.cos(Uh), $h = Math.sin(Uh), qh = 6371008.8, Gh = 2 * Math.PI * qh; class Yh { constructor(t, e) { if (isNaN(t) || isNaN(e)) throw new Error(`Invalid LngLat object: (${t}, ${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 Yh(P(this.lng, -180, 180), this.lat) } toArray() { return [this.lng, this.lat] } toString() { return `LngLat(${this.lng}, ${this.lat})` } distanceTo(t) { const e = Math.PI / 180, r = this.lat * e, n = t.lat * e, i = Math.sin(r) * Math.sin(n) + Math.
vendor: 4,571 bytes, line 33
33cos(r) * Math.cos(n) * Math.cos((t.lng - this.lng) * e); return qh * Math.acos(Math.min(i, 1)) } toBounds(t = 0) { const e = 360 * t / 40075017, r = e / Math.cos(Math.PI / 180 * this.lat); return new vl(new Yh(this.lng - r, this.lat - e), new Yh(this.lng + r, this.lat + e)) } toEcef(t) { const e = gh(t); return Ph(this.lat, this.lng, ch + e) } static convert(t) { if (t instanceof Yh) return t; if (Array.isArray(t) && (2 === t.length || 3 === t.length)) return new Yh(Number(t[0]), Number(t[1])); if (!Array.isArray(t) && "object" == typeof t && null !== t) return new Yh(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>]") } } var Zh = Yh; const Xh = 0, Kh = 25.5; function Wh(t) { return Gh * Math.cos(t * Math.PI / 180) } function Hh(t) { return (180 + t) / 360 } function Jh(t) { return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t * Math.PI / 360))) / 360 } function Qh(t, e) { return t / Wh(e) } function tp(t) { return 360 * t - 180 } function ep(t) { return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t) * Math.PI / 180)) - 90 } function rp(t, e) { return t * Wh(ep(e)) } const np = 85.051129; function ip(t) { return Math.cos(_(k(t, -np, np))) } function sp(t, e) { const r = k(e, Xh, Kh), n = Math.pow(2, r); return ip(t) * Gh / (512 * n) } function ap(t) { return 1 / Math.cos(t * Math.PI / 180) } function op(t, e = 0) { const r = Math.exp(Math.PI * (1 - (t.y + e / Cr) / (1 << t.z) * 2)); return 80150034 * r / (r * r + 1) / Cr / (1 << t.z) } class lp { constructor(t, e, r = 0) { this.x = +t, this.y = +e, this.z = +r; } static fromLngLat(t, e = 0) { const r = Zh.convert(t); return new lp(Hh(r.lng), Jh(r.lat), Qh(e, r.lat)) } toLngLat() { return new Zh(tp(this.x), ep(this.y)) } toAltitude() { return rp(this.z, this.y) } meterInMercatorCoordinateUnits() { return 1 / Gh * ap(ep(this.y)) } } function up(t, e, r, n, i, s, a, o, l) { const u = (e + n) / 2, c = (r + i) / 2, h = new x(u, c); o(h), function (t, e, r, n, i, s) { const a = r - i, o = n - s; return Math.abs((n - e) * a - (r - t) * o) / Math.hypot(a, o) }(h.x, h.y, s.x, s.y, a.x, a.y) >= l ? (up(t, e, r, u, c, s, h, o, l), up(t, u, c, n, i, h, a, o, l)) : t.push(a); } function cp(t, e, r) { let n = t[0], i = n.x, s = n.y; e(n); const a = [n]; for (let o = 1; o < t.length; o++) { const l = t[o], { x: u, y: c } = l; e(l), up(a, i, s, u, c, n, l, e, r), i = u, s = c, n = l; } return a } function hp(t, e, r, n) { if (n(e, r)) { const i = e.add(r)._mult(.5); hp(t, e, i, n), hp(t, i, r, n); } else t.push(r); } function pp(t, e) { let r = t[0]; const n = [r]; for (let i = 1; i < t.length; i++) { const s = t[i]; hp(n, r, s, e), r = s; } return n } const fp = Math.pow(2, 14) - 1, dp = -fp - 1; function mp(t, e) { const r = Math.round(t.x * e), n = Math.round(t.y * e); return t.x = k(r, dp, fp), t.y = k(n, dp, fp), (r < t.x || r > t.x + 1 || n < t.y || n > t.y + 1) && q("Geometry exceeds allowed extent, reduce your vector tile buffer size"), t } function yp(t, e, r) { const n = t.loadGeometry(), i = t.extent, s = Cr / i; if (e && r && r.projection.isReprojectedInTileSpace) { const s = 1 << e.z, { scale: a, x: o, y: l, projection: u } = r, c = t => { const r = tp((e.x + t.x / i) / s), n = ep((e.y + t.y / i) / s), c = u.project(r, n); t.x = (c.x * a - o) * i, t.y = (c.y * a - l) * i; }; for (let e = 0; e < n.length; e++)if (1 !== t.type) n[e] = cp(n[e], c, 1); else { const t = []; for (const r of n[e]) r.x < 0 || r.x >= i || r.y < 0 || r.y >= i || (c(r), t.push(r)); n[e] = t; } } for (const t of n) for (const e of t) mp(e, s); return n } function gp(t, e) { return { type: t.type, id: t.id, properties: t.properties, geometry: e ? yp(t) : [] } } function xp(t, e, r, n, i) { t.emplaceBack(2 * e + (n + 1) / 2, 2 * r + (i + 1) / 2); } function vp(t, e, r) { const n = 16384; t.emplaceBack(e.x, e.y, e.z, r[0] * n, r[1] * n, r[2] * n); } class bp { constructor(t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((t => t.fqid)), this.index = t.index, this.hasPattern = !1, this.projection = t.projection, this.layoutVertexArray = new $a, this.indexArray = new ao, this.segments = new Do, this.programConfigurations = new fl(t.layers, t.zoom), this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)); } populate(t, e, r, n) { const i = this.layers[0], s = []; let a = null;
vendor: 4,256 bytes, line 33
33 "circle" === i.type && (a = i.layout.get("circle-sort-key")); for (const { feature: e, id: i, index: o, sourceLayerIndex: l } of t) { const t = this.layers[0]._featureFilter.needGeometry, u = gp(e, t); if (!this.layers[0]._featureFilter.filter(new _a(this.zoom), u, r)) continue; const c = a ? a.evaluate(u, {}, r) : void 0, h = { id: i, properties: e.properties, type: e.type, sourceLayerIndex: l, index: o, geometry: t ? u.geometry : yp(e, r, n), patterns: {}, sortKey: c }; s.push(h); } a && s.sort(((t, e) => t.sortKey - e.sortKey)); let o = null; "globe" === n.projection.name && (this.globeExtVertexArray = new Ha, o = n.projection); for (const n of s) { const { geometry: i, index: s, sourceLayerIndex: a } = n, l = t[s].feature; this.addFeature(n, i, s, e.availableImages, r, o, e.brightness), e.featureIndex.insert(l, i, s, a, this.index); } } update(t, e, r, n, i) { const s = 0 !== Object.keys(t).length; s && !this.stateDependentLayers.length || this.programConfigurations.updatePaintArrays(t, e, s ? this.stateDependentLayers : this.layers, r, n, i); } isEmpty() { return 0 === this.layoutVertexArray.length } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload } upload(t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, Eo.members), this.indexBuffer = t.createIndexBuffer(this.indexArray), this.globeExtVertexArray && (this.globeExtVertexBuffer = t.createVertexBuffer(this.globeExtVertexArray, Bo.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, r, n, i, s, a) { for (const r of e) for (const e of r) { const r = e.x, n = e.y; if (r < 0 || r >= Cr || n < 0 || n >= Cr) continue; if (s) { const t = s.projectTilePoint(r, n, i), e = s.upVector(i, r, n), a = this.globeExtVertexArray; vp(a, t, e), vp(a, t, e), vp(a, t, e), vp(a, t, e); } const a = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, t.sortKey), o = a.vertexLength; xp(this.layoutVertexArray, r, n, -1, -1), xp(this.layoutVertexArray, r, n, 1, -1), xp(this.layoutVertexArray, r, n, 1, 1), xp(this.layoutVertexArray, r, n, -1, 1), this.indexArray.emplaceBack(o, o + 1, o + 2), this.indexArray.emplaceBack(o, o + 2, o + 3), a.vertexLength += 4, a.primitiveLength += 2; } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, {}, n, i, a); } } function _p(t, e) { for (let r = 0; r < t.length; r++)if (zp(e, t[r])) return !0; for (let r = 0; r < e.length; r++)if (zp(t, e[r])) return !0; return !!Sp(t, e) } function wp(t, e, r) { return !!zp(t, e) || !!kp(e, t, r) } function Mp(t, e) { if (1 === t.length) return Pp(e, t[0]); for (let r = 0; r < e.length; r++) { const n = e[r]; for (let e = 0; e < n.length; e++)if (zp(t, n[e])) return !0 } for (let r = 0; r < t.length; r++)if (Pp(e, t[r])) return !0; for (let r = 0; r < e.length; r++)if (Sp(t, e[r])) return !0; return !1 } function Ap(t, e, r) { if (t.length > 1) { if (Sp(t, e)) return !0; for (let n = 0; n < e.length; n++)if (kp(e[n], t, r)) return !0 } for (let n = 0; n < t.length; n++)if (kp(t[n], e, r)) return !0; return !1 } function Sp(t, e) { if (0 === t.length || 0 === e.length) return !1; for (let r = 0; r < t.length - 1; r++) { const n = t[r], i = t[r + 1]; for (let t = 0; t < e.length - 1; t++)if (Ip(n, i, e[t], e[t + 1])) return !0 } return !1 } function Ip(t, e, r, n) { return G(t, r, n) !== G(e, r, n) && G(t, e, r) !== G(t, e, n) } function kp(t, e, r) { const n = r * r; if (1 === e.length) return t.distSqr(e[0]) < n; for (let r = 1; r < e.length; r++)if (Tp(t, e[r - 1], e[r]) < n) return !0; return !1 } function Tp(t, e, r) { const n = e.distSqr(r); if (0 === n) return t.distSqr(e); const i = ((t.x - e.x) * (r.x - e.x) + (t.y - e.y) * (r.y - e.y)) / n; return t.distSqr(i < 0 ? e : i > 1 ? r : r.sub(e)._mult(i)._add(e)) } function Pp(t, e) { let r, n, i, s = !1; for (let a = 0; a < t.length; a++) { r = t[a]; for (let t = 0, a = r.length - 1; t < r.length; a = t++)n = r[t], i = r[a], n.y >
vendor: 8,706 bytes, line 33
33 e.y != i.y > e.y && e.x < (i.x - n.x) * (e.y - n.y) / (i.y - n.y) + n.x && (s = !s); } return s } function zp(t, e) { let r = !1; for (let n = 0, i = t.length - 1; n < t.length; i = n++) { const s = t[n], a = t[i]; s.y > e.y != a.y > e.y && e.x < (a.x - s.x) * (e.y - s.y) / (a.y - s.y) + s.x && (r = !r); } return r } function Ep(t, e, r, n, i) { for (const s of t) if (e <= s.x && r <= s.y && n >= s.x && i >= s.y) return !0; const s = [new x(e, r), new x(e, i), new x(n, i), new x(n, r)]; if (t.length > 2) for (const e of s) if (zp(t, e)) return !0; for (let e = 0; e < t.length - 1; e++)if (Bp(t[e], t[e + 1], s)) return !0; return !1 } function Bp(t, e, r) { const n = r[0], i = r[2]; if (t.x < n.x && e.x < n.x || t.x > i.x && e.x > i.x || t.y < n.y && e.y < n.y || t.y > i.y && e.y > i.y) return !1; const s = G(t, e, r[0]); return s !== G(t, e, r[1]) || s !== G(t, e, r[2]) || s !== G(t, e, r[3]) } function Dp(t, e, r, n, i, s) { let a = e.y - t.y, o = t.x - e.x; if (s = s || 0) { const t = a * a + o * o; if (0 === t) return !0; const e = Math.sqrt(t); a /= e, o /= e; } return !((r.x - t.x) * a + (r.y - t.y) * o - s < 0 || (n.x - t.x) * a + (n.y - t.y) * o - s < 0 || (i.x - t.x) * a + (i.y - t.y) * o - s < 0) } function Cp(t, e, r, n, i, s, a) { return !(Dp(t, e, n, i, s, a) || Dp(e, r, n, i, s, a) || Dp(r, t, n, i, s, a) || Dp(n, i, t, e, r, a) || Dp(i, s, t, e, r, a) || Dp(s, n, t, e, r, a)) } function Rp(t, e, r) { const n = e.paint.get(t).value; return "constant" === n.kind ? n.value : r.programConfigurations.get(e.id).getMaxValue(t) } function Lp(t) { return Math.sqrt(t[0] * t[0] + t[1] * t[1]) } function Vp(t, e, r, n, i) { if (!e[0] && !e[1]) return t; const s = x.convert(e)._mult(i); "viewport" === r && s._rotate(-n); const a = []; for (let e = 0; e < t.length; e++)a.push(t[e].sub(s)); return a } function Op(t, e, r, n) { const i = x.convert(t)._mult(n); return "viewport" === e && i._rotate(-r), i } Ks(bp, "CircleBucket", { omit: ["layers"] }); const Fp = new Da({ "circle-sort-key": new Ea(re.layout_circle["circle-sort-key"]), visibility: new za(re.layout_circle.visibility) }); var jp = { paint: new Da({ "circle-radius": new Ea(re.paint_circle["circle-radius"]), "circle-color": new Ea(re.paint_circle["circle-color"]), "circle-blur": new Ea(re.paint_circle["circle-blur"]), "circle-opacity": new Ea(re.paint_circle["circle-opacity"]), "circle-translate": new za(re.paint_circle["circle-translate"]), "circle-translate-anchor": new za(re.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new za(re.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new za(re.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new Ea(re.paint_circle["circle-stroke-width"]), "circle-stroke-color": new Ea(re.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new Ea(re.paint_circle["circle-stroke-opacity"]), "circle-emissive-strength": new za(re.paint_circle["circle-emissive-strength"]) }), layout: Fp }; const Up = t.m.create(), Np = 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 }; function $p(e, r, n, i, s, a, o, l, u) { if (a && e.queryGeometry.isAboveHorizon) return !1; a && (u *= e.pixelToTileUnitsFactor); const c = e.tileID.canonical, h = n.projection.upVectorScale(c, n.center.lat, n.worldSize).metersToTile; for (const p of r) for (const r of p) { const p = r.add(l), f = s && n.elevation ? n.elevation.exaggeration() * s.getElevationAt(p.x, p.y, !0) : 0, d = n.projection.projectTilePoint(p.x, p.y, c); if (f > 0) { const t = n.projection.upVector(c, p.x, p.y); d.x += t[0] * h * f, d.y += t[1] * h * f, d.z += t[2] * h * f; } const m = a ? p : qp(d.x, d.y, d.z, i), y = a ? e.tilespaceRays.map((t => Zp(t, f))) : e.queryGeometry.screenGeometry, g = t.e.transformMat4([], [d.x, d.y, d.z, 1], i); if (!o && a ? u *= g[3] / n.cameraToCenterDistance : o && !a && (u *= n.cameraToCenterDistance / g[3]), a) { const t = ep((r.y / Cr + c.y) / (1 << c.z)); u /= n.projection.pixelsPerMeter(t, 1) / Qh(1, t); } if (wp(y, m, u)) return !0 } return !1 } function qp(e, r, n, i) { const s = t.e.transformMat4([], [e, r, n, 1], i); return new x(s[0] / s[3], s[1] / s[3]) } const Gp = t.v.fromValues(0, 0, 0), Yp = t.v.fromValues(0, 0, 1); function Zp(e, r) { const n = t.v.create(); return Gp[2] = r, e.intersectsPlane(Gp, Yp, n), new x(n[0], n[1]) } class Xp extends bp { } function Kp(t, { width: e, height: r }, n, i) { if (i) { if (i instanceof Uint8ClampedArray) i = new Uint8Array(i.buffer); else if (i.length !== e * r * n) throw new RangeError("mismatched image size") } else i = new Uint8Array(e * r * n); return t.width = e, t.height = r, t.data = i, t } function Wp(t, e, r) { const { width: n, height: i } = e; n === t.width && i === t.height || (Hp(t, e, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t.width, n), height: Math.min(t.height, i) }, r), t.width = n, t.height = i, t.data = e.data); } function Hp(t, e, r, n, i, s, a) { if (0 === i.width || 0 === i.height) return e; if (i.width > t.width || i.height > t.height || r.x > t.width - i.width || r.y > t.height - i.height) throw new RangeError("out of range source coordinates for image copy"); if (i.width > e.width || i.height > e.height || n.x > e.width - i.width || n.y > e.height - i.height) throw new RangeError("out of range destination coordinates for image copy"); const o = t.data, l = e.data, u = 4 === s && a; for (let a = 0; a < i.height; a++) { const c = ((r.y + a) * t.width + r.x) * s, h = ((n.y + a) * e.width + n.x) * s; if (u) for (let t = 0; t < i.width; t++) { const e = c + t * s + 3, r = h + t * s; l[r + 0] = 255, l[r + 1] = 255, l[r + 2] = 255, l[r + 3] = o[e]; } else for (let t = 0; t < i.width * s; t++)l[h + t] = o[c + t]; } return e } Ks(Xp, "HeatmapBucket", { omit: ["layers"] }); class Jp { constructor(t, e) { Kp(this, t, 1, e); } resize(t) { Wp(this, new Jp(t), 1); } clone() { return new Jp({ width: this.width, height: this.height }, new Uint8Array(this.data)) } static copy(t, e, r, n, i) { Hp(t, e, r, n, i, 1); } } class Qp { constructor(t, e) { Kp(this, t, 4, e); } resize(t) { Wp(this, new Qp(t), 4); } replace(t, e) { e ? this.data.set(t) : this.data = t instanceof Uint8ClampedArray ? new Uint8Array(t.buffer) : t; } clone() { return new Qp({ width: this.width, height: this.height }, new Uint8Array(this.data)) } static copy(t, e, r, n, i, s) { Hp(t, e, r, n, i, 4, s); } } class tf { constructor(t, e) { this.width = t.width, this.height = t.height, this.data = e instanceof Uint8Array ? new Float32Array(e.buffer) : e; } } Ks(Jp, "AlphaImage"), Ks(Qp, "RGBAImage"); const ef = new Da({ visibility: new za(re.layout_heatmap.visibility) }); var rf = { paint: new Da({ "heatmap-radius": new Ea(re.paint_heatmap["heatmap-radius"]), "heatmap-weight": new Ea(re.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new za(re.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Ba(re.paint_heatmap["heatmap-color"]), "heatmap-opacity": new za(re.paint_heatmap["heatmap-opacity"]) }), layout: ef }; function nf(t) { const e = {}, r = t.resolution || 256, n = t.clips ? t.clips.length : 1, i = t.image || new Qp({ width: r, height: n }), s = (r, n, s) => { e[t.evaluationKey] = s; const a = t.expression.evaluate(e); a && (i.data[r + n + 0] = Math.floor(255 * a.r / a.a), i.data[r + n + 1] = Math.floor(255 * a.g / a.a), i.data[r + n + 2] = Math.floor(255 * a.b / a.a), i.data[r + n + 3] = Math.floor(255 * a.a)); }; if (t.clips) for (let e = 0, i = 0; e < n; ++e, i += 4 * r)for (let n = 0, a = 0; n < r; n++, a += 4) { const o = n / (r - 1), { start: l, end: u } = t.clips[e]; s(i, a, l * (1 - o) + u * o); } else for (let t = 0, e = 0; t < r; t++, e += 4)s(0, e, t / (r - 1)); return i } const sf = new Da({ visibility: new za(re.layout_hillshade.visibility) }); var af = { paint: new Da({ "hillshade-illumination-direction": new za(re.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new za(re.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new za(re.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new za(re.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new za(re.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new za(re.paint_hillshade["hillshade-accent-color"]), "hillshade-emissive-strength": new za(re.paint_hillshade["hillshade-emissive-strength"]) }), layout: sf }; const of = Ua([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: lf } = of; var uf = { exports: {} }; function cf(t, e, r) { r = r || 2;
vendor: 6,644 bytes, line 33
33 var n, i, s, a, o, l, u, c = e && e.length, h = c ? e[0] * r : t.length, p = hf(t, 0, h, r, !0), f = []; if (!p || p.next === p.prev) return f; if (c && (p = function (t, e, r, n) { var i, s, a, o = []; for (i = 0, s = e.length; i < s; i++)(a = hf(t, e[i] * n, i < s - 1 ? e[i + 1] * n : t.length, n, !1)) === a.next && (a.steiner = !0), o.push(wf(a)); for (o.sort(xf), i = 0; i < o.length; i++)r = vf(o[i], r); return r }(t, e, p, r)), t.length > 80 * r) { n = s = t[0], i = a = t[1]; for (var d = r; d < h; d += r)(o = t[d]) < n && (n = o), (l = t[d + 1]) < i && (i = l), o > s && (s = o), l > a && (a = l); u = 0 !== (u = Math.max(s - n, a - i)) ? 32767 / u : 0; } return ff(p, f, r, n, i, u, 0), f } function hf(t, e, r, n, i) { var s, a; if (i === Rf(t, e, r, n) > 0) for (s = e; s < r; s += n)a = Bf(s, t[s], t[s + 1], a); else for (s = r - n; s >= e; s -= n)a = Bf(s, t[s], t[s + 1], a); return a && If(a, a.next) && (Df(a), a = a.next), a } function pf(t, e) { if (!t) return t; e || (e = t); var r, n = t; do { if (r = !1, n.steiner || !If(n, n.next) && 0 !== Sf(n.prev, n, n.next)) n = n.next; else { if (Df(n), (n = e = n.prev) === n.next) break; r = !0; } } while (r || n !== e); return e } function ff(t, e, r, n, i, s, a) { if (t) { !a && s && function (t, e, r, n) { var i = t; do { 0 === i.z && (i.z = _f(i.x, i.y, e, r, n)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next; } while (i !== t); i.prevZ.nextZ = null, i.prevZ = null, function (t) { var e, r, n, i, s, a, o, l, u = 1; do { for (r = t, t = null, s = null, a = 0; r;) { for (a++, n = r, o = 0, e = 0; e < u && (o++, n = n.nextZ); e++); for (l = u; o > 0 || l > 0 && n;)0 !== o && (0 === l || !n || r.z <= n.z) ? (i = r, r = r.nextZ, o--) : (i = n, n = n.nextZ, l--), s ? s.nextZ = i : t = i, i.prevZ = s, s = i; r = n; } s.nextZ = null, u *= 2; } while (a > 1) }(i); }(t, n, i, s); for (var o, l, u = t; t.prev !== t.next;)if (o = t.prev, l = t.next, s ? mf(t, n, i, s) : df(t)) e.push(o.i / r | 0), e.push(t.i / r | 0), e.push(l.i / r | 0), Df(t), t = l.next, u = l.next; else if ((t = l) === u) { a ? 1 === a ? ff(t = yf(pf(t), e, r), e, r, n, i, s, 2) : 2 === a && gf(t, e, r, n, i, s) : ff(pf(t), e, r, n, i, s, 1); break } } } function df(t) { var e = t.prev, r = t, n = t.next; if (Sf(e, r, n) >= 0) return !1; for (var i = e.x, s = r.x, a = n.x, o = e.y, l = r.y, u = n.y, c = i < s ? i < a ? i : a : s < a ? s : a, h = o < l ? o < u ? o : u : l < u ? l : u, p = i > s ? i > a ? i : a : s > a ? s : a, f = o > l ? o > u ? o : u : l > u ? l : u, d = n.next; d !== e;) { if (d.x >= c && d.x <= p && d.y >= h && d.y <= f && Mf(i, o, s, l, a, u, d.x, d.y) && Sf(d.prev, d, d.next) >= 0) return !1; d = d.next; } return !0 } function mf(t, e, r, n) { var i = t.prev, s = t, a = t.next; if (Sf(i, s, a) >= 0) return !1; for (var o = i.x, l = s.x, u = a.x, c = i.y, h = s.y, p = a.y, f = o < l ? o < u ? o : u : l < u ? l : u, d = c < h ? c < p ? c : p : h < p ? h : p, m = o > l ? o > u ? o : u : l > u ? l : u, y = c > h ? c > p ? c : p : h > p ? h : p, g = _f(f, d, e, r, n), x = _f(m, y, e, r, n), v = t.prevZ, b = t.nextZ; v && v.z >= g && b && b.z <= x;) { if (v.x >= f && v.x <= m && v.y >= d && v.y <= y && v !== i && v !== a && Mf(o, c, l, h, u, p, v.x, v.y) && Sf(v.prev, v, v.next) >= 0) return !1; if (v = v.prevZ, b.x >= f && b.x <= m && b.y >= d && b.y <= y && b !== i && b !== a && Mf(o, c, l, h, u, p, b.x, b.y) && Sf(b.prev, b, b.next) >= 0) return !1; b = b.nextZ; } for (; v && v.z >= g;) { if (v.x >= f && v.x <= m && v.y >= d && v.y <= y && v !== i && v !== a && Mf(o, c, l, h, u, p, v.x, v.y) && Sf(v.prev, v, v.next) >= 0) return !1; v = v.prevZ; } for (; b && b.z <= x;) { if (b.x >= f && b.x <= m && b.y >= d && b.y <= y && b !== i && b !== a && Mf(o, c, l, h, u, p, b.x, b.y) && Sf(b.prev, b, b.next) >= 0) return !1; b = b.nextZ; } return !0 } function yf(t, e, r) { var n = t; do { var i = n.prev, s = n.next.next; !If(i, s) && kf(i, n, n.next, s) && zf(i, s) && zf(s, i) && (e.push(i.i / r | 0), e.push(n.i / r | 0), e.push(s.i / r | 0), Df(n), Df(n.next), n = t = s), n = n.next; } while (n !== t); return pf(n) } function gf(t, e, r, n, i, s) { var a = t; do { for (var o = a.next.next; o !== a.prev;) { if (a.i !== o.i && Af(a, o)) { var l = Ef(a, o); return a = pf(a, a.next), l = pf(l, l.next), ff(a, e, r, n, i, s, 0), void ff(l, e, r, n, i, s, 0) } o = o.next; } a = a.next; } while (a !== t) } function xf(t, e) { return t.x - e.x } function vf(t, e) { var r = function (t, e) { var r, n = e, i = t.x, s = t.y, a = -1 / 0; do { if (s <= n.y && s >= n.next.y && n.next.y !== n.y) { var o = n.x + (s - n.y) * (n.next.x - n.x) / (n.next.y - n.y); if (o <= i && o > a && (a = o, r = n.x < n.next.x ? n : n.next, o === i)) return r } n = n.next; } while (n !== e); if (!r) return null; var l, u = r, c = r.x, h = r.y, p = 1 / 0; n = r; do { i >= n.x && n.x >= c && i !== n.x && Mf(s < h ? i : a, s, c, h, s < h ? a : i, s, n.x, n.y) && (l = Math.abs(s - n.y) / (i - n.x), zf(n, t) && (l < p || l === p && (n.x > r.x || n.x === r.x && bf(r, n))) && (r = n, p = l)), n = n.next; } while (n !== u); return r }(t, e); if (!r) return e; var n = Ef(r, t); return pf(n, n.next), pf(r, r.next) } function bf(t, e) { return Sf(t.prev, t, e.prev) < 0 && Sf(e.next, t, t.next) < 0 } function _f(t, e, r, n, i) { return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = (t - r) * i | 0) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = (e - n) * i | 0) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1 } function wf(t) { var e = t, r = t; do { (e.x < r.x || e.x === r.x && e.y < r.y) && (r = e), e = e.next; } while (e !== t); return r } function Mf(t, e, r, n, i, s, a, o) { return (i - a) * (e - o) >= (t - a) * (s - o) && (t - a) * (n - o) >= (r - a) * (e - o) && (r - a) * (s - o) >= (i - a) * (n - o) } function Af(t, e) { return t.next.i !== e.i && t.prev.i !== e.i && !function (t, e) { var r = t; do { if (r.i !== t.i && r.next.i !== t.i && r.i !== e.i && r.next.i !== e.i && kf(r, r.next, t, e)) return !0; r = r.next; } while (r !== t); return !1 }(t, e) && (zf(t, e) && zf(e, t) && function (t, e) { var r = t, n = !1, i = (t.x + e.x) / 2, s = (t.y + e.y) / 2; do { r.y > s != r.next.y > s && r.next.y !== r.y && i < (r.next.x - r.x) * (s - r.y) / (r.next.y - r.y) + r.x && (n = !n), r = r.next; } while (r !== t); return n }(t, e) && (Sf(t.prev, t, e.prev) || Sf(t, e.prev, e)) || If(t, e) && Sf(t.prev, t, t.next) > 0 && Sf(e.prev, e, e.next) > 0) } function Sf(t, e, r) { return (e.y - t.y) * (r.x - e.x) - (e.x - t.x) * (r.y - e.y
vendor: 16,119 bytes, lines 33-36
33) } function If(t, e) { return t.x === e.x && t.y === e.y } function kf(t, e, r, n) { var i = Pf(Sf(t, e, r)), s = Pf(Sf(t, e, n)), a = Pf(Sf(r, n, t)), o = Pf(Sf(r, n, e)); return i !== s && a !== o || !(0 !== i || !Tf(t, r, e)) || !(0 !== s || !Tf(t, n, e)) || !(0 !== a || !Tf(r, t, n)) || !(0 !== o || !Tf(r, e, n)) } function Tf(t, e, r) { return e.x <= Math.max(t.x, r.x) && e.x >= Math.min(t.x, r.x) && e.y <= Math.max(t.y, r.y) && e.y >= Math.min(t.y, r.y) } function Pf(t) { return t > 0 ? 1 : t < 0 ? -1 : 0 } function zf(t, e) { return Sf(t.prev, t, t.next) < 0 ? Sf(t, e, t.next) >= 0 && Sf(t, t.prev, e) >= 0 : Sf(t, e, t.prev) < 0 || Sf(t, t.next, e) < 0 } function Ef(t, e) { var r = new Cf(t.i, t.x, t.y), n = new Cf(e.i, e.x, e.y), i = t.next, s = e.prev; return t.next = e, e.prev = t, r.next = i, i.prev = r, n.next = r, r.prev = n, s.next = n, n.prev = s, n } function Bf(t, e, r, n) { var i = new Cf(t, e, r); return n ? (i.next = n.next, i.prev = n, n.next.prev = i, n.next = i) : (i.prev = i, i.next = i), i } function Df(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 Cf(t, e, r) { this.i = t, this.x = e, this.y = r, this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1; } function Rf(t, e, r, n) { for (var i = 0, s = e, a = r - n; s < r; s += n)i += (t[a] - t[s]) * (t[s + 1] + t[a + 1]), a = s; return i } uf.exports = cf, uf.exports.default = cf, cf.deviation = function (t, e, r, n) { var i = e && e.length, s = Math.abs(Rf(t, 0, i ? e[0] * r : t.length, r)); if (i) for (var a = 0, o = e.length; a < o; a++)s -= Math.abs(Rf(t, e[a] * r, a < o - 1 ? e[a + 1] * r : t.length, r)); var l = 0; for (a = 0; a < n.length; a += 3) { var u = n[a] * r, c = n[a + 1] * r, h = n[a + 2] * r; l += Math.abs((t[u] - t[h]) * (t[c + 1] - t[u + 1]) - (t[u] - t[c]) * (t[h + 1] - t[u + 1])); } return 0 === s && 0 === l ? 0 : Math.abs((l - s) / s) }, cf.flatten = function (t) { for (var e = t[0][0].length, r = { vertices: [], holes: [], dimensions: e }, n = 0, i = 0; i < t.length; i++) { for (var s = 0; s < t[i].length; s++)for (var a = 0; a < e; a++)r.vertices.push(t[i][s][a]); i > 0 && r.holes.push(n += t[i - 1].length); } return r }; var Lf = p(uf.exports); function Vf(t, e) { const r = t.length; if (r <= 1) return [t]; const n = []; let i, s; for (let e = 0; e < r; e++) { const r = Y(t[e]); 0 !== r && (t[e].area = Math.abs(r), void 0 === s && (s = r < 0), s === r < 0 ? (i && n.push(i), i = [t[e]]) : i.push(t[e])); } if (i && n.push(i), e > 1) for (let t = 0; t < n.length; t++)n[t].length <= e || (ur(n[t], e, 1, n[t].length - 1, Of), n[t] = n[t].slice(0, e)); return n } function Of(t, e) { return e.area - t.area } function Ff(t, e, r) { const n = r.patternDependencies; let i = !1; for (const r of e) { const e = r.paint.get(`${t}-pattern`); e.isConstant() || (i = !0); const s = e.constantOr(null); s && (i = !0, n[s] = !0); } return i } function jf(t, e, r, n, i) { const s = i.patternDependencies; for (const a of e) { const e = a.paint.get(`${t}-pattern`).value; if ("constant" !== e.kind) { let t = e.evaluate({ zoom: n }, r, {}, i.availableImages); t = t && t.name ? t.name : t, s[t] = !0, r.patterns[a.id] = t; } } return r } class Uf { constructor(t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((t => t.fqid)), this.index = t.index, this.hasPattern = !1, this.patternFeatures = [], this.layoutVertexArray = new $a, this.indexArray = new ao, this.indexArray2 = new eo, this.programConfigurations = new fl(t.layers, t.zoom), this.segments = new Do, this.segments2 = new Do, this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)), this.projection = t.projection; } populate(t, e, r, n) { this.hasPattern = Ff("fill", this.layers, e); const i = this.layers[0].layout.get("fill-sort-key"), s = []; for (const { feature: a, id: o, index: l, sourceLayerIndex: u } of t) { const t = this.layers[0]._featureFilter.needGeometry, c = gp(a, t); if (!this.layers[0]._featureFilter.filter(new _a(this.zoom), c, r)) continue; const h = i ? i.evaluate(c, {}, r, e.availableImages) : void 0, p = { id: o, properties: a.properties, type: a.type, sourceLayerIndex: u, index: l, geometry: t ? c.geometry : yp(a, r, n), patterns: {}, sortKey: h }; s.push(p); } i && s.sort(((t, e) => t.sortKey - e.sortKey)); for (const n of s) { const { geometry: i, index: s, sourceLayerIndex: a } = n; if (this.hasPattern) { const t = jf("fill", this.layers, n, this.zoom, e); this.patternFeatures.push(t); } else this.addFeature(n, i, s, r, {}, e.availableImages, e.brightness); e.featureIndex.insert(t[s].feature, i, s, a, this.index); } } update(t, e, r, n, i) { const s = 0 !== Object.keys(t).length; s && !this.stateDependentLayers.length || this.programConfigurations.updatePaintArrays(t, e, s ? this.stateDependentLayers : this.layers, r, n, i); } addFeatures(t, e, r, n, i, s) { for (const t of this.patternFeatures) this.addFeature(t, t.geometry, t.index, e, r, n, s); } isEmpty() { return 0 === this.layoutVertexArray.length } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload } upload(t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, lf), 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, r, n, i, s = [], a) { for (const t of Vf(e, 500)) { let e = 0; for (const r of t) e += r.length; const r = this.segments.prepareSegment(e, this.layoutVertexArray, this.indexArray), n = r.vertexLength, i = [], s = []; for (const e of t) { if (0 === e.length) continue; e !== t[0] && s.push(i.length / 2); const r = this.segments2.prepareSegment(e.length, this.layoutVertexArray, this.indexArray2), n = r.vertexLength; this.layoutVertexArray.emplaceBack(e[0].x, e[0].y), this.indexArray2.emplaceBack(n + e.length - 1, n), i.push(e[0].x), i.push(e[0].y); for (let t = 1; t < e.length; t++)this.layoutVertexArray.emplaceBack(e[t].x, e[t].y), this.indexArray2.emplaceBack(n + t - 1, n + t), i.push(e[t].x), i.push(e[t].y); r.vertexLength += e.length, r.primitiveLength += e.length; } const a = Lf(i, s); for (let t = 0; t < a.length; t += 3)this.indexArray.emplaceBack(n + a[t], n + a[t + 1], n + a[t + 2]); r.vertexLength += e, r.primitiveLength += a.length / 3; } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, i, s, n, a); } } Ks(Uf, "FillBucket", { omit: ["layers", "patternFeatures"] }); const Nf = new Da({ "fill-sort-key": new Ea(re.layout_fill["fill-sort-key"]), visibility: new za(re.layout_fill.visibility) }); var $f = { paint: new Da({ "fill-antialias": new za(re.paint_fill["fill-antialias"]), "fill-opacity": new Ea(re.paint_fill["fill-opacity"]), "fill-color": new Ea(re.paint_fill["fill-color"]), "fill-outline-color": new Ea(re.paint_fill["fill-outline-color"]), "fill-translate": new za(re.paint_fill["fill-translate"]), "fill-translate-anchor": new za(re.paint_fill["fill-translate-anchor"]), "fill-pattern": new Ea(re.paint_fill["fill-pattern"]), "fill-emissive-strength": new za(re.paint_fill["fill-emissive-strength"]) }), layout: Nf }; const qf = Ua([{ name: "a_pos_normal_ed", components: 4, type: "Int16" }]), Gf = Ua([{ name: "a_pos_end", components: 4, type: "Int16" }, { name: "a_angular_offset_factor", components: 1, type: "Int16" }]), Yf = Ua([{ name: "a_centroid_pos", components: 2, type: "Uint16" }]), Zf = Ua([{ name: "a_hidden_by_landmark", components: 1, type: "Uint8" }]), Xf = Ua([{ name: "a_pos_3", components: 3, type: "Int16" }, { name: "a_pos_normal_3", components: 3, type: "Int16" }]), { members: Kf } = qf; var Wf = {}, Hf = y, Jf = Qf; function Qf(t, e, r, n, i) { this.properties = {}, this.extent = r, this.type = 0, this._pbf = t, this._geometry = -1, this._keys = n, this._values = i, t.readFields(td, this, e); } function td(t, e, r) { 1 == t ? e.id = r.readVarint() : 2 == t ? function (t, e) { for (var r = t.readVarint() + t.pos; t.pos < r;) { var n = e._keys[t.readVarint()], i = e._values[t.readVarint()]; e.properties[n] = i; } }(r, e) : 3 == t ? e.type = r.readVarint() : 4 == t && (e._geometry = r.pos); } function ed(t) { for (var e, r, n = 0, i = 0, s = t.length, a = s - 1; i < s; a = i++)n += ((r = t[a]).x - (e = t[i]).x) * (e.y + r.y); return n } Qf.types = ["Unknown", "Point", "LineString", "Polygon"], Qf.prototype.loadGeometry = function () { var t = this._pbf; t.pos = this._geometry; for (var e, r = t.readVarint() + t.pos, n = 1, i = 0, s = 0, a = 0, o = []; t.pos < r;) { if (i <= 0) { var l = t.readVarint(); n = 7 & l, i = l >> 3; } if (i--, 1 === n || 2 === n) s += t.readSVarint(), a += t.readSVarint(), 1 === n && (e && o.push(e), e = []), e.push(new Hf(s, a)); else { if (7 !== n) throw new Error("unknown command " + n); e && e.push(e[0].clone()); } } return e && o.push(e), o }, Qf.prototype.bbox = function () { var t = this._pbf; t.pos = this._geometry; for (var e = t.readVarint() + t.pos, r = 1, n = 0, i = 0, s = 0, a = 1 / 0, o = -1 / 0, l = 1 / 0, u = -1 / 0; t.pos < e;) { if (n <= 0) { var c = t.readVarint(); r = 7 & c, n = c >> 3; } if (n--, 1 === r || 2 === r) (i += t.readSVarint()) < a && (a = i), i > o && (o = i), (s += t.readSVarint()) < l && (l = s), s > u && (u = s); else if (7 !== r) throw new Error("unknown command " + r) } return [a, l, o, u] }, Qf.prototype.toGeoJSON = function (t, e, r) { var n, i, s = this.extent * Math.pow(2, r), a = this.extent * t, o = this.extent * e, l = this.loadGeometry(), u = Qf.types[this.type]; function c(t) { for (var e = 0; e < t.length; e++) { var r = t[e]; t[e] = [360 * (r.x + a) / s - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (r.y + o) / s) * Math.PI / 180)) - 90]; } } switch (this.type) { case 1: var h = []; for (n = 0; n < l.length; n++)h[n] = l[n][0]; c(l = h); break; case 2: for (n = 0; n < l.length; n++)c(l[n]); break; case 3: for (l = function (t) { var e = t.length; if (e <= 1) return [t]; for (var r, n, i = [], s = 0; s < e; s++) { var a = ed(t[s]); 0 !== a && (void 0 === n && (n = a < 0), n === a < 0 ? (r && i.push(r), r = [t[s]]) : r.push(t[s])); } return r && i.push(r), i }(l), n = 0; n < l.length; n++)for (i = 0; i < l[n].length; i++)c(l[n][i]); }1 === l.length ? l = l[0] : u = "Multi" + u; var p = { type: "Feature", geometry: { type: u, coordinates: l }, properties: this.properties }; return "id" in this && (p.id = this.id), p }; var rd = Jf, nd = id; function id(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(sd, this, e), this.length = this._features.length; } function sd(t, e, r) { 15 === t ? e.version = r.readVarint() : 1 === t ? e.name = r.readString() : 5 === t ? e.extent = r.readVarint() : 2 === t ? e._features.push(r.pos) : 3 === t ? e._keys.push(r.readString()) : 4 === t && e._values.push(function (t) { for (var e = null, r = t.readVarint() + t.pos; t.pos < r;) { var n = t.readVarint() >> 3; e = 1 === n ? t.readString() : 2 === n ? t.readFloat() : 3 === n ? t.readDouble() : 4 === n ? t.readVarint64() : 5 === n ? t.readVarint() : 6 === n ? t.readSVarint() : 7 === n ? t.readBoolean() : null; } return e }(r)); } id.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 rd(this._pbf, e, this.extent, this._keys, this._values) }; var ad = nd; function od(t, e, r) { if (3 === t) { var n = new ad(r, r.readVarint() + r.pos); n.length && (e[n.name] = n); } } var ld = Wf.VectorTile = function (t, e) { this.layers = t.readFields(od, {}, e); }, ud = Wf.VectorTileFeature = Jf; function cd(t, e, r, n) { const i = [], s = 0 === n ? (t, e, r, n, i, s) => { t.push(new x(s, r + (s - e) / (n - e) * (i - r))); } : (t, e, r, n, i, s) => { t.push(new x(e + (s - r) / (i - r) * (n - e), s)); }; for (const a of t) { const t = []; for (const i of a) { if (i.length <= 2) continue; const a = []; for (let t = 0; t < i.length - 1; t++) { const o = i[t].x, l = i[t].y, u = i[t + 1].x, c = i[t + 1].y, h = 0 === n ? o : l, p = 0 === n ? u : c; h < e ? p > e && s(a, o, l, u, c, e) : h > r ? p < r && s(a, o, l, u, c, r) : a.push(i[t]), p < e && h >= e && s(a, o, l, u, c, e), p > r && h <= r && s(a, o, l, u, c, r); } let o = i[i.length - 1]; const l = 0 === n ? o.x : o.y; l >= e && l <= r && a.push(o), a.length && (o = a[a.length - 1], a[0].x === o.x && a[0].y === o.y || a.push(a[0]), t.push(a)); } t.length && i.push(t); } return i } Wf.VectorTileLayer = nd; class hd { constructor(t) { this._stringToNumber = {}, this._numberToString = []; for (let e = 0; e < t.length; e++) { const r = t[e]; this._stringToNumber[r] = e, this._numberToString[e] = r; } } encode(t) { return this._stringToNumber[t] } decode(t) { return this._numberToString[t] } } var pd = {
34            /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
35            read: function (t, e, r, n, i) { var s, a, o = 8 * i - n - 1, l = (1 << o) - 1, u = l >> 1, c = -7, h = r ? i - 1 : 0, p = r ? -1 : 1, f = t[e + h]; for (h += p, s = f & (1 << -c) - 1, f >>= -c, c += o; c > 0; s = 256 * s + t[e + h], h += p, c -= 8); for (a = s & (1 << -c) - 1, s >>= -c, c += n; c > 0; a = 256 * a + t[e + h], h += p, c -= 8); if (0 === s) s = 1 - u; else { if (s === l) return a ? NaN : 1 / 0 * (f ? -1 : 1); a += Math.pow(2, n), s -= u; } return (f ? -1 : 1) * a * Math.pow(2, s - n) }, write: function (t, e, r, n, i, s) { var a, o, l, u = 8 * s - i - 1, c = (1 << u) - 1, h = c >> 1, p = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f = n ? 0 : s - 1, d = n ? 1 : -1, m = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0; for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (o = isNaN(e) ? 1 : 0, a = c) : (a = Math.floor(Math.log(e) / Math.LN2), e * (l = Math.pow(2, -a)) < 1 && (a--, l *= 2), (e += a + h >= 1 ? p / l : p * Math.pow(2, 1 - h)) * l >= 2 && (a++, l /= 2), a + h >= c ? (o = 0, a = c) : a + h >= 1 ? (o = (e * l - 1) * Math.pow(2, i), a += h) : (o = e * Math.pow(2, h - 1) * Math.pow(2, i), a = 0)); i >= 8; t[r + f] = 255 & o, f += d, o /= 256, i -= 8); for (a = a << i | o, u += i; u > 0; t[r + f] = 255 & a, f += d, a /= 256, u -= 8); t[r + f - d] |= 128 * m; }
36        }, fd = md, dd = pd; function md(t) { this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t) ? t : new Uint8Array(t || 0), this.pos = 0, this.type = 0, this.length = this.buf.length; } md.Varint = 0, md.Fixed64 = 1, md.Bytes = 2, md.Fixed32 = 5; var yd = 4294967296, gd = 1 / yd, xd = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf8"); function vd(t) { return t.type === md.Bytes ? t.readVarint() + t.pos : t.pos + 1 } function bd(t, e, r) { return r ? 4294967296 * e + (t >>> 0) : 4294967296 * (e >>> 0) + (t >>> 0) } function _d(t, e, r) { var n = e <= 16383 ? 1 : e <= 2097151 ? 2 : e <= 268435455 ? 3 : Math.floor(Math.log(e) / (7 * Math.LN2)); r.realloc(n); for (var i = r.pos - 1; i >= t; i--)r.buf[i + n] = r.buf[i]; } function wd(t, e) { for (var r = 0; r < t.length; r++)e.writeVarint(t[r]); } function Md(t, e) { for (var r = 0; r < t.length; r++)e.writeSVarint(t[r]); } function Ad(t, e) { for (var r = 0; r < t.length; r++)e.writeFloat(t[r]); } function Sd(t, e) { for (var r = 0; r < t.length; r++)e.writeDouble(t[r]); } function Id(t, e) { for (var r = 0; r < t.length; r++)e.writeBoolean(t[r]); } function kd(t, e) { for (var r = 0; r < t.length; r++)e.writeFixed32(t[r]); } function Td(t, e) { for (var r = 0; r < t.length; r++)e.writeSFixed32(t[r]); } function Pd(t, e) { for (var r = 0; r < t.length;
vendor: 4,185 bytes, line 36
36 r++)e.writeFixed64(t[r]); } function zd(t, e) { for (var r = 0; r < t.length; r++)e.writeSFixed64(t[r]); } function Ed(t, e) { return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + 16777216 * t[e + 3] } function Bd(t, e, r) { t[r] = e, t[r + 1] = e >>> 8, t[r + 2] = e >>> 16, t[r + 3] = e >>> 24; } function Dd(t, e) { return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + (t[e + 3] << 24) } md.prototype = { destroy: function () { this.buf = null; }, readFields: function (t, e, r) { for (r = r || this.length; this.pos < r;) { var n = this.readVarint(), i = n >> 3, s = this.pos; this.type = 7 & n, t(i, e, this), this.pos === s && this.skip(n); } return e }, readMessage: function (t, e) { return this.readFields(t, e, this.readVarint() + this.pos) }, readFixed32: function () { var t = Ed(this.buf, this.pos); return this.pos += 4, t }, readSFixed32: function () { var t = Dd(this.buf, this.pos); return this.pos += 4, t }, readFixed64: function () { var t = Ed(this.buf, this.pos) + Ed(this.buf, this.pos + 4) * yd; return this.pos += 8, t }, readSFixed64: function () { var t = Ed(this.buf, this.pos) + Dd(this.buf, this.pos + 4) * yd; return this.pos += 8, t }, readFloat: function () { var t = dd.read(this.buf, this.pos, !0, 23, 4); return this.pos += 4, t }, readDouble: function () { var t = dd.read(this.buf, this.pos, !0, 52, 8); return this.pos += 8, t }, readVarint: function (t) { var e, r, n = this.buf; return e = 127 & (r = n[this.pos++]), r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 7, r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 14, r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 21, r < 128 ? e : function (t, e, r) { var n, i, s = r.buf; if (n = (112 & (i = s[r.pos++])) >> 4, i < 128) return bd(t, n, e); if (n |= (127 & (i = s[r.pos++])) << 3, i < 128) return bd(t, n, e); if (n |= (127 & (i = s[r.pos++])) << 10, i < 128) return bd(t, n, e); if (n |= (127 & (i = s[r.pos++])) << 17, i < 128) return bd(t, n, e); if (n |= (127 & (i = s[r.pos++])) << 24, i < 128) return bd(t, n, e); if (n |= (1 & (i = s[r.pos++])) << 31, i < 128) return bd(t, n, e); throw new Error("Expected varint not more than 10 bytes") }(e |= (15 & (r = n[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 && xd ? function (t, e, r) { return xd.decode(t.subarray(e, r)) }(this.buf, e, t) : function (t, e, r) { for (var n = "", i = e; i < r;) { var s, a, o, l = t[i], u = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1; if (i + c > r) break; 1 === c ? l < 128 && (u = l) : 2 === c ? 128 == (192 & (s = t[i + 1])) && (u = (31 & l) << 6 | 63 & s) <= 127 && (u = null) : 3 === c ? (a = t[i + 2], 128 == (192 & (s = t[i + 1])) && 128 == (192 & a) && ((u = (15 & l) << 12 | (63 & s) << 6 | 63 & a) <= 2047 || u >= 55296 && u <= 57343) && (u = null)) : 4 === c && (a = t[i + 2], o = t[i + 3], 128 == (192 & (s = t[i + 1])) && 128 == (192 & a) && 128 == (192 & o) && ((u = (15 & l) << 18 | (63 & s) << 12 | (63 & a) << 6 | 63 & o) <= 65535 || u >= 1114112) && (u = null)), null === u ? (u = 65533, c = 1) : u > 65535 && (u -= 65536, n += String.fromCharCode(u >>> 10 & 1023 | 55296), u = 56320 | 1023 & u), n += String.fromCharCode(u), i += c; } return n }(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 !== md.Bytes) return t.push(this.readVarint(e)); var r = vd(this); for (t = t || []; this.pos < r;)t.push(this.readVarint(e)); return t }, readPackedSVarint: function (t) { if (this.type !== md.Bytes) return t.push(this.readSVarint()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readSVarint()); return t }, readPackedBoolean: function (t) { if (this.type !== md.Bytes) return t.push(this.readBoolean()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readBoolean()); return t }
vendor: 6,252 bytes, line 36
36, readPackedFloat: function (t) { if (this.type !== md.Bytes) return t.push(this.readFloat()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readFloat()); return t }, readPackedDouble: function (t) { if (this.type !== md.Bytes) return t.push(this.readDouble()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readDouble()); return t }, readPackedFixed32: function (t) { if (this.type !== md.Bytes) return t.push(this.readFixed32()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readFixed32()); return t }, readPackedSFixed32: function (t) { if (this.type !== md.Bytes) return t.push(this.readSFixed32()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readSFixed32()); return t }, readPackedFixed64: function (t) { if (this.type !== md.Bytes) return t.push(this.readFixed64()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readFixed64()); return t }, readPackedSFixed64: function (t) { if (this.type !== md.Bytes) return t.push(this.readSFixed64()); var e = vd(this); for (t = t || []; this.pos < e;)t.push(this.readSFixed64()); return t }, skip: function (t) { var e = 7 & t; if (e === md.Varint) for (; this.buf[this.pos++] > 127;); else if (e === md.Bytes) this.pos = this.readVarint() + this.pos; else if (e === md.Fixed32) this.pos += 4; else { if (e !== md.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 r = new Uint8Array(e); r.set(this.buf), this.buf = r, 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), Bd(this.buf, t, this.pos), this.pos += 4; }, writeSFixed32: function (t) { this.realloc(4), Bd(this.buf, t, this.pos), this.pos += 4; }, writeFixed64: function (t) { this.realloc(8), Bd(this.buf, -1 & t, this.pos), Bd(this.buf, Math.floor(t * gd), this.pos + 4), this.pos += 8; }, writeSFixed64: function (t) { this.realloc(8), Bd(this.buf, -1 & t, this.pos), Bd(this.buf, Math.floor(t * gd), this.pos + 4), this.pos += 8; }, writeVarint: function (t) { (t = +t || 0) > 268435455 || t < 0 ? function (t, e) { var r, n; if (t >= 0 ? (r = t % 4294967296 | 0, n = t / 4294967296 | 0) : (n = ~(-t / 4294967296), 4294967295 ^ (r = ~(-t % 4294967296)) ? r = r + 1 | 0 : (r = 0, n = n + 1 | 0)), t >= 0x10000000000000000 || t < -0x10000000000000000) throw new Error("Given varint doesn't fit into 10 bytes"); e.realloc(10), function (t, e, r) { r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, r.buf[r.pos] = 127 & (t >>>= 7); }(r, 0, e), function (t, e) { var r = (7 & t) << 4; e.buf[e.pos++] |= r | ((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))))); }(n, 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, r) { for (var n, i, s = 0; s < e.length; s++) { if ((n = e.charCodeAt(s)) > 55295 && n < 57344) { if (!i) { n > 56319 || s + 1 === e.length ? (t[r++] = 239, t[r++] = 191, t[r++] = 189) : i = n; continue } if (n < 56320) { t[r++] = 239, t[r++] = 191, t[r++] = 189, i = n; continue } n = i - 55296 << 10 | n - 56320 | 65536, i = null; } else i && (t[r++] = 239, t[r++] = 191, t[r++] = 189, i = null); n < 128 ? t[r++] = n : (n < 2048 ? t[r++] = n >> 6 | 192 : (n < 65536 ? t[r++] = n >> 12 | 224 : (t[r++] = n >> 18 | 240, t[r++] = n >> 12 & 63 | 128), t[r++] = n >> 6 & 63 | 128), t[r++] = 63 & n | 128); } return r }(this.buf, t, this.pos); var r = this.pos - e; r >= 128 && _d(e, r, this), this.pos = e - 1, this.writeVarint(r), this.pos += r; }, writeFloat: function (t) { this.realloc(4), dd.write(this.buf, t, this.pos, !0, 23, 4), this.pos += 4; }, writeDouble: function (t) { this.realloc(8), dd.write(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 r = 0; r < e; r++)this.buf[this.pos++] = t[r]; }, writeRawMessage: function (t, e) { this.pos++; var r = this.pos; t(e, this); var n = this.pos - r; n >= 128 && _d(r, n, this), this.pos = r - 1, this.writeVarint(n), this.pos += n; }, writeMessage: function (t, e, r) { this.writeTag(t, md.Bytes), this.writeRawMessage(e, r); }, writePackedVarint: function (t, e) { e.length && this.writeMessage(t, wd, e); }, writePackedSVarint: function (t, e) { e.length && this.writeMessage(t, Md, e); }, writePackedBoolean: function (t, e) { e.length && this.writeMessage(t, Id, e); }, writePackedFloat: function (t, e) { e.length && this.writeMessage(t, Ad, e); }, writePackedDouble: function (t, e) { e.length && this.writeMessage(t, Sd, e); }, writePackedFixed32: function (t, e) { e.length && this.writeMessage(t, kd, e); }, writePackedSFixed32: function (t, e) { e.length && this.writeMessage(t, Td, e); }, writePackedFixed64: function (t, e) { e.length && this.writeMessage(t, Pd, e); }, writePackedSFixed64: function (t, e) { e.length && this.writeMessage(t, zd, e); }, writeBytesField: function (t, e) { this.writeTag(t, md.Bytes), this.writeBytes(e); }, writeFixed32Field: function (t, e) { this.writeTag(t, md.Fixed32), this.writeFixed32(e); }, writeSFixed32Field: function (t, e) { this.writeTag(t, md.Fixed32), this.writeSFixed32(e); }, writeFixed64Field: function (t, e) { this.writeTag(t, md.Fixed64), this.writeFixed64
vendor: 10,601 bytes, line 36
36(e); }, writeSFixed64Field: function (t, e) { this.writeTag(t, md.Fixed64), this.writeSFixed64(e); }, writeVarintField: function (t, e) { this.writeTag(t, md.Varint), this.writeVarint(e); }, writeSVarintField: function (t, e) { this.writeTag(t, md.Varint), this.writeSVarint(e); }, writeStringField: function (t, e) { this.writeTag(t, md.Bytes), this.writeString(e); }, writeFloatField: function (t, e) { this.writeTag(t, md.Fixed32), this.writeFloat(e); }, writeDoubleField: function (t, e) { this.writeTag(t, md.Fixed64), this.writeDouble(e); }, writeBooleanField: function (t, e) { this.writeVarintField(t, Boolean(e)); } }; var Cd = p(fd); const Rd = ["tile", "layer", "source", "sourceLayer", "state"]; class Ld { constructor(t, e, r, n, i) { this.type = "Feature", this._vectorTileFeature = t, this._z = e, this._x = r, this._y = n, this.properties = t.properties, this.id = i; } 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", state: void 0, geometry: this.geometry, properties: this.properties }; void 0 !== this.id && (t.id = this.id); for (const e of Rd) void 0 !== this[e] && (t[e] = this[e]); return t } } class Vd { constructor() { this.state = {}, this.stateChanges = {}, this.deletedStates = {}; } updateState(t, e, r) { const n = String(e); if (this.stateChanges[t] = this.stateChanges[t] || {}, this.stateChanges[t][n] = this.stateChanges[t][n] || {}, B(this.stateChanges[t][n], r), null === this.deletedStates[t]) { this.deletedStates[t] = {}; for (const e in this.state[t]) e !== n && (this.deletedStates[t][e] = null); } else if (this.deletedStates[t] && null === this.deletedStates[t][n]) { this.deletedStates[t][n] = {}; for (const e in this.state[t][n]) r[e] || (this.deletedStates[t][n][e] = null); } else for (const e in r) this.deletedStates[t] && this.deletedStates[t][n] && null === this.deletedStates[t][n][e] && delete this.deletedStates[t][n][e]; } removeFeatureState(t, e, r) { if (null === this.deletedStates[t]) return; const n = String(e); if (this.deletedStates[t] = this.deletedStates[t] || {}, r && void 0 !== e) null !== this.deletedStates[t][n] && (this.deletedStates[t][n] = this.deletedStates[t][n] || {}, this.deletedStates[t][n][r] = null); else if (void 0 !== e) if (this.stateChanges[t] && this.stateChanges[t][n]) for (r in this.deletedStates[t][n] = {}, this.stateChanges[t][n]) this.deletedStates[t][n][r] = null; else this.deletedStates[t][n] = null; else this.deletedStates[t] = null; } getState(t, e) { const r = String(e), n = B({}, (this.state[t] || {})[r], (this.stateChanges[t] || {})[r]); if (null === this.deletedStates[t]) return {}; if (this.deletedStates[t]) { const r = this.deletedStates[t][e]; if (null === r) return {}; for (const t in r) delete n[t]; } return n } initializeTileState(t, e) { t.setFeatureState(this.state, e); } coalesceChanges(t, e) { const r = {}; for (const t in this.stateChanges) { this.state[t] = this.state[t] || {}; const e = {}; for (const r in this.stateChanges[t]) this.state[t][r] || (this.state[t][r] = {}), B(this.state[t][r], this.stateChanges[t][r]), e[r] = this.state[t][r]; r[t] = e; } for (const t in this.deletedStates) { this.state[t] = this.state[t] || {}; const e = {}; if (null === this.deletedStates[t]) for (const r in this.state[t]) e[r] = {}, this.state[t][r] = {}; else for (const r in this.deletedStates[t]) { if (null === this.deletedStates[t][r]) this.state[t][r] = {}; else if (this.state[t][r]) for (const e of Object.keys(this.deletedStates[t][r])) delete this.state[t][r][e]; e[r] = this.state[t][r]; } r[t] = r[t] || {}, B(r[t], e); } if (this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(r).length) for (const n in t) t[n].setFeatureState(r, e); } } class Od { constructor(t) { this.size = t, this.minimums = [], this.maximums = [], this.leaves = []; } getElevation(t, e) { const r = this.toIdx(t, e); return { min: this.minimums[r], max: this.maximums[r] } } isLeaf(t, e) { return this.leaves[this.toIdx(t, e)] } toIdx(t, e) { return e * this.size + t } } function Fd(t, e, r, n) { let i = 0, s = Number.MAX_VALUE; for (let a = 0; a < 3; a++)if (Math.abs(n[a]) < 1e-15) { if (r[a] < t[a] || r[a] > e[a]) return null } else { const o = 1 / n[a]; let l = (t[a] - r[a]) * o, u = (e[a] - r[a]) * o; if (l > u) { const t = l; l = u, u = t; } if (l > i && (i = l), u < s && (s = u), i > s) return null } return i } function jd(t, e, r, n, i, s, a, o, l, u, c) { const h = n - t, p = i - e, f = s - r, d = a - t, m = o - e, y = l - r, g = c[1] * y - c[2] * m, x = c[2] * d - c[0] * y, v = c[0] * m - c[1] * d, b = h * g + p * x + f * v; if (Math.abs(b) < 1e-15) return null; const _ = 1 / b, w = u[0] - t, M = u[1] - e, A = u[2] - r, S = (w * g + M * x + A * v) * _; if (S < 0 || S > 1) return null; const I = M * f - A * p, k = A * h - w * f, T = w * p - M * h, P = (c[0] * I + c[1] * k + c[2] * T) * _; return P < 0 || S + P > 1 ? null : (d * I + m * k + y * T) * _ } function Ud(t, e, r) { return (t - e) / (r - e) } function Nd(t, e, r, n, i, s, a, o, l) { const u = 1 << r, c = s - n, h = a - i, p = (t + 1) / u * c + n, f = (e + 0) / u * h + i, d = (e + 1) / u * h + i; o[0] = (t + 0) / u * c + n, o[1] = f, l[0] = p, l[1] = d; } class $d { 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)), r = []; let n = Math.ceil(Math.pow(2, e)); const i = 1 / n, s = (t, e, r, n, i) => { const s = n ? 1 : 0, a = (t + 1) * r - s, o = e * r, l = (e + 1) * r - s; i[0] = t * r, i[1] = o, i[2] = a, i[3] = l; }; let a = new Od(n); const o = []; for (let e = 0; e < n * n; e++) { s(e % n, Math.floor(e / n), i, !1, o); const r = Gd(o[0], o[1], t), l = Gd(o[2], o[1], t), u = Gd(o[2], o[3], t), c = Gd(o[0], o[3], t); a.minimums.push(Math.min(r, l, u, c)), a.maximums.push(Math.max(r, l, u, c)), a.leaves.push(1); } for (r.push(a), n /= 2; n >= 1; n /= 2) { const t = r[r.length - 1]; a = new Od(n); for (let e = 0; e < n * n; e++) { s(e % n, Math.floor(e / n), 2, !0, o); const r = t.getElevation(o[0], o[1]), i = t.getElevation(o[2], o[1]), l = t.getElevation(o[2], o[3]), u = t.getElevation(o[0], o[3]), c = t.isLeaf(o[0], o[1]), h = t.isLeaf(o[2], o[1]), p = t.isLeaf(o[2], o[3]), f = t.isLeaf(o[0], o[3]), d = Math.min(r.min, i.min, l.min, u.min), m = Math.max(r.max, i.max, l.max, u.max), y = c && h && p && f; a.maximums.push(m), a.minimums.push(d), a.leaves.push(m - d <= 5 && y ? 1 : 0); } r.push(a); } return r }(this.dem), r = e.length - 1, n = e[r]; this._addNode(n.minimums[0], n.maximums[0], n.leaves[0]), this._construct(e, 0, 0, r, 0); } raycastRoot(t, e, r, n, i, s, a = 1) { return Fd([t, e, -100], [r, n, this.maximums[0] * a], i, s) } raycast(e, r, n, i, s, a, o = 1) { if (!this.nodeCount) return null; const l = this.raycastRoot(e, r, n, i, s, a, o); if (null == l) return null; const u = [], c = [], h = [], p = [], f = [{ idx: 0, t: l, nodex: 0, nodey: 0, depth: 0 }]; for (; f.length > 0;) { const { idx: l, t: d, nodex: m, nodey: y, depth: g } = f.pop(); if (this.leaves[l]) { Nd(m, y, g, e, r, n, i, h, p); const l = 1 << g, u = (m + 0) / l, c = (m + 1) / l, f = (y + 0) / l, x = (y + 1) / l, v = Gd(u, f, this.dem) * o, b = Gd(c, f, this.dem) * o, _ = Gd(c, x, this.dem) * o, w = Gd(u, x, this.dem) * o, M = jd(h[0], h[1], v, p[0], h[1], b, p[0], p[1], _, s, a), A = jd(p[0], p[1], _, h[0], p[1], w, h[0], h[1], v, s, a), S = Math.min(null !== M ? M : Number.MAX_VALUE, null !== A ? A : Number.MAX_VALUE); if (S !== Number.MAX_VALUE) return S; { const e = t.v.scaleAndAdd([], s, a, d); if (qd(v, b, w, _, Ud(e[0], h[0], p[0]), Ud(e[1], h[1], p[1])) >= e[2]) return d } continue } let x = 0; for (let t = 0; t < this._siblingOffset.length; t++) { Nd((m << 1) + this._siblingOffset[t][0], (y << 1) + this._siblingOffset[t][1], g + 1, e, r, n, i, h, p), h[2] = -100, p[2] = this.maximums[this.childOffsets[l] + t] * o; const f = Fd(h, p, s, a); if (null != f) { const e = f; u[t] = e; let r = !1; for (let n = 0; n < x && !r; n++)e >= u[c[n]] && (c.splice(n, 0, t), r = !0); r || (c[x] = t), x++; } } for (let t = 0; t < x; t++) { const e = c[t]; f.push({ idx: this.childOffsets[l] + e, t: u[e], nodex: (m << 1) + this._siblingOffset[e][0], nodey: (y << 1) + this._siblingOffset[e][1], depth: g + 1 }); } } return null } _addNode(t, e, r) { return this.minimums.push(t), this.maximums.push(e), this.leaves.push(r), this.childOffsets.push(0), this.nodeCount++ } _construct(t, e, r, n, i) { if (1 === t[n].isLeaf(e, r)) return; this.childOffsets[i] || (this.childOffsets[i] = this.nodeCount); const s = n - 1, a = t[s]; let o = 0, l = 0; for (let t = 0; t < this._siblingOffset.length; t++) { const n = 2 * e + this._siblingOffset[t][0], i = 2 * r + this._siblingOffset[t][1], s = a.getElevation(n, i), u = a.isLeaf(n, i), c = this._addNode(s.min, s.max, u); u && (o |= 1 << t), l || (l = c); } for (let n = 0; n < this._siblingOffset.length; n++)o & 1 << n || this._construct(t, 2 * e + this._siblingOffset[n][0], 2 * r + this._siblingOffset[n][1], s, l + n); } } function qd(t, e, r, n, i, s) { return Mn(Mn(t, r, s), Mn(e, n, s), i) } function Gd(t, e, r) { const n = r.dim, i = k(t * n - .5, 0, n - 1), s = k(e * n - .5, 0, n - 1), a = Math.floor(i), o = Math.floor(s), l = Math.min(a + 1, n - 1), u = Math.min(o + 1, n - 1); return qd(r.get(a, o), r.get(l, o), r.get(a, u), r.get(l, u), i - a, s - o) } const Yd = { mapbox: [6553.6, 25.6, .1, 1e4], terrarium: [256, 1, 1 / 256, 32768] }; function Zd(t, e, r) { return (256 * t * 256 + 256 * e + r) / 10 - 1e4 } function Xd(t, e, r) { return 256 * t + e + r / 256 - 32768 } class Kd { get tree() { return this._tree || this._buildQuadTree(), this._tree } constructor(t, e, r, n = !1) { if (this.uid = t, e.height !== e.width) throw new RangeError("DEM tiles must be square"); if (r && "mapbox" !== r && "terrarium" !== r) return q(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`); this.stride = e.height; const i = this.dim = e.height - 2, s = new Uint32Array(e.data.buffer); if (this.pixels = new Uint8Array(e.data.buffer), this.floatView = new Float32Array(e.data.buffer), this.borderReady = n, this._modifiedForSources = {}, !n) { for (let t = 0; t < i; t++)s[this._idx(-1, t)] = s[this._idx(0, t)], s[this._idx(i, t)] = s[this._idx(i - 1, t)
vendor: 4,632 bytes, line 36
36], s[this._idx(t, -1)] = s[this._idx(t, 0)], s[this._idx(t, i)] = s[this._idx(t, i - 1)]; s[this._idx(-1, -1)] = s[this._idx(0, 0)], s[this._idx(i, -1)] = s[this._idx(i - 1, 0)], s[this._idx(-1, i)] = s[this._idx(0, i - 1)], s[this._idx(i, i)] = s[this._idx(i - 1, i - 1)]; } const a = "terrarium" === r ? Xd : Zd; for (let t = 0; t < s.length; ++t) { const e = 4 * t; this.floatView[t] = a(this.pixels[e], this.pixels[e + 1], this.pixels[e + 2]); } this._timestamp = Wt.now(); } _buildQuadTree() { this._tree = new $d(this); } get(t, e, r = !1) { r && (t = k(t, -1, this.dim), e = k(e, -1, this.dim)); const n = this._idx(t, e); return this.floatView[n] } set(t, e, r) { const n = this._idx(t, e), i = this.floatView[n]; return this.floatView[n] = r, r - i } static getUnpackVector(t) { return Yd[t] } _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) } static pack(t, e) { const r = [0, 0, 0, 0], n = Kd.getUnpackVector(e); let i = Math.floor((t + n[3]) / n[2]); return r[2] = i % 256, i = Math.floor(i / 256), r[1] = i % 256, i = Math.floor(i / 256), r[0] = i, r } getPixels() { return new tf({ width: this.stride, height: this.stride }, this.pixels) } backfillBorder(t, e, r) { if (this.dim !== t.dim) throw new Error("dem dimension mismatch"); let n = e * this.dim, i = e * this.dim + this.dim, s = r * this.dim, a = r * this.dim + this.dim; switch (e) { case -1: n = i - 1; break; case 1: i = n + 1; }switch (r) { case -1: s = a - 1; break; case 1: a = s + 1; }const o = -e * this.dim, l = -r * this.dim; for (let e = s; e < a; e++)for (let r = n; r < i; r++) { const n = 4 * this._idx(r, e), i = 4 * this._idx(r + o, e + l); this.pixels[n + 0] = t.pixels[i + 0], this.pixels[n + 1] = t.pixels[i + 1], this.pixels[n + 2] = t.pixels[i + 2], this.pixels[n + 3] = t.pixels[i + 3]; } } onDeserialize() { this._tree && (this._tree.dem = this); } } Ks(Kd, "DEMData"), Ks($d, "DemMinMaxQuadTree", { omit: ["dem"] }); class Wd { constructor(t, e, r) { this._demTile = t, this._dem = this._demTile.dem, this._scale = e, this._offset = r; } static create(t, e, r) { const n = r || t.findDEMTileFor(e); if (!n || !n.dem) return; const i = n.dem, s = n.tileID, a = 1 << e.canonical.z - s.canonical.z; return new Wd(n, i.dim / Cr / a, [(e.canonical.x / a - s.canonical.x) * i.dim, (e.canonical.y / a - s.canonical.y) * i.dim]) } tileCoordToPixel(t, e) { const r = e * this._scale + this._offset[1], n = Math.floor(t * this._scale + this._offset[0]), i = Math.floor(r); return new x(n, i) } getElevationAt(t, e, r, n) { const i = t * this._scale + this._offset[0], s = e * this._scale + this._offset[1], a = Math.floor(i), o = Math.floor(s), l = this._dem; return n = !!n, r ? Mn(Mn(l.get(a, o, n), l.get(a, o + 1, n), s - o), Mn(l.get(a + 1, o, n), l.get(a + 1, o + 1, n), s - o), i - a) : l.get(a, o, n) } getElevationAtPixel(t, e, r) { return this._dem.get(t, e, !!r) } getMeterToDEM(t) { return (1 << this._demTile.tileID.canonical.z) * Qh(1, t) * this._dem.stride } } class Hd { constructor(t, e) { this.tileID = t, this.x = t.canonical.x, this.y = t.canonical.y, this.z = t.canonical.z, this.grid = new Zs(Cr, 16, 0), this.featureIndexArray = new Po, this.promoteId = e; } insert(t, e, r, n, i, s = 0) { const a = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(r, n, i, s); const o = this.grid; for (let t = 0; t < e.length; t++) { const r = e[t], n = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; for (let t = 0; t < r.length; t++) { const e = r[t]; n[0] = Math.min(n[0], e.x), n[1] = Math.min(n[1], e.y), n[2] = Math.max(n[2], e.x), n[3] = Math.max(n[3], e.y); } n[0] < Cr && n[1] < Cr && n[2] >= 0 && n[3] >= 0 && o.insert(a, n[0], n[1], n[2], n[3]); } } loadVTLayers() { if (!this.vtLayers) { this.vtLayers = new ld(new Cd(this.rawTileData)).layers, this.sourceLayerCoder = new hd(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, r, n) { this.loadVTLayers(); const i = t.params || {}, s = ls(i.filter), a = t.tileResult, o = t.transform, l = a.bufferedTilespaceBounds, u = this.grid.query(l.min.x, l.min.y, l.max.x, l.max.y, ((t, e, r, n) => Ep(a.bufferedTilespaceGeometry, t, e, r, n))); u.sort(Qd); let c = null; o.elevation && u.length > 0 && (c = Wd.create(o.elevation, this.tileID)); const h = {}; let p; for (let o = 0; o < u.length; o++) { const l = u[o]; if (l === p) continue; p = l; const f = this.featureIndexArray.get(l); let d = null;
vendor: 14,596 bytes, line 36
36 this.loadMatchingFeature(h, f, s, i.layers, i.availableImages, e, r, n, ((e, r, n, i = 0) => (d || (d = yp(e, this.tileID.canonical, t.tileTransform)), r.queryIntersectsFeature(a, e, n, d, this.z, t.transform, t.pixelPosMatrix, c, i)))); } return h } loadMatchingFeature(t, e, r, n, i, s, a, o, l) { const { featureIndex: u, bucketIndex: c, sourceLayerIndex: h, layoutVertexArrayOffset: p } = e, f = this.bucketLayerIDs[c]; if (n && !function (t, e) { for (let r = 0; r < t.length; r++)if (e.indexOf(t[r]) >= 0) return !0; return !1 }(n, f)) return; const d = this.sourceLayerCoder.decode(h), m = this.vtLayers[d].feature(u); if (r.needGeometry) { const t = gp(m, !0); if (!r.filter(new _a(this.tileID.overscaledZ), t, this.tileID.canonical)) return } else if (!r.filter(new _a(this.tileID.overscaledZ), m)) return; const y = this.getId(m, d); for (let e = 0; e < f.length; e++) { const r = f[e]; if (n && n.indexOf(r) < 0) continue; const c = s[r]; if (!c) continue; let h = {}; void 0 !== y && o && (h = o.getState(c.sourceLayer || "_geojsonTileLayer", y)); const d = B({}, a[r]); d.paint = Jd(d.paint, c.paint, m, h, i), d.layout = Jd(d.layout, c.layout, m, h, i); const g = !l || l(m, c, h, p); if (!g) continue; const x = new Ld(m, this.z, this.x, this.y, y); x.layer = d; let v = t[r]; void 0 === v && (v = t[r] = []), v.push({ featureIndex: u, feature: x, intersectionZ: g }); } } lookupSymbolFeatures(t, e, r, n, i, s, a, o) { const l = {}; this.loadVTLayers(); const u = ls(i); for (const i of t) this.loadMatchingFeature(l, { bucketIndex: r, sourceLayerIndex: n, featureIndex: i, layoutVertexArrayOffset: 0 }, u, s, a, o, e); return l } loadFeature(t) { const { featureIndex: e, sourceLayerIndex: r } = t; this.loadVTLayers(); const n = this.sourceLayerCoder.decode(r), i = this.vtFeatures[n]; if (i[e]) return i[e]; const s = this.vtLayers[n].feature(e); return i[e] = s, s } hasLayer(t) { for (const e of this.bucketLayerIDs) for (const r of e) if (t === r) return !0; return !1 } getId(t, e) { let r = t.id; if (this.promoteId) { const n = "string" == typeof this.promoteId ? this.promoteId : this.promoteId[e]; null != n && (r = t.properties[n]), "boolean" == typeof r && (r = Number(r)); } return r } } function Jd(t, e, r, n, i) { return j(t, ((t, s) => { const a = e instanceof Pa ? e.get(s) : null; return a && a.evaluate ? a.evaluate(r, n, i) : a })) } function Qd(t, e) { return e - t } Ks(Hd, "FeatureIndex", { omit: ["rawTileData", "sourceLayerCoder"] }); const tm = Ua([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_tex_size", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), em = Ua([{ name: "a_globe_anchor", components: 3, type: "Int16" }, { name: "a_globe_normal", components: 3, type: "Float32" }], 4), rm = Ua([{ name: "a_projected_pos", components: 4, type: "Float32" }], 4); Ua([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4); const nm = Ua([{ name: "a_z_offset", components: 1, type: "Float32" }], 4), im = Ua([{ name: "a_texb", components: 2, type: "Uint16" }]), sm = Ua([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }]), am = Ua([{ name: "a_size_scale", components: 1, type: "Float32" }, { name: "a_padding", components: 2, type: "Float32" }, { name: "a_z_offset", components: 1, type: "Float32" }]); Ua([{ 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 om = Ua([{ name: "a_pos", components: 3, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), lm = Ua([{ name: "a_pos_2f", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4); Ua([{ name: "triangle", components: 3, type: "Uint16" }]), Ua([{ 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" }]), Ua([{ type: "Float32", name: "tileAnchorX" }, { type: "Float32", name: "tileAnchorY" }, { type: "Int16", name: "projectedAnchorX" }, { type: "Int16", name: "projectedAnchorY" }, { type: "Int16", name: "projectedAnchorZ" }, { type: "Int16", name: "rightJustifiedTextSymbolIndex" }, { type: "Int16", name: "centerJustifiedTextSymbolIndex" }, { type: "Int16", name: "leftJustifiedTextSymbolIndex" }, { type: "Int16", name: "verticalPlacedTextSymbolIndex" }, { type: "Int16", name: "placedIconSymbolIndex" }, { type: "Int16", name: "verticalPlacedIconSymbolIndex" }, { type: "Uint16", name: "key" }, { type: "Uint16", name: "textBoxStartIndex" }, { type: "Uint16", name: "textBoxEndIndex" }, { type: "Uint16", name: "verticalTextBoxStartIndex" }, { type: "Uint16", name: "verticalTextBoxEndIndex" }, { type: "Uint16", name: "iconBoxStartIndex" }, { type: "Uint16", name: "iconBoxEndIndex" }, { type: "Uint16", name: "verticalIconBoxStartIndex" }, { type: "Uint16", name: "verticalIconBoxEndIndex" }, { type: "Uint16", name: "featureIndex" }, { type: "Uint16", name: "numHorizontalGlyphVertices" }, { type: "Uint16", name: "numVerticalGlyphVertices" }, { type: "Uint16", name: "numIconVertices" }, { type: "Uint16", name: "numVerticalIconVertices" }, { type: "Uint16", name: "useRuntimeCollisionCircles" }, { type: "Uint32", name: "crossTileID" }, { type: "Float32", components: 2, name: "textOffset" }, { type: "Float32", name: "collisionCircleDiameter" }, { type: "Float32", name: "zOffset" }, { type: "Uint8", name: "hasIconTextFit" }]), Ua([{ type: "Float32", name: "offsetX" }]), Ua([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }]); var um = 24; const cm = 128; function hm(t, e) { const { expression: r } = e; if ("constant" === r.kind) return { kind: "constant", layoutSize: r.evaluate(new _a(t + 1)) }; if ("source" === r.kind) return { kind: "source" }; { const { zoomStops: e, interpolationType: n } = r; let i = 0; for (; i < e.length && e[i] <= t;)i++; i = Math.max(0, i - 1); let s = i; for (; s < e.length && e[s] < t + 1;)s++; s = Math.min(e.length - 1, s); const a = e[i], o = e[s]; return "composite" === r.kind ? { kind: "composite", minZoom: a, maxZoom: o, interpolationType: n } : { kind: "camera", minZoom: a, maxZoom: o, minSize: r.evaluate(new _a(a)), maxSize: r.evaluate(new _a(o)), interpolationType: n } } } function pm(t, { uSize: e, uSizeT: r }, { lowerSize: n, upperSize: i }) { return "source" === t.kind ? n / cm : "composite" === t.kind ? Mn(n / cm, i / cm, r) : e } function fm(t, e) { let r = 0, n = 0; if ("constant" === t.kind) n = t.layoutSize; else if ("source" !== t.kind) { const { interpolationType: i, minZoom: s, maxZoom: a } = t, o = i ? k(Yn.interpolationFactor(i, e, s, a), 0, 1) : 0; "camera" === t.kind ? n = Mn(t.minSize, t.maxSize, o) : r = o; } return { uSizeT: r, uSize: n } } var dm = Object.freeze({ __proto__: null, SIZE_PACK_FACTOR: cm, evaluateSizeForFeature: pm, evaluateSizeForZoom: fm, getSizeData: hm }); function mm(t, e, r) { return t.sections.forEach((t => { t.text = function (t, e, r) { const n = e.layout.get("text-transform").evaluate(r, {}); return "uppercase" === n ? t = t.toLocaleUpperCase() : "lowercase" === n && (t = t.toLocaleLowerCase()), ba.applyArabicShaping && (t = ba.applyArabicShaping(t)), t }(t.text, e, r); })), t } const ym = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂", "←": "↑", "→": "↓" }; function gm(t) { return "︶" === t || "﹈" === t || "︸" === t || "﹄" === t || "﹂" === t || "︾" === t || "︼" === t || "︺" === t || "︘" === t || "﹀" === t || "︐" === t || "︓" === t || "︔" === t || "`" === t || " ̄" === t || "︑" === t || "︒" === t } function xm(t) { return "︵" === t || "﹇" === t || "︷" === t || "﹃" === t || "﹁" === t || "︽" === t || "︻" === t || "︹" === t || "︗" === t || "︿" === t } const vm = 3; function bm(t, e, r) { e.glyphs = [], 1 === t && r.readMessage(_m, e); } function _m(t, e, r) { if (3 === t) { const { id: t, bitmap: n, width: i, height: s, left: a, top: o, advance: l } = r.readMessage(wm, {}); e.glyphs.push({ id: t, bitmap: new Jp({ width: i + 2 * vm, height: s + 2 * vm }, n), metrics: { width: i, height: s, left: a, top: o, advance: l } }); } else 4 === t ? e.ascender = r.readSVarint() : 5 === t && (e.descender = r.readSVarint()); } function wm(t, e, r) { 1 === t ? e.id = r.readVarint() : 2 === t ? e.bitmap = r.readBytes() : 3 === t ? e.width = r.readVarint() : 4 === t ? e.height = r.readVarint() : 5 === t ? e.left = r.readSVarint() : 6 === t ? e.top = r.readSVarint() : 7 === t && (e.advance = r.readVarint()); } const Mm = vm, Am = { horizontal: 1, vertical: 2, horizontalOnly: 3 }, Sm = -17; class Im { constructor() { this.scale = 1, this.fontStack = "", this.imageName = null; } static forText(t, e) { const r = new Im; return r.scale = t || 1, r.fontStack = e, r } static forImage(t) { const e = new Im; return e.imageName = t, e } } class km { constructor() { this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null; } static fromFeature(t, e) { const r = new km; for (let n = 0; n < t.sections.length; n++) { const i = t.sections[n]; i.image ? r.addImageSection(i) : r.addTextSection(i, e); } return r } length() { return this.text.length } getSection(t) { return this.sections[this.sectionIndex[t]] } getSections() { return this.sections } getSectionIndex(t) { return this.sectionIndex[t] } getCodePoint(t) { return this.text.codePointAt(t) } verticalizePunctuation(t) { this.text = function (t, e) { let r = ""; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n + 1) || null, s = t.charCodeAt(n - 1) || null; r += !e && (i && sa(i) && !ym[t[n + 1]] || s && sa(s) && !ym[t[n - 1]]) || !ym[t[n]] ? t[n] : ym[t[n]]; } return r }(this.text, t); } trim() { let t = 0; for (let e = 0; e < this.text.length && Pm[this.text.charCodeAt(e)]; e++)t++; let e = this.text.length; for (let r = this.text.length - 1; r >= 0 && r >= t && Pm[this.text.charCodeAt(r)]; r--)e--; this.text = this.text.substring(t, e), this.sectionIndex = this.sectionIndex.slice(t, e); } substring(t, e) { const r = new km; return r.text = this.text.substring(t, e), r.sectionIndex = this.sectionIndex.slice(t, e), r.sections = this.sections, r } 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(Im.forText(t.scale, t.fontStack || e)); const r = this.sections.length - 1; for (let e = 0; e < t.text.length; ++e)this.sectionIndex.push(r); } addImageSection(t) { const e = t.image ? t.image.namePrimary : ""; if (0 === e.length) return void q("Can't add FormattedSection with an empty image."); const r = this.getNextImageSectionCharCode(); r ? (this.text += String.fromCodePoint(r), this.sections.push(Im.forImage(e)), this.sectionIndex.push(this.sections.length - 1)) : q("Reached maximum number of images 6401"); } getNextImageSectionCharCode() { return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID) } } function Tm(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d) { const m = km.fromFeature(t, i); h === Am.vertical && m.verticalizePunctuation(p); let y = []; const g = function (t, e, r, n, i, s) { if (!t) return []; const a = [], o = function (t, e, r, n, i, s) { let a = 0; for (let r = 0; r < t.length(); r++) { const o = t.getSection(r); a += Em(t.getCodePoint(r), o, n, i, e, s); } return a / Math.max(1, Math.ceil(a / r)) }(t, e, r, n, i, s), l = t.text.indexOf("​") >= 0; let u = 0; for (let r = 0; r < t.length(); r++) { const h = t.getSection(r), p = t.getCodePoint(r); if (Pm[p] || (u += Em(p, h, n, i, e, s)), r < t.length() - 1) { const e = !((c = p) < 11904 || !(ta["Bopomofo Extended"](c) || ta.Bopomofo(c) || ta["CJK Compatibility Forms"](c) || ta["CJK Compatibility Ideographs"](c) || ta["CJK Compatibility"](c) || ta["CJK Radicals Supplement"](c) || ta["CJK Strokes"](c) || ta["CJK Symbols and Punctuation"](c) || ta["CJK Unified Ideographs Extension A"](c) || ta["CJK Unified Ideographs"](c) || ta["Enclosed CJK Letters and Months"](c) || ta["Halfwidth and Fullwidth Forms"](c) || ta.Hiragana(c) || ta["Ideographic Description Characters"](c) || ta["Kangxi Radicals"](c) || ta["Katakana Phonet
36ic Extensions"](c) || ta.Katakana(c) || ta["Vertical Forms"](c) || ta["Yi Radicals"](c) || ta["Yi Syllables"](c))); (zm[p] || e || h.imageName) && a.push(Cm(r + 1, u, o, a, Dm(p, t.getCodePoint(r + 1), e && l), !1)); } } var c; return Rm(Cm(t.length(), u, o, a, 0, !0)) }(m, u, s, e, n, f), { processBidirectionalText: x, processStyledBidirectionalText: v } = ba; if (x && 1 === m.sections.length) { const t = x(m.toString(), g); for (const e of t) { const t = new km; t.text = e, t.sections = m.sections; for (let r = 0; r < e.length; r++)t.sectionIndex.push(0); y.push(t); } } else if (v) { const t = v(m.text, m.sectionIndex, g); for (const e of t) { const t = new km; t.text = e[0], t.sectionIndex = e[1], t.sections = m.sections, y.push(t); } } else y = function (t, e) { const r = [], n = t.text; let i = 0; for (const n of e) r.push(t.substring(i, n)), i = n; return i < n.length && r.push(t.substring(i, n.length)), r }(m, g); const b = [], _ = { positionedLines: b, text: m.toString(), top: c[1], bottom: c[1], left: c[0], right: c[0], writingMode: h, iconsInText: !1, verticalizable: !1, hasBaseline: !1 }; return function (t, e, r, n, i, s, a, o, l, u, c, h) { let p = 0, f = 0, d = 0; const m = "right" === o ? 1 : "left" === o ? 0 : .5; let y = !1; for (const t of i) { const r = t.getSections(); for (const t of r) { if (t.imageName) continue; const r = e[t.fontStack]; if (r && (y = void 0 !== r.ascender && void 0 !== r.descender, !y)) break } if (!y) break } let g = 0; for (const a of i) { a.trim(); const i = a.getMaxScale(), o = (i - 1) * um, v = { positionedGlyphs: [], lineOffset: 0 }; t.positionedLines[g] = v; const b = v.positionedGlyphs; let _ = 0; if (!a.length()) { f += s, ++g; continue } let w = 0, M = 0; for (let s = 0; s < a.length(); s++) { const o = a.getSection(s), d = a.getSectionIndex(s), m = a.getCodePoint(s); let g = o.scale, v = null, A = null, S = null, I = um, k = 0; const T = !(l === Am.horizontal || !c && !ia(m) || c && (Pm[m] || (x = m, ta.Arabic(x) || ta["Arabic Supplement"](x) || ta["Arabic Extended-A"](x) || ta["Arabic Presentation Forms-A"](x) || ta["Arabic Presentation Forms-B"](x)))); if (o.imageName) { const e = n[o.imageName]; if (!e) continue; S = o.imageName, t.iconsInText = t.iconsInText || !0, A = e.paddedRect; const r = e.displaySize; g = g * um / h, v = { width: r[0], height: r[1], left: 0, top: -Mm, advance: T ? r[1] : r[0], localGlyph: !1 }, k = y ? -v.height * g : Sm + i * um - r[1] * g, I = v.advance; const s = (T ? r[0] : r[1]) * g - um * i; s > 0 && s > _ && (_ = s); } else { const t = r[o.fontStack]; if (!t) continue; t[m] && (A = t[m]); const n = e[o.fontStack]; if (!n) continue; const s = n.glyphs[m]; if (!s) continue; if (v = s.metrics, I = 8203 !== m ? um : 0, y) { const t = void 0 !== n.ascender ? Math.abs(n.ascender) : 0, e = void 0 !== n.descender ? Math.abs(n.descender) : 0, r = (t + e) * g; w < r && (w = r, M = (t - e) / 2 * g), k = -t * g; } else k = Sm + (i - g) * um; } T ? (t.verticalizable = !0, b.push({ glyph: m, imageName: S, x: p, y: f + k, vertical: T, scale: g, localGlyph: v.localGlyph, fontStack: o.fontStack, sectionIndex: d, metrics: v, rect: A }), p += I * g + u) : (b.push({ glyph: m, imageName: S, x: p, y: f + k, vertical: T, scale: g, localGlyph: v.localGlyph, fontStack: o.fontStack, sectionIndex: d, metrics: v, rect: A }), p += v.advance * g + u); } 0 !== b.length && (d = Math.max(p - u, d), y ? Vm(b, m, _, M, s * i / 2) : Vm(b, m, _, 0, s / 2)), p = 0; const A = s * i + _; v.lineOffset = Math.max(_, o), f += A, ++g; } var x; const v = f, { horizontalAlign: b, verticalAlign: _ } = Lm(a); ((function (t, e, r, n, i, s) { const a = (e - r) * i, o = -s * n; for (const e of t) for (const t of e.positionedGlyphs) t.x += a, t.y += o; }))(t.positionedLines, m, b, _, d, v), t.top += -_ * v, t.bottom = t.top + v, t.left += -b * d, t.right = t.left + d, t.hasBaseline = y; }(_, e, r, n, y, a, o, l, h, u, p, d), !function (t) { for (const e of t) if (0 !== e.positionedGlyphs.length) return !1; return !0 }(b) && _ } const Pm = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, zm = { 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 Em(t, e, r, n, i, s) { if (e.imageName) { const t = n[e.imageName]; return t ? t.displaySize[0] * e.scale * um / s + i : 0 } { const n = r[e.fontStack], s = n && n.glyphs[t]; return s ? s.metrics.advance * e.scale + i : 0 } } function Bm(t, e, r, n) { const i = Math.pow(t - e, 2); return n ? t < e ? i / 2 : 2 * i : i + Math.abs(r) * r } function Dm(t, e, r) { let n = 0; return 10 === t && (n -= 1e4), r && (n += 150), 40 !== t && 65288 !== t || (n += 50), 41 !== e && 65289 !== e || (n += 50), n } function Cm(t, e, r, n, i, s) { let a = null, o = Bm(e, r, i, s); for (const t of n) { const n = Bm(e - t.x, r, i, s) + t.badness; n <= o && (a = t, o = n); } return { index: t, x: e, priorBreak: a, badness: o } } function Rm(t) { return t ? Rm(t.priorBreak).concat(t.index) : [] } function Lm(t) { let e = .5, r = .5; switch (t) { case "right": case "top-right": case "bottom-right": e = 1; break;
vendor: 8,258 bytes, line 36
36 case "left": case "top-left": case "bottom-left": e = 0; }switch (t) { case "bottom": case "bottom-right": case "bottom-left": r = 1; break; case "top": case "top-right": case "top-left": r = 0; }return { horizontalAlign: e, verticalAlign: r } } function Vm(t, e, r, n, i) { if (!(e || r || n || i)) return; const s = t.length - 1, a = t[s], o = (a.x + a.metrics.advance * a.scale) * e; for (let e = 0; e <= s; e++)t[e].x -= o, t[e].y += r + n + i; } function Om(t, e, r, n) { const { horizontalAlign: i, verticalAlign: s } = Lm(n), a = r[0] - t.displaySize[0] * i, o = r[1] - t.displaySize[1] * s; return { imagePrimary: t, imageSecondary: e, top: o, bottom: o + t.displaySize[1], left: a, right: a + t.displaySize[0] } } function Fm(t, e, r, n, i, s) { const a = t.imagePrimary; let o; if (a.content) { const t = a.content, e = a.pixelRatio || 1; o = [t[0] / e, t[1] / e, a.displaySize[0] - t[2] / e, a.displaySize[1] - t[3] / e]; } const l = e.left * s, u = e.right * s; let c, h, p, f; "width" === r || "both" === r ? (f = i[0] + l - n[3], h = i[0] + u + n[1]) : (f = i[0] + (l + u - a.displaySize[0]) / 2, h = f + a.displaySize[0]); const d = e.top * s, m = e.bottom * s; return "height" === r || "both" === r ? (c = i[1] + d - n[0], p = i[1] + m + n[2]) : (c = i[1] + (d + m - a.displaySize[1]) / 2, p = c + a.displaySize[1]), { imagePrimary: a, imageSecondary: void 0, top: c, right: h, bottom: p, left: f, collisionPadding: o } } class jm extends x { constructor(t, e, r, n, i) { super(t, e), this.angle = n, this.z = r, void 0 !== i && (this.segment = i); } clone() { return new jm(this.x, this.y, this.z, this.angle, this.segment) } } function Um(t, e, r, n, i) { if (void 0 === e.segment) return !0; let s = e, a = e.segment + 1, o = 0; for (; o > -r / 2;) { if (a--, a < 0) return !1; o -= t[a].dist(s), s = t[a]; } o += t[a].dist(t[a + 1]), a++; const l = []; let u = 0; for (; o < r / 2;) { const e = t[a], r = t[a + 1]; if (!r) return !1; let s = t[a - 1].angleTo(e) - e.angleTo(r); for (s = Math.abs((s + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l.push({ distance: o, angleDelta: s }), u += s; o - l[0].distance > n;)u -= l.shift().angleDelta; if (u > i) return !1; a++, o += e.dist(r); } return !0 } function Nm(t) { let e = 0; for (let r = 0; r < t.length - 1; r++)e += t[r].dist(t[r + 1]); return e } function $m(t, e, r) { return t ? .6 * e * r : 0 } function qm(t, e) { return Math.max(t ? t.right - t.left : 0, e ? e.right - e.left : 0) } function Gm(t, e, r, n, i, s) { const a = $m(r, i, s), o = qm(r, n) * s; let l = 0; const u = Nm(t) / 2; for (let r = 0; r < t.length - 1; r++) { const n = t[r], i = t[r + 1], s = n.dist(i); if (l + s > u) { const c = (u - l) / s, h = Mn(n.x, i.x, c), p = Mn(n.y, i.y, c), f = new jm(h, p, 0, i.angleTo(n), r); return !a || Um(t, f, o, a, e) ? f : void 0 } l += s; } } function Ym(t, e, r, n, i, s, a, o, l) { const u = $m(n, s, a), c = qm(n, i), h = c * a, p = 0 === t[0].x || t[0].x === l || 0 === t[0].y || t[0].y === l; return e - h < e / 4 && (e = h + e / 4), Zm(t, p ? e / 2 * o % e : (c / 2 + 2 * s) * a * o % e, e, u, r, h, p, !1, l) } function Zm(t, e, r, n, i, s, a, o, l) { const u = s / 2, c = Nm(t); let h = 0, p = e - r, f = []; for (let e = 0; e < t.length - 1; e++) { const a = t[e], o = t[e + 1], d = a.dist(o), m = o.angleTo(a); for (; p + r < h + d;) { p += r; const y = (p - h) / d, g = Mn(a.x, o.x, y), x = Mn(a.y, o.y, y); if (g >= 0 && g < l && x >= 0 && x < l && p - u >= 0 && p + u <= c) { const r = new jm(g, x, 0, m, e); n && !Um(t, r, s, n, i) || f.push(r); } } h += d; } return o || f.length || a || (f = Zm(t, h / 2, r, n, i, s, a, !0, l)), f } function Xm(t, e, r, n, i) { const s = []; for (let a = 0; a < t.length; a++) { const o = t[a]; let l; for (let t = 0; t < o.length - 1; t++) { let a = o[t], u = o[t + 1]; a.x < e && u.x < e || (a.x < e ? a = new x(e, a.y + (e - a.x) / (u.x - a.x) * (u.y - a.y))._round() : u.x < e && (u = new x(e, a.y + (e - a.x) / (u.x - a.x) * (u.y - a.y))._round()), a.y < r && u.y < r || (a.y < r ? a = new x(a.x + (r - a.y) / (u.y - a.y) * (u.x - a.x), r)._round() : u.y < r && (u = new x(a.x + (r - a.y) / (u.y - a.y) * (u.x - a.x), r)._round()), a.x >= n && u.x >= n || (a.x >= n ? a = new x(n, a.y + (n - a.x) / (u.x - a.x) * (u.y - a.y))._round() : u.x >= n && (u = new x(n, a.y + (n - a.x) / (u.x - a.x) * (u.y - a.y))._round()), a.y >= i && u.y >= i || (a.y >= i ? a = new x(a.x + (i - a.y) / (u.y - a.y) * (u.x - a.x), i)._round() : u.y >= i && (u = new x(a.x + (i - a.y) / (u.y - a.y) * (u.x - a.x), i)._round()), l && a.equals(l[l.length - 1]) || (l = [a], s.push(l)), l.push(u))))); } } return s } function Km(t) { let e = 0, r = 0; for (const n of t) e += n.w * n.h, r = Math.max(r, n.w); t.sort(((t, e) => e.h - t.h)); const n = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e / .95)), r), h: 1 / 0 }]; let i = 0, s = 0; for (const e of t) for (let t = n.length - 1; t >= 0; t--) { const r = n[t]; if (!(e.w > r.w || e.h > r.h)) { if (e.x = r.x, e.y = r.y, s = Math.max(s, e.y + e.h), i = Math.max(i, e.x + e.w), e.w === r.w && e.h === r.h) { const e = n.pop(); t < n.length && (n[t] = e); } else e.h === r.h ? (r.x += e.w, r.w -= e.w) : e.w === r.w ? (r.y += e.h, r.h -= e.h) : (n.push({ x: r.x + e.w, y: r.y, w: r.w - e.w, h: e.h }), r.y += e.h, r.h -= e.h); break } } return { w: i, h: s, fill: e / (i * s) || 0 } } Ks(jm, "Anchor"); const Wm = 1; class Hm { constructor(t, { pixelRatio: e, version: r, stretchX: n, stretchY: i, content: s }) { this.paddedRect = t, this.pixelRatio = e, this.stretchX = n, this.stretchY = i, this.content = s, this.version = r; } get tl() { return [this.paddedRect.x + Wm, this.paddedRect.y + Wm] } get br() { return [this.paddedRect.x + this.paddedRect.w - Wm, this.paddedRect.y + this.paddedRect.h - Wm] } get displaySize() { return [(this.paddedRect.w - 2 * Wm) / this.pixelRatio, (this.paddedRect.h - 2 * Wm) / this.pixelRatio] } } class Jm { constructor(t, e) { const r = {}, n = {}; this.haveRenderCallbacks = []; const i = []; this.addImages(t, r, i), this.addImages(e, n, i); const { w: s, h: a } = Km(i), o = new Qp({ width: s || 1, height: a || 1 }); for (const e in t) { const n = t[e], i = r[e].paddedRect; Qp.copy(n.data, o, { x: 0, y: 0 }, { x: i.x + Wm, y: i.y + Wm }, n.data, n.sdf); } for (const t in e) { const r = e[t], i = n[t].paddedRect, s = i.x + Wm, a = i.y + Wm, l = r.data.width, u = r.data.height; Qp.copy(r.data, o, { x: 0, y: 0 }, { x: s, y: a }, r.data), Qp.copy(r.data, o, { x: 0, y: u - 1 }, { x: s, y: a - 1 }, { width: l, height: 1 }), Qp.copy(r.data, o, { x: 0, y: 0 }, { x: s, y: a + u }, { width: l, height: 1 }), Qp.copy(r.data, o, { x: l - 1, y: 0 }, { x: s - 1, y: a }, { width: 1, height: u }), Qp.copy(r.data, o, { x: 0, y: 0 }, { x: s + l, y: a }, { width: 1, height: u }); } this.image = o, this.iconPositions = r, this.patternPositions = n; } addImages(t, e, r) { for (const n in t) { const i = t[n], s = { x: 0, y: 0, w: i.data.width + 2 * Wm, h: i.data.height + 2 * Wm }; r.push(s), e[n] = new Hm(s, i), i.hasRenderCallback && this.haveRenderCallbacks.push(n); } } patchUpdatedImages(t, e, r) { this.haveRenderCallbacks = this.haveRenderCallbacks.filter((e => t.hasImage(e, r))), t.dispatchRenderCallbacks(this.haveRenderCallbacks, r); for (const n in t.getUpdatedImages(r)) this.patchUpdatedImage(this.iconPositions[n], t.getImage(n, r), e), this.patchUpdatedImage(this.patternPositions[n], t.getImage(n, r), e); } patchUpdatedImage(t, e, r) { if (!t || !e) return; if (t.version === e.version) return; t.version = e.version; const [n, i] = t.tl, s = !!Object.keys(this.patternPositions).length; r.update(e.data, { useMipmap: s }, { x: n, y: i }); } } Ks(Hm, "ImagePosition"), Ks(Jm, "ImageAtlas"); const Qm = 1e20; function ty(t, e, r, n, i, s, a, o, l) { for (let u = e; u < e + n; u++)ey(t, r * s + u, s, i, a, o, l); for (let u = r; u < r + i; u++)ey(t, u * s + e, 1, n, a, o, l); } function ey(t, e, r, n, i, s, a) { s[0] = 0, a[0] = -Qm, a[1] = Qm, i[0] = t[e]; for (let o = 1, l = 0, u = 0; o < n; o++) { i[o] = t[e + o * r]; const n = o * o; do { const t = s[l]; u = (i[o] - i[t] + n - t * t) / (o - t) / 2; } while (u <= a[l] && --l > -1); l++, s[l] = o, a[l] = u, a[l + 1] = Qm; } for (let o = 0, l = 0; o < n; o++) { for (;
36 a[l + 1] < o;)l++; const n = s[l], u = o - n; t[e + o * r] = i[n] + u * u; } } const ry = 2, ny = { none: 0, ideographs: 1, all: 2 }; class iy { constructor(t, e, r) { this.requestManager = t, this.localGlyphMode = e, this.localFontFamily = r, this.urls = {}, this.entries = {}, this.localGlyphs = { 200: {}, 400: {}, 500: {}, 900: {} }; } setURL(t, e) { this.urls[e] = t; } getGlyphs(t, e, r) { const i = [], s = this.urls[e] || n.GLYPHS_URL; for (const e in t) for (const r of t[e]) i.push({ stack: e, id: r }); z(i, (({ stack: t, id: e }, r) => { let n = this.entries[t]; n || (n = this.entries[t] = { glyphs: {}, requests: {}, ranges: {}, ascender: void 0, descender: void 0 }); let i = n.glyphs[e]; if (void 0 !== i) return void r(null, { stack: t, id: e, glyph: i }); if (i = this._tinySDF(n, t, e), i) return n.glyphs[e] = i, void r(null, { stack: t, id: e, glyph: i }); const a = Math.floor(e / 256); if (256 * a > 65535) return void r(new Error("glyphs > 65535 not supported")); if (n.ranges[a]) return void r(null, { stack: t, id: e, glyph: i }); let o = n.requests[a]; o || (o = n.requests[a] = [], iy.loadGlyphRange(t, a, s, 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[a] = !0; } for (const r of o) r(t, e); delete n.requests[a]; }))), o.push(((n, i) => { n ? r(n) : i && r(null, { stack: t, id: e, glyph: i.glyphs[e] || null }); })); }), ((t, e) => { if (t) r(t); else if (e) { const t = {}; for (const { stack: r, id: n, glyph: i } of e) void 0 === t[r] && (t[r] = {}), void 0 === t[r].glyphs && (t[r].glyphs = {}), t[r].glyphs[n] = i && { id: i.id, bitmap: i.bitmap.clone(), metrics: i.metrics }, t[r].ascender = this.entries[r].ascender, t[r].descender = this.entries[r].descender; r(null, t); } })); } _doesCharSupportLocalGlyph(t) { return this.localGlyphMode !== ny.none && (this.localGlyphMode === ny.all ? !!this.localFontFamily : !!this.localFontFamily && (ta["CJK Unified Ideographs"](t) || ta["Hangul Syllables"](t) || ta.Hiragana(t) || ta.Katakana(t) || ta["CJK Symbols and Punctuation"](t) || ta["CJK Unified Ideographs Extension A"](t) || ta["CJK Unified Ideographs Extension B"](t))) } _tinySDF(t, e, r) { const n = this.localFontFamily; if (!n || !this._doesCharSupportLocalGlyph(r)) return; let i = t.tinySDF; if (!i) { let r = "400"; /bold/i.test(e) ? r = "900" : /medium/i.test(e) ? r = "500" : /light/i.test(e) && (r = "200"), i = t.tinySDF = new iy.TinySDF({ fontFamily: n, fontWeight: r, fontSize: 24 * ry, buffer: 3 * ry, radius: 8 * ry }), i.fontWeight = r; } if (this.localGlyphs[i.fontWeight][r]) return this.localGlyphs[i.fontWeight][r]; const s = String.fromCodePoint(r), { data: a, width: o, height: l, glyphWidth: u, glyphHeight: c, glyphLeft: h, glyphTop: p, glyphAdvance: f } = i.draw(s); return this.localGlyphs[i.fontWeight][r] = { id: r, bitmap: new Jp({ width: o, height: l }, a), metrics: { width: u / ry, height: c / ry, left: h / ry, top: p / ry - 27, advance: f / ry, localGlyph: !0 } } } } iy.loadGlyphRange = function (t, e, r, n, i) { const s = 256 * e, a = s + 255, o = n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}", t).replace("{range}", `${s}-${a}`), ct.Glyphs); dt(o, ((t, e) => { if (t) i(t); else if (e) { const t = {}, r = function (t) { return new Cd(t).readFields(bm, {}) }(e); for (const e of r.glyphs) t[e.id] = e; i(null, { glyphs: t, ascender: r.ascender, descender: r.descender }); } })); }, iy.TinySDF = class { constructor({ fontSize: t = 24, buffer: e = 3, radius: r = 8, cutoff: n = .25, fontFamily: i = "sans-serif", fontWeight: s = "normal", fontStyle: a = "normal" } = {}) { this.buffer = e, this.cutoff = n, this.radius = r; const o = this.size = t + 4 * e, l = this._createCanvas(o), u = this.ctx = l.getContext("2d", { willReadFrequently: !0 }); u.font = `${a} ${s} ${t}px ${i}`, u.textBaseline = "alphabetic", u.textAlign = "left", u.fillStyle = "black", this.gridOuter = new Float64Array(o * o), this.gridInner = new Float64Array(o * o), this.f = new Float64Array(o), this.z = new Float64Array(o + 1), this.v = new Uint16Array(o); } _createCanvas(t) { const e = document.createElement("canvas"); return e.width = e.height = t, e } draw(t) { const { width: e, actualBoundingBoxAscent: r, actualBoundingBoxDescent: n, actualBoundingBoxLeft: i, actualBoundingBoxRight: s } = this.ctx.measureText(t), a = Math.ceil(r), o = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(s - i))), l = Math.min(this.size - this.buffer, a + Math.
vendor: 5,959 bytes, line 36
36ceil(n)), u = o + 2 * this.buffer, c = l + 2 * this.buffer, h = Math.max(u * c, 0), p = new Uint8ClampedArray(h), f = { data: p, width: u, height: c, glyphWidth: o, glyphHeight: l, glyphTop: a, glyphLeft: 0, glyphAdvance: e }; if (0 === o || 0 === l) return f; const { ctx: d, buffer: m, gridInner: y, gridOuter: g } = this; d.clearRect(m, m, o, l), d.fillText(t, m, m + a); const x = d.getImageData(m, m, o, l); g.fill(Qm, 0, h), y.fill(0, 0, h); for (let t = 0; t < l; t++)for (let e = 0; e < o; e++) { const r = x.data[4 * (t * o + e) + 3] / 255; if (0 === r) continue; const n = (t + m) * u + e + m; if (1 === r) g[n] = 0, y[n] = Qm; else { const t = .5 - r; g[n] = t > 0 ? t * t : 0, y[n] = t < 0 ? t * t : 0; } } ty(g, 0, 0, u, c, u, this.f, this.v, this.z), ty(y, m, m, o, l, u, this.f, this.v, this.z); for (let t = 0; t < h; t++) { const e = Math.sqrt(g[t]) - Math.sqrt(y[t]); p[t] = Math.round(255 - 255 * (e / this.radius + this.cutoff)); } return f } }; const sy = Wm; function ay(t, e, r, n) { const i = [], s = t.imagePrimary, a = s.pixelRatio, o = s.paddedRect.w - 2 * sy, l = s.paddedRect.h - 2 * sy, u = t.right - t.left, c = t.bottom - t.top, h = s.stretchX || [[0, o]], p = s.stretchY || [[0, l]], f = (t, e) => t + e[1] - e[0], d = h.reduce(f, 0), m = p.reduce(f, 0), y = o - d, g = l - m; let v = 0, b = d, _ = 0, w = m, M = 0, A = y, S = 0, I = g; if (s.content && n) { const t = s.content; v = oy(h, 0, t[0]), _ = oy(p, 0, t[1]), b = oy(h, t[0], t[2]), w = oy(p, t[1], t[3]), M = t[0] - v, S = t[1] - _, A = t[2] - t[0] - b, I = t[3] - t[1] - w; } const k = (n, i, o, l) => { const h = uy(n.stretch - v, b, u, t.left), p = cy(n.fixed - M, A, n.stretch, d), f = uy(i.stretch - _, w, c, t.top), y = cy(i.fixed - S, I, i.stretch, m), g = uy(o.stretch - v, b, u, t.left), k = cy(o.fixed - M, A, o.stretch, d), T = uy(l.stretch - _, w, c, t.top), P = cy(l.fixed - S, I, l.stretch, m), z = new x(h, f), E = new x(g, f), B = new x(g, T), D = new x(h, T), C = new x(p / a, y / a), R = new x(k / a, P / a), L = e * Math.PI / 180; if (L) { const t = Math.sin(L), e = Math.cos(L), r = [e, -t, t, e]; z._matMult(r), E._matMult(r), D._matMult(r), B._matMult(r); } const V = n.stretch + n.fixed, O = o.stretch + o.fixed, F = i.stretch + i.fixed, j = l.stretch + l.fixed, U = t.imageSecondary; return { tl: z, tr: E, bl: D, br: B, texPrimary: { x: s.paddedRect.x + sy + V, y: s.paddedRect.y + sy + F, w: O - V, h: j - F }, texSecondary: U ? { x: U.paddedRect.x + sy + V, y: U.paddedRect.y + sy + F, w: O - V, h: j - F } : void 0, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: C, pixelOffsetBR: R, minFontScaleX: A / a / u, minFontScaleY: I / a / c, isSDF: r } }; if (n && (s.stretchX || s.stretchY)) { const t = ly(h, y, d), e = ly(p, g, m); for (let r = 0; r < t.length - 1; r++) { const n = t[r], s = t[r + 1]; for (let t = 0; t < e.length - 1; t++)i.push(k(n, e[t], s, e[t + 1])); } } else i.push(k({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: o + 1 }, { fixed: 0, stretch: l + 1 })); return i } function oy(t, e, r) { let n = 0; for (const i of t) n += Math.max(e, Math.min(r, i[1])) - Math.max(e, Math.min(r, i[0])); return n } function ly(t, e, r) { const n = [{ fixed: -sy, stretch: 0 }]; for (const [e, r] of t) { const t = n[n.length - 1]; n.push({ fixed: e - t.stretch, stretch: t.stretch }), n.push({ fixed: e - t.stretch, stretch: t.stretch + (r - e) }); } return n.push({ fixed: e + sy, stretch: r }), n } function uy(t, e, r, n) { return t / e * r + n } function cy(t, e, r, n) { return t - e * r / n } function hy(t, e, r, n) { const i = e + t.positionedLines[n].lineOffset; return 0 === n ? r + i / 2 : r + (i + (e + t.positionedLines[n - 1].lineOffset)) / 2 } function py(t, e = 1, r = !1) { let n = 1 / 0, i = 1 / 0, s = -1 / 0, a = -1 / 0; const o = t[0]; for (let t = 0; t < o.length; t++) { const e = o[t]; (!t || e.x < n) && (n = e.x), (!t || e.y < i) && (i = e.y), (!t || e.x > s) && (s = e.x), (!t || e.y > a) && (a = e.y); } const l = Math.min(s - n, a - i); let u = l / 2; const c = new Dr([], fy); if (0 === l) return new x(n, i); for (let e = n; e < s; e += l)for (let r = i; r < a; r += l)c.push(new dy(e + u, r + u, u, t)); let h = function (t) { let e = 0, r = 0, n = 0; const i = t[0]; for (let t = 0, s = i.length, a = s - 1; t < s; a = t++) { const s = i[t], o = i[a], l = s.x * o.y - o.x * s.y; r += (s.x + o.x) * l, n += (s.y + o.y) * l, e += 3 * l; } return new dy(r / e, n / e, 0, t) }(t), p = c.length; for (; c.length;) { const n = c.pop(); (n.d > h.d || !h.d) && (h = n, r && console.log("found best %d after %d probes", Math.round(1e4 * n.d) / 1e4, p)), n.max - h.d <= e || (u = n.h / 2, c.push(new dy(n.p.x - u, n.p.y - u, u, t)), c.push(new dy(n.p.x + u, n.p.y - u, u, t)), c.push(new dy(n.p.x - u, n.p.y + u, u, t)), c.push(new dy(n.p.x + u, n.p.y + u, u, t)), p += 4); } return r && (console.log(`num probes: ${p}`), console.log(`best distance: ${h.d}`)), h.p } function fy(t, e) { return e.max - t.max } class dy { constructor(t, e, r, n) { this.p = new x(t, e), this.h = r, this.d = function (t, e) { let r = !1, n = 1 / 0; for (let i = 0; i < e.length; i++) { const s = e[i]; for (let e = 0, i = s.length, a = i - 1; e < i; a = e++) { const i = s[e], o = s[a]; i.y > t.y != o.y > t.y && t.x < (o.x - i.x) * (t.y - i.y) / (o.y - i.y) + i.x && (r = !r), n = Math.min(n, Tp(t, i, o)); } } return (r ? 1 : -1) * Math.sqrt(n) }(this.p, n), this.max = this.d + this.h * Math.SQRT2; } } const my = 7, yy = Number.POSITIVE_INFINITY, gy = Math.sqrt(2); function xy(t, [e, r]) { let n = 0, i = 0; if (r === yy) { e < 0 && (e = 0); const r = e / gy; switch (t) { case "top-right": case "top-left": i = r - my; break; case "bottom-right": case "bottom-left": i = -r + my; break; case "bottom": i = -e + my; break; case "top": i = e - my; }switch (t) { case "top-right": case "bottom-right": n = -r; break; case "top-left": case "bottom-left": n = r; break;
36 case "left": n = e; break; case "right": n = -e; } } else { switch (e = Math.abs(e), r = Math.abs(r), t) { case "top-right": case "top-left": case "top": i = r - my; break; case "bottom-right": case "bottom-left": case "bottom": i = -r + my; }switch (t) { case "top-right": case "bottom-right": case "right": n = -e; break; case "top-left": case "bottom-left": case "left": n = e; } } return [n, i] } function vy(t, e, r, n, i, s, a, o, l, u, c) { t.createArrays(), t.tilePixelRatio = Cr / (512 * t.overscaling), t.compareText = {}, t.iconsNeedLinear = !1; const h = t.layers[0].layout, p = t.layers[0]._unevaluatedLayout._values, f = {}; if ("composite" === t.textSizeData.kind) { const { minZoom: e, maxZoom: r } = t.textSizeData; f.compositeTextSizes = [p["text-size"].possiblyEvaluate(new _a(e), o), p["text-size"].possiblyEvaluate(new _a(r), o)]; } if ("composite" === t.iconSizeData.kind) { const { minZoom: e, maxZoom: r } = t.iconSizeData; f.compositeIconSizes = [p["icon-size"].possiblyEvaluate(new _a(e), o), p["icon-size"].possiblyEvaluate(new _a(r), o)]; } f.layoutTextSize = p["text-size"].possiblyEvaluate(new _a(l + 1), o), f.layoutIconSize = p["icon-size"].possiblyEvaluate(new _a(l + 1), o), f.textMaxSize = p["text-size"].possiblyEvaluate(new _a(18), o); const d = "map" === h.get("text-rotation-alignment") && "point" !== h.get("symbol-placement"), m = h.get("text-size"); let y = !1; for (const e of t.features) if (e.icon && e.icon.nameSecondary) { y = !0; break } for (const s of t.features) { const l = h.get("text-font").evaluate(s, {}, o).join(","), p = m.evaluate(s, {}, o), g = f.layoutTextSize.evaluate(s, {}, o), x = (f.layoutIconSize.evaluate(s, {}, o), { horizontal: {}, vertical: void 0 }), v = s.text; let b, _ = [0, 0]; if (v) { const n = v.toString(), a = h.get("text-letter-spacing").evaluate(s, {}, o) * um, u = h.get("text-line-height").evaluate(s, {}, o) * um, c = ra(n) ? a : 0, f = h.get("text-anchor").evaluate(s, {}, o), m = h.get("text-variable-anchor"); if (!m) { const t = h.get("text-radial-offset").evaluate(s, {}, o); _ = t ? xy(f, [t * um, yy]) : h.get("text-offset").evaluate(s, {}, o).map((t => t * um)); } let y = d ? "center" : h.get("text-justify").evaluate(s, {}, o); const b = "point" === h.get("symbol-placement"), w = b ? h.get("text-max-width").evaluate(s, {}, o) * um : 1 / 0, M = s => { t.allowVerticalPlacement && ea(n) && (x.vertical = Tm(v, e, r, i, l, w, u, f, s, c, _, Am.vertical, !0, g, p)); }; if (!d && m) { const t = "auto" === y ? m.map((t => by(t))) : [y]; let n = !1; for (let s = 0; s < t.length; s++) { const a = t[s]; if (!x.horizontal[a]) if (n) x.horizontal[a] = x.horizontal[0]; else { const t = Tm(v, e, r, i, l, w, u, "center", a, c, _, Am.horizontal, !1, g, p); t && (x.horizontal[a] = t, n = 1 === t.positionedLines.length); } } M("left"); } else { if ("auto" === y && (y = by(f)), b || h.get("text-writing-mode").indexOf("horizontal") >= 0 || !ea(n)) { const t = Tm(v, e, r, i, l, w, u, f, y, c, _, Am.horizontal, !1, g, p); t && (x.horizontal[y] = t); } M(b ? "left" : y); } } let w = !1; if (s.icon && s.icon.namePrimary) { const e = n[s.icon.namePrimary]; e && (b = Om(i[s.icon.namePrimary], s.icon.nameSecondary ? i[s.icon.nameSecondary] : void 0, h.get("icon-offset").evaluate(s, {}, o), h.get("icon-anchor").evaluate(s, {}, o)), w = e.sdf, void 0 === t.sdfIcons ? t.sdfIcons = e.sdf : t.sdfIcons !== e.sdf && q("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 M = Sy(x.horizontal) || x.vertical; t.iconsInText || (t.iconsInText = !!M && M.iconsInText), (M || b) && _y(t, s, x, b, n, f, g, 0, _, w, a, o, u, c, y); } s && t.generateCollisionDebugBuffers(l, t.collisionBoxArray); } function by(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 _y(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d) { let m = s.textMaxSize.evaluate(e, {}, h); void 0 === m && (m = a); const y = t.layers[0].layout, g = y.get("icon-offset").evaluate(e, {}, h), x = Sy(r.horizontal) || r.vertical, v = "globe" === p.name, b = um, w = a / b, M = t.tilePixelRatio * m / b, A = (B = t.overscaling, t.zoom > 18 && B > 2 && (B >>= 1), Math.max(Cr / (512 * B), 1) * y.get("symbol-spacing")), S = y.get("text-padding") * t.tilePixelRatio, I = y.get("icon-padding") * t.tilePixelRatio, k = _(y.get("text-max-angle")), T = "map" === y.get("text-rotation-alignment") && "point" !== y.get("symbol-placement"), P = "map" === y.get("icon-rotation-alignment") && "point" !== y.get("symbol-placement"), z = y.get("symbol-placement"), E = A / 2; var B; const D = y.get("icon-text-fit").evaluate(e, {}, h), C = y.get("icon-text-fit-padding").evaluate(e, {}, h), R = "none" !== D; let L; !1 === t.hasAnyIconTextFit && R && (t.hasAnyIconTextFit = !0), n && R && (t.allowVerticalPlacement && r.vertical && (L = Fm(n, r.vertical, D, C, g, w)), x && (n = Fm(n, x, D, 
vendor: 11,338 bytes, line 36
36C, g, w))); const V = (a, o, m) => { if (o.x < 0 || o.x >= Cr || o.y < 0 || o.y >= Cr) return; let y = null; if (v) { const { x: t, y: e, z: r } = p.projectTilePoint(o.x, o.y, m); y = { anchor: new jm(t, e, r, 0, void 0), up: p.upVector(m, o.x, o.y) }; } !function (t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g, x, v, b, _, w, M, A, S, I) { const k = t.addToLineVertexArray(e, n); let T, P, z, E, B, D, C, R = 0, L = 0, V = 0, O = 0, F = -1, j = -1; const U = {}; let N = $o(""); const $ = r ? r.anchor : e, G = "none" !== l.layout.get("icon-text-fit").evaluate(b, {}, A); let Y = 0, Z = 0; if (void 0 === l._unevaluatedLayout.getValue("text-radial-offset") ? [Y, Z] = l.layout.get("text-offset").evaluate(b, {}, A).map((t => t * um)) : (Y = l.layout.get("text-radial-offset").evaluate(b, {}, A) * um, Z = yy), t.allowVerticalPlacement && i.vertical) { const t = i.vertical; if (d) D = ky(t), o && (C = ky(o)); else { const r = l.layout.get("text-rotate").evaluate(b, {}, A) + 90; z = Iy(u, $, e, c, h, p, t, f, r, m), o && (E = Iy(u, $, e, c, h, p, o, g, r)); } } if (s) { const n = l.layout.get("icon-rotate").evaluate(b, {}, A), i = ay(s, n, w, G), a = o ? ay(o, n, w, G) : void 0; P = Iy(u, $, e, c, h, p, s, g, n), R = 4 * i.length; const f = t.iconSizeData; let d = null; "source" === f.kind ? (d = [cm * l.layout.get("icon-size").evaluate(b, {}, A)], d[0] > My && q(`${t.layerIds[0]}: Value for "icon-size" is >= ${wy}. Reduce your "icon-size".`)) : "composite" === f.kind && (d = [cm * _.compositeIconSizes[0].evaluate(b, {}, A), cm * _.compositeIconSizes[1].evaluate(b, {}, A)], (d[0] > My || d[1] > My) && q(`${t.layerIds[0]}: Value for "icon-size" is >= ${wy}. Reduce your "icon-size".`)), t.addSymbols(t.icon, i, d, v, x, b, !1, r, e, k.lineStartIndex, k.lineLength, -1, M, A, S, I), F = t.icon.placedSymbolArray.length - 1, a && (L = 4 * a.length, t.addSymbols(t.icon, a, d, v, x, b, Am.vertical, r, e, k.lineStartIndex, k.lineLength, -1, M, A, S, I), j = t.icon.placedSymbolArray.length - 1); } for (const n in i.horizontal) { const s = i.horizontal[n]; T || (N = $o(s.text), d ? B = ky(s) : T = Iy(u, $, e, c, h, p, s, f, l.layout.get("text-rotate").evaluate(b, {}, A), m)); const o = 1 === s.positionedLines.length; if (V += Ay(t, r, e, s, a, l, d, b, m, k, i.vertical ? Am.horizontal : Am.horizontalOnly, o ? Object.keys(i.horizontal) : [n], U, F, _, M, A, S), o) break } i.vertical && (O += Ay(t, r, e, i.vertical, a, l, d, b, m, k, Am.vertical, ["vertical"], U, j, _, M, A, S)); let X = -1; const K = (t, e) => t ? Math.max(t, e) : e; X = K(B, X), X = K(D, X), X = K(C, X); const W = X > -1 ? 1 : 0; t.glyphOffsetArray.length >= fg.MAX_GLYPHS && q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), void 0 !== b.sortKey && t.addToSortKeyRanges(t.symbolInstances.length, b.sortKey), t.symbolInstances.emplaceBack(e.x, e.y, $.x, $.y, $.z, U.right >= 0 ? U.right : -1, U.center >= 0 ? U.center : -1, U.left >= 0 ? U.left : -1, U.vertical >= 0 ? U.vertical : -1, F, j, N, void 0 !== T ? T : t.collisionBoxArray.length, void 0 !== T ? T + 1 : t.collisionBoxArray.length, void 0 !== z ? z : t.collisionBoxArray.length, void 0 !== z ? z + 1 : t.collisionBoxArray.length, void 0 !== P ? P : t.collisionBoxArray.length, void 0 !== P ? P + 1 : t.collisionBoxArray.length, E || t.collisionBoxArray.length, E ? E + 1 : t.collisionBoxArray.length, c, V, O, R, L, W, 0, Y, Z, X, 0, G ? 1 : 0); }(t, o, y, a, r, n, i, L, t.layers[0], t.collisionBoxArray, e.index, e.sourceLayerIndex, t.index, S, T, l, 0, I, P, g, e, s, u, c, h, f, d); }; if ("line" === z) for (const i of Xm(e.geometry, 0, 0, Cr, Cr)) { const e = Ym(i, A, k, r.vertical || x, n, b, M, t.overscaling, Cr); for (const r of e) x && Ty(t, x.text, E, r) || V(i, r, h); } else if ("line-center" === z) { for (const t of e.geometry) if (t.length > 1) { const e = Gm(t, k, r.vertical || x, n, b, M); e && V(t, e, h); } } else if ("Polygon" === e.type) for (const t of Vf(e.geometry, 0)) { const e = py(t, 16); V(t[0], new jm(e.x, e.y, 0, 0, void 0), h); } else if ("LineString" === e.type) for (const t of e.geometry) V(t, new jm(t[0].x, t[0].y, 0, 0, void 0), h); else if ("Point" === e.type) for (const t of e.geometry) for (const e of t) V([e], new jm(e.x, e.y, 0, 0, void 0), h); } const wy = 255, My = wy * cm; function Ay(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m, y, g) { const v = function (t, e, r, n, i, s, a, o) { const l = []; if (0 === e.positionedLines.length) return l; const u = n.layout.get("text-rotate").evaluate(s, {}) * Math.PI / 180, c = function (t) { const e = t[0], r = t[1], n = e * r; return n > 0 ? [e, -r] : n < 0 ? [-e, r] : 0 === e ? [r, e] : [r, -e] }(r); let h = Math.abs(e.top - e.bottom); for (const t of e.positionedLines) h -= t.lineOffset; const p = e.positionedLines.length, f = h / p; let d = e.top - r[1]; for (let t = 0; t < p; ++t) { const n = e.positionedLines[t]; d = hy(e, f, d, t); for (const t of n.positionedGlyphs) { if (!t.rect) continue; const n = t.rect || {}; let s = Mm + 1, h = !0, p = 1, f = 0; if (t.imageName) { const e = a[t.imageName]; if (!e) continue; if (e.sdf) { q("SDF images are not supported in formatted text and will be ignored."); continue } h = !1, p = e.pixelRatio, s = Wm / p; } const m = (i || o) && t.vertical, y = t.metrics.advance * t.scale / 2, g = t.metrics, v = t.rect; if (null === v) continue; o && e.verticalizable && (f = t.imageName ? y - t.metrics.width * t.scale / 2 : 0); const b = i ? [t.x + y, t.y] : [0, 0]; let _ = [0, 0], w = [0, 0], M = !1; i || (m ? (w = [t.x + y + c[0], t.y + c[1] - f], M = !0) : _ = [t.x + y + r[0], t.y + r[1] - f]); const A = v.w * t.scale / (p * (t.localGlyph ? ry : 1)), S = v.h * t.scale / (p * (t.localGlyph ? ry : 1)); let I, k, T, P; if (m) { const e = t.y - d, r = new x(-y, y - e), n = -Math.PI / 2, i = new x(...w); I = new x(-y + _[0], _[1]), I._rotateAround(n, r)._add(i), I.x += -e + y, I.y -= (g.left - s) * t.scale; const a = t.imageName ? g.advance * t.scale : um * t.scale, o = String.fromCodePoint(t.glyph); gm(o) ? I.x += (1 - s) * t.scale : xm(o) ? I.x += a - g.height * t.scale + (-s - 1) * t.scale : I.x += t.imageName || g.width + 2 * s === v.w && g.height + 2 * s === v.h ? (a - S) / 2 : (a - (g.height + 2 * s) * t.scale) / 2, k = new x(I.x, I.y - A), T = new x(I.x + S, I.y), P = new x(I.x + S, I.y - A); } else { const e = (g.left - s) * t.scale - y + _[0], r = (-g.top - s) * t.scale + _[1], n = e + A, i = r + S; I = new x(e, r), k = new x(n, r), T = new x(e, i), P = new x(n, i); } if (u) { let t; t = i ? new x(0, 0) : M ? new x(c[0], c[1]) : new x(r[0], r[1]), I._rotateAround(u, t), k._rotateAround(u, t), T._rotateAround(u, t), P._rotateAround(u, t); } const z = new x(0, 0), E = new x(0, 0); l.push({ tl: I, tr: k, bl: T, br: P, texPrimary: n, texSecondary: void 0, writingMode: e.writingMode, glyphOffset: b, sectionIndex: t.sectionIndex, isSDF: h, pixelOffsetTL: z, pixelOffsetBR: E, minFontScaleX: 0, minFontScaleY: 0 }); } } return l }(0, n, l, s, a, o, i, t.allowVerticalPlacement), b = t.textSizeData; let _ = null; "source" === b.kind ? (_ = [cm * s.layout.get("text-size").evaluate(o, {}, y)], _[0] > My && q(`${t.layerIds[0]}: Value for "text-size" is >= ${wy}. Reduce your "text-size".`)) : "composite" === b.kind && (_ = [cm * d.compositeTextSizes[0].evaluate(o, {}, y), cm * d.compositeTextSizes[1].evaluate(o, {}, y)], (_[0] > My || _[1] > My) && q(`${t.layerIds[0]}: Value for "text-size" is >= ${wy}. Reduce your "text-size".`)), t.addSymbols(t.text, v, _, l, a, o, c, e, r, u.lineStartIndex, u.lineLength, f, m, y, g, !1); for (const e of h) p[e] = t.text.placedSymbolArray.length - 1; return 4 * v.length } function Sy(t) { for (const e in t) return t[e]; return null } function Iy(t, e, r, n, i, s, a, o, l, u) { let c = a.top, h = a.bottom, p = a.left, f = a.right; const d = a.collisionPadding; if (d && (p -= d[0], c -= d[1], f += d[2], h += d[3]), l) { const t = new x(p, c), e = new x(f, c), r = new x(p, h), n = new x(f, h), i = _(l); let s = new x(0, 0); u && (s = new x(u[0], u[1])), t._rotateAround(i, s), e._rotateAround(i, s), r._rotateAround(i, s), n._rotateAround(i, s), p = Math.min(t.x, e.x, r.x, n.x), f = Math.max(t.x, e.x, r.x, n.x), c = Math.min(t.y, e.y, r.y, n.y), h = Math.max(t.y, e.y, r.y, n.y); } return t.emplaceBack(e.x, e.y, e.z, r.x, r.y, p, c, f, h, o, n, i, s), t.length - 1 } function ky(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 Ty(t, e, r, n) { const i = t.compareText; if (e in i) { const t = i[e]; for (let e = t.length - 1; e >= 0; e--)if (n.dist(t[e]) < r) return !0 } else i[e] = []; return i[e].push(n), !1 } function Py(t, e) { const r = t.fovAboveCenter, n = t.elevation ? t.elevation.getMinElevationBelowMSL() * e : 0, i = (t._camera.position[2] * t.worldSize - n) / Math.cos(t._pitch), s = Math.sin(r) * i / Math.sin(Math.max(Math.PI / 2 - t._pitch - r, .01)), a = Math.sin(t._pitch) * s + i; return Math.min(1.01 * a, i * (1 / t._horizonShift)) } function zy(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 r = Math.pow(2, -t.z), n = t.x * r, i = (t.x + 1) * r, s = t.y * r, a = (t.y + 1) * r, o = tp(n), l = tp(i), u = ep(s), c = ep(a), h = e.project(o, u), p = e.project(l, u), f = e.project(l, c), d = e.project(o, c); let m = Math.min(h.x, p.x, f.x, d.x), y = Math.min(h.y, p.y, f.y, d.y), g = Math.max(h.x, p.x, f.x, d.x), x = Math.max(h.y, p.y, f.y, d.y); const v = r / 16; function b(t, r, n, i, s, a) { const o = (n + s) / 2, l = (i + a) / 2, u = e.project(tp(o), ep(l)), c = Math.max(0, m - u.x, y - u.y, u.x - g, u.y - x); m = Math.min(m, u.x), g = Math.max(g, u.x), y = Math.min(y, u.y), x = Math.max(x, u.y), c > v && (b(t, u, n, i, o, l), b(u, r, o, l, s, a)); } b(h, p, n, s, i, s), b(p, f, i, s, i, a), b(f, d, i, a, n, a), b(d, h, n, a, n, s), m -= v, y -= v, g += v, x += v; const _ = 1 / Math.max(g - m, x - y); return { scale: _, x: m * _, y: y * _, x2: g * _, y2: x * _, projection: e } } function Ey(t, { x: e, y: r }, n = 0) { return new x(((e - n) * t.scale - t.x) * Cr, (r * t.scale - t.y) * Cr) } const By = t.m.identity(new Float32Array(16)); class Dy { 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 Zh(0, 0) } projectTilePoint(t, e, r) { return { x: t, y: e, z: 0 } } locationPoint(t, e, r = !0) { return t._coordinatePoint(t.locationCoordinate(e), r) } pixelsPerMeter(t, e) { return Qh(1, t) * e } pixelSpaceConversion(t, e, r) { return 1 } farthestPixelDistance(t) { return Py(t, t.pixelsPerMeter) } pointCoordinate(t, e, r, n) { const i = t.horizonLineFromTop(!1), s = new x(e, Math.max(i, r)); return t.rayIntersectionCoordinate(t.pointRayIntersection(s, n)) } pointCoordinate3D(t, e, r) { const n = new x(e, r); if (t.elevation) return t.elevation.pointCoordinate(n);
vendor: 20,527 bytes, line 36
36 { const e = this.pointCoordinate(t, n.x, n.y, 0); return [e.x, e.y, e.z] } } isPointAboveHorizon(t, e) { if (t.elevation) return !this.pointCoordinate3D(t, e.x, e.y); const r = t.horizonLineFromTop(); return e.y < r } createInversionMatrix(t, e) { return By } createTileMatrix(e, r, n) { let i, s, a; const o = n.canonical, l = t.m.identity(new Float64Array(16)); if (this.isReprojectedInTileSpace) { const u = zy(o, this); i = 1, s = u.x + n.wrap * u.scale, a = u.y, t.m.scale(l, l, [i / u.scale, i / u.scale, e.pixelsPerMeter / r]); } else i = r / e.zoomScale(o.z), s = (o.x + Math.pow(2, o.z) * n.wrap) * i, a = o.y * i; return t.m.translate(l, l, [s, a, 0]), t.m.scale(l, l, [i / Cr, i / Cr, 1]), l } upVector(t, e, r) { return [0, 0, 1] } upVectorScale(t, e, r) { return { metersToTile: 1 } } } class Cy extends Dy { constructor(t) { super(t), this.range = [4, 7], this.center = t.center || [-96, 37.5]; const [e, r] = this.parallels = t.parallels || [29.5, 45.5], n = Math.sin(_(e)); this.n = (n + Math.sin(_(r))) / 2, this.c = 1 + n * (2 * this.n - n), this.r0 = Math.sqrt(this.c) / this.n; } project(t, e) { const { n: r, c: n, r0: i } = this, s = _(t - this.center[0]), a = _(e), o = Math.sqrt(n - 2 * r * Math.sin(a)) / r; return { x: o * Math.sin(s * r), y: o * Math.cos(s * r) - i, z: 0 } } unproject(t, e) { const { n: r, c: n, r0: i } = this, s = i + e; let a = Math.atan2(t, Math.abs(s)) * Math.sign(s); s * r < 0 && (a -= Math.PI * Math.sign(t) * Math.sign(s)); const o = _(this.center[0]) * r; a = P(a, -Math.PI - o, Math.PI - o); const l = k(w(a / r) + this.center[0], -180, 180), u = Math.asin(k((n - (t * t + s * s) * r * r) / (2 * r), -1, 1)), c = k(w(u), -np, np); return new Zh(l, c) } } const Ry = 1.340264, Ly = -.081106, Vy = 893e-6, Oy = .003796, Fy = Math.sqrt(3) / 2; class jy extends Dy { project(t, e) { e = e / 180 * Math.PI, t = t / 180 * Math.PI; const r = Math.asin(Fy * Math.sin(e)), n = r * r, i = n * n * n; return { x: .5 * (t * Math.cos(r) / (Fy * (Ry + 3 * Ly * n + i * (7 * Vy + 9 * Oy * n))) / Math.PI + .5), y: 1 - .5 * (r * (Ry + Ly * n + i * (Vy + Oy * n)) / Math.PI + 1), z: 0 } } unproject(t, e) { t = (2 * t - .5) * Math.PI; let r = e = (2 * (1 - e) - 1) * Math.PI, n = r * r, i = n * n * n; for (let t, s, a, o = 0; o < 12 && (s = r * (Ry + Ly * n + i * (Vy + Oy * n)) - e, a = Ry + 3 * Ly * n + i * (7 * Vy + 9 * Oy * n), t = s / a, r = k(r - t, -Math.PI / 3, Math.PI / 3), n = r * r, i = n * n * n, !(Math.abs(t) < 1e-12)); ++o); const s = Fy * t * (Ry + 3 * Ly * n + i * (7 * Vy + 9 * Oy * n)) / Math.cos(r), a = Math.asin(Math.sin(r) / Fy), o = k(180 * s / Math.PI, -180, 180), l = k(180 * a / Math.PI, -np, np); return new Zh(o, l) } } class Uy extends Dy { 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 r = 360 * (t - .5), n = k(360 * (.5 - e), -np, np); return new Zh(r, n) } } const Ny = Math.PI / 2; function $y(t) { return Math.tan((Ny + t) / 2) } class qy extends Dy { constructor(t) { super(t), this.center = t.center || [0, 30]; const [e, r] = this.parallels = t.parallels || [30, 30]; let n = _(e), i = _(r); this.southernCenter = n + i < 0, this.southernCenter && (n = -n, i = -i); const s = Math.cos(n), a = $y(n); this.n = n === i ? Math.sin(n) : Math.log(s / Math.cos(i)) / Math.log($y(i) / a), this.f = s * Math.pow($y(n), this.n) / this.n; } project(t, e) { e = _(e), this.southernCenter && (e = -e), t = _(t - this.center[0]); const r = 1e-6, { n: n, f: i } = this; i > 0 ? e < -Ny + r && (e = -Ny + r) : e > Ny - r && (e = Ny - r); const s = i / Math.pow($y(e), n); let a = s * Math.sin(n * t), o = i - s * Math.cos(n * t); return a = .5 * (a / Math.PI + .5), o = .5 * (o / Math.PI + .5), { x: a, y: this.southernCenter ? o : 1 - o, z: 0 } } unproject(t, e) { t = (2 * t - .5) * Math.PI, this.southernCenter && (e = 1 - e), e = (2 * (1 - e) - .5) * Math.PI; const { n: r, f: n } = this, i = n - e, s = Math.sign(i), a = Math.sign(r) * Math.sqrt(t * t + i * i); let o = Math.atan2(t, Math.abs(i)) * s; i * r < 0 && (o -= Math.PI * Math.sign(t) * s); const l = k(w(o / r) + this.center[0], -180, 180), u = k(w(2 * Math.atan(Math.pow(n / a, 1 / r)) - Ny), -np, np); return new Zh(l, this.southernCenter ? -u : u) } } class Gy extends Dy { 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: Hh(t), y: Jh(e), z: 0 } } unproject(t, e) { const r = tp(t), n = ep(e); return new Zh(r, n) } } const Yy = _(np); class Zy extends Dy { project(t, e) { const r = (e = _(e)) * e, n = r * r; return { x: .5 * ((t = _(t)) * (.8707 - .131979 * r + n * (n * (.003971 * r - .001529 * n) - .013791)) / Math.PI + .5), y: 1 - .5 * (e * (1.007226 + r * (.015085 + n * (.028874 * r - .044475 - .005916 * n))) / Math.PI + 1), z: 0 } } unproject(t, e) { t = (2 * t - .5) * Math.PI; let r = e = (2 * (1 - e) - 1) * Math.PI, n = 25, i = 0, s = r * r; do { s = r * r; const t = s * s; i = (r * (1.007226 + s * (.015085 + t * (.028874 * s - .044475 - .005916 * t))) - e) / (1.007226 + s * (.045255 + t * (.259866 * s - .311325 - .005916 * 11 * t))), r = k(r - i, -Yy, Yy); } while (Math.abs(i) > 1e-6 && --n > 0); s = r * r; const a = k(w(t / (.8707 + s * (s * (s * s * s * (.003971 - .001529 * s) - .013791) - .131979))), -180, 180), o = w(r); return new Zh(a, o) } } const Xy = _(np); class Ky extends Dy { project(t, e) { e = _(e), t = _(t); const r = Math.cos(e), n = 2 / Math.PI, i = Math.acos(r * Math.cos(t / 2)), s = Math.sin(i) / i, a = .5 * (t * n + 2 * r * Math.sin(t / 2) / s) || 0, o = .5 * (e + Math.sin(e) / s) || 0; return { x: .5 * (a / Math.PI + .5), y: 1 - .5 * (o / Math.PI + 1), z: 0 } } unproject(t, e) { let r = t = (2 * t - .5) * Math.PI, n = e = (2 * (1 - e) - 1) * Math.PI, i = 25; const s = 1e-6; let a = 0, o = 0; do { const i = Math.cos(n), s = Math.sin(n), l = 2 * s * i, u = s * s, c = i * i, h = Math.cos(r / 2), p = Math.sin(r / 2), f = 2 * h * p, d = p * p, m = 1 - c * h * h, y = m ? 1 / m : 0, g = m ? Math.acos(i * h) * Math.sqrt(1 / m) : 0, x = .5 * (2 * g * i * p + 2 * r / Math.PI) - t, v = .5 * (g * s + n) - e, b = .5 * y * (c * d + g * i * h * u) + 1 / Math.PI, _ = y * (f * l / 4 - g * s * p), w = .125 * y * (l * p - g * s * c * f), M = .5 * y * (u * h + g * d * i) + .5, A = _ * w - M * b; a = (v * _ - x * M) / A, o = (x * w - v * b) / A, r = k(r - a, -Math.PI, Math.PI), n = k(n - o, -Xy, Xy); } while ((Math.abs(a) > s || Math.abs(o) > s) && --i > 0); return new Zh(w(r), w(n)) } } class Wy extends Dy { constructor(t) { super(t), this.center = t.center || [0, 0], this.parallels = t.parallels || [0, 0], this.cosPhi = Math.max(.01, Math.cos(_(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: r, cosPhi: n } = this; return { x: _(t) * n * r + .5, y: -Math.sin(_(e)) / n * r + .5, z: 0 } } unproject(t, e) { const { scale: r, cosPhi: n } = this, i = -(e - .5) / r, s = k(w((t - .5) / r) / n, -180, 180), a = Math.asin(k(i * n, -1, 1)), o = k(w(a), -np, np); return new Zh(s, o) } } class Hy extends Gy { constructor(t) { super(t), this.requiresDraping = !0, this.supportsWorldCopies = !1, this.supportsFog = !0, this.zAxisUnit = "pixels", this.unsupportedLayers = ["debug"], this.range = [3, 5]; } projectTilePoint(e, r, n) { const i = zh(e, r, n), s = Dh(_h(n)); return t.v.transformMat4(i, i, s), { x: i[0], y: i[1], z: i[2] } } locationPoint(e, r) { const n = Ph(r.lat, r.lng), i = t.v.normalize([], n), s = e.elevation ? e.elevation.getAtPointOrZero(e.locationCoordinate(r), e._centerAltitude) : e._centerAltitude, a = Qh(1, 0) * Cr * s; t.v.scaleAndAdd(n, n, i, a); const o = t.m.identity(new Float64Array(16)); return t.m.multiply(o, e.pixelMatrix, e.globeMatrix), t.v.transformMat4(n, n, o), new x(n[0], n[1]) } pixelsPerMeter(t, e) { return Qh(1, 0) * e } pixelSpaceConversion(t, e, r) { const n = Qh(1, t) * e, i = Mn(Qh(1, 45) * e, n, r); return this.pixelsPerMeter(t, e) / i } createTileMatrix(e, r, n) { const i = Ch(_h(n.canonical)); return t.m.multiply(new Float64Array(16), e.globeMatrix, i) } createInversionMatrix(e, r) { const { center: n } = e, i = Dh(_h(r)); return t.m.rotateY(i, i, _(n.lng)), t.m.rotateX(i, i, _(n.lat)), t.m.scale(i, i, [e._pixelsPerMercatorPixel, e._pixelsPerMercatorPixel, 1]), Float32Array.from(i) } pointCoordinate(t, e, r, n) { return xh(t, e, r, !0) || new lp(0, 0) } pointCoordinate3D(t, e, r) { const n = this.pointCoordinate(t, e, r, 0); return [n.x, n.y, n.z] } isPointAboveHorizon(t, e) { return !xh(t, e.x, e.y, !1) } farthestPixelDistance(e) { const r = function (e, r) { const n = e.cameraToCenterDistance, i = e._centerAltitude * r, s = e._camera, a = e._camera.forward(), o = t.v.add([], t.v.scale([], a, -n), [0, 0, i]), l = e.worldSize / (2 * Math.PI), u = [0, 0, -l], c = e.width / e.height, h = Math.tan(e.fovAboveCenter), p = t.v.scale([], s.up(), h), f = t.v.scale([], s.right(), h * c), d = t.v.normalize([], t.v.add([], t.v.add([], a, p), f)), m = []; let y; if (new th(o, d).closestPointOnSphere(u, l, m)) { const r = t.v.add([], m, u), n = t.v.sub([], r, o); y = Math.cos(e.fovAboveCenter) * t.v.length(n); } else { const e = t.v.sub([], o, u), r = t.v.sub([], u, o); t.v.normalize(r, r); const n = t.v.length(e) - l; y = Math.sqrt(n * (n + 2 * l)); const i = Math.acos(y / (l + n)) - Math.acos(t.v.dot(a, r)); y *= Math.cos(i); } return 1.01 * y }(e, this.pixelsPerMeter(e.center.lat, e.worldSize)), n = Oh(e.zoom); if (n > 0) { const t = Py(e, Qh(1, e.center.lat) * e.worldSize), i = e.worldSize / (2 * Math.PI), s = Math.max(e.width, e.height) / e.worldSize * Math.PI; return Mn(r, t + i * (1 - Math.cos(s)), Math.pow(n, 10)) } return r } upVector(t, e, r) { return zh(e, r, t, 1) } upVectorScale(t) { return { metersToTile: gh(Eh(_h(t))) } } } function Jy(t) { const e = t.parallels, r = !!e && Math.abs(e[0] + e[1]) < .01; switch (t.name) { case "mercator": return new Gy(t); case "equirectangular": return new Uy(t); case "naturalEarth": return new Zy(t); case "equalEarth": return new jy(t); case "winkelTripel": return new Ky(t); case "albers": return r ? new Wy(t) : new Cy(t); case "lambertConformalConic": return r ? new Wy(t) : new qy(t); case "globe": return new Hy(t) }throw new Error(`Invalid projection name: ${t.name}`) } const Qy = new Da({ "symbol-placement": new za(re.layout_symbol["symbol-placement"]), "symbol-spacing": new za(re.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new za(re.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new Ea(re.layout_symbol["symbol-sort-key"]), "symbol-z-order": new za(re.layout_symbol["symbol-z-order"]), "symbol-z-elevate": new za(re.layout_symbol["symbol-z-elevate"]), "icon-allow-overlap": new za(re.layout_symbol["icon-allow-overlap"]), "icon-ignore-placement": new za(re.layout_symbol["icon-ignore-placement"]), "icon-optional": new za(re.layout_symbol["icon-optional"]), "icon-rotation-alignment": new za(re.layout_symbol["icon-rotation-alignment"]), "icon-size": new Ea(re.layout_symbol["icon-size"]), "icon-text-fit": new Ea(re.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new Ea(re.layout_symbol["icon-text-fit-padding"]), "icon-image": new Ea(re.layout_symbol["icon-image"]), "icon-rotate": new Ea(re.layout_symbol["icon-rotate"]), "icon-padding": new za(re.layout_symbol["icon-padding"]), "icon-keep-upright": new za(re.layout_symbol["icon-keep-upright"]), "icon-offset": new Ea(re.layout_symbol["icon-offset"]), "icon-anchor": new Ea(re.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new za(re.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new za(re.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new za(re.layout_symbol["text-rotation-alignment"]), "text-field": new Ea(re.layout_symbol["text-field"]), "text-font": new Ea(re.layout_symbol["text-font"]), "text-size": new Ea(re.layout_symbol["text-size"]), "text-max-width": new Ea(re.layout_symbol["text-max-width"]), "text-line-height": new Ea(re.layout_symbol["text-line-height"]), "text-letter-spacing": new Ea(re.layout_symbol["text-letter-spacing"]), "text-justify": new Ea(re.layout_symbol["text-justify"]), "text-radial-offset": new Ea(re.layout_symbol["text-radial-offset"]), "text-variable-anchor": new za(re.layout_symbol["text-variable-anchor"]), "text-anchor": new Ea(re.layout_symbol["text-anchor"]), "text-max-angle": new za(re.layout_symbol["text-max-angle"]), "text-writing-mode": new za(re.layout_symbol["text-writing-mode"]), "text-rotate": new Ea(re.layout_symbol["text-rotate"]), "text-padding": new za(re.layout_symbol["text-padding"]), "text-keep-upright": new za(re.layout_symbol["text-keep-upright"]), "text-transform": new Ea(re.layout_symbol["text-transform"]), "text-offset": new Ea(re.layout_symbol["text-offset"]), "text-allow-overlap": new za(re.layout_symbol["text-allow-overlap"]), "text-ignore-placement": new za(re.layout_symbol["text-ignore-placement"]), "text-optional": new za(re.layout_symbol["text-optional"]), visibility: new za(re.layout_symbol.visibility) }); var tg = { paint: new Da({ "icon-opacity": new Ea(re.paint_symbol["icon-opacity"]), "icon-emissive-strength": new Ea(re.paint_symbol["icon-emissive-strength"]), "text-emissive-strength": new Ea(re.paint_symbol["text-emissive-strength"]), "icon-color": new Ea(re.paint_symbol["icon-color"]), "icon-halo-color": new Ea(re.paint_symbol["icon-halo-color"]), "icon-halo-width": new Ea(re.paint_symbol["icon-halo-width"]), "icon-halo-blur": new Ea(re.paint_symbol["icon-halo-blur"]), "icon-translate": new za(re.paint_symbol["icon-translate"]), "icon-translate-anchor": new za(re.paint_symbol["icon-translate-anchor"]), "icon-image-cross-fade": new Ea(re.paint_symbol["icon-image-cross-fade"]), "text-opacity": new Ea(re.paint_symbol["text-opacity"]), "text-color": new Ea(re.paint_symbol["text-color"], { runtimeType: ye, getOverride: t => t.textColor, hasOverride: t => !!t.textColor }), "text-halo-color": new Ea(re.paint_symbol["text-halo-color"]), "text-halo-width": new Ea(re.paint_symbol["text-halo-width"]), "text-halo-blur": new Ea(re.paint_symbol["text-halo-blur"]), "text-translate": new za(re.paint_symbol["text-translate"]), "text-translate-anchor": new za(re.paint_symbol["text-translate-anchor"]), "icon-color-saturation": new za(re.paint_symbol["icon-color-saturation"]) }), layout: Qy }; class eg { constructor(t) { this.type = t.property.overrides ? t.property.overrides.runtimeType : pe, 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 } } Ks(eg, "FormatSectionOverride", { omit: ["defaultValue"] }); class rg extends Va { constructor(t, e, r) { super(t, tg, e, r); } 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 r = this.layout.get("text-writing-mode"); if (r) { const t = []; for (const e of r) 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, r, n) { const i = this.layout.get(t).evaluate(e, {}, r, n), s = this._unevaluatedLayout._values[t]; return s.isDataDriven() || Zi(s.value) || !i ? i : function (t, e) { return e.replace(/{([^{}]+)}/g, ((e, r) => r in t ? String(t[r]) : "")) }(e.properties, i) } createBucket(t) { return new fg(t) } queryRadius() { return 0 } queryIntersectsFeature() { return !1 } _setPaintOverrides() { for (const t of tg.paint.overridableProperties) { if (!rg.hasPaintOverride(this.layout, t)) continue; const e = this.paint.get(t), r = new eg(e), n = new Yi(r, e.property.specification, this.scope, this.options); let i = null; i = "constant" === e.value.kind || "source" === e.value.kind ? new Ki("source", n) : new Wi("composite", n, e.value.zoomStops, e.value._interpolationType), this.paint._values[t] = new Ta(e.property, i, e.parameters); } } _handleOverridablePaintPropertyUpdate(t, e, r) { return !(!this.layout || e.isDataDriven() || r.isDataDriven()) && rg.hasPaintOverride(this.layout, t) } static hasPaintOverride(t, e) { const r = t.get("text-field"), n = tg.paint.properties[e]; let i = !1; const s = t => { for (const e of t) if (n.overrides && n.overrides.hasOverride(e)) return void (i = !0) }; if ("constant" === r.value.kind && r.value.value instanceof Oe) s(r.value.value.sections); else if ("source" === r.value.kind) { const t = e => { i || (e instanceof Ge && Ne(e.value) === be ? s(e.value.sections) : e instanceof We ? s(e.sections) : e.eachChild(t)); }, e = r.value; e._styleExpression && t(e._styleExpression.expression); } return i } getProgramIds() { const t = 0 !== this.paint.get("icon-opacity").constantOr(1), e = 0 !== this.paint.get("text-opacity").constantOr(1), r = []; return t && r.push("symbolIcon"), e && r.push("symbolSDF"), r } getDefaultProgramParams(t, e) { return { config: new pl(this, e), overrideFog: !1 } } } const ng = ud.types, ig = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }]; function sg(t, e, r, n, i, s, a, o, l, u, c, h, p) { const f = o ? Math.min(My, Math.round(o[0])) : 0, d = o ? Math.min(My, Math.round(o[1])) : 0; t.emplaceBack(e, r, Math.round(32 * n), Math.round(32 * i), s, a, (f << 1) + (l ? 1 : 0), d, 16 * u, 16 * c, 256 * h, 256 * p); } function ag(t, e, r) { t.emplaceBack(e, r); } function og(t, e, r, n, i, s, a) { t.emplaceBack(e, r, n, i, s, a); } function lg(t, e, r, n, i) { t.emplaceBack(e, r, n, i), t.emplaceBack(e, r, n, i), t.emplaceBack(e, r, n, i), t.emplaceBack(e, r, n, i); } function ug(t) { for (const e of t.sections) if (la(e.text)) return !0; return !1 } class cg { constructor(t) { this.layoutVertexArray = new Ja, this.indexArray = new ao, this.programConfigurations = t, this.segments = new Do, this.dynamicLayoutVertexArray = new Xa, this.opacityVertexArray = new to, this.placedSymbolArray = new Mo, this.iconTransitioningVertexArray = new eo, this.globeExtVertexArray = new Qa, this.zOffsetVertexArray = new uo; } isEmpty() { return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length && 0 === this.iconTransitioningVertexArray.length } upload(t, e, r, n, i) { this.isEmpty() || (r && (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, tm.members), this.indexBuffer = t.createIndexBuffer(this.indexArray, e), this.dynamicLayoutVertexBuffer = t.createVertexBuffer(this.dynamicLayoutVertexArray, rm.members, !0), this.opacityVertexBuffer = t.createVertexBuffer(this.opacityVertexArray, ig, !0), this.iconTransitioningVertexArray.length > 0 && (this.iconTransitioningVertexBuffer = t.createVertexBuffer(this.iconTransitioningVertexArray, im.members, !0)), this.globeExtVertexArray.length > 0 && (this.globeExtVertexBuffer = t.createVertexBuffer(this.globeExtVertexArray, em.members, !0)), !this.zOffsetVertexBuffer && (this.zOffsetVertexArray.length > 0 || i) && (this.zOffsetVertexBuffer = t.createVertexBuffer(this.zOffsetVertexArray, nm.members, !0)), this.opacityVertexBuffer.itemSize = 1), (r || n) && this.programConfigurations.upload(t)); } destroy() { this.layo
36utVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy(), this.iconTransitioningVertexBuffer && this.iconTransitioningVertexBuffer.destroy(), this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy(), this.zOffsetVertexBuffer && this.zOffsetVertexBuffer.destroy()); } } Ks(cg, "SymbolBuffers"); class hg { constructor(t, e, r) { this.layoutVertexArray = new t, this.layoutAttributes = e, this.indexArray = new r, this.segments = new Do, this.collisionVertexArray = new so, this.collisionVertexArrayExt = new Xa; } upload(t) { this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t.createVertexBuffer(this.collisionVertexArray, sm.members, !0), this.collisionVertexBufferExt = t.createVertexBuffer(this.collisionVertexArrayExt, am.members, !0); } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy(), this.collisionVertexBufferExt.de
36stroy()); } } Ks(hg, "CollisionBuffers"); class pg { constructor(e) { this.collisionBoxArray = e.collisionBoxArray, this.zoom = e.zoom, this.overscaling = e.overscaling, this.layers = e.layers, this.layerIds = this.layers.map((t => t.fqid)), this.index = e.index, this.pixelRatio = e.pixelRatio, this.sourceLayerIndex = e.sourceLayerIndex, this.hasPattern = !1, this.hasRTLText = !1, this.fullyClipped = !1, this.hasAnyIconTextFit = !1, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = t.m.identity([]), this.placementViewportMatrix = t.m.identity([]); const r = this.layers[0]._unevaluatedLayout._values; this.textSizeData = hm(this.zoom, r["text-size"]), this.iconSizeData = hm(this.zoom, r["icon-size"]); const n = this.layers[0].layout, i = n.get("symbol-sort-key"), s = n.get("symbol-z-order"); this.canOverlap = n.get("text-allow-overlap") || n.get("icon-allow-overlap") || n.get("text-ignore-placement") || n.get("icon-ignore-placement"), this.sortFeaturesByKey = "viewport-y" !== s && void 0 !== i.constantOr(1), this.sortFeaturesByY = ("viewport-y" === s || "auto" === s && !this.sortFeaturesByKey) && this.canOverlap, this.writingModes = n.get("text-writing-mode").map((t => Am[t])), this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)), this.sourceID = e.sourceID, this.projection = e.projection, this.hasAnyZOffset = !1, this.zOffsetSortDirty = !1, this.zOffsetBuffersNeedUpload = n.get("symbol-z-elevate"); } createArrays() { this.text = new cg(new fl(this.layers, this.zoom, (t => /^text/.test(t)))), this.icon = new cg(new fl(this.layers, this.zoom, (t => /^icon/.test(t)))), this.glyphOffsetArray = new Io, this.lineVertexArray = new ko, this.symbolInstances = new So; } calculateGlyphDependencies(t, e, r, n, i) { for (let r = 0; r < t.length; r++) { const s = t.codePointAt(r); if (void 0 === s) break; if (e[s] = !0, n && i && s <= 65535) { const n = ym[t.charAt(r)]; n && (e[n.charCodeAt(0)] = !0); } } } populate(e, r, n, i) { const s = this.layers[0], a = s.layout, o = "globe" === this.projection.name, l = a.get("text-font"), u = a.get("text-field"), c = a.get("icon-image"), h = ("constant" !== u.value.kind || u.value.value instanceof Oe && !u.value.value.isEmpty() || u.value.value.toString().length > 0) && ("constant" !== l.value.kind || l.value.value.length > 0), p = "constant" !== c.value.kind || !!c.value.value || Object.keys(c.parameters).length > 0, f = a.get("symbol-sort-key"); if (this.features = [], !h && !p) return; const d = r.iconDependencies, m = r.glyphDependencies, y = r.availableImages, g = new _a(this.zoom); for (const { feature: r, id: u, index: c, sourceLayerIndex: x } of e) { const e = s._featureFilter.needGeometry, v = gp(r, e); if (!s._featureFilter.filter(g, v, n)) continue; if (e || (v.geometry = yp(r, n, i)), o && 1 !== r.type && n.z <= 5) { const e = v.geometry, r = .98078528056, i = (e, i) => { const s = zh(e.x, e.y, n, 1), a = zh(i.x, i.y, n, 1); return t.v.dot(s, a) < r }; for (let t = 0; t < e.length; t++)e[t] = pp(e[t], i); } let b, _; if (h) { const t = s.getValueAndResolveTokens("text-field", v, n, y), e = Oe.factory(t); ug(e) && (this.hasRTLText = !0), (!this.hasRTLText || "unavailable" === xa() || this.hasRTLText && ba.isParsed()) && (b = mm(e, s, v)); } if (p) { const t = s.getValueAndResolveTokens("icon-image", v, n, y); _ = t instanceof Fe ? t : Fe.fromString(t); } if (!b && !_) continue; const w = this.sortFeaturesByKey ? f.evaluate(v, {}, n) : void 0; if (this.features.push({ id: u, text: b, icon: _, index: c, sourceLayerIndex: x, geometry: v.geometry, properties: r.properties, type: ng[r.type], sortKey: w }), _ && (d[_.namePrimary] = !0, _.nameSecondary && (d[_.nameSecondary] = !0)), b) { const t = l.evaluate(v, {}, n).join(","), e = "map" === a.get("text-rotation-alignment") && "point" !== a.get("symbol-placement"); this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(Am.vertical) >= 0; for (const r of b.sections) if (r.image) d[r.image.namePrimary] = !0; else { const n = ea(b.toString()), i = r.fontStack || t, s = m[i] = m[i] || {}; this.calculateGlyphDependencies(r.text, s, e, this.allowVerticalPlacement, n); } } } "line" === a.get("symbol-placement") && (this.features = function (t) { const e = {}, r = {}, n = []; let i = 0; function s(e) { n.push(t[e]), i++; } function a(t, e, i) { const s = r[t]; return delete r[t], r[e] = s, n[s].geometry[0].pop(), n[s].geometry[0] = n[s].geometry[0].concat(i[0]), s } function o(t, r, i) { const s = e[r]; return delete e[r], e[t] = s, n[s].geometry[0].shift(), n[s].geometry[0] = i[0].c
vendor: 12,647 bytes, line 36
36oncat(n[s].geometry[0]), s } function l(t, e, r) { const n = r ? e[0][e[0].length - 1] : e[0][0]; return `${t}:${n.x}:${n.y}` } for (let u = 0; u < t.length; u++) { const c = t[u], h = c.geometry, p = c.text ? c.text.toString() : null; if (!p) { s(u); continue } const f = l(p, h), d = l(p, h, !0); if (f in r && d in e && r[f] !== e[d]) { const t = o(f, d, h), i = a(f, d, n[t].geometry); delete e[f], delete r[d], r[l(p, n[i].geometry, !0)] = i, n[t].geometry = null; } else f in r ? a(f, d, h) : d in e ? o(f, d, h) : (s(u), e[f] = i - 1, r[d] = i - 1); } return n.filter((t => t.geometry)) }(this.features)), this.sortFeaturesByKey && this.features.sort(((t, e) => t.sortKey - e.sortKey)); } update(t, e, r, n, i) { const s = 0 !== Object.keys(t).length; if (s && !this.stateDependentLayers.length) return; const a = s ? this.stateDependentLayers : this.layers; this.text.programConfigurations.updatePaintArrays(t, e, a, r, n, i), this.icon.programConfigurations.updatePaintArrays(t, e, a, r, n, i); } updateZOffset() { const t = (t, e, n) => { r += e, r > t.length && t.resize(r); for (let i = -e; i < 0; i++)t.emplace(i + r, n); }, e = (t, e, r) => { n += e, n > t.length && t.resize(n); for (let i = -e; i < 0; i++)t.emplace(i + n, r); }; if (!this.zOffsetBuffersNeedUpload) return; this.zOffsetBuffersNeedUpload = !1; let r = 0, n = 0; for (let r = 0; r < this.symbolInstances.length; r++) { const n = this.symbolInstances.get(r), { numHorizontalGlyphVertices: i, numVerticalGlyphVertices: s, numIconVertices: a } = n, o = n.zOffset, l = a > 0; if ((i > 0 || s > 0) && (t(this.text.zOffsetVertexArray, i, o), t(this.text.zOffsetVertexArray, s, o)), l) { const { placedIconSymbolIndex: t, verticalPlacedIconSymbolIndex: r } = n; t >= 0 && e(this.icon.zOffsetVertexArray, a, o), r >= 0 && e(this.icon.zOffsetVertexArray, n.numVerticalIconVertices, o); } } this.text.zOffsetVertexBuffer && this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray), this.icon.zOffsetVertexBuffer && this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray); } isEmpty() { return 0 === this.symbolInstances.length && !this.hasRTLText } uploadPending() { return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload } upload(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.zOffsetBuffersNeedUpload), this.icon.upload(t, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload, this.zOffsetBuffersNeedUpload), this.uploaded = !0; } destroyDebugData() { this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(); } getProjection() { return this.projectionInstance || (this.projectionInstance = Jy(this.projection)), this.projectionInstance } destroy() { this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData(); } addToLineVertexArray(t, e) { const r = this.lineVertexArray.length; if (void 0 !== t.segment) for (const { x: t, y: r } of e) this.lineVertexArray.emplaceBack(t, r); return { lineStartIndex: r, lineLength: this.lineVertexArray.length - r } } addSymbols(t, e, r, n, i, s, a, o, l, u, c, h, p, f, d, m) { const y = t.indexArray, g = t.layoutVertexArray, x = t.globeExtVertexArray, v = t.segments.prepareSegment(4 * e.length, g, y, this.canOverlap ? s.sortKey : void 0), b = this.glyphOffsetArray.length, _ = v.vertexLength, w = this.allowVerticalPlacement && a === Am.vertical ? Math.PI / 2 : 0, M = s.text && s.text.sections; for (let n = 0; n < e.length; n++) { const { tl: i, tr: a, bl: u, br: c, texPrimary: h, texSecondary: b, pixelOffsetTL: _, pixelOffsetBR: A, minFontScaleX: S, minFontScaleY: I, glyphOffset: k, isSDF: T, sectionIndex: P } = e[n], z = v.vertexLength, E = k[1]; if (sg(g, l.x, l.y, i.x, E + i.y, h.x, h.y, r, T, _.x, _.y, S, I), sg(g, l.x, l.y, a.x, E + a.y, h.x + h.w, h.y, r, T, A.x, _.y, S, I), sg(g, l.x, l.y, u.x, E + u.y, h.x, h.y + h.h, r, T, _.x, A.y, S, I), sg(g, l.x, l.y, c.x, E + c.y, h.x + h.w, h.y + h.h, r, T, A.x, A.y, S, I), o) { const { x: e, y: r, z: n } = o.anchor, [i, s, a] = o.up; og(x, e, r, n, i, s, a), og(x, e, r, n, i, s, a), og(x, e, r, n, i, s, a), og(x, e, r, n, i, s, a), lg(t.dynamicLayoutVertexArray, e, r, n, w); } else lg(t.dynamicLayoutVertexArray, l.x, l.y, l.z, w); if (m) { const e = b || h; ag(t.iconTransitioningVertexArray, e.x, e.y), ag(t.iconTransitioningVertexArray, e.x + e.w, e.y), ag(t.iconTransitioningVertexArray, e.x, e.y + e.h), ag(t.iconTransitioningVertexArray, e.x + e.w, e.y + e.h); } y.emplaceBack(z, z + 1, z + 2), y.emplaceBack(z + 1, z + 2, z + 3), v.vertexLength += 4, v.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(k[0]), n !== e.length - 1 && P === e[n + 1].sectionIndex || t.programConfigurations.populatePaintArrays(g.length, s, s.index, {}, p, f, d, M && M[P]); } const A = o ? o.anchor : l; t.placedSymbolArray.emplaceBack(A.x, A.y, A.z, l.x, l.y, b, this.glyphOffsetArray.length - b, _, u, c, l.segment, r ? r[0] : 0, r ? r[1] : 0, n[0], n[1], a, 0, !1, 0, h, 0); } _commitLayoutVertex(t, e, r, n, i, s, a) { t.emplaceBack(e, r, n, i, s, Math.round(a.x), Math.round(a.y)); } _addCollisionDebugVertices(t, e, r, n, i, s, a) { const o = r.segments.prepareSegment(4, r.layoutVertexArray, r.indexArray), l = o.vertexLength, u = a.tileAnchorX, c = a.tileAnchorY; for (let t = 0; t < 4; t++)r.collisionVertexArray.emplaceBack(0, 0, 0, 0); this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt, e, t.padding, a.zOffset), this._commitLayoutVertex(r.layoutVertexArray, n, i, s, u, c, new x(t.x1, t.y1)), this._commitLayoutVertex(r.layoutVertexArray, n, i, s, u, c, new x(t.x2, t.y1)), this._commitLayoutVertex(r.layoutVertexArray, n, i, s, u, c, new x(t.x2, t.y2)), this._commitLayoutVertex(r.layoutVertexArray, n, i, s, u, c, new x(t.x1, t.y2)), o.vertexLength += 4; const h = r.indexArray; h.emplaceBack(l, l + 1), h.emplaceBack(l + 1, l + 2), h.emplaceBack(l + 2, l + 3), h.emplaceBack(l + 3, l), o.primitiveLength += 4; } _addTextDebugCollisionBoxes(t, e, r, n, i, s) { for (let a = n; a < i; a++) { const n = r.get(a), i = this.getSymbolInstanceTextSize(t, s, e, a); this._addCollisionDebugVertices(n, i, this.textCollisionBox, n.projectedAnchorX, n.projectedAnchorY, n.projectedAnchorZ, s); } } _addIconDebugCollisionBoxes(t, e, r, n, i, s) { for (let a = n; a < i; a++) { const n = r.get(a), i = this.getSymbolInstanceIconSize(t, e, s.placedIconSymbolIndex); this._addCollisionDebugVertices(n, i, this.iconCollisionBox, n.projectedAnchorX, n.projectedAnchorY, n.projectedAnchorZ, s); } } generateCollisionDebugBuffers(t, e) { this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new hg(no, om.members, eo), this.iconCollisionBox = new hg(no, om.members, eo); const r = fm(this.iconSizeData, t), n = fm(this.textSizeData, t); for (let i = 0; i < this.symbolInstances.length; i++) { const s = this.symbolInstances.get(i); this._addTextDebugCollisionBoxes(n, t, e, s.textBoxStartIndex, s.textBoxEndIndex, s), this._addTextDebugCollisionBoxes(n, t, e, s.verticalTextBoxStartIndex, s.verticalTextBoxEndIndex, s), this._addIconDebugCollisionBoxes(r, t, e, s.iconBoxStartIndex, s.iconBoxEndIndex, s), this._addIconDebugCollisionBoxes(r, t, e, s.verticalIconBoxStartIndex, s.verticalIconBoxEndIndex, s); } } getSymbolInstanceTextSize(t, e, r, n) { const i = this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex >= 0 ? e.rightJustifiedTextSymbolIndex : e.centerJustifiedTextSymbolIndex >= 0 ? e.centerJustifiedTextSymbolIndex : e.leftJustifiedTextSymbolIndex >= 0 ? e.leftJustifiedTextSymbolIndex : e.verticalPlacedTextSymbolIndex >= 0 ? e.verticalPlacedTextSymbolIndex : n), s = pm(this.textSizeData, t, i) / um; return this.tilePixelRatio * s } getSymbolInstanceIconSize(t, e, r) { const n = this.icon.placedSymbolArray.get(r), i = pm(this.iconSizeData, t, n); return this.tilePixelRatio * i } _commitDebugCollisionVertexUpdate(t, e, r, n) { t.emplaceBack(e, -r, -r, n), t.emplaceBack(e, r, -r, n), t.emplaceBack(e, r, r, n), t.emplaceBack(e, -r, r, n); } _updateTextDebugCollisionBoxes(t, e, r, n, i, s) { for (let a = n; a < i; a++) { const n = r.get(a), i = this.getSymbolInstanceTextSize(t, s, e, a); this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt, i, n.padding, s.zOffset); } } _updateIconDebugCollisionBoxes(t, e, r, n, i, s) { for (let a = n; a < i; a++) { const n = r.get(a), i = this.getSymbolInstanceIconSize(t, e, s.placedIconSymbolIndex); this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt, i, n.padding, s.zOffset); } } updateCollisionDebugBuffers(t, e) { if (!this.hasDebugData()) return; this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexArrayExt.clear(), this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexArrayExt.clear(); const r = fm(this.iconSizeData, t), n = fm(this.textSizeData, t); for (let i = 0; i < this.symbolInstances.length; i++) { const s = this.symbolInstances.get(i); this._updateTextDebugCollisionBoxes(n, t, e, s.textBoxStartIndex, s.textBoxEndIndex, s), this._updateTextDebugCollisionBoxes(n, t, e, s.verticalTextBoxStartIndex, s.verticalTextBoxEndIndex, s), this._updateIconDebugCollisionBoxes(r, t, e, s.iconBoxStartIndex, s.iconBoxEndIndex, s), this._updateIconDebugCollisionBoxes(r, t, e, s.verticalIconBoxStartIndex, s.verticalIconBoxEndIndex, s); } 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, r, n, i, s, a, o, l) { const u = {}; if (e < r) { const { x1: r, y1: n, x2: i, y2: s, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p, featureIndex: f } = t.get(e); u.textBox = { x1: r, y1: n, x2: i, y2: s, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p }, u.textFeatureIndex = f; } if (n < i) { const { x1: e, y1: r, x2: i, y2: s, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p, featureIndex: f } = t.get(n); u.verticalTextBox = { x1: e, y1: r, x2: i, y2: s, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p }, u.verticalTextFeatureIndex = f; } if (s < a) { const { x1: e, y1: r, x2: n, y2: i, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p, featureIndex: f } = t.get(s); u.iconBox = { x1: e, y1: r, x2: n, y2: i, padding: a, projectedAnchorX: o, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p }, u.iconFeatureIndex = f; } if (o < l) { const { x1: e, y1: r, x2: n, y2: i, padding: s, projectedAnchorX: a, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p, featureIndex: f } = t.get(o); u.verticalIconBox = { x1: e, y1: r, x2: n, y2: i, padding: s, projectedAnchorX: a, projectedAnchorY: l, projectedAnchorZ: c, tileAnchorX: h, tileAnchorY: p }, u.verticalIconFeatureIndex = f; } return u } deserializeCollisionBoxes(t) { this.collisionArrays = []; for (let e = 0; e < this.symbolInstances.length; e++) { const r = this.symbolInstances.get(e); this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t, r.textBoxStartIndex, r.textBoxEndIndex, r.verticalTextBoxStartIndex, r.verticalTextBoxEndIndex, r.iconBoxStartIndex, r.iconBoxEndIndex, r.verticalIconBoxStartIndex, r.verticalIconBoxEndIndex)); } } hasTextData() { return this.text.segments.get().length > 0 } hasIconData() { return this.icon.segments.get().length > 0 } hasDebugData() { return this.textCollisionBox && this.iconCollisionBox } hasTextCollisionBoxData() { return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0 } hasIconCollisionBoxData() { return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0 } hasIconTextFit() { return this.hasAnyIconTextFit } addIndicesForPlacedSymbol(t, e) { const r = t.placedSymbolArray.get(e), n = r.vertexStartIndex + 4 * r.numGlyphs; for (let e = r.vertexStartIndex; e < n; e += 4)t.indexArray.emplaceBack(e, e + 1, e + 2), t.indexArray.emplaceBack(e + 1, e + 2, e + 3); }
36 getSortedSymbolIndexes(t) { if (this.sortedAngle === t && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes; const e = Math.sin(t), r = Math.cos(t), n = [], i = [], s = []; for (let t = 0; t < this.symbolInstances.length; ++t) { s.push(t); const a = this.symbolInstances.get(t); n.push(0 | Math.round(e * a.tileAnchorX + r * a.tileAnchorY)), i.push(a.featureIndex); } return s.sort(((t, e) => n[t] - n[e] || i[e] - i[t])), s } getSortedIndexesByZOffset() { if (!this.zOffsetSortDirty) return this.symbolInstanceIndexesSortedZOffset; if (!this.symbolInstanceIndexesSortedZOffset) { this.symbolInstanceIndexesSortedZOffset = []; for (let t = 0; t < this.symbolInstances.length; ++t)this.symbolInstanceIndexesSortedZOffset.push(t); } return this.zOffsetSortDirty = !1, this.symbolInstanceIndexesSortedZOffset.sort(((t, e) => this.symbolInstances.get(e).zOffset - this.symbolInstances.get(t).zOffset)) } addToSortKeyRanges(t, e) { const r = this.sortKeyRanges[this.sortKeyRanges.length - 1]; r && r.sortKey === e ? r.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); const { rightJustifiedTextSymbolIndex: r, centerJustifiedTextSymbolIndex: n, leftJustifiedTextSymbolIndex: i, verticalPlacedTextSymbolIndex: s, placedIconSymbolIndex: a, verticalPlacedIconSymbolIndex: o } = e; r >= 0 && this.addIndicesForPlacedSymbol(this.text, r), n >= 0 && n !== r && this.addIndicesForPlacedSymbol(this.text, n), i >= 0 && i !== n && i !== r && this.addIndicesForPlacedSymbol(this.text, i), s >= 0 && this.addIndicesForPlacedSymbol(this.text, s), a >= 0 && this.addIndicesForPlacedSymbol(this.icon, a), o >= 0 && this.addIndicesForPlacedSymbol(this.icon, o); } this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray); } } } Ks(pg, "SymbolBucket", { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), pg.MAX_GLYPHS = 65535, pg.addDynamicAttributes = lg; var fg = pg; const dg = Ua([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }, { name: "a_linesofar", components: 1, type: "Float32" }], 4), { members: mg } = dg, yg = Ua([{ name: "a_packed", components: 4, type: "Float32" }]), { members: gg } = yg, xg = ud.types, vg = Math.cos(Math.PI / 180 * 37.5); class bg { constructor(t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((t => t.fqid)), 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 Za, this.layoutVertexArray2 = new Xa, this.indexArray = new ao, this.programConfigurations = new fl(t.layers, t.zoom), this.segments = new Do, this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)); } populate(t, e, r, n) { this.hasPattern = Ff("line", this.layers, e); const i = this.layers[0].layout.get("line-sort-key"), s = []; for (const { feature: e, id: a, index: o, sourceLayerIndex: l } of t) { const t = this.layers[0]._featureFilter.needGeometry, u = gp(e, t); if (!this.layers[0]._featureFilter.filter(new _a(this.zoom), u, r)) continue; const c = i ? i.evaluate(u, {}, r) : void 0, h = { id: a, properties: e.properties, type: e.type, sourceLayerIndex: l, index: o, geometry: t ? u.geometry : yp(e, r, n), patterns: {}, sortKey: c }; s.push(h); } i && s.sort(((t, e) => t.sortKey - e.sortKey)); const { lineAtlas: a, featureIndex: o } = e, l = this.addConstantDashes(a); for (const n of s) { const { geometry: i, index: s, sourceLayerIndex: u } = n; if (l && this.addFeatureDashes(n, a), this.hasPattern) { const t = jf("line", this.layers, n, this.zoom, e); this.patternFeatures.push(t); } else this.addFeature(n, i, s, r, a.positions, e.availableImages, e.brightness); o.insert(t[s].feature, i, s, u, this.index); } } addConstantDashes(t) { let e = !1; for (const r of this.layers) { const n = r.paint.get("line-dasharray").value, i = r.layout.get("line-cap").value; if ("constant" !== n.kind || "constant" !== i.kind) e = !0; else { const e = i.value, r = n.value; if (!r) continue; t.addDash(r, e); } } return e } addFeatureDashes(t, e) { const r = this.zoom; for (const n of this.layers) { const i = n.paint.get("line-dasharray").value, s = n.layout.get("line-cap").value; if ("constant" === i.kind && "constant" === s.kind) continue; let a, o; if ("constant" === i.kind) { if (a = i.value, !a) continue } else a = i.evaluate({ zoom: r }, t); o = "constant" === s.kind ? s.value : s.evaluate({ zoom: r }, t), e.addDash(a, o), t.patterns[n.id] = e.getKey(a, o); } } update(t, e, r, n, i) { const s = 0 !== Object.keys(t).length; s && !this.stateDependentLayers.length || this.programConfigurations.updatePaintArrays(t, e, s ? this.stateDependentLayers : this.layers, r, n, i); } addFeatures(t, e, r, n, i, s) { for (const t of this.patternFeatures) this.addFeature(t, t.geometry, t.index, e, r, n, s); } 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, gg)), this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, mg), 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, r, n, i, s, a) { const o = this.layers[0].layout, l = o.get("line-join").evaluate(t, {}), u = o.get("line-cap").evaluate(t, {}), c = o.get("line-miter-limit"), h = o.get("line-round-limit"); this.lineClips = this.lineFeatureClips(t); for (const r of e) this.addLine(r, t, l, u, c, h); this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, i, s, n, a); } addLine(t, e, r, n, i, s) { if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineS
vendor: 4,128 bytes, line 36
36oFar = 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 a = "Polygon" === xg[e.type]; let o = t.length; for (; o >= 2 && t[o - 1].equals(t[o - 2]);)o--; let l = 0; for (; l < o - 1 && t[l].equals(t[l + 1]);)l++; if (o < (a ? 3 : 2)) return; "bevel" === r && (i = 1.05); const u = this.overscaling <= 16 ? 15 * Cr / (512 * this.overscaling) : 0, c = this.segments.prepareSegment(10 * o, this.layoutVertexArray, this.indexArray); let h, p, f, d, m; this.e1 = this.e2 = -1, a && (h = t[o - 2], m = t[l].sub(h)._unit()._perp()); for (let e = l; e < o; e++) { if (f = e === o - 1 ? a ? t[l + 1] : void 0 : t[e + 1], f && t[e].equals(f)) continue; m && (d = m), h && (p = h), h = t[e], m = f ? f.sub(h)._unit()._perp() : d, d = d || m; let y = d.add(m); 0 === y.x && 0 === y.y || y._unit(); const g = d.x * m.x + d.y * m.y, x = y.x * m.x + y.y * m.y, v = 0 !== x ? 1 / x : 1 / 0, b = 2 * Math.sqrt(2 - 2 * x), _ = x < vg && p && f, w = d.x * m.y - d.y * m.x > 0; if (_ && e > l) { const t = h.dist(p); if (t > 2 * u) { const e = h.sub(h.sub(p)._mult(u / t)._round()); this.updateDistance(p, e), this.addCurrentVertex(e, d, 0, 0, c), p = e; } } const M = p && f; let A = M ? r : a ? "butt" : n; if (M && "round" === A && (v < s ? A = "miter" : v <= 2 && (A = "fakeround")), "miter" === A && v > i && (A = "bevel"), "bevel" === A && (v > 2 && (A = "flipbevel"), v < i && (A = "miter")), p && this.updateDistance(p, h), "miter" === A) y._mult(v), this.addCurrentVertex(h, y, 0, 0, c); else if ("flipbevel" === A) { if (v > 100) y = m.mult(-1); else { const t = v * d.add(m).mag() / d.sub(m).mag(); y._perp()._mult(t * (w ? -1 : 1)); } this.addCurrentVertex(h, y, 0, 0, c), this.addCurrentVertex(h, y.mult(-1), 0, 0, c); } else if ("bevel" === A || "fakeround" === A) { const t = -Math.sqrt(v * v - 1), e = w ? t : 0, r = w ? 0 : t; if (p && this.addCurrentVertex(h, d, e, r, c), "fakeround" === A) { const t = Math.round(180 * b / Math.PI / 20); for (let e = 1; e < t; e++) { let r = e / t; if (.5 !== r) { const t = r - .5; r += r * t * (r - 1) * ((1.0904 + g * (g * (3.55645 - 1.43519 * g) - 3.2452)) * t * t + (.848013 + g * (.215638 * g - 1.06021))); } const n = m.sub(d)._mult(r)._add(d)._unit()._mult(w ? -1 : 1); this.addHalfVertex(h, n.x, n.y, !1, w, 0, c); } } f && this.addCurrentVertex(h, m, -e, -r, c); } else if ("butt" === A) this.addCurrentVertex(h, y, 0, 0, c); else if ("square" === A) { const t = p ? 1 : -1; p || this.addCurrentVertex(h, y, t, t, c), this.addCurrentVertex(h, y, 0, 0, c), p && this.addCurrentVertex(h, y, t, t, c); } else "round" === A && (p && (this.addCurrentVertex(h, d, 0, 0, c), this.addCurrentVertex(h, d, 1, 1, c, !0)), f && (this.addCurrentVertex(h, m, -1, -1, c, !0), this.addCurrentVertex(h, m, 0, 0, c))); if (_ && e < o - 1) { const t = h.dist(f); if (t > 2 * u) { const e = h.add(f.sub(h)._mult(u / t)._round()); this.updateDistance(h, e), this.addCurrentVertex(e, m, 0, 0, c), h = e; } } } } addCurrentVertex(t, e, r, n, i, s = !1) { const a = e.y * n - e.x, o = -e.y - e.x * n; this.addHalfVertex(t, e.x + e.y * r, e.y - e.x * r, s, !1, r, i), this.addHalfVertex(t, a, o, s, !0, -n, i); } addHalfVertex({ x: t, y: e }, r, n, i, s, a, o) { this.layoutVertexArray.emplaceBack((t << 1) + (i ? 1 : 0), (e << 1) + (s ? 1 : 0), Math.round(63 * r) + 128, Math.round(63 * n) + 128, 1 + (0 === a ? 0 : a < 0 ? -1 : 1), 0, this.lineSoFar), this.lineClips && this.layoutVertexArray2.emplaceBack(this.scaledDistance, this.lineClipsArray.length, this.lineClips.start, this.lineClips.end); const l = o.vertexLength++; this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, l), o.primitiveLength++), s ? this.e2 = l : this.e1 = l; } 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; }
36 else this.lineSoFar = this.distance; } updateDistance(t, e) { this.distance += t.dist(e), this.updateScaledDistance(); } } Ks(bg, "LineBucket", { omit: ["layers", "patternFeatures"] }); class _g { constructor(t, e, r, n) { this.context = t, this.format = r, this.texture = t.gl.createTexture(), this.update(e, n); } update(t, e, r) { const { width: n, height: i } = t, { context: s } = this, { gl: a } = s; if (a.bindTexture(a.TEXTURE_2D, this.texture), s.pixelStoreUnpackFlipY.set(!1), s.pixelStoreUnpack.set(1), s.pixelStoreUnpackPremultiplyAlpha.set(this.format === a.RGBA && (!e || !1 !== e.premultiply)), r || this.size && this.size[0] === n && this.size[1] === i) { const { x: e, y: s } = r || { x: 0, y: 0 }; if (t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof HTMLVideoElement || t instanceof ImageData || ImageBitmap && t instanceof ImageBitmap) a.texSubImage2D(a.TEXTURE_2D, 0, e, s, a.RGBA, a.UNSIGNED_BYTE, t); else { let r = this.format, o = a.UNSIGNED_BYTE; this.format === a.R32F && (r = a.RED, o = a.FLOAT), a.texSubImage2D(a.TEXTURE_2D, 0, e, s, n, i, r, o, t.data); } } else if (this.size = [n, i], t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof HTMLVideoElement || t instanceof ImageData || ImageBitmap && t instanceof ImageBitmap) { let e = this.format; this.format === a.R8 && (e = a.RED), a.texImage2D(a.TEXTURE_2D, 0, this.format, e, a.UNSIGNED_BYTE, t); } else { let e = this.format, r = this.format, s = a.UNSIGNED_BYTE; this.format === a.DEPTH_COMPONENT && (e = a.DEPTH_COMPONENT16, s = a.UNSIGNED_SHORT), this.format === a.R8 && (r = a.RED), this.format === a.R32F && (s = a.FLOAT, r = a.RED), a.texImage2D(a.TEXTURE_2D, 0, e, n, i, 0, r, s, t.data); } this.useMipmap = Boolean(e && e.useMipmap), this.useMipmap && a.generateMipmap(a.TEXTURE_2D); } bind(t, e, r = !1) { const { context: n } = this, { gl: i } = n; i.bindTexture(i.TEXTURE_2D, this.texture), t !== this.minFilter && (i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, t), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, this.useMipmap && !r ? t === i.NEAREST ? i.NEAREST_MIPMAP_NEAREST : i.LINEAR_MIPMAP_LINEAR : t), this.minFilter = t), e !== this.wrapS && (i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, e), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, e), this.wrapS = e); } bindExtraParam(t, e, r, n) { const { context: i } = this, { gl: s } = i; s.bindTexture(s.TEXTURE_2D, this.texture), e !== this.magFilter && (s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, e), this.magFilter = e), t !== this.minFilter && (s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, this.useMipmap ? t === s.NEAREST ? s.NEAREST_MIPMAP_NEAREST : s.LINEAR_MIPMAP_LINEAR : t), this.minFilter = t), r !== this.wrapS && (s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, r), this.wrapS = r), n !== this.wrapT && (s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, n), this.wrapT = n); } destroy() { const { gl: t } = this.context; t.deleteTexture(this.texture), this.texture = null; } } class wg { constructor(t, e) { this.context = t, this.texture = e; } bind(t, e) { const { context: r } = this, { gl: n } = r; n.bindTexture(n.TEXTURE_2D, this.texture), t !== this.minFilter && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t), this.minFilter = t), e !== this.wrapS && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, e), this.wrapS = e); } } const Mg = 32, Ag = 33, Sg = new Uint16Array(8184); for (let t = 0; t < 2046; t++) { let e = t + 2, r = 0, n = 0, i = 0, s = 0, a = 0, o = 0; for (1 & e ? i = s = a = Mg : r = n = o = Mg; (e >>= 1) > 1;) { const t = r + i >> 1, l = n + s >> 1; 1 & e ? (i = r, s = n, r = a, n = o) : (r = i, n = s, i = a, s = o), a = t, o = l; } const l = 4 * t; Sg[l + 0] = r, Sg[l + 1] = n, Sg[l + 2] = i, Sg[l + 3] = s; } const Ig = new Uint16Array(2178), kg = new Uint8Array(1089), Tg = new Uint16Array(1089); function Pg(t) { return 0 === t ? -.03125 : 32 === t ? .03125 : 0 } var zg = Ua([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]); const Eg = { type: 2, extent: Cr, loadGeometry: () => [[new x(0, 0), new x(Cr + 1, 0), new x(Cr + 1, Cr + 1), new x(0, 
36Cr + 1), new x(0, 0)]] }; class Bg { constructor(t, e, r, n, i) { this.tileID = t, this.uid = C(), this.uses = 0, this.tileSize = e, this.tileZoom = r, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = !1, this.hasRTLText = !1, this.dependencies = {}, this.isRaster = i, n && n.style && (this._lastUpdatedBrightness = n.style.getBrightness()), this.expiredRequestCount = 0, this.state = "loading", n && n.transform && (this.projection = n.transform.projection); } registerFadeDuration(t) { const e = t + this.timeAdded; e < Wt.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 = zy(this.tileID.canonical, this.projection)), this._tileTransform } loadVectorData(t, e, r) { 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 r = {}; if (!e) return r; for (const n of t) { const t = n.layerIds.map((t => e.getLayer(t))).filter(Boolean); if (0 !== t.length) { n.layers = t, n.stateDependentLayerIds && (n.stateDependentLayers = n.stateDependentLayerIds.map((e => t.filter((t => t.id === e))[0]))); for (const e of t) r[e.fqid] = n; } } return r }(t.buckets, e.style), this.hasSymbolBuckets = !1; for (const t in this.buckets) { const e = this.buckets[t]; if (e instanceof fg) { if (this.hasSymbolBuckets = !0, !r) break; e.justReloaded = !0; } } if (this.hasRTLText = !1, this.hasSymbolBuckets) for (const t in this.buckets) { const e = this.buckets[t]; if (e instanceof fg && e.hasRTLText) { this.hasRTLText = !0, ba.isLoading() || ba.isLoaded() || "deferred" !== xa() || va(); break } } this.queryPadding = 0; for (const t in this.buckets) { const r = this.buckets[t], n = e.style.getOwnLayer(t); if (!n) continue; const i = n.queryRadius(r); this.queryPadding = Math.max(this.queryPadding, i); } t.imageAtlas && (this.imageAtlas = t.imageAtlas), t.glyphAtlasImage && (this.glyphAtlasImage = t.glyphAtlasImage), t.lineAtlas && (this.lineAtlas = t.lineAtlas), this._lastUpdatedBrightness = t.brightness; } else this.collisionBoxArray = new _o; } 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.fqid] } upload(t) { for (const e in this.buckets) { const r = this.buckets[e]; r.uploadPending() && r.upload(t); } const e = t.gl, r = this.imageAtlas; if (r && !r.uploaded) { const n = !!Object.keys(r.patternPositions).length; this.imageAtlasTexture = new _g(t, r.image, e.RGBA, { useMipmap: n }), this.imageAtlas.uploaded = !0; } this.glyphAtlasImage && (this.glyphAtlasTexture = new _g(t, this.glyphAtlasImage, e.R8), this.glyphAtlasImage = null), this.lineAtlas && !this.lineAtlas.uploaded && (this.lineAtlasTexture = new _g(t, this.lineAtlas.image, e.R8), this.lineAtlas.uploaded = !0); } prepare(t, e, r) { if (this.imageAtlas && this.imageAtlasTexture && this.imageAtlas.patchUpdatedImages(t, this.imageAtlasTexture, r), !e || !this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) return; const n = e.style.getBrightness(); (this._lastUpdatedBrightness || n) && (this._lastUpdatedBrightness && n && Math.abs(this._lastUpdatedBrightness - n) < .001 || (this._lastUpdatedBrightness = n, this.updateBuckets(void 0, e))); } queryRenderedFeatures(t, e, r, n, i, s, a, o) { return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ tileResult: n, pixelPosMatrix: a, transform: s, params: i, tileTransform: this.tileTransform }, t, e, r) : {} } querySourceFeatures(t, e) { const r = this.latestFeatureIndex; if (!r || !r.rawTileData) return; const n = r.loadVTLayers(), i = e ? e.sourceLayer : "", s = n._geojsonTileLayer || n[i]; if (!s) return; const a = ls(e && e.filter), { z: o, x: l, y: u } = this.tileID.canonical, c = { z: o, x: l, y: u }; for (let e = 0; e < s.length; e++) { const n = s.feature(e); if (a.needGeometry) { const t = gp(n, !0);
36 if (!a.filter(new _a(this.tileID.overscaledZ), t, this.tileID.canonical)) continue } else if (!a.filter(new _a(this.tileID.overscaledZ), n)) continue; const h = r.getId(n, i), p = new Ld(n, o, l, u, h); p.tile = c, t.push(p); } } hasData() { return "loaded" === this.state || "reloading" === this.state || "expired" === this.state } bucketsLoaded() { for (const t in this.buckets) if (this.buckets[t].uploadPending()) return !1; return !0 } patternsLoaded() { return !!this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length } setExpiryData(t) { const e = this.expirationTime; if (t.cacheControl) { const e = K(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 r = !1; if (this.expirationTime > t) r = !1; else if (e) if (this.expirationTime < e) r = !0; else { const n = this.expirationTime - e; n ? this.expirationTime = t + Math.max(n, 3e4) : r = !0; } else r = !0; r ? (this.expiredRequestCount++, this.state = "expired") : this.expiredRequestCount = 0; } } getExpiryTimeout() { if (this.expirationTime) return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - (new Date).getTime(), Math.pow(2, 31) - 1) } setFeatureState(t, e) { this.latestFeatureIndex && this.latestFeatureIndex.rawTileData && 0 !== Object.keys(t).length && e && this.updateBuckets(t, e); } updateBuckets(t, e) { if (!this.latestFeatureIndex) return; const r = this.latestFeatureIndex.loadVTLayers(), n = e.style.listImages(), i = e.style.getBrightness(); for (const s in this.buckets) { if (!e.style.hasLayer(s)) continue; const a = this.buckets[s], o = a.layers[0].sourceLayer || "_geojsonTileLayer", l = r[o]; let u = {}; if (t && (u = t[o], !l || !u || 0 === Object.keys(u).length)) continue; if (a.update(u, l, n, this.imageAtlas && this.imageAtlas.patternPositions || {}, i), a instanceof bg || a instanceof Uf) { const t = e.style.getOwnSourceCache(a.layers[0].source); e._terrain && e._terrain.enabled && t && a.programConfigurations.needsUpload && e._terrain._clearRenderCacheForTile(t.id, this.tileID); } const c = e && e.style && e.style.getOwnLayer(s); c && (this.queryPadding = Math.max(this.queryPadding, c.queryRadius(a))); } } holdingForFade() { return void 0 !== this.symbolFadeHoldUntil } symbolFadeFinished() { return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < Wt.now() } clearFadeHold() { this.symbolFadeHoldUntil = void 0; } setHoldDuration(t) { this.symbolFadeHoldUntil = Wt.now() + t; } setTexture(t, e) { const r = e.context, n = r.gl; this.texture = this.texture || e.getTileTexture(t.width), this.texture && this.texture instanceof _g ? this.texture.update(t, { useMipmap: !0 }) : (this.texture = new _g(r, t, n.RGBA, { useMipmap: !0 }), this.texture.bind(n.LINEAR, n.CLAMP_TO_EDGE)); } setDependencies(t, e) { const r = {}; for (const t of e) r[t] = !0; this.dependencies[t] = r; } hasDependency(t, e) { for (const r of t) { const t = this.dependencies[r]; if (t) for (const r of e) if (t[r]) return !0 } return !1 } clearQueryDebugViz() { } _makeDebugTileBoundsBuffers(t, e) { if (!e || "mercator" === e.name || this._tileDebugBuffer) return; const r = yp(Eg, this.tileID.canonical, this.tileTransform)[0], n = new $a, i = new fo; for (let t = 0; t < r.length; t++) { const { x: e, y: s } = r[t]; n.emplaceBack(e, s), i.emplaceBack(t); } i.emplaceBack(0), this._tileDebugIndexBuffer = t.createIndexBuffer(i), this._tileDebugBuffer = t.createVertexBuffer(n, Yc.members), this._tileDebugSegments = Do.simpleSegment(0, 0, n.length, i.length); } _makeTileBoundsBuffers(t, e) { if (this._tileBoundsBuffer || !e || "mercator" === e.name) return; const r = yp(Eg, this.tileID.canonical, this.tileTransform)[0]; let n, i; if (this.isRaster) { const t = function (t, e) { const r = zy(t, e), n = Math.pow(2, t.z); for (let i = 0; i < Ag; i++)for (let s = 0; s < Ag; s++) { const a = tp((t.x + (s + Pg(s)) / Mg) / n), o = ep((t.y + (i + Pg(i)) / Mg) / n), l = e.project(a, o), u = i * Ag + s; Ig[2 * u + 0] = Math.round((l.x * r.scale - r.x) * Cr), Ig[2 * u + 1] = Math.round((l.y * r.scale - r.y) * Cr); } kg.fill(0), Tg.fill(0); for (let t = 2045; t >= 0; t--) { const e = 4 * t, r = Sg[e + 0], n = Sg[e + 1], i = Sg[e + 2], s = Sg[e + 3], a = r + i >> 1, o = n + s >> 1, l = a + o - n, u = o + r - a, c = n * Ag + r, h = s * Ag + i, p = o * Ag + a, f = Math.hypot((Ig[2 * c + 0] + Ig[2 * h + 0]) / 2 - Ig[2 * p + 0], (Ig[2 * c + 1] + Ig[2 * h + 1]) / 2 - Ig[2 * p + 1]) >= 16;
vendor: 8,987 bytes, line 36
36 kg[p] = kg[p] || (f ? 1 : 0), t < 1022 && (kg[p] = kg[p] || kg[(n + u >> 1) * Ag + (r + l >> 1)] || kg[(s + u >> 1) * Ag + (i + l >> 1)]); } const i = new Ga, s = new ao; let a = 0; function o(t, e) { const r = e * Ag + t; return 0 === Tg[r] && (i.emplaceBack(Ig[2 * r + 0], Ig[2 * r + 1], t * Cr / Mg, e * Cr / Mg), Tg[r] = ++a), Tg[r] - 1 } function l(t, e, r, n, i, a) { const u = t + r >> 1, c = e + n >> 1; if (Math.abs(t - i) + Math.abs(e - a) > 1 && kg[c * Ag + u]) l(i, a, t, e, u, c), l(r, n, i, a, u, c); else { const l = o(t, e), u = o(r, n), c = o(i, a); s.emplaceBack(l, u, c); } } return l(0, 0, Mg, Mg, Mg, 0), l(Mg, Mg, 0, 0, 0, Mg), { vertices: i, indices: s } }(this.tileID.canonical, e); n = t.vertices, i = t.indices; } else { n = new Ga, i = new ao; for (const { x: t, y: e } of r) n.emplaceBack(t, e, 0, 0); const t = Lf(n.int16, void 0, 4); for (let e = 0; e < t.length; e += 3)i.emplaceBack(t[e], t[e + 1], t[e + 2]); } this._tileBoundsBuffer = t.createVertexBuffer(n, zg.members), this._tileBoundsIndexBuffer = t.createIndexBuffer(i), this._tileBoundsSegments = Do.simpleSegment(0, 0, n.length, i.length); } _makeGlobeTileDebugBuffers(e, r) { const n = r.projection; if (!n || "globe" !== n.name || r.freezeTileCoverage) return; const i = this.tileID.canonical, s = Dh(Mh(i, r)), a = Oh(r.zoom); let o; a > 0 && (o = t.m.invert(new Float64Array(16), r.globeMatrix)), this._makeGlobeTileDebugBorderBuffer(e, i, r, s, o, a), this._makeGlobeTileDebugTextBuffer(e, i, r, s, o, a); } _globePoint(e, r, n, i, s, a, o) { let l = zh(e, r, n); if (a) { const s = 1 << n.z, u = Hh(i.center.lng), c = Jh(i.center.lat), h = (n.x + .5) / s - u; let p = 0; h > .5 ? p = -1 : h < -.5 && (p = 1); let f = (e / Cr + n.x) / s + p, d = (r / Cr + n.y) / s; f = (f - u) * i._pixelsPerMercatorPixel + u, d = (d - c) * i._pixelsPerMercatorPixel + c; const m = [f * i.worldSize, d * i.worldSize, 0]; t.v.transformMat4(m, m, a), l = wh(l, m, o); } return t.v.transformMat4(l, l, s) } _makeGlobeTileDebugBorderBuffer(t, e, r, n, i, s) { const a = new $a, o = new fo, l = new qa, u = (t, u, c, h, p) => { const f = (c - t) / (p - 1), d = (h - u) / (p - 1), m = a.length; for (let c = 0; c < p; c++) { const h = t + c * f, p = u + c * d; a.emplaceBack(h, p); const y = this._globePoint(h, p, e, r, n, i, s); l.emplaceBack(y[0], y[1], y[2]), o.emplaceBack(m + c); } }, c = Cr; u(0, 0, c, 0, 16), u(c, 0, c, c, 16), u(c, c, 0, c, 16), u(0, c, 0, 0, 16), this._tileDebugIndexBuffer = t.createIndexBuffer(o), this._tileDebugBuffer = t.createVertexBuffer(a, Yc.members), this._globeTileDebugBorderBuffer = t.createVertexBuffer(l, Gc.members), this._tileDebugSegments = Do.simpleSegment(0, 0, a.length, o.length); } _makeGlobeTileDebugTextBuffer(t, e, r, n, i, s) { const a = Cr / 4, o = new $a, l = new ao, u = new qa, c = 25; l.reserve(32), o.reserve(c), u.reserve(c); const h = (t, e) => c * t + e; for (let t = 0; t < c; t++) { const l = t * a; for (let t = 0; t < c; t++) { const c = t * a; o.emplaceBack(c, l); const h = this._globePoint(c, l, e, r, n, i, s); u.emplaceBack(h[0], h[1], h[2]); } } for (let t = 0; t < 4; t++)for (let e = 0; e < 4; e++) { const r = h(t, e), n = h(t, e + 1), i = h(t + 1, e), s = h(t + 1, e + 1); l.emplaceBack(r, n, i), l.emplaceBack(i, n, s); } this._tileDebugTextIndexBuffer = t.createIndexBuffer(l), this._tileDebugTextBuffer = t.createVertexBuffer(o, Yc.members), this._globeTileDebugTextBuffer = t.createVertexBuffer(u, Gc.members), this._tileDebugTextSegments = Do.simpleSegment(0, 0, c, 32); } destroy(t = !1) { 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(), delete this.imageAtlasTexture), this.glyphAtlasTexture && (this.glyphAtlasTexture.destroy(), delete this.glyphAtlasTexture), this.lineAtlasTexture && (this.lineAtlasTexture.destroy(), delete this.lineAtlasTexture), this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(), this._tileBoundsIndexBuffer.destroy(), this._tileBoundsSegments.destroy(), this._tileBoundsBuffer = null), this._tileDebugBuffer && (this._tileDebugBuffer.destroy(), this._tileDebugSegments.destroy(), this._tileDebugBuffer = null), this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(), this._tileDebugIndexBuffer = null), this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(), this._globeTileDebugBorderBuffer = null), this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(), this._tileDebugTextSegments.destroy(), this._tileDebugTextIndexBuffer.destroy(), this._tileDebugTextBuffer = null), this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(), this._globeTileDebugTextBuffer = null), !t && this.texture && this.texture instanceof _g && (this.texture.destroy(), delete this.texture), this.hillshadeFBO && (this.hillshadeFBO.destroy(), delete this.hillshadeFBO), this.dem && delete this.dem, this.neighboringTiles && delete this.neighboringTiles, this.demTexture && (this.demTexture.destroy(), delete this.demTexture), this.latestFeatureIndex = null, this.state = "unloaded"; } } class Dg { 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, r) { const n = t.wrapped().key; void 0 === this.data[n] && (this.data[n] = []); const i = { value: e, timeout: void 0 }; if (void 0 !== r && (i.timeout = setTimeout((() => { this.remove(t, i); }), r)), this.data[n].push(i), this.order.push(n), 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 r = t.wrapped().key, n = void 0 === e ? 0 : this.data[r].indexOf(e), i = this.data[r][n]; return this.data[r].splice(n, 1), i.timeout && clearTimeout(i.timeout), 0 === this.data[r].length && delete this.data[r], this.onRemove(i.value), this.order.splice(this.order.indexOf(r), 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 r in this.data) for (const n of this.data[r]) t(n.value) || e.push(n); for (const t of e) this.remove(t.value.tileID, t); } } class Cg { constructor(t, e, r, n) { this.id = Cg.uniqueIdxCounter, Cg.uniqueIdxCounter++, this.context = t; const i = t.gl; this.buffer = i.createBuffer(), this.dynamicDraw = Boolean(r), this.context.unbindVAO(), t.bindElementBuffer.set(this.buffer), i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.arrayBuffer, this.dynamicDraw ? i.DYNAMIC_DRAW : i.STATIC_DRAW), this.dynamicDraw || n || e.destroy(); } bind() { this.context.bindElementBuffer.set(this.buffer); } updateData(t) { this.id = Cg.uniqueIdxCounter, Cg.uniqueIdxCounter++; 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); } } Cg.uniqueIdxCounter = 0; class Rg { constructor(t, e, r) { this.func = t, this.mask = e, this.range = r; } } Rg.ReadOnly = !1, Rg.ReadWrite = !0, Rg.disabled = new Rg(519, Rg.ReadOnly, [0, 1]); const Lg = 7680; class Vg { constructor(t, e, r, n, i, s) { this.test = t, this.ref = e, this.mask = r, this.fail = n, this.depthFail = i, this.pass = s; } } Vg.disabled = new Vg({ func: 519, mask: 0 }, 0, 0, Lg, Lg, Lg); class Og { constructor(t, e, r, n) { this.blendFunction = t, this.blendColor = e, this.mask = r, this.blendEquation = n; } } Og.Replace = [1, 0, 1, 0], Og.disabled = new Og(Og.Replace, Re.transparent, [!1, !1, !1, !1]), Og.unblended = new Og(Og.Replace, Re.transparent, [!0, !0, !0, !0]), Og.alphaBlended = new Og([1, 771, 1, 771], Re.transparent, [!0, !0, !0, !0]), Og.multiply = new Og([774, 0, 774, 0], Re.transparent, [!0, !0, !0, !0]); const Fg = 1029, jg = 2305; class Ug { constructor(t, e, r) { this.enable = t, this.mode = e, this.frontFace = r; } } Ug.disabled = new Ug(!1, Fg, jg), Ug.backCCW = new Ug(!0, Fg, jg), Ug.backCW = new Ug(!0, Fg, 2304), Ug.frontCW = new Ug(!0, 1028, 2304), Ug.frontCCW = new Ug(!0, 1028, jg); class Ng extends ee { constructor(t, e, r) { super(), this.id = t, this._onlySymbols = r, e.on("data", (t =>
36 { "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 Dg(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._minTileCacheSize = e.minTileCacheSize, this._maxTileCacheSize = e.maxTileCacheSize, this._loadedParentTiles = {}, this.castsShadows = !1, this._coveredTiles = {}, this._shadowCasterTiles = {}, this._state = new Vd, 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 ("errored" !== e.state && ("loaded" !== e.state || !e.bucketsLoaded())) return !1 } return !0 } getSource() { return this._source } pause() { this._paused = !0; } resume() { if (!this._paused) return; const t = this._shouldReloadOnResume; this._paused = !1, this._shouldReloadOnResume = !1, t && this.reload(), this.transform && this.update(this.transform); } _loadTile(t, e) { return t.isSymbolTile = this._onlySymbols, t.isExtraShadowCaster = this._shadowCasterTiles[t.tileID.key], 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) { this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null); for (const e in this._tiles) { const r = this._tiles[e]; r.upload(t), r.prepare(this.map.style.imageManager, this.map ? this.map.painter : null, this._source.scope); } } getIds() { return E(this._tiles).map((t => t.tileID)).sort($g).map((t => t.key)) } getRenderableIds(t, e) { const r = []; for (const n in this._tiles) this._isIdRenderable(+n, t, e) && r.push(this._tiles[n]); return t ? r.sort(((t, e) => { const r = t.tileID, n = e.tileID, i = new x(r.canonical.x, r.canonical.y)._rotate(this.transform.angle), s = new x(n.canonical.x, n.canonical.y)._rotate(this.transform.angle); return r.overscaledZ - n.overscaledZ || s.y - i.y || s.x - i.x })).map((t => t.tileID.key)) : r.map((t => t.tileID)).sort($g).map((t => t.key)) } hasRenderableParent(t) { const e = this.findLoadedParent(t, 0); return !!e && this._isIdRenderable(e.tileID.key) } _isIdRenderable(t, e, r) { return this._tiles[t] && this._tiles[t].hasData() && !this._coveredTiles[t] && (e || !this._tiles[t].holdingForFade()) && (r || !this._shadowCasterTiles[t]) } 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 r = this._tiles[t]; r && ("loading" !== r.state && (r.state = e), this._loadTile(r, this._tileLoaded.bind(this, r, t, e))); } _tileLoaded(t, e, r, n) { if (n) if (t.state = "errored", 404 !== n.status) this._source.fire(new te(n, { tile: t })); else { if (!(t.tileID.key in this._loadedParentTiles)) return void this._source.fire(new Qt("data", { dataType: "source", sourceDataType: "error", sourceId: this._source.id })); 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 = Wt.now(), "expired" === r && (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 Qt("data", { dataType: "source", tile: t, coord: t.tileID, sourceCacheId: this.id })); } _backfillDEM(t) { const e = this.getRenderableIds(); for (let n = 0; n < e.length; n++) { const i = e[n]; if (t.neighboringTiles && t.neighboringTiles[i]) { const e = this.getTileByID(i); r(t, e), r(e, t); } } function r(t, e) { if (!t.dem || t.dem.borderReady) return;
vendor: 5,135 bytes, line 36
36 t.needsHillshadePrepare = !0, t.needsDEMTextureUpload = !0; let r = e.tileID.canonical.x - t.tileID.canonical.x; const n = e.tileID.canonical.y - t.tileID.canonical.y, i = Math.pow(2, t.tileID.canonical.z), s = e.tileID.key; 0 === r && 0 === n || Math.abs(n) > 1 || (Math.abs(r) > 1 && (1 === Math.abs(r + i) ? r += i : 1 === Math.abs(r - i) && (r -= i)), e.dem && t.dem && (t.dem.backfillBorder(e.dem, r, n), t.neighboringTiles && t.neighboringTiles[s] && (t.neighboringTiles[s].backfilled = !0))); } } getTile(t) { return this.getTileByID(t.key) } getTileByID(t) { return this._tiles[t] } _retainLoadedChildren(t, e, r, n) { for (const i in this._tiles) { let s = this._tiles[i]; if (n[i] || !s.hasData() || s.tileID.overscaledZ <= e || s.tileID.overscaledZ > r) continue; let a = s.tileID; for (; s && s.tileID.overscaledZ > e + 1;) { const t = s.tileID.scaledTo(s.tileID.overscaledZ - 1); s = this._tiles[t.key], s && s.hasData() && (a = t); } let o = a; for (; o.overscaledZ > e;)if (o = o.scaledTo(o.overscaledZ - 1), t[o.key]) { n[a.key] = a; break } } } findLoadedParent(t, e) { if (t.key in this._loadedParentTiles) { const r = this._loadedParentTiles[t.key]; return r && r.tileID.overscaledZ >= e ? r : null } for (let r = t.overscaledZ - 1; r >= e; r--) { const e = t.scaledTo(r), n = this._getLoadedTile(e); if (n) return n } } _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 r = Math.ceil(t.width / e) + 1, n = Math.ceil(t.height / e) + 1, i = Math.floor(r * n * 5), s = "number" == typeof this._minTileCacheSize ? Math.max(this._minTileCacheSize, i) : i, a = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, s) : s; this._cache.setMaxSize(a); } handleWrapJump(t) { const e = Math.round((t - (void 0 === this._prevLng ? t : this._prevLng)) / 360); if (this._prevLng = t, e) { const t = {}; for (const r in this._tiles) { const n = this._tiles[r]; n.tileID = n.tileID.unwrapTo(n.tileID.wrap + e), t[n.tileID.key] = n; } this._tiles = t; for (const t in this._timers) clearTimeout(this._timers[t]), delete this._timers[t]; for (const t in this._tiles) this._setTileReloadTimer(+t, this._tiles[t]); } } update(t, e, r, n) { if (this.transform = t, !this._sourceLoaded || this._paused || this.transform.freezeTileCoverage) return; if (this.usedForTerrain && !r) return; let i; if (this.updateCacheSize(t, e), "globe" !== this.transform.projection.name && this.handleWrapJump(this.transform.center.lng), this._shadowCasterTiles = {}, this._coveredTiles = {}, this.used || this.usedForTerrain ? this._source.tileID ? i = t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t => new Hc(t.canonical.z, t.wrap, t.canonical.z, t.canonical.x, t.canonical.y))) : (i = t.coveringTiles({ tileSize: e || this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom && !r, reparseOverscaled: this._source.reparseOverscaled, isTerrainDEM: this.usedForTerrain }), this._source.hasTile && (i = i.filter((t => this._source.hasTile(t))))) : i = [], i.length > 0 && this.castsShadows && n && "globe" !== this.transform.projection.name && !this.usedForTerrain && !qg(this._source.type)) { const s = t.coveringZoomLevel({ tileSize: e || this._source.tileSize, roundZoom: this._source.roundZoom && !r }), a = Math.min(s, this._source.maxzoom), o = t.extendTileCoverForShadows(i, n, a); for (const t of o) this._shadowCasterTiles[t.key] = !0, i.push(t); } const s = this._updateRetainedTiles(i); if (qg(this._source.type) && 0 !== i.length) { const t = {}, e = {}, r = Object.keys(s); for (const n of r) { const r = s[n], i = this._tiles[n]; if (!i || i.fadeEndTime && i.fadeEndTime <= Wt.now()) continue; const a = this.findLoadedParent(r, Math.max(r.overscaledZ - Ng.maxOverzooming, this._source.minzoom)); a && (this._addTile(a.tileID), t[a.tileID.key] = a.tileID), e[n] = r; } const n = i[i.length - 1].overscaledZ; for (const t in this._tiles) { const r = this._tiles[t]; if (s[t] || !r.hasData()) continue; let i = r.tileID; for (; i.overscaledZ > n;) { i = i.scaledTo(i.overscaledZ - 1); const n = this._tiles[i.key]; if (n && n.hasData() && e[i.key]) { s[t] = r.tileID; break } } } for (const e in t) s[e] || (this._coveredTiles[e] = !0, s[e] = t[e]); } for (const t in s) this._tiles[t].clearFadeHold(); const a = function (t, e) { const r = []; for (const n in t) n in e || r.push(n); return r }(this._tiles, s); for (const t of a) { const e = this._tiles[t]; e.hasSymbolBuckets && !e.holdingForFade() ? e.setHoldDuration(this.map._fadeDuration) : e.hasSymbolBuckets && !e.symbolFadeFinished() || this._removeTile(+t); } 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 r = {}, n = t.reduce(((t, e) =>
vendor: 9,590 bytes, line 36
36 Math.min(t, e.overscaledZ)), 1 / 0), i = t[0].overscaledZ, s = Math.max(i - Ng.maxOverzooming, this._source.minzoom), a = Math.max(i + Ng.maxUnderzooming, this._source.minzoom), o = {}; for (const r of t) { const t = this._addTile(r); e[r.key] = r, t.hasData() || n < this._source.maxzoom && (o[r.key] = r); } this._retainLoadedChildren(o, n, a, e); for (const n of t) { let t = this._tiles[n.key]; if (t.hasData()) continue; if (n.canonical.z >= this._source.maxzoom) { const t = n.children(this._source.maxzoom)[0], r = this.getTile(t); if (r && r.hasData()) { e[t.key] = t; continue } } else { const t = n.children(this._source.maxzoom); if (e[t[0].key] && e[t[1].key] && e[t[2].key] && e[t[3].key]) continue } let i = t.wasRequested(); for (let a = n.overscaledZ - 1; a >= s; --a) { const s = n.scaledTo(a); if (r[s.key]) break; if (r[s.key] = !0, t = this.getTile(s), !t && i && (t = this._addTile(s)), t && (e[s.key] = s, i = t.wasRequested(), t.hasData())) break } } return e } _updateLoadedParentTileCache() { this._loadedParentTiles = {}; for (const t in this._tiles) { const e = []; let r, n = this._tiles[t].tileID; for (; n.overscaledZ > 0;) { if (n.key in this._loadedParentTiles) { r = this._loadedParentTiles[n.key]; break } e.push(n.key); const t = n.scaledTo(n.overscaledZ - 1); if (r = this._getLoadedTile(t), r) break; n = t; } for (const t of e) this._loadedParentTiles[t] = r; } } _addTile(t) { let e = this._tiles[t.key]; if (e) return !0 !== e.isExtraShadowCaster || !!this._shadowCasterTiles[t.key] || this._reloadTile(t.key, "reloading"), 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 r = Boolean(e); if (!r) { const r = this.map ? this.map.painter : null; e = new Bg(t, this._source.tileSize * t.overscaleFactor(), this.transform.tileZoom, r, this._isRaster), this._loadTile(e, this._tileLoaded.bind(this, e, t.key, e.state)); } return e ? (e.uses++, this._tiles[t.key] = e, r || this._source.fire(new Qt("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 r = e.getExpiryTimeout(); r && (this._timers[t] = setTimeout((() => { this._reloadTile(t, "expired"), delete this._timers[t]; }), r)); } _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, r) { const n = [], i = this.transform; if (!i) return n; const s = "globe" === i.projection.name, a = Hh(i.center.lng); for (const o in this._tiles) { const l = this._tiles[o]; if (r && l.clearQueryDebugViz(), l.holdingForFade()) continue; let u; if (s) { const t = l.tileID.canonical; if (0 === t.z) { const e = [Math.abs(k(a, ...Gg(t, -1)) - a), Math.abs(k(a, ...Gg(t, 1)) - a)]; u = [0, 2 * e.indexOf(Math.min(...e)) - 1]; } else { const e = [Math.abs(k(a, ...Gg(t, -1)) - a), Math.abs(k(a, ...Gg(t, 0)) - a), Math.abs(k(a, ...Gg(t, 1)) - a)]; u = [e.indexOf(Math.min(...e)) - 1]; } } else u = [0]; for (const r of u) { const s = t.containsTile(l, i, e, r); s && n.push(s); } } return n } getShadowCasterCoordinates() { return this._getRenderableCoordinates(!1, !0) } getVisibleCoordinates(t) { return this._getRenderableCoordinates(t) } _getRenderableCoordinates(t, e) { const r = this.getRenderableIds(t, e).map((t => this._tiles[t].tileID)), n = "globe" === this.transform.projection.name; for (const t of r) t.projMatrix = this.transform.calculateProjMatrix(t.toUnwrapped()), t.expandedProjMatrix = n ? this.transform.calculateProjMatrix(t.toUnwrapped(), !1, !0) : t.projMatrix; return r } sortCoordinatesByDistance(t) { const e = t.slice(), r = this.transform._camera.position, n = this.transform._camera.forward(), i = {}; for (const t of e) { const e = 1 / (1 << t.canonical.z); i[t.key] = ((t.canonical.x + .5) * e + t.wrap - r[0]) * n[0] + ((t.canonical.y + .5) * e - r[1]) * n[1] - r[2] * n[2]; } return e.sort(((t, e) => i[t.key] - i[e.key])), e } hasTransition() { if (this._source.hasTransition()) return !0; if (qg(this._source.type)) for (const t in this._tiles) { const e = this._tiles[t]; if (void 0 !== e.fadeEndTime && e.fadeEndTime >= Wt.now()) return !0 } return !1 } setFeatureState(t, e, r) { this._state.updateState(t = t || "_geojsonTileLayer", e, r); } removeFeatureState(t, e, r) { this._state.removeFeatureState(t = t || "_geojsonTileLayer", e, r); } getFeatureState(t, e) { return this._state.getState(t = t || "_geojsonTileLayer", e) } setDependencies(t, e, r) { const n = this._tiles[t]; n && n.setDependencies(e, r); } reloadTilesForDependencies(t, e) { for (const r in this._tiles) this._tiles[r].hasDependency(t, e) && this._reloadTile(+r, "reloading"); this._cache.filter((r => !r.hasDependency(t, e))); } _preloadTiles(t, e) { if (!this._sourceLoaded) { const r = () => { this._sourceLoaded && (this._source.off("data", r), this._preloadTiles(t, e)); }; return void this._source.on("data", r) } const r = new Map, n = Array.isArray(t) ? t : [t], i = this.map.painter.terrain, s = this.usedForTerrain && i ? i.getScaledDemTileSize() : this._source.tileSize; for (const t of n) { const e = t.coveringTiles({ tileSize: s, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom && !this.usedForTerrain, reparseOverscaled: this._source.reparseOverscaled, isTerrainDEM: this.usedForTerrain }); for (const t of e) r.set(t.key, t); this.usedForTerrain && t.updateElevation(!1); } z(Array.from(r.values()), ((t, e) => { const r = new Bg(t, this._source.tileSize * t.overscaleFactor(), this.transform.tileZoom, this.map.painter, this._isRaster); this._loadTile(r, (t => { "raster-dem" === this._source.type && r.dem && this._backfillDEM(r), e(t, r); })); }), e); } } function $g(t, e) { const r = Math.abs(2 * t.wrap) - +(t.wrap < 0), n = Math.abs(2 * e.wrap) - +(e.wrap < 0); return t.overscaledZ - e.overscaledZ || n - r || e.canonical.y - t.canonical.y || e.canonical.x - t.canonical.x } function qg(t) { return "raster" === t || "image" === t || "video" === t || "custom" === t } function Gg(t, e) { const r = 1 << t.z; return [t.x / r + e, (t.x + 1) / r + e] } Ng.maxOverzooming = 10, Ng.maxUnderzooming = 3; const Yg = Ua([{ name: "a_pos_3f", components: 3, type: "Float32" }]), Zg = Ua([{ name: "a_color_3f", components: 3, type: "Float32" }]), Xg = Ua([{ name: "a_color_4f", components: 4, type: "Float32" }]), Kg = Ua([{ name: "a_uv_2f", components: 2, type: "Float32" }]), Wg = Ua([{ name: "a_normal_3f", components: 3, type: "Float32" }]), Hg = Ua([{ name: "a_normal_matrix0", components: 4, type: "Float32" }, { name: "a_normal_matrix1", components: 4, type: "Float32" }, { name: "a_normal_matrix2", components: 4, type: "Float32" }, { name: "a_normal_matrix3", components: 4, type: "Float32" }]), Jg = Ua([{ name: "a_pbr", components: 4, type: "Uint16" }, { name: "a_heightBasedEmissiveStrength", components: 3, type: "Float32" }]); function Qg(e, r) { const n = ex(e.projection, e.zoom, e.width, e.height), i = function (e, r, n, i, s) { const a = new Zh(n.lng - 180 * rx, n.lat), o = new Zh(n.lng + 180 * rx, n.lat), l = e.project(a.lng, a.lat), u = e.project(o.lng, o.lat), c = -Math.atan2(u.y - l.y, u.x - l.x), h = lp.fromLngLat(n); h.y = k(h.y, -1 + rx, 1 - rx); const p = h.toLngLat(), f = e.project(p.lng, p.lat), d = lp.fromLngLat(p); d.x += rx; const m = d.toLngLat(), y = e.project(m.lng, m.lat), g = ix(y.x - f.x, y.y - f.y, c), x = lp.fromLngLat(p); x.y += rx; const v = x.toLngLat(), b = e.project(v.lng, v.lat), _ = ix(b.x - f.x, b.y - f.y, c), w = Math.abs(g.x) / Math.abs(_.y), M = t.m.identity([]); t.m.rotateZ(M, M, -c * (1 - (s ? 0 : i))); const A = t.m.identity([]); return t.m.scale(A, A, [1, 1 - (1 - w) * i, 1]), A[4] = -_.x / _.y * i, t.m.rotateZ(A, A, c), t.m.multiply(A, M, A), A }(e.projection, 0, e.center, n, r), s = tx(e); return t.m.scale(i, i, [s, s, 1]), i } function tx(t) { const e = t.projection, r = ex(t.projection, t.zoom, t.width, t.height), n = nx(e, t.center), i = nx(e, Zh.convert(e.center)); return Math.pow(2, n * r + (1 - r) * i) } function ex(t, e, r, n, i = 1 / 0) { const s = t.range; if (!s) return 0; const a = Math.min(i, Math.max(r, n)), o = Math.log(a / 1024) / Math.LN2; return T(s[0] + o, s[1] + o, e) } const rx = 1 / 4e4; function nx(t, e) { const r = k(e.lat, -np, np), n = new Zh(e.lng - 180 * rx, r), i = new Zh(e.lng + 180 * rx, r), s = t.project(n.lng, r), a = t.project(i.lng, r), o = lp.fromLngLat(n), l = lp.fromLngLat(i), u = a.x - s.x, c = a.y - s.y, h = l.x - o.x, p = l.y - o.y, f = Math.sqrt((h * h + p * p) / (u * u + c * c)); return Math.log(f) / Math.LN2 } function ix(t, e, r) { const n = Math.cos(r), i = Math.sin(r); return { x: t * n - e * i, y: t * i + e * n } } function sx(t, e, r) { return e * (Cr / (t.tileSize * Math.pow(2, r - t.tileID.overscaledZ
36))) } function ax(e, r, n) { t.m.identity(e), t.m.rotateZ(e, e, _(r[2])), t.m.rotateX(e, e, _(r[0])), t.m.rotateY(e, e, _(r[1])), t.m.scale(e, e, n), t.m.multiply(e, e, [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]); } function ox(e, r, n, i, s, a, o, l) { const u = [n[0] - r[0], n[1] - r[1], 0], c = [i[0] - r[0], i[1] - r[1], 0]; if (t.v.length(u) < 1e-12 || t.v.length(c) < 1e-12) return t.q.identity(e); const h = t.v.cross([], u, c); t.v.normalize(h, h), t.v.subtract(c, i, r), u[2] = (a - s) * l, c[2] = (o - s) * l; const p = u; return t.v.cross(p, u, c), t.v.normalize(p, p), t.q.rotationTo(e, h, p) } function lx(e, r, n = !1) { const i = Oh(r.zoom), s = function (e, r, n) { const i = r.worldSize, s = [e[12], e[13], e[14]], a = ep(s[1] / i), o = tp(s[0] / i), l = t.m.identity([]), u = Qh(1, a) * i, c = Qh(1, 0) * i * sp(a, r.zoom), h = 1 / Rh(i); let p = c * h; if (n) { const t = ex(r.projection, r.zoom, r.width, r.height, 1024); p = h * r.projection.pixelSpaceConversion(r.center.lat, i, t); } const f = Ph(a, o); t.v.add(f, f, t.v.scale([], t.v.normalize([], f), u * p * s[2])); const d = function (e) { const r = [e[0], e[1], e[2]]; let n = [0, 1, 0]; const i = t.v.cross([], n, r); return t.v.cross(n, r, i), 0 === t.v.squaredLength(n) && (n = [0, 1, 0], t.v.cross(i, r, n)), t.v.normalize(i, i), t.v.normalize(n, n), t.v.normalize(r, r), [i[0], i[1], i[2], 0, n[0], n[1], n[2], 0, r[0], r[1], r[2], 0, e[0], e[1], e[2], 1] }(f); t.m.scale(l, l, [p, p, p * u]), t.m.translate(l, l, [-s[0], -s[1], -s[2]]); const m = t.m.multiply([], r.globeMatrix, d); return t.m.multiply(m, m, l), t.m.multiply(m, m, e), m }(e, r, n); if (i > 0) { const n = function (e, r) { const n = r.worldSize, i = Qh(1, 0) * n * sp(r.center.lat, r.zoom) / Rh(n), s = Qh(1, r.center.lat) * n, a = t.m.identity([]); return t.m.rotateY(a, a, _(r.center.lng)), t.m.rotateX(a, a, _(r.center.lat)), t.m.translate(a, a, [0, 0, ch]), t.m.scale(a, a, [i, i, i * s]), t.m.translate(a, a, [r.point.x - .5 * n, r.point.y - .5 * n, 0]), t.m.multiply(a, a, e), t.m.multiply(a, r.globeMatrix, a) }(e, r); return function (e, r, n) { const i = (e, r, n) => { const i = t.v.length(e), s = t.v.length(r), a = wh(e, r, n); return t.v.scale(a, a, 1 / t.v.length(a) * Mn(i, s, n)) }, s = i([e[0], e[1], e[2]], [r[0], r[1], r[2]], n), a = i([e[4], e[5], e[6]], [r[4], r[5], r[6]], n), o = i([e[8], e[9], e[10]], [r[8], r[9], r[10]], n), l = wh([e[12], e[13], e[14]], [r[12], r[13], r[14]], n); return [s[0], s[1], s[2], 0, a[0], a[1], a[2], 0, o[0], o[1], o[2], 0, l[0], l[1], l[2], 1] }(s, n, i) } return s } const ux = 64, cx = { CoordinateSpaceTile: 1, CoordinateSpaceYUp: 2, HasMapboxMeshFeatures: 4 }; function hx(t, e, r = !1) { t.uploaded || (t.gfxTexture = new _g(e, t.image, r ? e.gl.R8 : e.gl.RGBA, { useMipmap: t.sampler.minFilter >= e.gl.NEAREST_MIPMAP_NEAREST }), t.uploaded = !0, t.image = null); } function px(t, e, r) { t.indexBuffer = e.createIndexBuffer(t.indexArray, !1, !0), t.vertexBuffer = e.createVertexBuffer(t.vertexArray, Yg.members, !1, !0), t.normalArray && (t.normalBuffer = e.createVertexBuffer(t.normalArray, Wg.members, !1, !0)), t.texcoordArray && (t.texcoordBuffer = e.createVertexBuffer(t.texcoordArray, Kg.members, !1, !0)), t.colorArray && (t.colorBuffer = e.createVertexBuffer(t.colorArray, (12 === t.colorArray.bytesPerElement ? Zg : Xg).members, !1, !0)), t.featureArray && (t.pbrBuffer = e.createVertexBuffer(t.featureArray, Jg.members, !0)), t.segments = Do.simpleSegment(0, 0, t.vertexArray.length, t.indexArray.length); const n = t.material; n.pbrMetallicRoughness.baseColorTexture && hx(n.pbrMetallicRoughness.baseColorTexture, e), n.pbrMetallicRoughness.metallicRoughnessTexture && hx(n.pbrMetallicRoughness.metallicRoughnessTexture, e), n.normalTexture && hx(n.normalTexture, e), n.occlusionTexture && hx(n.occlusionTexture, e, r), n.emissionTexture && hx(n.emissionTexture, e); } function fx(t, e, r) { if (t.meshes) for (const n of t.meshes) px(n, e, r); if (t.children) for (const n of t.children) fx(n, e, r); } function dx(t) { if (t.meshes) for (const e of t.meshes) e.indexArray.destroy(), e.vertexArray.destroy(), e.colorArray && e.colorArray.destroy(), e.normalArray && e.normalArray.destroy(), e.texcoordArray && e.texcoordArray.destroy(), e.featureArray && e.featureArray.destroy(); if (t.children) for (const e of t.children) dx(e); } function mx(t) { if (t.meshes) for (const r of t.meshes) r.vertexBuffer && (r.vertexBuffer.destroy(), r.indexBuffer.destroy(), r.n
36ormalBuffer && r.normalBuffer.destroy(), r.texcoordBuffer && r.texcoordBuffer.destroy(), r.colorBuffer && r.colorBuffer.destroy(), r.pbrBuffer && r.pbrBuffer.destroy(), r.segments.destroy(), r.material && ((e = r.material).pbrMetallicRoughness.baseColorTexture && e.pbrMetallicRoughness.baseColorTexture.gfxTexture && e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(), e.pbrMetallicRoughness.metallicRoughnessTexture && e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture && e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(), e.normalTexture && e.normalTexture.gfxTexture && e.normalTexture.gfxTexture.destroy(), e.emissionTexture && e.emissionTexture.gfxTexture && e.emissionTexture.gfxTexture.destroy(), e.occlusionTexture && e.occlusionTexture.gfxTexture && e.occlusionTexture.gfxTexture.destroy())); var e; if (t.children) for (const e of t.children) mx(e); } class yx { constructor(t, e) { this.feature = t, this.instancedDataOffset = e, this.instancedDataCount = 0, this.rotation = [0, 0, 0], this.scale = [1, 1, 1], this.translation = [0, 0, 0]; } } class gx { constructor() { this.instancedDataArray = new go, this.instancesEvaluatedElevation = [], this.features = [], this.idToFeaturesIndex = {}; } } class xx { constructor(t) { this.zoom = t.zoom, this.canonical = t.canonical, this.layers = t.layers, this.layerIds = this.layers.map((t => t.fqid)), this.projection = t.projection, this.index = t.index, this.hasZoomDependentProperties = this.layers[0].isZoomDependent(), this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)), this.hasPattern = !1, this.instancesPerModel = {}, this.validForExaggeration = 0, this.maxVerticalOffset = 0, this.maxScale = 0, this.maxHeight = 0, this.lookupDim = this.zoom > this.canonical.z ? 256 : this.zoom > 15 ? 75 : 100, this.instanceCount = 0, this.terrainElevationMin = 0, this.terrainElevationMax = 0, this.validForDEMTile = { id: null, timestamp: 0 }; } populate(t, e, r, n) { this.tileToMeter = op(r); const i = this.layers[0]._featureFilter.needGeometry; this.lookup = new Uint8Array(this.lookupDim * this.lookupDim); for (const { feature: s, id: a, index: o, sourceLayerIndex: l } of t) { const t = gp(s, i); if (!this.layers[0]._featureFilter.filter(new _a(this.zoom), t, r)) continue; const u = { id: a, sourceLayerIndex: l, index: o, geometry: i ? t.geometry : yp(s, r, n), properties: s.properties, type: s.type, patterns: {} }, c = this.addFeature(u, u.geometry, t); c && e.featureIndex.insert(s, u.geometry, o, l, this.index, this.instancesPerModel[c].instancedDataArray.length); } this.lookup = null; } update(t, e, r, n) { for (const e in this.instancesPerModel) { const r = this.instancesPerModel[e]; for (const e in t) r.idToFeaturesIndex.hasOwnProperty(e) && this.evaluate(r.features[r.idToFeaturesIndex[e]], t[e], r, !0); } this.maxHeight = 0; } updateZoomBasedPaintProperties() { if (!this.hasZoomDependentProperties) return !1; let e = !1; for (const r in this.instancesPerModel) { const n = this.instancesPerModel[r]; for (const r of n.features) { const i = this.layers[0], s = r.feature, a = this.canonical, o = i.paint.get("model-rotation").evaluate(s, {}, a), l = i.paint.get("model-scale").evaluate(s, {}, a), u = i.paint.get("model-translation").evaluate(s, {}, a); t.v.exactEquals(r.rotation, o) && t.v.exactEquals(r.scale, l) && t.v.exactEquals(r.translation, u) || (this.evaluate(r, r.featureStates, n, !0), e = !0); } } return e } isEmpty() { for (const t in this.instancesPerModel) if (0 !== this.instancesPerModel[t].instancedDataArray.length) return !1; return !0 } uploadPending() { return !this.uploaded } upload(t) { if (!this.uploaded) for (const e in this.instancesPerModel) { const r = this.instancesPerModel[e]; r.instancedDataArray.length < 0 || 0 === r.instancedDataArray.length || (r.instancedDataBuffer ? r.instancedDataBuffer.updateData(r.instancedDataArray) : r.instancedDataBuffer = t.createVertexBuffer(r.instancedDataArray, Hg.members, !0, void 0, this.instanceCount)); } this.uploaded = !0; } destroy() { for (const t in this.instancesPerModel) { const e = this.instancesPerModel[t]; 0 !== e.instancedDataArray.length && e.instancedDataBuffer && e.instancedDataBuffer.destroy(); } } addFeature(t, e, r) { const n = this.layers[0], i = n.layout.get("model-id").evaluate(r, {}, this.canonical); if (!i) return q(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`), i; this.instancesPerModel[i] || (this.instancesPerModel[i] = new gx); const s = this.instancesPerModel[i], a = s.instancedDataArray, o = new yx(r, a.length); for (const t of e) for (const e of t) { if (e.x < 0 || e.x >= Cr || e.y < 0 || e.y >= Cr) continue; const t = (this.lookupDim - 1) / Cr, r = this.lookupDim * (e.y * t | 0) + e.x * t | 0; if (this.lookup) { if (0 !== this.lookup[r]) continue; this.lookup[r] = 1; } this.instanceCount++; const n = a.length; a.resize(n + 1), s.instancesEvaluatedElevation.push(0), a.float32[16 * n] = e.x, a.float32[16 * n + 1] = e.y; } return o.instancedDataCount = s.instancedDataArray.length - o.instancedDataOffset, o.instancedDataCount > 0 && (t.id && (s.idToFeaturesIndex[t.id] = s.features.length), s.features.push(o), this.evaluate(o, {}, s, !1)), i } evaluate(t, e, r, n) { const i = this.layers[0], s = t.feature, a = this.canonical, o = t.rotation = i.paint.get("model-rotation").evaluate(s, e, a), l = t.scale = i.paint.get("model-scale").evaluate(s, e, a), u = t.translation = i.paint.get("model-translation").evaluate(s, e, a), c = i.paint.get("model-color").evaluate(s, e, a); c.a = i.paint.get("model-color-mix-intensity").evaluate(s, e, a); const h = []; this.maxVerticalOffset < u[2] && (this.maxVerticalOffset = u[2]), this.maxScale = Math.max(Math.max(this.maxScale, l[0]), Math.max(l[1], l[2])), ax(h, o, l); const p = Math.round(100 * c.a) + c.b / 1.05; for (let e = 0; e < t.instancedDataCount; ++e) { const i = t.instancedDataOffset + e, s = 16 * i, o = r.instancedDataArray.float32; let l = 0; n && (l = o[s + 6] - r.instancesEvaluatedElevation[i]); const f = 0 | o[s + 1]; o[s] = (0 | o[s]) + c.r / 1.05, o[s + 1] = f + c.g / 1.05, o[s + 2] = p, o[s + 3] = 1 / (a.z > 10 ? this.tileToMeter : op(a, f)), o[s + 4] = u[0], o[s + 5] = u[1], o[s + 6] = u[2] + l, o[s + 7] = h[0], o[s + 8] = h[1], o[s + 9] = h[2], o[s + 10] = h[4], o[s + 11] = h[5], o[s + 12] = h[6], o[s + 13] = h[8], o[s + 14] = h[9], o[s + 15] = h[10], r.instancesEvaluatedElevation[i] = u[2]; } } } Ks(xx, "ModelBucket", { omit: ["layers"] }), Ks(gx, "PerModelAttributes"), Ks(yx, "ModelFeature"); const vx = new Da({ visibility: new za(re.layout_model.visibility), "model-id": new Ea(re.layout_model["model-id"]) }); var bx = { paint: new Da({ "model-opacity": new za(re.paint_model["model-opacity"]), "model-rotation": new Ea(re.paint_model["model-rotation"]), "model-scale": new Ea(re.paint_model["model-scale"]), "model-translation": new Ea(re.paint_model["model-translation"]), "model-color": new Ea(re.paint_model["model-color"]), "model-color-mix-intensity": new Ea(re.paint_model["model-color-mix-intensity"]), "model-type": new za(re.paint_model["model-type"]), "model-cast-shadows": new za(re.paint_model["model-cast-shadows"]), "model-receive-shadows": new za(re.paint_model["model-receive-shadows"]), "model-ambient-occlusion-intensity": new za(re.paint_model["model-ambient-occlusion-intensity"]), "model-emissive-strength": new Ea(re.paint_model["model-emissive-strength"]), "model-roughness": new Ea(re.paint_model["model-roughness"]), "model-height-based-emissive-strength-multiplier": new Ea(re.paint_model["model-height-based-emissive-strength-multiplier"]), "model-cutoff-fade-range": new za(re.paint_model["model-cutoff-fade-range"]) }), layout: vx }; const _x = new Float32Array(262144), wx = new Uint8Array(262144); function Mx(t) { let e = 0; if (t.meshes) for (const r of t.meshes) e = Math.max(e, r.aabb.max[2]); if (t.children) for (const r of t.children) e = Math.max(e, Mx(r)); return e } const Ax = ["", "wall", "door", "roof", "window", "lamp", "logo"]; class Sx { constructor(t) { this.node = t, this.evaluatedRMEA = [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [.4, 1, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]], this.hiddenByReplacement = !1, this.evaluatedScale = [1, 1, 1], this.evaluatedColor = [], this.emissionHeightBasedParams = [], this.feature = { type: "Point", id: t.id, geometry: [], properties: { height: Mx(t) } }; } } class Ix { constructor(t, e, r, n) { this.nodes = t, this.id = e, this.modelTraits |= cx.CoordinateSpaceTile, this.uploaded = !1, this.hasPattern = !1, r && (this.modelTraits |= cx.HasMapbox
36MeshFeatures), this.zoom = -1, this.terrainExaggeration = 1, this.projection = { name: "mercator" }, this.replacementUpdateTime = 0, this.elevationReadFromZ = 255, this.brightness = n, this.dirty = !0, this.needsUpload = !1; } update() { console.log("Update 3D model bucket"); } populate() { console.log("populate 3D model bucket"); } uploadPending() { return !this.uploaded || this.needsUpload } upload(t) { if (!this.needsUpload) return; const e = this.getNodesInfo(); for (const r of e) { const e = r.node; this.uploaded ? this.updatePbrBuffer(e) : fx(e, t, !0); } for (const t of e) dx(t.node); this.uploaded = !0, this.needsUpload = !1; } updatePbrBuffer(t) { let e = !1; if (!t.meshes) return e; for (const r of t.meshes) r.pbrBuffer && (r.pbrBuffer.updateData(r.featureArray), e = !0); return e } needsReEvaluation(t, e, r) { const n = t.transform.projectionOptions, i = t.style.getBrightness(), s = this.brightness !== i; return !!(!this.uploaded || this.dirty || n.name !== this.projection.name || kx(r.paint.get("model-color").value, s) || kx(r.paint.get("model-color-mix-intensity").value, s) || kx(r.paint.get("model-roughness").value, s) || kx(r.paint.get("model-emissive-strength").value, s) || kx(r.paint.get("model-height-based-emissive-strength-multiplier").value, s)) && (this.projection = n, this.brightness = i, !0) } evaluateScale(t, e) { if (t.transform.zoom === this.zoom) return; this.zoom = t.transform.zoom; const r = this.getNodesInfo(), n = this.id.canonical; for (const t of r) { const r = t.feature; t.evaluatedScale = e.paint.get("model-scale").evaluate(r, {}, n); } } evaluate(t) { const e = this.getNodesInfo(); for (const r of e) { if (!r.node.meshes) continue; const e = r.feature, n = r.node.meshes && r.node.meshes[0].featureData, i = r.evaluatedColor[2], s = r.evaluatedRMEA[2], a = this.id.canonical; if (r.hasTranslucentParts = !1, n) { for (let n = 0; n < Ax.length; n++) { const i = Ax[n]; i.length && (e.properties.part = i); const s = t.paint.get("model-color").evaluate(e, {}, a), o = t.paint.get("model-color-mix-intensity").evaluate(e, {}, a); r.evaluatedColor[n] = [s.r, s.g, s.b, o], r.evaluatedRMEA[n][0] = t.paint.get("model-roughness").evaluate(e, {}, a), r.evaluatedRMEA[n][2] = t.paint.get("model-emissive-strength").evaluate(e, {}, a), r.evaluatedRMEA[n][3] = s.a, r.emissionHeightBasedParams[n] = t.paint.get("model-height-based-emissive-strength-multiplier").evaluate(e, {}, a), !r.hasTranslucentParts && s.a < 1 && (r.hasTranslucentParts = !0); } delete e.properties.part, Px(r, i !== r.evaluatedColor[2] || s !== r.evaluatedRMEA[2]); } else r.evaluatedRMEA[0][2] = t.paint.get("model-emissive-strength").evaluate(e, {}, a); r.evaluatedScale = t.paint.get("model-scale").evaluate(e, {}, a), this.updatePbrBuffer(r.node) || (this.needsUpload = !0); } this.dirty = !1; } elevationUpdate(t, e, r, n) { const i = t.findDEMTileFor(r); if (i && (i.tileID.canonical !== this.terrainTile || e !== this.terrainExaggeration)) { if (i.dem && i.tileID.overscaledZ !== this.elevationReadFromZ) { this.elevationReadFromZ = i.tileID.overscaledZ; const e = Wd.create(t, r, i); if (!e) return; this.modelTraits & cx.HasMapboxMeshFeatures && this.updateDEM(t, e, r, n); for (const t of this.getNodesInfo()) { const r = t.node; if (!r.footprint || !r.footprint.vertices || !r.footprint.vertices.length) continue; const n = r.footprint.vertices; let i = e.getElevationAt(n[0].x, n[0].y, !0, !0); for (let t = 1; t < n.length; t++)i = Math.min(i, e.getElevationAt(n[t].x, n[t].y, !0, !0)); r.elevation = i; } } this.terrainTile = i.tileID.canonical, this.terrainExaggeration = e; } } updateDEM(t, e, r, n) { let i = e._dem._modifiedForSources[n]; if (void 0 === i && (e._dem._modifiedForSources[n] = [], i = e._dem._modifiedForSources[n]), i.includes(r.canonical)) return; const s = e._dem.dim; i.push(r.canonical); let a = !1; for (const t of this.getNodesInfo()) { const r = t.node; if (!r.footprint || !r.footprint.grid) continue; const n = r.footprint.grid, i = e.tileCoordToPixel(n.min.x, n.min.y), o = e.tileCoordToPixel(n.max.x, n.max.y), l = Math.min(Math.min(s - o.y, i.x), Math.min(i.y, s - o.x)); if (l < 0) continue; const u = k(l, 2, 5);
36 let c = Math.max(0, i.x - u), h = Math.max(0, i.y - u), p = Math.min(o.x + u, s - 1), f = Math.min(o.y + u, s - 1); for (let t = h; t <= f; ++t)for (let e = c; e <= p; ++e)wx[t * s + e] = 255; let d = 0, m = 0; for (let t = 0; t < n.cellsY; ++t)for (let r = 0; r < n.cellsX; ++r) { if (!n.cells[t * n.cellsX + r]) continue; const i = e.tileCoordToPixel(n.min.x + r / n.xScale, n.min.y + t / n.yScale), a = e.tileCoordToPixel(n.min.x + (r + 1) / n.xScale, n.min.y + (t + 1) / n.yScale); for (let t = i.y; t <= Math.min(a.y + 1, s - 1); ++t)for (let r = i.x; r <= Math.min(a.x + 1, s - 1); ++r)255 === wx[t * s + r] && (wx[t * s + r] = 0, d += e.getElevationAtPixel(r, t), m++); } const y = d / m; c = Math.max(1, i.x - u), h = Math.max(1, i.y - u), p = Math.min(o.x + u, s - 2), f = Math.min(o.y + u, s - 2), a = !0; for (let t = h; t <= f; ++t)for (let r = c; r <= p; ++r)0 === wx[t * s + r] && (_x[t * s + r] = e._dem.set(r, t, y)); for (let t = 1; t < u; ++t) { c = Math.max(1, i.x - t), h = Math.max(1, i.y - t), p = Math.min(o.x + t, s - 2), f = Math.min(o.y + t, s - 2); for (let r = h; r <= f; ++r)for (let n = c; n <= p; ++n) { const i = r * s + n; if (255 === wx[i]) { let a = 0, o = 0, l = -1, c = -1; for (let e = -1; e <= 1; ++e)for (let i = -1; i <= 1; ++i) { const u = (r + e) * s + n + i; if (wx[u] >= t) continue; const h = _x[u], p = Math.abs(h); p > o && (a = h, o = p, l = i, c = e); } if (o > .1) { const s = 1 - (t + .5 * Math.abs(l * c)) / u; let o = e._dem.get(n, r) + a * s; const h = e._dem.get(n + l, r + c), p = e._dem.get(n - l, r - c, !0); (o - h) * (o - p) > 0 && (o = (h + p) / 2), _x[i] = e._dem.set(n, r, o), wx[i] = t; } } } } } a && (e._demTile.needsDEMTextureUpload = !0, e._dem._timestamp = Wt.now()); } getNodesInfo() { if (!this.nodesInfo) { this.nodesInfo = []; for (const t of this.nodes) this.nodesInfo.push(new Sx(t)); this.freeNodes(); } return this.nodesInfo } freeNodes() { if (this.nodes) { for (const t of this.nodes) mx(t); this.nodes.splice(0, this.nodes.length); } } destroy() { this.freeNodes(); const t = this.getNodesInfo(); for (const e of t) dx(e.node), mx(e.node); } isEmpty() { return !this.nodes.length } updateReplacement(t, e) { if (e.updateTime === this.replacementUpdateTime) return; this.replacementUpdateTime = e.updateTime; const r = e.getReplacementRegionsForTile(t.toUnwrapped()), n = this.getNodesInfo(); for (let t = 0; t < this.nodesInfo.length; t++) { const e = n[t].node; n[t].hiddenByReplacement = !!e.footprint && !r.find((t => t.footprint === e.footprint)); } } getHeightAtTileCoord(t, e) { const r = this.getNodesInfo(), n = []; for (let i = 0; i < this.nodesInfo.length; i++) { const s = r[i], a = s.node.meshes[0]; if (t < a.aabb.min[0] || e < a.aabb.min[1] || t > a.aabb.max[0] || e > a.aabb.max[1]) continue; const o = (t - a.aabb.min[0]) / (a.aabb.max[0] - a.aabb.min[0]) * ux | 0, l = Math.min(63, (e - a.aabb.min[1]) / (a.aabb.max[1] - a.aabb.min[1]) * ux | 0) * ux + Math.min(63, o); if (!(a.heightmap[l] < 0 && s.node.footprint)) { if (s.hiddenByReplacement) return; return { height: a.heightmap[l], maxHeight: s.feature.properties.height, hidden: !1, verticalScale: s.evaluatedScale[2] } } if (s.node.footprint.grid.query(new x(t, e), new x(t, e), n), n.length > 0) return { height: void 0, maxHeight: s.feature.properties.height, hidden: s.hiddenByReplacement, verticalScale: s.evaluatedScale[2] } } } } function kx(t, e) { return !t.isLightConstant && e } function Tx(t, e, r, n, i, s, a, o) { let l = (61440 & e | (61440 & e) >> 4) >> 8, u = (3840 & e | (3840 & e) >> 4) >> 4, c = 240 & e | (240 & e) >> 4; r[3] > 0 && (l = Mn(l, 255 * r[0], r[3]), u = Mn(u, 255 * r[1], r[3]), c = Mn(c, 255 * r[2], r[3])); const h = l << 8 | u, p = c << 8 | Math.floor(255 * n[3]), f = function (t) { const e = k(t, 0, 2); return Math.min(Math.round(.5 * e * 255), 255) }(n[2]) << 8 | 15 * n[0] << 4 | 15 * n[1], d = k(i[0], 0, 1), m = k(i[1], 0, 1), y = k(i[2], 0, 1), g = k(i[3], 0, 1); let x, v, b, _; if (d !== m && a !== s && m !== d) { const t = a - s; v = 1 / (t * (m - d)), b = -(s + t * d) / (t * (m - d)); const e = k(i[4], -1, 1); _ = Math.pow(10, e), x = 255 * y << 8 | 255 * g; } else x = 65535, v = 0, b = 1, _ = 1; if (t.emplaceBack(h, p, f, x, v, b, _), o) { const t = o.length; o.clear(); for (let e = 0; e < t; e++)o.emplaceBack(h, p, f, x, v, b, _); } } function Px(t, e) { const r = t.node; let n = 0; for (const i of r.meshes) { if (r.lights && r.lightMeshIndex === n) continue; if (!i.featureData) continue; i.featureArray = new xo, i.featureArray.reserve(i.featureData.length); let s = e; for (const e of i.featureData) { let n; const a = 65535 & e, o = (15 & a) < 8 ? 15 & a : 0, l = e >> 16 & 65535, u = t.evaluatedRMEA[o], c = t.evaluatedColor[o], h = t.emissionHeightBasedParams[o]; if (s && 2 === o && r.lights && (n = new xo, n.resize(10 * r.lights.length)), Tx(i.featureArray, l, c, u, h, i.aabb.min[2], i.aabb.max[2], n), n && s) { s = !1; const t = r.meshes[r.lightMeshIndex]; t.featureArray = n, t.featureArray._trim(); } } i.featureArray._trim(), n++; } } function zx(t, e) { return t.x - e.x || t.y - e.y } function Ex(t, e) { return 0 === zx(t.min, e.min) && 0 === zx(t.max, e.max) } function Bx(t, e) { return !(t.min.x > e.max.x || t.max.x < e.min.x || t.min.y > e.max.y || t.max.y < e.min.y) } function Dx(t, e, r) { const n = 1 / Cr, i = 1 / (1 << r.canonical.z), s = (e.x * n + r.canonical.x) * i + r.wrap, a = (e.y * 
vendor: 34,585 bytes, line 36
36n + r.canonical.y) * i; return { min: new x((t.x * n + r.canonical.x) * i + r.wrap, (t.y * n + r.canonical.y) * i), max: new x(s, a) } } function Cx(t, e, r) { const n = 1 << r.canonical.z, i = ((e.x - r.wrap) * n - r.canonical.x) * Cr, s = (e.y * n - r.canonical.y) * Cr; return { min: new x(((t.x - r.wrap) * n - r.canonical.x) * Cr, (t.y * n - r.canonical.y) * Cr), max: new x(i, s) } } function Rx(t, e, r, n, i, s, a) { const o = t.indices, l = t.vertices, u = []; for (let c = n; c < n + i; c += 3) { const n = e[r[c + 0] + s], i = e[r[c + 1] + s], h = e[r[c + 2] + s], p = Math.min(n.x, i.x, h.x), f = Math.max(n.x, i.x, h.x), d = Math.min(n.y, i.y, h.y), m = Math.max(n.y, i.y, h.y); u.length = 0, t.grid.query(new x(p, d), new x(f, m), u); for (let t = 0; t < u.length; t++) { const e = u[t]; if (Cp(l[o[3 * e + 0]], l[o[3 * e + 1]], l[o[3 * e + 2]], n, i, h, a)) return !0 } } return !1 } function Lx(t, e, r, n) { if (!t || !r) return !1; let i = t.vertices; if (!e.canonical.equals(n.canonical) || e.wrap !== n.wrap) { if (r.vertices.length < t.vertices.length) return Lx(r, n, t, e); const s = e.canonical, a = n.canonical, o = Math.pow(2, a.z - s.z); i = t.vertices.map((t => new x(t.x * s.x * Cr * o - a.x * Cr, t.y * s.y * Cr * o - a.y * Cr))); } return Rx(r, i, t.indices, 0, t.indices.length, 0, 0) } Ks(Ix, "Tiled3dModelBucket", { omit: ["layers"] }), Ks(Sx, "Tiled3dModelFeature"); const Vx = ud.types, Ox = ["fill-extrusion-base", "fill-extrusion-height", "fill-extrusion-color", "fill-extrusion-pattern", "fill-extrusion-flood-light-wall-radius"], Fx = ["fill-extrusion-flood-light-ground-radius"], jx = Math.pow(2, 13), Ux = Math.pow(2, 15) - 1, Nx = new x(0, 1), $x = 2147483648; function qx(t, e, r, n, i, s, a, o) { t.emplaceBack((e << 1) + a, (r << 1) + s, (Math.floor(n * jx) << 1) + i, Math.round(o)); } function Gx(t, e, r, n, i, s) { t.emplaceBack(e.x, e.y, (r.x << 1) + n, (r.y << 1) + i, s); } function Yx(t, e, r) { const n = 16384; t.emplaceBack(e.x, e.y, e.z, r[0] * n, r[1] * n, r[2] * n); } class Zx { constructor() { this.vertexOffset = 0, this.vertexCount = 0, this.indexOffset = 0, this.indexCount = 0; } } class Xx { constructor() { this.centroidXY = new x(0, 0), this.vertexArrayOffset = 0, this.vertexCount = 0, this.groundVertexArrayOffset = 0, this.groundVertexCount = 0, this.flags = 0, this.footprintSegIdx = -1, this.footprintSegLen = 0, this.polygonSegIdx = -1, this.polygonSegLen = 0, this.min = new x(Number.MAX_VALUE, Number.MAX_VALUE), this.max = new x(-Number.MAX_VALUE, -Number.MAX_VALUE), this.height = 0; } span() { return new x(this.max.x - this.min.x, this.max.y - this.min.y) } } class Kx { constructor() { this.acc = new x(0, 0), this.accCount = 0, this.centroidDataIndex = 0; } startRing(t, e) { t.min.x === Number.MAX_VALUE && (t.min.x = t.max.x = e.x, t.min.y = t.max.y = e.y); } appendEdge(t, e, r) { this.accCount++, this.acc._add(e); let n = !!this.borders; e.x < t.min.x ? (t.min.x = e.x, n = !0) : e.x > t.max.x && (t.max.x = e.x, n = !0), e.y < t.min.y ? (t.min.y = e.y, n = !0) : e.y > t.max.y && (t.max.y = e.y, n = !0), ((0 === e.x || e.x === Cr) && e.x === r.x) != ((0 === e.y || e.y === Cr) && e.y === r.y) && this.processBorderOverlap(e, r), n && this.checkBorderIntersection(e, r); } checkBorderIntersection(t, e) { e.x < 0 != t.x < 0 && this.addBorderIntersection(0, Mn(e.y, t.y, (0 - e.x) / (t.x - e.x))), e.x > Cr != t.x > Cr && this.addBorderIntersection(1, Mn(e.y, t.y, (Cr - e.x) / (t.x - e.x))), e.y < 0 != t.y < 0 && this.addBorderIntersection(2, Mn(e.x, t.x, (0 - e.y) / (t.y - e.y))), e.y > Cr != t.y > Cr && this.addBorderIntersection(3, Mn(e.x, t.x, (Cr - 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 r = this.borders[t]; e < r[0] && (r[0] = e), e > r[1] && (r[1] = e); } processBorderOverlap(t, e) { if (t.x === e.x) { if (t.y === e.y) return; const r = 0 === t.x ? 0 : 1; this.addBorderIntersection(r, e.y), this.addBorderIntersection(r, t.y); } else { const r = 0 === t.y ? 2 : 3; this.addBorderIntersection(r, e.x), this.addBorderIntersection(r, t.x); } } centroid() { return 0 === this.accCount ? new x(0, 0) : new x(Math.floor(Math.max(0, this.acc.x) / this.accCount), Math.floor(Math.max(0, this.acc.y) / this.accCount)) } intersectsCount() { return this.borders ? this.borders.reduce(((t, e) => t + +(e[0] !== Number.MAX_VALUE)), 0) : 0 } } function Wx(t, e) { const r = t.add(e)._unit(), n = k(t.x * r.x + t.y * r.y, -1, 1); var i, s, a; return i = Math.acos(n), Math.min(4, Math.max(-4, Math.tan(i))) / 4 * Ux * ((s = t).x * (a = e).y - s.y * a.x < 0 ? -1 : 1) } const Hx = [t => t.x < 0, t => t.x > Cr, t => t.y < 0, t => t.y > Cr]; function Jx(t, e, r, n) { const i = [4]; if (0 === n) return i; r._mult(n); const s = t.sub(r), a = e.sub(r), o = [t, e, s, a]; for (let t = 0; t < 4; t++)for (const e of o) if (Hx[t](e)) { i.push(t); break } return i } class Qx { constructor(t) { this.vertexArray = new Ya, this.indexArray = new ao, this.programConfigurations = new fl(t.layers, t.zoom, (t => Fx.includes(t))), this._segments = new Do, this.hiddenByLandmarkVertexArray = new vo, this._segmentToGroundQuads = {}, this._segmentToGroundQuads[0] = [], this._segmentToRegionTriCounts = {}, this._segmentToRegionTriCounts[0] = [0, 0, 0, 0, 0], this.regionSegments = {}, this.regionSegments[4] = new Do; } getDefaultSegment() { return this.regionSegments[4] } hasData() { return 0 !== this.vertexArray.length } addData(t, e, r, n = !1) { const i = t.length; if (i > 2) { let s = Math.max(0, this._segments.get().length - 1); const a = this._segments._prepareSegment(4 * i, this.vertexArray.length, 2 * this._segmentToGroundQuads[s].length); let o; s !== this._segments.get().length - 1 && (s++, this._segmentToGroundQuads[s] = [], this._segmentToRegionTriCounts[s] = [0, 0, 0, 0, 0]); { const e = t[0], r = t[1]; o = Wx(e.sub(t[i - 1])._perp()._unit(), r.sub(e)._perp()._unit()); } for (let l = 0; l < i; l++) { const u = l === i - 1 ? 0 : l + 1, c = t[l], h = t[u], p = t[u === i - 1 ? 0 : u + 1], f = h.sub(c)._perp()._unit(), d = Wx(f, p.sub(h)._perp()._unit()), m = o, y = d; if (iv(c, h, e) || n && sv(c, e) && sv(h, e)) { o = d; continue } const g = a.vertexLength; Gx(this.vertexArray, c, h, 1, 1, m), Gx(this.vertexArray, c, h, 1, 0, m), Gx(this.vertexArray, c, h, 0, 1, y), Gx(this.vertexArray, c, h, 0, 0, y), a.vertexLength += 4; const x = Jx(c, h, f, r); for (const t of x) this._segmentToGroundQuads[s].push({ id: g, region: t }), this._segmentToRegionTriCounts[s][t] += 2, a.primitiveLength += 2; o = d; } } } prepareBorderSegments() { if (!this.hasData()) return; const t = this._segments.get(), e = t.length; for (let t = 0; t < e; t++)this._segmentToGroundQuads[t].sort(((t, e) => t.region - e.region)); for (let r = 0; r < e; r++) { const e = this._segmentToGroundQuads[r], n = t[r], i = this._segmentToRegionTriCounts[r]; i.reduce(((t, e) => t + e), 0); let s = 0; for (let t = 0; t <= 4; t++) { const e = i[t]; if (0 !== e) { let r = this.regionSegments[t]; r || (r = this.regionSegments[t] = new Do); const i = { vertexOffset: n.vertexOffset, primitiveOffset: n.primitiveOffset + s, vertexLength: n.vertexLength, primitiveLength: e }; r.get().push(i); } s += e; } for (let t = 0; t < e.length; t++) { const r = e[t].id; this.indexArray.emplaceBack(r, r + 1, r + 3), this.indexArray.emplaceBack(r, r + 3, r + 2); } } this._segmentToGroundQuads = null, this._segmentToRegionTriCounts = null, this._segments.destroy(), this._segments = null; } addPaintPropertiesData(t, e, r, n, i, s) { this.hasData() && this.programConfigurations.populatePaintArrays(this.vertexArray.length, t, e, r, n, i, s); } upload(t) { this.hasData() && (this.vertexBuffer = t.createVertexBuffer(this.vertexArray, Gf.members), this.indexBuffer = t.createIndexBuffer(this.indexArray)); } uploadPaintProperties(t) { this.hasData() && this.programConfigurations.upload(t); } update(t, e, r, n, i, s) { this.hasData() && this.programConfigurations.updatePaintArrays(t, e, r, n, i, s); } updateHiddenByLandmark(t) { if (!this.hasData()) return; const e = t.groundVertexCount + t.groundVertexArrayOffset; if (0 === t.groundVertexCount) return; const r = t.flags & $x ? 1 : 0; for (let n = t.groundVertexArrayOffset; n < e; ++n)this.hiddenByLandmarkVertexArray.emplace(n, r); this._needsHiddenByLandmarkUpdate = !0; } uploadHiddenByLandmark(t) { this.hasData() && this._needsHiddenByLandmarkUpdate && (!this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexArray.length > 0 ? this.hiddenByLandmarkVertexBuffer = t.createVertexBuffer(this.hiddenByLandmarkVertexArray, Zf.members, !0) : this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray), this._needsHiddenByLandmarkUpdate = !1); } destroy() { if (this.vertexBuffer) { this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.destroy(), this._segments && this._segments.destroy(), this.programConfigurations.destroy(); for (let t = 0; t <= 4; t++) { const e = this.regionSegments[t]; e && e.destroy(); } } } } class tv { 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.fqid)), this.index = t.index, this.hasPattern = !1, this.edgeRadius = 0, this.projection = t.projection, this.activeReplacements = [], this.replacementUpdateTime = 0, this.centroidData = [], this.footprintIndices = new ao, this.footprintVertices = new $a, this.footprintSegments = [], this.layoutVertexArray = new Ga, this.centroidVertexArray = new zo, this.indexArray = new ao, this.programConfigurations = new fl(t.layers, t.zoom, (t => Ox.includes(t))), this.segments = new Do, this.stateDependentLayerIds = this.layers.filter((t => t.isStateDependent())).map((t => t.id)), this.groundEffect = new Qx(t), this.maxHeight = 0, this.partLookup = {}, this.triangleSubSegments = [], this.polygonSegments = []; } populate(t, e, r, n) { this.features = [], this.hasPattern = Ff("fill-extrusion", this.layers, e), this.featuresOnBorder = [], this.borderFeatureIndices = [[], [], [], []], this.borderDoneWithNeighborZ = [-1, -1, -1, -1], this.tileToMeter = op(r), this.edgeRadius = this.layers[0].layout.get("fill-extrusion-edge-radius") / this.tileToMeter; for (const { feature: i, id: s, index: a, sourceLayerIndex: o } of t) { const t = this.layers[0]._featureFilter.needGeometry, l = gp(i, t); if (!this.layers[0]._featureFilter.filter(new _a(this.zoom), l, r)) continue; const u = { id: s, sourceLayerIndex: o, index: a, geometry: t ? l.geometry : yp(i, r, n), properties: i.properties, type: i.type, patterns: {} }, c = this.layoutVertexArray.length; this.hasPattern ? this.features.push(jf("fill-extrusion", this.layers, u, this.zoom, e)) : this.addFeature(u, u.geometry, a, r, {}, e.availableImages, n, e.brightness), e.featureIndex.insert(i, u.geometry, a, o, this.index, c); } this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(), this.groundEffect.prepareBorderSegments(), this.polygonSegments.length = 0; } addFeatures(t, e, r, n, i, s) { for (const t of this.features) { const { geometry: a } = t; this.addFeature(t, a, t.index, e, r, n, i, s); } this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(); } update(t, e, r, n, i) { const s = 0 !== Object.keys(t).length; if (s && !this.stateDependentLayers.length) return; const a = s ? this.stateDependentLayers : this.layers; this.programConfigurations.updatePaintArrays(t, e, a, r, n, i), this.groundEffect.update(t, e, a, r, n, i); } isEmpty() { return 0 === this.layoutVertexArray.length } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload || this.groundEffect.programConfigurations.needsUpload } upload(t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, Kf), this.indexBuffer = t.createIndexBuffer(this.indexArray), this.layoutVertexExtArray && (this.layoutVertexExtBuffer = t.createVertexBuffer(this.layoutVertexExtArray, Xf.members, !0)), this.groundEffect.upload(t)), this.groundEffect.uploadPaintProperties(t), this.programConfigurations.upload(t), this.uploaded = !0; } uploadCentroid(t) { this.groundEffect.uploadHiddenByLandmark(t), this.needsCentroidUpdate && (!this.centroidVertexBuffer && this.centroidVertexArray.length > 0 ? this.centroidVertexBuffer = t.createVertexBuffer(this.centroidVertexArray, Yf.members, !0) : this.centroidVertexBuffer && this.centroidVertexBuffer.updateData(this.centroidVertexArray), this.needsCentroidUpdate = !1); } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.centroidVertexBuffer && this.centroidVertexBuffer.destroy(), this.layoutVertexExtBuffer && this.layoutVertexExtBuffer.destroy(), this.groundEffect.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); } addFeature(t, e, r, n, i, s, a, o) { const l = this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t, {}) / this.tileToMeter, u = [new x(0, 0), new x(Cr, Cr)], c = a.projection, h = "globe" === c.name, p = "Polygon" === Vx[t.type], f = new Kx; f.centroidDataIndex = this.centroidData.length; const d = new Xx, m = this.layers[0].paint.get("fill-extrusion-base").evaluate(t, {}, n) <= 0, y = this.layers[0].paint.get("fill-extrusion-height").evaluate(t, {}, n); d.height = y, d.vertexArrayOffset = this.layoutVertexArray.length, d.groundVertexArrayOffset = this.groundEffect.vertexArray.length, h && !this.layoutVertexExtArray && (this.layoutVertexExtArray = new Ha); const g = Vf(e, 500); for (let t = g.length - 1; t >= 0; t--) { const e = g[t]; (0 === e.length || (v = e[0]).every((t => t.x <= 0)) || v.every((t => t.x >= Cr)) || v.every((t => t.y <= 0)) || v.every((t => t.y >= Cr))) && g.splice(t, 1); } var v; let b; if (h) b = uv(g, u, n); else { b = []; for (const t of g) b.push({ polygon: t, bounds: u }); } const _ = p ? this.edgeRadius : 0, w = _ > 0 && this.zoom < 17, M = (t, e) => { if (0 === t.length) return !1; const r = t[t.length - 1]; return e.x === r.x && e.y === r.y }; for (const { polygon: t, bounds: e } of b) { let r = 0, i = 0; for (const e of t) p && !e[0].equals(e[e.length - 1]) && e.push(e[0]), i += p ? e.length - 1 : e.length; const s = this.segments.prepareSegment((p ? 5 : 4) * i, this.layoutVertexArray, this.indexArray); d.footprintSegIdx < 0 && (d.footprintSegIdx = this.footprintSegments.length), d.polygonSegIdx < 0 && (d.polygonSegIdx = this.polygonSegments.length); const a = { triangleArrayOffset: this.indexArray.length, triangleCount: 0, triangleSegIdx: this.segments.segments.length - 1 }, o = new Zx; if (o.vertexOffset = this.footprintVertices.length, o.indexOffset = 3 * this.footprintIndices.length, o.ringIndices = [], p) { const i = [], a = []; r = s.vertexLength; for (let r = 0; r < t.length; r++) { const u = t[r]; u.length && 0 !== r && a.push(i.length / 2); const p = []; let f, d; f = u[1].sub(u[0])._perp()._unit(), o.ringIndices.push(u.length - 1); for (let t = 1; t < u.length; t++) { const e = u[t], r = u[t === u.length - 1 ? 1 : t + 1], a = e.clone(); if (_) { d = r.sub(e)._perp()._unit(); const t = f.add(d)._unit(), n = _ * Math.min(4, 1 / (f.x * t.x + f.y * t.y)); a.x += n * t.x, a.y += n * t.y, a.x = Math.round(a.x), a.y = Math.round(a.y), f = d; } !m || 0 !== _ && !w || M(p, a) || p.push(a), qx(this.layoutVertexArray, a.x, a.y, 0, 0, 1, 1, 0), s.vertexLength++, this.footprintVertices.emplaceBack(e.x, e.y), i.push(e.x, e.y), h && Yx(this.layoutVertexExtArray, c.projectTilePoint(a.x, a.y, n), c.upVector(n, a.x, a.y)); } m && (0 === _ || w) && (0 !== p.length && M(p, p[0]) && p.pop(), this.groundEffect.addData(p, e, l)); } const u = Lf(i, a); for (let t = 0; t < u.length; t += 3)this.footprintIndices.emplaceBack(o.vertexOffset + u[t + 0], o.vertexOffset + u[t + 1], o.vertexOffset + u[t + 2]), this.indexArray.emplaceBack(r + u[t], r + u[t + 2], r + u[t + 1]), s.primitiveLength++; o.indexCount += u.length, o.vertexCount += this.footprintVertices.length - o.vertexOffset; } for (let i = 0; i < t.length; i++) { const a = t[i]; f.startRing(d, a[0]); let o = a.length > 4 && av(a[a.length - 2], a[0], a[1]), u = _ ? rv(a[a.length - 2], a[0], a[1], _) : 0; const y = []; let g, x, v; x = a[1].sub(a[0])._perp()._unit(); let b = !0; for (let t = 1, i = 0; t < a.length; t++) { let l = a[t - 1], p = a[t]; const w = a[t === a.length - 1 ? 1 : t + 1]; if (f.appendEdge(d, p, l), iv(p, l, e)) { _ && (x = w.sub(p)._perp()._unit(), b = !b); continue } const A = p.sub(l)._perp(), S = A.x / (Math.abs(A.x) + Math.abs(A.y)), I = A.y > 0 ? 1 : 0, k = l.dist(p); if (i + k > 32768 && (i = 0), _) { v = w.sub(p)._perp()._unit(); let t = nv(l, p, w, ev(x, v), _); isNaN(t) && (t = 0); const e = p.sub(l)._unit(); l = l.add(e.mult(u))._round(), p = p.add(e.mult(-t))._round(), u = t, x = v, m && this.zoom >= 17 && (M(y, l) || y.push(l), M(y, p) || y.push(p)); } const T = s.vertexLength, P = a.length > 4 && av(l, p, w); let z = ov(i, o, b); if (qx(this.layoutVertexArray, l.x, l.y, S, I, 0, 0, z), qx(this.layoutVertexArray, l.x, l.y, S, I, 0, 1, z), i += k, z = ov(i, P, !b), o = P, qx(this.layoutVertexArray, p.x, p.y, S, I, 0, 0, z), qx(this.layoutVertexArray, p.x, p.y, S, I, 0, 1, z), s.vertexLength += 4, this.indexArray.emplaceBack(T + 0, T + 1, T + 2), this.indexArray.emplaceBack(T + 1, T + 3, T + 2), s.primitiveLength += 2, _) { const n = r + (1 === t ? a.length - 2 : t - 2), i = 1 === t ? r : n + 1; if (this.indexArray.emplaceBack(T + 1, n, T + 3), this.indexArray.emplaceBack(n, i, T + 3), s.primitiveLength += 2, void 0 === g && (g = T), !iv(w, a[t], e)) { const e = t === a.length - 1 ? g : s.vertexLength; this.indexArray.emplaceBack(T + 2, T + 3, e), this.indexArray.emplaceBack(T + 3, e + 1, e), this.indexArray.emplaceBack(T + 3, i, e + 1), s.primitiveLength += 3; } b = !b; } if (h) { const t = this.layoutVertexExtArray, e = c.projectTilePoint(l.x, l.y, n), r = c.projectTilePoint(p.x, p.y, n), i = c.upVector(n, l.x, l.y), s = c.upVector(n, p.x, p.y); Yx(t, e, i), Yx(t, e, i), Yx(t, r, s), Yx(t, r, s); } } p && (r += a.length - 1), m && _ && this.zoom >= 17 && (0 !== y.length && M(y, y[0]) && y.pop(), this.groundEffect.addData(y, e, l, _ > 0)); } this.footprintSegments.push(o), a.triangleCount = this.indexArray.length - a.triangleArrayOffset, this.polygonSegments.push(a), ++d.footprintSegLen, ++d.polygonSegLen; } if (d.vertexCount = this.layoutVertexArray.length - d.vertexArrayOffset, d.groundVertexCount = this.groundEffect.vertexArray.length - d.groundVertexArrayOffset, 0 !== d.vertexCount) { if (d.centroidXY = f.borders ? Nx : this.encodeCentroid(f, d), this.centroidData.push(d), f.borders) { this.featuresOnBorder.push(f); const t = this.featuresOnBorder.length - 1; for (let e = 0; e < f.borders.length; e++)f.borders[e][0] !== Number.MAX_VALUE && this.borderFeatureIndices[e].push(t); } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, i, s, n, o), this.groundEffect.addPaintPropertiesData(t, r, i, s, n, o), this.maxHeight = Math.max(this.maxHeight, y); } } sortBorders() { for (let t = 0; t < this.borderFeatureIndices.length; t++)this.borderFeatureIndices[t].sort(((e, r) => this.featuresOnBorder[e].borders[t][0] - this.featuresOnBorder[r].borders[t][0])); } splitToSubtiles() { const t = []; for (let e = 0; e < this.centroidData.length; e++) { const r = this.centroidData[e], n = +(r.min.y + r.max.y > Cr), i = 2 * n + (+(r.min.x + r.max.x > Cr) ^ n); for (let n = 0; n < r.polygonSegLen; n++) { const s = r.polygonSegIdx + n; t.push({ centroidIdx: e, subtile: i, polygonSegmentIdx: s, triangleSegmentIdx: this.polygonSegments[s].triangleSegIdx }); } } const e = new ao; t.sort(((t, e) => t.triangleSegmentIdx === e.triangleSegmentIdx ? t.subtile - e.subtile : t.triangleSegmentIdx - e.triangleSegmentIdx)); let r = 0, n = 0, i = 0; for (const e of t) { if (e.triangleSegmentIdx !== r) break; i++; } const s = t.length; for (; n !== t.length;) { r = t[n].triangleSegmentIdx; let a = 0, o = n, l = n; for (let e = o; e < i && t[e].subtile === a; e++)l++; for (; o !== i;) { const n = t[o]; a = n.subtile; const s = this.centroidData[n.centroidIdx].min.clone(), u = this.centroidData[n.centroidIdx].max.clone(), c = { vertexOffset: this.segments.segments[r].vertexOffset, primitiveOffset: e.length, vertexLength: this.segments.segments[r].vertexLength, primitiveLength: 0, sortKey: void 0, vaos: {} }; for (let r = o; r < l; r++) { const n = t[r], i = this.polygonSegments[n.polygonSegmentIdx], a = this.centroidData[n.centroidIdx].min, o = this.centroidData[n.centroidIdx].max, l = this.indexArray.uint16; for (let t = i.triangleArrayOffset; t < i.triangleArrayOffset + i.triangleCount; t++)e.emplaceBack(l[3 * t], l[3 * t + 1], l[3 * t + 2]); c.primitiveLength += i.triangleCount, s.x = Math.min(s.x, a.x), s.y = Math.min(s.y, a.y), u.x = Math.max(u.x, o.x), u.y = Math.max(u.y, o.y); } c.primitiveLength > 0 && this.triangleSubSegments.push({ segment: c, min: s, max: u }), o = l; for (let e = o; e < i && t[e].subtile === t[o].subtile; e++)l++; } n = i; for (let e = n; e < s && t[e].triangleSegmentIdx === t[n].triangleSegmentIdx; e++)i++; } e._trim(), this.indexArray = e; } getVisibleSegments(t, e, r) { let n = 0, i = 0; const s = 1 << t.canonical.z; if (e) { const r = e.getMinMaxForTile(t); r && (n = r.min, i = r.max); } i += this.maxHeight; const a = t.toUnwrapped(); let o; const l = [a.canonical.x / s + a.wrap, a.canonical.y / s], u = [(a.canonical.x + 1) / s + a.wrap, (a.canonical.y + 1) / s], c = new Do, h = (t, e, r) => [t[0] * (1 - r[0]) + e[0] * r[0], t[1] * (1 - r[1]) + e[1] * r[1]], p = [], f = []; for (const t of this.triangleSubSegments) { p[0] = t.min.x / Cr, p[1] = t.min.y / Cr, f[0] = t.max.x / Cr, f[1] = t.max.y / Cr; const e = h(l, u, p), s = h(l, u, f); if (0 === new oh([e[0], e[1], n], [s[0], s[1], i]).intersectsPrecise(r)) { o && (c.segments.push(o), o = void 0); continue } const a = t.segment; o && o.vertexOffset !== a.vertexOffset && (c.segments.push(o), o = void 0), o ? (o.vertexLength += a.vertexLength, o.primitiveLength += a.primitiveLength) : o = { vertexOffset: a.vertexOffset, primitiveLength: a.primitiveLength, vertexLength: a.vertexLength, primitiveOffset: a.primitiveOffset, sortKey: void 0, vaos: {} }; } return o && c.segments.push(o), c } encodeCentroid(t, e) { const r = t.centroid(), n = e.span(), i = Math.min(7, Math.round(n.x * this.tileToMeter / 10)), s = Math.min(7, Math.round(n.y * this.tileToMeter / 10)); return new x(k(r.x, 1, Cr - 1) << 3 | i, k(r.y, 1, Cr - 1) << 3 | s) } encodeBorderCentroid(t) { if (!t.borders) return new x(0, 0); const e = t.borders, r = Number.MAX_VALUE; if (e[0][0] !== r || e[1][0] !== r) { const t = e[0][0] !== r ? 0 : 1; return new x(6 | (e[0][0] !== r ? 0 : 65528), ((e[t][0] + e[t][1]) / 2 | 0) << 3 | 6) } { const t = e[2][0] !== r ? 2 : 3; return new x(((e[t][0] + e[t][1]) / 2 | 0) << 3 | 6, 6 | (e[2][0] !== r ? 0 : 65528)) } } showCentroid(t) { const e = this.centroidData[t.centroidDataIndex]; e.flags &= $x, e.centroidXY.x = 0, e.centroidXY.y = 0, this.writeCentroidToBuffer(e); } writeCentroidToBuffer(t) { this.groundEffect.updateHiddenByLandmark(t); const e = t.vertexArrayOffset, r = t.vertexCount + t.vertexArrayOffset, n = t.flags & $x ? Nx : t.centroidXY, i = this.centroidVertexArray.geta_centroid_pos0(e); if (this.centroidVertexArray.geta_centroid_pos1(e) !== n.y || i !== n.x) { for (let t = e; t < r; ++t)this.centroidVertexArray.emplace(t, n.x, n.y); this.needsCentroidUpdate = !0; } } createCentroidsBuffer() { this.centroidVertexArray.resize(this.layoutVertexArray.length), this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); for (const t of this.centroidData) this.writeCentroidToBuffer(t); } updateReplacement(t, e) { if (e.updateTime === this.replacementUpdateTime) return; this.replacementUpdateTime = e.updateTime; const r = e.getReplacementRegionsForTile(t.toUnwrapped()); if (function (t, e) { if (t.length !== e.length) return !1; for (let r = 0; r < t.length; r++)if (t[r].sourceId !== e[r].sourceId || !Ex(t[r], e[r])) return !1; return !0 }(this.activeReplacements, r)) return; if (this.activeReplacements = r, 0 === this.centroidVertexArray.length) this.createCentroidsBuffer(); else for (const t of this.centroidData) t.flags &= 2147483647; const n = []; for (const e of this.activeReplacements) { const r = Math.pow(2, e.footprintTileId.canonical.z - t.canonical.z); for (const i of this.centroidData) if (!(i.flags & $x || e.min.x > i.max.x || i.min.x > e.max.x || e.min.y > i.max.y || i.min.y > e.max.y)) for (let s = 0; s < i.footprintSegLen; s++) { const a = this.footprintSegments[i.footprintSegIdx + s]; if (n.length = 0, cv(this.footprintVertices, a.vertexOffset, a.vertexCount, e.footprintTileId.canonical, t.canonical, n), Rx(e.footprint, n, this.footprintIndices.uint16, a.indexOffset, a.indexCount, -a.vertexOffset, -r)) { i.flags |= $x; break } } } for (const t of this.centroidData) this.writeCentroidToBuffer(t); this.borderDoneWithNeighborZ = [-1, -1, -1, -1]; } footprintContainsPoint(t, e, r) { let n = !1; for (let i = 0; i < r.footprintSegLen; i++) { const s = this.footprintSegments[r.footprintSegIdx + i]; let a = 0; for (const r of s.ringIndices) { for (let i = a, o = r + a - 1; i < r + a; o = i++) { const r = this.footprintVertices.int16[2 * (i + s.vertexOffset) + 0], a = this.footprintVertices.int16[2 * (i + s.vertexOffset) + 1], l = this.footprintVertices.int16[2 * (o + s.vertexOffset) + 1]; a > e != l > e && t < (this.footprintVertices.int16[2 * (o + s.vertexOffset) + 0] - r) * (e - a) / (l - a) + r && (n = !n); } a = r; } } return n } getHeightAtTileCoord(t, e) { let r = Number.NEGATIVE_INFINITY, n = !0; const i = 4 * (t + Cr) * Cr + (e + Cr); if (this.partLookup.hasOwnProperty(i)) { const t = this.partLookup[i]; return t ? { height: t.height, hidden: !!(t.flags & $x) } : void 0 } for (const s of this.centroidData) t > s.max.x || s.min.x > t || e > s.max.y || s.min.y > e || this.footprintContainsPoint(t, e, s) && s && s.height > r && (r = s.height, this.partLookup[i] = s, n = !!(s.flags & $x)); if (r !== Number.NEGATIVE_INFINITY) return { height: r, hidden: n }; this.partLookup[i] = void 0; } } function ev(t, e) { const r = t.add(e)._unit(); return t.x * r.x + t.y * r.y } function rv(t, e, r, n) { const i = e.sub(t)._perp()._unit(), s = r.sub(e)._perp()._unit(); return nv(t, e, r, ev(i, s), n) } function nv(t, e, r, n, i) { const s = Math.sqrt(1 - n * n); return Math.min(t.dist(e) / 3, e.dist(r) / 3, i * s / n) } function iv(t, e, r) { return t.x < r[0].x && e.x < r[0].x || t.x > r[1].x && e.x > r[1].x || t.y < r[0].y && e.y < r[0].y || t.y > r[1].y && e.y > r[1].y } function sv(t, e) { return t.x < e[0].x || t.x > e[1].x || t.y < e[0].y || t.y > e[1].y } function av(t, e, r) { if (t.x < 0 || t.x >= Cr || e.x < 0 || e.x >= Cr || r.x < 0 || r.x >= Cr) return !1; const n = r.sub(e), i = n.perp(), s = t.sub(e); return (n.x * s.x + n.y * s.y) / Math.sqrt((n.x * n.x + n.y * n.y) * (s.x * s.x + s.y * s.y)) > -.866 && i.x * s.x + i.y * s.y < 0 } function ov(t, e, r) { const n = e ? 2 | t : -3 & t; return r ? 1 | n : -2 & n } function lv() { const t = Math.PI / 32, e = Math.tan(t), r = qh; return r * Math.sqrt(1 + 2 * e * e) - r } function uv(t, e, r) { const n = 1 << r.z, i = tp(r.x / n), s = tp((r.x + 1) / n), a = ep(r.y / n), o = ep((r.y + 1) / n); return function (t, e, r, n, i = 0, s) { const a = []; if (!t.length || !r || !n) return a; const o = (t, e) => { for (const r of t) a.push({ polygon: r, bounds: e }); }, l = Math.ceil(Math.log2(r)), u = Math.ceil(Math.log2(n)), c = l - u, h = []; for (let t = 0; t < Math.abs(c); t++)h.push(c > 0 ? 0 : 1); for (let t = 0; t < Math.min(l, u); t++)h.push(0), h.push(1); let p = t; if (p = cd(p, e[0].y - i, e[1].y + i, 1), p = cd(p, e[0].x - i, e[1].x + i, 0), !p.length) return a; const f = []; for (h.length ? f.push({ polygons: p, bounds: e, depth: 0 }) : o(p, e); f.length;) { const t = f.pop(), e = t.depth, r = h[e], n = t.bounds[0], a = t.bounds[1], l = 0 === r ? n.x : n.y, u = 0 === r ? a.x : a.y, c = s ? s(r, l, u) : .5 * (l + u), p = cd(t.polygons, l - i, c + i, r), d = cd(t.polygons, c - i, u + i, r); if (p.length) { const t = [n, new x(0 === r ? c : a.x, 1 === r ? c : a.y)]; h.length > e + 1 ? f.push({ polygons: p, bounds: t, depth: e + 1 }) : o(p, t); } if (d.length) { const t = [new x(0 === r ? c : n.x, 1 === r ? c : n.y), a]; h.length > e + 1 ? f.push({ polygons: d, bounds: t, depth: e + 1 }) : o(d, t); } } return a }(t, e, Math.ceil((s - i) / 11.25), Math.ceil((a - o) / 11.25), 1, ((t, e, i) => { if (0 === t) return .5 * (e + i); { const t = ep((r.y + e / Cr) / n); return (Jh(.5 * (ep((r.y + i / Cr) / n) + t)) * n - r.y) * Cr } })) } function cv(t, e, r, n, i, s) { const a = Math.pow(2, n.z - i.z); for (let o = 0; o < r; o++) { let r = t.int16[2 * (o + e) + 0], l = t.int16[2 * (o + e) + 1]; r = (r + i.x * Cr) * a - n.x * Cr, l = (l + i.y * Cr) * a - n.y * Cr, s.push(new x(r, l)); } } Ks(tv, "FillExtrusionBucket", { omit: ["layers", "features"] }), Ks(Xx, "PartData"), Ks(Zx, "FootprintSegment"), Ks(Kx, "BorderCentroidData"), Ks(Qx, "GroundEffect"); const hv = new Da({ visibility: new za(re["layout_fill-extrusion"].visibility), "fill-extrusion-edge-radius": new za(re["layout_fill-extrusion"]["fill-extrusion-edge-radius"]) }); var pv = { paint: new Da({ "fill-extrusion-opacity": new za(re["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new Ea(re["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new za(re["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new za(re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Ea(re["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new Ea(re["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new Ea(re["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new za(re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]), "fill-extrusion-ambient-occlusion-intensity": new za(re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]), "fill-extrusion-ambient-occlusion-radius": new za(re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]), "fill-extrusion-ambient-occlusion-wall-radius": new za(re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]), "fill-extrusion-ambient-occlusion-ground-radius": new za(re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]), "fill-extrusion-ambient-occlusion-ground-attenuation": new za(re["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]), "fill-extrusion-flood-light-color": new za(re["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]), "fill-extrusion-flood-light-intensity": new za(re["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]), "fill-extrusion-flood-light-wall-radius": new Ea(re["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]), "fill-extrusion-flood-light-ground-radius": new Ea(re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]), "fill-extrusion-flood-light-ground-attenuation": new za(re["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]), "fill-extrusion-vertical-scale": new za(re["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]), "fill-extrusion-rounded-roof": new za(re["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]), "fill-extrusion-cutoff-fade-range": new za(re["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]), "fill-extrusion-emissive-strength": new za(re["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]) }), layout: hv }; class fv extends x { constructor(t, e, r) { super(t, e), this.z = r; } } function dv(t, e) { return t.x * e.x + t.y * e.y } function mv(t, e) { if (1 === t.length) { let r = 0; const n = e[r++]; let i; for (; !i || n.equals(i);)if (i = e[r++], !i) return 1 / 0; for (; r < e.length; r++) { const s = e[r], a = t[0], o = i.sub(n), l = s.sub(n), u = a.sub(n), c = dv(o, o), h = dv(o, l), p = dv(l, l), f = dv(u, o), d = dv(u, l), m = c * p - h * h, y = (p * f - h * d) / m, g = (c * d - h * f) / m, x = n.z * (1 - y - g) + i.z * y + s.z * g; if (isFinite(x)) return x } return 1 / 0 } { let t = 1 / 0; for (const r of e) t = Math.min(t, r.z); return t } } function yv(t, e, r, n, i, s, a, o) { const l = a * i.getElevationAt(t, e, !0, !0), u = 0 !== s[0], c = u ? 0 === s[1] ? a * (s[0] / 7 - 450) : a * function (t, e, r) { const n = Math.floor(e[0] / 8), i = Math.floor(e[1] / 8), s = 10 * (e[0] - 8 * n), a = 10 * (e[1] - 8 * i), o = t.getElevationAt(n, i, !0, !0), l = t.getMeterToDEM(r), u = Math.floor(.5 * (s * l - 1)), c = Math.floor(.5 * (a * l - 1)), h = t.tileCoordToPixel(n, i), p = 2 * u + 1, f = 2 * c + 1, d = function (t, e, r, n, i) { return [t.getElevationAtPixel(e, r, !0), t.getElevationAtPixel(e + i, r, !0), t.getElevationAtPixel(e, r + i, !0), t.getElevationAtPixel(e + n, r + i, !0)] }(t, h.x - u, h.y - c, p, f), m = Math.abs(d[0] - d[1]), y = Math.abs(d[2] - d[3]), g = Math.abs(d[0] - d[2]) + Math.abs(d[1] - d[3]), x = Math.min(.25, .5 * l * (m + y) / p), v = Math.min(.25, .5 * l * g / f); return o + Math.max(x * s, v * a) }(i, s, o) : l; return { base: l + (0 === r) ? -1 : r, top: u ? Math.max(c + n, l + r + 2) : l + n } } const gv = new Da({ "line-cap": new Ea(re.layout_line["line-cap"]), "line-join": new Ea(re.layout_line["line-join"]), "line-miter-limit": new za(re.layout_line["line-miter-limit"]), "line-round-limit": new za(re.layout_line["line-round-limit"]), "line-sort-key": new Ea(re.layout_line["line-sort-key"]), visibility: new za(re.layout_line.visibility) }); var xv = { paint: new Da({ "line-opacity": new Ea(re.paint_line["line-opacity"]), "line-color": new Ea(re.paint_line["line-color"]), "line-translate": new za(re.paint_line["line-translate"]), "line-translate-anchor": new za(re.paint_line["line-translate-anchor"]), "line-width": new Ea(re.paint_line["line-width"]), "line-gap-width": new Ea(re.paint_line["line-gap-width"]), "line-offset": new Ea(re.paint_line["line-offset"]), "line-blur"
36: new Ea(re.paint_line["line-blur"]), "line-dasharray": new Ea(re.paint_line["line-dasharray"]), "line-pattern": new Ea(re.paint_line["line-pattern"]), "line-gradient": new Ba(re.paint_line["line-gradient"]), "line-trim-offset": new za(re.paint_line["line-trim-offset"]), "line-emissive-strength": new za(re.paint_line["line-emissive-strength"]), "line-border-width": new Ea(re.paint_line["line-border-width"]), "line-border-color": new Ea(re.paint_line["line-border-color"]) }), layout: gv }; function vv(t, e) { return 1 / sx(t, 1, e.tileZoom) } function bv(t, e, r, n) { return t.translatePosMatrix(n || e.tileID.projMatrix, e, r.paint.get("line-translate"), r.paint.get("line-translate-anchor")) } const _v = t => { const e = []; wv(t) && e.push("RENDER_LINE_DASH"), t.paint.get("line-gradient") && e.push("RENDER_LINE_GRADIENT"); const r = t.paint.get("line-trim-offset"); return 0 === r[0] && 0 === r[1] || e.push("RENDER_LINE_TRIM_OFFSET"), 0 !== t.paint.get("line-border-width").constantOr(1) && e.push("RENDER_LINE_BORDER"), e }; function wv(t) { const e = t.paint.get("line-dasharray").value; return e.value || "constant" !== e.kind } const Mv = new class extends Ea { possiblyEvaluate(t, e) { return e = new _a(Math.floor(e.zoom), { now: e.now, fadeDuration: e.fadeDuration, transition: e.transition }), super.possiblyEvaluate(t, e) } evaluate(t, e, r, n) { return e = B({}, e, { zoom: Math.floor(e.zoom) }), super.evaluate(t, e, r, n) } }(xv.paint.properties["line-width"].specification); function Av(t, e) { return e > 0 ? e + 2 * t : t } Mv.useIntegerZoom = !0; const Sv = new Da({ visibility: new za(re.layout_background.visibility) }); var Iv = { paint: new Da({ "background-color": new za(re.paint_background["background-color"]), "background-pattern": new za(re.paint_background["background-pattern"]), "background-opacity": new za(re.paint_background["background-opacity"]), "background-emissive-strength": new za(re.paint_background["background-emissive-strength"]) }), layout: Sv }; const kv = new Da({ visibility: new za(re.layout_raster.visibility) }); var Tv = { paint: new Da({ "raster-opacity": new za(re.paint_raster["raster-opacity"]), "raster-color": new Ba(re.paint_raster["raster-color"]), "raster-color-mix": new za(re.paint_raster["raster-color-mix"]), "raster-color-range": new za(re.paint_raster["raster-color-range"]), "raster-hue-rotate": new za(re.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new za(re.paint_raster["raster-brightness-min"]), "raster-brightness-max": new za(re.paint_raster["raster-brightness-max"]), "raster-saturation": new za(re.paint_raster["raster-saturation"]), "raster-contrast": new za(re.paint_raster["raster-contrast"]), "raster-resampling": new za(re.paint_raster["raster-resampling"]), "raster-fade-duration": new za(re.paint_raster["raster-fade-duration"]), "raster-emissive-strength": new za(re.paint_raster["raster-emissive-strength"]), "raster-array-band": new za(re.paint_raster["raster-array-band"]), "raster-elevation": new za(re.paint_raster["raster-elevation"]) }), layout: kv }; function Pv(e, r, n, i, s, a, o, l) { const u = [e, r, 1, n, i, 1, s, a, 1], c = [o, l, 1], h = t.bx.adjoint([], u), [p, f, d] = t.v.transformMat3(c, c, h); return t.bx.multiply(u, u, [p, 0, 0, 0, f, 0, 0, 0, d]) } function zv(e, r, n, i, s, a, o, l) { const u = function (e, r, n, i, s, a, o, l) { const u = Pv(0, 0, 1, 0, 1, 1, 0, 1), c = Pv(e, r, n, i, s, a, o, l), h = t.bx.adjoint([], u); return t.bx.multiply(c, c, h) }(e, r, n, i, s, a, o, l); return [u[2] / u[8] / Cr, u[5] / u[8] / Cr] } function Ev(t) { return [t[0], Math.min(Math.max(t[1], -np), np)] } class Bv extends ee { constructor(t, e, r, n) { super(), this.id = t, this.dispatcher = r, this.coordinates = e.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = !1, this.onNorthPole = !1, this.onSouthPole = !1, this.setEventedParent(n), this.options = e, this._dirty = !1; } load(t, e) { if (this._loaded = e || !1, this.fire(new Qt("dataloading", { dataType: "source" })), this.url = this.options.url, !this.url) return t && (this.coordinates = t), this._loaded = !0, void this._finishLoading(); this._imageRequest = vt(this.map._requestManager.transformRequest(this.url, ct.Image), ((e, r) => { this._imageRequest = null, this._loaded = !0, e ? this.fire(new te(e)) : r && (this.image = r instanceof HTMLImageElement ? Wt.getImageData(r) : r, this._dirty = !0, this.width = this.image.width, this.height = this.image.height, t && (this.coordinates = t), this._finishLoading()); })); } loaded() { return this._loaded } updateImage(t) { return t.url ? (this._imageRequest && t.url !== this.options.url && (this._imageRequest.cancel(), this._imageRequest = null), this.options.url = t.url, this.load(t.coordinates, this._loaded), this) : this } setTexture(t) { if (!(t.handle instanceof WebGLTexture)) throw new Error("The provided handle is not a WebGLTexture instance"); return this.texture = new wg(this.map.painter.context, t.handle), this.width = t.dimensions[0], this.height = t.dimensions[1], this._dirty = !1, this._loaded = !0, this._finishLoading(), this } _finishLoading() { this.map && (this.setCoordinates(this.coordinates), this.fire(new Qt("data", { dataType: "source", sourceDataType: "metadata" }))); } onAdd(t) { this.map = t, this.load(); } onRemove() { this._imageRequest && (this._imageRequest.cancel(), this._imageRequest = null), !this.texture || this.texture instanceof wg || this.texture.destroy(), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()); } setCoordinates(t) { if (this.coordinates = t, this._boundsArray = void 0, this._unsupportedCoords = !1, !t.length) return this; this.onNorthPole = !1, this.onSouthPole = !1; let e = t[0][1], r = t[0][1]; for (const n of t) n[1] > r && (r = n[1]), n[1] < e && (e = n[1]); const n = (r + e) / 2; if (n > np ? this.onNorthPole = !0 : n < -np && (this.onSouthPole = !0), !this.onNorthPole && !this.onSouthPole) { const e = t.map(lp.fromLngLat); this.tileID = function (t) { let e = 1 / 0, r = 1 / 0, n = -1 / 0, i = -1 / 0; for (const s of t) e = Math.min(e, s.x), r = Math.min(r, s.y), n = Math.max(n, s.x), i = Math.max(i, s.y); const s = Math.max(n - e, i - r), a = Math.max(0, Math.floor(-Math.log(s) / Math.LN2)), o = Math.pow(2, a); let l = Math.floor((e + n) / 2 * o); return l > 1 && (l -= 1), new Kc(a, l, Math.floor((r + i) / 2 * o)) }(e), this.minzoom = this.maxzoom = this.tileID.z; } return this.fire(new Qt("data", { dataType: "source", sourceDataType: "content" })), this } _clear() { this._boundsArray = void 0, this._unsupportedCoords = !1; } _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 || this.onNorthPole || this.onSouthPole || this._unsupportedCoords) return; const r = zy(new Kc(0, 0, 0), this.map.transform.projection), n = [r.projection.project(this.coordinates[0][0], this.coordinates[0][1]), r.projection.project(this.coordinates[1][0], this.coordinates[1][1]), r.projection.project(this.coordinates[2][0], this.coordinates[2][1]), r.projection.project(this.coordinates[3][0], this.coordinates[3][1])]; if (!function (t) { const e = t[1].x - t[0].x, r = t[1].y - t[0].y, n = t[2].x - t[1].x, i = t[2].y - t[1].y, s = t[3].x - t[2].x, a = t[3].y - t[2].y, o = t[0].x - t[3].x, l = t[0].y - t[3].y, u = e * i - n * r, c = n * a - s * i, h = s * l - o * a, p = o * r - e * l; return u > 0 && c > 0 && h > 0 && p > 0 || u < 0 && c < 0 && h < 0 && p < 0 }(n)) return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"), void (this._unsupportedCoords = !0); const i = zy(this.tileID, this.map.transform.projection), [s, a, o, l] = this.coordinates.map((t => { const e = i.projection.project(t[0], t[1]);
36 return Ey(i, e)._round() })); this.perspectiveTransform = zv(s.x, s.y, a.x, a.y, o.x, o.y, l.x, l.y); const u = this._boundsArray = new Ga; u.emplaceBack(s.x, s.y, 0, 0), u.emplaceBack(a.x, a.y, Cr, 0), u.emplaceBack(l.x, l.y, 0, Cr), u.emplaceBack(o.x, o.y, Cr, Cr), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()), this.boundsBuffer = e.createVertexBuffer(u, zg.members), this.boundsSegments = Do.simpleSegment(0, 0, 4, 2); const c = [], h = function (t) { return [Ev(t[0]), Ev(t[1]), Ev(t[2]), Ev(t[3])] }(this.coordinates), [p, f, d, m] = function (t) { let e = t[0][0], r = e, n = t[0][1], i = n; for (let s = 1; s < t.length; s++)t[s][0] < e ? e = t[s][0] : t[s][0] > r && (r = t[s][0]), t[s][1] < n ? n = t[s][1] : t[s][1] > i && (i = t[s][1]); return [e, n, r - e, i - n] }(h); { const i = new Ga, [s, a, o, l] = function (t) { let e = t[0].x, r = e, n = t[0].y, i = n; for (let s = 1; s < t.length; s++)t[s].x < e ? e = t[s].x : t[s].x > r && (r = t[s].x), t[s].y < n ? n = t[s].y : t[s].y > i && (i = t[s].y); return [e, n, r - e, i - n] }(n), u = t => [(t.x - s) / o, (t.y - a) / l], [h, y, g, x] = n.map(u), v = function (e, r, n, i, s, a, o, l) { const u = Pv(0, 0, 1, 0, 1, 1, 0, 1), c = Pv(e, r, n, i, s, a, o, l), h = t.bx.adjoint([], c); return t.bx.multiply(u, u, h) }(h[0], h[1], y[0], y[1], g[0], g[1], x[0], x[1]); this.elevatedGlobePerspectiveTransform = zv(h[0], h[1], y[0], y[1], g[0], g[1], x[0], x[1]); const b = (e, r) => { c.push(e.lng); const n = Math.round((e.lng - p) / d * Cr), s = Math.round((e.lat - f) / m * Cr), a = u(r), o = t.v.transformMat3([], [a[0], a[1], 1], v), l = Math.round(o[0] / o[2] * Cr), h = Math.round(o[1] / o[2] * Cr); i.emplaceBack(n, s, l, h); }, _ = n[3].x - n[0].x, w = n[3].y - n[0].y, M = n[2].x - n[1].x, A = n[2].y - n[1].y; for (let t = 0; t < 65; t++) { const e = t / 64, i = [n[0].x + e * _, n[0].y + e * w], s = [n[1].x + e * M, n[1].y + e * A], a = s[0] - i[0], o = s[1] - i[1]; for (let t = 0; t < 65; t++) { const e = t / 64, n = { x: i[0] + a * e, y: i[1] + o * e, z: 0 }; b(r.projection.unproject(n.x, n.y), n); } } this.elevatedGlobeVertexBuffer = e.createVertexBuffer(i, zg.members); } { this.maxLongitudeTriangleSize = 0; let t = [], r = new ao; const n = (e, n, i) => { r.emplaceBack(e, n, i); const s = c[e], a = c[n], o = c[i], l = Math.min(Math.min(s, a), o), u = Math.max(Math.max(s, a), o) - l; u > this.maxLongitudeTriangleSize && (this.maxLongitudeTriangleSize = u), t.push(l + u / 2); }; for (let t = 0; t < 64; t++)for (let e = 0; e < 64; e++) { const r = 65 * t + e, i = r + 1, s = r + 65, a = s + 1; n(r, s, i), n(i, s, a); } [t, r] = function (t, e) { const r = Array.from({ length: t.length }, ((t, e) => e)); r.sort(((e, r) => t[e] - t[r])); const n = [], i = new ao; for (let s = 0; s < r.length; s++) { const a = r[s]; n.push(t[a]); const o = 3 * a, l = o + 1; i.emplaceBack(e.uint16[o], e.uint16[l], e.uint16[l + 1]); } return [n, i] }(t, r), this.elevatedGlobeTrianglesCenterLongitudes = t, this.elevatedGlobeIndexBuffer = e.createIndexBuffer(r); } this.elevatedGlobeSegments = Do.simpleSegment(0, 0, 4225, 8192), this.elevatedGlobeGridMatrix = new Float32Array([0, d / Cr, 0, m / Cr, 0, 0, f, p, 0]); } prepare() { const t = 0 !== Object.keys(this.tiles).length; if (this.tileID && !t) return; const e = this.map.painter.context, r = e.gl; !this._dirty || this.texture instanceof wg || (this.texture ? this.texture.update(this.image) : (this.texture = new _g(e, this.image, r.RGBA), this.texture.bind(r.LINEAR, r.CLAMP_TO_EDGE)), this._dirty = !1), t && 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 } getSegmentsForLongitude(t) { const e = this.elevatedGlobeSegments; if (!this.elevatedGlobeTrianglesCenterLongitudes || !e) return null; const r = this.elevatedGlobeTrianglesCenterLongitudes; let n = ((t, e) => t + 360 * Math.round((e - t) / 360))(t + 180, r[0]); const i = new Do, s = (t, r) => { i.segments.push({ vertexOffset: 0, primitiveOffset: t, vertexLength: e.segments[0].vertexLength, primitiveLength: r, sortKey: void 0, vaos: {} }); }, a = .51 * this.maxLongitudeTriangleSize; if (Math.abs(r[0] - n) <= a) { const t = tt(r, 0, r.length, n + a); return t === r.length || s(t, Q(r, t + 1, r.length, n + 360 - a) - t), i } n < r[0] && (n += 360); const o = Q(r, 0, r.length, n - a); if (o === r.length) return s(0, r.length), i; s(0, o - 0); const l = tt(r, o + 1, r.length, n + a); return l !== r.length && s(l, r.length - l), i } } class Dv extends Va { constructor(t, e) { super(t, {}, e), this.implementation = t, t.slot && (this.slot = t.slot); } is3D() { return "3d" === this.implementation.renderingMode } hasOffscreenPass() { return void 0 !== this.implementation.prerender } isLayerDraped(t) { return void 0 !== this.implementation.renderToTile } shouldRedrape() { return !!this.implementation.shouldRerenderTiles && this.implementation.shouldRerenderTiles() } 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); } } const Cv = new Da({ visibility: new za(re.layout_sky.visibility) }); var Rv = { paint: new Da({ "sky-type": new za(re.paint_sky["sky-type"]), "sky-atmosphere-sun": new za(re.paint_sky["sky-atmosphere-sun"]), "sky-atmosphere-sun-intensity": new za(re.paint_sky["sky-atmosphere-sun-intensity"]), "sky-gradient-center": new za(re.paint_sky["sky-gradient-center"]), "sky-gradient-radius": new za(re.paint_sky["sky-gradient-radius"]), "sky-gradient": new Ba(re.paint_sky["sky-gradient"]), "sky-atmosphere-halo-color": new za(re.paint_sky["sky-atmosphere-halo-color"]), "sky-atmosphere-color": new za(re.paint_sky["sky-atmosphere-color"]), "sky-opacity": new za(re.paint_sky["sky-opacity"]) }), layout: Cv }; function Lv(e, r, n) { const i = [0, 0, 1], s = t.q.identity([]); return t.q.rotateY(s, s, n ? -_(e) + Math.PI : _(e)), t.q.rotateX(s, s, -_(r)), t.v.transformQuat(i, i, s), t.v.normalize(i, i) } var Vv = { paint: new Da({}) }; const Ov = { circle: class extends Va { constructor(t, e, r) { super(t, jp, e, r); } createBucket(t) { return new bp(t) } queryRadius(t) { const e = t; return Rp("circle-radius", this, e) + Rp("circle-stroke-width", this, e) + Lp(this.paint.get("circle-translate")) } queryIntersectsFeature(t, e, r, n, i, s, a, o) { const l = Op(this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), s.angle, t.pixelToTileUnitsFactor), u = this.paint.get("circle-radius").evaluate(e, r) + this.paint.get("circle-stroke-width").evaluate(e, r); return $p(t, n, s, a, o, "map" === this.paint.get("circle-pitch-alignment"), "map" === this.paint.get("circle-pitch-scale"), l, u) } getProgramIds() { return ["circle"] } getDefaultProgramParams(t, e) { const r = Np(this); return { config: new pl(this, e), defines: r, overrideFog: !1 } } }, heatmap: class extends Va { createBucket(t) { return new Xp(t) } constructor(t, e, r) { super(t, rf, e, r), this._updateColorRamp(); } _handleSpecialPaintPropertyUpdate(t) { "heatmap-color" === t && this._updateColorRamp(); } _updateColorRamp() { this.colorRamp = nf({ 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 Rp("heatmap-radius", this, t) } queryIntersectsFeature(t, e, r, n, i, s, a, o) { const l = this.paint.get("heatmap-radius").evaluate(e, r); return $p(t, n, s, a, o, !0, !0, new x(0, 0), l) } hasOffscreenPass() { return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility } getProgramIds() { return ["heatmap", "heatmapTexture"] } getDefaultProgramParams(t, e) { return "heatmap" === t ? { config: new pl(this, e), overrideFog: !1 } : {} } }, hillshade: class extends Va { constructor(t, e, r) { super(t, af, e, r); } hasOffscreenPass() { return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility } getProgramIds() { return ["hillshade", "hillshadePrepare"] } getDefaultProgramParams(t, e) { return { overrideFog: !1 } } }, fill: class extends Va { constructor(t, e, r) { super(t, $f, e, r); } getProgramIds() { const t = this.paint.get("fill-pattern"), e = t && t.constantOr(1), r = [e ? "fillPattern" : "fill"]; return this.paint.get("fill-antialias") && r.push(e && !this.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline"), r } getDefaultProgramParams(t, e) { return { config: new pl(this, e), overrideFog: !1 } } recalculate(t, e) { super.recalculate(t, e); const r = this.paint._values["fill-outline-color"]; "constant" === r.value.kind && void 0 === r.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]); } createBucket(t) { return new Uf(t) } queryRadius() { return Lp(this.paint.get("fill-translate")) } queryIntersectsFeature(t, e, r, n, i, s) { return !t.queryGeometry.isAboveHorizon && Mp(Vp(t.tilespaceGeometry, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), s.angle, t.pixelToTileUnitsFactor), n) } isTileClipped() { return !0 } }, "fill-extrusion": class extends Va { constructor(t, e, r) { super(t, pv, e, r), this._stats = { numRen
vendor: 8,911 bytes, line 36
36deredVerticesInShadowPass: 0, numRenderedVerticesInTransparentPass: 0 }; } createBucket(t) { return new tv(t) } queryRadius() { return Lp(this.paint.get("fill-extrusion-translate")) } is3D() { return !0 } hasShadowPass() { return !0 } cutoffRange() { return this.paint.get("fill-extrusion-cutoff-fade-range") } canCastShadows() { return !0 } getProgramIds() { return [this.paint.get("fill-extrusion-pattern").constantOr(1) ? "fillExtrusionPattern" : "fillExtrusion"] } queryIntersectsFeature(e, r, n, i, s, a, o, l, u) { const c = Op(this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), a.angle, e.pixelToTileUnitsFactor), h = this.paint.get("fill-extrusion-height").evaluate(r, n), p = this.paint.get("fill-extrusion-base").evaluate(r, n), f = [0, 0], d = l && a.elevation, m = a.elevation ? a.elevation.exaggeration() : 1, y = e.tile.getBucket(this); if (d && y instanceof tv) { const t = y.centroidVertexArray, e = u + 1; e < t.length && (f[0] = t.geta_centroid_pos0(e), f[1] = t.geta_centroid_pos1(e)); } if (0 === f[0] && 1 === f[1]) return !1; "globe" === a.projection.name && (i = uv([i], [new x(0, 0), new x(Cr, Cr)], e.tileID.canonical).map((t => t.polygon)).flat()); const g = d ? l : null, [v, b] = function (e, r, n, i, s, a, o, l, u, c, h) { return "globe" === e.projection.name ? function (e, r, n, i, s, a, o, l, u, c, h) { const p = [], f = [], d = e.projection.upVectorScale(h, e.center.lat, e.worldSize).metersToTile, m = [0, 0, 0, 1], y = [0, 0, 0, 1], g = (t, e, r, n) => { t[0] = e, t[1] = r, t[2] = n, t[3] = 1; }, x = lv(); n > 0 && (n += x), i += x; for (const x of r) { const r = [], v = []; for (const p of x) { const f = p.x + s.x, x = p.y + s.y, b = e.projection.projectTilePoint(f, x, h), _ = e.projection.upVector(h, p.x, p.y); let w = n, M = i; if (o) { const t = yv(f, x, n, i, o, l, u, c); w += t.base, M += t.top; } 0 !== n ? g(m, b.x + _[0] * d * w, b.y + _[1] * d * w, b.z + _[2] * d * w) : g(m, b.x, b.y, b.z), g(y, b.x + _[0] * d * M, b.y + _[1] * d * M, b.z + _[2] * d * M), t.v.transformMat4(m, m, a), t.v.transformMat4(y, y, a), r.push(new fv(m[0], m[1], m[2])), v.push(new fv(y[0], y[1], y[2])); } p.push(r), f.push(v); } return [p, f] }(e, r, n, i, s, a, o, l, u, c, h) : o ? function (e, r, n, i, s, a, o, l, u) { const c = [], h = [], p = [0, 0, 0, 1]; for (const f of e) { const e = [], d = []; for (const c of f) { const h = c.x + i.x, f = c.y + i.y, m = yv(h, f, r, n, a, o, l, u); p[0] = h, p[1] = f, p[2] = m.base, p[3] = 1, t.e.transformMat4(p, p, s), p[3] = Math.max(p[3], 1e-5); const y = new fv(p[0] / p[3], p[1] / p[3], p[2] / p[3]); p[0] = h, p[1] = f, p[2] = m.top, p[3] = 1, t.e.transformMat4(p, p, s), p[3] = Math.max(p[3], 1e-5); const g = new fv(p[0] / p[3], p[1] / p[3], p[2] / p[3]); e.push(y), d.push(g); } c.push(e), h.push(d); } return [c, h] }(r, n, i, s, a, o, l, u, c) : function (t, e, r, n, i) { const s = [], a = [], o = i[8] * e, l = i[9] * e, u = i[10] * e, c = i[11] * e, h = i[8] * r, p = i[9] * r, f = i[10] * r, d = i[11] * r; for (const e of t) { const t = [], r = []; for (const s of e) { const e = s.x + n.x, a = s.y + n.y, m = i[0] * e + i[4] * a + i[12], y = i[1] * e + i[5] * a + i[13], g = i[2] * e + i[6] * a + i[14], x = i[3] * e + i[7] * a + i[15], v = m + o, b = y + l, _ = g + u, w = Math.max(x + c, 1e-5), M = m + h, A = y + p, S = g + f, I = Math.max(x + d, 1e-5); t.push(new fv(v / w, b / w, _ / w)), r.push(new fv(M / I, A / I, S / I)); } s.push(t), a.push(r); } return [s, a] }(r, n, i, s, a) }(a, i, p, h, c, o, g, f, m, a.center.lat, e.tileID.canonical), _ = e.queryGeometry; return function (t, e, r) { let n = 1 / 0; Mp(r, e) && (n = mv(r, e[0])); for (let i = 0; i < e.length; i++) { const s = e[i], a = t[i]; for (let t = 0; t < s.length - 1; t++) { const e = s[t], i = [e, s[t + 1], a[t + 1], a[t], e]; _p(r, i) && (n = Math.min(n, mv(r, i))); } } return n !== 1 / 0 && n }(v, b, _.isPointQuery() ? _.screenBounds : _.screenGeometry) } }, line: class extends Va { constructor(t, e, r) { super(t, xv, e, r), 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 wn, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER; } } gradientExpression() { return this._transitionablePaint._values["line-gradient"].value.expression } widthExpression() { return this._transitionablePaint._values["line-width"].value.expression } recalculate(t, e) { super.recalculate(t, e), this.paint._values["line-floorwidth"] = Mv.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, t); } createBucket(t) { return new bg(t) } getProgramIds() { return [this.paint.get("line-pattern").constantOr(1) ? "linePattern" : "line"] } getDefaultProgramParams(t, e) { const r = _v(this); return { config: new pl(this, e), defines: r, overrideFog: !1 } } queryRadius(t) { const e = t, r = Av(Rp("line-width", this, e), Rp("line-gap-width", this, e)), n = Rp("line-offset", this, e); return r / 2 + Math.abs(n) + Lp(this.paint.get("line-translate")) } queryIntersectsFeature(t, e, r, n, i, s) { if (t.queryGeometry.isAboveHorizon) return !1; const a = Vp(t.tilespaceGeometry, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), s.angle, t.pixelToTileUnitsFactor), o = t.pixelToTileUnitsFactor / 2 * Av(this.paint.get("line-width").evaluate(e, r), this.paint.get("line-gap-width").evaluate(e, r)), l = this.paint.get("line-offset").evaluate(e, r); return l && (n = function (t, e) { const r = [], n = new x(0, 0); for (let i = 0; i < t.length; i++) { const s = t[i], a = []; for (let t = 0; t < s.length; t++) { const r = s[t], i = s[t + 1], o = 0 === t ? n : r.sub(s[t - 1])._unit()._perp(), l = t === s.length - 1 ? n : i.sub(r)._unit()._perp(), u = o._add(l)._unit(); u._mult(1 / (u.x * l.x + u.y * l.y)), a.push(u._mult(e)._add(r)); } r.push(a); } return r }(n, l * t.pixelToTileUnitsFactor)), function (t, e, r) { for (let n = 0; n < e.length; n++) { const i = e[n]; if (t.length >= 3) for (let e = 0; e < i.length; e++)if (zp(t, i[e])) return !0; if (Ap(t, i, r)) return !0 } return !1 }(a, n, o) } isTileClipped() { return !0 } }, symbol: rg, background: class extends Va { constructor(t, e, r) { super(t, Iv, e, r); } getProgramIds() { return [this.paint.get("background-pattern") ? "backgroundPattern" : "background"] } getDefaultProgramParams(t, e) { return { overrideFog: !1 } } }, raster: class extends Va { constructor(t, e, r) { super(t, Tv, e, r), this._updateColorRamp(); } getProgramIds() { return ["raster"] } hasColorMap() { return !!this._transitionablePaint._values["raster-color"].value.value } isLayerDraped(t) { return !(t && t._source instanceof Bv) || !t._source.onNorthPole && !t._source.onSouthPole && 0 === this.paint.get("raster-elevation") } _handleSpecialPaintPropertyUpdate(t) { "raster-color" !== t && "raster-color-range" !== t || this._updateColorRamp(); } _updateColorRamp() { if (!this.hasColorMap()) return; const t = this._transitionablePaint._values["raster-color"].value.expression, [e, r] = this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({ zoom: 0 }); this.colorRamp = nf({ expression: t, evaluationKey: "rasterValue", image: this.colorRamp, clips: [{ start: e, end: r }], resolution: 256 }), this.colorRampTexture = null; } }, sky: class extends Va { constructor(t, e, r) { super(t, Rv, e, r), 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 = nf({ 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 r = this.paint.get("sky-atmosphere-sun"), n = !r, i = t.style.light, s = i.properties.get("position"); return n && "viewport" === i.properties.get("anchor") && q("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."), n ? Lv(s.azimuthal, 90 - s.polar, e) : Lv(r[0], 90 - r[1], e) } const r = this.paint.get("sky-gradient-center"); return Lv(r[0], 90 - r[1], e) } isSky() { return !0 }
36 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 } }, slot: class extends Va { constructor(t, e, r) { super(t, Vv, e); } }, model: class extends Va { constructor(t, e, r) { super(t, bx, e, r); } createBucket(t) { return new xx(t) } getProgramIds() { return ["model"] } is3D() { return !0 } hasShadowPass() { return !0 } canCastShadows() { return !0 } hasLightBeamPass() { return !0 } cutoffRange() { return this.paint.get("model-cutoff-fade-range") } queryRadius() { return 0 } queryIntersectsFeature() { return !1 } _handleOverridablePaintPropertyUpdate(t, e, r) { return !(!this.layout || e.isDataDriven() || r.isDataDriven() || "model-color" !== t && "model-color-mix-intensity" !== t && "model-rotation" !== t && "model-scale" !== t && "model-translation" !== t && "model-emissive-strength" !== t) } _isPropertyZoomDependent(t) { const e = this._transitionablePaint._values[t]; return null != e && null != e.value && null != e.value.expression && e.value.expression instanceof Wi } isZoomDependent() { return this._isPropertyZoomDependent("model-scale") || this._isPropertyZoomDependent("model-rotation") || this._isPropertyZoomDependent("model-translation") } } }; class Fv { 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 jv { constructor() { this.tasks = {}, this.taskQueue = [], O(["process"], this), this.invoker = new Fv(this.process), this.nextId = 0; } add(t, e) { const r = this.nextId++, n = function ({ type: t, isSymbolTile: e, zoom: r }) { return r = r || 0, "message" === t ? 0 : "maybePrepare" !== t || e ? "parseTile" !== t || e ? "parseTile" === t && e ? 300 - r : "maybePrepare" === t && e ? 400 - r : 500 : 200 - r : 100 - r }(e); if (0 === n) { X(); try { t(); } finally { } return null } return this.tasks[r] = { fn: t, metadata: e, priority: n, id: r }, this.taskQueue.push(r), this.invoker.trigger(), { cancel: () => { delete this.tasks[r]; } } } process() { X(); 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 n = this.tasks[this.taskQueue[r]]; n.priority < e && (e = n.priority, t = r); } if (null === t) return null; const r = this.taskQueue[t]; return this.taskQueue.splice(t, 1), r } remove() { this.invoker.remove(); } } class Uv { constructor(t, e, r) { this.target = t, this.parent = e, this.mapId = r, this.callbacks = {}, this.cancelCallbacks = {}, O(["receive"], this), this.target.addEventListener("message", this.receive, !1), this.scheduler = new jv; } send(t, e, r, n, i = !1, s) { const a = Math.round(1e18 * Math.random()).toString(36).substring(0, 10); r && (r.metadata = s, this.callbacks[a] = r); const o = new Set; return this.target.postMessage({ id: a, type: t, hasCallback: !!r, targetMapId: n, mustQueue: i, sourceMapId: this.mapId, data: Js(e, o) }, o), { cancel: () => { r && delete this.callbacks[a], this.target.postMessage({ id: a, type: "<cancel>", targetMapId: n, sourceMapId: this.mapId }); } } } receive(t) { const e = t.data, r = e.id; if (r && (!e.targetMapId || this.mapId === e.targetMapId)) if ("<cancel>" === e.type) { const t = this.cancelCallbacks[r]; delete this.cancelCallbacks[r], t && t.cancel(); } else if (e.mustQueue || X()) { const t = this.callbacks[r], n = this.scheduler.add((() => this.processTask(r, e)), t && t.metadata || { type: "message" }); n && (this.cancelCallbacks[r] = n); } else this.processTask(r, e); } processTask(t, e) { if (delete this.cancelCallbacks[t], "<response>" === e.type) { const r = this.callbacks[t]; delete this.callbacks[t], r && (e.error ? r(Qs(e.error)) : r(null, Qs(e.data))); } else { const r = new Set, n = e.hasCallback ? (e, n) => { this.target.postMessage({ id: t, type: "<response>", sourceMapId: this.mapId, error: e ? Js(e) : null, data: Js(n, r) }, r); } : t => { }, i = Qs(e.data); if (this.parent[e.type]) this.parent[e.type](e.sourceMapId, i, n); else if (this.parent.getWorkerSource) { const t = e.type.split("."); this.parent.getWorkerSource(e.sourceMapId, t[0], i.source, i.scope)[t[1]](i, n); } else n(new Error(`Could not find function ${e.type}`)); } } remove() { this.scheduler.remove(), this.target.removeEventListener("message", this.receive, !1); } } class Nv { constructor(t, e) { this.workerPool = t, this.actors = [], this.currentActor = 0, this.id = C();
36 const r = this.workerPool.acquire(this.id); for (let t = 0; t < r.length; t++) { const n = new Nv.Actor(r[t], e, this.id); n.name = `Worker ${t}`, this.actors.push(n); } this.ready = !1, this.broadcast("checkIfReady", null, (() => { this.ready = !0; })); } broadcast(t, e, r) { z(this.actors, ((r, n) => { r.send(t, e, n); }), 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); } } Nv.Actor = Uv; class $v { constructor(t, e) { this.width = t, this.height = e, this.nextRow = 0, this.image = new Jp({ width: t, height: e }), this.positions = {}, this.uploaded = !1; } getDash(t, e) { const r = this.getKey(t, e); return this.positions[r] } trim() { const t = this.width, e = this.height = L(this.nextRow); this.image.resize({ width: t, height: e }); } getKey(t, e) { return t.join(",") + e } getDashRanges(t, e, r) { const n = []; let i = t.length % 2 == 1 ? -t[t.length - 1] * r : 0, s = t[0] * r, a = !0; n.push({ left: i, right: s, isDash: a, zeroLength: 0 === t[0] }); let o = t[0]; for (let e = 1; e < t.length; e++) { a = !a; const l = t[e]; i = o * r, o += l, s = o * r, n.push({ left: i, right: s, isDash: a, zeroLength: 0 === l }); } return n } addRoundDash(t, e, r) { const n = e / 2; for (let e = -r; e <= r; e++) { const i = this.width * (this.nextRow + r + e); let s = 0, a = t[s]; for (let o = 0; o < this.width; o++) { o / a.right > 1 && (a = t[++s]); const l = Math.abs(o - a.left), u = Math.abs(o - a.right), c = Math.min(l, u); let h; const p = e / r * (n + 1); if (a.isDash) { const t = n - Math.abs(p); h = Math.sqrt(c * c + t * t); } else h = n - Math.sqrt(c * c + p * p); this.image.data[i + o] = Math.max(0, Math.min(255, h + 128)); } } } addRegularDash(t, e) { for (let e = t.length - 1; e >= 0; --e) { const r = t[e], n = t[e + 1]; r.zeroLength ? t.splice(e, 1) : n && n.isDash === r.isDash && (n.left = r.left, t.splice(e, 1)); } const r = t[0], n = t[t.length - 1]; r.isDash === n.isDash && (r.left = n.left - this.width, n.right = r.right + this.width); const i = this.width * this.nextRow; let s = 0, a = t[s]; for (let r = 0; r < this.width; r++) { r / a.right > 1 && (a = t[++s]); const n = Math.abs(r - a.left), o = Math.abs(r - a.right), l = Math.min(n, o); this.image.data[i + r] = Math.max(0, Math.min(255, (a.isDash ? l : -l) + e + 128)); } } addDash(t, e) { const r = this.getKey(t, e); if (this.positions[r]) return this.positions[r]; const n = "round" === e, i = n ? 7 : 0, s = 2 * i + 1; if (this.nextRow + s > this.height) return q("LineAtlas out of space"), null; 0 === t.length && t.push(1); let a = 0; for (let e = 0; e < t.length; e++)t[e] < 0 && (q("Negative value is found in line dasharray, replacing values with 0"), t[e] = 0), a += t[e]; if (0 !== a) { const r = this.width / a, s = this.getDashRanges(t, this.width, r); n ? this.addRoundDash(s, r, i) : this.addRegularDash(s, "square" === e ? .5 * r : 0); } const o = this.nextRow + i; this.nextRow += s; const l = { tl: [o, i], br: [a, 0] }; return this.positions[r] = l, l } } Ks($v, "LineAtlas"); const qv = 1 * ry; class Gv { constructor(t) { const e = {}, r = []; for (const n in t) { const i = t[n], s = e[n] = {}; for (const t in i.glyphs) { const e = i.glyphs[+t]; if (!e || 0 === e.bitmap.width || 0 === e.bitmap.height) continue; const n = e.metrics.localGlyph ? qv : 1, a = { x: 0, y: 0, w: e.bitmap.width + 2 * n, h: e.bitmap.height + 2 * n }; r.push(a), s[t] = a; } } const { w: n, h: i } = Km(r), s = new Jp({ width: n || 1, height: i || 1 }); for (const r in t) { const n = t[r]; for (const t in n.glyphs) { const i = n.glyphs[+t]; if (!i || 0 === i.bitmap.width || 0 === i.bitmap.height) continue; const a = e[r][t], o = i.metrics.localGlyph ? qv : 1; Jp.copy(i.bitmap, s, { x: 0, y: 0 }, { x: a.x + o, y: a.y + o }, i.bitmap); } } this.image = s, this.positions = e; } } Ks(Gv, "GlyphAtlas"); class Yv { constructor(t) { this.tileID = new Hc(t.tileID.overscaledZ, t.tileID.wrap, t.tileID.canonical.z, t.tileID.canonical.x, t.tileID.canonical.y), this.tileZoom = t.tileZoom, this.uid = t.uid, this.zoom = t.zoom, this.canonical = t.tileID.canonical, this.pixelRatio = t.pixelRatio, this.tileSize = t.tileSize, this.source = t.source, this.scope = t.scope, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t.showCollisionBoxes, this.collectResourceTiming = !!t.collectResourceTiming, this.promoteId = t.promoteId, this.isSymbolTile = t.isSymbolTile, this.tileTransform = zy(t.tileID.canonical, t.projection), this.projection = t.projection, this.brightness = t.brightness, this.extraShadowCaster = !!t.extraShadowCaster; } parse(t, e, r, n, i) { this.status = "parsing", this.data = t, this.collisionBoxArray = new _o; const s = new hd(Object.keys(t.layers).sort()), a = new Hd(this.tileID, this.promoteId); a.bucketLayerIDs = []; const o = {}, l = new $v(256, 256), u = { featureIndex: a, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, lineAtlas: l, availableImages: r, brightness: this.brightness }, c = e.familiesBySource[this.source]; for (const e in c) { const n = t.layers[e]; if (!n) continue; let i = !1, l = !1, h = !1; for (const t of c[e]) "symbol" === t[0].type ? i = !0 : l = !0, t[0].is3D() && "model" !== t[0].type && (h = !0); if (this.extraShadowCaster && !h) continue; if (!0 === this.isSymbolTile && !i) continue; if (!1 === this.isSymbolTile && !l) continue; 1 === n.version && q(`Vector tile source "${this.source}" layer "${e}" does not use vector tile spec v2 and therefore may have some rendering errors.`); const p = s.encode(e), f = []; for (let t = 0; t < n.length; t++) { const r = n.feature(t), i = a.getId(r, e); f.push({ feature: r, id: i, index: t, sourceLayerIndex: p }); } for (const t of c[e]) { const e = t[0]; (!this.extraShadowCaster || e.is3D() && "model" !== e.type) && (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 && (Zv(t, this.zoom, u.brightness, r), (o[e.id] = e.createBucket({ index: a.bucketLayerIDs.length, layers: t, zoom: this.zoom, canonical: this.canonical, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: p, sourceID: this.source, projection: this.projection.spec })).populate(f, u, this.tileID.canonical, this.tileTransform), a.bucketLayerIDs.push(t.map((t => t.id))))); } } let h, p, f, d; l.trim(); const m = { type: "maybePrepare", isSymbolTile: this.isSymbolTile, zoom: this.zoom }, y = () => { if (h) return this.status = "done", i(h); if (this.extraShadowCaster) this.status = "done", i(null, { buckets: E(o).filter((t =>
36 !t.isEmpty())), featureIndex: a, collisionBoxArray: null, glyphAtlasImage: null, lineAtlas: null, imageAtlas: null, brightness: u.brightness, glyphMap: null, iconMap: null, glyphPositions: null }); else if (p && f && d) { const t = new Gv(p), e = new Jm(f, d); for (const n in o) { const i = o[n]; i instanceof fg ? (Zv(i.layers, this.zoom, u.brightness, r), vy(i, p, t.positions, f, e.iconPositions, this.showCollisionBoxes, r, this.tileID.canonical, this.tileZoom, this.projection, this.brightness)) : i.hasPattern && (i instanceof bg || i instanceof Uf || i instanceof tv) && (Zv(i.layers, this.zoom, u.brightness, r), i.addFeatures(u, this.tileID.canonical, e.patternPositions, r, this.tileTransform, this.brightness)); } this.status = "done", i(null, { buckets: E(o).filter((t => !t.isEmpty())), featureIndex: a, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: t.image, lineAtlas: l, imageAtlas: e, brightness: u.brightness }); } }; if (!this.extraShadowCaster) { const t = j(u.glyphDependencies, (t => Object.keys(t).map(Number))); Object.keys(t).length ? n.send("getGlyphs", { uid: this.uid, stacks: t, scope: this.scope }, ((t, e) => { h || (h = t, p = e, y()); }), void 0, !1, m) : p = {}; const e = Object.keys(u.iconDependencies); e.length ? n.send("getImages", { icons: e, source: this.source, scope: this.scope, tileID: this.tileID, type: "icons" }, ((t, e) => { h || (h = t, f = e, y()); }), void 0, !1, m) : f = {}; const r = Object.keys(u.patternDependencies); r.length ? n.send("getImages", { icons: r, source: this.source, scope: this.scope, tileID: this.tileID, type: "patterns" }, ((t, e) => { h || (h = t, d = e, y()); }), void 0, !1, m) : d = {}; } y(); } } function Zv(t, e, r, n) { const i = new _a(e, { brightness: r }); for (const e of t) e.recalculate(i, n); } class Xv { constructor(t) { this.entries = {}, this.scheduler = t; } request(t, e, r, n) { const i = this.entries[t] = this.entries[t] || { callbacks: [] }; if (i.result) { const [t, r] = i.result; return this.scheduler ? this.scheduler.add((() => { n(t, r); }), e) : n(t, r), () => { } } return i.callbacks.push(n), i.cancel || (i.cancel = r(((r, n) => { i.result = [r, n]; for (const t of i.callbacks) this.scheduler ? this.scheduler.add((() => { t(r, n); }), e) : t(r, n); setTimeout((() => delete this.entries[t]), 3e3); }))), () => { i.result || (i.callbacks = i.callbacks.filter((t => t !== n)), i.callbacks.length || (i.cancel(), delete this.entries[t])); } } } function Kv(t, e, r) { const n = JSON.stringify(t.request); return t.data && (this.deduped.entries[n] = { result: [null, t.data] }), this.deduped.request(n, { type: "parseTile", isSymbolTile: t.isSymbolTile, zoom: t.tileZoom }, (e => { const n = dt(t.request, ((t, n, i, s) => { t ? e(t) : n && e(null, { vectorTile: r ? void 0 : new ld(new Cd(n)), rawData: n, cacheControl: i, expires: s }); })); return () => { n.cancel(), e(); } }), e) } var Wv = { workerUrl: "", workerClass: null, workerParams: void 0 }; function Hv() { return null != Wv.workerClass ? new Wv.workerClass : new self.Worker(Wv.workerUrl, Wv.workerParams) } const Jv = "mapboxgl_preloaded_worker_pool"; class Qv { constructor() { this.active = {}; } acquire(t) { if (!this.workers) for (this.workers = []; this.workers.length < Qv.workerCount;)this.workers.push(new Hv); return this.active[t] = !0, this.workers.slice() } release(t) { delete this.active[t], this.workers && 0 === this.numActive() && (this.workers.forEach((t => { t.terminate(); })), this.workers = null); } isPreloaded() { return !!this.active[Jv] } numActive() { return Object.keys(this.active).length } } let tb; function eb() { return tb || (tb = new Qv), tb } Qv.workerCount = 2; let rb, nb, ib, sb = null; function ab() { return X() && self.worker && self.worker.dracoUrl ? self.worker.dracoUrl : nb || n.DRACO_URL } const ob = 5123, lb = 5126, ub = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, [ob]: Uint16Array, 5125: Uint32Array, [lb]: Float32Array }, cb = { 5120: "DT_INT8", 5121: "DT_UINT8", 5122: "DT_INT16", [ob]: "DT_UINT16", 5125: "DT_UINT32", [lb]: "DT_FLOAT32" }, hb = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 }; function pb(t, e, r) { const n = r.json.bufferViews.length, i = r.buffers.length; e.bufferView = n, r.json.bufferViews[n] = { buffer: i, byteLength: t.byteLength }, r.buffers[i] = t; } const fb = "KHR_draco_mesh_compression"; function db(t, e) { const r = t.extensions && t.extensions[fb]; if (!r) return; const n = new ib.Decoder, i = vb(e, r.bufferView), s = new ib.Mesh; if (!n.DecodeArrayToMesh(i, i.byteLength, s)) throw new Error("Failed to decode Draco mesh"); const a = e.json.accessors[t.indices], o = ub[a.componentType], l = a.count * o.BYTES_PER_ELEMENT, u = ib._malloc(l); o === Uint16Array ? n.GetTrianglesUInt16Array(s, l, u) : n.GetTrianglesUInt32Array(s, l, u), pb(ib.memory.buffer.slice(u, u + l), a, e), ib._free(u); for (const i of Object.keys(r.attributes)) { const a = n.GetAttributeByUniqueId(s, r.attributes[i]), o = e.json.accessors[t.attributes[i]], l = cb[o.componentType], u = o.count * hb[o.type] * ub[o.componentType].BYTES_PER_ELEMENT, 
36c = ib._malloc(u); n.GetAttributeDataArrayForAllPoints(s, a, ib[l], u, c), pb(ib.memory.buffer.slice(c, c + u), o, e), ib._free(c); } n.destroy(), s.destroy(), delete t.extensions[fb]; } const mb = 1179937895, yb = new TextDecoder("utf8"); function gb(t, e) { return new URL(t, e).href } function xb(t, e, r, n) { return fetch(gb(t.uri, n)).then((t => t.arrayBuffer())).then((t => { e.buffers[r] = t; })) } function vb(t, e) { const r = t.json.bufferViews[e]; return new Uint8Array(t.buffers[r.buffer], r.byteOffset || 0, r.byteLength) } function bb(t, e, r, n) { if (t.uri) { const i = gb(t.uri, n); return fetch(i).then((t => t.blob())).then((t => createImageBitmap(t))).then((t => { e.images[r] = t; })) } if (void 0 !== t.bufferView) { const n = vb(e, t.bufferView), i = new Blob([n], { type: t.mimeType }); return createImageBitmap(i).then((t => { e.images[r] = t; })) } } function _b(t, e = 0, r) { const n = { json: null, images: [], buffers: [] }; if (new Uint32Array(t, e, 1)[0] === mb) { const r = new Uint32Array(t, e); let i = 2; const s = (r[i++] >> 2) - 3, a = r[i++] >> 2; if (i++, n.json = JSON.parse(yb.decode(r.subarray(i, i + a))), i += a, i < s) { const s = r[i++]; i++; const a = e + (i << 2); n.buffers[0] = t.slice(a, a + s); } } else n.json = JSON.parse(yb.decode(new Uint8Array(t, e))); const { buffers: i, images: s, meshes: a, extensionsUsed: o } = n.json; let l = Promise.resolve(); if (i) { const t = []; for (let e = 0; e < i.length; e++) { const s = i[e]; s.uri ? t.push(xb(s, n, e, r)) : n.buffers[e] || (n.buffers[e] = null); } l = Promise.all(t); } return l.then((() => { const t = [], e = o && o.includes(fb); if (e && t.push(function () { if (!ib) return rb || (rb = function (t) { let e, r = null; function n() { e = new Uint8Array(r.buffer); } function i() { throw new Error("Unexpected Draco error.") } const s = { a: { a: i, d: function (t, r, n) { return e.copyWithin(t, r, r + n) }, c: function (t) { const i = e.length, s = Math.max(t >>> 0, Math.ceil(1.2 * i)), a = Math.ceil((s - i) / 65536); try { return r.grow(a), n(), !0 } catch (t) { return !1 } }, b: i } }; return (WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(t, s) : t.then((t => t.arrayBuffer())).then((t => WebAssembly.instantiate(t, s)))).then((t => { const { Rb: i, Qb: s, P: a, T: o, X: l, Ja: u, La: c, Qa: h, Va: p, Wa: f, eb: d, jb: m, f: y, e: g, yb: x, zb: v, Ab: b, Bb: _, Db: w, Gb: M } = t.instance.exports; r = g; const A = (() => { let t = 0, r = 0, n = 0, a = 0; return o => { n && (i(a), i(t), r += n, n = t = 0), t || (r += 128, t = s(r)); const l = o.length + 7 & -8; let u = t; l >= r && (n = l, u = a = s(l)); for (let t = 0; t < o.length; t++)e[u + t] = o[t]; return u } })(); return n(), y(), { memory: g, _free: i, _malloc: s, Mesh: class { constructor() { this.ptr = a(); } destroy() { o(this.ptr); } }, Decoder: class { constructor() { this.ptr = u(); } destroy() { m(this.ptr); } DecodeArrayToMesh(t, e, r) { const n = A(t), i = c(this.ptr, n, e, r.ptr); return !!l(i) }
36 GetAttributeByUniqueId(t, e) { return { ptr: h(this.ptr, t.ptr, e) } } GetTrianglesUInt16Array(t, e, r) { p(this.ptr, t.ptr, e, r); } GetTrianglesUInt32Array(t, e, r) { f(this.ptr, t.ptr, e, r); } GetAttributeDataArrayForAllPoints(t, e, r, n, i) { d(this.ptr, t.ptr, e.ptr, r, n, i); } }, DT_INT8: x(), DT_UINT8: v(), DT_INT16: b(), DT_UINT16: _(), DT_UINT32: w(), DT_FLOAT32: M() } })) }(fetch(ab())), rb.then((t => { ib = t, rb = void 0; }))) }()), s) for (let e = 0; e < s.length; e++)t.push(bb(s[e], n, e, r)); return (t.length ? Promise.all(t) : Promise.resolve()).then((() => { if (e && a) for (const { primitives: t } of a) for (const e of t) db(e, n); return n })) })) } class wb { constructor(t, e, r) { if (this.triangleCount = e.length / 3, this.min = new x(0, 0), this.max = new x(0, 0), this.xScale = 0, this.yScale = 0, this.cellsX = 0, this.cellsY = 0, this.cells = [], this.payload = [], 0 === this.triangleCount || 0 === t.length || 0 === r) return; const n = t.map((t => t.x)), i = t.map((t => t.y)); this.min = new x(Math.min(...n), Math.min(...i)), this.max = new x(Math.max(...n), Math.max(...i)); const s = this.max.sub(this.min); s.x = Math.max(s.x, 1), s.y = Math.max(s.y, 1); const a = Math.max(s.x, s.y) / r; this.cellsX = Math.max(1, Math.ceil(s.x / a)), this.cellsY = Math.max(1, Math.ceil(s.y / a)), this.xScale = 1 / a, this.yScale = 1 / a; const o = []; for (let r = 0; r < this.triangleCount; r++) { const n = t[e[3 * r + 0]].sub(this.min), i = t[e[3 * r + 1]].sub(this.min), s = t[e[3 * r + 2]].sub(this.min), l = Mb(Math.floor(Math.min(n.x, i.x, s.x)), this.xScale, this.cellsX), u = Mb(Math.floor(Math.max(n.x, i.x, s.x)), this.xScale, this.cellsX), c = Mb(Math.floor(Math.min(n.y, i.y, s.y)), this.yScale, this.cellsY), h = Mb(Math.floor(Math.max(n.y, i.y, s.y)), this.yScale, this.cellsY), p = new x(0, 0), f = new x(0, 0), d = new x(0, 0), m = new x(0, 0); for (let t = c; t <= h; ++t) { p.y = f.y = t * a, d.y = m.y = (t + 1) * a; for (let e = l; e <= u; ++e)p.x = d.x = e * a, f.x = m.x = (e + 1) * a, (Cp(n, i, s, p, f, m) || Cp(n, i, s, p, m, d)) && o.push({ cellIdx: t * this.cellsX + e, triIdx: r }); } } if (0 === o.length) return; o.sort(((t, e) => t.cellIdx - e.cellIdx || t.triIdx - e.triIdx)); let l = 0; for (; l < o.length;) { const t = o[l].cellIdx, e = { start: this.payload.length, len: 0 }; for (; l < o.length && o[l].cellIdx === t;)++e.len, this.payload.push(o[l++].triIdx); this.cells[t] = e; } } query(t, e, r) { if (0 === this.triangleCount || 0 === this.cells.length) return; if (t.x > this.max.x || this.min.x > e.x) return; if (t.y > this.max.y || this.min.y > e.y) return; this.lookup || (this.lookup = new Uint8Array(Math.ceil(this.triangleCount / 8))); for (let t = 0; t < this.lookup.length; t++)this.lookup[t] = 0; const n = Mb(t.x - this.min.x, this.xScale, this.cellsX), i = Mb(e.x - this.min.x, this.xScale, this.cellsX), s = Mb(t.y - this.min.y, this.yScale, this.cellsY), a = Mb(e.y - this.min.y, this.yScale, this.cellsY); for (let t = s; t <= a; t++)for (let e = n; e <= i; e++) { const n = this.cells[t * this.cellsX + e]; if (n) for (let t = 0; t < n.len; t++) { const e = this.payload[n.start + t], i = Math.floor(e / 8), s = 1 << e % 8; if (!(this.lookup[i] & s) && (this.lookup[i] |= s, r.push(e), r.length === this.triangleCount)) return } } } } function Mb(t, e, r) { return Math.max(0, Math.min(r - 1, Math.floor(t * e))) } function Ab(t, e) { const r = t.json.bufferViews[e.bufferView]; return new (0, ub[e.componentType])(t.buffers[r.buffer], (e.byteOffset || 0) + (r.byteOffset || 0), e.count * hb[e.type]) } function Sb(t, e, r) { const n = t.indices, i = t.attributes, s = {}; s.indexArray = new ao; const a = e.json.accessors[n], o = a.count / 3; s.indexArray.reserve(o); const l = Ab(e, a); for (let t = 0; t < o; t++)s.indexArray.emplaceBack(l[3 * t], l[3 * t + 1], l[3 * t + 2]); s.indexArray._trim(), s.vertexArray = new mo; const u = e.json.accessors[i.POSITION]; s.vertexArray.reserve(u.count); const c = Ab(e, u); for (let t = 0; t < u.count; t++)s.vertexArray.emplaceBack(c[3 * t], c[3 * t + 1], c[3 * t + 2]); if (s.vertexArray._trim(), s.aabb = new oh(u.min, u.max), s.centroid = function (t, e) { const r = [0, 0, 0], n = t.length; if (n > 0) { for (let i = 0; i < n; i++) { const n = 3 * t[i]; r[0] += e[n], r[1] += e[n + 1], r[2] += e[n + 2]; } r[0] /= n, r[1] /= n, r[2] /= n; } return r }(l, c), void 0 !== i.COLOR_0) { const t = e.json.accessors[i.COLOR_0], r = hb[t.type]; if (t.componentType === lb) { s.colorArray = 3 === r ? new mo : new Xa, s.colorArray.reserve(t.count); const n = Ab(e, t); if (3 === r) for (let e = 0; e < t.count; e++)s.colorArray.emplaceBack(n[3 * e], n[3 * e + 1], n[3 * e + 2]); else for (let e = 0; e < t.count; e++)s.colorArray.emplaceBack(n[4 * e], n[4 * e + 1], n[4 * e + 2], n[4 * e + 3]); s.colorArray._trim(); } else if (t.componentType === ob && 4 === r) { s.colorArray = new Xa, s.colorArray.resize(t.count); const r = Ab(e, t), n = 1 / 65535, i = s.colorArray.float32; for (let t = 0; t < 4 * r.length; ++t)i[t] = r[t] * n; } else q(`glTF color buffer parsing for accessor ${JSON.stringify(t)} is not supported`); } if (void 0 !== i.NORMAL) { s.normalArray = new mo; const t = e.json.accessors[i.NORMAL]; s.normalArray.reserve(t.count); const r = Ab(e, t); for (let e = 0; e < t.count; e++)s.normalArray.emplaceBack(r[3 * e], r[3 * e + 1], r[3 * e + 2]); s.normalArray._trim(); } if (void 0 !== i.TEXCOORD_0 && r.length > 0) { s.texcoordArray = new yo;
vendor: 6,128 bytes, line 36
36 const t = e.json.accessors[i.TEXCOORD_0]; s.texcoordArray.reserve(t.count); const r = Ab(e, t); for (let e = 0; e < t.count; e++)s.texcoordArray.emplaceBack(r[2 * e], r[2 * e + 1]); s.texcoordArray._trim(); } const h = t.material; return s.material = function (t, e) { const { emissiveFactor: r = [0, 0, 0], alphaMode: n = "OPAQUE", alphaCutoff: i = .5, normalTexture: s, occlusionTexture: a, emissiveTexture: o, doubleSided: l } = t, { baseColorFactor: u = [1, 1, 1, 1], metallicFactor: c = 1, roughnessFactor: h = 1, baseColorTexture: p, metallicRoughnessTexture: f } = t.pbrMetallicRoughness || {}; return { pbrMetallicRoughness: { baseColorFactor: new Re(...u), metallicFactor: c, roughnessFactor: h, baseColorTexture: p ? e[p.index] : void 0, metallicRoughnessTexture: f ? e[f.index] : void 0 }, doubleSided: l, emissiveFactor: r, alphaMode: n, alphaCutoff: i, normalTexture: s ? e[s.index] : void 0, occlusionTexture: a ? e[a.index] : void 0, emissionTexture: o ? e[o.index] : void 0, defined: void 0 === t.defined } }(void 0 !== h ? e.json.materials[h] : { defined: !1 }, r), void 0 !== i._FEATURE_RGBA4444 && (s.featureData = new Uint32Array(Ab(e, e.json.accessors[i._FEATURE_RGBA4444]).buffer)), s } function Ib(e, r, n) { const { matrix: i, rotation: s, translation: a, scale: o, mesh: l, extras: u, children: c } = e, h = {}; if (h.matrix = i || t.m.fromRotationTranslationScale([], s || [0, 0, 0, 1], a || [0, 0, 0], o || [1, 1, 1]), void 0 !== l) { h.meshes = n[l]; const t = h.anchor = [0, 0]; for (const e of h.meshes) { const { min: r, max: n } = e.aabb; t[0] += r[0] + n[0], t[1] += r[1] + n[1]; } t[0] = Math.floor(t[0] / h.meshes.length / 2), t[1] = Math.floor(t[1] / h.meshes.length / 2); } if (u && (u.id && (h.id = u.id), u.lights && (h.lights = function (t) { if (!t.length) return []; const e = function (t) { const e = atob(t), r = new Uint8Array(e.length); for (let t = 0; t < e.length; t++)r[t] = e.codePointAt(t); return r }(t), r = [], n = e.length / 24, i = new Uint16Array(e.buffer), s = new Float32Array(e.buffer); for (let t = 0; t < n; t++) { const e = i[2 * t * 6] / 30, n = i[2 * t * 6 + 1] / 30, a = i[2 * t * 6 + 10] / 100, o = s[6 * t + 1], l = s[6 * t + 2], u = s[6 * t + 3], c = s[6 * t + 4], h = u - o, p = c - l, f = Math.hypot(h, p); r.push({ pos: [o + .5 * h, l + .5 * p, n], normal: [p / f, -h / f, 0], width: f, height: e, depth: a, points: [o, l, u, c] }); } return r }(u.lights))), c) { const t = []; for (const e of c) t.push(Ib(r.json.nodes[e], r, n)); h.children = t; } return h } function kb(t) { if (0 === t.vertices.length || 0 === t.indices.length) return null; const [e, r] = [t.vertices[0].clone(), t.vertices[0].clone()]; for (let n = 1; n < t.vertices.length; ++n) { const i = t.vertices[n]; e.x = Math.min(e.x, i.x), e.y = Math.min(e.y, i.y), r.x = Math.max(r.x, i.x), r.y = Math.max(r.y, i.y); } const n = Math.ceil(Math.max(r.x - e.x, r.y - e.y) / 256), i = Math.max(8, n), s = new wb(t.vertices, t.indices, i); return { vertices: t.vertices, indices: t.indices, grid: s, min: e, max: r } } function Tb(t) { if (!t.extras || !t.extras.ground) return null; const e = t.extras.ground; if (!e || !Array.isArray(e) || 0 === e.length) return null; const r = e[0]; if (!r || !Array.isArray(r) || 0 === r.length) return null; const n = []; for (const t of r) { if (!Array.isArray(t) || 2 !== t.length) continue; const e = t[0], r = t[1]; "number" == typeof e && "number" == typeof r && n.push(new x(e, r)); } if (n.length < 3) return null; n.length > 1 && n[n.length - 1].equals(n[0]) && n.pop(); let i = 0; for (let t = 0; t < n.length; t++) { const e = n[t], r = n[(t + 1) % n.length], s = n[(t + 2) % n.length]; i += (e.x - r.x) * (s.y - r.y) - (s.x - r.x) * (e.y - r.y); } i > 0 && n.reverse(); const s = Lf(n.flatMap((t => [t.x, t.y])), []); return 0 === s.length ? null : { vertices: n, indices: s } } function Pb(t) { const e = [], r = []; let n = 0; for (const i of t) { n = e.length; const t = i.vertexArray.float32, s = i.indexArray.uint16; for (let r = 0; r < i.vertexArray.length; r++)e.push(new x(t[3 * r + 0], t[3 * r + 1])); for (let t = 0; t < 3 * i.indexArray.length; t++)r.push(s[t] + n); } if (r.length % 3 != 0) return null; for (let t = 0; t < r.length; t += 3) { const n = e[r[t + 0]], i = e[r[t + 1]], s = e[r[t + 2]]; (n.x - i.x) * (s.y - i.y) - (s.x - i.x) * (n.y - i.y) > 0 && ([r[t + 1], r[t + 2]] = [r[t + 2], r[t + 1]]); } return { vertices: e, indices: r } } function zb(t) { const e = function (t, e) { const r = [], n = WebGL2RenderingContext; if (t.json.textures) for (const i of t.json.textures) { const s = { magFilter: n.LINEAR, minFilter: n.NEAREST, wrapS: n.REPEAT, wrapT: n.REPEAT }; void 0 !== i.sampler && Object.assign(s, t.json.samplers[i.sampler]), r.push({ image: e[i.source], sampler: s, uploaded: !1 }); } return r }(t, t.images), r = function (t, e) { const r = []; for (const n of t.json.meshes) { const i = []; for (const r of n.primitives) i.push(Sb(r, t, e)); r.push(i); } return r }(t, e), { scenes: n, scene: i, nodes: s } = t.json, a = n ? n[i || 0].nodes : s, o = []; for (const e of a) o.push(Ib(s[e], t, r)); return function (t, e, r) { const n = {}, i = new Set; for (let s = 0; s < t.length; s++) { const t = r[e[s]]; if (!t.extras) continue; const a = t.extras["mapbox:footprint:version"], o = t.extras["mapbox:footprint:id"]; (a || o) && i.add(s), "1.0.0" === a && o && (n[o] = s); } for (let s = 0; s < t.length; s++) { if (i.has(s)) continue; const a = t[s], o = r[e[s]]; if (!o.extras) continue; let l = null; a.id in n && (l = Pb(t[n[a.id]].meshes)), l || (l = Tb(o)), l && (a.footprint = kb(l)); } if (i.size > 0) { const e = Array.from(i.values()).sort(((t, e) => t - e)); for (let r = e.length - 1; r >= 0; r--)t.splice(e[r], 1); } }(o, a, t.json.nodes), o } function Eb(t) { t.heightmap = new Float32Array(4096), t.heightmap.fill(-1); const e = t.vertexArray.float32, r = t.aabb.min[0] - 1, n = t.aabb.min[1] - 1, i = ux / (t.aabb.max[0] - r + 2), s = ux / (t.aabb.max[1] - n + 2); for (let a = 0; a < e.length; a += 3) { const o = e[a + 2], l = (e[a + 0] - r) * i | 0, u = (e[a + 1] - n) * s | 0; o >
36 t.heightmap[u * ux + l] && (t.heightmap[u * ux + l] = o); } } function Bb(e, r) { const n = {}; n.indexArray = new ao, n.indexArray.reserve(4 * e.length), n.vertexArray = new mo, n.vertexArray.reserve(10 * e.length), n.colorArray = new Xa, n.vertexArray.reserve(10 * e.length); let i = 0; for (const s of e) { const e = Math.min(10, Math.max(4, 1.3 * s.height)) * r, a = [-s.normal[1], s.normal[0], 0], o = Math.min(.29, .1 * s.width / s.depth), l = s.width - 2 * s.depth * r * (o + .01), u = t.v.scaleAndAdd([], s.pos, a, l / 2), c = t.v.scaleAndAdd([], s.pos, a, -l / 2), h = [u[0], u[1], u[2] + s.height], p = [c[0], c[1], c[2] + s.height], f = t.v.scaleAndAdd([], s.normal, a, o); t.v.scale(f, f, e); const d = t.v.scaleAndAdd([], s.normal, a, -o); t.v.scale(d, d, e), t.v.add(f, u, f), t.v.add(d, c, d), u[2] += .1, c[2] += .1, n.vertexArray.emplaceBack(f[0], f[1], f[2]), n.vertexArray.emplaceBack(d[0], d[1], d[2]), n.vertexArray.emplaceBack(u[0], u[1], u[2]), n.vertexArray.emplaceBack(c[0], c[1], c[2]), n.vertexArray.emplaceBack(h[0], h[1], h[2]), n.vertexArray.emplaceBack(p[0], p[1], p[2]), n.vertexArray.emplaceBack(u[0], u[1], u[2]), n.vertexArray.emplaceBack(c[0], c[1], c[2]), n.vertexArray.emplaceBack(f[0], f[1], f[2]), n.vertexArray.emplaceBack(d[0], d[1], d[2]); const m = l / e / 2; n.colorArray.emplaceBack(-m - o, -1, m, .8), n.colorArray.emplaceBack(m + o, -1, m, .8), n.colorArray.emplaceBack(-m, 0, m, 1.3), n.colorArray.emplaceBack(m, 0, m, 1.3), n.colorArray.emplaceBack(m + o, -.8, m, .7), n.colorArray.emplaceBack(m + o, -.8, m, .7), n.colorArray.emplaceBack(0, 0, m, 1.3), n.colorArray.emplaceBack(0, 0, m, 1.3), n.colorArray.emplaceBack(m + o, -1.2, m, .8), n.colorArray.emplaceBack(m + o, -1.2, m, .8), n.indexArray.emplaceBack(6 + i, 4 + i, 8 + i), n.indexArray.emplaceBack(7 + i, 9 + i, 5 + i), n.indexArray.emplaceBack(0 + i, 1 + i, 2 + i), n.indexArray.emplaceBack(1 + i, 3 + i, 2 + i), i += 10; } const s = { defined: !0, emissiveFactor: [0, 0, 0] }, a = {}; return a.baseColorFactor = Re.white, s.pbrMetallicRoughness = a, n.material = s, n.aabb = new oh([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]), n } Ks(wb, "TriangleGridIndex"); const Db = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]; class Cb { static from(t) { if (!(t instanceof ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer."); const [e, r] = new Uint8Array(t, 0, 2); if (219 !== e) throw new Error("Data does not appear to be in a KDBush format."); const n = r >> 4; if (1 !== n) throw new Error(`Got v${n} data when expected v1.`); const i = Db[15 & r]; if (!i) throw new Error("Unrecognized array type."); const [s] = new Uint16Array(t, 2, 1), [a] = new Uint32Array(t, 4, 1); return new Cb(a, s, i, t) } constructor(t, e = 64, r = Float64Array, n) { if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`); this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = r, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array; const i = Db.indexOf(this.ArrayType), s = 2 * t * this.ArrayType.BYTES_PER_ELEMENT, a = t * this.IndexArrayType.BYTES_PER_ELEMENT, o = (8 - a % 8) % 8; if (i < 0) throw new Error(`Unexpected typed array class: ${r}.`); n && n instanceof ArrayBuffer ? (this.data = n, this.ids = new this.IndexArrayType(this.data, 8, t), this.coords = new this.ArrayType(this.data, 8 + a + o, 2 * t), this._pos = 2 * t, this._finished = !0) : (this.data = new ArrayBuffer(8 + s + a + o), this.ids = new this.IndexArrayType(this.data, 8, t), this.coords = new this.ArrayType(this.data, 8 + a + o, 2 * t), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, 16 + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t); } add(t, e) { const r = this._pos >> 1; return this.ids[r] = r, this.coords[this._pos++] = t, this.coords[this._pos++] = e, r } finish() { const t = this._pos >> 1; if (t !== this.numItems) throw new Error(`Added ${t} items when expected ${this.numItems}.`); return Rb(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this } range(t, e, r, n) { if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
vendor: 1,407 bytes, line 36
36 const { ids: i, coords: s, nodeSize: a } = this, o = [0, i.length - 1, 0], l = []; for (; o.length;) { const u = o.pop() || 0, c = o.pop() || 0, h = o.pop() || 0; if (c - h <= a) { for (let a = h; a <= c; a++) { const o = s[2 * a], u = s[2 * a + 1]; o >= t && o <= r && u >= e && u <= n && l.push(i[a]); } continue } const p = h + c >> 1, f = s[2 * p], d = s[2 * p + 1]; f >= t && f <= r && d >= e && d <= n && l.push(i[p]), (0 === u ? t <= f : e <= d) && (o.push(h), o.push(p - 1), o.push(1 - u)), (0 === u ? r >= f : n >= d) && (o.push(p + 1), o.push(c), o.push(1 - u)); } return l } within(t, e, r) { if (!this._finished) throw new Error("Data not yet indexed - call index.finish()."); const { ids: n, coords: i, nodeSize: s } = this, a = [0, n.length - 1, 0], o = [], l = r * r; for (; a.length;) { const u = a.pop() || 0, c = a.pop() || 0, h = a.pop() || 0; if (c - h <= s) { for (let r = h; r <= c; r++)Fb(i[2 * r], i[2 * r + 1], t, e) <= l && o.push(n[r]); continue } const p = h + c >> 1, f = i[2 * p], d = i[2 * p + 1]; Fb(f, d, t, e) <= l && o.push(n[p]), (0 === u ? t - r <= f : e - r <= d) && (a.push(h), a.push(p - 1), a.push(1 - u)), (0 === u ? t + r >= f : e + r >= d) && (a.push(p + 1), a.push(c), a.push(1 - u)); } return o } } function Rb(t, e, r, n, i, s) { if (i - n <= r) return; const a = n + i >> 1; Lb(t, e, a, n, i, s), Rb(t, e, r, n, a - 1, 1 - s), Rb(t, e, r, a + 1, i, 1 - s); }
36 function Lb(t, e, r, n, i, s) { for (; i > n;) { if (i - n > 600) { const a = i - n + 1, o = r - n + 1, l = Math.log(a), u = .5 * Math.exp(2 * l / 3), c = .5 * Math.sqrt(l * u * (a - u) / a) * (o - a / 2 < 0 ? -1 : 1); Lb(t, e, r, Math.max(n, Math.floor(r - o * u / a + c)), Math.min(i, Math.floor(r + (a - o) * u / a + c)), s); } const a = e[2 * r + s]; let o = n, l = i; for (Vb(t, e, n, r), e[2 * i + s] > a && Vb(t, e, n, i); o < l;) { for (Vb(t, e, o, l), o++, l--; e[2 * o + s] < a;)o++; for (; e[2 * l + s] > a;)l--; } e[2 * n + s] === a ? Vb(t, e, n, l) : (l++, Vb(t, e, l, i)), l <= r && (n = l + 1), r <= l && (i = l - 1); } } function Vb(t, e, r, n) { Ob(t, r, n), Ob(e, 2 * r, 2 * n), Ob(e, 2 * r + 1, 2 * n + 1); } function Ob(t, e, r) { const n = t[e]; t[e] = t[r], t[r] = n; } function Fb(t, e, r, n) { const i = t - r, s = e - n; return i * i + s * s } t.$ = 45, t.A = np, t.B = function (e) { const r = t.m.identity(new Float64Array(16)); t.m.multiply(r, e.pixelMatrix, e.globeMatrix); const n = [0, dh, 0], i = [0, mh, 0]; return t.v.transformMat4(n, n, r), t.v.transformMat4(i, i, r), [n[0] > 0 && n[0] <= e.width && n[1] > 0 && n[1] <= e.height && !jh(e, new Zh(e.center.lat, 90)), i[0] > 0 && i[0] <= e.width && i[1] > 0 && i[1] <= e.height && !jh(e, new Zh(e.center.lat, -90))] }, t.C = Re, t.D = vl, t.E = Hh, t.F = ah, t.G = uh, t.H = Jh, t.I = Cg, t.J = Cr, t.K = function (e, r) { const { scale: n } = e.tileTransform, i = n * Cr / (e.tileSize * Math.pow(2, r.zoom - e.tileID.overscaledZ + e.tileID.canonical.z)); return t.h.scale(new Float32Array(4), r.inverseAdjustmentMatrix, [i, i]) }, t.L = Zh, t.M = lp, t.N = ex, t.O = Hc, t.P = x, t.Q = Qg, t.R = th, t.S = function (e) { const r = Qg(e, !0); return t.h.invert([], [r[0], r[1], r[4], r[5]]) }, t.T = eh, t.U = Wc, t.V = function (t) { const { x: e, y: r } = t.point, { lng: n, lat: i } = t._center; return Vh(e, r, t.worldSize, n, i) }, t.W = Am, t.X = q, t.Y = w, t.Z = lh, t._ = function (t) { const e = Math.round((t + 45 + 360) % 360 / 90) % 4; return M[e] }, t.a = Og, t.a$ = Ko, t.a0 = Wh, t.a1 = function (t, e) { return ft(B(t, { type: "json" }), e) }, t.a2 = ct, t.a3 = vt, t.a4 = Wt, t.a5 = Qp, t.a6 = ee, t.a7 = te, t.a8 = Qt, t.a9 = _g, t.aA = zp, t.aB = cp, t.aC = ch, t.aD = Xv, t.aE = Ra, t.aF = Kv, t.aG = function (t) { ut++, ut > nt && (t.getActor().send("enforceCacheSizeLimit", rt), ut = 0); }, t.aH = Dt, t.aI = Kt, t.aJ = function (t) { return t <= 1 ? 1 : Math.pow(2, Math.floor(Math.log(t) / Math.LN2)) }, t.aK = Bv, t.aL = function (t, e) { const r = document.createElement("video"); r.muted = !0, r.onloadstart = function () { e(null, r); }; for (let e = 0; e < t.length; e++) { const n = document.createElement("source"); mt(t[e]) || (r.crossOrigin = "Anonymous"), n.src = t[e], r.appendChild(n); } return { cancel: () => { } } }, t.aM = ne, t.aN = wg, t.aO = function (t) { return fetch(t).then((t => t.arrayBuffer())).then((e => _b(e, 0, t))) }, t.aP = zb, t.aQ = class { constructor(t, e, r, n) { this.id = t, this.position = null != e ? new Zh(e[0], e[1]) : new Zh(0, 0), this.orientation = null != r ? r : [0, 0, 0], this.nodes = n, this.uploaded = !1, this.aabb = new oh([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]), this.matrix = []; } _applyTransformations(e, r) { if (t.m.multiply(e.matrix, r, e.matrix), e.meshes) for (const t of e.meshes) { const r = oh.applyTransform(t.aabb, e.matrix); this.aabb.encapsulate(r); } if (e.children) for (const t of e.children) this._applyTransformations(t, e.matrix); } computeBoundsAndApplyParent() { const e = t.m.identity([]); for (const t of this.nodes) this._applyTransformations(t, e); } _positionModelOnTerrain(e, r) { const n = e.elevation; if (!n) return 0; const i = oh.projectAabbCorners(this.aabb, this.matrix), s = Qh(1, this.position.lat) * e.worldSize, a = function (e, r) { const n = [0, 0, 1], i = [{ corners: [0, 1, 3, 2], dotProductWithUp: 0 }, { corners: [1, 5, 2, 6], dotProductWithUp: 0 }, { corners: [0, 4, 1, 5], dotProductWithUp: 0 }, { corners: [2, 6, 3, 7], dotProductWithUp: 0 }, { corners: [4, 7, 5, 6], dotProductWithUp: 0 }, { corners: [0, 3, 4, 7], dotProductWithUp: 0 }]; for (const s of i) { const i = e[s.corners[0]], a = e[s.corners[1]], o = e[s.corners[2]], l = [a[0] - i[0], a[1] - i[1], r * (a[2] - i[2])], u = t.v.cross(l, l, [o[0] - i[0], o[1] - i[1], r * (o[2] - i[2])]); t.v.normalize(u, u), s.dotProductWithUp = t.v.dot(u, n); } return i.sort(((t, e) => t.dotProductWithUp - e.dotProductWithUp)), i[0].corners }(i, s), o = i[a[0]], l = i[a[1]], u = i[a[2]], c = i[a[3]], h = n.getAtPointOrZero(new lp(o[0] / e.worldSize, o[1] / e.worldSize), 0), p = n.getAtPointOrZero(new lp(l[0] / e.worldSize, l[1] / e.worldSize), 0), f = n.getAtPointOrZero(new lp(u[0] / e.worldSize, u[1] / e.worldSize), 0), d = n.getAtPointOrZero(new lp(c[0] / e.worldSize, c[1] / e.worldSize), 0), m = (h + d) / 2, y = (p + f) / 2; return m > y ? p < f ? ox(r, l, c, o, p, d, h, s) : ox(r, u, o, c, f, h, d, s) : h < d ? ox(r, o, l, u, h, p, f, s) : ox(r, c, u, l, d, f, p, s), Math.max(m, y) } computeModelMatrix(e, r, n, i, s, a, o = !1) { const l = e.transform, u = l.zoom, c = l.project(this.position), h = sp(this.position.lat, u), p = 1 / h;
36 t.m.identity(this.matrix), t.m.translate(this.matrix, this.matrix, [c.x + i[0] * p, c.y + i[1] * p, i[2]]); let f = 1, d = 1; const m = l.worldSize; if (o) { if ("mercator" === l.projection.name) { let e = 0; l.elevation && (e = l.elevation.getAtPointOrZero(new lp(c.x / m, c.y / m), 0)); const r = t.e.transformMat4([], [c.x, c.y, e, 1], l.projMatrix)[3] / l.cameraToCenterDistance; f = r, d = r * sp(l.center.lat, u); } else if ("globe" === l.projection.name) { const e = lx(this.matrix, l), r = t.m.multiply([], l.projMatrix, e), n = [0, 0, 0, 1]; t.e.transformMat4(n, n, r); const i = n[3] / l.cameraToCenterDistance, s = Oh(u), a = l.projection.pixelsPerMeter(this.position.lat, m) * sp(this.position.lat, u), o = l.projection.pixelsPerMeter(l.center.lat, m) * sp(l.center.lat, u); f = i / Mn(a, ip(l.center.lat), s), d = i * h / a, f *= o, d *= o; } } else f = p; t.m.scale(this.matrix, this.matrix, [f, f, d]); const y = [...this.matrix], g = this.orientation, x = []; if (ax(x, [g[0] + r[0], g[1] + r[1], g[2] + r[2]], n), t.m.multiply(this.matrix, y, x), s && l.elevation) { let e = 0; const r = []; if (a && l.elevation) { e = this._positionModelOnTerrain(l, r); const n = t.m.fromQuat([], r), i = t.m.multiply([], n, x); t.m.multiply(this.matrix, y, i); } else e = l.elevation.getAtPointOrZero(new lp(c.x / m, c.y / m), 0); 0 !== e && (this.matrix[14] += e); } } upload(t) { if (!this.uploaded) { for (const e of this.nodes) fx(e, t); for (const t of this.nodes) dx(t); this.uploaded = !0; } } destroy() { for (const t of this.nodes) mx(t); } }, t.aR = O, t.aS = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"], t.aT = Xm, t.aU = _p, t.aV = um, t.aW = xy, t.aX = by, t.aY = Lm, t.aZ = Cb, t.a_ = rl, t.aa = Km, t.ab = Hm, t.ac = Da, t.ad = za, t.ae = re, t.af = class { constructor(t) { this.specification = t; } possiblyEvaluate(t, e) { return Z(t.expression.evaluate(e)) } interpolate(t, e, r) { return { x: Mn(t.x, e.x, r), y: Mn(t.y, e.y, r), z: Mn(t.z, e.z, r), azimuthal: Mn(t.azimuthal, e.azimuthal, r), polar: Mn(t.polar, e.polar, r) } } }, t.ag = Aa, t.ah = t => Ns(Es(t)), t.ai = $s, t.aj = Fs, t.ak = B, t.al = _a, t.am = Wi, t.an = T, t.ao = Oh, t.ap = t => Ns(Cs(t)), t.aq = An, t.ar = Pa, t.as = class { constructor(t) { this.specification = t; } possiblyEvaluate(t, e) { return function ([t, e]) { const r = Z([1, t, e]); return { x: r.x, y: r.y, z: r.z } }(t.expression.evaluate(e)) } interpolate(t, e, r) { return { x: Mn(t.x, e.x, r), y: Mn(t.y, e.y, r), z: Mn(t.z, e.z, r) } } }, t.at = function (t, e, r = 0, n = !0) { const i = new x(r, r), s = t.sub(i), a = e.add(i), o = [s, new x(a.x, s.y), a, new x(s.x, a.y)]; return n && o.push(s.clone()), o }, t.au = function (t, e) { const r = []; for (let n = 0; n < t.length; n++) { const i = P(n - 1, -1, t.length - 1), s = P(n + 1, -1, t.length - 1), a = t[n], o = t[s], l = t[i].sub(a).unit(), u = o.sub(a).unit(), c = u.angleWithSep(l.x, l.y), h = l.add(u).unit().mult(-1 * e / Math.sin(c / 2)); r.push(a.add(h)); } return r }, t.av = Ey, t.aw = Ep, t.ax = function (e, r, n = 0) { return t.v.fromValues(((r.x - n) * e.scale - e.x) * Cr, (r.y * e.scale - e.y) * Cr, rp(r.z, r.y)) }, t.ay = sx, t.az = function (t) { let e = 1 / 0, r = 1 / 0, n = -1 / 0, i = -1 / 0; for (const s of t) e = Math.min(e, s.x), r = Math.min(r, s.y), n = Math.max(n, s.x), i = Math.max(i, s.y); return { min: new x(e, r), max: new x(n, i) } }, t.b = Qh, t.b$ = 0, t.b0 = Ho, t.b1 = tl, t.b2 = Wo, t.b3 = function (t, e, r) { const n = Math.sqrt(t * t + e * e + r * r), i = n > 0 ? Math.acos(r / n) * b : 0; let s = 0 !== t || 0 !== e ? Math.atan2(-e, -t) * b + 90 : 0; return s < 0 && (s += 360), [n, s, i] }, t.b4 = Rg, t.b5 = Ug, t.b6 = Vg, t.b7 = Jo, t.b8 = class extends Xo { constructor(t) { super(t), this.current = nl; } set(t, e, r) { if (this.fetchUniformLocation(t, e)) for (let t = 0; t < 9; t++)if (r[t] !== this.current[t]) { this.current = r, this.gl.uniformMatrix3fv(this.location, !1, r); break } } }, t.b9 = Qo, t.bA = function (e, r) { const n = [0, 0, 0], i = Dh(_h(r.canonical)); return t.v.transformMat4(n, n, i), t.v.transformMat4(n, n, e), n }, t.bB = t => ({ u_camera_to_center_distance: new Wo(t), u_extrude_scale: new sl(t), u_device_pixel_ratio: new Wo(t), u_matrix: new rl(t), u_inv_rot_matrix: new rl(t), u_merc_center: new Ho(t), u_tile_id: new Jo(t), u_zoom_transition: new Wo(t), u_up_dir: new Jo(t), u_emissive_strength: new Wo(t) }), t.bC = t => ({ u_matrix: new rl(t), u_pixels_to_tile_units: new sl(t), u_device_pixel_ratio: new Wo(t), u_units_to_pixels: new Ho(t), u_dash_image: new Ko(t), u_gradient_image: new Ko(t), u_image_height: new Wo(t), u_texsize: new Ho(t), u_tile_units_to_pixels: new Wo(t), u_alph
vendor: 5,861 bytes, line 36
36a_discard_threshold: new Wo(t), u_trim_offset: new Ho(t), u_emissive_strength: new Wo(t) }), t.bD = t => ({ u_matrix: new rl(t), u_texsize: new Ho(t), u_pixels_to_tile_units: new sl(t), u_device_pixel_ratio: new Wo(t), u_image: new Ko(t), u_units_to_pixels: new Ho(t), u_tile_units_to_pixels: new Wo(t), u_alpha_discard_threshold: new Wo(t) }), t.bE = io, t.bF = lm, t.bG = dm, t.bH = Np, t.bI = (t, e, r, n, i, s) => { const a = t.transform, o = "globe" === a.projection.name; let l; if ("map" === s.paint.get("circle-pitch-alignment")) if (o) { const t = Lh(a.zoom, e.canonical) * a._pixelsPerMercatorPixel; l = Float32Array.from([t, 0, 0, t]); } else l = a.calculatePixelsToTileUnitsMatrix(r); else l = new Float32Array([a.pixelsToGLUnits[0], 0, 0, a.pixelsToGLUnits[1]]); const u = { u_camera_to_center_distance: t.transform.getCameraToCenterDistance(a.projection), u_matrix: t.translatePosMatrix(e.projMatrix, r, s.paint.get("circle-translate"), s.paint.get("circle-translate-anchor")), u_device_pixel_ratio: Wt.devicePixelRatio, u_extrude_scale: l, u_inv_rot_matrix: Up, u_merc_center: [0, 0], u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_up_dir: [0, 0, 0], u_emissive_strength: s.paint.get("circle-emissive-strength") }; if (o) { u.u_inv_rot_matrix = n, u.u_merc_center = i, u.u_tile_id = [e.canonical.x, e.canonical.y, 1 << e.canonical.z], u.u_zoom_transition = Oh(a.zoom); const t = i[0] * Cr, r = i[1] * Cr; u.u_up_dir = a.projection.upVector(new Kc(0, 0, 0), t, r); } return u }, t.bJ = _v, t.bK = (t, e, r, n, i) => { const s = t.transform; return { u_matrix: bv(t, e, r, n), u_texsize: e.imageAtlasTexture ? e.imageAtlasTexture.size : [0, 0], u_pixels_to_tile_units: s.calculatePixelsToTileUnitsMatrix(e), u_device_pixel_ratio: i, u_image: 0, u_tile_units_to_pixels: vv(e, s), u_units_to_pixels: [1 / s.pixelsToGLUnits[0], 1 / s.pixelsToGLUnits[1]], u_alpha_discard_threshold: 0 } }, t.bL = (t, e, r, n, i, s, a) => { const o = t.transform, l = o.calculatePixelsToTileUnitsMatrix(e); return { u_matrix: bv(t, e, r, n), u_pixels_to_tile_units: l, u_device_pixel_ratio: s, u_units_to_pixels: [1 / o.pixelsToGLUnits[0], 1 / o.pixelsToGLUnits[1]], u_dash_image: 0, u_gradient_image: 1, u_image_height: i, u_texsize: wv(r) && e.lineAtlasTexture ? e.lineAtlasTexture.size : [0, 0], u_tile_units_to_pixels: vv(e, t.transform), u_alpha_discard_threshold: 0, u_trim_offset: a, u_emissive_strength: r.paint.get("line-emissive-strength") } }, t.bM = L, t.bN = nf, t.bO = lv, t.bP = Qc, t.bQ = tv, t.bR = $x, t.bS = 450, t.bT = 7, t.bU = Mh, t.bV = Ch, t.bW = Ua, t.bX = mo, t.bY = co, t.bZ = 1, t.b_ = 771, t.ba = A, t.bb = function (t, e, r) { const n = Oh(r.zoom), i = t.style.map._antialias, s = e.options.extStandardDerivativesForceOff || t.terrain && t.terrain.exaggeration() > 0; return 0 === n && !i && !s }, t.bc = function (e) { const r = e.pixelsPerMeter, n = r / Qh(1, e.center.lat), i = t.m.identity(new Float64Array(16)); return t.m.translate(i, i, [e.point.x, e.point.y, 0]), t.m.scale(i, i, [n, n, r]), Float32Array.from(i) }, t.bd = se, t.be = Ih, t.bf = function (t) { const e = np - 5; t = k(t, -e, e) / e * 90; const r = Math.pow(Math.abs(Math.sin(_(t))), 3); return Math.round(r * (fh.length - 1)) }, t.bg = function (e, r, n, i) { const s = r.getNorth(), a = r.getSouth(), o = r.getWest(), l = r.getEast(), u = 1 << e.z, c = l - o, h = s - a, p = c / ph, f = -h / fh[n], d = [0, p, 0, f, 0, 0, s, o, 0]; if (e.z > 0) { const e = 180 / i; t.bx.multiply(d, d, [e / c + 1, 0, 0, 0, e / h + 1, 0, -.5 * e / p, .5 * e / f, 1]); } return d[2] = u, d[5] = e.x, d[8] = e.y, d }, t.bh = Dh, t.bi = _h, t.bj = function (e, r, n) { const i = t.m.identity(new Float64Array(16)), s = (r / (1 << e) - .5) * Math.PI * 2; return t.m.rotateY(i, n.globeMatrix, s), Float32Array.from(i) }, t.bk = class { isDataAvailableAtPoint(t) { const e = this._source(); if (this.isUsingMockSource() || !e || t.y < 0 || t.y > 1) return !1; const r = e.getSource().maxzoom, n = 1 << r, i = Math.floor(t.x), s = Math.floor((t.x - i) * n), a = Math.floor(t.y * n), o = this.findDEMTileFor(new Hc(r, i, r, s, a)); return !(!o || !o.dem) } getAtPointOrZero(t, e = 0) { return this.getAtPoint(t, e) || 0 } getAtPoint(t, e, r = !0) { if (this.isUsingMockSource()) return null; null == e && (e = null); const n = this._source(); if (!n) return e; if (t.y < 0 || t.y > 1) return e; const i = n.getSource().maxzoom, s = 1 << i, a = Math.floor(t.x), o = t.x - a, l = new Hc(i, a, i, Math.floor(o * s), Math.floor(t.y * s)), u = this.findDEMTileFor(l); if (!u || !u.dem) return e; const c = u.dem, h = 1 << u.tileID.canonical.z, p = (o * h - u.tileID.canonical.x) * c.dim, f = (t.y * h - u.tileID.canonical.y) * c.dim, d = Math.floor(p), m = Math.floor(f); return (r ? this.exaggeration() : 1) * Mn(Mn(c.get(d, m), c.get(d, m + 1), f - m), Mn(c.get(d + 1, m), c.get(d + 1, m + 1), f - m), p - d) } getAtTileOffset(t, e, r) { const n = 1 << t.canonical.z; return this.getAtPointOrZero(new lp(t.wrap + (t.canonical.x + e / Cr) / n, (t.canonical.y + r / Cr) / n)) } getAtTileOffsetFunc(e, r, n, i) { return s => { const a = this.getAtTileOffset(e, s.x, s.y), o = i.upVector(e.canonical, s.x, s.y), l = i.upVectorScale(e.canonical, r, n).metersToTile; return t.v.scale(o, o, a * l), o } } getForTilePoints(t, e, r, n) { if (this.isUsingMockSource()) return !1; const i = Wd.create(this, t, n); return !!i && (e.forEach((t => { t[2] = this.exaggeration() * i.getElevationAt(t[0], t[1], r); })), !0) } getMinMaxForTile(t) { if (this.isUsingMockSource()) return null; const e = this.findDEMTileFor(t); if (!e || !e.dem) return null; const r = e.dem.tree, n = e.tileID, i = 1 << t.canonical.z - n.canonical.z; let s = t.canonical.x / i - n.canonical.x, a = t.canonical.y / i - n.canonical.y, o = 0; for (let e = 0; e < t.canonical.z - n.canonical.z && !r.leaves[o]; e++) { s *= 2, a *= 2;
36 const t = 2 * Math.floor(a) + Math.floor(s); o = r.childOffsets[o] + t, s %= 1, a %= 1; } return { min: this.exaggeration() * r.minimums[o], max: this.exaggeration() * r.maximums[o] } } getMinElevationBelowMSL() { throw new Error("Pure virtual method called.") } raycast(t, e, r) { throw new Error("Pure virtual method called.") } pointCoordinate(t) { throw new Error("Pure virtual method called.") } _source() { throw new Error("Pure virtual method called.") } isUsingMockSource() { throw new Error("Pure virtual method called.") } exaggeration() { throw new Error("Pure virtual method called.") } findDEMTileFor(t) { throw new Error("Pure virtual method called.") } get visibleDemTiles() { throw new Error("Getter must be implemented in subclass.") } getMinMaxForVisibleTiles() { const t = this.visibleDemTiles; if (0 === t.length) return null; let e = !1, r = Number.MAX_VALUE, n = Number.MIN_VALUE; for (const i of t) { const t = this.getMinMaxForTile(i.tileID); t && (r = Math.min(r, t.min), n = Math.max(n, t.max), e = !0); } return e ? { min: r, max: n } : null } }, t.bl = Yc, t.bm = Do, t.bn = gh, t.bo = $a, t.bp = ao, t.bq = Ng, t.br = Nv, t.bs = eb, t.bt = Bg, t.bu = tf, t.bv = function (t, e) { return [Math.pow(t[0], 2.2) * e, Math.pow(t[1], 2.2) * e, Math.pow(t[2], 2.2) * e] }, t.bw = function (t) { return [Math.pow(t[0], 1 / 2.2), Math.pow(t[1], 1 / 2.2), Math.pow(t[2], 1 / 2.2)] }, t.by = Lh, t.bz = 256, t.c = k, t.c$ = e, t.c0 = ho, t.c1 = function (t, e, r, n, i) { return k((t - e) / (r - e) * (i - n) + n, n, i) }, t.c2 = bi, t.c3 = oh, t.c4 = sp, t.c5 = lx, t.c6 = [1, 1, 1], t.c7 = Wd, t.c8 = cx, t.c9 = eo, t.cA = U, t.cB = t => Ns(Ds(t)), t.cC = ga, t.cD = ft, t.cE = S, t.cF = function () { return !!document.fullscreenElement || !!document.webkitFullscreenElement }, t.cG = I, t.cH = ap, t.cI = Ph, t.cJ = function ([t, e, r]) { const n = Math.hypot(t, e, r), i = Math.atan2(t, r), s = .5 * Math.PI - Math.acos(-e / n); return new Zh(w(i), w(s)) }, t.cK = tp, t.cL = qh, t.cM = n, t.cN = jh, t.cO = Fh, t.cP = function (e) { const r = [0, 0, 0], n = t.m.identity(new Float64Array(16)); return t.m.multiply(n, e.pixelMatrix, e.globeMatrix), t.v.transformMat4(r, r, n), new x(r[0], r[1]) }, t.cQ = function (t) { const e = t.navigator ? t.navigator.userAgent : null; return !!function (t) { if (null == W) { const e = t.navigator ? t.navigator.userAgent : null; W = !!t.safari || !(!e || !(/\b(iPad|iPhone|iPod)\b/.test(e) || e.match("Safari") && !e.match("Chrome"))); } return W }(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.cR = C, t.cS = class { constructor(t, e, r) { this._transformRequestFn = t, this._customAccessToken = e, this._silenceAuthErrors = !!r, 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", h, 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, r) { if (!_t(t)) return t; const n = kt(t); return n.params.push(`sdk=js-${e}`), n.path = `/styles/v1${n.path}`, this._makeAPIURL(n, this._customAccessToken || r) } normalizeGlyphsURL(t, e) { if (!_t(t)) return t; const r = kt(t); return r.path = `/fonts/v1${r.path}`, this._makeAPIURL(r, this._customAccessToken || e) } normalizeModelURL(t, e) { if (!_t(t)) return t; const r = kt(t); return r.path = `/models/v1${r.path}`, this._makeAPIURL(r, this._customAccessToken || e) } normalizeSourceURL(t, e, r, n) { if (!_t(t)) return t; const i = kt(t); return i.path = `/v4/${i.authority}.json`, i.params.push("secure"), r && i.params.push(`language=${r}`), n && i.params.push(`worldview=${n}`), this._makeAPIURL(i, this._customAccessToken || e) } normalizeSpriteURL(t, e, r, n) { const i = kt(t); return _t(t) ? (i.path = `/styles/v1${i.path}/sprite${e}${r}`, this._makeAPIURL(i, this._customAccessToken || n)) : (i.path += `${e}${r}`, Tt(i)) } normalizeTileURL(t, e, r) { if (this._isSkuTokenExpired() && this._createSkuToken(), t && !_t(t)) return t; const s = kt(t); s.path = s.path.replace(/(\.(png|jpg)\d*)(?=$)/, `${e || r && "raster" !== s.authority && 512 === r ? "@2x" : ""}${i.supported ? ".webp" : "$1"}`), "raster" === s.authority ? s.path = `/${n.RASTER_URL_PREFIX}${s.path}` : (s.path = s.path.replace(/^.+\/v4\//, "/"), s.path = `/${n.TILE_URL_VERSION}${s.path}`); const a = this._customAccessToken || function (t) { for (const e of t) { const t = e.match(/^access_token=(.*)$/); if (t) return t[1] } return null }(s.params) || n.ACCESS_TOKEN; return n.REQUIRE_ACCESS_TOKEN && a && this._skuToken && s.params.push(`sku=${this._skuToken}`), this._makeAPIURL(s, a) } canonicalizeTileURL(t, e) { const r = kt(t); if (!r.path.match(/^(\/v4\/|\/raster\/v1\/)/) || !r.path.match(/\.[\w]+$/)) return t; let i = "mapbox://"; r.path.match(/^\/raster\/v1\//) ? i += `raster/${r.path.replace(`/${n.RASTER_URL_PREFIX}/`, "")}` : i += `tiles/${r.path.replace(`/${n.TILE_URL_VERSION}/`, "")}`; let s = r.params; return e && (s = s.filter((t => !t.match(/^access_token=/)))), s.length && (i += `?${s.join("&")}`), i } canonicalizeTileset(t, e) { const r = !!e && _t(e), n = []; for (const e of t.tiles || []) wt(e) ? n.push(this.canonicalizeTileURL(e, r)) : n.push(e); return n } _makeAPIURL(t, e) { const r = "See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes", i = kt(n.API_URL); if (t.protocol = i.protocol, t.authority = i.authority, "http" === t.protocol) { const e = t.params.indexOf("secure"); e >= 0 && t.params.splice(e, 1); } if ("/" !== i.path && (t.path = `${i.path}${t.path}`), !n.REQUIRE_ACCESS_TOKEN) return Tt(t); if (e = e || n.ACCESS_TOKEN, !this._silenceAuthErrors) { if (!e) throw new Error(`An API access token is required to use Mapbox GL. ${r}`); if ("s" === e[0]) throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`) } return t.params = t.params.filter((t => -1 === t.indexOf("access_token"))), t.params.push(`access_token=${e || ""}`), Tt(t) } }, t.cT = function (t, e) { e ? jt.add(t) : jt.delete(t); }, t.cU = i, t.cV = Vt, t.cW = Ft, t.cX = bt, t.cY = Rt, t.cZ = function (t) { jt.delete(t); }, t.c_ = z, t.ca = class { constructor() { this._updateTime = 0, this._sourceIds = [], this._activeRegions = [], this._prevRegions = []; } clear() { this._activeRegions.length > 0 && ++this._updateTime, this._activeRegions = [], this._prevRegions = []; } get updateTime() { return this._updateTime } getReplacementRegionsForTile(t) { const e = Dx(new x(0, 0), new x(Cr, Cr), t), r = []; for (const n of this._activeRegions) { if (n.hiddenByOverlap) continue; if (!Bx(e, n)) continue; const i = Cx(n.min, n.max, t); r.push({ min: i.min, max: i.max, sourceId: this._sourceIds[n.priority], footprint: n.footprint, footprintTileId: n.tileId }); } return r } setSources(t) { this._setSources(t.map((t => ({ getSourceId: () => t.cache.id, getFootprints: () => { const e = [];
vendor: 7,112 bytes, line 36
36 for (const r of t.cache.getVisibleCoordinates()) { const n = t.cache.getTile(r).buckets[t.layer]; if (n) for (const t of n.getNodesInfo()) { const n = t.node; n.footprint && e.push({ footprint: n.footprint, id: r.toUnwrapped() }); } } return e } })))); } _addSource(t) { const e = t.getFootprints(); if (0 !== e.length) { for (const t of e) { if (!t.footprint) continue; const e = Dx(t.footprint.min, t.footprint.max, t.id); this._activeRegions.push({ min: e.min, max: e.max, hiddenByOverlap: !1, priority: this._sourceIds.length, tileId: t.id, footprint: t.footprint }); } this._sourceIds.push(t.getSourceId()); } } _computeReplacement() { this._activeRegions.sort(((t, e) => t.priority - e.priority || zx(t.min, e.min) || zx(t.max, e.max))); let t = this._activeRegions.length !== this._prevRegions.length; if (!t) { let e = 0, r = 0; for (; !t && e !== this._activeRegions.length;) { const n = this._activeRegions[e], i = this._prevRegions[r]; t = n.priority !== i.priority || !Ex(n, i), ++e, ++r; } } if (t) { ++this._updateTime; const t = t => { const e = this._activeRegions; if (t >= e.length) return t; const r = e[t].priority; for (; t < e.length && e[t].priority === r;)++t; return t }; if (this._sourceIds.length > 1) { let e = 0, r = t(e); for (; e !== r;) { let n = e; const i = e; for (; n !== r;) { const t = this._activeRegions[n]; t.hiddenByOverlap = !1; for (let e = 0; e < i; e++) { const r = this._activeRegions[e]; if (!r.hiddenByOverlap && Bx(t, r) && (t.hiddenByOverlap = Lx(t.footprint, t.tileId, r.footprint, r.tileId), t.hiddenByOverlap)) break } ++n; } e = r, r = t(e); } } } } _setSources(t) { [this._prevRegions, this._activeRegions] = [this._activeRegions, []], this._sourceIds = []; for (let e = t.length - 1; e >= 0; e--)this._addSource(t[e]); this._computeReplacement(); } }, t.cb = Ga, t.cc = zg, t.cd = fo, t.ce = 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.withSkirts.destroy(), t.withoutSkirts.destroy(); } _fillGridMeshWithLods(t, e) { const r = new $a, n = new ao, i = [], s = t + 1 + 2, a = e[0] + 1, o = e[0] + 1 + (1 + e.length), l = (t, e, r) => { let n = t === s - 1 ? t - 2 : 0 === t ? t : t - 1; return n += r ? 24575 : 0, [n, e] }; for (let t = 0; t < s; ++t)r.emplaceBack(...l(t, 0, !0)); for (let t = 0; t < a; ++t)for (let e = 0; e < s; ++e)r.emplaceBack(...l(e, t, (0 === e || e === s - 1) && !0)); for (let t = 0; t < e.length; ++t) { const n = e[t]; for (let t = 0; t < s; ++t)r.emplaceBack(...l(t, n, !0)); } for (let t = 0; t < e.length; ++t) { const a = n.length, l = e[t] + 1 + 2, u = new ao; for (let r = 0; r < l - 1; r++) { const i = r === l - 2, a = i ? s * (o - e.length + t - r) : s; for (let t = 0; t < s - 1; t++) { const e = r * s + t; 0 === r || i || 0 === t || t === s - 2 ? (u.emplaceBack(e + 1, e, e + a), u.emplaceBack(e + a, e + a + 1, e + 1)) : (n.emplaceBack(e + 1, e, e + a), n.emplaceBack(e + a, e + a + 1, e + 1)); } } const c = Do.simpleSegment(0, a, r.length, n.length - a); for (let t = 0; t < u.uint16.length; t += 3)n.emplaceBack(u.uint16[t], u.uint16[t + 1], u.uint16[t + 2]); const h = Do.simpleSegment(0, a, r.length, n.length - a); i.push({ withoutSkirts: c, withSkirts: h }); } return { vertices: r, indices: n, segments: i } } _createGrid(t) { const e = this._fillGridMeshWithLods(ph, fh); this._gridSegments = e.segments, this._gridBuffer = t.createVertexBuffer(e.vertices, Yc.members), this._gridIndexBuffer = t.createIndexBuffer(e.indices, !0); } _createPoles(t) { const e = new ao; for (let t = 0; t <= ph; t++)e.emplaceBack(0, t + 1, t + 2); this._poleIndexBuffer = t.createIndexBuffer(e, !0); const r = new co, n = new co, i = new co, s = new co; this._poleSegments = []; for (let t = 0, e = 0; t < lh; t++) { const a = 360 / (1 << t); r.emplaceBack(0, -ch, 0, .5, 0), n.emplaceBack(0, -ch, 0, .5, 1), i.emplaceBack(0, -ch, 0, .5, .5), s.emplaceBack(0, -ch, 0, .5, .5); for (let t = 0; t <= ph; t++) { let e = t / ph, o = 0; const l = Mn(0, a, e), [u, c, h] = Th(Nh, $h, l, ch); r.emplaceBack(u, c, h, e, o), n.emplaceBack(u, c, h, e, 1 - o); const p = _(l); e = .5 + .5 * Math.sin(p), o = .5 + .5 * Math.cos(p), i.emplaceBack(u, c, h, e, o), s.emplaceBack(u, c, h, e, 1 - o); } this._poleSegments.push(Do.simpleSegment(e, 0, 66, 64)), e += 66; } this._poleNorthVertexBuffer = t.createVertexBuffer(r, qc, !1), this._poleSouthVertexBuffer = t.createVertexBuffer(n, qc, !1), this._texturedPoleNorthVertexBuffer = t.createVertexBuffer(i, qc, !1), this._texturedPoleSouthVertexBuffer = t.createVertexBuffer(s, qc, !1); } getGridBuffers(t, e) { return [this._gridBuffer, this._gridIndexBuffer, e ? this._gridSegments[t].withSkirts : this._gridSegments[t].withoutSkirts] } getPoleBuffers(t, e) { return [e ? this._texturedPoleNorthVertexBuffer : this._poleNorthVertexBuffer, e ? this._texturedPoleSouthVertexBuffer : this._poleSouthVertexBuffer, this._poleIndexBuffer, this._poleSegments[t]] } }, t.cf = function (t) { return jt.has(t) }, t.cg = op, t.ch = Z, t.ci = function (t) { return t({ pluginStatus: fa, pluginURL: da }), ga.on("pluginStateChange", t), t }, t.cj = iy, t.ck = ny, t.cl = pt, t.cm = ma, t.cn = _t, t.co = N, t.cp = function (t, e, r) { return "custom" === t.type ? new Dv(t, e) : new Ov[t.type](t, e, r) }, t.cq = function (t) { const e = t.indexOf(Ca); return e >= 0 ? t.slice(0, e) : t }, t.cr = t => Ns(zs(t)), t.cs = t => Ns(Ts(t)), t.ct = t => Ns(Bs(t)), t.cu = function (t) { return t.indexOf(Ca) >= 0 }, t.cv = function (t) { const e = t.indexOf(Ca); return e >= 0 ? t.slice(e + 1) : "" }, t.cw = Xi, t.cx = function (t) { const e = [], r = t.id; return void 0 === r && e.push({ message: `layers.${r}: missing required property "id"` }), void 0 === t.render && e.push({ message: `layers.${r}: missing required method "render"` }), t.renderingMode && "2d" !== t.renderingMode && "3d" !== t.renderingMode && e.push({ message: `layers.${r}: property "renderingMode" must be either "2d" or "3d"` }), e }, t.cy = t => Ns(Ss(t)), t.cz = t => Ns(bs(t)), t.d = _, t.d0 = function (t, e) { rt = t, nt = e; }, t.d1 = function (t, e, r = !1) { if (fa === ua || fa === ca || fa === ha) throw new Error("setRTLTextPlugin cannot be called multiple times."); da = Wt.resolveURL(t), fa = ua, pa = e, ya(), r || va(); }, t.d2 = xa, t.d3 = function () { eb().acquire(Jv); }, t.d4 = function () { const t = tb; t && (t.isPreloaded() && 1 === t.numActive() ? (t.release(Jv), tb = 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()")); }, t.d5 = Qv, t.d6 = function (t) { const e = at(); if (!e) return; const r = e.delete(et); t && r.catch(t).then((() => t())); }, t.d7 = Wv, t.d8 = ab, t.d9 = function (t) { nb = Wt.resolveURL(t), sb || (sb = new 
36Nv(eb(), new ee)), sb.broadcast("setDracoUrl", nb); }, t.da = E, t.db = Kd, t.dc = p, t.dd = ud, t.de = Wf, t.df = y, t.dg = fd, t.dh = class extends ee { constructor(t, e, r, n, i, s) { super(), this.actor = t, this.layerIndex = e, this.availableImages = r, this.loadVectorData = i || Kv, this.loading = {}, this.loaded = {}, this.deduped = new Xv(t.scheduler), this.isSpriteLoaded = n, this.scheduler = t.scheduler, this.brightness = s; } loadTile(t, e) { const r = t.uid, n = t && t.request, i = n && n.collectResourceTiming, s = this.loading[r] = new Yv(t); s.abort = this.loadVectorData(t, ((a, o) => { const l = !this.loading[r]; if (delete this.loading[r], l || a || !o) return s.status = "done", l || (this.loaded[r] = s), e(a); const u = o.rawData, c = {}; o.expires && (c.expires = o.expires), o.cacheControl && (c.cacheControl = o.cacheControl), s.vectorTile = o.vectorTile || new ld(new Cd(u)); const h = () => { s.parse(s.vectorTile, this.layerIndex, this.availableImages, this.actor, ((t, r) => { if (t || !r) return e(t); const s = {}; if (i) { const t = $t(n); t.length > 0 && (s.resourceTiming = JSON.parse(JSON.stringify(t))); } e(null, B({ rawTileData: u.slice(0) }, r, c, s)); })); }; this.isSpriteLoaded ? h() : this.once("isSpriteLoaded", (() => { this.scheduler ? this.scheduler.add(h, { type: "parseTile", isSymbolTile: t.isSymbolTile, zoom: t.tileZoom }) : h(); })), this.loaded = this.loaded || {}, this.loaded[r] = s; })); } reloadTile(t, e) { const r = this.loaded, n = t.uid, i = this; if (r && r[n]) { const s = r[n]; s.showCollisionBoxes = t.showCollisionBoxes, s.projection = t.projection, s.brightness = t.brightness, s.tileTransform = zy(t.tileID.canonical, t.projection), s.extraShadowCaster = t.extraShadowCaster; const a = (t, r) => { const n = s.reloadCallback; n && (delete s.reloadCallback, s.parse(s.vectorTile, i.layerIndex, this.availableImages, i.actor, n)), e(t, r); }; "parsing" === s.status ? s.reloadCallback = a : "done" === s.status && (s.vectorTile ? s.parse(s.vectorTile, this.layerIndex, this.availableImages, this.actor, a) : a()); } else e(null, void 0); } abortTile(t, e) { const r = t.uid, n = this.loading[r]; n && (n.abort && n.abort(), delete this.loading[r]), e(); } removeTile(t, e) { const r = this.loaded, n = t.uid; r && r[n] && delete r[n], e(); } }, t.di = $t, t.dj = dt, t.dk = Hd, t.dl = function (t) { let e = 0; if (new Uint32Array(t, 0, 1)[0] !== mb) { const r = new Uint32Array(t, 0, 7), [, , n, i, s, a] = r; e = r.byteLength + i + s + a + s, (n !== t.byteLength || e >= t.byteLength) && q("Invalid b3dm header information."); } return _b(t, e) }, t.dm = function (t, e) { const r = zb(t); for (const t of r) { for (const e of t.meshes) Eb(e); t.lights && (t.lightMeshIndex = t.meshes.length, t.meshes.push(Bb(t.lights, e))); } return r }, t.dn = Ix, t.dp = Uv, t.dq = ba, t.dr = function (t) { ot(), it && it.then((e => { e.keys().then((r => { for (let n = 0; n < r.length - t; n++)e.delete(r[n]); })); })); }, t.f = function (e, r) { const { x: n, y: i } = e.point, s = Vh(n, i, e.worldSize / e._pixelsPerMercatorPixel, 0, 0); return t.m.multiply(s, s, Ch(_h(r))) }, t.g = J, t.i = fm, t.j = pm, t.k = lg, t.l = ep, t.n = Mn, t.o = Jy, t.p = function (t, e) { const r = {}; for (let n = 0; n < e.length; n++) { const i = e[n]; i in t && (r[i] = t[i]); } return r }, t.r = tx, t.s = function (t, e, r) { t[4 * e + 0] = r[0], t[4 * e + 1] = r[1], t[4 * e + 2] = r[2], t[4 * e + 3] = r[3]; }, t.t = Kc, t.u = function (t, e, r, n, i) { const s = 5 * e + 2; t.float32[s + 0] = r, t.float32[s + 1] = n, t.float32[s + 2] = i; }, t.w = P, t.x = Sh, t.y = function (t, e, r, n, i, s, a, o, l) { if ("globe" === l.name) return Sh(t, e, new Kc(r, n, i), !1); const u = zy({ z: r, x: n, y: i }, l); return new oh([(s + u.x / u.scale) * e, e * (u.y / u.scale), a], [(s + u.x2 / u.scale) * e, e * (u.y2 / u.scale), o]) }, t.z = function (t, e, r) { let n = 0; for (let i = 0; i < 2; ++i) { const s = r ? r[i] : 0; t[i] > s && (n += (t[i] - s) * (t[i] - s)), e[i] < s && (n += (s - e[i]) * (s - e[i])); } return n };
37    }));
38
39    define(["./shared"], (function (e) { "use strict"; function t(e) { if ("number" == typeof e || "boolean" == typeof e || "string" == typeof e || null == e) return JSON.stringify(e); if (Array.isArray(e)) { let r = "["; for (const o of e) r += `${t(o)},`; return `${r}]` } let r = "{"; for (const o of Object.keys(e).sort()) r += `${o}:${t(e[o])},`; return `${r}}` } function r(r) { let o = ""; for (const i of e.aS) o += `/${t(r[i])}`; return o } class o { constructor(e) { this.keyCache = {}, this._layers = {}, this._layerConfigs = {}, e && this.replace(e); } replace(e, t) { this._layerConfigs = {}, this._layers = {}, this.update(e, [], t); } update(t, o, i) { this._options = i; for (const r of t) this._layerConfigs[r.id] = r, (this._layers[r.id] = e.cp(r, this.scope, this._options)).compileFilter(), this.keyCache[r.id] && delete this.keyCache[r.id]; for (const e of o) delete this.keyCache[e], delete this._layerConfigs[e], delete this._layers[e]; this.familiesBySource = {}; const s = function (e, t) { const o = {}; for (let i = 0; i < e.length; i++) { const s = t && t[e[i].id] || r(e[i]); t && (t[e[i].id] = s); let n = o[s]; n || (n = o[s] = []), n.push(e[i]); } const i = []; for (const e in o) i.push(o[e]); return i }(e.da(this._layerConfigs), this.keyCache); for (const e of s) { const t = e.map((e => this._layers[e.id])), r = t[0]; if ("none" === r.visibility) continue; const o = r.source || ""; let i = this.familiesBySource[o]; i || (i = this.familiesBySource[o] = {}); const s = r.sourceLayer || "_geojsonTileLayer"; let n = i[s]; n || (n = i[s] = []), n.push(t); } } } class i { loadTile(t, r) { const { uid: o, encoding: i, rawImageData: s, padding: n } = t, a = ImageBitmap && s instanceof ImageBitmap ? this.getImageData(s, n) : s; r(null, new e.db(o, a, i, n < 1)); } getImageData(e, t) { this.offscreenCanvas && this.offscreenCanvasContext || (this.offscreenCanvas = new OffscreenCanvas(e.width, e.height), this.offscreenCanvasContext = this.offscreenCanvas.getContext("2d", { willReadFrequently: !0 })), this.offscreenCanvas.width = e.width, this.offscreenCanvas.height = e.height, this.offscreenCanvasContext.drawImage(e, 0, 0, e.width, e.height); const r = this.offscreenCanvasContext.getImageData(-t, -t, e.width + 2 * t, e.height + 2 * t); return this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height), r } } function s(e, t) { if (0 !== e.length) { n(e[0], t); for (var r = 1; r < e.length; r++)n(e[r], !t); } } function n(e, t) { for (var r = 0, o = 0, i = 0, s = e.length, n = s - 1; i < s; n = i++) { var a = (e[i][0] - e[n][0]) * (e[n][1] + e[i][1]), l = r + a; o += Math.abs(r) >= Math.abs(a) ? r - l + a : a - l + r, r = l; } r + o >= 0 != !!t && e.reverse(); } var a = e.dc((function e(t, r) { var o, i = t && t.type; if ("FeatureCollection" === i) for (o = 0; o < t.features.length; o++)e(t.features[o], r); else if ("GeometryCollection" === i) for (o = 0; o < t.geometries.length; o++)e(t.geometries[o], r); else if ("Feature" === i) e(t.geometry, r); else if ("Polygon" === i) s(t.coordinates, r); else if ("MultiPolygon" === i) for (o = 0; o < t.coordinates.length; o++)s(t.coordinates[o], r); return t })); const l = e.dd.prototype.toGeoJSON;
vendor: 5,686 bytes, line 39
39 var h = { exports: {} }, u = e.df, c = e.de.VectorTileFeature, d = f; function f(e, t) { this.options = t || {}, this.features = e, this.length = e.length; } function p(e, t) { this.id = "number" == typeof e.id ? e.id : void 0, this.type = e.type, this.rawGeometry = 1 === e.type ? [e.geometry] : e.geometry, this.properties = e.tags, this.extent = t || 4096; } f.prototype.feature = function (e) { return new p(this.features[e], this.options.extent) }, p.prototype.loadGeometry = function () { var e = this.rawGeometry; this.geometry = []; for (var t = 0; t < e.length; t++) { for (var r = e[t], o = [], i = 0; i < r.length; i++)o.push(new u(r[i][0], r[i][1])); this.geometry.push(o); } return this.geometry }, p.prototype.bbox = function () { this.geometry || this.loadGeometry(); for (var e = this.geometry, t = 1 / 0, r = -1 / 0, o = 1 / 0, i = -1 / 0, s = 0; s < e.length; s++)for (var n = e[s], a = 0; a < n.length; a++) { var l = n[a]; t = Math.min(t, l.x), r = Math.max(r, l.x), o = Math.min(o, l.y), i = Math.max(i, l.y); } return [t, o, r, i] }, p.prototype.toGeoJSON = c.prototype.toGeoJSON; var g = e.dg, m = d; function y(e) { var t = new g; return function (e, t) { for (var r in e.layers) t.writeMessage(3, v, e.layers[r]); }(e, t), t.finish() } function v(e, t) { var r; t.writeVarintField(15, e.version || 1), t.writeStringField(1, e.name || ""), t.writeVarintField(5, e.extent || 4096); var o = { keys: [], values: [], keycache: {}, valuecache: {} }; for (r = 0; r < e.length; r++)o.feature = e.feature(r), t.writeMessage(2, w, o); var i = o.keys; for (r = 0; r < i.length; r++)t.writeStringField(3, i[r]); var s = o.values; for (r = 0; r < s.length; r++)t.writeMessage(4, I, s[r]); } function w(e, t) { var r = e.feature; void 0 !== r.id && t.writeVarintField(1, r.id), t.writeMessage(2, x, e), t.writeVarintField(3, r.type), t.writeMessage(4, b, r); } function x(e, t) { var r = e.feature, o = e.keys, i = e.values, s = e.keycache, n = e.valuecache; for (var a in r.properties) { var l = r.properties[a], h = s[a]; if (null !== l) { void 0 === h && (o.push(a), s[a] = h = o.length - 1), t.writeVarint(h); var u = typeof l; "string" !== u && "boolean" !== u && "number" !== u && (l = JSON.stringify(l)); var c = u + ":" + l, d = n[c]; void 0 === d && (i.push(l), n[c] = d = i.length - 1), t.writeVarint(d); } } } function S(e, t) { return (t << 3) + (7 & e) } function M(e) { return e << 1 ^ e >> 31 } function b(e, t) { for (var r = e.loadGeometry(), o = e.type, i = 0, s = 0, n = r.length, a = 0; a < n; a++) { var l = r[a], h = 1; 1 === o && (h = l.length), t.writeVarint(S(1, h)); for (var u = 3 === o ? l.length - 1 : l.length, c = 0; c < u; c++) { 1 === c && 1 !== o && t.writeVarint(S(2, u - 1)); var d = l[c].x - i, f = l[c].y - s; t.writeVarint(M(d)), t.writeVarint(M(f)), i += d, s += f; } 3 === o && t.writeVarint(S(7, 1)); } } function I(e, t) { var r = typeof e; "string" === r ? t.writeStringField(1, e) : "boolean" === r ? t.writeBooleanField(7, e) : "number" === r && (e % 1 != 0 ? t.writeDoubleField(3, e) : e < 0 ? t.writeSVarintField(6, e) : t.writeVarintField(5, e)); } h.exports = y, h.exports.fromVectorTileJs = y, h.exports.fromGeojsonVt = function (e, t) { t = t || {}; var r = {}; for (var o in e) r[o] = new m(e[o].features, t), r[o].name = o, r[o].version = t.version, r[o].extent = t.extent; return y({ layers: r }) }, h.exports.GeoJSONWrapper = m; var k = e.dc(h.exports); const P = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: !1, generateId: !1, reduce: null, map: e => e }, _ = Math.fround || (L = new Float32Array(1), e => (L[0] = +e, L[0])); var L; const T = 3, C = 5, O = 6; class j { constructor(e) { this.options = Object.assign(Object.create(P), e), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = []; } load(e) { const { log: t, minZoom: r, maxZoom: o } = this.options; t && console.time("total time"); const i = `prepare ${e.length} points`; t && console.time(i), this.points = e; const s = []; for (let t = 0; t < e.length; t++) { const r = e[t]; if (!r.geometry) continue; const [o, i] = r.geometry.coordinates, n = _(z(o)), a = _(D(i)); s.push(n, a, 1 / 0, t, -1, 1), this.options.reduce && s.push(0); } let n = this.trees[o + 1] = this._createTree(s); t && console.timeEnd(i); for (let e = o; e >= r; e--) { const r = +Date.now(); n = this.trees[e] = this._createTree(this._cluster(n, e)), t && console.log("z%d: %d clusters in %dms", e, n.numItems, +Date.now() - r); } return t && console.timeEnd("total time"), this } getClusters(e, t) { let r = ((e[0] + 180) % 360 + 360) % 360 - 180; const o = Math.max(-90, Math.min(90, e[1])); let i = 180 === e[2] ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180; const s = Math.max(-90, Math.min(90, e[3])); if (e[2] - e[0] >= 360) r = -180, i = 180; else if (r > i) { const e = this.getClusters([r, o, 180, s], t), n = this.getClusters([-180, o, i, s], t); return e.concat(n) } const n = this.trees[this._limitZoom(t)], a = n.range(z(r), D(s), z(i), D(o)), l = n.data, h = []; for (const e of a) { const t = this.stride * e; h.push(l[t + C] > 1 ? Z(l, t, this.clusterProps) : this.points[l[t + T]]); } return h } getChildren(e) { const t = this._getOriginId(e), r = this._getOriginZoom(e), o = "No cluster with the specified id.", i = this.trees[r]; if (!i) throw new Error(o); const s = i.data; if (t * this.stride >= s.length) throw new Error(o); const n = this.options.radius / (this.options.extent * Math.pow(2, r - 1)), a = i.within(s[t * this.stride], s[t * this.stride + 1], n), l = []; for (const t of a) { const r = t * this.stride; s[r + 4] === e && l.push(s[r + C] >
vendor: 2,866 bytes, line 39
39 1 ? Z(s, r, this.clusterProps) : this.points[s[r + T]]); } if (0 === l.length) throw new Error(o); return l } getLeaves(e, t, r) { const o = []; return this._appendLeaves(o, e, t = t || 10, r = r || 0, 0), o } getTile(e, t, r) { const o = this.trees[this._limitZoom(e)], i = Math.pow(2, e), { extent: s, radius: n } = this.options, a = n / s, l = (r - a) / i, h = (r + 1 + a) / i, u = { features: [] }; return this._addTileFeatures(o.range((t - a) / i, l, (t + 1 + a) / i, h), o.data, t, r, i, u), 0 === t && this._addTileFeatures(o.range(1 - a / i, l, 1, h), o.data, i, r, i, u), t === i - 1 && this._addTileFeatures(o.range(0, l, a / i, h), o.data, -1, r, i, u), u.features.length ? u : null } getClusterExpansionZoom(e) { let t = this._getOriginZoom(e) - 1; for (; t <= this.options.maxZoom;) { const r = this.getChildren(e); if (t++, 1 !== r.length) break; e = r[0].properties.cluster_id; } return t } _appendLeaves(e, t, r, o, i) { const s = this.getChildren(t); for (const t of s) { const s = t.properties; if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(e, s.cluster_id, r, o, i) : i < o ? i++ : e.push(t), e.length === r) break } return i } _createTree(t) { const r = new e.aZ(t.length / this.stride | 0, this.options.nodeSize, Float32Array); for (let e = 0; e < t.length; e += this.stride)r.add(t[e], t[e + 1]); return r.finish(), r.data = t, r } _addTileFeatures(e, t, r, o, i, s) { for (const n of e) { const e = n * this.stride, a = t[e + C] > 1; let l, h, u; if (a) l = F(t, e, this.clusterProps), h = t[e], u = t[e + 1]; else { const r = this.points[t[e + T]]; l = r.properties; const [o, i] = r.geometry.coordinates; h = z(o), u = D(i); } const c = { type: 1, geometry: [[Math.round(this.options.extent * (h * i - r)), Math.round(this.options.extent * (u * i - o))]], tags: l }; let d; d = a || this.options.generateId ? t[e + T] : this.points[t[e + T]].id, void 0 !== d && (c.id = d), s.features.push(c); } } _limitZoom(e) { return Math.max(this.options.minZoom, Math.min(Math.floor(+e), this.options.maxZoom + 1)) } _cluster(e, t) { const { radius: r, extent: o, reduce: i, minPoints: s } = this.options, n = r / (o * Math.pow(2, t)), a = e.data, l = [], h = this.stride; for (let r = 0; r < a.length; r += h) { if (a[r + 2] <= t) continue; a[r + 2] = t; const o = a[r], u = a[r + 1], c = e.within(a[r], a[r + 1], n), d = a[r + C]; let f = d; for (const e of c) { const r = e * h; a[r + 2] > t && (f += a[r + C]); } if (f > d && f >= s) { let e, s = o * d, n = u * d, p = -1; const g = ((r / h | 0) << 5) + (t + 1) + this.points.length; for (const o of c) { const l = o * h; if (a[l + 2] <= t) continue; a[l + 2] = t; const u = a[l + C]; s += a[l] * u, n += a[l + 1] * u, a[l + 4] = g, i && (e || (e = this._map(a, r, !0), p = this.clusterProps.length, this.clusterProps.push(e)), i(e, this._map(a, l))); }
39 a[r + 4] = g, l.push(s / f, n / f, 1 / 0, g, -1, f), i && l.push(p); } else { for (let e = 0; e < h; e++)l.push(a[r + e]); if (f > 1) for (const e of c) { const r = e * h; if (!(a[r + 2] <= t)) { a[r + 2] = t; for (let e = 0; e < h; e++)l.push(a[r + e]); } } } } return l } _getOriginId(e) { return e - this.points.length >> 5 } _getOriginZoom(e) { return (e - this.points.length) % 32 } _map(e, t, r) { if (e[t + C] > 1) { const o = this.clusterProps[e[t + O]]; return r ? Object.assign({}, o) : o } const o = this.points[e[t + T]].properties, i = this.options.map(o); return r && i === o ? Object.assign({}, i) : i } } function Z(e, t, r) { return { type: "Feature", id: e[t + T], properties: F(e, t, r), geometry: { type: "Point", coordinates: [(o = e[t], 360 * (o - .5)), E(e[t + 1])] } }; var o; } function F(e, t, r) { const o = e[t + C], i = o >= 1e4 ? `${Math.round(o / 1e3)}k` : o >= 1e3 ? Math.round(o / 100) / 10 + "k" : o, s = e[t + O], n = -1 === s ? {} : Object.assign({}, r[s]); return Object.assign(n, { cluster: !0, cluster_id: e[t + T], point_count: o, point_count_abbreviated: i }) } function z(e) { return e / 360 + .5 } function D(e) { const t = Math.sin(e * Math.PI / 180), r = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI; return r < 0 ? 0 : r > 1 ? 1 : r } function E(e) { const t = (180 - 360 * e) * Math.PI / 180; return 360 * Math.atan(Math.exp(t)) / Math.PI - 90 } var J = { exports: {} }; J.exports = function () { function e(r, o, i, s) { for (var n, a = s, l = i - o >> 1, h = i - o, u = r[o], c = r[o + 1], d = r[i], f = r[i + 1], p = o + 3; p < i; p += 3) { var g = t(r[p], r[p + 1], u, c, d, f); if (g > a) n = p, a = g; else if (g === a) { var m = Math.abs(p - l); m < h && (n = p, h = m); } } a > s && (n - o > 3 && e(r, o, n, s), r[n + 2] = a, i - n > 3 && e(r, n, i, s)); } function t(e, t, r, o, i, s) { var n = i - r, a = s - o; if (0 !== n || 0 !== a) { var l = ((e - r) * n + (t - o) * a) / (n * n + a * a); l > 1 ? (r = i, o = s) : l > 0 && (r += n * l, o += a * l); } return (n = e - r) * n + (a = t - o) * a } function r(e, t, r, i) { var s = { id: void 0 === e ? null : e, type: t, geometry: r, tags: i, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }; return function (e) { var t = e.geometry, r = e.type; if ("Point" === r || "MultiPoint" === r || "LineString" === r) o(e, t); else if ("Polygon" === r || "MultiLineString" === r) for (var i = 0; i < t.length; i++)o(e, t[i]); else if ("MultiPolygon" === r) for (i = 0; i < t.length; i++)for (var s = 0; s < t[i].length; s++)o(e, t[i][s]); }(s), s } function o(e, t) { for (var r = 0; r < t.length; r += 3)e.minX = Math.min(e.minX, t[r]), e.minY = Math.min(e.minY, t[r + 1]), e.maxX = Math.max(e.maxX, t[r]), e.maxY = Math.max(e.maxY, t[r + 1]); } function i(e, t, o, l) { if (t.geometry) { var h = t.geometry.coordinates, u = t.geometry.type, c = Math.pow(o.tolerance / ((1 << o.maxZoom) * o.extent), 2), d = [], f = t.id; if (o.promoteId ? f = t.properties[o.promoteId] : o.generateId && (f = l || 0), "Point" === u) s(h, d); else if ("MultiPoint" === u) for (var p = 0; p < h.length; p++)s(h[p], d); else if ("LineString" === u) n(h, d, c, !1); else if ("MultiLineString" === u) { if (o.lineMetrics) { for (p = 0; p < h.length; p++)n(h[p], d = [], c, !1), e.push(r(f, "LineString", d, t.properties)); return } a(h, d, c, !1); } else if ("Polygon" === u) a(h, d, c, !0); else { if ("MultiPolygon" !== u) { if ("GeometryCollection" === u) { for (p = 0; p < t.geometry.geometries.length; p++)i(e, { id: f, geometry: t.geometry.geometries[p], properties: t.properties }, o, l); return } throw new Error("Input data is not a valid GeoJSON object.") } for (p = 0; p < h.length; p++) { var g = []; a(h[p], g, c, !0), d.push(g); } } e.push(r(f, u, d, t.properties)); } } function s(e, t) { t.push(l(e[0])), t.push(h(e[1])), t.push(0); } function n(t, r, o, i) { for (var s, n, a = 0, u = 0; u < t.length; u++) { var c = l(t[u][0]), d = h(t[u][1]); r.push(c), r.push(d), r.push(0), u > 0 && (a += i ? (s * d - c * n) / 2 : Math.sqrt(Math.pow(c - s, 2) + Math.pow(d - n, 2))), s = c, n = d; } var f = r.length - 3; r[2] = 1, e(r, 0, f, o), r[f + 2] = 1, r.size = Math.abs(a), r.start = 0, r.end = r.size; } function a(e, t, r, o) { for (var i = 0; i < e.length; i++) { var s = []; n(e[i], s, r, o), t.push(s); } } function l(e) { return e / 360 + .5 } function h(e) { var t = Math.sin(e * Math.PI / 180), r = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI; return r < 0 ? 0 : r > 1 ? 1 : r } function u(e, t, o, i, s, n, a, l) { if (i /= t, n >= (o /= t) && a < i) return e; if (a < o || n >= i) return null; for (var h = [], u = 0; u < e.length; u++) { var f = e[u], g = f.geometry, m = f.type, y = 0 === s ? f.minX : f.minY, v = 0 === s ? f.maxX : f.maxY; if (y >= o && v < i) h.push(f); else if (!(v < o || y >= i)) { var w = []; if ("Point" === m || "MultiPoint" === m) c(g, w, o, i, s); else if ("LineString" === m) d(g, w, o, i, s, !1, l.lineMetrics); else if ("MultiLineString" === m) p(g, w, o, i, s, !1); else if ("Polygon" === m) p(g, w, o, i, s, !0); else if ("MultiPolygon" === m) for (var x = 0; x < g.length; x++) { var S = []; p(g[x], S, o, i, s, !0), S.length && w.push(S); } if (w.length) { if (l.lineMetrics && "LineString" === m) { for (x = 0; x < w.length;
vendor: 4,942 bytes, line 39
39 x++)h.push(r(f.id, m, w[x], f.tags)); continue } "LineString" !== m && "MultiLineString" !== m || (1 === w.length ? (m = "LineString", w = w[0]) : m = "MultiLineString"), "Point" !== m && "MultiPoint" !== m || (m = 3 === w.length ? "Point" : "MultiPoint"), h.push(r(f.id, m, w, f.tags)); } } } return h.length ? h : null } function c(e, t, r, o, i) { for (var s = 0; s < e.length; s += 3) { var n = e[s + i]; n >= r && n <= o && (t.push(e[s]), t.push(e[s + 1]), t.push(e[s + 2])); } } function d(e, t, r, o, i, s, n) { for (var a, l, h = f(e), u = 0 === i ? m : y, c = e.start, d = 0; d < e.length - 3; d += 3) { var p = e[d], v = e[d + 1], w = e[d + 2], x = e[d + 3], S = e[d + 4], M = 0 === i ? p : v, b = 0 === i ? x : S, I = !1; n && (a = Math.sqrt(Math.pow(p - x, 2) + Math.pow(v - S, 2))), M < r ? b > r && (l = u(h, p, v, x, S, r), n && (h.start = c + a * l)) : M > o ? b < o && (l = u(h, p, v, x, S, o), n && (h.start = c + a * l)) : g(h, p, v, w), b < r && M >= r && (l = u(h, p, v, x, S, r), I = !0), b > o && M <= o && (l = u(h, p, v, x, S, o), I = !0), !s && I && (n && (h.end = c + a * l), t.push(h), h = f(e)), n && (c += a); } var k = e.length - 3; p = e[k], v = e[k + 1], w = e[k + 2], (M = 0 === i ? p : v) >= r && M <= o && g(h, p, v, w), k = h.length - 3, s && k >= 3 && (h[k] !== h[0] || h[k + 1] !== h[1]) && g(h, h[0], h[1], h[2]), h.length && t.push(h); } function f(e) { var t = []; return t.size = e.size, t.start = e.start, t.end = e.end, t } function p(e, t, r, o, i, s) { for (var n = 0; n < e.length; n++)d(e[n], t, r, o, i, s, !1); } function g(e, t, r, o) { e.push(t), e.push(r), e.push(o); } function m(e, t, r, o, i, s) { var n = (s - t) / (o - t); return e.push(s), e.push(r + (i - r) * n), e.push(1), n } function y(e, t, r, o, i, s) { var n = (s - r) / (i - r); return e.push(t + (o - t) * n), e.push(s), e.push(1), n } function v(e, t) { for (var o = [], i = 0; i < e.length; i++) { var s, n = e[i], a = n.type; if ("Point" === a || "MultiPoint" === a || "LineString" === a) s = w(n.geometry, t); else if ("MultiLineString" === a || "Polygon" === a) { s = []; for (var l = 0; l < n.geometry.length; l++)s.push(w(n.geometry[l], t)); } else if ("MultiPolygon" === a) for (s = [], l = 0; l < n.geometry.length; l++) { for (var h = [], u = 0; u < n.geometry[l].length; u++)h.push(w(n.geometry[l][u], t)); s.push(h); } o.push(r(n.id, a, s, n.tags)); } return o } function w(e, t) { var r = []; r.size = e.size, void 0 !== e.start && (r.start = e.start, r.end = e.end); for (var o = 0; o < e.length; o += 3)r.push(e[o] + t, e[o + 1], e[o + 2]); return r } function x(e, t) { if (e.transformed) return e; var r, o, i, s = 1 << e.z, n = e.x, a = e.y; for (r = 0; r < e.features.length; r++) { var l = e.features[r], h = l.geometry, u = l.type; if (l.geometry = [], 1 === u) for (o = 0; o < h.length; o += 2)l.geometry.push(S(h[o], h[o + 1], t, s, n, a)); else for (o = 0; o < h.length; o++) { var c = []; for (i = 0; i < h[o].length; i += 2)c.push(S(h[o][i], h[o][i + 1], t, s, n, a)); l.geometry.push(c); } } return e.transformed = !0, e } function S(e, t, r, o, i, s) { return [Math.round(r * (e * o - i)), Math.round(r * (t * o - s))] } function M(e, t, r, o, i) { for (var s = t === i.maxZoom ? 0 : i.tolerance / ((1 << t) * i.extent), n = { features: [], numPoints: 0, numSimplified: 0, numFeatures: 0, source: null, x: r, y: o, z: t, transformed: !1, minX: 2, minY: 1, maxX: -1, maxY: 0 }, a = 0; a < e.length; a++) { n.numFeatures++, b(n, e[a], s, i); var l = e[a].minX, h = e[a].minY, u = e[a].maxX, c = e[a].maxY; l < n.minX && (n.minX = l), h < n.minY && (n.minY = h), u > n.maxX && (n.maxX = u), c > n.maxY && (n.maxY = c); } return n } function b(e, t, r, o) { var i = t.geometry, s = t.type, n = []; if ("Point" === s || "MultiPoint" === s) for (var a = 0; a < i.length; a += 3)n.push(i[a]), n.push(i[a + 1]), e.numPoints++, e.numSimplified++; else if ("LineString" === s) I(n, i, e, r, !1, !1); else if ("MultiLineString" === s || "Polygon" === s) for (a = 0; a < i.length; a++)I(n, i[a], e, r, "Polygon" === s, 0 === a); else if ("MultiPolygon" === s) for (var l = 0; l < i.length; l++) { var h = i[l]; for (a = 0; a < h.length; a++)I(n, h[a], e, r, !0, 0 === a); } if (n.length) { var u = t.tags || null; if ("LineString" === s && o.lineMetrics) { for (var c in u = {}, t.tags) u[c] = t.tags[c]; u.mapbox_clip_start = i.start / i.size, u.mapbox_clip_end = i.end / i.size; } var d = { geometry: n, type: "Polygon" === s || "MultiPolygon" === s ? 3 : "LineString" === s || "MultiLineString" === s ? 2 : 1, tags: u }; null !== t.id && (d.id = t.id), e.features.push(d); } } function I(e, t, r, o, i, s) { var n = o * o; if (o > 0 && t.size < (i ? n : o)) r.numPoints += t.length / 3; else { for (var a = [], l = 0; l < t.length; l += 3)(0 === o || t[l + 2] > n) && (r.numSimplified++, a.push(t[l]), a.push(t[l + 1])), r.numPoints++; i && function (e, t) { for (var r = 0, o = 0, i = e.length, s = i 
vendor: 7,316 bytes, line 39
39- 2; o < i; s = o, o += 2)r += (e[o] - e[s]) * (e[o + 1] + e[s + 1]); if (r > 0 === t) for (o = 0, i = e.length; o < i / 2; o += 2) { var n = e[o], a = e[o + 1]; e[o] = e[i - 2 - o], e[o + 1] = e[i - 1 - o], e[i - 2 - o] = n, e[i - 1 - o] = a; } }(a, s), e.push(a); } } function k(e, t) { var r = (t = this.options = function (e, t) { for (var r in t) e[r] = t[r]; return e }(Object.create(this.options), t)).debug; if (r && console.time("preprocess data"), t.maxZoom < 0 || t.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range"); if (t.promoteId && t.generateId) throw new Error("promoteId and generateId cannot be used together."); var o = function (e, t) { var r = []; if ("FeatureCollection" === e.type) for (var o = 0; o < e.features.length; o++)i(r, e.features[o], t, o); else i(r, "Feature" === e.type ? e : { geometry: e }, t); return r }(e, t); this.tiles = {}, this.tileCoords = [], r && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", t.indexMaxZoom, t.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), (o = function (e, t) { var r = t.buffer / t.extent, o = e, i = u(e, 1, -1 - r, r, 0, -1, 2, t), s = u(e, 1, 1 - r, 2 + r, 0, -1, 2, t); return (i || s) && (o = u(e, 1, -r, 1 + r, 0, -1, 2, t) || [], i && (o = v(i, 1).concat(o)), s && (o = o.concat(v(s, -1)))), o }(o, t)).length && this.splitTile(o, 0, 0, 0), r && (o.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 P(e, t, r) { return 32 * ((1 << e) * r + t) + e } return k.prototype.options = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: !1, promoteId: null, generateId: !1, debug: 0 }, k.prototype.splitTile = function (e, t, r, o, i, s, n) { for (var a = [e, t, r, o], l = this.options, h = l.debug; a.length;) { o = a.pop(), r = a.pop(), t = a.pop(), e = a.pop(); var c = 1 << t, d = P(t, r, o), f = this.tiles[d]; if (!f && (h > 1 && console.time("creation"), f = this.tiles[d] = M(e, t, r, o, l), this.tileCoords.push({ z: t, x: r, y: o }), h)) { h > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t, r, o, f.numFeatures, f.numPoints, f.numSimplified), console.timeEnd("creation")); var p = "z" + t; this.stats[p] = (this.stats[p] || 0) + 1, this.total++; } if (f.source = e, i) { if (t === l.maxZoom || t === i) continue; var g = 1 << i - t; if (r !== Math.floor(s / g) || o !== Math.floor(n / g)) continue } else if (t === l.indexMaxZoom || f.numPoints <= l.indexMaxPoints) continue; if (f.source = null, 0 !== e.length) { h > 1 && console.time("clipping"); var m, y, v, w, x, S, b = .5 * l.buffer / l.extent, I = .5 - b, k = .5 + b, _ = 1 + b; m = y = v = w = null, x = u(e, c, r - b, r + k, 0, f.minX, f.maxX, l), S = u(e, c, r + I, r + _, 0, f.minX, f.maxX, l), e = null, x && (m = u(x, c, o - b, o + k, 1, f.minY, f.maxY, l), y = u(x, c, o + I, o + _, 1, f.minY, f.maxY, l), x = null), S && (v = u(S, c, o - b, o + k, 1, f.minY, f.maxY, l), w = u(S, c, o + I, o + _, 1, f.minY, f.maxY, l), S = null), h > 1 && console.timeEnd("clipping"), a.push(m || [], t + 1, 2 * r, 2 * o), a.push(y || [], t + 1, 2 * r, 2 * o + 1), a.push(v || [], t + 1, 2 * r + 1, 2 * o), a.push(w || [], t + 1, 2 * r + 1, 2 * o + 1); } } }, k.prototype.getTile = function (e, t, r) { var o = this.options, i = o.extent, s = o.debug; if (e < 0 || e > 24) return null; var n = 1 << e, a = P(e, t = (t % n + n) % n, r); if (this.tiles[a]) return x(this.tiles[a], i); s > 1 && console.log("drilling down to z%d-%d-%d", e, t, r); for (var l, h = e, u = t, c = r; !l && h > 0;)h--, u = Math.floor(u / 2), c = Math.floor(c / 2), l = this.tiles[P(h, u, c)]; return l && l.source ? (s > 1 && console.log("found parent tile z%d-%d-%d", h, u, c), s > 1 && console.time("drilling down"), this.splitTile(l.source, h, u, c, e, t, r), s > 1 && console.timeEnd("drilling down"), this.tiles[a] ? x(this.tiles[a], i) : null) : null }, function (e, t) { return new k(e, t) } }(); var N = e.dc(J.exports); function Y(t, r) { const o = t.tileID.canonical; if (!this._geoJSONIndex) return r(null, null); const i = this._geoJSONIndex.getTile(o.z, o.x, o.y); if (!i) return r(null, null); const s = new class { constructor(t) { this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = e.J, this.length = t.length, this._features = t; } feature(t) { return new class { constructor(t) { this._feature = t, this.extent = e.J, this.type = t.type, this.properties = t.tags, "id" in t && !isNaN(t.id) && (this.id = parseInt(t.id, 10)); } loadGeometry() { if (1 === this._feature.type) { const t = []; for (const r of this._feature.geometry) t.push([new e.P(r[0], r[1])]); return t } { const t = []; for (const r of this._feature.geometry) { const o = []; for (const t of r) o.push(new e.P(t[0], t[1])); t.push(o); } return t } } toGeoJSON(e, t, r) { return l.call(this, e, t, r) } }(this._features[t]) } }(i.features); let n = k(s); 0 === n.byteOffset && n.byteLength === n.buffer.byteLength || (n = new Uint8Array(n)), r(null, { vectorTile: s, rawData: n.buffer }); } class G extends e.dh { constructor(e, t, r, o, i, s) { super(e, t, r, o, Y, s), i && (this.loadGeoJSON = i); } loadData(t, r) { const o = t && t.request, i = o && o.collectResourceTiming; this.loadGeoJSON(t, ((s, n) => { if (s || !n) return r(s); if ("object" != typeof n) return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)); { a(n, !0); try { if (t.filter) { const r = e.cw(t.filter, { type: "boolean", "property-type": "data-driven", overridable: !1, transition: !1 }); if ("error" === r.result) throw new Error(r.value.map((e => `${e.key}: ${e.message}`)).join(", ")); const o = n.features.filter((e => r.value.evaluate({ zoom: 0 }, e))); n = { type: "FeatureCollection", features: o }; } this._geoJSONIndex = t.cluster ? new j(function ({ superclusterOptions: t, clusterProperties: r }) { if (!r || !t) return t; const o = {}, i = {}, s = { accumulated: null, zoom: 0 }, n = { properties: null }, a = Object.keys(r); for (const t of a) { const [s, n] = r[t], a = e.cw(n), l = e.cw("string" == typeof s ? [s, ["accumulated"], ["get", t]] : s); o[t] = a.value, i[t] = l.value; } return t.map = e => { n.properties = e; const t = {}; for (const e of a) t[e] = o[e].evaluate(s, n); return t }, t.reduce = (e, t) => { n.properties = t; for (const t of a) s.accumulated = e[t], e[t] = i[t].evaluate(s, n); }, t }(t)).load(n.features) : N(n, t.geojsonVtOptions); } catch (s) { return r(s) } this.loaded = {}; const l = {}; if (i) { const r = e.di(o); r && (l.resourceTiming = {}, l.resourceTiming[t.source] = JSON.parse(JSON.stringify(r))); } r(null, l); } })); } reloadTile(e, t) { const r = this.loaded; return r && r[e.uid] ? super.reloadTile(e, t) : this.loadTile(e, t) } loadGeoJSON(t, r) { if (t.request) e.a1(t.request, r); else { if ("string" != typeof t.data) return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)); try { return r(null, JSON.parse(t.data)) } catch (e) { return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)) } } }
39 getClusterExpansionZoom(e, t) { try { t(null, this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)); } catch (e) { t(e); } } getClusterChildren(e, t) { try { t(null, this._geoJSONIndex.getChildren(e.clusterId)); } catch (e) { t(e); } } getClusterLeaves(e, t) { try { t(null, this._geoJSONIndex.getLeaves(e.clusterId, e.limit, e.offset)); } catch (e) { t(e); } } } class W { constructor(t, r) { this.tileID = new e.O(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.projection = t.projection, this.brightness = r; } parse(t, r, o, i) { this.status = "parsing"; const s = new e.O(o.tileID.overscaledZ, o.tileID.wrap, o.tileID.canonical.z, o.tileID.canonical.x, o.tileID.canonical.y), n = {}, a = r.familiesBySource[o.source], l = new e.dk(s, o.promoteId); return l.bucketLayerIDs = [], e.dl(t).then((t => { if (!t) return i(new Error("Could not parse tile")); const r = e.dm(t, 1 / e.cg(o.tileID.canonical)), h = t.json.extensionsUsed && t.json.extensionsUsed.includes("MAPBOX_mesh_features"), u = new e.al(this.zoom, { brightness: this.brightness }); for (const o in a) for (const i of a[o]) { const o = i[0], a = t.json.extensionsUsed; o.recalculate(u, []); const l = new e.dn(r, s, a && a.includes("MAPBOX_mesh_features"), this.brightness); h || (l.needsUpload = !0), n[o.fqid] = l, l.evaluate(o); } this.status = "done", i(null, { buckets: n, featureIndex: l }); })).catch((e => i(new Error(e.message)))) } } class X { constructor(e, t, r, o, i, s) { this.actor = e, this.layerIndex = t, this.brightness = s, this.loading = {}, this.loaded = {}; } loadTile(t, r) { const o = t.uid, i = this.loading[o] = new W(t, this.brightness); e.dj(t.request, ((e, s) => { const n = !this.loading[o]; return delete this.loading[o], n || e ? (i.status = "done", n || (this.loaded[o] = i), r(e)) : s && 0 !== s.byteLength ? void i.parse(s, this.layerIndex, t, ((e, t) => { i.status = "done", this.loaded = this.loaded || {}, this.loaded[o] = i, e || !t ? r(e) : r(null, t); })) : (i.status = "done", this.loaded[o] = i, r()) })); } reloadTile(e, t) { const r = this.loaded, o = e.uid; if (r && r[o]) { const i = r[o]; i.projection = e.projection, i.brightness = e.brightness; const s = (r, o) => { i.reloadCallback && (delete i.reloadCallback, this.loadTile(e, t)), t(r, o); }; "parsing" === i.status ? i.reloadCallback = s : "done" === i.status && this.loadTile(e, t); } } abortTile(e, t) { const r = e.uid; this.loading[r] && delete this.loading[r], t(); } removeTile(e, t) { const r = this.loaded, o = e.uid; r && r[o] && delete r[o], t(); } } class q { constructor(t) { this.self = t, this.actor = new e.dp(t, this), this.layerIndexes = {}, this.availableImages = {}, this.isSpriteLoaded = {}, this.projections = {}, this.defaultProjection = e.o({ name: "mercator" }), this.workerSourceTypes = { vector: e.dh, geojson: G, "batched-model": X }, this.workerSources = {}, this.demWorkerSources = {}, this.self.registerWorkerSource = (e, t) => { if (this.workerSourceTypes[e]) throw new Error(`Worker source with name "${e}" already registered.`); this.workerSourceTypes[e] = t; }, this.self.registerRTLTextPlugin = t => { if (e.dq.isParsed()) throw new Error("RTL text plugin already registered."); e.dq.applyArabicShaping = t.applyArabicShaping, e.dq.processBidirectionalText = t.processBidirectionalText, e.dq.processStyledBidirectionalText = t.processStyledBidirectionalText; }; } clearCaches(e, t, r) { delete this.layerIndexes[e], delete this.availableImages[e], delete this.workerSources[e], delete this.demWorkerSources[e], r(); } checkIfReady(e, t, r) { r(); } setReferrer(e, t) { this.referrer = t; } spriteLoaded(t, { scope: r, isLoaded: o }) { if (this.isSpriteLoaded[t] || (this.isSpriteLoaded[t] = {}), this.isSpriteLoaded[t][r] = o, this.workerSources[t] && this.workerSources[t][r]) for (const i in this.workerSources[t][r]) { const s = this.workerSources[t][r][i]; for (const t in s) s[t] instanceof e.dh && (s[t].isSpriteLoaded = o, s[t].fire(new e.a8("isSpriteLoaded"))); } } setImages(e, { scope: t, images: r }, o) { if (this.availableImages[e] || (this.availableImages[e] = {}), this.availableImages[e][t] = r, this.workerSources[e] && this.workerSources[e][t]) { for (const o in this.workerSources[e][t]) { const i = this.workerSources[e][t][o]; for (const e in i) i[e].availableImages = r; } o(); } else o(); } setProjection(t, r) { this.projections[t] = e.o(r); } setBrightness(e, t, r) { this.brightness = t, r(); } setLayers(e, t, r) { this.getLayerIndex(e, t.scope).replace(t.layers, t.options), r(); } updateLayers(e, t, r) { this.getLayerIndex(e, t.scope).update(t.layers, t.removedIds, t.options), r(); } loadTile(e, t, r) { t.projection = this.projections[e] || this.defaultProjection, this.getWorkerSource(e, t.type, t.source, t.scope).loadTile(t, r); } loadDEMTile(e, t, r) { this.getDEMWorkerSource(e, t.source, t.scope).loadTile(t, r); } reloadTile(e, t, r) { t.projection = this.projections[e] || this.defaultProjection, this.getWorkerSource(e, t.type, t.source, t.scope).reloadTile(t, r); } abortTile(e, t, r) { this.getWorkerSource(e, t.type, t.source, t.scope).abortTile(t, r); } removeTile(e, t, r) { this.getWorkerSource(e, t.type, t.source, t.scope).removeTile(t, r); } removeSource(e, t, r) { if (!(this.workerSources[e] && this.workerSources[e][t.scope] && this.workerSources[e][t.scope][t.type] && this.workerSources[e][t.scope][t.type][t.source])) return; const o = this.workerSources[e][t.scope][t.type][t.source]; delete this.workerSources[e][t.scope][t.type][t.source], void 0 !== o.removeSource ? o.removeSource(t, r) : r(); } loadWorkerSource(e, t, r) { try { this.self.importScripts(t.url), r(); } catch (e) { r(e.toString()); } } syncRTLPluginState(t, r, o) { try { e.dq.setState(r); const t = e.dq.getPluginURL(); if (e.dq.isLoaded() && !e.dq.isParsed() && null != t) { this.self.importScripts(t); const r = e.dq.isParsed(); o(r ? void 0 : new Error(`RTL Text Plugin failed to import scripts from ${t}`), r); } } catch (e) { o(e.toString()); } } setDracoUrl(e, t) { this.dracoUrl = t; } getAvailableImages(e, t) { this.availableImages[e] || (this.availableImages[e] = {}); let r = this.availableImages[e][t]; return r || (r = []), r } getLayerIndex(e, t) { this.layerIndexes[e] || (this.layerIndexes[e] = {}); let r = this.layerIndexes[e][t]; return r || (r = this.layerIndexes[e][t] = new o, r.scope = t), r } getWorkerSource(e, t, r, o) { if (this.workerSources[e] || (this.workerSources[e] = {}), this.workerSources[e][o] || (this.workerSources[e][o] = {}), this.workerSources[e][o][t] || (this.workerSources[e][o][t] = {}), this.isSpriteLoaded[e] || (this.isSpriteLoaded[e] = {}), !this.workerSources[e][o][t][r]) { const i = { send: (t, r, o, i, s, n) => { this.actor.send(t, r, o, e, s, n); }, scheduler: this.actor.scheduler }; this.workerSources[e][o][t][r] = new this.workerSourceTypes[t](i, this.getLayerIndex(e, o), this.getAvailableImages(e, o), this.isSpriteLoaded[e][o], void 0, this.brightness); } return this.workerSources[e][o][t][r] } getDEMWorkerSource(e, t, r) { return this.demWorkerSources[e] || (this.demWorkerSources[e] = {}), this.demWorkerSources[e][r] || (this.demWorkerSources[e][r] = {}), this.demWorkerSources[e][r][t] || (this.demWorkerSources[e][r][t] = new i), this.demWorkerSources[e][r][t] } enforceCacheSizeLimit(t, r) { e.dr(r); } getWorkerPerformanceMetrics(e, t, r) { r(void 0, void 0); } } return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope && (self.worker = new q(self)), q }));
40
41    define(["./shared"], (function (e) { "use strict"; function t(e, i) { if (Array.isArray(e)) { if (!Array.isArray(i) || e.length !== i.length) return !1; for (let o = 0; o < e.length; o++)if (!t(e[o], i[o])) return !1; return !0 } if ("object" == typeof e && null !== e && null !== i) { if ("object" != typeof i) return !1; if (Object.keys(e).length !== Object.keys(i).length) return !1; for (const o in e) if (!t(e[o], i[o])) return !1; return !0 } return e === i } var i = o; function o(e) { return !function (e) { return "undefined" == typeof window || "undefined" == typeof document ? "n
41ot a browser" : function () { if (!("Worker" in window && "Blob" in window && "URL" in window)) return !1; var e, t, i = new Blob([""], { type: "text/javascript" }), o = URL.createObjectURL(i); try { t = new Worker(o), e = !0; } catch (t) { e = !1; } return t && t.terminate(), URL.revokeObjectURL(o), e }() ? function () { var e = document.createElement("canvas"); e.width = e.height = 1; var t = e.getContext("2d"); if (!t) return !1; var i = t.getImageData(0, 0, 1, 1); return i && i.width === e.width }() ? (void 0 === r[t = e && e.failIfMajorPerformanceCaveat] && (r[t] = function (e) { var t, i = function (e) { var t = document.createElement("canvas"), i = Object.create(o.webGLContextAttributes); return i.failIfMajorPerformanceCaveat = e, t.getContext("webgl2", i) }(e); if (!i) return !1; try { t = i.createShader(i.VERTEX_SHADER); } catch (e) { return !1 } return !(!t || i.isContextLost()) && (i.shaderSource(t, "void main() {}"), i.compileShader(t), !0 === i.getShaderParameter(t, i.COMPILE_STATUS)) }(t)), r[t] ? document.documentMode ? "insufficient ECMAScript 6 support" : void 0 : "insufficient WebGL2 support") : "insufficient Canvas/getImageData support" : "insufficient worker support"; var t; }(e) } var r = {}; function s(e, t, i) { const o = document.createElement(e); return null != t && (o.className = t), i && i.appendChild(o), o } function n(e, t, i) { const o = document.createElementNS("http://www.w3.org/2000/svg", e); for (const e of Object.keys(t)) o.setAttributeNS(null, e, String(t[e])); return i && i.appendChild(o), o } o.webGLContextAttributes = { antialias: !1, alpha: !0, stencil: !0, depth: !0 }; const a = "undefined" != typeof document ? document.documentElement && document.documentElement.style : null, l = a && void 0 !== a.userSelect ? "userSelect" : "WebkitUserSelect"; let c; function h() { a && l && (c = a[l], a[l] = "none"); } function _() { a && l && (a[l] = c); } function d(e) { e.preventDefault(), e.stopPropagation(), window.removeEventListener("click", d, !0); } function u() { window.addEventListener("click", d, !0), window.setTimeout((() => { window.removeEventListener("click", d, !0); }), 0); } function p(e, t) { const i = e.getBoundingClientRect(); return g(e, i, t) } function m(e, t) { const i = e.getBoundingClientRect(), o = []; for (let r = 0; r < t.length; r++)o.push(g(e, i, t[r])); return o } function f(e) { return void 0 !== window.InstallTrigger && 2 === e.button && e.ctrlKey && window.navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? 0 : e.button } function g(t, i, o) { const r = t.offsetWidth === i.width ? 1 : t.offsetWidth / i.width; return new e.P((o.clientX - i.left) * r, (o.clientY - i.top) * r) } class v { constructor() { this._changed = !1, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSourceCaches = {}, this._updatedPaintProps = new Set, this._updatedImages = new Set; } isDirty() { return this._changed } setDirty() { this._changed = !0; } getUpdatedSourceCaches() { return this._updatedSourceCaches } updateSourceCache(e, t) { this._updatedSourceCaches[e] = t, this.setDirty(); } discardSourceCacheUpdate(e) { delete this._updatedSourceCaches[e]; } updateLayer(e) { const t = e.scope; this._updatedLayers[t] = this._updatedLayers[t] || new Set, this._updatedLayers[t].add(e.id), this.setDirty(); } removeLayer(e) { const t = e.scope; this._removedLayers[t] = this._removedLayers[t] || {}, this._updatedLayers[t] = this._updatedLayers[t] || new Set, this._removedLayers[t][e.id] = e, this._updatedLayers[t].delete(e.id), this._updatedPaintProps.delete(e.fqid), this.setDirty(); } getRemovedLayer(e) { return this._removedLayers[e.scope] ? this._removedLayers[e.scope][e.id] : null } discardLayerRemoval(e) { this._removedLayers[e.scope] && delete this._removedLayers[e.scope][e.id]; } getLayerUpdatesByScope() { const e = {}; for (const t in this._updatedLayers) e[t] = e[t] || {}, e[t].updatedIds = Array.from(this._updatedLayers[t].values()); for (const t in this._removedLayers) e[t] = e[t] || {}, e[t].removedIds = Object.keys(this._removedLayers[t]); return e } getUpdatedPaintProperties() { return this._updatedPaintProps } updatePaintProperties(e) { this._updatedPaintProps.add(e.fqid), this.setDirty(); } getUpdatedImages() { return Array.from(this._updatedImages.values()) } updateImage(e) { this._updatedImages.add(e), this.setDirty(); } resetUpdatedImages() { this._updatedImages.clear(); } reset() { this._changed = !1, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSourceCaches = {}, this._updatedPaintProps.clear(), this._updatedImages.clear(); } } const x = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" }; class y { constructor(e, t, i, o, r, s) { this.length = t.length, this.attributes = i, this.itemSize = t.bytesPerElement, this.dynamicDraw = o, this.instanceCount = s, this.context = e; const n = e.gl; this.buffer = n.createBuffer(), e.bindVertexBuffer.set(this.buffer), n.bufferData(n.ARRAY_BUFFER, t.arrayBuffer, this.dynamicDraw ? n.DYNAMIC_DRAW : n.STATIC_DRAW), this.dynamicDraw || r || t.destroy(); } bind() { this.context.bindVertexBuffer.set(this.buffer); } updateData(e) { const t = this.context.gl; this.bind(), t.bufferSubData(t.ARRAY_BUFFER, 0, e.arrayBuffer); } enableAttributes(e, t) { for (let i = 0; i < this.attributes.length; i++) { const o = t.attributes[this.attributes[i].name]; void 0 !== o && e.enableVertexAttribArray(o); } } setVertexAttribPointers(e, t, i) { for (let o = 0; o < this.attributes.length; o++) { const r = this.attributes[o], s = t.attributes[r.name]; void 0 !== s && e.vertexAttribPointer(s, r.components, e[x[r.type]], !1, this.itemSize, r.offset + this.itemSize * (i || 0)); } } setVertexAttribDivisor(e, t, i) { for (let o = 0; o < this.attributes.length; o++) { const r = t.attributes[this.attributes[o].name]; void 0 !== r && this.instanceCount && this.instanceCount > 0 && e.vertexAttribDivisor(r, i); } } destroy() { this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); } } class b { constructor(e) { this.gl = e.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = !1; } get() { return this.current } set(e) { } getDefault() { return this.default }
vendor: 13,599 bytes, line 41
41 setDefault() { this.set(this.default); } } class w extends b { getDefault() { return e.C.transparent } set(e) { const t = this.current; (e.r !== t.r || e.g !== t.g || e.b !== t.b || e.a !== t.a || this.dirty) && (this.gl.clearColor(e.r, e.g, e.b, e.a), this.current = e, this.dirty = !1); } } class T extends b { getDefault() { return 1 } set(e) { (e !== this.current || this.dirty) && (this.gl.clearDepth(e), this.current = e, this.dirty = !1); } } class E extends b { getDefault() { return 0 } set(e) { (e !== this.current || this.dirty) && (this.gl.clearStencil(e), this.current = e, this.dirty = !1); } } class C extends b { getDefault() { return [!0, !0, !0, !0] } set(e) { const t = this.current; (e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || e[3] !== t[3] || this.dirty) && (this.gl.colorMask(e[0], e[1], e[2], e[3]), this.current = e, this.dirty = !1); } } class I extends b { getDefault() { return !0 } set(e) { (e !== this.current || this.dirty) && (this.gl.depthMask(e), this.current = e, this.dirty = !1); } } class S extends b { getDefault() { return 255 } set(e) { (e !== this.current || this.dirty) && (this.gl.stencilMask(e), this.current = e, this.dirty = !1); } } class M extends b { getDefault() { return { func: this.gl.ALWAYS, ref: 0, mask: 255 } } set(e) { const t = this.current; (e.func !== t.func || e.ref !== t.ref || e.mask !== t.mask || this.dirty) && (this.gl.stencilFunc(e.func, e.ref, e.mask), this.current = e, this.dirty = !1); } } class L extends b { getDefault() { const e = this.gl; return [e.KEEP, e.KEEP, e.KEEP] } set(e) { const t = this.current; (e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || this.dirty) && (this.gl.stencilOp(e[0], e[1], e[2]), this.current = e, this.dirty = !1); } } class P extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; e ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST), this.current = e, this.dirty = !1; } } class D extends b { getDefault() { return [0, 1] } set(e) { const t = this.current; (e[0] !== t[0] || e[1] !== t[1] || this.dirty) && (this.gl.depthRange(e[0], e[1]), this.current = e, this.dirty = !1); } } class A extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; e ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST), this.current = e, this.dirty = !1; } } class R extends b { getDefault() { return this.gl.LESS } set(e) { (e !== this.current || this.dirty) && (this.gl.depthFunc(e), this.current = e, this.dirty = !1); } } class z extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; e ? t.enable(t.BLEND) : t.disable(t.BLEND), this.current = e, this.dirty = !1; } } class O extends b { getDefault() { const e = this.gl; return [e.ONE, e.ZERO, e.ONE, e.ZERO] } set(e) { const t = this.current; (e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || e[3] !== t[3] || this.dirty) && (this.gl.blendFuncSeparate(e[0], e[1], e[2], e[3]), this.current = e, this.dirty = !1); } } class F extends b { getDefault() { return e.C.transparent } set(e) { const t = this.current; (e.r !== t.r || e.g !== t.g || e.b !== t.b || e.a !== t.a || this.dirty) && (this.gl.blendColor(e.r, e.g, e.b, e.a), this.current = e, this.dirty = !1); } } class B extends b { getDefault() { return this.gl.FUNC_ADD } set(e) { (e !== this.current || this.dirty) && (this.gl.blendEquationSeparate(e, e), this.current = e, this.dirty = !1); } } class k extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; e ? t.enable(t.CULL_FACE) : t.disable(t.CULL_FACE), this.current = e, this.dirty = !1; } } class N extends b { getDefault() { return this.gl.BACK } set(e) { (e !== this.current || this.dirty) && (this.gl.cullFace(e), this.current = e, this.dirty = !1); } } class U extends b { getDefault() { return this.gl.CCW } set(e) { (e !== this.current || this.dirty) && (this.gl.frontFace(e), this.current = e, this.dirty = !1); } } let G = class extends b { getDefault() { return null } set(e) { (e !== this.current || this.dirty) && (this.gl.useProgram(e), this.current = e, this.dirty = !1); } }; class j extends b { getDefault() { return this.gl.TEXTURE0 } set(e) { (e !== this.current || this.dirty) && (this.gl.activeTexture(e), this.current = e, this.dirty = !1); } } class V extends b { getDefault() { const e = this.gl; return [0, 0, e.drawingBufferWidth, e.drawingBufferHeight] } set(e) { const t = this.current; (e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || e[3] !== t[3] || this.dirty) && (this.gl.viewport(e[0], e[1], e[2], e[3]), this.current = e, this.dirty = !1); } } class Z extends b { getDefault() { return null } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.bindFramebuffer(t.FRAMEBUFFER, e), this.current = e, this.dirty = !1; } } class W extends b { getDefault() { return null } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.bindRenderbuffer(t.RENDERBUFFER, e), this.current = e, this.dirty = !1; } } class H extends b { getDefault() { return null } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.bindTexture(t.TEXTURE_2D, e), this.current = e, this.dirty = !1; } } class q extends b { getDefault() { return null } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.bindBuffer(t.ARRAY_BUFFER, e), this.current = e, this.dirty = !1; } } class $ extends b { getDefault() { return null } set(e) { const t = this.gl; t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e), this.current = e, this.dirty = !1; } } class X extends b { getDefault() { return null } set(e) { this.gl && (e !== this.current || this.dirty) && (this.gl.bindVertexArray(e), this.current = e, this.dirty = !1); } } class J extends b { getDefault() { return 4 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.pixelStorei(t.UNPACK_ALIGNMENT, e), this.current = e, this.dirty = !1; } } class Y extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e), this.current = e, this.dirty = !1; } } class K extends b { getDefault() { return !1 } set(e) { if (e === this.current && !this.dirty) return; const t = this.gl; t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, e), this.current = e, this.dirty = !1; } } class Q extends b { constructor(e, t) { super(e), this.context = e, this.parent = t; } getDefault() { return null } } class ee extends Q { setDirty() { this.dirty = !0; } set(e) { if (e === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t = this.gl; t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, e, 0), this.current = e, this.dirty = !1; } } class te extends Q { attachment() { return this.gl.DEPTH_ATTACHMENT } set(e) { if (e === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t = this.gl; t.framebufferRenderbuffer(t.FRAMEBUFFER, this.attachment(), t.RENDERBUFFER, e), this.current = e, this.dirty = !1; } } class ie extends Q { attachment() { return this.gl.DEPTH_ATTACHMENT } set(e) { if (e === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t = this.gl; t.framebufferTexture2D(t.FRAMEBUFFER, this.attachment(), t.TEXTURE_2D, e, 0), this.current = e, this.dirty = !1; } } class oe extends te { attachment() { return this.gl.DEPTH_STENCIL_ATTACHMENT } } class re { constructor(e, t, i, o, r) { this.context = e, this.width = t, this.height = i; const s = this.framebuffer = e.gl.createFramebuffer(); o && (this.colorAttachment = new ee(e, s)), r && (this.depthAttachmentType = r, this.depthAttachment = "renderbuffer" === r ? new te(e, s) : new ie(e, s)); } destroy() { const e = this.context.gl; if (this.colorAttachment) { const t = this.colorAttachment.get(); t && e.deleteTexture(t); } if (this.depthAttachment && this.depthAttachmentType) if ("renderbuffer" === this.depthAttachmentType) { const t = this.depthAttachment.get(); t && e.deleteRenderbuffer(t); } else { const t = this.depthAttachment.get(); t && e.deleteTexture(t); } e.deleteFramebuffer(this.framebuffer); } } class se { constructor(e, t) { this.gl = e, this.clearColor = new w(this), this.clearDepth = new T(this), this.clearStencil = new E(this), this.colorMask = new C(this), this.depthMask = new I(this), this.stencilMask = new S(this), this.stencilFunc = new M(this), this.stencilOp = new L(this), this.stencilTest = new P(this), this.depthRange = new D(this), this.depthTest = new A(this), this.depthFunc = new R(this), this.blend = new z(this), this.blendFunc = new O(this), this.blendColor = new F(this), this.blendEquation = new B(this), this.cullFace = new k(this), this.cullFaceSide = new N(this), this.frontFace = new U(this), this.program = new G(this), this.activeTexture = new j(this), this.viewport = new V(this), this.bindFramebuffer = new Z(this), this.bindRenderbuffer = new W(this), this.bindTexture = new H(this), this.bindVertexBuffer = new q(this), this.bindElementBuffer = new $(this), this.bindVertexArrayOES = new X(this), this.pixelStoreUnpack = new J(this), this.pixelStoreUnpackPremultiplyAlpha = new Y(this), this.pixelStoreUnpackFlipY = new K(this), this.options = t ? { ...t } : {}, this.options.extTextureFilterAnisotropicForceOff || (this.extTextureFilterAnisotropic = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))), this.extDebugRendererInfo = e.getExtension("WEBGL_debug_renderer_info"), this.extDebugRendererInfo && (this.renderer = e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL), this.vendor = e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)), this.options.extTextureFloatLinearForceOff || (this.extTextureFloatLinear = e.getExtension("OES_texture_float_linear")), this.extRenderToTextureHalfFloat = e.getExtension("EXT_color_buffer_half_float"), this.extTimerQuery = e.getExtension("EXT_disjoint_timer_query_webgl2"), this.maxTextureSize = e.getParameter(e.MAX_TEXTURE_SIZE); } setDefault() { this.unbindVAO(), this.clearColor.setDefault(), this.clearDepth.setDefault(), this.clearStencil.setDefault(), this.colorMask.setDefault(), this.depthMask.setDefault(), this.stencilMask.setDefault(), this.stencilFunc.setDefault(), this.stencilOp.setDefault(), this.stencilTest.setDefault(), this.depthRange.setDefault(), this.depthTest.setDefault(), this.depthFunc.setDefault(), this.blend.setDefault(), this.blendFunc.setDefault(), this.blendColor.setDefault(), this.blendEquation.setDefault(), this.cullFace.setDefault(), this.cullFaceSide.setDefault(), this.frontFace.setDefault(), this.program.setDefault(), this.activeTexture.setDefault(), this.bindFramebuffer.setDefault(), this.pixelStoreUnpack.setDefault(), this.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.pixelStoreUnpackFlipY.setDefault(); } setDirty() { this.clearColor.dirty = !0, this.clearDepth.dirty = !0, this.clearStencil.dirty = !0, this.colorMask.dirty = !0, this.depthMask.dirty = !0, this.stencilMask.dirty = !0, this.stencilFunc.dirty = !0, this.stencilOp.dirty = !0, this.stencilTest.dirty = !0, this.depthRange.dirty = !0, this.depthTest.dirty = !0, this.depthFunc.dirty = !0, this.blend.dirty = !0, this.blendFunc.dirty = !0, this.blendColor.dirty = !0, this.blendEquation.dirty = !0, this.cullFace.dirty = !0, this.cullFaceSide.dirty = !0, this.frontFace.dirty = !0, this.program.dirty = !0, this.activeTexture.dirty = !0, this.viewport.dirty = !0, this.bindFramebuffer.dirty = !0, this.bindRenderbuffer.dirty = !0, this.bindTexture.dirty = !0, this.bindVertexBuffer.dirty = !0, this.bindElementBuffer.dirty = !0, this.bindVertexArrayOES.dirty = !0, this.pixelStoreUnpack.dirty = !0, this.pixelStoreUnpackPremultiplyAlpha.dirty = !0, this.pixelStoreUnpackFlipY.dirty = !0; } createIndexBuffer(t, i, o) { return new e.I(this, t, i, o) } createVertexBuffer(e, t, i, o, r) { return new y(this, e, t, i, o, r) } createRenderbuffer(e, t, i) { const o = this.gl, r = o.createRenderbuffer(); return this.bindRenderbuffer.set(r), o.renderbufferStorage(o.RENDERBUFFER, e, t, i), this.bindRenderbuffer.set(null), r } createFramebuffer(e, t, i, o) { return new re(this, e, t, i, o) } clear({ color: e, depth: t, stencil: i, colorMask: o }) { const r = this.gl; let s = 0; e && (s |= r.COLOR_BUFFER_BIT, this.clearColor.set(e), this.colorMask.set(o || [!0, !0, !0, !0])), void 0 !== t && (s |= r.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(t), this.depthMask.set(!0)), void 0 !== i && (s |= r.STENCIL_BUFFER_BIT, this.clearStencil.set(i), this.stencilMask.set(255)), r.clear(s); } setCullFace(e) { !1 === e.enable ? this.cullFace.set(!1) : (this.cullFace.set(!0), this.cullFaceSide.set(e.mode), this.frontFace.set(e.frontFace)); } setDepthMode(e) { e.func !== this.gl.ALWAYS || e.mask ? (this.depthTest.set(!0), this.depthFunc.set(e.func), this.depthMask.set(e.mask), this.depthRange.set(e.range)) : this.depthTest.set(!1); } setStencilMode(e) { e.test.func !== this.gl.ALWAYS || e.mask ? (this.stencilTest.set(!0), this.stencilMask.set(e.mask), this.stencilOp.set([e.fail, e.depthFail, e.pass]), this.stencilFunc.set({ func: e.test.func, ref: e.ref, mask: e.test.mask })) : this.stencilTest.set(!1); }
41 setColorMode(i) { t(i.blendFunction, e.a.Replace) ? this.blend.set(!1) : (this.blend.set(!0), this.blendFunc.set(i.blendFunction), this.blendColor.set(i.blendColor), i.blendEquation ? this.blendEquation.set(i.blendEquation) : this.blendEquation.setDefault()), this.colorMask.set(i.mask); } unbindVAO() { this.bindVertexArrayOES.set(null); } } class ne { constructor(e = 0, t = 0, i = 0, o = 0) { if (isNaN(e) || e < 0 || isNaN(t) || t < 0 || isNaN(i) || i < 0 || isNaN(o) || o < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers"); this.top = e, this.bottom = t, this.left = i, this.right = o; } interpolate(t, i, o) { return null != i.top && null != t.top && (this.top = e.n(t.top, i.top, o)), null != i.bottom && null != t.bottom && (this.bottom = e.n(t.bottom, i.bottom, o)), null != i.left && null != t.left && (this.left = e.n(t.left, i.left, o)), null != i.right && null != t.right && (this.right = e.n(t.right, i.right, o)), this } getCenter(t, i) { const o = e.c((this.left + t - this.right) / 2, 0, t), r = e.c((this.top + i - this.bottom) / 2, 0, i); return new e.P(o, r) } equals(e) { return this.top === e.top && this.bottom === e.bottom && this.left === e.left && this.right === e.right } clone() { return new ne(this.top, this.bottom, this.left, this.right) } toJSON() { return { top: this.top, bottom: this.bottom, left: this.left, right: this.right } } } function ae(t, i) { const o = e.g(t, 3); e.m.fromQuat(t, i), e.s(t, 3, o); } function le(t, i) { const o = e.q.identity([]); return e.q.rotateZ(o, o, -i), e.q.rotateX(o, o, -t), o } function ce(t, i) { const o = [t[0], t[1], 0], r = [i[0], i[1], 0]; if (e.v.length(o) >= 1e-15) { const t = e.v.normalize([], o); e.v.scale(r, t, e.v.dot(r, t)), i[0] = r[0], i[1] = r[1]; } const s = e.v.cross([], i, t); if (e.v.len(s) < 1e-15) return null; const n = Math.atan2(-s[1], s[0]); return le(Math.atan2(Math.sqrt(t[0] * t[0] + t[1] * t[1]), -t[2]), n) } class he { constructor(e, t) { this.position = e, this.orientation = t; } get position() { return this._position } set position(t) { if (t) { const i = t instanceof e.M ? t : new e.M(t[0], t[1], t[2]); this._renderWorldCopies && (i.x = e.w(i.x, 0, 1)), this._position = i; } else this._position = null; } lookAtPoint(t, i) { if (this.orientation = null, !this.position) return; const o = this.position, r = this._elevation ? this._elevation.getAtPointOrZero(e.M.fromLngLat(t)) : 0, s = e.M.fromLngLat(t, r), n = [s.x - o.x, s.y - o.y, s.z - o.z]; i || (i = [0, 0, 1]), i[2] = Math.abs(i[2]), this.orientation = ce(n, i); } setPitchBearing(t, i) { this.orientation = le(e.d(t), e.d(-i)); } } class _e { constructor(t, i) { this._transform = e.m.identity([]), this.orientation = i, this.position = t; } get mercatorPosition() { const t = this.position; return new e.M(t[0], t[1], t[2]) } get position() { const t = e.g(this._transform, 3); return [t[0], t[1], t[2]] } set position(t) { var i; t && e.s(this._transform, 3, [(i = t)[0], i[1], i[2], 1]); } get orientation() { return this._orientation } set orientation(t) { this._orientation = t || e.q.identity([]), t && ae(this._transform, this._orientation); } getPitchBearing() { const e = this.forward(), t = this.right(); return { bearing: Math.atan2(-t[1], t[0]), pitch: Math.atan2(Math.sqrt(e[0] * e[0] + e[1] * e[1]), -e[2]) } } setPitchBearing(e, t) { this._orientation = le(e, t), ae(this._transform, this._orientation); } forward() { const t = e.g(this._transform, 2); return [-t[0], -t[1], -t[2]] } up() { const t = e.g(this._transform, 1); return [-t[0], -t[1], -t[2]] } right() { const t = e.g(this._transform, 0); return [t[0], t[1], t[2]] } getCameraToWorld(t, i) { const o = new Float64Array(16); return e.m.invert(o, this.getWorldToCamera(t, i)), o } getCameraToWorldMercator() { return this._transform } getWorldToCameraPosition(t, i, o) { const r = this.position; e.v.scale(r, r, -t); const s = new Float64Array(16); return e.m.fromScaling(s, [o, o, o]), e.m.translate(s, s, r), s[10] *= i, s } getWorldToCamera(t, i) { const o = new Float64Array(16), r = new Float64Array(4), s = this.position; return e.q.conjugate(r, this._orientation), e.v.scale(s, s, -t), e.m.fromQuat(o, r), e.m.translate(o, o, s), o[1] *= -1, o[5] *= -1, o[9] *= -1, o[13] *= -1, o[8] *= i, o[9] *= i, o[10] *= i, o[11] *= i, o } getCameraToClipPerspective(t, i, o, r) { const s = new Float64Array(16); return e.m.perspective(s, t, i, o, r), s } getCameraToClipOrthographic(t, i, o, r, s, n) { const a = new Float64Array(16); return e.m.ortho(a, t, i, o, r, s, n), a } getDistanceToElevation(t, i = !1) { const o = 0 === t ? 0 : e.b(t, i ? e.l(this.position[1]) : this.position[1]), r = this.forward(); return (o - this.position[2]) / r[2] } clone() { return new _e([...this.position], [...this.orientation]) } } const de = { unknown: 0, flipRequired: 1, flipNotRequired: 2 }, ue = Math.tan(85 * Math.PI / 180); function pe(t, i, o, r, s, n, a) { const l = e.m.create(); if (o) if ("globe" === n.name) { const t = e.f(s, i); e.m.multiply(l, l, t); } else { const t = e.h.invert([], a); l[0] = t[0], l[1] = t[1], l[4] = t[2], l[5] = t[3], r || e.m.rotateZ(l, l, s.angle); }
vendor: 6,358 bytes, line 41
41 else e.m.multiply(l, s.labelPlaneMatrix, t); return l } function me(e, t, i, o, r, s, n) { const a = pe(e, t, i, o, r, s, n); return "globe" === s.name && i || (a[2] = a[6] = a[10] = a[14] = 0), a } function fe(t, i, o, r, s, n, a) { if (o) { if ("globe" === n.name) { const l = pe(t, i, o, r, s, n, a); return e.m.invert(l, l), e.m.multiply(l, t, l), l } { const i = e.m.clone(t), o = e.m.identity([]); return o[0] = a[0], o[1] = a[1], o[4] = a[2], o[5] = a[3], e.m.multiply(i, i, o), r || e.m.rotateZ(i, i, -s.angle), i } } return s.glCoordMatrix } function ge(t, i, o, r) { const s = [t, i, o, 1]; o ? e.e.transformMat4(s, s, r) : Me(s, s, r); const n = s[3]; return s[0] /= n, s[1] /= n, s[2] /= n, s } function ve(e, t) { return Math.min(.5 + e / t * .5, 1.5) } function xe(e, t) { const i = e[0] / e[3], o = e[1] / e[3]; return i >= -t[0] && i <= t[0] && o >= -t[1] && o <= t[1] } function ye(t, i, o, r, s, n, a, l, c, h) { const _ = o.transform, d = r ? t.textSizeData : t.iconSizeData, u = e.i(d, o.transform.zoom), p = "globe" === _.projection.name, m = [256 / o.width * 2 + 1, 256 / o.height * 2 + 1], f = r ? t.text.dynamicLayoutVertexArray : t.icon.dynamicLayoutVertexArray; f.clear(); let g = null; p && (g = r ? t.text.globeExtVertexArray : t.icon.globeExtVertexArray); const v = t.lineVertexArray, x = r ? t.text.placedSymbolArray : t.icon.placedSymbolArray, y = o.transform.width / o.transform.height; let b, w = !1; for (let r = 0; r < x.length; r++) { const p = x.get(r), { numGlyphs: T, writingMode: E } = p; if (E !== e.W.vertical || w || b === e.W.horizontal || (w = !0), b = E, (p.hidden || E === e.W.vertical) && !w) { Se(T, f); continue } w = !1; const C = new e.P(p.tileAnchorX, p.tileAnchorY); let { x: I, y: S, z: M } = _.projection.projectTilePoint(C.x, C.y, h.canonical); if (c) { const [e, t, i] = c(C); I += e, S += t, M += i; } const L = [I, S, M, 1]; if (e.e.transformMat4(L, L, i), !xe(L, m)) { Se(T, f); continue } const P = L[3], D = ve(o.transform.getCameraToCenterDistance(_.projection), P), A = e.j(d, u, p), R = a ? A / D : A * D, z = ge(I, S, M, s); if (z[3] <= 0) { Se(T, f); continue } let O = {}; const F = a ? null : c, B = Te(p, R, !1, l, i, s, n, t.glyphOffsetArray, v, f, g, z, C, O, y, F, _.projection, h, a); w = B.useVertical, F && B.needsFlipping && (O = {}), (B.notEnoughRoom || w || B.needsFlipping && Te(p, R, !0, l, i, s, n, t.glyphOffsetArray, v, f, g, z, C, O, y, F, _.projection, h, a).notEnoughRoom) && Se(T, f); } r ? (t.text.dynamicLayoutVertexBuffer.updateData(f), g && t.text.globeExtVertexBuffer && t.text.globeExtVertexBuffer.updateData(g)) : (t.icon.dynamicLayoutVertexBuffer.updateData(f), g && t.icon.globeExtVertexBuffer && t.icon.globeExtVertexBuffer.updateData(g)); } function be(e, t, i, o, r, s, n, a, l, c, h, _, d, u, p, m) { const { lineStartIndex: f, glyphStartIndex: g, segment: v } = a, x = g + a.numGlyphs, y = f + a.lineLength, b = t.getoffsetX(g), w = t.getoffsetX(x - 1), T = Ie(e * b, i, o, r, s, n, v, f, y, l, c, h, _, d, !0, u, p, m); if (!T) return null; const E = Ie(e * w, i, o, r, s, n, v, f, y, l, c, h, _, d, !0, u, p, m); return E ? { first: T, last: E } : null } function we(t, i, o, r) { return t === e.W.horizontal && Math.abs(r) > Math.abs(o) ? { useVertical: !0 } : t === e.W.vertical ? r > 0 ? { needsFlipping: !0 } : null : i !== de.unknown && function (e, t) { return 0 === e || Math.abs(t / e) > ue }(o, r) ? i === de.flipRequired ? { needsFlipping: !0 } : null : o < 0 ? { needsFlipping: !0 } : null } function Te(t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g, v, x) { const y = i / 24, b = t.lineOffsetX * y, w = t.lineOffsetY * y, { lineStartIndex: T, glyphStartIndex: E, numGlyphs: C, segment: I, writingMode: S, flipState: M } = t, L = T + t.lineLength, P = t => { if (_) { const [i, o, r] = t.up, s = h.length; e.u(_, s + 0, i, o, r), e.u(_, s + 1, i, o, r), e.u(_, s + 2, i, o, r), e.u(_, s + 3, i, o, r); } const [i, o, r] = t.point; e.k(h, i, o, r, t.angle); }; if (C > 1) { const e = be(y, l, b, w, o, d, u, t, c, n, p, f, !1, g, v, x); if (!e) return { notEnoughRoom: !0 }; if (r && !o) { let [i, o, r] = e.first.point, [s, n, l] = e.last.point;[i, o] = ge(i, o, r, a), [s, n] = ge(s, n, l, a); const c = we(S, M, (s - i) * m, n - o); if (t.flipState = c && c.needsFlipping ? de.flipRequired : de.flipNotRequired, c) return c } P(e.first); for (let e = E + 1; e < E + C - 1; e++) { const t = Ie(y * l.getoffsetX(e), b, w, o, d, u, I, T, L, c, n, p, f, !1, !1, g, v, x); if (!t) return h.length -= 4 * (e - E), { notEnoughRoom: !0 }; P(t); } P(e.last); } else { if (r && !o) { const i = ge(u.x, u.y, 0, s), o = T + I + 1, r = new e.P(c.getx(o), c.gety(o)), n = ge(r.x, r.y, 0, s), a = n[3] > 0 ? n : Ce(u, r, i, 1, s, void 0, g, v.canonical), l = we(S, M, (a[0] - i[0]) * m, a[1] - i[1]); if (t.flipState = l && l.needsFlipping ? de.flipRequired : de.flipNotRequired, l) return l } const i = Ie(y * l.getoffsetX(E), b, w, o, d, u, I, T, L, c, n, p, f, !1, !1, g, v, x); if (!i) return { notEnoughRoom: !0 }; P(i); } return {} } function Ee(e, t, i, o, r) { const { x: s, y: n, z: a } = o.projectTilePoint(e.x, e.y, t); if (!r) return ge(s, n, a, i); const [l, c, h] = r(e); return ge(s + l, n + c, a + h, i) } function Ce(t, i, o, r, s, n, a, l) { const c = Ee(t.sub(i)._unit()._add(t), l, s, a, n); return e.v.sub(c, o, c), e.v.normalize(c, c), e.v.scaleAndAdd(c, o, c, r) } function Ie(t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g, v) { const x = r ? t - i : t + i; let y = x > 0 ? 1 : -1, b = 0; r && (y *= -1, b = Math.PI), y < 0 && (b += Math.PI); let w = l + a + (y > 0 ? 0 : 1) | 0, T = s, E = s, C = 0, I = 0; const S = Math.abs(x), M = [], L = []; let P = n, D = P; const A = () => Ce(D, P, E, S - C + 1, _, u, f, g.canonical); for (; C + I <= S;) { if (w += y, w < l || w >= c) return null; if (E = T, D = P, M.push(E), p && L.push(D), P = new e.P(h.getx(w), h.gety(w)), T = d[w], !T) { const e = Ee(P, g.canonical, _, f, u); T = e[3] > 0 ? d[w] = e : A(); } C += I, I = e.v.distance(E, T); } m && u && (d[w] && (T = A(), I = e.v.distance(E, T)), d[w] = T); const R = (S - C) / I, z = P.sub(D)._mult(R)._add(D), O = e.v.sub([], T, E), F = e.v.scaleAndAdd([], E, O, R); let B = [0, 0, 1], k = O[0], N = O[1]; if (v && (B = f.upVector(g.canonical, z.x, z.y), 0 !== B[0] || 0 !== B[1] || 1 !== B[2])) { const t = [B[2], 0, -B[
410]], i = e.v.cross([], B, t); e.v.normalize(t, t), e.v.normalize(i, i), k = e.v.dot(O, t), N = e.v.dot(O, i); } if (o) { const t = e.v.cross([], B, O); e.v.normalize(t, t), e.v.scaleAndAdd(F, F, t, o * y); } const U = b + Math.atan2(N, k); return M.push(F), p && L.push(z), { point: F, angle: U, path: M, tilePath: L, up: B } } function Se(e, t) { const i = t.length, o = i + 4 * e; t.resize(o), t.float32.fill(-1 / 0, 4 * i, 4 * o); } function Me(e, t, i) { const o = t[0], r = t[1]; return e[0] = i[0] * o + i[4] * r + i[12], e[1] = i[1] * o + i[5] * r + i[13], e[3] = i[3] * o + i[7] * r + i[15], e } const Le = (e, t, i) => (1 - i) * e + i * t, Pe = e => e * e * e * e * e; class De { constructor(t, i, o, r, s, n, a) { this.tileSize = 512, this._renderWorldCopies = void 0 === s || s, this._minZoom = t || 0, this._maxZoom = i || 22, this._minPitch = null == o ? 0 : o, this._maxPitch = null == r ? 60 : r, this.setProjection(n), this.setMaxBounds(a), this.width = 0, this.height = 0, this._center = new e.L(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 ne, this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._fogTileMatrixCache = {}, this._expandedProjMatrixCache = {}, this._distanceTileDataCache = {}, this._camera = new _e, this._centerAltitude = 0, this._averageElevation = 0, this.cameraElevationReference = "ground", this._pixelsPerMercatorPixel = 1, this.globeRadius = 0, this.globeCenterInViewSpace = [0, 0, 0], this._horizonShift = .1, this._orthographicProjectionAtLowPitch = !1; } clone() { const e = new De(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies, this.getProjection()); return e._elevation = this._elevation, e._centerAltitude = this._centerAltitude, e._centerAltitudeValidForE
41xaggeration = this._centerAltitudeValidForExaggeration, e.tileSize = this.tileSize, e.mercatorFromTransition = this.mercatorFromTransition, e.width = this.width, e.height = this.height, e.cameraElevationReference = this.cameraElevationReference, e._center = this._center, e._setZoom(this.zoom), e._seaLevelZoom = this._seaLevelZoom, e.angle = this.angle, e._fov = this._fov, e._pitch = this._pitch, e._nearZ = this._nearZ, e._farZ = this._farZ, e._averageElevation = this._averageElevation, e._orthographicProjectionAtLowPitch = this._orthographicProjectionAtLowPitch, e._unmodified = this._unmodified, e._edgeInsets = this._edgeInsets.clone(), e._camera = this._camera.clone(), e._calcMatrices(), e.freezeTileCoverage = this.freezeTileCoverage, e.frustumCorners = this.frustumCorners, e } get isOrthographic() { return "globe" !== this.projection.name && this._orthographicProjectionAtLowPitch && this.pitch < 15 } get elevation() { return this._elevation } set elevation(e) { this._elevation !== e && (this._elevation = e, this._updateCameraOnTerrain(), this._calcMatrices()); } get depthOcclusionForSymbolsAndCircles() { return "globe" !== this.projection.name && !this.isOrthographic } updateElevation(e, t = !1) { const i = this._elevation && this._elevation.exaggeration() !== this._centerAltitudeValidForE
vendor: 8,742 bytes, line 41
41xaggeration; (null == this._seaLevelZoom || i) && this._updateCameraOnTerrain(), (e || i) && this._constrainCamera(t), this._calcMatrices(); } getProjection() { return e.p(this.projection, ["name", "center", "parallels"]) } setProjection(i) { this.projectionOptions = i || { name: "mercator" }; const o = this.projection ? this.getProjection() : void 0; this.projection = e.o(this.projectionOptions); const r = !t(o, this.getProjection()); return r && this._calcMatrices(), this.mercatorFromTransition = !1, r } setOrthographicProjectionAtLowPitch(e) { return this._orthographicProjectionAtLowPitch !== e && (this._orthographicProjectionAtLowPitch = e, this._calcMatrices(), !0) } setMercatorFromTransition() { const t = this.projection.name; this.mercatorFromTransition = !0, this.projectionOptions = { name: "mercator" }, this.projection = e.o({ name: "mercator" }); const i = t !== this.projection.name; return i && this._calcMatrices(), i } get minZoom() { return this._minZoom } set minZoom(e) { this._minZoom !== e && (this._minZoom = e, this.zoom = Math.max(this.zoom, e)); } get maxZoom() { return this._maxZoom } set maxZoom(e) { this._maxZoom !== e && (this._maxZoom = e, this.zoom = Math.min(this.zoom, e)); } get minPitch() { return this._minPitch } set minPitch(e) { this._minPitch !== e && (this._minPitch = e, this.pitch = Math.max(this.pitch, e)); } get maxPitch() { return this._maxPitch } set maxPitch(e) { this._maxPitch !== e && (this._maxPitch = e, this.pitch = Math.min(this.pitch, e)); } get renderWorldCopies() { return this._renderWorldCopies && !0 === this.projection.supportsWorldCopies } set renderWorldCopies(e) { void 0 === e ? e = !0 : null === e && (e = !1), this._renderWorldCopies = e; } get worldSize() { return this.tileSize * this.scale } get cameraWorldSizeForFog() { const e = Math.max(this._camera.getDistanceToElevation(this._averageElevation), Number.EPSILON); return this._worldSizeFromZoom(this._zoomFromMercatorZ(e)) } get cameraWorldSize() { const e = Math.max(this._camera.getDistanceToElevation(this._averageElevation, !0), Number.EPSILON); return this._worldSizeFromZoom(this._zoomFromMercatorZ(e)) } get pixelsPerMeter() { return this.projection.pixelsPerMeter(this.center.lat, this.worldSize) } get cameraPixelsPerMeter() { return e.b(1, this.center.lat) * this.cameraWorldSizeForFog } get centerOffset() { return this.centerPoint._sub(this.size._div(2)) } get size() { return new e.P(this.width, this.height) } get bearing() { return e.w(this.rotation, -180, 180) } set bearing(e) { this.rotation = e; } get rotation() { return -this.angle / Math.PI * 180 } set rotation(t) { const i = -t * Math.PI / 180; this.angle !== i && (this._unmodified = !1, this.angle = i, this._calcMatrices(), this.rotationMatrix = e.h.create(), e.h.rotate(this.rotationMatrix, this.rotationMatrix, this.angle)); } get pitch() { return this._pitch / Math.PI * 180 } set pitch(t) { const i = e.c(t, this.minPitch, this.maxPitch) / 180 * Math.PI; this._pitch !== i && (this._unmodified = !1, this._pitch = i, this._calcMatrices()); } get aspect() { return this.width / this.height } get fov() { return this._fov / Math.PI * 180 } get fovX() { return this._fov } get fovY() { const e = 1 / Math.tan(.5 * this.fovX); return 2 * Math.atan(1 / this.aspect / e) } set fov(t) { t = Math.max(.01, Math.min(60, t)), this._fov !== t && (this._unmodified = !1, this._fov = e.d(t), this._calcMatrices()); } get averageElevation() { return this._averageElevation } set averageElevation(e) { this._averageElevation = e, this._calcFogMatrices(), this._distanceTileDataCache = {}; } get zoom() { return this._zoom } set zoom(e) { const t = Math.min(Math.max(e, this.minZoom), this.maxZoom); this._zoom !== t && (this._unmodified = !1, this._setZoom(t), this._updateSeaLevelZoom(), this._constrain(), this._calcMatrices()); } _setZoom(e) { this._zoom = e, this.scale = this.zoomScale(e), this.tileZoom = Math.floor(e), this.zoomFraction = e - this.tileZoom; } _updateCameraOnTerrain() { const e = this.elevation ? this.elevation.getAtPoint(this.locationCoordinate(this.center), Number.NEGATIVE_INFINITY) : Number.NEGATIVE_INFINITY, t = this.elevation && e === Number.NEGATIVE_INFINITY && this.elevation.visibleDemTiles.length > 0 && this.elevation.exaggeration() > 0 && this._centerAltitudeValidForExaggeration; if (!this._elevation || e === Number.NEGATIVE_INFINITY && (!t || !this._centerAltitude)) return this._centerAltitude = 0, this._seaLevelZoom = null, void (this._centerAltitudeValidForExaggeration = void 0); const i = this._elevation; t || this._centerAltitude && this._centerAltitudeValidForExaggeration && i.exaggeration() && this._centerAltitudeValidForExaggeration !== i.exaggeration() ? (this._centerAltitude = this._centerAltitude / this._centerAltitudeValidForExaggeration * i.exaggeration(), this._centerAltitudeValidForExaggeration = i.exaggeration()) : (this._centerAltitude = e || 0, this._centerAltitudeValidForExaggeration = i.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 t = this._elevation, i = [[.5, .2], [.3, .5], [.5, .5], [.7, .5], [.5, .8]], o = this.horizonLineFromTop(); let r = 0, s = 0; for (let n = 0; n < i.length; n++) { const a = new e.P(i[n][0] * this.width, o + i[n][1] * (this.height - o)), l = t.pointCoordinate(a); if (!l) continue; const c = 1 / Math.hypot(l[0] - this._camera.position[0], l[1] - this._camera.position[1]); r += l[3] * c, s += c; } return 0 === s ? NaN : r / s } get center() { return this._center } set center(e) { e.lat === this._center.lat && e.lng === this._center.lng || (this._unmodified = !1, this._center = e, this._terrainEnabled() && ("ground" === this.cameraElevationReference ? this._updateCameraOnTerrain() : this._updateZoomFromElevation()), this._constrain(), this._calcMatrices()); } _updateZoomFromElevation() { if (null == this._seaLevelZoom || !this._elevation) return; const e = this._seaLevelZoom, t = this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)), i = this.pixelsPerMeter / this.worldSize * t, o = this._mercatorZfromZoom(e), r = this._mercatorZfromZoom(this._maxZoom), s = Math.max(o - i, r); this._setZoom(this._zoomFromMercatorZ(s)); } get padding() { return this._edgeInsets.toJSON() } set padding(e) { this._edgeInsets.equals(e) || (this._unmodified = !1, this._edgeInsets.interpolate(this._edgeInsets, e, 1), this._calcMatrices()); } computeZoomRelativeTo(t) { const i = this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint, t.toAltitude())); let o; o = t.z < this._camera.position[2] ? [i.x, i.y, i.z] : [t.x, t.y, t.z]; const r = e.v.length(e.v.sub([], this._camera.position, o)); return e.c(this._zoomFromMercatorZ(r), this._minZoom, this._maxZoom) } setFreeCameraOptions(t) { if (!this.height) return; if (!t.position && !t.orientation) return; this._updateCameraState(); let i = !1; if (t.orientation && !e.q.exactEquals(t.orientation, this._camera.orientation) && (i = this._setCameraOrientation(t.orientation)), t.position) { const o = [t.position.x, t.position.y, t.position.z]; e.v.exactEquals(o, this._camera.position) || (this._setCameraPosition(o), i = !0); } i && (this._updateStateFromCamera(), this.recenterOnTerrain()); } getFreeCameraOptions() { this._updateCameraState(); const t = this._camera.position, i = new he; return i.position = new e.M(t[0], t[1], t[2]), i.orientation = this._camera.orientation, i._elevation = this.elevation, i._renderWorldCopies = this.renderWorldCopies, i } _setCameraOrientation(t) { if (!e.q.length(t)) return !1; e.q.normalize(t, t); const i = e.v.transformQuat([], [0, 0, -1], t), o = e.v.transformQuat([], [0, -1, 0], t); if (o[2] < 0) return !1; const r = ce(i, o); return !!r && (this._camera.orientation = r, !0) } _setCameraPosition(t) { const i = this.zoomScale(this.minZoom) * this.tileSize, o = this.zoomScale(this.maxZoom) * this.tileSize, r = this.cameraToCenterDistance; t[2] = e.c(t[2], r / o, r / i), this._camera.position = t; } get centerPoint() { return this._edgeInsets.getCenter(this.width, this.height) } get fovAboveCenter() { return this._fov * (.5 + this.centerOffset.y / this.height) } isPaddingEqual(e) { return this._edgeInsets.equals(e) } interpolatePadding(e, t, i) { this._unmodified = !1, this._edgeInsets.interpolate(e, t, i), this._constrain(), this._calcMatrices(); } coveringZoomLevel(e) { const t = (e.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / e.tileSize)); return Math.max(0, t) }
41 getVisibleUnwrappedCoordinates(t) { const i = [new e.U(0, t)]; if (this.renderWorldCopies) { const o = this.pointCoordinate(new e.P(0, 0)), r = this.pointCoordinate(new e.P(this.width, 0)), s = this.pointCoordinate(new e.P(this.width, this.height)), n = this.pointCoordinate(new e.P(0, this.height)), a = Math.floor(Math.min(o.x, r.x, s.x, n.x)), l = Math.floor(Math.max(o.x, r.x, s.x, n.x)), c = 1; for (let o = a - c; o <= l + c; o++)0 !== o && i.push(new e.U(o, t)); } return i } isLODDisabled(e) { return (!e || this.pitch <= 60) && this._edgeInsets.top <= this._edgeInsets.bottom && !this._elevation && !this.projection.isReprojectedInTileSpace } extendTileCoverForShadows(t, i, o) { let r = []; if (0 === i[0] && 0 === i[1]) return r; for (const o of t) { const t = o.canonical, s = o.overscaledZ, n = o.wrap, a = 1 << t.z, l = t.x + 1 < a, c = t.x > 0, h = t.y + 1 < a, _ = t.y > 0, d = o.wrap - (c ? 0 : 1), u = o.wrap + (l ? 0 : 1), p = c ? t.x - 1 : a - 1, m = l ? t.x + 1 : 0; i[0] < 0 ? (r.push(new e.O(s, u, t.z, m, t.y)), i[1] < 0 && h && (r.push(new e.O(s, n, t.z, t.x, t.y + 1)), r.push(new e.O(s, u, t.z, m, t.y + 1))), i[1] > 0 && _ && (r.push(new e.O(s, n, t.z, t.x, t.y - 1)), r.push(new e.O(s, u, t.z, m, t.y - 1)))) : i[0] > 0 ? (r.push(new e.O(s, d, t.z, p, t.y)), i[1] < 0 && h && (r.push(new e.O(s, n, t.z, t.x, t.y + 1)), r.push(new e.O(s, d, t.z, p, t.y + 1))), i[1] > 0 && _ && (r.push(new e.O(s, n, t.z, t.x, t.y - 1)), r.push(new e.O(s, d, t.z, p, t.y - 1)))) : i[1] < 0 && h ? r.push(new e.O(s, n, t.z, t.x, t.y + 1)) : _ && r.push(new e.O(s, n, t.z, t.x, t.y - 1)); } if (r.length > 1) { r.sort(((e, t) => e.overscaledZ - t.overscaledZ || e.wrap - t.wrap || e.canonical.z - t.canonical.z || e.canonical.x - t.canonical.x || e.canonical.y - t.canonical.y)); let e = 0, t = 0; for (; t < r.length;)r[t].equals(r[e]) ? ++t : r[++e] = r[t++]; r.length = e + 1; } const s = []; for (const e of r) r.some((t => e.isChildOf(t))) || s.push(e); return r = s.filter((e => !t.some((t => !!(e.overscaledZ < o && t.isChildOf(e)) || e.equals(t) || e.isChildOf(t))))), r } coveringTiles(t) { let i = this.coveringZoomLevel(t); const o = i, r = this.elevation && this.elevation.exaggeration(), s = r && !t.isTerrainDEM, n = "mercator" === this.projection.name; if (void 0 !== t.minzoom && i < t.minzoom) return []; void 0 !== t.maxzoom && i > t.maxzoom && (i = t.maxzoom); const a = this.locationCoordinate(this.center), l = this.center.lat, c = 1 << i, h = [c * a.x, c * a.y, 0], _ = "globe" === this.projection.name, d = !_, u = e.F.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, i, d), p = _ ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint()), m = c * e.b(1, this.center.lat), f = this._camera.position[2] / e.b(1, this.center.lat), g = [c * p.x, c * p.y, f * (d ? 1 : m)], v = _ || r, x = this.cameraToCenterDistance / t.tileSize * (t.roundZoom ? 1 : .502), y = this.isLODDisabled(!0) ? i : 0; let b; if (this._elevation && t.isTerrainDEM) b = 1e4 * this._elevation.exaggeration(); else if (this._elevation) { const e = this._elevation.getMinMaxForVisibleTiles(); b = e ? e.max : this._centerAltitude; } else b = this._centerAltitude; const w = t.isTerrainDEM ? -b : this._elevation ? this._elevation.getMinElevationBelowMSL() : 0, T = this.projection.isReprojectedInTileSpace ? e.r(this) : 1, E = t => { const i = 1 / 4e4, o = new e.M(t.x + i, t.y, t.z), r = new e.M(t.x, t.y + i, t.z), s = t.toLngLat(), n = o.toLngLat(), a = r.toLngLat(), l = this.locationCoordinate(s), c = this.locationCoordinate(n), h = this.locationCoordinate(a), _ = Math.hypot(c.x - l.x, c.y - l.y), d = Math.hypot(h.x - l.x, h.y - l.y); return Math.sqrt(_ * d) * T / i }, C = t => { const i = b, o = w; return { aabb: e.y(this, c, 0, 0, 0, t, o, i, this.projection), zoom: 0, x: 0, y: 0, minZ: o, maxZ: i, wrap: t, fullyVisible: !1 } }, I = []; let S = []; const M = i, L = t.reparseOverscaled ? o : i, P = e => e * e, D = P((f - this._centerAltitude) * m), A = e => { if (!this._elevation || !e.tileID || !n) return; const t = this._elevation.getMinMaxForTile(e.tileID), i = e.aabb; t ? (i.min[2] = t.min, i.max[2] = t.max, i.center[2] = (i.min[2] + i.max[2]) / 2) : (e.shouldSplit = R(e), e.shouldSplit || (i.min[2] = i.max[2] = i.center[2] = this._centerAltitude)); }, R = t => { if (t.zoom < y) return !0; if (t.zoom === M) return !1; if (null != t.shouldSplit) return t.shouldSplit; const i = t.aabb.distanceX(g), r = t.aabb.distanceY(g); let n = D, a = 1; if (_) { n = P(t.aabb.distanceZ(g)); const i = Math.pow(2, t.zoom), o = e.l((t.y + 1) / i), r = e.l(t.y / i), s = Math.min(Math.max(l, o), r), c = e.a0(s) / e.a0(l); if (a = s === l ? 1 / Math.max(1, this._mercatorScaleRatio - .3) : Math.min(1, c / this._mercatorScaleRatio), this.zoom <= e.Z && t.zoom === M - 1 && c >= .9) return !0 } else if (s && (n = P(t.aabb.distanceZ(g) * m)), this.projection.isReprojectedInTileSpace && o <= 5) { const i = Math.pow(2, t.zoom), o = E(new e.M((t.x + .5) / i, (t.y + .5) / i)); a = o > .85 ? 1 : o; } const c = i * i + r * r + n, h = P((1 << M - t.zoom) * x * a * ((e, t) => { if (t * P(.707) < e) return 1; const i = Math.sqrt(t / e); return i / (1.4144271570014144 + (Math.pow(1.1, i - 1.4144271570014144 + 1) - 1) / (1.1 - 1) - 1) })(Math.max(n, D), c)); return c < h }; if (this.renderWorldCopies) for (let e = 1; e <= 3; e++)I.push(C(-e)), I.push(C(e)); for (I.push(C(0)); I.length > 0;) { const o = I.pop(), r = o.x, a = o.y; let l = o.fullyVisible; const d = () => "globe" === this.projection.name && (0 === o.y || o.y === (1 << o.zoom) - 1); if (!l) { let t = v ? o.aabb.intersects(u) : o.aabb.intersectsFlat(u); if (0 === t && d()) { const i = new e.t(o.zoom, r, a); t = e.x(this, c, i, !0).intersects(u); } if (0 === t) continue; l = 2 === t; } if (o.zoom !== M && R(o)) for (let t = 0; t < 4; t++) { const i = (r << 1) + t % 2, h = (a << 1) + (t >> 1), d = { aabb: n ? o.aabb.quadrant(t) : e.y(this, c, o.zoom + 1, i, h, o.wrap, o.minZ, o.maxZ, this.projection), zoom: o.zoom + 1, x: i, y: h, wrap: o.wrap, fullyVisible: l, tileID: void 0, shouldSplit: void 0, minZ: o.minZ, maxZ: o.maxZ }; s && !_ && (d.tileID = new e.O(o.zoom + 1 === M ? L : o.zoom + 1, o.wrap, o.zoom + 1, i, h), A(d)), I.push(d); } else { const s = o.zoom === M ? L : o.zoom; if (t.minzoom && t.minzoom > s) continue; if (!l) { let t = v ? o.aabb.intersectsPrecise(u) : o.aabb.intersectsPreciseFlat(u); if (0 === t && d()) { const i = new e.t(o.zoom, r, a); t = e.x(this, c, i, !0).intersectsPrecise(u); } if (0 === t) continue } const n = h[0] - (.5 + r + (o.wrap << o.zoom)) * (1 << i - o.zoom), _ = h[1] - .5 - a, p = o.tileID ? o.tileID : new e.O(s, o.wrap, o.zoom, r, a); S.push({ tileID: p, distanceSq: n * n + _ * _ }); } } if (this.fogCullDistSq) { const i = this.fogCullDistSq, o = this.horizonLineFromTop(); S = S.filter((r => { const s = [0, 0, 0, 1], n = [e.J, e.J, 0, 1], a = this.calculateFogTileMatrix(r.tileID.toUnwrapped()); e.e.transformMat4(s, s, a), e.e.transformMat4(n, n, a); const l = e.e.min([], s, n), c = e.e.max([], s, n), h = e.z(l, c); if (0 === h) return !0; let _ = !1; const d = this._elevation; if (d && h > i && 0 !== o) { const i = this.calculateProjMatrix(r.tileID.toUnwrapped()); let s; t.isTerrainDEM || (s = d.getMinMaxForTile(r.tileID)), s || (s = { min: w, max: b }); const n = e._(this.rotation), a = [n[0] * e.J, n[1] * e.J, s.max]; e.v.transformMat4(a, a, i), _ = (1 - a[1]) * this.height * .5 < o; } return h < i || _ })); } return S.sort(((e, t) => e.distanceSq - t.distanceSq)).map((e => e.tileID)) } resize(e, t) { this.width = e, this.height = t, this.pixelsToGLUnits = [2 / e, -2 / t], this._constrain(), this._calcMatrices(); } get unmodified() { return this._unmodified } zoomScale(e) { return Math.pow(2, e) } scaleZoom(e) { return Math.log(e) / Math.LN2 } project(t) { const i = e.c(t.lat, -e.A, e.A), o = this.projection.project(t.lng, i); return new e.P(o.x * this.worldSize, o.y * this.worldSize) } unproject(e) { return this.projection.unproject(e.x / this.worldSize, e.y / this.worldSize) } get point() { return this.project(this.center) } get pointMerc() { return this.point._div(this.worldSize) } get pixelsPerMeterRatio() { return this.pixelsPerMeter / e.b(1, this.center.lat) / this.worldSize } setLocationAtPoint(t, i) { let o, r; const s = this.centerPoint; if ("globe" === this.projection.name) { const e = this.worldSize; o = (i.x - s.x) / e, r = (i.y - s.y) / e; } else { const e = this.pointCoordinate(i), t = this.pointCoordinate(s);
41 o = e.x - t.x, r = e.y - t.y; } const n = this.locationCoordinate(t); this.setLocation(new e.M(n.x - o, n.y - r)); } setLocation(e) { this.center = this.coordinateLocation(e), this.projection.wrap && (this.center = this.center.wrap()); } locationPoint(e) { return this.projection.locationPoint(this, e) } locationPoint3D(e) { return this.projection.locationPoint(this, e, !0) } pointLocation(e) { return this.coordinateLocation(this.pointCoordinate(e)) } pointLocation3D(e) { return this.coordinateLocation(this.pointCoordinate3D(e)) } locationCoordinate(t, i) { const o = i ? e.b(i, t.lat) : void 0, r = this.projection.project(t.lng, t.lat); return new e.M(r.x, r.y, o) } coordinateLocation(e) { return this.projection.unproject(e.x, e.y) } pointRayIntersection(t, i) { const o = null != i ? i : this._centerAltitude, r = [t.x, t.y, 0, 1], s = [t.x, t.y, 1, 1]; e.e.transformMat4(r, r, this.pixelMatrixInverse), e.e.transformMat4(s, s, this.pixelMatrixInverse); const n = s[3]; e.e.scale(r, r, 1 / r[3]), e.e.scale(s, s, 1 / n); const a = r[2], l = s[2]; return { p0: r, p1: s, t: a === l ? 0 : (o - a) / (l - a) } } screenPointToMercatorRay(t) { const i = [t.x, t.y, 0, 1], o = [t.x, t.y, 1, 1]; return e.e.transformMat4(i, i, this.pixelMatrixInverse), e.e.transformMat4(o, o, this.pixelMatrixInverse), e.e.scale(i, i, 1 / i[3]), e.e.scale(o, o, 1 / o[3]), i[2] = e.b(i[2], this._center.lat) * this.worldSize, o[2] = e.b(o[2], this._center.lat) * this.worldSize, e.e.scale(i, i, 1 / this.worldSize), e.e.scale(o, o, 1 / this.worldSize), new e.R([i[0], i[1], i[2]], e.v.normalize([], e.v.sub([], o, i))) } rayIntersectionCoordinate(t) { const { p0: i, p1: o, t: r } = t, s = e.b(i[2], this._center.lat), n = e.b(o[2], this._center.lat); return new e.M(e.n(i[0], o[0], r) / this.worldSize, e.n(i[1], o[1], r) / this.worldSize, e.n(s, n, r)) } pointCoordinate(e, t = this._centerAltitude) { return this.projection.pointCoordinate(this, e.x, e.y, t) } pointCoordinate3D(t) { if (!this.elevation) return this.pointCoordinate(t); let i = this.projection.pointCoordinate3D(this, t.x, t.y); if (i) return new e.M(i[0], i[1], i[2]); let o = 0, r = this.horizonLineFromTop(); if (t.y > r) return this.pointCoordinate(t); const s = .02 * r, n = t.clone(); for (let t = 0; t < 10 && r - o > s; t++) { n.y = e.n(o, r, .66); const t = this.projection.pointCoordinate3D(this, n.x, n.y); t ? (r = n.y, i = t) : o = n.y; } return i ? new e.M(i[0], i[1], i[2]) : this.pointCoordinate(t) } isPointAboveHorizon(e) { return this.projection.isPointAboveHorizon(this, e) } isPointOnSurface(t) { if (t.y < 0 || t.y > this.height || t.x < 0 || t.x > this.width) return !1; if (this.elevation || this.zoom >= e.G) return !this.isPointAboveHorizon(t); const i = this.pointCoordinate(t); return i.y >= 0 && i.y <= 1 } _coordinatePoint(t, i) { const o = i && this.elevation ? this.elevation.getAtPointOrZero(t, this._centerAltitude) : this._centerAltitude, r = [t.x * this.worldSize, t.y * this.worldSize, o + t.toAltitude(), 1]; return e.e.transformMat4(r, r, this.pixelMatrix), r[3] > 0 ? new e.P(r[0] / r[3], r[1] / r[3]) : new e.P(Number.MAX_VALUE, Number.MAX_VALUE) } _getBoundsNonRectangular() { const { top: t, left: i } = this._edgeInsets, o = this.height - this._edgeInsets.bottom, r = this.width - this._edgeInsets.right, s = this.pointLocation3D(new e.P(i, t)), n = this.pointLocation3D(new e.P(r, t)), a = this.pointLocation3D(new e.P(r, o)), l = this.pointLocation3D(new e.P(i, o)); let c = Math.min(s.lng, n.lng, a.lng, l.lng), h = Math.max(s.lng, n.lng, a.lng, l.lng), _ = Math.min(s.lat, n.lat, a.lat, l.lat), d = Math.max(s.lat, n.lat, a.lat, l.lat); const u = Math.pow(2, -this.zoom) / 16 * 270, p = "globe" === this.projection.name ? 1 : 4, m = (t, i, o, r, s) => { const n = (t + o) / 2, a = (i + r) / 2, l = new e.P(n, a), { lng: f, lat: g } = this.pointLocation3D(l), v = Math.max(0, c - f, _ - g, f - h, g - d); c = Math.min(c, f), h = Math.max(h, f), _ = Math.min(_, g), d = Math.max(d, g), (s < p || v > u) && (m(t, i, n, a, s + 1), m(n, a, o, r, s + 1)); }; if (m(i, t, r, t, 1), m(r, t, r, o, 1), m(r, o, i, o, 1), m(i, o, i, t, 1), "globe" === this.projection.name) { const [t, i] = e.B(this); t ? (d = 90, h = 180, c = -180) : i && (_ = -90, h = 180, c = -180); } return new e.D(new e.L(c, _), new e.L(h, d)) } _getBoundsRectangular(t, i) { const { top: o, left: r } = this._edgeInsets, s = this.height - this._edgeInsets.bottom, n = this.width - this._edgeInsets.right, a = new e.P(r, o), l = new e.P(n, o), c = new e.P(n, s), h = new e.P(r, s); let _ = this.pointCoordinate(a, t), d = this.pointCoordinate(l, t); const u = this.pointCoordinate(c, i), p = this.pointCoordinate(h, i), m = (e, t) =>
41 (t.y - e.y) / (t.x - e.x); return _.y > 1 && d.y >= 0 ? _ = new e.M((1 - p.y) / m(p, _) + p.x, 1) : _.y < 0 && d.y <= 1 && (_ = new e.M(-p.y / m(p, _) + p.x, 0)), d.y > 1 && _.y >= 0 ? d = new e.M((1 - u.y) / m(u, d) + u.x, 1) : d.y < 0 && _.y <= 1 && (d = new e.M(-u.y / m(u, d) + u.x, 0)), (new e.D).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(u)) } _getBoundsRectangularTerrain() { const e = this.elevation; if (!e.visibleDemTiles.length || e.isUsingMockSource()) return this._getBoundsRectangular(0, 0); const t = e.visibleDemTiles.reduce(((e, t) => { if (t.dem) { const i = t.dem.tree; e.min = Math.min(e.min, i.minimums[0]), e.max = Math.max(e.max, i.maximums[0]); } return e }), { min: Number.MAX_VALUE, max: 0 }); return this._getBoundsRectangular(t.min * e.exaggeration(), t.max * e.exaggeration()) } getBounds() { return "mercator" === this.projection.name || "equirectangular" === this.projection.name ? this._terrainEnabled() ? this._getBoundsRectangularTerrain() : this._getBoundsRectangular(0, 0) : this._getBoundsNonRectangular() } horizonLineFromTop(e = !0) { const t = this.height / 2 / Math.tan(this._fov / 2) / Math.tan(Math.max(this._pitch, .1)) - this.centerOffset.y, i = this.height / 2 - t * (1 - this._horizonShift); return e ? Math.max(0, i) : i } getMaxBounds() { return this.maxBounds } setMaxBounds(t) { this.maxBounds = t, this.minLat = -e.A, this.maxLat = e.A, this.minLng = -180, this.maxLng = 180, t && (this.minLat = t.getSouth(), this.maxLat = t.getNorth(), this.minLng = t.getWest(), this.maxLng = t.getEast(), this.maxLng < this.minLng && (this.maxLng += 360)), this.worldMinX = e.E(this.minLng) * this.tileSize, this.worldMaxX = e.E(this.maxLng) * this.tileSize, this.worldMinY = e.H(this.maxLat) * this.tileSize, this.worldMaxY = e.H(this.minLat) * this.tileSize, this._constrain(); } calculatePosMatrix(e, t) { return this.projection.createTileMatrix(this, t, e) } calculateDistanceTileData(t) { const i = t.key, o = this._distanceTileDataCache; if (o[i]) return o[i]; const r = t.canonical, s = 1 / this.height, n = this.cameraWorldSize, a = n / this.zoomScale(r.z), l = (r.x + Math.pow(2, r.z) * t.wrap) * a, c = r.y * a, h = this.point; h.x *= n / this.worldSize, h.y *= n / this.worldSize; const _ = this.angle, d = Math.sin(-_), u = -Math.cos(-_); return o[i] = { bearing: [d, u], center: [(h.x - l) * s, (h.y - c) * s], scale: a / e.J * s }, o[i] } calculateFogTileMatrix(t) { const i = t.key, o = this._fogTileMatrixCache; if (o[i]) return o[i]; const r = this.projection.createTileMatrix(this, this.cameraWorldSizeForFog, t); return e.m.multiply(r, this.worldToFogMatrix, r), o[i] = new Float32Array(r), o[i] } calculateProjMatrix(t, i = !1, o = !1) { const r = t.key; let s; if (s = o ? this._expandedProjMatrixCache : i ? this._alignedProjMatrixCache : this._projMatrixCache, s[r]) return s[r]; const n = this.calculatePosMatrix(t, this.worldSize); let a; return a = this.projection.isReprojectedInTileSpace ? this.mercatorMatrix : o ? this.expandedFarZProjMatrix : i ? this.alignedProjMatrix : this.projMatrix, e.m.multiply(n, a, n), s[r] = new Float32Array(n), s[r] } calculatePixelsToTileUnitsMatrix(t) { const i = t.tileID.key, o = this._pixelsToTileUnitsCache; if (o[i]) return o[i]; const r = e.K(t, this); return o[i] = r, o[i] } customLayerMatrix() { return this.mercatorMatrix.slice() } globeToMercatorMatrix() { if ("globe" === this.projection.name) { const t = 1 / this.worldSize, i = e.m.fromScaling([], [t, t, t]); return e.m.multiply(i, i, this.globeMatrix), i } } recenterOnTerrain() { if (!this._elevation || "globe" === this.projection.name) return; const t = this._elevation; this._updateCameraState(); const i = e.b(1, this._center.lat) * this.worldSize, o = this._computeCameraPosition(i), r = this._camera.forward(), s = e.b(1, this._center.lat); o[2] /= s, r[2] /= s, e.v.normalize(r, r); const n = t.raycast(o, r, t.exaggeration()); if (n) { const t = e.v.scaleAndAdd([], o, r, n), i = new e.M(t[0], t[1], e.b(t[2], e.l(t[1]))), a = (i.z + e.v.length([i.x - o[0], i.y - o[1], i.z - o[2] * s])) * this._pixelsPerMercatorPixel; this._seaLevelZoom = this._zoomFromMercatorZ(a), this._centerAltitude = i.toAltitude(), this._center = this.coordinateLocation(i), this._updateZoomFromElevation(), this._constrain(), this._calcMatrices(); } } _constrainCamera(t = !1) { if (!this._elevation) return; const i = this._elevation, o = e.b(1, this._center.lat) * this.worldSize, r = this._computeCameraPosition(o), s = i.getAtPointOrZero(new e.M(...r)), n = this.pixelsPerMeter / this.worldSize * s, a = this._minimumHeightOverTerrain(), l = r[2] - n; if (l <= a) if (l < 0 || t) { const t = this.locationCoordinate(this._center, this._centerAltitude), i = [r[0], r[1], t.z - r[2]], o = e.v.length(i); i[2] -= (a - l) / this._pixelsPerMercatorPixel; const s = e.v.length(i); if (0 === s) return; e.v.scale(i, i, o / s * this._pixelsPerMercatorPixel), this._camera.position = [r[0], r[1], t.z * this._pixelsPerMercatorPixel - i[2]], this._updateStateFromCamera(); } else this._isCameraConstrained = !0; } _constrain() { if (!this.center || !this.width || !this.height || this._constraining) return; this._constraining = !0; const t = "globe" === this.projection.name || this.mercatorFromTransition; if (this.projection.isReprojectedInTileSpace || t) { const i = this.center; return i.lat = e.c(i.lat, this.minLat, this.maxLat), (this.maxBounds || !this.renderWorldCopies && !t) && (i.lng = e.c(i.lng, this.minLng, this.maxLng)), this.center = i, void (this._constraining = !1) } const i = this._unmodified, { x: o, y: r } = this.point; let s = 0, n = o, a = r; const l = this.width / 2, c = this.height / 2, h = this.worldMinY * this.scale, _ = this.worldMaxY * this.scale; if (r - c < h && (a = h + c), r + c > _ && (a = _ - c), _ - h < this.height && (s = Math.max(s, this.height / (_ - h)), a = (_ + h) / 2), this.maxBounds || !this._renderWorldCopies || !this.projection.wrap) { const e = this.worldMinX * this.scale, t = this.worldMaxX * this.scale, i = this.worldSize / 2 - (e + t) / 2; n = (o + i + this.worldSize) % this.worldSize - i, n - l < e && (n = e + l), n + l > t && (n = t - l), t - e < this.width && (s = Math.max(s, this.width / (t - e)), n = (t + e) / 2); } n === o && a === r || (this.center = this.unproject(new e.P(n, a))), s && (this.zoom += this.scaleZoom(s)), this._constrainCamera(), this._unmodified = i, this._constraining = !1; } _minZoomForBounds() { let e = Math.max(0, this.scaleZoom(this.height / (this.worldMaxY - this.worldMinY))); return this.maxBounds && (e = Math.max(e, this.scaleZoom(this.width / (this.worldMaxX - this.worldMinX)))), e } _maxCameraBoundsDistance() { return this._mercatorZfromZoom(this._minZoomForBounds()) } _calcMatrices() { if (!this.height) return; const t = this.centerOffset, i = "globe" === this.projection.name, o = this.pixelsPerMeter; "globe" === this.projection.name && (this._mercatorScaleRatio = e.b(1, this.center.lat) / e.b(1, e.$)); const r = e.N(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 s = "meters" === this.projection.zAxisUnit ? o : 1, n = this._camera.getWorldToCamera(this.worldSize, s); let a; const l = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, this._farZ); if (l[8] = 2 * -t.x / this.width, l[9] = 2 * t.y / this.height, this.isOrthographic) { let e = .5 * this.height / Math.tan(this._fov / 2) * 1 * Math.tan(.5 * this._fov), i = e * this.aspect, o = -i, r = -e; i -= t.x, o -= t.x, e += t.y, r += t.y, a = this._camera.getCameraToClipOrthographic(o, i, r, e, this._nearZ, this._farZ), ((e, t, i, o) => { for (let r = 0; r < 16; r++)e[r] = Le(t[r], i[r], o); })(a, a, l, Pe(this.pitch >= 15 ? 1 : this.pitch / 15)); } else a = l; const c = e.m.mul([], l, n); let h = e.m.mul([], a, n); if (this.projection.isReprojectedInTileSpace) { const t = this.locationCoordinate(this.center), i = e.m.identity([]); e.m.translate(i, i, [t.x * this.worldSize, t.y * this.worldSize, 0]), e.m.multiply(i, i, e.Q(this)), e.m.translate(i, i, [-t.x * this.worldSize, -t.y * this.worldSize, 0]), e.m.multiply(h, h, i), e.m.multiply(c, c, i), this.inverseAdjustmentMatrix = e.S(this); } else this.inverseAdjustmentMatrix = [1, 0, 0, 1]; if (this.mercatorMatrix = e.m.scale([], h, [this.worldSize, this.worldSize, this.worldSize / s, 1]), this.projMatrix = h, this.invProjMatrix = e.m.invert(new Float64Array(16), this.projMatrix), i) { const i = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, 1 / 0); i[8] = 2 * -t.x / this.width, i[9] = 2 * t.y / this.height, this.expandedFarZProjMatrix = e.m.mul([], i, n); } else this.expandedFarZProjMatrix = this.projMatrix; const _ = e.m.invert([], a); this.frustumCorners = e.T.fromInvProjectionMatrix(_, this.horizonLineFromTop(), this.height), this.cameraFrustum = e.F.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, 0, !i); const d = new Float32Array(16); e.m.identity(d), e.m.scale(d, d, [1, -1, 1]), e.m.rotateX(d, d, this._pitch), e.m.rotateZ(d, d, this.angle); const u = e.m.perspective(new Float32Array(16), this._fov, this.width / this.height, this._nearZ, this._farZ); this.starsProjMatrix = e.m.clone(u); const p = (Math.PI / 2 - this._pitch) * (this.height / this._fov) * this._horizonShift; u[8] = 2 * -t.x / this.width, u[9] = 2 * (t.y + p) / this.height, this.skyboxMatrix = e.m.multiply(d, u, d); const m = this.point, f = m.x, g = m.y, v = this.width % 2 / 2, x = this.height % 2 / 2, y = Math.cos(this.angle), b = Math.sin(this.angle), w = f - Math.round(f) + y * v + b * x, T = g - Math.round(g) + y * x + b * v, E = new Float64Array(h); if (e.m.translate(E, E, [w > .5 ? w - 1 : w, T > .5 ? T - 1 : T, 0]), this.alignedProjMatrix = E, h = e.m.create(), e.m.scale(h, h, [this.width / 2, -this.height / 2, 1]), e.m.translate(h, h, [1, -1, 0]), this.labelPlaneMatr
41ix = h, h = e.m.create(), e.m.scale(h, h, [1, -1, 1]), e.m.translate(h, h, [-1, -1, 0]), e.m.scale(h, h, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = h, this.pixelMatrix = e.m.multiply(new Float64Array(16), this.labelPlaneMatrix, c), this._calcFogMatrices(), this._distanceTileDataCache = {}, h = e.m.invert(new Float64Array(16), this.pixelMatrix), !h) throw new Error("failed to invert matrix"); if (this.pixelMatrixInverse = h, "globe" === this.projection.name || this.mercatorFromTransition) { this.globeMatrix = e.V(this); const t = [this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]]; this.globeCenterInViewSpace = e.v.transformMat4(t, t, n), this.globeRadius = this.worldSize / 2 / Math.PI - 1; } else this.globeMatrix = h; this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._pixelsToTileUnitsCache = {}, this._expandedProjMatrixCache = {}; } _calcFogMatrices() { this._fogTileMatrixCache = {}; const t = this.cameraWorldSizeForFog, i = this.cameraPixelsPerMeter, o = this._camera.position, r = 1 / this.height / this._pixelsPerMercatorPixel, s = [t, t, i]; e.v.scale(s, s, r), e.v.scale(o, o, -1), e.v.multiply(o, o, s); const n = e.m.create(); e.m.translate(n, n, o), e.m.scale(n, n, s), this.mercatorFogMatrix = n, this.worldToFogMatrix = this._camera.getWorldToCameraPosition(t, i, r); } _computeCameraPosition(e) { const t = (e = e || this.pixelsPerMeter) / this.pixelsPerMeter, i = this._camera.forward(), o = this.point, r = this._mercatorZfromZoom(this._seaLevelZoom ? this._seaLevelZoom : this._zoom) * t - e / this.worldSize * this._centerAltitude; return [o.x / this.worldSize - i[0] * r, o.y / this.worldSize - i[1] * r, e / this.worldSize * this._centerAltitude - i[2] * r] } _updateCameraState() { this.height && (this._camera.setPitchBearing(this._pitch, this.angle), this._camera.position = this._computeCameraPosition()); } _translateCameraConstrained(t) { const i = this._maxCameraBoundsDistance() * Math.cos(this._pitch), o = this._camera.position[2], r = t[2]; let s = 1; this.projection.wrap && (this.center = this.center.wrap()), r > 0 && (s = Math.min((i - o) / r, 1)), this._camera.position = e.v.scaleAndAdd([], this._camera.position, t, s), this._updateStateFromCamera(); } _updateStateFromCamera() { const t = this._camera.position, i = this._camera.forward(), { pitch: o, bearing: r } = this._camera.getPitchBearing(), s = e.b(this._centerAltitude, this.center.lat) * this._pixelsPerMercatorPixel, n = this._mercatorZfromZoom(this._maxZoom) * Math.cos(e.d(this._maxPitch)), a = Math.max((t[2] - s) / Math.cos(o), n), l = this._zoomFromMercatorZ(a); e.v.scaleAndAdd(t, t, i, a), this._pitch = e.c(o, e.d(this.minPitch), e.d(this.maxPitch)), this.angle = e.w(r, -Math.PI, Math.PI), this._setZoom(e.c(l, this._minZoom, this._maxZoom)), this._updateSeaLevelZoom(), this._center = this.coordinateLocation(new e.M(t[0], t[1], t[2])), this._unmodified = !1, this._constrain(), this._calcMatrices(); } _worldSizeFromZoom(e) { return Math.pow(2, e) * this.tileSize } _mercatorZfromZoom(e) { return this.cameraToCenterDistance / this._worldSizeFromZoom(e) } _minimumHeightOverTerrain() { const e = Math.min((null != this._seaLevelZoom ? this._seaLevelZoom : this._zoom) + 4, this._maxZoom); return this._mercatorZfromZoom(e) } _zoomFromMercatorZ(e) { return this.scaleZoom(this.cameraToCenterDistance / (e * this.tileSize)) } zoomFromMercatorZAdjusted(t) { let i = 0, o = e.G, r = 0, s = 1 / 0; for (; o - i > 1e-6 && o > i;) { const e = i + .5 * (o - i), n = this.tileSize * Math.pow(2, e), a = this.getCameraToCenterDistance(this.projection, e, n), l = this.scaleZoom(a / (t * this.tileSize)), c = Math.abs(e - l); c < s && (s = c, r = e), e < l ? i = e : o = e; } return r } _terrainEnabled() { return !(!this._elevation || !this.projection.supportsTerrain && (e.X("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."), 1)) } anyCornerOffEdge(t, i) { const o = Math.min(t.x, i.x), r = Math.max(t.x, i.x), s = Math.min(t.y, i.y), n = Math.max(t.y, i.y); if (s < this.horizonLineFromTop(!1)) return !0; if ("mercator" !== this.projection.name) return !1; const a = [new e.P(o, s), new e.P(r, n), new e.P(o, n), new e.P(r, s)], l = this.renderWorldCopies ? -3 : 0, c = this.renderWorldCopies ? 4 : 1; for (const e of a) { const t = this.pointRayIntersection(e); if (t.t < 0) return !0; const i = this.rayIntersectionCoordinate(t); if (i.x < l || i.y < 0 || i.x > c || i.y > 1) return !0 } return !1 } isHorizonVisible() { return this.pitch + e.Y(this.fovAboveCenter) > 88 || this.anyCornerOffEdge(new e.P(0, 0), new e.P(this.width, this.height)) } zoomDeltaToMovement(t, i) { const o = e.v.length(e.v.sub([], this._camera.position, t)), r = this._zoomFromMercatorZ(o) + i; return o - this._mercatorZfromZoom(r) } getCameraPoint() { if ("globe" === this.projection.name) { const t = function ([t, i, o], r) { const s = [t, i, o, 1]; e.e.transformMat4(s, s, r); const n = s[3] = Math.max(s[3], 1e-6); return s[0] /= n, s[1] /= n, s[2] /= n, s }([this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]], this.pixelMatrix); return new e.P(t[0], t[1]) } { const t = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1); return this.centerPoint.add(new e.P(0, t)) } } getCameraToCenterDistance(t, i = this.zoom, o = this.worldSize) { const r = e.N(t, i, this.width, this.height, 1024), s = t.pixelSpaceConversion(this.center.lat, o, r); let n = .5 / Math.tan(.5 * this._fov) * this.height * s; return this.isOrthographic && (n = Le(1, n, Pe(this.pitch >= 15 ? 1 : this.pitch / 15))), n } getWorldToCameraMatrix() { const t = this._camera.getWorldToCamera(this.worldSize, "meters" === this.projection.zAxisUnit ? this.pixelsPerMeter : 1); return "globe" === this.projection.name && e.m.multiply(t, t, this.globeMatrix), t } getFrustum(t) { return e.F.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, t, "meters" === this.projection.zAxisUnit) } } function Ae(e) { const { userImage: t } = e; return !!(t && t.render && t.render()) && (e.data.replace(new Uint8Array(t.data.buffer)), !0) } class Re extends e.a6 { constructor() { super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = {}, this.requestors = [], this.patterns = {}, this.atlasImage = {}, this.atlasTexture = {}, this.dirty = !0; } createScope(t) { this.images[t] = {}, this.loaded[t] = !1, this.updatedImages[t] = {}, this.patterns[t] = {}, this.callbackDispatchedThisFrame[t] = {}, this.atlasImage[t] = new e.a5({ width: 1, height: 1 }); } isLoaded() { for (const e in this.loaded) if (!this.loaded[e]) return !1; return !0 } setLoaded(e, t) { if (this.loaded[t] !== e && (this.loaded[t] = e, e)) { for (const { ids: e, callback: i } of this.requestors) this._notify(e, t, i); this.requestors = []; } } hasImage(e, t) { return !!this.getImage(e, t) } getImage(e, t) { return this.images[t][e] }
41 addImage(e, t, i) { this._validate(e, i) && (this.images[t][e] = i); } _validate(t, i) { let o = !0; return this._validateStretch(i.stretchX, i.data && i.data.width) || (this.fire(new e.a7(new Error(`Image "${t}" has invalid "stretchX" value`))), o = !1), this._validateStretch(i.stretchY, i.data && i.data.height) || (this.fire(new e.a7(new Error(`Image "${t}" has invalid "stretchY" value`))), o = !1), this._validateContent(i.content, i) || (this.fire(new e.a7(new Error(`Image "${t}" has invalid "content" value`))), o = !1), o } _validateStretch(e, t) { if (!e) return !0; let i = 0; for (const o of e) { if (o[0] < i || o[1] < o[0] || t < o[1]) return !1; i = o[1]; } return !0 } _validateContent(e, t) { return !(e && (4 !== e.length || e[0] < 0 || t.data.width < e[0] || e[1] < 0 || t.data.height < e[1] || e[2] < 0 || t.data.width < e[2] || e[3] < 0 || t.data.height < e[3] || e[2] < e[0] || e[3] < e[1])) } updateImage(e, t, i) { i.version = this.images[t][e].version + 1, this.images[t][e] = i, this.updatedImages[t][e] = !0; } removeImage(e, t) { const i = this.images[t][e]; delete this.images[t][e], delete this.patterns[t][e], i.userImage && i.userImage.onRemove && i.userImage.onRemove(); } listImages(e) { return Object.keys(this.images[e]) } getImages(e, t, i) { let o = !0; const r = !!this.loaded[t]; if (!r) for (const i of e) this.images[t][i] || (o = !1); r || o ? this._notify(e, t, i) : this.requestors.push({ ids: e, scope: t, callback: i }); } getUpdatedImages(e) { return this.updatedImages[e] } _notify(t, i, o) { const r = {}; for (const o of t) { this.images[i][o] || this.fire(new e.a8("styleimagemissing", { id: o })); const t = this.images[i][o]; t ? r[o] = { data: t.data.clone(), pixelRatio: t.pixelRatio, sdf: t.sdf, version: t.version, stretchX: t.stretchX, stretchY: t.stretchY, content: t.content, hasRenderCallback: Boolean(t.userImage && t.userImage.render) } : e.X(`Image "${o}" 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.`); } o(null, r); } getPixelSize(e) { const { width: t, height: i } = this.atlasImage[e]; return { width: t, height: i } } getPattern(t, i) { const o = this.patterns[i][t], r = this.getImage(t, i); if (!r) return null; if (o && o.position.version === r.version) return o.position; if (o) o.position.version = r.version; else { const o = { w: r.data.width + 2, h: r.data.height + 2, x: 0, y: 0 }, s = new e.ab(o, r); this.patterns[i][t] = { bin: o, position: s }; } return this._updatePatternAtlas(i), this.patterns[i][t].position } bind(t, i) { const o = t.gl; let r = this.atlasTexture[i]; r ? this.dirty && (r.update(this.atlasImage[i]), this.dirty = !1) : (r = new e.a9(t, this.atlasImage[i], o.RGBA), this.atlasTexture[i] = r), r.bind(o.LINEAR, o.CLAMP_TO_EDGE); } _updatePatternAtlas(t) { const i = []; for (const e in this.patterns[t]) i.push(this.patterns[t][e].bin); const { w: o, h: r } = e.aa(i), s = this.atlasImage[t]; s.resize({ width: o || 1, height: r || 1 }); for (const i in this.patterns[t]) { const { bin: o } = this.patterns[t][i], r = o.x + 1, n = o.y + 1, a = this.images[t][i].data, l = a.width, c = a.height; e.a5.copy(a, s, { x: 0, y: 0 }, { x: r, y: n }, { width: l, height: c }), e.a5.copy(a, s, { x: 0, y: c - 1 }, { x: r, y: n - 1 }, { width: l, height: 1 }), e.a5.copy(a, s, { x: 0, y: 0 }, { x: r, y: n + c }, { width: l, height: 1 }), e.a5.copy(a, s, { x: l - 1, y: 0 }, { x: r - 1, y: n }, { width: 1, height: c }), e.a5.copy(a, s, { x: 0, y: 0 }, { x: r + l, y: n }, { width: 1, height: c }); } this.dirty = !0; } beginFrame() { for (const e in this.images) this.callbackDispatchedThisFrame[e] = {}; } dispatchRenderCallbacks(e, t) { for (const i of e) { if (this.callbackDispatchedThisFrame[t][i]) continue; this.callbackDispatchedThisFrame[t][i] = !0; const e = this.images[t][i]; Ae(e) && this.updateImage(i, t, e); } } } const ze = new e.ac({ anchor: new e.ad(e.ae.light.anchor), position: new e.af(e.ae.light.position), color: new e.ad(e.ae.light.color), intensity: new e.ad(e.ae.light.intensity) }); class Oe extends e.a6 { constructor(t, i = "flat") { super(), this._transitionable = new e.ag(ze), this.setLight(t, i), this._transitioning = this._transitionable.untransitioned(); } getLight() { return this._transitionable.serialize() } setLight(t, i, o = {}
41) { this._validate(e.ah, t, o) || (this._transitionable.setTransitionOrValue(t), this.id = i); } updateTransitions(e) { this._transitioning = this._transitionable.transitioned(e, this._transitioning); } hasTransition() { return this._transitioning.hasTransition() } recalculate(e) { this.properties = this._transitioning.possiblyEvaluate(e); } _validate(t, i, o) { return (!o || !1 !== o.validate) && e.ai(this, t.call(e.aj, e.ak({ value: i, style: { glyphs: !0, sprite: !0 }, styleSpec: e.ae }))) } } const Fe = new e.ac({ source: new e.ad(e.ae.terrain.source), exaggeration: new e.ad(e.ae.terrain.exaggeration) }); let Be = class extends e.a6 { constructor(t, i, o, r) { super(), this.scope = o, this._transitionable = new e.ag(Fe, o, r), this._transitionable.setTransitionOrValue(t, r), this._transitioning = this._transitionable.untransitioned(), this.drapeRenderMode = i; } get() { return this._transitionable.serialize() } set(e, t) { this._transitionable.setTransitionOrValue(e, t); } updateTransitions(e) { this._transitioning = this._transitionable.transitioned(e, this._transitioning); } hasTransition() { return this._transitioning.hasTransition() } recalculate(e) { this.properties = this._transitioning.possiblyEvaluate(e); } getExaggeration(t) { return this._transitioning.possiblyEvaluate(new e.al(t)).get("exaggeration") } isZoomDependent() { const t = this._transitionable._values.exaggeration; return null != t && null != t.value && null != t.value.expression && t.value.expression instanceof e.am } }; const ke = 45, Ne = 65, Ue = .05; function Ge(t, i, o, r) { const s = e.an(ke, Ne, o), [n, a] = je(t, r); let l = 1 - Math.min(1, Math.exp((i - n) / (a - n) * -6)); return l *= l * l, l = Math.min(1, 1.00747 * l), l * s * t.alpha } function je(e, t) { const i = .5 / Math.tan(.5 * t); return [e.range[0] + i, e.range[1] + i] } function Ve(t, i, o, r, s) { const n = e.v.transformMat4([], [i, o, r], s.mercatorFogMatrix); return Ge(t, e.v.length(n), s.pitch, s._fov) } function Ze(t, i, o, r, s, n, a) { const l = [[o, r, 0], [s, r, 0], [s, n, 0], [o, n, 0]]; let c = Number.MAX_VALUE, h = -Number.MAX_VALUE; for (const t of l) { const o = e.v.transformMat4([], t, i), r = e.v.length(o); c = Math.min(c, r), h = Math.max(h, r); } return [Ge(t, c, a.pitch, a._fov), Ge(t, h, a.pitch, a._fov)] } const We = new e.ac({ range: new e.ad(e.ae.fog.range), color: new e.ad(e.ae.fog.color), "high-color": new e.ad(e.ae.fog["high-color"]), "space-color": new e.ad(e.ae.fog["space-color"]), "horizon-blend": new e.ad(e.ae.fog["horizon-blend"]), "star-intensity": new e.ad(e.ae.fog["star-intensity"]), "vertical-range": new e.ad(e.ae.fog["vertical-range"]) }); class He extends e.a6 { constructor(t, i) { super(), this._transitionable = new e.ag(We), this.set(t), this._transitioning = this._transitionable.untransitioned(), this._transform = i; } get state() { const t = this._transform, i = "globe" === t.projection.name, o = e.ao(t.zoom), r = this.properties.get("range"), s = [.5, 3]; return { range: i ? [e.n(s[0], r[0], o), e.n(s[1], r[1], o)] : r, horizonBlend: this.properties.get("horizon-blend"), alpha: this.properties.get("color").a } } get() { return this._transitionable.serialize() } set(t, i = {}) { if (this._validate(e.ap, t, i)) return; const o = e.ak({}, t); for (const t of Object.keys(e.ae.fog)) void 0 === o[t] && (o[t] = e.ae.fog[t].default); this._transitionable.setTransitionOrValue(o); } getOpacity(t) { if (!this._transform.projection.supportsFog) return 0; const i = this.properties && this.properties.get("color") || 1; return ("globe" === this._transform.projection.name ? 1 : e.an(ke, Ne, t)) * i.a } getOpacityAtLatLng(t, i) { return this._transform.projection.supportsFog ? function (t, i, o) { const r = e.M.fromLngLat(i), s = o.elevation ? o.elevation.getAtPointOrZero(r) : 0; return Ve(t, r.x, r.y, s, o) }(this.state, t, i) : 0 } getOpacityForTile(t) { if (!this._transform.projection.supportsFog) return [1, 1]; const i = this._transform.calculateFogTileMatrix(t.toUnwrapped()); return Ze(this.state, i, 0, 0, e.J, e.J, this._transform) } getOpacityForBounds(e, t, i, o, r) { return this._transform.projection.supportsFog ? Ze(this.state, e, t, i, o, r, this._transform) : [1, 1] } getFovAdjustedRange(e) { return this._transform.projection.supportsFog ? je(this.state, e) : [0, 1] } isVisibleOnFrustum(t) { if (!this._transform.projection.supportsFog) return !1; const i = [4, 5, 6, 7]; for (const o of i) { const i = t.points[o]; let r; if (i[2] >= 0) r = i; else { const s = t.points[o - 4]; r = e.aq(s, i, s[2] / (s[2] - i[2])); } if (Ve(this.state, r[0], r[1], 0, this._transform) >= Ue) return !0 } return !1 } updateTransitions(e) { this._transitioning = this._transitionable.transitioned(e, this._transitioning); } hasTransition() { return this._transitioning.hasTransition() } recalculate(e) { this.properties = this._transitioning.possiblyEvaluate(e); } _validate(t, i, o) { return (!o || !1 !== o.validate) && e.ai(this, t.call(e.aj, e.ak({ value: i, style: { glyphs: !0, sprite: !0 }, styleSpec: e.ae }))) } } class qe extends e.a6 { constructor(t, i, o, r) { super(), this.scope = o, this._options = t, this.properties = new e.ar(i), this._transitionable = new e.ag(i, o, new Map(r)), this._transitionable.setTransitionOrValue(t.properties), this._transitioning = this._transitionable.untransitioned(); } updateConfig(e) { this._transitionable.setTransitionOrValue(this._options.properties, new Map(e)); } updateTransitions(e) { this._transitioning = this._transitionable.transitioned(e, this._transitioning); } hasTransition() { return this._transitioning.hasTransition() } recalculate(e) { this.properties = this._transitioning.possiblyEvaluate(e); } get() { return this._options.properties = this._transitionable.serialize(), this._options } set(e, t) { this._options = e, this._transitionable.setTransitionOrValue(e.properties, t); } shadowsEnabled() { return !!this.properties && !0 === this.properties.get("cast-shadows") } } const $e = new e.ac({ color: new e.ad(e.ae.properties_light_ambient.color), intensity: new e.ad(e.ae.properties_light_ambient.intensity) }), Xe = new e.ac({ direction: new e.as(e.ae.properties_light_directional.direction), color: new e.ad(e.ae.properties_light_directional.color), intensity: new e.ad(e.ae.properties_light_directional.intensity), "cast-shadows": new e.ad(e.ae.properties_light_directional["cast-shadows"]), "shadow-intensity": new e.ad(e.ae.properties_light_directional["shadow-intensity"]) }); class Je { constructor(e, t, i, o) { this.screenBounds = e, this.cameraPoint = t, this._screenRaycastCache = {}, this._cameraRaycastCache = {}, this.isAboveHorizon = i, this.screenGeometry = this.bufferedScreenGeometry(0), this.screenGeometryMercator = this._bufferedScreenMercator(0, o); }
vendor: 12,831 bytes, line 41
41 static createFromScreenPoints(t, i) { let o, r; if (t instanceof e.P || "number" == typeof t[0]) { const s = e.P.convert(t); o = [s], r = i.isPointAboveHorizon(s); } else { const s = e.P.convert(t[0]), n = e.P.convert(t[1]); o = [s, n], r = e.at(s, n).every((e => i.isPointAboveHorizon(e))); } return new Je(o, i.getCameraPoint(), r, i) } isPointQuery() { return 1 === this.screenBounds.length } bufferedScreenGeometry(t) { return e.at(this.screenBounds[0], 1 === this.screenBounds.length ? this.screenBounds[0] : this.screenBounds[1], t) } bufferedCameraGeometry(t) { const i = this.screenBounds[0], o = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e.P(1, 1)) : this.screenBounds[1], r = e.at(i, o, 0, !1); return this.cameraPoint.y > o.y && (this.cameraPoint.x > i.x && this.cameraPoint.x < o.x ? r.splice(3, 0, this.cameraPoint) : this.cameraPoint.x >= o.x ? r[2] = this.cameraPoint : this.cameraPoint.x <= i.x && (r[3] = this.cameraPoint)), e.au(r, t) } bufferedCameraGeometryGlobe(t) { const i = this.screenBounds[0], o = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e.P(1, 1)) : this.screenBounds[1], r = e.at(i, o, t), s = this.cameraPoint.clone(); switch (3 * ((s.y > i.y) + (s.y > o.y)) + ((s.x > i.x) + (s.x > o.x))) { case 0: r[0] = s, r[4] = s.clone(); break; case 1: r.splice(1, 0, s); break; case 2: r[1] = s; break; case 3: r.splice(4, 0, s); break; case 5: r.splice(2, 0, s); break; case 6: r[3] = s; break; case 7: r.splice(3, 0, s); break; case 8: r[2] = s; }return r } containsTile(t, i, o, r = 0) { const s = t.queryPadding / i._pixelsPerMercatorPixel + 1, n = o ? this._bufferedCameraMercator(s, i) : this._bufferedScreenMercator(s, i); let a = t.tileID.wrap + (n.unwrapped ? r : 0); const l = n.polygon.map((i => e.av(t.tileTransform, i, a))); if (!e.aw(l, 0, 0, e.J, e.J)) return; a = t.tileID.wrap + (this.screenGeometryMercator.unwrapped ? r : 0); const c = this.screenGeometryMercator.polygon.map((i => e.ax(t.tileTransform, i, a))), h = c.map((t => new e.P(t[0], t[1]))), _ = i.getFreeCameraOptions().position || new e.M(0, 0, 0), d = e.ax(t.tileTransform, _, a), u = c.map((t => { const i = e.v.sub(t, t, d); return e.v.normalize(i, i), new e.R(d, i) })), p = e.ay(t, 1, i.zoom) * i._pixelsPerMercatorPixel; return { queryGeometry: this, tilespaceGeometry: h, tilespaceRays: u, bufferedTilespaceGeometry: l, bufferedTilespaceBounds: (m = e.az(l), m.min.x = e.c(m.min.x, 0, e.J), m.min.y = e.c(m.min.y, 0, e.J), m.max.x = e.c(m.max.x, 0, e.J), m.max.y = e.c(m.max.y, 0, e.J), m), tile: t, tileID: t.tileID, pixelToTileUnitsFactor: p }; var m; } _bufferedScreenMercator(e, t) { const i = Qe(e); if (this._screenRaycastCache[i]) return this._screenRaycastCache[i]; { let o; return o = "globe" === t.projection.name ? this._projectAndResample(this.bufferedScreenGeometry(e), t) : { polygon: this.bufferedScreenGeometry(e).map((e => t.pointCoordinate3D(e))), unwrapped: !0 }, this._screenRaycastCache[i] = o, o } } _bufferedCameraMercator(e, t) { const i = Qe(e); if (this._cameraRaycastCache[i]) return this._cameraRaycastCache[i]; { let o; return o = "globe" === t.projection.name ? this._projectAndResample(this.bufferedCameraGeometryGlobe(e), t) : { polygon: this.bufferedCameraGeometry(e).map((e => t.pointCoordinate3D(e))), unwrapped: !0 }, this._cameraRaycastCache[i] = o, o } } _projectAndResample(t, i) { const o = function (t, i) { const o = e.m.multiply([], i.pixelMatrix, i.globeMatrix), r = [0, -e.aC, 0, 1], s = [0, e.aC, 0, 1], n = [0, 0, 0, 1]; e.e.transformMat4(r, r, o), e.e.transformMat4(s, s, o), e.e.transformMat4(n, n, o); const a = new e.P(r[0] / r[3], r[1] / r[3]), l = new e.P(s[0] / s[3], s[1] / s[3]), c = e.aA(t, a) && r[3] < n[3], h = e.aA(t, l) && s[3] < n[3]; if (!c && !h) return null; const _ = function (e, t, i) { for (let o = 1; o < e.length; o++) { const r = Ke(t.pointCoordinate3D(e[o - 1]).x), s = Ke(t.pointCoordinate3D(e[o]).x); if (i < 0) { if (r < s) return { idx: o, t: -r / (s - 1 - r) } } else if (s < r) return { idx: o, t: (1 - r) / (s + 1 - r) } } return null }(t, i, c ? -1 : 1); if (!_) return null; const { idx: d, t: u } = _; let p = d > 1 ? Ye(t.slice(0, d), i) : [], m = d < t.length ? Ye(t.slice(d), i) : []; p = p.map((t => new e.P(Ke(t.x), t.y))), m = m.map((t => new e.P(Ke(t.x), t.y))); const f = [...p]; 0 === f.length && f.push(m[m.length - 1]); const g = e.n(f[f.length - 1].y, (0 === m.length ? p[0] : m[0]).y, u); let v; return v = c ? [new e.P(0, g), new e.P(0, 0), new e.P(1, 0), new e.P(1, g)] : [new e.P(1, g), new e.P(1, 1), new e.P(0, 1), new e.P(0, g)], f.push(...v), 0 === m.length ? f.push(p[0]) : f.push(...m), { polygon: f.map((t => new e.M(t.x, t.y))), unwrapped: !1 } }(t, i); if (o) return o; const r = function (t, i) { let o = !1, r = -1 / 0, s = 0; for (let e = 0; e < t.length - 1; e++)t[e].x > r && (r = t[e].x, s = e); for (let e = 0; e < t.length - 1; e++) { const i = (s + e) % (t.length - 1), r = t[i], n = t[i + 1]; Math.abs(r.x - n.x) > .5 && (r.x < n.x ? (r.x += 1, 0 === i && (t[t.length - 1].x += 1)) : (n.x += 1, i + 1 === t.length - 1 && (t[0].x += 1)), o = !0); } const n = e.E(i.center.lng); return o && n < Math.abs(n - 1) && t.forEach((e => { e.x -= 1; })), { polygon: t, unwrapped: o } }(Ye(t, i).map((t => new e.P(Ke(t.x), t.y))), i); return { polygon: r.polygon.map((t => new e.M(t.x, t.y))), unwrapped: r.unwrapped } } } function Ye(t, i) { return e.aB(t, (e => { const t = i.pointCoordinate3D(e); e.x = t.x, e.y = t.y; }), 1 / 256) } function Ke(e) { return e < 0 ? 1 + e % 1 : e % 1 } function Qe(e) { return 100 * e | 0 } function et(t, i, o, r, s) { const n = function (o, r) { if (o) return s(o); if (r) { t.url && r.tiles && t.tiles && delete t.tiles; const o = e.p(e.ak(r, t), ["tiles", "minzoom", "maxzoom", "attribution", "mapbox_logo", "bounds", "scheme", "tileSize", "encoding"]); r.vector_layers && (o.vectorLayers = r.vector_layers, o.vectorLayerIds = o.vectorLayers.map((e => e.id))), o.tiles = i.canonicalizeTileset(o, t.url), s(null, o); } }; return t.url ? e.a1(i.transformRequest(i.normalizeSourceURL(t.url, null, o, r), e.a2.Source), n) : e.a4.frame((() => n(null, t))) } class tt { constructor(t, i, o) { this.bounds = e.D.convert(this.validateBounds(t)), this.minzoom = i || 0, this.maxzoom = o || 24; } validateBounds(e) { return Array.isArray(e) && 4 === e.length ? [Math.max(-180, e[0]), Math.max(-90, e[1]), Math.min(180, e[2]), Math.min(90, e[3])] : [-180, -90, 180, 90] } contains(t) { const i = Math.pow(2, t.z), o = Math.floor(e.E(this.bounds.getWest()) * i), r = Math.floor(e.H(this.bounds.getNorth()) * i), s = Math.ceil(e.E(this.bounds.getEast()) * i), n = Math.ceil(e.H(this.bounds.getSouth()) * i); return t.x >= o && t.x < s && t.y >= r && t.y < n } } class it extends e.a6 { constructor(t, i, o, r) { if (super(), this.id = t, this.dispatcher = o, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = !0, this.isTileClipped = !0, this._loaded = !1, e.ak(this, e.p(i, ["url", "scheme", "tileSize", "promoteId"])), this._options = e.ak({ type: "vector" }, i), this._collectResourceTiming = !!i.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512"); this.setEventedParent(r), this._tileWorkers = {}, this._deduped = new e.aD; } load(t) { this._loaded = !1, this.fire(new e.a8("dataloading", { dataType: "source" })); const i = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, o = this.map._worldview; this._tileJSONRequest = et(this._options, this.map._requestManager, i, o, ((r, s) => { this._tileJSONRequest = null, this._loaded = !0, r ? (i && console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`), o && 2 !== o.length && console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`), this.fire(new e.a7(r))) : s && (e.ak(this, s), s.bounds && (this.tileBounds = new tt(s.bounds, this.minzoom, this.maxzoom)), e.aH(s.tiles, this.map._requestManager._customAccessToken), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "content" }))), t && t(r); })); } loaded() { return this._loaded } hasTile(e) { return !this.tileBounds || this.tileBounds.contains(e.canonical) } onAdd(e) { this.map = e, this.load(); } reload() { this.cancelTileJSONRequest(); const t = e.aE(this.id, this.scope); this.load((() => this.map.style.clearSource(t))); } setTiles(e) { return this._options.tiles = e, this.reload(), this } setUrl(e) { return this.url = e, this._options.url = e, this.reload(), this } onRemove() { this.cancelTileJSONRequest(); } serialize() { return e.ak({}, this._options) } loadTile(t, i) { const o = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme)), r = { request: this.map._requestManager.transformRequest(o, e.a2.Tile), data: void 0, uid: t.uid, tileID: t.tileID, tileZoom: t.tileZoom, zoom: t.tileID.overscaledZ, tileSize: this.tileSize * t.tileID.overscaleFactor(), type: this.type, source: this.id, scope: this.scope, pixelRatio: e.a4.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId, isSymbolTile: t.isSymbolTile, brightness: this.map.style && this.map.style.getBrightness() || 0, extraShadowCaster: t.isExtraShadowCaster }; if (r.request.collectResourceTiming = this._collectResourceTiming, t.actor && "expired" !== t.state) "loading" === t.state ? t.reloadCallback = i : t.request = t.actor.send("reloadTile", r, s.bind(this)); else if (t.actor = this._tileWorkers[o] = this._tileWorkers[o] || this.dispatcher.getActor(), this.dispatcher.ready) t.request = t.actor.send("loadTile", r, s.bind(this), void 0, !0); else { const i = e.aF.call({ deduped: this._deduped }, r, ((e, i) => { e || !i ? s.call(this, e) : (r.data = { cacheControl: i.cacheControl, expires: i.expires, rawData: i.rawData.slice(0) }, t.actor && t.actor.send("loadTile", r, s.bind(this), void 0, !0)); }), !0); t.request = { cancel: i }; } function s(o, r) { return delete t.request, t.aborted ? i(null) : o && 404 !== o.status ? i(o) : (r && r.resourceTiming && (t.resourceTiming = r.resourceTiming), this.map._refreshExpiredTiles && r && t.setExpiryData(r), t.loadVectorData(r, this.map.painter), e.aG(this.dispatcher), i(null), void (t.reloadCallback && (this.loadTile(t, t.reloadCallback), t.reloadCallback = null))) } } abortTile(e) { e.request && (e.request.cancel(), delete e.request), e.actor && e.actor.send("abortTile", { uid: e.uid, type: this.type, source: this.id, scope: this.scope }); } unloadTile(e) { e.actor && e.actor.send("removeTile", { uid: e.uid, type: this.type, source: this.id, scope: this.scope }), e.destroy(); } hasTransition() { return !1 } afterUpdate() { this._tileWorkers = {}; } cancelTileJSONRequest() { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); } } class ot extends e.a6 { constructor(t, i, o, r) { super(), this.id = t, this.dispatcher = o, this.setEventedParent(r), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = !0, this.scheme = "xyz", this.tileSize = 512, this._loaded = !1, this._options = e.ak({ type: "raster" }, i), e.ak(this, e.p(i, ["url", "scheme", "tileSize"])); } load(t) { this._loaded = !1, this.fire(new e.a8("dataloading", { dataType: "source" })), this._tileJSONRequest = et(this._options, this.map._requestManager, null, null, ((i, o) => { this._tileJSONRequest = null, this._loaded = !0, i ? this.fire(new e.a7(i)) : o && (e.ak(this, o), o.bounds && (this.tileBounds = new tt(o.bounds, this.minzoom, this.maxzoom)), e.aH(o.tiles), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "content" }))), t && t(i); })); } loaded() { return this._loaded } onAdd(e) { this.map = e, this.load(); } reload() { this.cancelTileJSONRequest(); const t = e.aE(this.id, this.scope); this.load((() => this.map.style.clearSource(t))); } setTiles(e) { return this._options.tiles = e, this.reload(), this } setUrl(e) { return this.url = e, this._options.url = e, this.reload(), this } onRemove() { this.cancelTileJSONRequest(); } serialize() { return e.ak({}, this._options) } hasTile(e) { return !this.tileBounds || this.tileBounds.contains(e.canonical) } loadTile(t, i) { const o = e.a4.devicePixelRatio >= 2, r = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme), o, this.tileSize); t.request = e.a3(this.map._requestManager.transformRequest(r, e.a2.Tile), ((o, r, s, n) => (delete t.request, t.aborted ? (t.state = "unloaded", i(null)) : o ? (t.state = "errored", i(o)
41) : r ? (this.map._refreshExpiredTiles && t.setExpiryData({ cacheControl: s, expires: n }), t.setTexture(r, this.map.painter), t.state = "loaded", e.aG(this.dispatcher), void i(null)) : i(null)))); } abortTile(e, t) { e.request && (e.request.cancel(), delete e.request), t(); } unloadTile(t, i) { t.texture && t.texture instanceof e.a9 ? (t.destroy(!0), t.texture && t.texture instanceof e.a9 && this.map.painter.saveTileTexture(t.texture)) : t.destroy(), i(); } hasTransition() { return !1 } cancelTileJSONRequest() { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); } } const rt = { vector: it, raster: ot, "raster-dem": class extends ot { constructor(t, i, o, r) { super(t, i, o, r), this.type = "raster-dem", this.maxzoom = 22, this._options = e.ak({ type: "raster-dem" }, i), this.encoding = i.encoding || "mapbox"; } loadTile(t, i) { const o = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme), !1, this.tileSize); function r(e, o) { e && (t.state = "errored", i(e)), o && (t.dem = o, t.dem.onDeserialize(), t.needs
41HillshadePrepare = !0, t.needsDEMTextureUpload = !0, t.state = "loaded", i(null)); } t.request = e.a3(this.map._requestManager.transformRequest(o, e.a2.Tile), function (o, s, n, a) { if (delete t.request, t.aborted) t.state = "unloaded", i(null); else if (o) t.state = "errored", i(o); else if (s) { this.map._refreshExpiredTiles && t.setExpiryData({ cacheControl: n, expires: a }); const i = ImageBitmap && s instanceof ImageBitmap && e.aI(), o = 1 - (s.width - e.aJ(s.width)) / 2; o < 1 || t.neighboringTiles || (t.neighboringTiles = this._getNeighboringTiles(t.tileID)); const l = i ? s : e.a4.getImageData(s, o), c = { uid: t.uid, coord: t.tileID, source: this.id, scope: this.scope, rawImageData: l, encoding: this.encoding, padding: o }; t.actor && "expired" !== t.state || (t.actor = this.dispatcher.getActor(), t.actor.send("loadDEMTile", c, r.bind(this), void 0, !0)); } }.bind(this)); } _getNeighboringTiles(t) { const i = t.canonical, o = Math.pow(2, i.z), r = (i.x - 1 + o) % o, s = 0 === i.x ? t.wrap - 1 : t.wrap, n = (i.x + 1 + o) % o, a = i.x + 1 === o ? t.wrap + 1 : t.wrap, l = {}; return l[new e.O(t.overscaledZ, s, i.z, r, i.y).key] = { backfilled: !1 }, l[new e.O(t.overscaledZ, a, i.z, n, i.y).key] = { backfilled: !1 }, i.y > 0 && (l[new e.O(t.overscaledZ, s, i.z, r, i.y - 1).key] = { backfilled: !1 }, l[new e.O(t.overscaledZ, t.wrap, i.z, i.x, i.y - 1).key] = { backfilled: !1 }, l[new e.O(t.overscaledZ, a, i.z, n, i.y - 1).key] = { backfilled: !1 }), i.y + 1 < o && (l[new e.O(t.overscaledZ, s, i.z, r, i.y + 1).key] = { backfilled: !1 }, l[new e.O(t.overscaledZ, t.wrap, i.z, i.x, i.y + 1).key] = { backfilled: !1 }, l[new e.O(t.overscaledZ, a, i.z, n, i.y + 1).key] = { backfilled: !1 }), l } }, geojson: class extends e.a6 { constructor(t, i, o, r) { super(), this.id = t, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = !0, this.reparseOverscaled = !0, this._loaded = !1, this.actor = o.getActor(), this.setEventedParent(r), this._data = i.data, this._options = e.ak({}, 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 s = e.J / this.tileSize; this.workerOptions = e.ak({ source: this.id, scope: this.scope, cluster: i.cluster || !1, geojsonVtOptions: { buffer: (void 0 !== i.buffer ? i.buffer : 128) * s, tolerance: (void 0 !== i.tolerance ? i.tolerance : .375) * s, extent: e.J, 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: e.J, radius: (void 0 !== i.clusterRadius ? i.clusterRadius : 50) * s, log: !1, generateId: i.generateId || !1 }, clusterProperties: i.clusterProperties, filter: i.filter }, i.workerOptions); } onAdd(e) { this.map = e, this.setData(this._data); } setData(e) { return this._data = e, this._updateWorkerData(), this } getClusterExpansionZoom(e, t) { return this.actor.send("geojson.getClusterExpansionZoom", { clusterId: e, source: this.id, scope: this.scope }, t), this } getClusterChildren(e, t) { return this.actor.send("geojson.getClusterChildren", { clusterId: e, source: this.id, scope: this.scope }, t), this } getClusterLeaves(e, t, i, o) { return this.actor.send("geojson.getClusterLeaves", { source: this.id, scope: this.scope, clusterId: e, limit: t, offset: i }, o), this } _updateWorkerData() { if (this._pendingLoad) return void (this._coalesce = !0); this.fire(new e.a8("dataloading", { dataType: "source" })), this._loaded = !1; const t = e.ak({}, this.workerOptions); t.scope = this.scope; const i = this._data; "string" == typeof i ? (t.request = this.map._requestManager.transformRequest(e.a4.resolveURL(i), e.a2.Source), t.request.collectResourceTiming = this._collectResourceTiming) : t.data = JSON.stringify(i), this._pendingLoad = this.actor.send(`${this.type}.loadData`, t, ((t, i) => { if (this._loaded = !0, this._pendingLoad = null, t) this.fire(new e.a7(t)); else { const t = { dataType: "source", sourceDataType: this._metadataFired ? "content" : "metadata" }; this._collectResourceTiming && i && i.resourceTiming && i.resourceTiming[this.id] && (t.resourceTiming = i.resourceTiming[this.id]), this.fire(new e.a8("data", t)), this._metadataFired = !0; } this._coalesce && (this._updateWorkerData(), this._coalesce = !1); })); } loaded() { return this._loaded } loadTile(t, i) { const o = t.actor ? "reloadTile" : "loadTile"; t.actor = this.actor; const r = { type: this.type, uid: t.uid, tileID: t.tileID, tileZoom: t.tileZoom, zoom: t.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, scope: this.scope, pixelRatio: e.a4.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId, brightness: this.map.style && this.map.style.getBrightness() || 0 }; t.request = this.actor.send(o, r, ((e, r) => (delete t.request, t.destroy(), t.aborted ? i(null) : e ? i(e) : (t.loadVectorData(r, this.map.painter, "reloadTile" === o), i(null)))), void 0, "loadTile" === o); } abortTile(e) { e.request && (e.request.cancel(), delete e.request), e.aborted = !0; } unloadTile(e) { this.actor.send("removeTile", { uid: e.uid, type: this.type, source: this.id, scope: this.scope }), e.destroy(); } onRemove() { this._pendingLoad && this._pendingLoad.cancel(); } serialize() { return e.ak({}, this._options, { type: this.type, data: this._data }) } hasTransition() { return !1 } }, video: class extends e.aK { constructor(e, t, i, o) { super(e, t, i, o), this.roundZoom = !0, this.type = "video", this.options = t; } load() { this._loaded = !1; const t = this.options; this.urls = []; for (const i of t.urls) this.urls.push(this.map._requestManager.transformRequest(i, e.a2.Source).url); e.aL(this.urls, ((t, i) => { this._loaded = !0, t ? this.fire(new e.a7(t)) : 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(); }
41 seek(t) { if (this.video) { const i = this.video.seekable; t < i.start(0) || t > i.end(0) ? this.fire(new e.a7(new e.aM(`sources.${this.id}`, null, `Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))) : this.video.currentTime = t; } } getVideo() { return this.video } onAdd(e) { this.map || (this.map = e, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates))); } prepare() { if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) return; const t = this.map.painter.context, i = t.gl; this.texture ? this.video.paused || (this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE), i.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, i.RGBA, i.UNSIGNED_BYTE, this.video)) : (this.texture = new e.a9(t, 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(t); } serialize() { return { type: "video", urls: this.urls, coordinates: this.coordinates } } hasTransition() { return this.video && !this.video.paused } }, image: e.aK, model: class extends e.a6 { constructor(e, t, i, o) { super(), this.id = e, this.type = "model", this.models = [], this._loaded = !1, this._options = t; } load() { const t = []; for (const i in this._options.models) { const o = this._options.models[i], r = e.aO(this.map._requestManager.transformRequest(o.uri, e.a2.Model).url).then((t => { if (!t) return; const r = e.aP(t), s = new e.aQ(i, o.position, o.orientation, r); s.computeBoundsAndApplyParent(), this.models.push(s); })).catch((t => { this.fire(new e.a7(new Error(`Could not load model ${i} from ${o.uri}: ${t.message}`))); })); t.push(r); } return Promise.allSettled(t).then((() => { this._loaded = !0, this.fire(new e.a8("data", { dataType: "source", sourceDataType: "metadata" })); })).catch((t => { this.fire(new e.a7(new Error(`Could not load models: ${t.message}`))); })) } onAdd(e) { this.map = e, this.load(); } hasTransition() { return !1 } loaded() { return this._loaded } getModels() { return this.models } loadTile(e, t) { } serialize() { return { type: "model" } } }, "batched-model": class extends e.a6 { constructor(e, t, i, o) { super(), this.type = "batched-model", this.id = e, this.tileSize = 512, this._options = t, this.tiles = this._options.tiles, this.maxzoom = t.maxzoom || 19, this.minzoom = t.minzoom || 0, this.roundZoom = !0, this.usedInConflation = !0, this.dispatcher = i, this.reparseOverscaled = !1, this.scheme = "xyz", this._loaded = !1, this.setEventedParent(o); } onAdd(e) { this.map = e, this.load(); } load(t) { this._loaded = !1, this.fire(new e.a8("dataloading", { dataType: "source" })); const i = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, o = this.map._worldview; this._tileJSONRequest = et(this._options, this.map._requestManager, i, o, ((r, s) => { this._tileJSONRequest = null, this._loaded = !0, r ? (i && console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`), o && 2 !== o.length && console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`), this.fire(new e.a7(r))) : s && (e.ak(this, s), s.bounds && (this.tileBounds = new tt(s.bounds, this.minzoom, this.maxzoom)), e.aH(s.tiles, this.map._requestManager._customAccessToken), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "content" }))), t && t(r); })); } hasTransition() { return !1 } hasTile(e) { return !this.tileBounds || this.tileBounds.contains(e.canonical) } loaded() { return this._loaded } loadTile(t, i) { const o = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme)), r = { request: this.map._requestManager.transformRequest(o, e.a2.Tile), data: void 0, uid: t.uid, tileID: t.tileID, tileZoom: t.tileZoom, zoom: t.tileID.overscaledZ, tileSize: this.tileSize * t.tileID.overscaleFactor(), type: this.type, source: this.id, scope: this.scope, showCollisionBoxes: this.map.showCollisionBoxes, isSymbolTile: t.isSymbolTile, brightness: this.map.style && this.map.style.getBrightness() || 0 }; if (t.actor && "expired" !== t.state) if ("loading" === t.state) t.reloadCallback = i; else { if (t.buckets) { const e = Object.values(t.buckets); for (const t of e) t.dirty = !0; return void (t.state = "loaded") } t.request = t.actor.send("reloadTile", r, s.bind(this)); } else t.actor = this.dispatcher.getActor(), t.request = t.actor.send("loadTile", r, s.bind(this), void 0, !0); function s(e, o) { return t.aborted ? i(null) : e && 404 !== e.status ? i(e) : (o && (o.resourceTiming && (t.resourceTiming = o.resourceTiming), this.map._refreshExpiredTiles && t.setExpiryData(o), t.buckets = { ...t.buckets, ...o.buckets }), t.state = "loaded", void i(null)) } } serialize() { return e.ak({}, this._options) } }, canvas: class extends e.aK { constructor(t, i, o, r) { super(t, i, o, r), i.coordinates ? Array.isArray(i.coordinates) && 4 === i.coordinates.length && !i.coordinates.some((e => !Array.isArray(e) || 2 !== e.length || e.some((e =>
41 "number" != typeof e)))) || this.fire(new e.a7(new e.aM(`sources.${t}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new e.a7(new e.aM(`sources.${t}`, null, 'missing required property "coordinates"'))), i.animate && "boolean" != typeof i.animate && this.fire(new e.a7(new e.aM(`sources.${t}`, null, 'optional "animate" property must be a boolean value'))), i.canvas ? "string" == typeof i.canvas || i.canvas instanceof HTMLCanvasElement || this.fire(new e.a7(new e.aM(`sources.${t}`, null, '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new e.a7(new e.aM(`sources.${t}`, 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 HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new e.a7(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(e) { this.map = e, this.load(), this.canvas && this.animate && this.play(); } onRemove() { this.pause(); } prepare() { let t = !1; if (this.canvas.width !== this.width && (this.width = this.canvas.width, t = !0), this.canvas.height !== this.height && (this.height = this.canvas.height, t = !0), this._hasInvalidDimensions()) return; if (0 === Object.keys(this.tiles).length) return; const i = this.map.painter.context; this.texture ? !t && !this._playing || this.texture instanceof e.aN || this.texture.update(this.canvas, { premultiply: !0 }) : this.texture = new e.a9(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 e of [this.canvas.width, this.canvas.height]) if (isNaN(e) || e <= 0) return !0; return !1 } }, custom: class extends e.a6 { constructor(t, i, o, r) { super(), this.id = t, this.type = "custom", this._dataType = "raster", this._dispatcher = o, this._implementation = i, this.setEventedParent(r), this.scheme = "xyz", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this._loaded = !1, this.roundZoom = !0, this._implementation || this.fire(new e.a7(new Error(`Missing implementation for ${this.id} custom source`))), this._implementation.loadTile || this.fire(new e.a7(new Error(`Missing loadTile implementation for ${this.id} custom source`))), this._implementation.bounds && (this.tileBounds = new tt(this._implementation.bounds, this.minzoom, this.maxzoom)), i.update = this._update.bind(this), i.clearTiles = this._clearTiles.bind(this), i.coveringTiles = this._coveringTiles.bind(this), e.ak(this, e.p(i, ["dataType", "scheme", "minzoom", "maxzoom", "tileSize", "attribution", "minTileCacheSize", "maxTileCacheSize"])); } serialize() { return e.p(this, ["type", "scheme", "minzoom", "maxzoom", "tileSize", "attribution"]) } load() { this._loaded = !0, this.fire(new e.a8("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e.a8("data", { dataType: "source", sourceDataType: "content" })); } loaded() { return this._loaded } onAdd(t) { this._map = t, this._loaded = !1, this.fire(new e.a8("dataloading", { dataType: "source" })), this._implementation.onAdd && this._implementation.onAdd(t), this.load(); } onRemove(e) { this._implementation.onRemove && this._implementation.onRemove(e); } hasTile(e) { if (this._implementation.hasTile) { const { x: t, y: i, z: o } = e.canonical; return this._implementation.hasTile({ x: t, y: i, z: o }) } return !this.tileBounds || this.tileBounds.contains(e.canonical) } loadTile(e, t) { const { x: i, y: o, z: r } = e.tileID.canonical, s = new AbortController; e.request = Promise.resolve(this._implementation.loadTile({ x: i, y: o, z: r }, { signal: s.signal })).then(function (i) { return delete e.request, e.aborted ? (e.state = "unloaded", t(null)) : void 0 === i ? (e.state = "errored", t(null)) : null === i ? (this.loadTileData(e, { width: this.tileSize, height: this.tileSize, data: null }), e.state = "loaded", t(null)) : function (e) { return e instanceof ImageData || e instanceof HTMLCanvasElement || e instanceof ImageBitmap || e instanceof HTMLImageElement }(i) ? (this.loadTileData(e, i), e.state = "loaded", void t(null)) : (e.state = "errored", t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`))) }.bind(this)).catch((i => { 20 !== i.code && (e.state = "errored", t(i)); })), e.request.cancel = () => s.abort(); } loadTileData(e, t) { e.setTexture(t, this._map.painter); } unloadTile(t, i) { if (t.texture && t.texture instanceof e.a9 ? (t.destroy(!0), t.texture && t.texture instanceof e.a9 && this._map.painter.saveTileTexture(t.texture)) : t.destroy(), this._implementation.unloadTile) { const { x: e, y: i, z: o } = t.tileID.canonical; this._implementation.unloadTile({ x: e, y: i, z: o }); } i(); } abortTile(e, t) { e.request && e.request.cancel && (e.request.cancel(), delete e.request), t(); } hasTransition() { return !1 } _coveringTiles() { return this._map.transform.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, roundZoom: this.roundZoom }).map((e => ({ x: e.canonical.x, y: e.canonical.y, z: e.canonical.z }))) } _clearTiles() { const t = e.aE(this.id, this.scope); this._map.style.clearSource(t); } _update() { this.fire(new e.a8("data", { dataType: "source", sourceDataType: "content" })); } } }, st = function (t, i, o, r) { const s = new rt[i.type](t, i, o, r); if (s.id !== t) throw new Error(`Expected Source id to be ${t} instead of ${s.id}`); return e.aR(["load", "abort", "unload", "serialize", "prepare"], s), s }; function nt(t, i) { const o = e.m.identity([]); return e.m.scale(o, o, [.5 * t.width, .5 * -t.height, 1]), e.m.translate(o, o, [1, -1, 0]), e.m.multiply(o, o, t.calculateProjMatrix(i.toUnwrapped())), Float32Array.from(o) } function at(e, t, i, o, r, s, n, a = !1) { const l = e.tilesIn(o, n, a); l.sort(ct); const c = []; for (const o of l) c.push({ wrappedTileID: o.tile.tileID.wrapped().key, queryResults: o.tile.queryRenderedFeatures(t, i, e._state, o, r, s, nt(e.transform, o.tile.tileID), a) }); const h = function (e) { const t = {}, i = {}; for (const o of e) { const e = o.queryResults, r = o.wrappedTileID, s = i[r] = i[r] || {}; for (const i in e) { const o = e[i], r = s[i] = s[i] || {}, n = t[i] = t[i] || []; for (const e of o) r[e.featureIndex] || (r[e.featureIndex] = !0, n.push(e)); } } return t }(c); for (const t in h) h[t].forEach((t => { const i = t.feature, o = i.layer; o && "background" !== o.type && "sky" !== o.type && "slot" !== o.type && (i.source = o.source, o["source-layer"] && (i.sourceLayer = o["source-layer"]), i.state = void 0 !== i.id ? e.getFeatureState(
41o["source-layer"], i.id) : {}); })); return h } function lt(e, t) { const i = e.getRenderableIds().map((t => e.getTileByID(t))), o = [], r = {}; for (let e = 0; e < i.length; e++) { const s = i[e], n = s.tileID.canonical.key; r[n] || (r[n] = !0, s.querySourceFeatures(o, t)); } return o } function ct(e, t) { const i = e.tileID, o = t.tileID; return i.overscaledZ - o.overscaledZ || i.canonical.y - o.canonical.y || i.wrap - o.wrap || i.canonical.x - o.canonical.x } class ht { constructor(e) { this.style = e; } processLayersChanged() { this.layers = []; for (const e in this.style._mergedLayers) { const t = this.style._mergedLayers[e]; if ("fill-extrusion" === t.type) this.layers.push(t); else if ("model" === t.type) { const e = this.style.getLayerSource(t); e && "batched-model" === e.type && this.layers.push(t); } } } updateZOffset(e, t) { this.currentBuildingBuckets = []; for (let e = 0; e < this.layers.length; ++e) { const i = this.layers[e], o = this.style.getLayerSourceCache(i); let r = 1; "fill-extrusion" === i.type && (r = i.paint.get("fill-extrusion-opacity") > 0 ? i.paint.get("fill-extrusion-vertical-scale") : 0); let s = o ? o.getTile(t) : null; if (!s && o && t.canonical.z > o.getSource().minzoom) { let e = t.scaledTo(Math.min(o.getSource().maxzoom, t.overscaledZ - 1)); for (; e.overscaledZ >= o.getSource().minzoom && (s = o.getTile(e), !s && 0 !== e.overscaledZ);)e = e.scaledTo(e.overscaledZ - 1); } this.currentBuildingBuckets.push({ bucket: s ? s.getBucket(i) : null, tileID: s ? s.tileID : t, verticalScale: r }); } e.hasAnyZOffset = !1; let i = !1; for (let o = 0; o < e.symbolInstances.length; o++) { const r = e.symbolInstances.get(o), s = r.zOffset, n = this._getHeightAtTileOffset(t, r.tileAnchorX, r.tileAnchorY); r.zOffset = -1 !== n ? n : s, i || s === r.zOffset || (i = !0), e.hasAnyZOffset || 0 === r.zOffset || (e.hasAnyZOffset = !0); } i && (e.zOffsetBuffersNeedUpload = !0, e.zOffsetSortDirty = !0); } _mapCoordToOverlappingTile(t, i, o, r) { let s = i, n = o; if (t.canonical.z !== r.canonical.z) { const a = r.canonical, l = 1 / (1 << t.canonical.z - a.z); s = (i + t.canonical.x * e.J) * l - a.x * e.J | 0, n = (o + t.canonical.y * e.J) * l - a.y * e.J | 0; } return { tileX: s, tileY: n } } _getHeightAtTileOffset(e, t, i) { let o, r; for (let s = 0; s < this.layers.length; ++s) { if ("fill-extrusion" !== this.layers[s].type) continue; const { bucket: n, tileID: a, verticalScale: l } = this.currentBuildingBuckets[s]; if (!n) continue; const { tileX: c, tileY: h } = this._mapCoordToOverlappingTile(e, t, i, a), _ = n.getHeightAtTileCoord(c, h); _ && void 0 !== _.height && (_.hidden ? o = _.height : r = Math.max(_.height * l, r || 0)); } if (void 0 !== r) return r; for (let r = 0; r < this.layers.length; ++r) { if ("model" !== this.layers[r].type) continue; const { bucket: s, tileID: n } = this.currentBuildingBuckets[r]; if (!s) continue; const { tileX: a, tileY: l } = this._mapCoordToOverlappingTile(e, t, i, n), c = s.getHeightAtTileCoord(a, l); if (c && !c.hidden) return void 0 === c.height && void 0 !== o ? Math.min(c.maxHeight, o) * c.verticalScale : (c.height || 0) * c.verticalScale } return -1 } } function _t(t, i) { const o = {}; for (const e in t) "ref" !== e && (o[e] = t[e]); return e.aS.forEach((e => { e in i && (o[e] = i[e]); })), o } function dt(e) { e = e.slice(); const t = Object.create(null); for (let i = 0; i < e.length; i++)t[e[i].id] = e[i]; for (let i = 0; i < e.length; i++)"ref" in e[i] && (e[i] = _t(e[i], t[e[i].ref])); return e } const ut = { setStyle: "setStyle", addLayer: "addLayer", removeLayer: "removeLayer", setPaintProperty: "setPaintProperty", setLayoutProperty: "setLayoutProperty", setSlot: "setSlot", setFilter: "setFilter", addSource: "addSource", removeSource: "removeSource", setGeoJSONSourceData: "setGeoJSONSourceData", setLayerZoomRange: "setLayerZoomRange", setLayerProperty: "setLayerProperty", setCenter: "setCenter", setZoom: "setZoom", setBearing: "setBearing", setPitch: "setPitch", setSprite: "setSprite", setGlyphs: "setGlyphs", setTransition: "setTransition", setLight: "setLight", setTerrain: "setTerrain", setFog: "setFog", setCamera: "setCamera", setLights: "setLights", setProjection: "setProjection", addImport: "addImport", removeImport: "removeImport", setImportUrl: "setImportUrl", setImportData: "setImportData", setImportConfig: "setImportConfig" }; function pt(e, t, i) { i.push({ command: ut.addSource, args: [e, t[e]] }); } function mt(e, t, i) { t.push({ command: ut.removeSource, args: [e] }), i[e] = !0; } function ft(e, t, i, o) { mt(e, i, o), pt(e, t, i); } function gt(e, i, o) { let r; for (r in e[o]) if (e[o].hasOwnProperty(r) && "data" !== r && !t(e[o][r], i[o][r])) return !1; for (r in i[o]) if (i[o].hasOwnProperty(r) && "data" !== r && !t(e[o][r], i[o][r])) return !1; return !0 } function vt(e, i, o, r, s, n) { let a; for (a in i = i || {}, e = e || {}) e.hasOwnProperty(a) && (t(e[a], i[a]) || o.push({ command: n, args: [r, a, i[a], s] })); for (a in i) i.hasOwnProperty(a) && !e.hasOwnProperty(a) && (t(e[a], i[a]) || o.push({ command: n, args: [r, a, i[a], s] })); } function xt(e) { return e.id } function yt(e, t) { return e[t.id] = t, e } class bt { constructor(e, t) { this.reset(e, t); } reset(e, t) { this.points = e || [], this._distances = [0]; for (let e = 1; e < this.points.length; e++)this._distances[e] = this._distances[e - 1] + this.points[e].dist(this.points[e - 1]); this.length = this._distances[this._distances.length - 1], this.padding = Math.min(t || 0, .5 * this.length), this.paddedLength = this.length - 2 * this.padding; } lerp(t) { if (1 === this.points.length) return this.points[0]; t = e.c(t, 0, 1); let i = 1, o = this._distances[i]; const r = t * this.paddedLength + this.padding; for (; o < r && i < this._distances.length;)o = this._distances[++i];
vendor: 5,167 bytes, line 41
41 const s = i - 1, n = this._distances[s], a = o - n, l = a > 0 ? (r - n) / a : 0; return this.points[s].mult(1 - l).add(this.points[i].mult(l)) } } class wt { constructor(e, t, i) { const o = this.boxCells = [], r = this.circleCells = []; this.xCellCount = Math.ceil(e / i), this.yCellCount = Math.ceil(t / i); for (let e = 0; e < this.xCellCount * this.yCellCount; e++)o.push([]), r.push([]); this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = e, this.height = t, this.xScale = this.xCellCount / e, this.yScale = this.yCellCount / t, this.boxUid = 0, this.circleUid = 0; } keysLength() { return this.boxKeys.length + this.circleKeys.length } insert(e, t, i, o, r) { this._forEachCell(t, i, o, r, this._insertBoxCell, this.boxUid++), this.boxKeys.push(e), this.bboxes.push(t), this.bboxes.push(i), this.bboxes.push(o), this.bboxes.push(r); } insertCircle(e, t, i, o) { this._forEachCell(t - o, i - o, t + o, i + o, this._insertCircleCell, this.circleUid++), this.circleKeys.push(e), this.circles.push(t), this.circles.push(i), this.circles.push(o); } _insertBoxCell(e, t, i, o, r, s) { this.boxCells[r].push(s); } _insertCircleCell(e, t, i, o, r, s) { this.circleCells[r].push(s); } _query(e, t, i, o, r, s) { if (i < 0 || e > this.width || o < 0 || t > this.height) return !r && []; const n = []; if (e <= 0 && t <= 0 && this.width <= i && this.height <= o) { if (r) return !0; for (let e = 0; e < this.boxKeys.length; e++)n.push({ key: this.boxKeys[e], x1: this.bboxes[4 * e], y1: this.bboxes[4 * e + 1], x2: this.bboxes[4 * e + 2], y2: this.bboxes[4 * e + 3] }); for (let e = 0; e < this.circleKeys.length; e++) { const t = this.circles[3 * e], i = this.circles[3 * e + 1], o = this.circles[3 * e + 2]; n.push({ key: this.circleKeys[e], x1: t - o, y1: i - o, x2: t + o, y2: i + o }); } return s ? n.filter(s) : n } return this._forEachCell(e, t, i, o, this._queryCell, n, { hitTest: r, seenUids: { box: {}, circle: {} } }, s), r ? n.length > 0 : n } _queryCircle(e, t, i, o, r) { const s = e - i, n = e + i, a = t - i, l = t + i; if (n < 0 || s > this.width || l < 0 || a > this.height) return !o && []; const c = []; return this._forEachCell(s, a, n, l, this._queryCellCircle, c, { hitTest: o, circle: { x: e, y: t, radius: i }, seenUids: { box: {}, circle: {} } }, r), o ? c.length > 0 : c } query(e, t, i, o, r) { return this._query(e, t, i, o, !1, r) } hitTest(e, t, i, o, r) { return this._query(e, t, i, o, !0, r) } hitTestCircle(e, t, i, o) { return this._queryCircle(e, t, i, !0, o) } _queryCell(e, t, i, o, r, s, n, a) { const l = n.seenUids, c = this.boxCells[r]; if (null !== c) { const r = this.bboxes; for (const h of c) if (!l.box[h]) { l.box[h] = !0; const c = 4 * h; if (e <= r[c + 2] && t <= r[c + 3] && i >= r[c + 0] && o >= r[c + 1] && (!a || a(this.boxKeys[h]))) { if (n.hitTest) return s.push(!0), !0; s.push({ key: this.boxKeys[h], x1: r[c], y1: r[c + 1], x2: r[c + 2], y2: r[c + 3] }); } } } const h = this.circleCells[r]; if (null !== h) { const r = this.circles; for (const c of h) if (!l.circle[c]) { l.circle[c] = !0; const h = 3 * c; if (this._circleAndRectCollide(r[h], r[h + 1], r[h + 2], e, t, i, o) && (!a || a(this.circleKeys[c]))) { if (n.hitTest) return s.push(!0), !0; { const e = r[h], t = r[h + 1], i = r[h + 2]; s.push({ key: this.circleKeys[c], x1: e - i, y1: t - i, x2: e + i, y2: t + i }); } } } } } _queryCellCircle(e, t, i, o, r, s, n, a) { const l = n.circle, c = n.seenUids, h = this.boxCells[r]; if (null !== h) { const e = this.bboxes; for (const t of h) if (!c.box[t]) { c.box[t] = !0; const i = 4 * t; if (this._circleAndRectCollide(l.x, l.y, l.radius, e[i + 0], e[i + 1], e[i + 2], e[i + 3]) && (!a || a(this.boxKeys[t]))) return s.push(!0), !0 } } const _ = this.circleCells[r]; if (null !== _) { const e = this.circles; for (const t of _) if (!c.circle[t]) { c.circle[t] = !0; const i = 3 * t; if (this._circlesCollide(e[i], e[i + 1], e[i + 2], l.x, l.y, l.radius) && (!a || a(this.circleKeys[t]))) return s.push(!0), !0 } } } _forEachCell(e, t, i, o, r, s, n, a) { const l = this._convertToXCellCoord(e), c = this._convertToYCellCoord(t), h = this._convertToXCellCoord(i), _ = this._convertToYCellCoord(o); for (let d = l; d <= h; d++)for (let l = c; l <= _; l++)if (r.call(this, e, t, i, o, this.xCellCount * l + d, s, n, a)) return } _convertToXCellCoord(e) { return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(e * this.xScale))) } _convertToYCellCoord(e) { return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(e * this.yScale))) } _circlesCollide(e, t, i, o, r, s) { const n = o - e, a = r - t, l = i + s; return l * l > n * n + a * a } _circleAndRectCollide(e, t, i, o, r, s, n) { const a = (s - o) / 2, l = Math.abs(e - (o + a)); if (l > a + i) return !1; const c = (n - r) / 2, h = Math.abs(t - (r + c)); if (h > c + i) return !1; if (l <= a || h <= c) return !0; const _ = l - a, d = h - c; return _ * _ + d * d <= i * i } } const Tt = 100; class Et { constructor(e, t, i = new wt(e.width + 200, e.height + 200, 25), o = new wt(e.width + 200, e.height + 200, 25)) { this.transform = e, this.grid = i, this.ignoredGrid = o, this.pitchfactor = Math.
vendor: 4,792 bytes, line 41
41cos(e._pitch) * e.cameraToCenterDistance, this.screenRightBoundary = e.width + Tt, this.screenBottomBoundary = e.height + Tt, this.gridRightBoundary = e.width + 200, this.gridBottomBoundary = e.height + 200, this.fogState = t; } placeCollisionBox(e, t, i, o, r, s, n, a) { let l = i.projectedAnchorX, c = i.projectedAnchorY, h = i.projectedAnchorZ; const _ = i.elevation, d = i.tileID, u = e.getProjection(); if (_ && d) { const [e, t, o] = u.upVector(d.canonical, i.tileAnchorX, i.tileAnchorY), r = u.upVectorScale(d.canonical, this.transform.center.lat, this.transform.worldSize).metersToTile; l += e * _ * r, c += t * _ * r, h += o * _ * r; } const p = this.projectAndGetPerspectiveRatio(n, l, c, h, i.tileID, "globe" === u.name || !!_ || this.transform.pitch > 0, u), m = s * p.perspectiveRatio, f = (i.x1 * t + o.x - i.padding) * m + p.point.x, g = (i.y1 * t + o.y - i.padding) * m + p.point.y, v = (i.x2 * t + o.x + i.padding) * m + p.point.x, x = (i.y2 * t + o.y + i.padding) * m + p.point.y, y = p.perspectiveRatio <= .55 || p.occluded; return !this.isInsideGrid(f, g, v, x) || !r && this.grid.hitTest(f, g, v, x, a) || y ? { box: [], offscreen: !1, occluded: p.occluded } : { box: [f, g, v, x], offscreen: this.isOffscreen(f, g, v, x), occluded: !1 } } placeCollisionCircles(t, i, o, r, s, n, a, l, c, h, _, d, u, p, m) { const f = [], g = this.transform.elevation, v = t.getProjection(), x = g ? g.getAtTileOffsetFunc(m, this.transform.center.lat, this.transform.worldSize, v) : null, y = new e.P(o.tileAnchorX, o.tileAnchorY); let { x: b, y: w, z: T } = v.projectTilePoint(y.x, y.y, m.canonical); if (x) { const [e, t, i] = x(y); b += e, w += t, T += i; } const E = "globe" === v.name, C = this.projectAndGetPerspectiveRatio(a, b, w, T, m, E || !!g || this.transform.pitch > 0, v), { perspectiveRatio: I } = C, S = (_ ? n / I : n * I) / e.aV, M = ge(b, w, T, l), L = C.signedDistanceFromCamera > 0 ? be(S, s, o.lineOffsetX * S, o.lineOffsetY * S, !1, M, y, o, r, l, {}, g && !_ ? x : null, _ && !!g, v, m, _) : null; let P = !1, D = !1, A = !0; if (L && !C.occluded) { const t = .5 * u * I + p, o = new e.P(-100, -100), r = new e.P(this.screenRightBoundary, this.screenBottomBoundary), s = new bt, { first: n, last: a } = L, l = n.path.length; let _ = []; for (let e = l - 1; e >= 1; e--)_.push(n.path[e]); for (let e = 1; e < a.path.length; e++)_.push(a.path[e]); const m = 2.5 * t; c && (_ = _.map((([e, t, i], o) => (x && !E && (i = x(o < l - 1 ? n.tilePath[l - 1 - o] : a.tilePath[o - l + 2])[2]), ge(e, t, i, c)))), _.some((e => e[3] <= 0)) && (_ = [])); let g = []; if (_.length > 0) { let t = 1 / 0, i = -1 / 0, s = 1 / 0, n = -1 / 0; for (const e of _) t = Math.min(t, e[0]), s = Math.min(s, e[1]), i = Math.max(i, e[0]), n = Math.max(n, e[1]); i >= o.x && t <= r.x && n >= o.y && s <= r.y && (g = [_.map((t => new e.P(t[0], t[1])))], (t < o.x || i > r.x || s < o.y || n > r.y) && (g = e.aT(g, o.x, o.y, r.x, r.y))); } for (const e of g) { s.reset(e, .25 * t); let o = 0; o = s.length <= .5 * t ? 1 : Math.ceil(s.paddedLength / m) + 1; for (let e = 0; e < o; e++) { const r = e / Math.max(o - 1, 1), n = s.lerp(r), a = n.x + Tt, l = n.y + Tt; f.push(a, l, t, 0); const c = a - t, _ = l - t, u = a + t, p = l + t; if (A = A && this.isOffscreen(c, _, u, p), D = D || this.isInsideGrid(c, _, u, p), !i && this.grid.hitTestCircle(a, l, t, d) && (P = !0, !h)) return { circles: [], offscreen: !1, collisionDetected: P, occluded: !1 } } } } return { circles: !h && P || !D ? [] : f, offscreen: A, collisionDetected: P, occluded: C.occluded } } queryRenderedSymbols(t) { if (0 === t.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {}; const i = []; let o = 1 / 0, r = 1 / 0, s = -1 / 0, n = -1 / 0; for (const a of t) { const t = new e.P(a.x + Tt, a.y + Tt); o = Math.min(o, t.x), r = Math.min(r, t.y), s = Math.max(s, t.x), n = Math.max(n, t.y), i.push(t); } const a = this.grid.query(o, r, s, n).concat(this.ignoredGrid.query(o, r, s, n)), l = {}, c = {}; for (const t of a) { const o = t.key; if (void 0 === l[o.bucketInstanceId] && (l[o.bucketInstanceId] = {}), l[o.bucketInstanceId][o.featureIndex]) continue; const r = [new e.P(t.x1, t.y1), new e.P(t.x2, t.y1), new e.P(t.x2, t.y2), new e.P(t.x1, t.y2)]; e.aU(i, r) && (l[o.bucketInstanceId][o.featureIndex] = !0, void 0 === c[o.bucketInstanceId] && (c[o.bucketInstanceId] = []), c[o.bucketInstanceId].push(o.featureIndex)); } return c } insertCollisionBox(e, t, i, o, r) { (t ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: i, featureIndex: o, collisionGroupID: r }, e[0], e[1], e[2], e[3]); } insertCollisionCircles(e, t, i, o, r) { const s = t ? this.ignoredGrid : this.grid, n = { bucketInstanceId: i, featureIndex: o, collisionGroupID: r }; for (let t = 0; t < e.length;
41 t += 4)s.insertCircle(n, e[t], e[t + 1], e[t + 2]); } projectAndGetPerspectiveRatio(t, i, o, r, s, n, a) { const l = [i, o, r, 1]; let c = !1; if (r || this.transform.pitch > 0) { if (e.e.transformMat4(l, l, t), this.fogState && s && "globe" !== a.name) { const t = function (t, i, o, r, s, n) { const a = n.calculateFogTileMatrix(s), l = [i, o, r]; return e.v.transformMat4(l, l, a), Ge(t, e.v.length(l), n.pitch, n._fov) }(this.fogState, i, o, r, s.toUnwrapped(), this.transform); c = t > .9; } } else Me(l, l, t); const h = l[3]; return { point: new e.P((l[0] / h + 1) / 2 * this.transform.width + Tt, (-l[1] / h + 1) / 2 * this.transform.height + Tt), perspectiveRatio: Math.min(.5 + this.transform.getCameraToCenterDistance(a) / h * .5, 1.5), signedDistanceFromCamera: h, occluded: n && l[2] > h || c } } isOffscreen(e, t, i, o) { return i < Tt || e >= this.screenRightBoundary || o < Tt || t > this.screenBottomBoundary } isInsideGrid(e, t, i, o) { return i >= 0 && e < this.gridRightBoundary && o >= 0 && t < this.gridBottomBoundary } getViewportMatrix() { const t = e.m.identity([]); return e.m.translate(t, t, [-100, -100, 0]), t } } function Ct(t, i, o) { const r = i.createTileMatrix(t, t.worldSize, o.toUnwrapped()); return e.m.multiply(new Float32Array(16), t.projMatrix, r) } function It(e, t, i) { if (t.projection.name === i.projection.name) return e.projMatrix; const o = i.clone(); return o.setProjection(t.projection), Ct(o, t.getProjection(), e) } function St(e, t, i) { return t.name === i.projection.name ? e.projMatrix : Ct(i, t, e) } class Mt { constructor(e, t, i, o) { this.opacity = e ? Math.max(0, Math.min(1, e.opacity + (e.placed ? t : -t))) : o && i ? 1 : 0, this.placed = i; } isHidden() { return 0 === this.opacity && !this.placed } } class Lt { constructor(e, t, i, o, r, s = !1) { this.text = new Mt(e ? e.text : null, t, i, r), this.icon = new Mt(e ? e.icon : null, t, o, r), this.clipped = s; } isHidden() { return this.text.isHidden() && this.icon.isHidden() } } class Pt { constructor(e, t, i, o = !1) { this.text = e, this.icon = t, this.skipFade = i, this.clipped = o; } } class Dt { constructor() { this.invProjMatrix = e.m.create(), this.viewportMatrix = e.m.create(), this.circles = []; } } class At { constructor(e, t, i, o, r) { this.bucketInstanceId = e, this.featureIndex = t, this.sourceLayerIndex = i, this.bucketIndex = o, this.tileID = r; } } class Rt { constructor(e) { this.crossSourceCollisions = e, this.maxGroupID = 0, this.collisionGroups = {}; } get(e) { if (this.crossSourceCollisions) return { ID: 0, predicate: null }; if (!this.collisionGroups[e]) { const t = ++this.maxGroupID; this.collisionGroups[e] = { ID: t, predicate: e => e.collisionGroupID === t }; } return this.collisionGroups[e] } } function zt(t, i, o, r, s) { const { horizontalAlign: n, verticalAlign: a } = e.aY(t), l = -(n - .5) * i, c = -(a - .5) * o, h = e.aW(t, r); return new e.P(l + h[0] * s, c + h[1] * s) } function Ot(t, i, o, r, s) { const n = new e.P(t, i); return o && n._rotate(r ? s : -s), n } class Ft { constructor(e, t, i, o, r, s) { this.transform = e.clone(), this.projection = e.projection.name, this.collisionIndex = new Et(this.transform, r), this.buildingIndex = s, this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = !1, this.commitTime = 0, this.fadeDuration = t, this.retainedQueryData = {}, this.collisionGroups = new Rt(i), this.collisionCircleArrays = {}, this.prevPlacement = o, o && (o.prevPlacement = void 0), this.placedOrientations = {}; } getBucketParts(t, i, o, r) { const s = o.getBucket(i), n = o.latestFeatureIndex; if (!s || !n || i.fqid !== s.layerIds[0]) return; const a = s.layers[0].layout, l = o.collisionBoxArray, c = Math.pow(2, this.transform.zoom - o.tileID.overscaledZ), h = o.tileSize / e.J, _ = o.tileID.toUnwrapped(); this.transform.setProjection(s.projection); const d = (u = o.tileID, p = s.getProjection(), m = this.transform, p.name === this.projection ? m.calculateProjMatrix(u.toUnwrapped()) : Ct(m, p, u)); var u, p, m; const f = "map" === a.get("text-pitch-alignment"), g = "map" === a.get("text-rotation-alignment"); i.compileFilter(); const v = i.dynamicFilter(), x = i.dynamicFilterNeedsFeature(), y = this.transform.calculatePixelsToTileUnitsMatrix(o), b = me(d, o.tileID.canonical, f, g, this.transform, s.getProjection(), y); let w = null; if (f) { const t = fe(d, o.tileID.canonical, f, g, this.transform, s.getProjection(), y);
vendor: 26,148 bytes, line 41
41 w = e.m.multiply([], this.transform.labelPlaneMatrix, t); } let T = null; v && o.latestFeatureIndex && (T = { unwrappedTileID: _, dynamicFilter: v, dynamicFilterNeedsFeature: x, featureIndex: o.latestFeatureIndex }), this.retainedQueryData[s.bucketInstanceId] = new At(s.bucketInstanceId, n, s.sourceLayerIndex, s.index, o.tileID); const E = { bucket: s, layout: a, posMatrix: d, textLabelPlaneMatrix: b, labelToScreenMatrix: w, clippingData: T, scale: c, textPixelRatio: h, holdingForFade: o.holdingForFade(), collisionBoxArray: l, partiallyEvaluatedTextSize: e.i(s.textSizeData, this.transform.zoom), partiallyEvaluatedIconSize: e.i(s.iconSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(s.sourceID) }; if (r) for (const e of s.sortKeyRanges) { const { sortKey: i, symbolInstanceStart: o, symbolInstanceEnd: r } = e; t.push({ sortKey: i, symbolInstanceStart: o, symbolInstanceEnd: r, parameters: E }); } else t.push({ symbolInstanceStart: 0, symbolInstanceEnd: s.symbolInstances.length, parameters: E }); } attemptAnchorPlacement(e, t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g) { const { textOffset0: v, textOffset1: x, crossTileID: y } = _, b = [v, x], w = zt(e, i, o, b, r), T = this.collisionIndex.placeCollisionBox(u, r, t, Ot(w.x, w.y, s, n, this.transform.angle), h, a, l, c.predicate); if (m) { const e = u.getSymbolInstanceIconSize(g, this.transform.zoom, _.placedIconSymbolIndex); if (0 === this.collisionIndex.placeCollisionBox(u, e, m, Ot(w.x, w.y, s, n, this.transform.angle), h, a, l, c.predicate).box.length) return } if (T.box.length > 0) { let t; return this.prevPlacement && this.prevPlacement.variableOffsets[y] && this.prevPlacement.placements[y] && this.prevPlacement.placements[y].text && (t = this.prevPlacement.variableOffsets[y].anchor), this.variableOffsets[y] = { textOffset: b, width: i, height: o, anchor: e, textScale: r, prevAnchor: t }, this.markUsedJustification(u, e, _, p), u.allowVerticalPlacement && (this.markUsedOrientation(u, p, _), this.placedOrientations[y] = p), { shift: w, placedGlyphBoxes: T } } } placeLayerBucketPart(t, i, o, r) { const { bucket: s, layout: n, posMatrix: a, textLabelPlaneMatrix: l, labelToScreenMatrix: c, clippingData: h, textPixelRatio: _, holdingForFade: d, collisionBoxArray: u, partiallyEvaluatedTextSize: p, partiallyEvaluatedIconSize: m, collisionGroup: f } = t.parameters, g = n.get("text-optional"), v = n.get("icon-optional"), x = n.get("text-allow-overlap"), y = n.get("icon-allow-overlap"), b = "map" === n.get("text-rotation-alignment"), w = "map" === n.get("text-pitch-alignment"), T = "viewport-y" === n.get("symbol-z-order"), E = n.get("symbol-z-elevate"); this.transform.setProjection(s.projection); let C = x && (y || !s.hasIconData() || v), I = y && (x || !s.hasTextData() || g); !s.collisionArrays && u && s.deserializeCollisionBoxes(u), o && r && s.updateCollisionDebugBuffers(this.transform.zoom, u); const S = (t, r, u) => { const { crossTileID: T, numVerticalGlyphVertices: E } = t; if (h) { const o = { zoom: this.transform.zoom, pitch: this.transform.pitch }; let r = null; if (h.dynamicFilterNeedsFeature) { const e = this.retainedQueryData[s.bucketInstanceId]; r = h.featureIndex.loadFeature({ featureIndex: t.featureIndex, bucketIndex: e.bucketIndex, sourceLayerIndex: e.sourceLayerIndex, layoutVertexArrayOffset: 0 }); } if (!(0, h.dynamicFilter)(o, r, this.retainedQueryData[s.bucketInstanceId].tileID.canonical, new e.P(t.tileAnchorX, t.tileAnchorY), this.transform.calculateDistanceTileData(h.unwrappedTileID))) return this.placements[T] = new Pt(!1, !1, !1, !0), void i.add(T) } if (i.has(T)) return; if (d) return void (this.placements[T] = new Pt(!1, !1, !1)); let S = !1, M = !1, L = !0, P = !1, D = !1, A = null, R = { box: null, offscreen: null, occluded: null }, z = { box: null, offscreen: null, occluded: null }, O = null, F = null, B = null, k = 0, N = 0, U = 0; u.textFeatureIndex ? k = u.textFeatureIndex : t.useRuntimeCollisionCircles && (k = t.featureIndex), u.verticalTextFeatureIndex && (N = u.verticalTextFeatureIndex); const G = e => { e.tileID = this.retainedQueryData[s.bucketInstanceId].tileID; const i = this.transform.elevation; e.elevation = t.zOffset + (i ? i.getAtTileOffset(e.tileID, e.tileAnchorX, e.tileAnchorY) : 0); }, j = u.textBox; if (j) { G(j); const i = i => { let o = e.W.horizontal; if (s.allowVerticalPlacement && !i && this.prevPlacement) { const e = this.prevPlacement.placedOrientations[T]; e && (this.placedOrientations[T] = e, o = e, this.markUsedOrientation(s, o, t)); } return o }, o = (t, i) => { if (s.allowVerticalPlacement && E > 0 && u.verticalTextBox) { for (const o of s.writingModes) if (o === e.W.vertical ? (R = i(), z = R) : R = t(), R && R.box && R.box.length) break } else R = t(); }; if (n.get("text-variable-anchor")) { let l = n.get("text-variable-anchor"); if (this.prevPlacement && this.prevPlacement.variableOffsets[T]) { const e = this.prevPlacement.variableOffsets[T]; l.indexOf(e.anchor) > 0 && (l = l.filter((t => t !== e.anchor)), l.unshift(e.anchor)); } const c = (e, i, o) => { const n = s.getSymbolInstanceTextSize(p, t, this.transform.zoom, r), c = (e.x2 - e.x1) * n + 2 * e.padding, h = (e.y2 - e.y1) * n + 2 * e.padding, d = t.hasIconTextFit && !y ? i : null; d && G(d); let u = { box: [], offscreen: !1, occluded: !1 }; const g = x ? 2 * l.length : l.length; for (let i = 0; i < g; ++i) { const g = this.attemptAnchorPlacement(l[i % l.length], e, c, h, n, b, w, _, a, f, i >= l.length, t, r, s, o, d, p, m); if (g && (u = g.placedGlyphBoxes, u && u.box && u.box.length)) { S = !0, A = g.shift; break } } return u }; o((() => c(j, u.iconBox, e.W.horizontal)), (() => { const t = u.verticalTextBox; return t && G(t), s.allowVerticalPlacement && !(R && R.box && R.box.length) && E > 0 && t ? c(t, u.verticalIconBox, e.W.vertical) : { box: null, offscreen: null, occluded: null } })), R && (S = R.box, L = R.offscreen, P = R.occluded); const h = i(!(!R || !R.box)); if (!S && this.prevPlacement) { const e = this.prevPlacement.variableOffsets[T]; e && (this.variableOffsets[T] = e, this.markUsedJustification(s, e.anchor, t, h)); } } else { const n = (i, o) => { const n = s.getSymbolInstanceTextSize(p, t, this.transform.zoom, r), l = this.collisionIndex.placeCollisionBox(s, n, i, new e.P(0, 0), x, _, a, f.predicate); return l && l.box && l.box.length && (this.markUsedOrientation(s, o, t), this.placedOrientations[T] = o), l }; o((() => n(j, e.W.horizontal)), (() => { const t = u.verticalTextBox; return s.allowVerticalPlacement && E > 0 && t ? (G(t), n(t, e.W.vertical)) : { box: null, offscreen: null, occluded: null } })), i(!!(R && R.box && R.box.length)); } } if (O = R, S = O && O.box && O.box.length > 0, L = O && O.offscreen, P = O && O.occluded, t.useRuntimeCollisionCircles) { const i = s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex >= 0 ? t.centerJustifiedTextSymbolIndex : t.verticalPlacedTextSymbolIndex), r = e.j(s.textSizeData, p, i), h = n.get("text-padding"); F = this.collisionIndex.placeCollisionCircles(s, x, i, s.lineVertexArray, s.glyphOffsetArray, r, a, l, c, o, w, f.predicate, t.collisionCircleDiameter * r / e.aV, h, this.retainedQueryData[s.bucketInstanceId].tileID), S = x || F.circles.length > 0 && !F.collisionDetected, L = L && F.offscreen, P = F.occluded; } if (u.iconFeatureIndex && (U = u.iconFeatureIndex), u.iconBox) { const i = i => { G(i); const o = t.hasIconTextFit && A ? Ot(A.x, A.y, b, w, this.transform.angle) : new e.P(0, 0), r = s.getSymbolInstanceIconSize(m, this.transform.zoom, t.placedIconSymbolIndex); return this.collisionIndex.placeCollisionBox(s, r, i, o, y, _, a, f.predicate) }; z && z.box && z.box.length && u.verticalIconBox ? (B = i(u.verticalIconBox), M = B.box.length > 0) : (B = i(u.iconBox), M = B.box.length > 0), L = L && B.offscreen, D = B.occluded; } const V = g || 0 === t.numHorizontalGlyphVertices && 0 === E, Z = v || 0 === t.numIconVertices; if (V || Z ? Z ? V || (M = M && S) : S = M && S : M = S = M && S, S && O && O.box && this.collisionIndex.insertCollisionBox(O.box, n.get("text-ignore-placement"), s.bucketInstanceId, z && z.box && N ? N : k, f.ID), M && B && this.collisionIndex.insertCollisionBox(B.box, n.get("icon-ignore-placement"), s.bucketInstanceId, U, f.ID), F && (S && this.collisionIndex.insertCollisionCircles(F.circles, n.get("text-ignore-placement"), s.bucketInstanceId, k, f.ID), o)) { const e = s.bucketInstanceId; let t = this.collisionCircleArrays[e]; void 0 === t && (t = this.collisionCircleArrays[e] = new Dt); for (let e = 0; e < F.circles.length; e += 4)t.circles.push(F.circles[e + 0]), t.circles.push(F.circles[e + 1]), t.circles.push(F.circles[e + 2]), t.circles.push(F.collisionDetected ? 1 : 0); } const W = "globe" !== s.projection.name; C = C && (W || !P), I = I && (W || !D), this.placements[T] = new Pt(S || C, M || I, L || s.justReloaded), i.add(T); }; if (E && this.buildingIndex && (this.buildingIndex.updateZOffset(s, this.retainedQueryData[s.bucketInstanceId].tileID), s.updateZOffset()), T) { const t = s.getSortedSymbolIndexes(this.transform.angle); for (let e = t.length - 1; e >= 0; --e) { const i = t[e]; S(s.symbolInstances.get(i), i, s.collisionArrays[i]); } s.hasAnyZOffset && e.X(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`); } else if (s.hasAnyZOffset) { const e = s.getSortedIndexesByZOffset(); for (let t = 0; t < e.length; ++t) { const i = e[t]; S(s.symbolInstances.get(i), i, s.collisionArrays[i]); } } else for (let e = t.symbolInstanceStart; e < t.symbolInstanceEnd; e++)S(s.symbolInstances.get(e), e, s.collisionArrays[e]); if (o && s.bucketInstanceId in this.collisionCircleArrays) { const t = this.collisionCircleArrays[s.bucketInstanceId]; e.m.invert(t.invProjMatrix, a), t.viewportMatrix = this.collisionIndex.getViewportMatrix(); } s.justReloaded = !1; } markUsedJustification(t, i, o, r) { const { leftJustifiedTextSymbolIndex: s, centerJustifiedTextSymbolIndex: n, rightJustifiedTextSymbolIndex: a, verticalPlacedTextSymbolIndex: l, crossTileID: c } = o, h = e.aX(i), _ = r === e.W.vertical ? l : "left" === h ? s : "center" === h ? n : "right" === h ? a : -1; s >= 0 && (t.text.placedSymbolArray.get(s).crossTileID = _ >= 0 && s !== _ ? 0 : c), n >= 0 && (t.text.placedSymbolArray.get(n).crossTileID = _ >= 0 && n !== _ ? 0 : c), a >= 0 && (t.text.placedSymbolArray.get(a).crossTileID = _ >= 0 && a !== _ ? 0 : c), l >= 0 && (t.text.placedSymbolArray.get(l).crossTileID = _ >= 0 && l !== _ ? 0 : c); } markUsedOrientation(t, i, o) { const r = i === e.W.horizontal || i === e.W.horizontalOnly ? i : 0, s = i === e.W.vertical ? i : 0, { leftJustifiedTextSymbolIndex: n, centerJustifiedTextSymbolIndex: a, rightJustifiedTextSymbolIndex: l, verticalPlacedTextSymbolIndex: c } = o, h = t.text.placedSymbolArray; n >= 0 && (h.get(n).placedOrientation = r), a >= 0 && (h.get(a).placedOrientation = r), l >= 0 && (h.get(l).placedOrientation = r), c >= 0 && (h.get(c).placedOrientation = s); } commit(e) { this.commitTime = e, this.zoomAtLastRecencyCheck = this.transform.zoom; const t = this.prevPlacement; let i = !1; this.prevZoomAdjustment = t ? t.zoomAdjustment(this.transform.zoom) : 0; const o = t ? t.symbolFadeChange(e) : 1, r = t ? t.opacities : {}, s = t ? t.variableOffsets : {}, n = t ? t.placedOrientations : {}; for (const e in this.placements) { const t = this.placements[e], s = r[e]; s ? (this.opacities[e] = new Lt(s, o, t.text, t.icon, null, t.clipped), i = i || t.text !== s.text.placed || t.icon !== s.icon.placed) : (this.opacities[e] = new Lt(null, o, t.text, t.icon, t.skipFade, t.clipped), i = i || t.text || t.icon); } for (const e in r) { const t = r[e]; if (!this.opacities[e]) { const r = new Lt(t, o, !1, !1); r.isHidden() || (this.opacities[e] = r, i = i || t.text.placed || t.icon.placed); } } for (const e in s) this.variableOffsets[e] || !this.opacities[e] || this.opacities[e].isHidden() || (this.variableOffsets[e] = s[e]); for (const e in n) this.placedOrientations[e] || !this.opacities[e] || this.opacities[e].isHidden() || (this.placedOrientations[e] = n[e]); i ? this.lastPlacementChangeTime = e : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = t ? t.lastPlacementChangeTime : e); } updateLayerOpacities(e, t) { const i = new Set; for (const o of t) { const t = o.getBucket(e); t && o.latestFeatureIndex && e.fqid === t.layerIds[0] && (this.updateBucketOpacities(t, i, o.collisionBoxArray), t.layers[0].layout.get("symbol-z-elevate") && this.buildingIndex && (this.buildingIndex.updateZOffset(t, o.tileID), t.updateZOffset())); } } updateBucketOpacities(t, i, o) { t.hasTextData() && t.text.opacityVertexArray.clear(), t.hasIconData() && t.icon.opacityVertexArray.clear(), t.hasIconCollisionBoxData() && t.iconCollisionBox.collisionVertexArray.clear(), t.hasTextCollisionBoxData() && t.textCollisionBox.collisionVertexArray.clear(); const r = t.layers[0].layout, s = !!t.layers[0].dynamicFilter(), n = new Lt(null, 0, !1, !1, !0), a = r.get("text-allow-overlap"), l = r.get("icon-allow-overlap"), c = r.get("text-variable-anchor"), h = "map" === r.get("text-rotation-alignment"), _ = "map" === r.get("text-pitch-alignment"), d = new Lt(null, 0, a && (l || !t.hasIconData() || r.get("icon-optional")), l && (a || !t.hasTextData() || r.get("text-optional")), !0); !t.collisionArrays && o && (t.hasIconCollisionBoxData() || t.hasTextCollisionBoxData()) && t.deserializeCollisionBoxes(o); const u = (e, t, i) => { for (let o = 0; o < t / 4; o++)e.opacityVertexArray.emplaceBack(i); }; let p = 0; for (let o = 0; o < t.symbolInstances.length; o++) { const r = t.symbolInstances.get(o), { numHorizontalGlyphVertices: a, numVerticalGlyphVertices: l, crossTileID: m, numIconVertices: f } = r, g = i.has(m); let v = this.opacities[m]; g ? v = n : v || (v = d, this.opacities[m] = v), i.add(m); const x = a > 0 || l > 0, y = f > 0, b = this.placedOrientations[m], w = b === e.W.vertical, T = b === e.W.horizontal || b === e.W.horizontalOnly; if (!x && !y || v.isHidden() || p++, x) { const e = Wt(v.text); u(t.text, a, w ? Ht : e), u(t.text, l, T ? Ht : e); const i = v.text.isHidden(), { leftJustifiedTextSymbolIndex: o, centerJustifiedTextSymbolIndex: s, rightJustifiedTextSymbolIndex: n, verticalPlacedTextSymbolIndex: c } = r, h = t.text.placedSymbolArray, _ = i || w ? 1 : 0; o >= 0 && (h.get(o).hidden = _), s >= 0 && (h.get(s).hidden = _), n >= 0 && (h.get(n).hidden = _), c >= 0 && (h.get(c).hidden = i || T ? 1 : 0); const d = this.variableOffsets[m]; d && this.markUsedJustification(t, d.anchor, r, b); const p = this.placedOrientations[m]; p && (this.markUsedJustification(t, "left", r, p), this.markUsedOrientation(t, p, r)); } if (y) { const e = Wt(v.icon), { placedIconSymbolIndex: i, verticalPlacedIconSymbolIndex: o } = r, s = t.icon.placedSymbolArray, n = v.icon.isHidden() ? 1 : 0; i >= 0 && (u(t.icon, f, w ? Ht : e), s.get(i).hidden = n), o >= 0 && (u(t.icon, r.numVerticalIconVertices, T ? Ht : e), s.get(o).hidden = n); } if (t.hasIconCollisionBoxData() || t.hasTextCollisionBoxData()) { const i = t.collisionArrays[o]; if (i) { let o = new e.P(0, 0), n = !0; if (i.textBox || i.verticalTextBox) { if (c) { const e = this.variableOffsets[m]; e ? (o = zt(e.anchor, e.width, e.height, e.textOffset, e.textScale), h && o._rotate(_ ? this.transform.angle : -this.transform.angle)) : n = !1; } s && (n = !v.clipped), i.textBox && Bt(t.textCollisionBox.collisionVertexArray, v.text.placed, !n || w, o.x, o.y), i.verticalTextBox && Bt(t.textCollisionBox.collisionVertexArray, v.text.placed, !n || T, o.x, o.y); } const a = n && Boolean(!T && i.verticalIconBox); i.iconBox && Bt(t.iconCollisionBox.collisionVertexArray, v.icon.placed, a, r.hasIconTextFit ? o.x : 0, r.hasIconTextFit ? o.y : 0), i.verticalIconBox && Bt(t.iconCollisionBox.collisionVertexArray, v.icon.placed, !a, r.hasIconTextFit ? o.x : 0, r.hasIconTextFit ? o.y : 0); } } } if (t.fullyClipped = 0 === p, t.sortFeatures(this.transform.angle), this.retainedQueryData[t.bucketInstanceId] && (this.retainedQueryData[t.bucketInstanceId].featureSortOrder = t.featureSortOrder), t.hasTextData() && t.text.opacityVertexBuffer && t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray), t.hasIconData() && t.icon.opacityVertexBuffer && t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray), t.hasIconCollisionBoxData() && t.iconCollisionBox.collisionVertexBuffer && t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray), t.hasTextCollisionBoxData() && t.textCollisionBox.collisionVertexBuffer && t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray), t.bucketInstanceId in this.collisionCircleArrays) { const e = this.collisionCircleArrays[t.bucketInstanceId]; t.placementInvProjMatrix = e.invProjMatrix, t.placementViewportMatrix = e.viewportMatrix, t.collisionCircleArray = e.circles, delete this.collisionCircleArrays[t.bucketInstanceId]; } } symbolFadeChange(e) { return 0 === this.fadeDuration ? 1 : (e - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment } zoomAdjustment(e) { return Math.max(0, (this.transform.zoom - e) / 1.5) } hasTransitions(e) { return this.stale || e - this.lastPlacementChangeTime < this.fadeDuration } stillRecent(e, t) { const i = this.zoomAtLastRecencyCheck === t ? 1 - this.zoomAdjustment(t) : 1; return this.zoomAtLastRecencyCheck = t, this.commitTime + this.fadeDuration * i > e } setStale() { this.stale = !0; } } function Bt(e, t, i, o, r) { e.emplaceBack(t ? 1 : 0, i ? 1 : 0, o || 0, r || 0), e.emplaceBack(t ? 1 : 0, i ? 1 : 0, o || 0, r || 0), e.emplaceBack(t ? 1 : 0, i ? 1 : 0, o || 0, r || 0), e.emplaceBack(t ? 1 : 0, i ? 1 : 0, o || 0, r || 0); } const kt = Math.pow(2, 25), Nt = Math.pow(2, 24), Ut = Math.pow(2, 17), Gt = Math.pow(2, 16), jt = Math.pow(2, 9), Vt = Math.pow(2, 8), Zt = Math.pow(2, 1); function Wt(e) { if (0 === e.opacity && !e.placed) return 0; if (1 === e.opacity && e.placed) return 4294967295; const t = e.placed ? 1 : 0, i = Math.floor(127 * e.opacity); return i * kt + t * Nt + i * Ut + t * Gt + i * jt + t * Vt + i * Zt + t } const Ht = 0; class qt { constructor(e) { this._sortAcrossTiles = "viewport-y" !== e.layout.get("symbol-z-order") && void 0 !== e.layout.get("symbol-sort-key").constantOr(1), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = new Set, this._bucketParts = []; } continuePlacement(e, t, i, o, r) { const s = this._bucketParts; for (; this._currentTileIndex < e.length;)if (t.getBucketParts(s, o, e[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, r()) return !0; for (this._sortAcrossTiles && (this._sortAcrossTiles = !1, s.sort(((e, t) => e.sortKey - t.sortKey))); this._currentPartIndex < s.length;) { const e = s[this._currentPartIndex]; if (t.placeLayerBucketPart(e, this._seenCrossTileIDs, i, 0 === e.symbolInstanceStart), this._currentPartIndex++, r()) return !0 } return !1 } } class $t { constructor(e, t, i, o, r, s, n, a, l) { this.placement = new Ft(e, r, s, n, a, l), this._currentPlacementIndex = t.length - 1, this._forceFullPlacement = i, this._showCollisionBoxes = o, this._done = !1; } isDone() { return this._done } continuePlacement(t, i, o, r) { const s = e.a4.now(), n = () => { const t = e.a4.now() - s; return !this._forceFullPlacement && t > 2 }; for (; this._currentPlacementIndex >= 0;) { const s = i[t[this._currentPlacementIndex]], a = this.placement.collisionIndex.transform.zoom; if ("symbol" === s.type && (!s.minzoom || s.minzoom <= a) && (!s.maxzoom || s.maxzoom > a)) { const t = s, i = t.layout.get("symbol-z-elevate"), a = this._inProgressLayer = this._inProgressLayer || new qt(t), l = e.aE(s.source, s.scope); if (a.continuePlacement(i ? r[l] : o[l], this.placement, this._showCollisionBoxes, s, n)) return; delete this._inProgressLayer; } this._currentPlacementIndex--; } this._done = !0; } commit(e) { return this.placement.commit(e), this.placement } } const Xt = 512 / e.J / 2; class Jt { constructor(t, i, o) { this.tileID = t, this.bucketInstanceId = o, this.index = new e.aZ(i.length, 16, Int32Array), this.keys = [], this.crossTileIDs = []; const r = t.canonical.x * e.J, s = t.canonical.y * e.J; for (let e = 0; e < i.length; e++) { const { key: t, crossTileID: o, tileAnchorX: n, tileAnchorY: a } = i.get(e), l = Math.floor((r + n) * Xt), c = Math.floor((s + a) * Xt); this.index.add(l, c), this.keys.push(t), this.crossTileIDs.push(o); } this.index.finish(); } findMatches(t, i, o) { const r = this.tileID.canonical.z < i.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - i.canonical.z), s = Xt / Math.pow(2, i.canonical.z - this.tileID.canonical.z), n = i.canonical.x * e.J, a = i.canonical.y * e.J; for (let e = 0; e < t.length; e++) { const i = t.get(e); if (i.crossTileID) continue; const { key: l, tileAnchorX: c, tileAnchorY: h } = i, _ = Math.floor((n + c) * s), d = Math.floor((a + h) * s), u = this.index.range(_ - r, d - r, _ + r, d + r); for (const e of u) { const t = this.crossTileIDs[e]; if (this.keys[e] === l && !o.has(t)) { o.add(t), i.crossTileID = t; break } } } } } class Yt { constructor() { this.maxCrossTileID = 0; } generate() { return ++this.maxCrossTileID } } class Kt { constructor() { this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0; } handleWrapJump(e) { const t = Math.round((e - this.lng) / 360); if (0 !== t) for (const e in this.indexes) { const i = this.indexes[e], o = {}; for (const e in i) { const r = i[e]; r.tileID = r.tileID.unwrapTo(r.tileID.wrap + t), o[r.tileID.key] = r; } this.indexes[e] = o; } this.lng = e; } addBucket(e, t, i) { if (this.indexes[e.overscaledZ] && this.indexes[e.overscaledZ][e.key]) { if (this.indexes[e.overscaledZ][e.key].bucketInstanceId === t.bucketInstanceId) return !1; this.removeBucketCrossTileIDs(e.overscaledZ, this.indexes[e.overscaledZ][e.key]); } for (let e = 0; e < t.symbolInstances.length; e++)t.symbolInstances.get(e).crossTileID = 0; this.usedCrossTileIDs[e.overscaledZ] || (this.usedCrossTileIDs[e.overscaledZ] = new Set); const o = this.usedCrossTileIDs[e.overscaledZ]; for (const i in this.indexes) { const r = this.indexes[i]; if (Number(i) > e.overscaledZ) for (const i in r) { const s = r[i]; s.tileID.isChildOf(e) && s.findMatches(t.symbolInstances, e, o); } else { const s = r[e.scaledTo(Number(i)).key]; s && s.findMatches(t.symbolInstances, e, o); } } for (let e = 0; e < t.symbolInstances.length; e++) { const r = t.symbolInstances.get(e); r.crossTileID || (r.crossTileID = i.generate(), o.add(r.crossTileID)); } return void 0 === this.indexes[e.overscaledZ] && (this.indexes[e.overscaledZ] = {}), this.indexes[e.overscaledZ][e.key] = new Jt(e, t.symbolInstances, t.bucketInstanceId), !0 } removeBucketCrossTileIDs(e, t) { for (const i of t.crossTileIDs) this.usedCrossTileIDs[e].delete(i); } removeStaleBuckets(e) { let t = !1; for (const i in this.indexes) { const o = this.indexes[i]; for (const r in o) e[o[r].bucketInstanceId] || (this.removeBucketCrossTileIDs(i, o[r]), delete o[r], t = !0); } return t } } class Qt { constructor() { this.layerIndexes = {}, this.crossTileIDs = new Yt, this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {}; } addLayer(e, t, i, o) { let r = this.layerIndexes[e.fqid]; void 0 === r && (r = this.layerIndexes[e.fqid] = new Kt); let s = !1; const n = {}; "globe" !== o.name && r.handleWrapJump(i); for (const i of t) { const t = i.getBucket(e); t && e.fqid === t.layerIds[0] && (t.bucketInstanceId || (t.bucketInstanceId = ++this.maxBucketInstanceId), r.addBucket(i.tileID, t, this.crossTileIDs) && (s = !0), n[t.bucketInstanceId] = !0); } return r.removeStaleBuckets(n) && (s = !0), s } pruneUnusedLayers(e) { const t = {}; e.forEach((e => { t[e] = !0; })); for (const e in this.layerIndexes) t[e] || delete this.layerIndexes[e]; } } var ei = "\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif", ti = "\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}", ii = "\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
41float 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;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}", oi = "in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}", 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\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}
41float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture(u_depth,uv-df.xz)),unpack_depth(texture(u_depth,uv+df.xz)),unpack_depth(texture(u_depth,uv-df.zy)),unpack_depth(texture(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif", si = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif", ni = "highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
41vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif", ai = "#ifdef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);vec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return (texCoord.xxyy+vec2(1.5,0.5).xyxy)/texResolution.xxyy;}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;vec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texture(u_image0,c.yz),texture(u_image0,c.xz),texture(u_image0,c.yw),texture(u_image0,c.xw)\n);}
41vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;vec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texture(u_image1,c.yz),texture(u_image1,c.xz),texture(u_image1,c.yw),texture(u_image1,c.xw)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texture(u_image0,texCoord);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texture(u_image1,texCoord);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif", li = "#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS", ci = "#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef NATIVE\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif"; const hi = []; fi(ei, hi), fi(ii, hi), fi(ti, hi); const _i = { "_prelude_fog.vertex.glsl": si, "_prelude_terrain.vertex.glsl": ri, "_prelude_shadow.vertex.glsl": li, "_prelude_fog.fragment.glsl": ni, "_prelude_shadow.fragment.glsl": ci, "_prelude_lighting.glsl": "\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
41));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE", "_prelude_raster_array.glsl": ai }, di = {}; gi("", ri), gi(ni, si), gi(ci, li), gi(ai, ""); const ui = gi(ti, ii), pi = ei; var mi = { background: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), backgroundPattern: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), circle: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
41/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
41s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'), clippingMask: gi("void main() {glFragColor=vec4(1.0);}", "in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), heatmap: gi('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), heatmapTexture: gi("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}", "in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"), collisionBox: gi("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}", '#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'), collisionCircle: gi("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}", "in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"), debug: gi("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}", '#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
41);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'), fill: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillOutline: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillOutlinePattern: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillPattern: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillExtrusion: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nuniform float u_emissive_strength;in float v_height;void main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,v_depth);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=max(0.01,cutoff_opacity(u_cutoff_params,ground.z));if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff < 0.01 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
41\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), fillExtrusionDepth: gi("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}", '#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'), fillExtrusionPattern: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
41),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nout vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
41ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'), groundShadow: gi('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,v_depth));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);v_depth=gl_Position.w;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'), fillExtrusionGroundEffect: gi("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;HANDLE_WIREFRAME_DEBUG;\n#endif\n#endif\n}", '#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;
41float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'), hillshadePrepare: gi("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}", "uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"), hillshade: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), line: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;
41uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
41float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {    \nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trimmed,out_color.rgb,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), linePattern: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float pattern_x=v_linesofar/pattern_size.x*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_ground(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\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: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;void main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'), symbolIcon: gi('#include "_prelude_lighting.glsl"\nuniform sampler2D u_texture;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\nin float v_fade_opacity;in vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nuniform mediump float u_icon_saturation;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nlowp float alpha=opacity*v_fade_opacity;vec4 out_color;\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b)*alpha;\n#else\nout_color=texture(u_texture,v_tex_a)*alpha;\n#endif\n#ifdef SATURATION\nvec3 luma=vec3(dot(out_color.rgb,vec3(0.2126,0.7152,0.0722)));out_color.rgb=mix(luma,out_color.rgb,u_icon_saturation);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nv_tex_a=a_tex/u_texsize;\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\nv_fade_opacity=out_fade_opacity;}'), symbolSDF: gi('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\nuniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout float v_draw_halo;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}'), symbolTextAndIcon: gi('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
41glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout float v_draw_halo;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nfloat out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}'), terrainRaster: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,v_depth,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
41\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}'), terrainDepth: gi("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}", '#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'), skybox: gi('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
41nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', oi), skyboxGradient: gi('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', oi), skyboxCapture: gi("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}
41float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}", "in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
41nd-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: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'), globeAtmosphere: gi('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
41vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}', "in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"), model: gi('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;highp float depth=unpack_depth(texture(u_depthTexture,coord));return v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
41Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nreturn vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
41Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);color=mix(color,v_color_mix.rgb,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
41y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=u_matrix*pos;pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
41\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=local_pos;\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1);v_depth_shadows=gl_Position.w;\n#endif\n}'), modelDepth: gi("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}", "in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
41rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=u_matrix*pos;\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"), stars: gi("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}", "\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}") }; function fi(e, t) { const i = e.replace(/\s*\/\/[^\n]*\n/g, "\n").split("\n"); for (let e of i) if (e = e.trim(), "#" === e[0] && e.includes("if") && !e.includes("endif")) { e = e.replace("#", "").replace(/ifdef|ifndef|elif|if/g, "").replace(/!|defined|\(|\)|\|\||&&/g, "").replace(/\s+/g, " ").trim(); const i = e.split(" "); for (const e of i) t.includes(e) || t.push(e); } } function gi(e, t) { const i = /#include\s+"([^"]+)"/g, o = /#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g; let r = t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm); r && (r = r.map((e => { const t = e.split(" "); return t[t.length - 1] })), r = [...new Set(r)]); const s = {}, n = [], a = []; if (e = e.replace(i, ((e, t) => (a.push(t), ""))), (t = t.replace(i, ((e, t) => (n.push(t), "")))).includes("flat out")) return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071'); let l = [...hi]; fi(e, l), fi(t, l); for (const e of [...n, ...a]) _i[e] || console.error(`Undefined include: ${e}`), di[e] || (di[e] = [], fi(_i[e], di[e])), l = [...l, ...di[e]]; return { fragmentSource: e = e.replace(o, ((e, t, i, o, r) => (s[r] = !0, "define" === t ? `\n#ifndef HAS_UNIFORM_u_${r}\nin ${i} ${o} ${r};\n#else\nuniform ${i} ${o} u_${r};\n#endif\n` : "initialize" === t ? `\n#ifdef HAS_UNIFORM_u_${r}\n    ${i} ${o} ${r} = u_${r};\n#endif\n` : "define-attribute" === t ? `\n#ifdef HAS_ATTRIBUTE_a_${r}\n    in ${i} ${o} ${r};\n#endif\n` : "initialize-attribute" === t ? "" : void 0))), vertexSource: t = t.replace(o, ((e, t, i, o, r) => { const n = "float" === o ? "vec2" : o, a = r.match(/color/) ? "color" : n; return "define-attribute-vertex-shader-only" === t ? `\n#ifdef HAS_ATTRIBUTE_a_${r}\nin ${i} ${o} a_${r};\n#endif\n` : s[r] ? "define" === t ? `\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${n} a_${r};\nout ${i} ${o} ${r};\n#else\nuniform ${i} ${o} u_${r};\n#endif\n` : "initialize" === t ? "vec4" === a ? `\n#ifndef HAS_UNIFORM_u_${r}\n    ${r} = a_${r};\n#else\n    ${i} ${o} ${r} = u_${r};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_${r}\n    ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n    ${i} ${o} ${r} = u_${r};\n#endif\n` : "define-attribute" === t ? `\n#ifdef HAS_ATTRIBUTE_a_${r}\n    in ${i} ${o} a_${r};\n    out ${i} ${o} ${r};\n#endif\n` : "initialize-attribute" === t ? `\n#ifdef HAS_ATTRIBUTE_a_${r}\n    ${r} = a_${r};\n#endif\n` : void 0 : "define" === t ? `\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${n} a_${r};\n#else\nuniform ${i} ${o} u_${r};\n#endif\n` : "define-instanced" === t ? "mat4" === a ? `\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${r}0;\nin vec4 a_${r}1;\nin vec4 a_${r}2;\nin vec4 a_${r}3;\n#else\nuniform ${i} ${o} u_${r};\n#endif\n` : `\n#ifdef INSTANCED_ARRAYS\nin ${i} ${n} a_${r};\n#else\nuniform ${i} ${o} u_${r};\n#endif\n` : "initialize-attribute-custom" === t ? `\n#ifdef HAS_ATTRIBUTE_a_${r}\n    ${i} ${o} ${r} = a_${r};\n#endif\n` : "vec4" === a ? `\n#ifndef HAS_UNIFORM_u_${r}\n    ${i} ${o} ${r} = a_${r};\n#else\n    ${i} ${o} ${r} = u_${r};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_${r}\n    ${i} ${o} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n    ${i} ${o} ${r} = u_${r};\n#endif\n` })), staticAttributes: r, usedDefines: l, vertexIncludes: n, fragmentIncludes: a } } class vi { constructor() { this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffers = [], this.vao = null; } bind(e, t, i, o, r, s, n, a) { this.context = e; let l = this.boundPaintVertexBuffers.length !== o.length; for (let e = 0; !l && e < o.length; e++)this.boundPaintVertexBuffers[e] !== o[e] && (l = !0); let c = this.boundDynamicVertexBuffers.length !== n.length; for (let e = 0; !c && e < n.length; e++)this.boundDynamicVertexBuffers[e] !== n[e] && (c = !0); if (!this.vao || this.boundProgram !== t || this.boundLayoutVertexBuffer !== i || l || c || this.boundIndexBuffer !== r || this.boundVertexOffset !== s) this.freshBind(t, i, o, r, s, n, a); else { e.bindVertexArrayOES.set(this.vao); for (const i of n) i && (i.bind(), a && i.instanceCount && i.setVertexAttribDivisor(e.gl, t, a)); r && r.dynamicDraw && r.bind(); } } freshBind(e, t, i, o, r, s, n) { const a = e.numAttributes, l = this.context, c = l.gl; this.vao && this.destroy(), this.vao = l.gl.createVertexArray(), l.bindVertexArrayOES.set(this.vao), this.boundProgram = e, this.boundLayoutVertexBuffer = t, this.boundPaintVertexBuffers = i, this.boundIndexBuffer = o, this.boundVertexOffset = r, this.boundDynamicVertexBuffers = s, t.enableAttributes(c, e), t.bind(), t.setVertexAttribPointers(c, e, r); for (const t of i) t.enableAttributes(c, e), t.bind(), t.setVertexAttribPointers(c, e, r); for (const t of s) t && (t.enableAttributes(c, e), t.bind(), t.setVertexAttribPointers(c, e, r), n && t.instanceCount && t.setVertexAttribDivisor(c, e, n)); o && o.bind(), l.currentNumAttributes = a; } destroy() { this.vao && (this.context.gl.deleteVertexArray(this.vao), this.vao = null); } } function xi(t, i) { const o = Math.pow(2, i.canonical.z), r = i.canonical.y; return [new e.M(0, r / o).toLngLat().lat, new e.M(0, (r + 1) / o).toLngLat().lat] } function yi(t, i, o, r, s, n, a) { const l = t.context, c = l.gl, h = o.hillshadeFBO; if (!h) return; t.prepareDrawTile(); const _ = t.isTileAffectedByFog(i), d = t.getOrCreateProgram("hillshade", { overrideFog: _ }); l.activeTexture.set(c.TEXTURE0), c.bindTexture(c.TEXTURE_2D, h.colorAttachment.get()); const u = ((t, i, o, r) => { const s = o.paint.get("hillshade-shadow-color"), n = o.paint.get("hillshade-highlight-color"), a = o.paint.get("hillshade-accent-color"), l = o.paint.get("hillshade-emissive-strength"); let c = e.d(o.paint.get("hillshade-illumination-direction")); if ("viewport" === o.paint.get("hillshade-illumination-anchor")) c -= t.transform.angle; else if (t.style && t.style.enable3dLights() && t.style.directionalLight) { const i = t.style.directionalLight.properties.get("direction"), o = e.b3(i.x, i.y, i.z); c = e.d(o[1]); } const h = !t.options.moving; return { u_matrix: r || t.transform.calculateProjMatrix(i.tileID.toUnwrapped(), h), u_image: 0, u_latrange: xi(0, i.tileID), u_light: [o.paint.get("hillshade-exaggeration"), c], u_shadow: s, u_highlight: n, u_emissive_strength: l, u_accent: a } })(t, o, r, t.terrain ? i.projMatrix : null); t.uploadCommonUniforms(l, d, i.toUnwrapped()); const { tileBoundsBuffer: p, tileBoundsIndexBuffer: m, tileBoundsSegments: f } = t.getTileBoundsBuffers(o); d.draw(t, c.TRIANGLES, s, n, a, e.b5.disabled, u, r.id, p, m, f); } function bi(t, i, o) { if (!i.needsDEMTextureUpload) return; const r = t.context, s = r.gl; r.pixelStoreUnpackPremultiplyAlpha.set(!1), i.demTexture = i.demTexture || t.getTileTexture(o.stride); const n = o.getPixels(); i.demTexture ? i.demTexture.update(n, { premultiply: !1 }) : i.demTexture = new e.a9(r, n, s.R32F, { premultiply: !1 }), i.needsDEMTextureUpload = !1; } function wi(t, i, o) { const r = t.context, s = r.gl; if (!i.dem) return; const n = i.dem; if (r.activeTexture.set(s.TEXTURE1), bi(t, i, n), !i.demTexture) return; i.demTexture.bind(s.NEAREST, s.CLAMP_TO_EDGE); const a = n.dim; r.activeTexture.set(s.TEXTURE0); let l = i.hillshadeFBO; if (!l) { const t = new e.a9(r, { width: a, height: a, data: null }, s.RGBA); t.bind(s.LINEAR, s.CLAMP_TO_EDGE), l = i.hillshadeFBO = r.createFramebuffer(a, a, !0, "renderbuffer"), l.colorAttachment.set(t.texture); } r.bindFramebuffer.set(l.framebuffer), r.viewport.set([0, 0, a, a]); const { tileBoundsBuffer: c, tileBoundsIndexBuffer: h, tileBoundsSegments: _ } = t.getMercatorTileBoundsBuffers(), d = []; t.linearFloatFilteringSupported() && d.push("TERRAIN_DEM_FLOAT_FORMAT"), t.getOrCreateProgram("hillshadePrepare", { defines: d }).draw(t, s.TRIANGLES, e.b4.disabled, e.b6.disabled, e.a.unblended, e.b5.disabled, ((t, i) => { const o = i.stride, r = e.m.create(); return e.m.ortho(r, 0, e.J, -e.J, 0, 0, 1), e.m.translate(r, r, [0, -e.J, 0]), { u_matrix: r, u_image: 1, u_dimension: [o, o], u_zoom: t.overscaledZ } })(i.tileID, n), o.id, c, h, _), i.needsHillshadePrepare = !1; } const Ti = t => ({ u_matrix: new e.a_(t), u_image0: new e.a$(t), u_skirt_height: new e.b2(t), u_ground_shadow_factor: new e.b7(t) }), Ei = (e, t, i) => ({ u_matrix: e, u_image0: 0, u_skirt_height: t, u_ground_shadow_factor: i }), Ci = (e, t, i, o, r, s, n, a, l, c, h, _, d, u, p) => ({ u_proj_matrix: Float32Array.from(e), u_globe_matrix: t, u_normalize_matrix: Float32Array.from(o), u_merc_matrix: i, u_zoom_transition: r, u_merc_center: s, u_image0: 0, u_frustum_tl: n, u_frustum_tr: a, u_frustum_br: l, u_frustum_bl: c, u_globe_pos: h, u_globe_radius: _, u_viewport: d, u_grid_matrix: p ? Float32Array.from(p) : new Float32Array(9), u_skirt_height: u }), Ii = (t, i) => { if (i > 0 && t.terrain && e.X("Cutoff is currently disabled on terrain"), i <= 0 || t.terrain) return { shouldRenderCutoff: !1, uniformValues: { u_cutoff_params: [0, 0, 0, 1] } }; const o = t.transform, r = Math.max(Math.abs(o._zoom - (t.minCutoffZoom - 1)), 1), s = o.isLODDisabled(!1) ? e.an(60, 45, o.pitch) : e.an(30, 15, o.pitch), n = o._farZ - o._nearZ, a = i * o.height, l = ((1 - (c = s)) * o.cameraToCenterDistance + c * (o._farZ + a)) * r; var c; return { shouldRenderCutoff: s < 1, uniformValues: { u_cutoff_params: [o._nearZ, o._farZ, (l - o._nearZ) / n, (l - a - o._nearZ) / n] } } }; function Si(e, t) { return null != e && null != t && !(!e.hasData() || !t.hasData()) && null != e.demTexture && null != t.demTexture && e.t
41ileID.key !== t.tileID.key } const Mi = new class { constructor() { this.operations = {}; } newMorphing(e, t, i, o, r) { if (e in this.operations) { const t = this.operations[e]; t.to.tileID.key !== i.tileID.key && (t.queued = i); } else this.operations[e] = { startTime: o, phase: 0, duration: r, from: t, to: i, queued: null }; } getMorphValuesForProxy(e) { if (!(e in this.operations)) return null; const t = this.operations[e]; return { from: t.from, to: t.to, phase: t.phase } } update(e) { for (const t in this.operations) { const i = this.operations[t]; for (i.phase = (e - i.startTime) / i.duration; i.phase >= 1 || !this._validOp(i);)if (!this._nextOp(i, e)) { delete this.operations[t]; break } } } _nextOp(e, t) { return !!e.queued && (e.from = e.to, e.to = e.queued, e.queued = null, e.phase = 0, e.startTime = t, !0) } _validOp(e) { return e.from.hasData() && e.to.hasData() } }, Li = { 0: null, 1: "TERRAIN_VERTEX_MORPHING" }; function Pi(e, t, i) { if (0 === t) return 0; const o = t < 1 && 514 === i ? .25 / t : 1; return 6 * Math.pow(1.5, 22 - e) * Math.max(t, 1) * o } function Di(e, t) { const i = 1 << e.z; return !t && (0 === e.x || e.x === i - 1) || 0 === e.y || e.y === i - 1 } const Ai = e => ({ u_matrix: e }); function Ri(t, i, o, r, s) { if (s > 0) { const n = e.a4.now(), a = (n - t.timeAdded) / s, l = i ? (n - i.timeAdded) / s : -1, c = o.getSource(), h = r.coveringZoomLevel({ tileSize: c.tileSize, roundZoom: c.roundZoom }), _ = !i || Math.abs(i.tileID.overscaledZ - h) > Math.abs(t.tileID.overscaledZ - h), d = _ && t.refreshedUponExpiration ? 1 : e.c(_ ? a : 1 - l, 0, 1); return t.refreshedUponExpiration && a >= 1 && (t.refreshedUponExpiration = !1), i ? { opacity: 1, mix: 1 - d } : { opacity: d, mix: 0 } } return { opacity: 1, mix: 0 } } class zi extends e.bq { constructor(t) { const i = { type: "raster-dem", maxzoom: t.transform.maxZoom }, o = new e.br(e.bs(), null), r = st("mock-dem", i, o, t.style); super("mock-dem", r, !1), r.setEventedParent(this), this._sourceLoaded = !0; } _loadTile(e, t) { e.state = "loaded", t(null); } } class Oi extends e.bq { constructor(t) { const i = st("proxy", { type: "geojson", maxzoom: t.transform.maxZoom }, new e.br(e.bs(), null), t.style); super("proxy", i, !1), i.setEventedParent(this), this.map = this.getSource().map = t, this.used = this._sourceLoaded = !0, this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; } update(t, i, o) { if (t.freezeTileCoverage) return; this.transform = t; const r = t.coveringTiles({ tileSize: this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled }).reduce(((i, o) => { if (i[o.key] = "", !this._tiles[o.key]) { const i = new e.bt(o, this._source.tileSize * o.overscaleFactor(), t.tileZoom); i.state = "loaded", this._tiles[o.key] = i; } return i }), {}); for (const e in this._tiles) e in r || (this.freeFBO(e), this._tiles[e].unloadVectorData(), delete this._tiles[e]); } freeFBO(e) { const t = this.proxyCachedFBO[e]; if (void 0 !== t) { const i = Object.values(t); this.renderCachePool.push(...i), delete this.proxyCachedFBO[e]; } } deallocRenderCache() { this.renderCache.forEach((e => e.fb.destroy())), this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; } } class Fi extends e.O { constructor(e, t, i) { super(e.overscaledZ, e.wrap, e.canonical.z, e.canonical.x, e.canonical.y), this.proxyTileKey = t, this.projMatrix = i; } } class Bi extends e.bk { constructor(t, i) { super(), this._debugParams = { sortTilesHiZFirst: !0, disableRenderCache: !1 }, t.tp.registerParameter(this._debugParams, ["Terrain"], "sortTilesHiZFirst", {}, (() => { this._style.map.triggerRepaint(); })), t.tp.registerParameter(this._debugParams, ["Terrain"], "disableRenderCache", {}, (() => { this._style.map.triggerRepaint(); })), t.tp.registerButton(["Terrain"], "Invalidate Render Cache", (() => { this.invalidateRenderCache = !0, this._style.map.triggerRepaint(); })), this.painter = t, this.terrainTileForTile = {}, this.prevTerrainTileForTile = {}; const [o, r, s] = function (t) { const i = new e.bo, o = new e.bp, r = 131;
vendor: 6,339 bytes, line 41
41 i.reserve(17161), o.reserve(33800); const s = e.J / 128, n = e.J + s / 2, a = n + s; for (let t = -s; t < a; t += s)for (let o = -s; o < a; o += s) { const r = o < 0 || o > n || t < 0 || t > n ? 24575 : 0, s = e.c(Math.round(o), 0, e.J), a = e.c(Math.round(t), 0, e.J); i.emplaceBack(s + r, a); } const l = (e, t) => { const i = t * r + e; o.emplaceBack(i + 1, i, i + r), o.emplaceBack(i + r, i + r + 1, i + 1); }; for (let e = 1; e < 129; e++)for (let t = 1; t < 129; t++)l(t, e); return [0, 129].forEach((e => { for (let t = 0; t < 130; t++)l(t, e), l(e, t); })), [i, o, 32768] }(), n = t.context; this.gridBuffer = n.createVertexBuffer(o, e.bl.members), this.gridIndexBuffer = n.createIndexBuffer(r), this.gridSegments = e.bm.simpleSegment(0, 0, o.length, r.length), this.gridNoSkirtSegments = e.bm.simpleSegment(0, 0, o.length, s), this.proxyCoords = [], this.proxiedCoords = {}, this._visibleDemTiles = [], this._drapedRenderBatches = [], this._sourceTilesOverlap = {}, this.proxySourceCache = new Oi(i.map), this.orthoMatrix = e.m.create(), e.m.ortho(this.orthoMatrix, "globe" === this.painter.transform.projection.name ? .015 : 0, e.J, 0, e.J, 0, 1); const a = n.gl; this._overlapStencilMode = new e.b6({ func: a.GEQUAL, mask: 255 }, 0, 255, a.KEEP, a.KEEP, a.REPLACE), this._previousZoom = t.transform.zoom, this.pool = [], this._findCoveringTileCache = {}, this._tilesDirty = {}, this.style = i, this._useVertexMorphing = !0, this._exaggeration = 1, this._mockSourceCache = new zi(i.map), this._pendingGroundEffectLayers = []; } set style(e) { e.on("data", this._onStyleDataEvent.bind(this)), this._style = e, this._style.map.on("moveend", (() => { this._clearLineLayersFromRenderCache(); })); } update(t, i, o) { if (t && t.terrain) { this._style !== t && (this.style = t, this._evaluationZoom = void 0); const r = t.terrain.properties, s = 0 === t.terrain.drapeRenderMode, n = t.terrain.isZoomDependent(); this._previousUpdateTimestamp = this.enabled ? this._updateTimestamp : void 0, this._updateTimestamp = e.a4.now(); const a = t.terrain && t.terrain.scope, l = r.get("source"), c = s ? this._mockSourceCache : t.getSourceCache(l, a); if (!c) return void e.X(`Couldn't find terrain source "${l}".`); if (this.sourceCache = c, this._exaggeration = n ? this.calculateExaggeration(i) : r.get("exaggeration"), !i.projection.requiresDraping && n && 0 === this._exaggeration) return void this._disable(); this.enabled = !0; const h = () => { this.sourceCache.used && e.X(`Raster DEM source '${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 t = this.getScaledDemTileSize(); this.sourceCache.update(i, t, !0), this.resetTileLookupCache(this.sourceCache.id); }; this.sourceCache.usedForTerrain || (this.resetTileLookupCache(this.sourceCache.id), this.sourceCache.usedForTerrain = !0, h(), this._initializing = !0), h(), i.updateElevation(!0, o), this.resetTileLookupCache(this.proxySourceCache.id), this.proxySourceCache.update(i), this._emptyDEMTextureDirty = !0, this._previousZoom = i.zoom; } else this._disable(); } calculateExaggeration(t) { const i = this._previousCameraAltitude, o = t.getFreeCameraOptions().position.z / t.pixelsPerMeter * t.worldSize; this._previousCameraAltitude = o; const r = null != i ? o - i : Number.MAX_VALUE; if (Math.abs(r) < 2) return this._exaggeration; const s = t.zoom, n = this._style.terrain; if (!this._previousUpdateTimestamp) return n.getExaggeration(s); let a = s - this._previousZoom; const l = this._previousUpdateTimestamp; let c = s; null != this._evaluationZoom && (c = this._evaluationZoom, Math.abs(s - c) > .5 && (a = .5 * (s - c + a)), a * r < 0 && (c += a)), this._evaluationZoom = c; const h = n.getExaggeration(c), _ = h === n.getExaggeration(Math.max(0, c - .1)); if (_ && Math.abs(h - this._exaggeration) < .01) return h; let d = Math.min(.1, .00375 * (this._updateTimestamp - l)); return (_ || h < .1 || Math.abs(a) < 1e-4) && (d = Math.min(.2, 4 * d)), e.n(this._exaggeration, h, d) } resetTileLookupCache(e) { this._findCoveringTileCache[e] = {}; } getScaledDemTileSize() { return this.sourceCache.getSource().tileSize / 128 * this.proxySourceCache.getSource().tileSize } _onStyleDataEvent(e) { e.coord && "source" === e.dataType ? this._clearRenderCacheForTile(e.sourceCacheId, e.coord) : "style" === e.dataType && (this.invalidateRenderCache = !0, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this._previousCameraAltitude = void 0); } _disable() { if (this.enabled && (this.enabled = !1, this._sharedDepthStencil = void 0, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this.proxySourceCache.deallocRenderCache(), this._style)) for (const e in this._style._mergedSourceCaches) this._style._mergedSourceCaches[e].usedForTerrain = !1; } destroy() { this._disable(), this._emptyDEMTexture && this._emptyDEMTexture.destroy(), this._emptyDepthBufferTexture && this._emptyDepthBufferTexture.destroy(), this.pool.forEach((e => e.fb.destroy())), this.pool = [], this._depthFBO && (this._depthFBO.destroy(), this._depthFBO = void 0, this._depthTexture = void 0), this.framebufferCopyTexture && this.framebufferCopyTexture.destroy(); } _source() { return this.enabled ? this.sourceCache : null } isUsingMockSource() { return this.sourceCache === this._mockSourceCache } exaggeration() { return this._exaggeration } get visibleDemTiles() { return this._visibleDemTiles } get drapeBufferSize() { const e = 2 * this.proxySourceCache.getSource().tileSize; return [e, e] } set useVertexMorphing(e) { this._useVertexMorphing = e; } updateTileBinding(t) { if (!this.enabled) return; this.prevTerrainTileForTile = this.terrainTileForTile; const i = this.proxySourceCache, o = this.painter.transform; this._initializing && (this._initializing = 0 === o._centerAltitude && -1 === this.getAtPointOrZero(e.M.fromLngLat(o.center), -1), this._emptyDEMTextureDirty = !this._initializing); const r = this.proxyCoords = i.getIds().map((e => { const t = i.getTileByID(e).tileID; return t.projMatrix = o.calculateProjMatrix(t.toUnwrapped()), t })); !function (t, i) { const o = i.transform.pointCoordinate(i.transform.getCameraPoint()), r = new e.P(o.x, o.y); t.sort(((t, i) =>
41 { if (i.overscaledZ - t.overscaledZ) return i.overscaledZ - t.overscaledZ; const o = new e.P(t.canonical.x + (1 << t.canonical.z) * t.wrap, t.canonical.y), s = new e.P(i.canonical.x + (1 << i.canonical.z) * i.wrap, i.canonical.y), n = r.mult(1 << t.canonical.z); return n.x -= .5, n.y -= .5, n.distSqr(o) - n.distSqr(s) })); }(r, this.painter); const s = this.proxyToSource || {}; this.proxyToSource = {}, r.forEach((e => { this.proxyToSource[e.key] = {}; })), this.terrainTileForTile = {}; const n = this._style._mergedSourceCaches; for (const e in n) { const i = n[e]; if (!i.used) continue; if (i !== this.sourceCache && this.resetTileLookupCache(i.id), this._setupProxiedCoordsForOrtho(i, t[e], s), i.usedForTerrain) continue; const o = t[e]; i.getSource().reparseOverscaled && this._assignTerrainTiles(o); } this.proxiedCoords[i.id] = r.map((e => new Fi(e, e.key, this.orthoMatrix))), this._assignTerrainTiles(r), this._prepareDEMTextures(), this._setupDrapedRenderBatches(), this._initFBOPool(), this._setupRenderCache(s), this.renderingToTexture = !1; const a = {}; this._visibleDemTiles = []; for (const e of this.proxyCoords) { const t = this.terrainTileForTile[e.key]; if (!t) continue; const i = t.tileID.key; i in a || (this._visibleDemTiles.push(t), a[i] = i); } } _assignTerrainTiles(e) { this._initializing || e.forEach((e => { if (this.terrainTileForTile[e.key]) return; const t = this._findTileCoveringTileID(e, this.sourceCache); t && (this.terrainTileForTile[e.key] = t); })); } _prepareDEMTextures() { const e = this.painter.context, t = e.gl; for (const i in this.terrainTileForTile) { const o = this.terrainTileForTile[i], r = o.dem; !r || o.demTexture && !o.needsDEMTextureUpload || (e.activeTexture.set(t.TEXTURE1), bi(this.painter, o, r)); } } _prepareDemTileUniforms(e, t, i, o) { if (!t || null == t.demTexture) return !1; const r = e.tileID.canonical, s = Math.pow(2, t.tileID.canonical.z - r.z), n = o || ""; return i[`u_dem_tl${n}`] = [r.x * s % 1, r.y * s % 1], i[`u_dem_scale${n}`] = s, !0 } get emptyDEMTexture() { return !this._emptyDEMTextureDirty && this._emptyDEMTexture ? this._emptyDEMTexture : this._updateEmptyDEMTexture() } get emptyDepthBufferTexture() { const t = this.painter.context, i = t.gl; if (!this._emptyDepthBufferTexture) { const o = new e.a5({ width: 1, height: 1 }, Uint8Array.of(255, 255, 255, 255)); this._emptyDepthBufferTexture = new e.a9(t, o, i.RGBA, { premultiply: !1 }); } return this._emptyDepthBufferTexture } _getLoadedAreaMinimum() { let e = 0; const t = this._visibleDemTiles.reduce(((t, i) => { if (!i.dem) return t; const o = i.dem.tree.minimums[0]; return o > 0 && e++, t + o }), 0); return e ? t / e : 0 } _updateEmptyDEMTexture() { const t = this.painter.context, i = t.gl; t.activeTexture.set(i.TEXTURE2); const o = this._getLoadedAreaMinimum(), [r, s] = (() => { const t = new e.bu({ width: 1, height: 1 }, new Float32Array([o])); return [i.R32F, t] })(); this._emptyDEMTextureDirty = !1; let n = this._emptyDEMTexture; return n ? n.update(s, { premultiply: !1 }) : n = this._emptyDEMTexture = new e.a9(t, s, r, { premultiply: !1 }), n } setupElevationDraw(t, i, o) { const r = this.painter.context, s = r.gl, n = { u_dem: 2, u_dem_prev: 4, u_dem_tl: [0, 0], u_dem_tl_prev: [0, 0], u_dem_scale: 0, u_dem_scale_prev: 0, u_dem_size: 0, u_dem_lerp: 1, u_depth: 3, u_depth_size_inv: [0, 0], u_exaggeration: 0 }; n.u_exaggeration = this.exaggeration(); let a = null, l = null, c = 1; if (o && o.morphing && this._useVertexMorphing) { const e = o.morphing.srcDemTile, i = o.morphing.dstDemTile; c = o.morphing.phase, e && i && (this._prepareDemTileUniforms(t, e, n, "_prev") && (l = e), this._prepareDemTileUniforms(t, i, n) && (a = i)); } const h = e => e && e.demTexture && this.painter.linearFloatFilteringSupported() ? s.LINEAR : s.NEAREST, _ = e => { n.u_dem_size = 1 === e.size[0] ? 1 : e.size[0] - 2; }; if (l && a) r.activeTexture.set(s.TEXTURE2), a.demTexture.bind(h(a), s.CLAMP_TO_EDGE), r.activeTexture.set(s.TEXTURE4), l.demTexture.bind(h(l), s.CLAMP_TO_EDGE), a.demTexture && _(a.demTexture), n.u_dem_lerp = c; else { a = this.terrainTileForTile[t.tileID.key], r.activeTexture.set(s.TEXTURE2); const e = this._prepareDemTileUniforms(t, a, n) ? a.demTexture : this.empty
vendor: 13,188 bytes, line 41
41DEMTexture; e.bind(h(a), s.CLAMP_TO_EDGE), _(e); } if (r.activeTexture.set(s.TEXTURE3), o && o.useDepthForOcclusion ? (this._depthTexture && this._depthTexture.bind(s.NEAREST, s.CLAMP_TO_EDGE), this._depthFBO && (n.u_depth_size_inv = [1 / this._depthFBO.width, 1 / this._depthFBO.height])) : (this.emptyDepthBufferTexture.bind(s.NEAREST, s.CLAMP_TO_EDGE), n.u_depth_size_inv = [1, 1]), o && o.useMeterToDem && a) { const t = (1 << a.tileID.canonical.z) * e.b(1, this.painter.transform.center.lat) * this.sourceCache.getSource().tileSize; n.u_meter_to_dem = t; } if (o && o.labelPlaneMatrixInv && (n.u_label_plane_matrix_inv = o.labelPlaneMatrixInv), i.setTerrainUniformValues(r, n), "globe" === this.painter.transform.projection.name) { const e = this.globeUniformValues(this.painter.transform, t.tileID.canonical, o && o.useDenormalizedUpVectorScale); i.setGlobeUniformValues(r, e); } } globeUniformValues(t, i, o) { const r = t.projection; return { u_tile_tl_up: r.upVector(i, 0, 0), u_tile_tr_up: r.upVector(i, e.J, 0), u_tile_br_up: r.upVector(i, e.J, e.J), u_tile_bl_up: r.upVector(i, 0, e.J), u_tile_up_scale: o ? e.bn(1) : r.upVectorScale(i, t.center.lat, t.worldSize).metersToTile } } renderToBackBuffer(t) { const i = this.painter, o = this.painter.context; 0 !== t.length && (o.bindFramebuffer.set(null), o.viewport.set([0, 0, i.width, i.height]), i.gpuTimingDeferredRenderStart(), this.renderingToTexture = !1, function (t, i, o, r, s) { if ("globe" === t.transform.projection.name) !function (t, i, o, r, s) { const n = t.context, a = n.gl; let l, c; const h = t.transform, _ = e.bb(t, n, h), d = (e, i) => { if (c === i) return; const o = [Li[i], "PROJECTION_GLOBE_VIEW"]; _ && o.push("CUSTOM_ANTIALIASING"); const r = t.isTileAffectedByFog(e); l = t.getOrCreateProgram("globeRaster", { defines: o, overrideFog: r }), c = i; }, u = t.colorModeForRenderPass(), p = new e.b4(a.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D); Mi.update(s); const m = e.bc(h), f = [e.E(h.center.lng), e.H(h.center.lat)], g = t.globeSharedBuffers, v = [h.width * e.a4.devicePixelRatio, h.height * e.a4.devicePixelRatio], x = Float32Array.from(h.globeMatrix), y = { useDenormalizedUpVectorScale: !0 }; { const h = t.transform, _ = Pi(h.zoom, i.exaggeration(), i.sourceCache._source.tileSize); c = -1; const b = a.TRIANGLES; for (const c of r) { const r = o.getTile(c), w = e.b6.disabled, T = i.prevTerrainTileForTile[c.key], E = i.terrainTileForTile[c.key]; Si(T, E) && Mi.newMorphing(c.key, T, E, s, 250), n.activeTexture.set(a.TEXTURE0), r.texture && r.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); const C = Mi.getMorphValuesForProxy(c.key), I = C ? 1 : 0; C && e.bd(y, { morphing: { srcDemTile: C.from, dstDemTile: C.to, phase: e.ba(C.phase) } }); const S = e.be(c.canonical), M = e.bf(S.getCenter().lat), L = e.bg(c.canonical, S, M, h.worldSize / h._pixelsPerMercatorPixel), P = e.bh(e.bi(c.canonical)), D = Ci(h.expandedFarZProjMatrix, x, m, P, e.ao(h.zoom), f, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, v, _, L); if (d(c, I), l && (i.setupElevationDraw(r, l, y), t.uploadCommonUniforms(n, l, c.toUnwrapped()), g)) { const [i, o, r] = g.getGridBuffers(M, 0 !== _); l.draw(t, b, p, w, u, e.b5.backCCW, D, "globe_raster", i, o, r); } } } if (g && (t.renderDefaultNorthPole || t.renderDefaultSouthPole)) { const s = ["GLOBE_POLES", "PROJECTION_GLOBE_VIEW"]; _ && s.push("CUSTOM_ANTIALIASING"), l = t.getOrCreateProgram("globeRaster", { defines: s }); for (const s of r) { const { x: r, y: c, z: _ } = s.canonical, d = 0 === c, m = c === (1 << _) - 1, [x, b, w, T] = g.getPoleBuffers(_, !1); if (T && (d || m)) { const c = o.getTile(s); n.activeTexture.set(a.TEXTURE0), c.texture && c.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); let g = e.bj(_, r, h); const E = e.bh(e.bi(s.canonical)), C = (i, o) => i.draw(t, a.TRIANGLES, p, e.b6.disabled, u, e.b5.disabled, Ci(h.expandedFarZProjMatrix, g, g, E, 0, f, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, v, 0), "globe_pole_raster", o, w, T); i.setupElevationDraw(c, l, y), t.uploadCommonUniforms(n, l, s.toUnwrapped()), d && t.renderDefaultNorthPole && C(l, x), m && t.renderDefaultSouthPole && (g = e.m.scale(e.m.create(), g, [1, -1, 1]), C(l, b)); } } } }(t, i, o, r, s); else { const n = t.context, a = n.gl; let l, c; const h = t.shadowRenderer, _ = Ii(t, t.longestCutoffRange), d = e => { if (c === e) return; const i = []; i.push(Li[e]), _.shouldRenderCutoff && i.push("RENDER_CUTOFF"), l = t.getOrCreateProgram("terrainRaster", { defines: i }), c = e; }, u = t.colorModeForRenderPass(), p = new e.b4(a.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D); Mi.update(s); const m = t.transform, f = Pi(m.zoom, i.exaggeration(), i.sourceCache._source.tileSize); let g = [0, 0, 0]; if (h) { const e = t.style.directionalLight, i = t.style.ambientLight; e && i && (g = wr(e, i)); } { c = -1; const v = a.TRIANGLES, [x, y] = [i.gridIndexBuffer, i.gridSegments]; for (const c of r) { const r = o.getTile(c), b = e.b6.disabled, w = i.prevTerrainTileForTile[c.key], T = i.terrainTileForTile[c.key]; Si(w, T) && Mi.newMorphing(c.key, w, T, s, 250), n.activeTexture.set(a.TEXTURE0), r.texture && r.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); const E = Mi.getMorphValuesForProxy(c.key), C = E ? 1 : 0; let I; E && (I = { morphing: { srcDemTile: E.from, dstDemTile: E.to, phase: e.ba(E.phase) } }); const S = Ei(c.projMatrix, Di(c.canonical, m.renderWorldCopies) ? f / 10 : f, g); if (d(C), !l) continue; i.setupElevationDraw(r, l, I); const M = c.toUnwrapped(); h && h.setupShadows(M, l), t.uploadCommonUniforms(n, l, M, null, _), l.draw(t, v, p, b, u, e.b5.backCCW, S, "terrain_raster", i.gridBuffer, x, y); } } } }(i, this, this.proxySourceCache, t, this._updateTimestamp), this.renderingToTexture = !0, i.gpuTimingDeferredRenderEnd(), t.splice(0, t.length)); } renderBatch(t) { if (0 === this._drapedRenderBatches.length) return t + 1; this.renderingToTexture = !0; const i = this.painter, o = this.painter.context, r = this.proxySourceCache, s = this.proxiedCoords[r.id], n = this._drapedRenderBatches.shift(), a = i.style.order, l = []; let c = 0; for (const h of s) { const s = r.getTileByID(h.proxyTileKey), _ = r.proxyCachedFBO[h.key] ? r.proxyCachedFBO[h.key][t] : void 0, d = void 0 !== _ ? r.renderCache[_] : this.pool[c++], u = void 0 !== _; if (s.texture = d.tex, u && !d.dirty) { l.push(s.tileID); continue } let p; o.bindFramebuffer.set(d.fb.framebuffer), this.renderedToTile = !1, d.dirty && (o.clear({ color: e.C.transparent, stencil: 0 }), d.dirty = !1); for (let e = n.start; e <= n.end; ++e) { const t = i.style._mergedLayers[a[e]]; if (t.isHidden(i.transform.zoom)) continue; const r = i.style.getLayerSourceCache(t), s = r ? this.proxyToSource[h.key][r.id] : [h]; if (!s) continue; const n = s; o.viewport.set([0, 0, d.fb.width, d.fb.height]), p !== (r ? r.id : null) && (this._setupStencil(d, s, t, r), p = r ? r.id : null), i.renderLayer(i, r, t, n); } if (0 === this._drapedRenderBatches.length) for (const e of this._pendingGroundEffectLayers) { const t = i.style._mergedLayers[a[e]]; if (t.isHidden(i.transform.zoom)) continue; const r = i.style.getLayerSourceCache(t), s = r ? this.proxyToSource[h.key][r.id] : [h]; if (!s) continue; const n = s; o.viewport.set([0, 0, d.fb.width, d.fb.height]), p !== (r ? r.id : null) && (this._setupStencil(d, s, t, r), p = r ? r.id : null), i.renderLayer(i, r, t, n); } this.renderedToTile ? (d.dirty = !0, l.push(s.tileID)) : u || --c, 5 === c && (c = 0, this.renderToBackBuffer(l)); } return this.renderToBackBuffer(l), this.renderingToTexture = !1, o.bindFramebuffer.set(null), o.viewport.set([0, 0, i.width, i.height]), n.end + 1 } postRender() { } isLayerOrderingCorrect(e) { const t = e.order.length; let i = -1, o = t; for (let r = 0; r < t; ++r)this._style.isLayerDraped(e._mergedLayers[e.order[r]]) ? i = Math.max(i, r) : o = Math.min(o, r); return o > i } getMinElevationBelowMSL() { let e = 0; return this._visibleDemTiles.filter((e => e.dem)).forEach((t => { e = Math.min(e, t.dem.tree.minimums[0]); })), 0 === e ? e : (e - 30) * this._exaggeration } raycast(e, t, i) { if (!this._visibleDemTiles) return null; const o = this._visibleDemTiles.filter((e => e.dem)).map((o => { const r = o.tileID, s = 1 << r.overscaledZ, { x: n, y: a } = r.canonical, l = n / s, c = (n + 1) / s, h = a / s, _ = (a + 1) / s; return { minx: l, miny: h, maxx: c, maxy: _, t: o.dem.tree.raycastRoot(l, h, c, _, e, t, i), tile: o } })); o.sort(((e, t) => (null !== e.t ? e.t : Number.MAX_VALUE) - (null !== t.t ? t.t : Number.MAX_VALUE))); for (const r of o) { if (null == r.t) return null; const o = r.tile.dem.tree.raycast(r.minx, r.miny, r.maxx, r.maxy, e, t, i); if (null != o) return o } return null } _createFBO() { const t = this.painter.context, i = t.gl, o = this.drapeBufferSize; t.activeTexture.set(i.TEXTURE0); const r = new e.a9(t, { width: o[0], height: o[1], data: null }, i.RGBA); r.bind(i.LINEAR, i.CLAMP_TO_EDGE); const s = t.createFramebuffer(o[0], o[1], !0, null); return s.colorAttachment.set(r.texture), s.depthAttachment = new oe(t, s.framebuffer), void 0 === this._sharedDepthStencil ? (this._sharedDepthStencil = t.createRenderbuffer(t.gl.DEPTH_STENCIL, o[0], o[1]), this._stencilRef = 0, s.depthAttachment.set(this._sharedDepthStencil), t.clear({ stencil: 0 })) : s.depthAttachment.set(this._sharedDepthStencil), t.extTextureFilterAnisotropic && i.texParameterf(i.TEXTURE_2D, t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, t.extTextureFilterAnisotropicMax), { fb: s, tex: r, dirty: !1 } } _initFBOPool() { for (; this.pool.length < Math.min(5, this.proxyCoords.length);)this.pool.push(this._createFBO()); } _shouldDisableRenderCache() { if (this._debugParams.disableRenderCache) return !0; if (this._style.hasLightTransitions()) return !0; for (const e in this._style._mergedSourceCaches) if (this._style._mergedSourceCaches[e].hasTransition()) return !0; return this._style.order.some((e => { const t = this._style._mergedLayers[e], i = t.isHidden(this.painter.transform.zoom); return "custom" === t.type ? !i && t.shouldRedrape() : !i && t.hasTransition() })) } _clearLineLayersFromRenderCache() { let t = !1; for (const e of this._style.getSources()) if (e instanceof it) { t = !0; break } if (!t) return; const i = {}; for (let t = 0; t < this._style.order.length; ++t) { const o = this._style._mergedLayers[this._style.order[t]], r = this._style.getLayerSourceCache(o); if (r && !i[r.id] && !o.isHidden(this.painter.transform.zoom) && "line" === o.type && o.widthExpression() instanceof e.am) { i[r.id] = !0; for (const e of this.proxyCoords) { const t = this.proxyToSource[e.key][r.id]; if (t) for (const e of t) this._clearRenderCacheForTile(r.id, e); } } } } _clearRasterLayersFromRenderCache() { let e = !1; for (const t in this._style._mergedSourceCaches) if (this._style._mergedSourceCaches[t]._source instanceof ot) { e = !0; break } if (!e) return; const t = {}; for (let e = 0; e < this._style.order.length; ++e) { const i = this._style._mergedLayers[this._style.order[e]], o = this._style.getLayerSourceCache(i); if (!o || t[o.id]) continue; if (i.isHidden(this.painter.transform.zoom) || "raster" !== i.type) continue; const r = i.paint.get("raster-fade-duration"); for (const e of this.proxyCoords) { const t = this.proxyToSource[e.key][o.id]; if (t) for (const e of t) { const t = Ri(o.getTile(e), o.findLoadedParent(e, 0), o, this.painter.transform, r); (1 !== t.opacity || 0 !== t.mix) && this._clearRenderCacheForTile(o.id, e); } } } } _setupDrapedRenderBatches() { const t = this._style.order, i = t.length; if (0 === i) return; const o = []; this._pendingGroundEffectLayers = []; let r, s = 0, n = this._style._mergedLayers[t[s]]; for (; !this._style.isLayerDraped(n) && n.isHidden(this.painter.transform.zoom) && ++s < i;)n = this._style._mergedLayers[t[s]]; for (; s < i; ++s) { const e = this._style._mergedLayers[t[s]]; e.isHidden(this.painter.transform.zoom) || (this._style.isLayerDraped(e) ? void 0 === r && (r = s) : ("fill-extrusion" === e.type && this._pendingGroundEffectLayers.push(s), void 0 !== r && (o.push({ start: r, end: s - 1 }), r = void 0))); } if (void 0 !== r && o.push({ start: r, end: s - 1 }), 0 !== o.length) { const t = o[o.length - 1]; this._pendingGroundEffectLayers.every((e => e > t.end)) || e.X("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers."); } this._drapedRenderBatches = o; } _setupRenderCache(e) { const t = this.proxySourceCache; if (this._shouldDisableRenderCache() || this.invalidateRenderCache) { if (this.invalidateRenderCache = !1, t.renderCache.length > t.renderCachePool.length) { const e = Object.values(t.proxyCachedFBO); t.proxyCachedFBO = {}; for (let i = 0; i < e.length; ++i) { const o = Object.values(e[i]); t.renderCachePool.push(...o); } } return } this._clearRasterLayersFromRenderCache(); const i = this.proxyCoords, o = this._tilesDirty; for (let r = i.length - 1; r >= 0; r--) { const s = i[r]; if (t.getTileByID(s.key), void 0 !== t.proxyCachedFBO[s.key]) { const i = e[s.
vendor: 5,618 bytes, line 41
41key], r = this.proxyToSource[s.key]; let n = 0; for (const e in r) { const t = r[e], s = i[e]; if (!s || s.length !== t.length || t.some(((t, i) => t !== s[i] || o[e] && o[e].hasOwnProperty(t.key)))) { n = -1; break } ++n; } for (const e in t.proxyCachedFBO[s.key]) t.renderCache[t.proxyCachedFBO[s.key][e]].dirty = n < 0 || n !== Object.values(i).length; } } const r = [...this._drapedRenderBatches]; r.sort(((e, t) => t.end - t.start - (e.end - e.start))); for (const e of r) for (const o of i) { if (t.proxyCachedFBO[o.key]) continue; let i = t.renderCachePool.pop(); void 0 === i && t.renderCache.length < 50 && (i = t.renderCache.length, t.renderCache.push(this._createFBO())), void 0 !== i && (t.proxyCachedFBO[o.key] = {}, t.proxyCachedFBO[o.key][e.start] = i, t.renderCache[i].dirty = !0); } this._tilesDirty = {}; } _setupStencil(e, t, i, o) { if (!o || !this._sourceTilesOverlap[o.id]) return void (this._overlapStencilType && (this._overlapStencilType = !1)); const r = this.painter.context, s = r.gl; if (t.length <= 1) return void (this._overlapStencilType = !1); let n; if (i.isTileClipped()) n = t.length, this._overlapStencilMode.test = { func: s.EQUAL, mask: 255 }, this._overlapStencilType = "Clip"; else { if (!(t[0].overscaledZ > t[t.length - 1].overscaledZ)) return void (this._overlapStencilType = !1); n = 1, this._overlapStencilMode.test = { func: s.GREATER, mask: 255 }, this._overlapStencilType = "Mask"; } this._stencilRef + n > 255 && (r.clear({ stencil: 0 }), this._stencilRef = 0), this._stencilRef += n, this._overlapStencilMode.ref = this._stencilRef, i.isTileClipped() && this._renderTileClippingMasks(t, this._overlapStencilMode.ref); } clipOrMaskOverlapStencilType() { return "Clip" === this._overlapStencilType || "Mask" === this._overlapStencilType } stencilModeForRTTOverlap(t) { return this.renderingToTexture && this._overlapStencilType ? ("Clip" === this._overlapStencilType && (this._overlapStencilMode.ref = this.painter._tileClippingMaskIDs[t.key]), this._overlapStencilMode) : e.b6.disabled } _renderTileClippingMasks(t, i) { const o = this.painter, r = this.painter.context, s = r.gl; o._tileClippingMaskIDs = {}, r.setColorMode(e.a.disabled), r.setDepthMode(e.b4.disabled); const n = o.getOrCreateProgram("clippingMask"); for (const r of t) { const t = o._tileClippingMaskIDs[r.key] = --i; n.draw(o, s.TRIANGLES, e.b4.disabled, new e.b6({ func: s.ALWAYS, mask: 0 }, t, 255, s.KEEP, s.KEEP, s.REPLACE), e.a.disabled, e.b5.disabled, Ai(r.projMatrix), "$clipping", o.tileExtentBuffer, o.quadTriangleIndexBuffer, o.tileExtentSegments); } } pointCoordinate(t) { const i = this.painter.transform; if (t.x < 0 || t.x > i.width || t.y < 0 || t.y > i.height) return null; const o = [t.x, t.y, 1, 1]; e.e.transformMat4(o, o, i.pixelMatrixInverse), e.e.scale(o, o, 1 / o[3]), o[0] /= i.worldSize, o[1] /= i.worldSize; const r = i._camera.position, s = e.b(1, i.center.lat), n = [r[0], r[1], r[2] / s, 0], a = e.v.subtract([], o.slice(0, 3), n); e.v.normalize(a, a); const l = this.raycast(n, a, this._exaggeration); return null !== l && l ? (e.v.scaleAndAdd(n, n, a, l), n[3] = n[2], n[2] *= s, n) : null } drawDepth() { const t = this.painter, i = t.context, o = this.proxySourceCache, r = Math.ceil(t.width), s = Math.ceil(t.height); if (!this._depthFBO || this._depthFBO.width === r && this._depthFBO.height === s || (this._depthFBO.destroy(), this._depthFBO = void 0, this._depthTexture = void 0), !this._depthFBO) { const t = i.gl, o = i.createFramebuffer(r, s, !0, "renderbuffer"); i.activeTexture.set(t.TEXTURE0); const n = new e.a9(i, { width: r, height: s, data: null }, t.RGBA); n.bind(t.NEAREST, t.CLAMP_TO_EDGE), o.colorAttachment.set(n.texture); const a = i.createRenderbuffer(i.gl.DEPTH_COMPONENT16, r, s); o.depthAttachment.set(a), this._depthFBO = o, this._depthTexture = n; } i.bindFramebuffer.set(this._depthFBO.framebuffer), i.viewport.set([0, 0, r, s]), function (t, i, o, r) { if ("globe" === t.transform.projection.name) return; const s = t.context, n = s.gl; s.clear({ depth: 1 }); const a = t.getOrCreateProgram("terrainDepth"), l = new e.b4(n.LESS, e.b4.ReadWrite, t.depthRangeFor3D); for (const s of r) { const r = o.getTile(s), c = Ei(s.projMatrix, 0, [0, 0, 0]); i.setupElevationDraw(r, a), a.draw(t, n.TRIANGLES, l, e.b6.disabled, e.a.unblended, e.b5.backCCW, c, "terrain_depth", i.gridBuffer, i.gridIndexBuffer, i.gridNoSkirtSegments); } }(t, this, o, this.proxyCoords); } _setupProxiedCoordsForOrtho(t, i, o) { if (t.getSource() instanceof e.aK) return this._setupProxiedCoordsForImageSource(t, i, o); this._findCoveringTileCache[t.id] = this._findCoveringTileCache[t.id] || {}; const r = this.proxiedCoords[t.id] = [], s = this.proxyCoords; for (let e = 0; e < s.length; e++) { const i = s[e], n = this._findTileCoveringTileID(i, t); if (n) { const e = this._createProxiedId(i, n, o[i.key] && o[i.key][t.id]); r.push(e), this.proxyToSource[i.key][t.id] = [e]; } } let n = !1; const a = new Set; for (let e = 0; e < i.length; e++) { const s = t.getTile(i[e]); if (!s || !s.hasData()) continue; const l = this._findTileCoveringTileID(s.tileID, this.proxySourceCache); if (l && l.tileID.canonical.z !== s.tileID.canonical.z) { const e = this.proxyToSource[l.tileID.key][t.id], i = this._createProxiedId(l.tileID, s, o[l.tileID.key] && o[l.tileID.key][t.id]); e ? e.splice(e.length - 1, 0, i) : this.proxyToSource[l.tileID.key][t.id] = [i]; const c = this.proxyToSource[l.tileID.key][t.id]; a.has(c) || a.add(c), r.push(i), n = !0; } } if (this._sourceTilesOverlap[t.id] = n, n && this._debugParams.sortTilesHiZFirst) for (const e of a) e.sort(((e, t) =>
41 t.overscaledZ - e.overscaledZ)); } _setupProxiedCoordsForImageSource(t, i, o) { if (!t.getSource().loaded()) return; const r = this.proxiedCoords[t.id] = [], s = this.proxyCoords, n = t.getSource(), a = n.tileID; if (!a) return; const l = new e.P(a.x, a.y)._div(1 << a.z), c = n.coordinates.map(e.M.fromLngLat).reduce(((e, t) => (e.min.x = Math.min(e.min.x, t.x - l.x), e.min.y = Math.min(e.min.y, t.y - l.y), e.max.x = Math.max(e.max.x, t.x - l.x), e.max.y = Math.max(e.max.y, t.y - l.y), e)), { min: new e.P(Number.MAX_VALUE, Number.MAX_VALUE), max: new e.P(-Number.MAX_VALUE, -Number.MAX_VALUE) }), h = (t, i) => { const o = t.wrap + t.canonical.x / (1 << t.canonical.z), r = t.canonical.y / (1 << t.canonical.z), s = e.J / (1 << t.canonical.z), n = i.wrap + i.canonical.x / (1 << i.canonical.z), a = i.canonical.y / (1 << i.canonical.z); return o + s < n + c.min.x || o > n + c.max.x || r + s < a + c.min.y || r > a + c.max.y }; for (let e = 0; e < s.length; e++) { const n = s[e]; for (let e = 0; e < i.length; e++) { const s = t.getTile(i[e]); if (!s || !s.hasData()) continue; if (h(n, s.tileID)) continue; const a = this._createProxiedId(n, s, o[n.key] && o[n.key][t.id]), l = this.proxyToSource[n.key][t.id]; l ? l.push(a) : this.proxyToSource[n.key][t.id] = [a], r.push(a); } } } _createProxiedId(t, i, o) { let r = this.orthoMatrix; if (o) { const e = o.find((e => e.key === i.tileID.key)); if (e) return e } if (i.tileID.key !== t.key) { const o = t.canonical.z - i.tileID.canonical.z; let s, n, a; r = e.m.create(); const l = i.tileID.wrap - t.wrap << t.overscaledZ; o > 0 ? (s = e.J >> o, n = s * ((i.tileID.canonical.x << o) - t.canonical.x + l), a = s * ((i.tileID.canonical.y << o) - t.canonical.y)) : (s = e.J << -o, n = e.J * (i.tileID.canonical.x - (t.canonical.x + l << -o)), a = e.J * (i.tileID.canonical.y - (t.canonical.y << -o))), e.m.ortho(r, 0, s, 0, s, 0, 1), e.m.translate(r, r, [n, a, 0]); } return new Fi(i.tileID, t.key, r) } _findTileCoveringTileID(t, i) { let o = i.getTile(t); if (o && o.hasData()) return o; const r = this._findCoveringTileCache[i.id], s = r[t.key]; if (o = s ? i.getTileByID(s) : null, o && o.hasData() || null === s) return o; let n = o ? o.tileID : t, a = n.overscaledZ; const l = i.getSource().minzoom, c = []; if (!s) { const r = i.getSource().maxzoom; if (t.canonical.z >= r) { const o = t.canonical.z - r; i.getSource().reparseOverscaled ? (a = Math.max(t.canonical.z + 2, i.transform.tileZoom), n = new e.O(a, t.wrap, r, t.canonical.x >> o, t.canonical.y >> o)) : 0 !== o && (a = r, n = new e.O(a, t.wrap, r, t.canonical.x >> o, t.canonical.y >> o)); } n.key !== t.key && (c.push(n.key), o = i.getTile(n)); } const h = e => { c.forEach((t => { r[t] = e; })), c.length = 0; }; for (a -= 1; a >= l && (!o || !o.hasData()); a--) { o && h(o.tileID.key); const e = n.calculateScaledKey(a); if (o = i.getTileByID(e), o && o.hasData()) break; const t = r[e]; if (null === t) break; void 0 === t ? c.push(e) : o = i.getTileByID(t); } return h(o ? o.tileID.key : null), o && o.hasData() ? o : null } findDEMTileFor(e) { return this.enabled ? this._findTileCoveringTileID(e, this.sourceCache) : null } prepareDrawTile() { this.renderedToTile = !0; } _clearRenderCacheForTile(e, t) { let i = this._tilesDirty[e]; i || (i = this._tilesDirty[e] = {}), i[t.key] = !0; } } function ki(t, i, o) { const r = function (t, i, o) { const r = e.v.dot(i, t), s = e.v.dot(o, [.2126, .7152, .0722]), n = (e, t, i) => (1 - i) * e + i * t, a = n(1 - .3 * Math.min(s, 1), 1, Math.min(r + 1, 1)); return n(.92, 1, Math.asin(e.c(i[2], -1, 1)) / Math.PI + .5) * a }(t, [0, 0, 1], i), s = [0, 0, 0]; e.v.scale(s, o.slice(0, 3), r); const n = [0, 0, 0]; e.v.scale(n, i.slice(0, 3), t[2]); const a = [0, 0, 0]; return e.v.add(a, s, n), e.bw(a) } const Ni = ["fill", "fillOutline", "fillPattern", "line", "linePattern", "background", "backgroundPattern", "hillshade", "raster"], Ui = ["stars", "fillExtrusion", "fillExtrusionGroundEffect", "model", "symbolSDF", "symbolIcon", "symbolTextAndIcon"]; class Gi { static cacheKey(e, t, i, o) { let r = `${t}${o ? o.cacheKey : ""}`; for (const t of i) e.usedDefines.includes(t) && (r += `/${t}`); return r } constructor(t, i, o, r, s, n) { const a = t.gl; this.program = a.createProgram(), this.configuration = r, this.name = i, this.fixedDefines = [...n]; const l = r ? r.getBinderAttributes() : [], c = (o.staticAttributes || []).concat(l); let h = r ? r.defines() : []; h = h.concat(n.map((e => `#define ${e}`))); const _ = "#version 300 es\n"; let d = _ + h.concat("precision mediump float;", pi, ui.fragmentSource).join("\n"); for (const e of o.fragmentIncludes) d += `\n${_i[e]}`; d += `\n${o.fragmentSource}`; let u = _ + h.concat("precision highp float;", pi, ui.vertexSource).join("\n"); for (const e of o.vertexIncludes) u += `\n${_i[e]}`; u += `\n${o.vertexSource}`;
41 const p = a.createShader(a.FRAGMENT_SHADER); if (a.isContextLost()) return void (this.failedToCreate = !0); a.shaderSource(p, d), a.compileShader(p), a.attachShader(this.program, p); const m = a.createShader(a.VERTEX_SHADER); if (a.isContextLost()) this.failedToCreate = !0; else { a.shaderSource(m, u), a.compileShader(m), a.attachShader(this.program, m), this.attributes = {}, this.numAttributes = c.length; for (let e = 0; e < this.numAttributes; e++)if (c[e]) { const t = c[e].startsWith("a_") ? c[e] : `a_${c[e]}`; a.bindAttribLocation(this.program, e, t), this.attributes[t] = e; } a.linkProgram(this.program), a.deleteShader(m), a.deleteShader(p), this.fixedUniforms = s(t), this.binderUniforms = r ? r.getUniforms(t) : [], n.includes("TERRAIN") && (this.terrainUniforms = (t => ({ u_dem: new e.a$(t), u_dem_prev: new e.a$(t), u_dem_tl: new e.b0(t), u_dem_scale: new e.b2(t), u_dem_tl_prev: new e.b0(t), u_dem_scale_prev: new e.b2(t), u_dem_size: new e.b2(t), u_dem_lerp: new e.b2(t), u_exaggeration: new e.b2(t), u_depth: new e.a$(t), u_depth_size_inv: new e.b0(t), u_meter_to_dem: new e.b2(t), u_label_plane_matrix_inv: new e.a_(t) }))(t)), n.includes("GLOBE") && (this.globeUniforms = (t => ({ u_tile_tl_up: new e.b7(t), u_tile_tr_up: new e.b7(t), u_tile_br_up: new e.b7(t), u_tile_bl_up: new e.b7(t), u_tile_up_scale: new e.b2(t) }))(t)), n.includes("FOG") && (this.fogUniforms = (t => ({ u_fog_matrix: new e.a_(t), u_fog_range: new e.b0(t), u_fog_color: new e.b9(t), u_fog_horizon_blend: new e.b2(t), u_fog_vertical_limit: new e.b0(t), u_fog_temporal_offset: new e.b2(t), u_frustum_tl: new e.b7(t), u_frustum_tr: new e.b7(t), u_frustum_br: new e.b7(t), u_frustum_bl: new e.b7(t), u_globe_pos: new e.b7(t), u_globe_radius: new e.b2(t), u_globe_transition: new e.b2(t), u_is_globe: new e.a$(t), u_viewport: new e.b0(t) }))(t)), n.includes("RENDER_CUTOFF") && (this.cutoffUniforms = (t => ({ u_cutoff_params: new e.b9(t) }))(t)), n.includes("LIGHTING_3D_MODE") && (this.lightsUniforms = (t => ({ u_lighting_ambient_color: new e.b7(t), u_lighting_directional_dir: new e.b7(t), u_lighting_directional_color: new e.b7(t), u_ground_radiance: new e.b7(t) }))(t)), n.includes("RENDER_SHADOWS") && (this.shadowUniforms = (t => ({ u_light_matrix_0: new e.a_(t), u_light_matrix_1: new e.a_(t), u_fade_range: new e.b0(t), u_shadow_normal_offset: new e.b7(t), u_shadow_intensity: new e.b2(t), u_shadow_texel_size: new e.b2(t), u_shadow_map_resolution: new e.b2(t), u_shadow_direction: new e.b7(t), u_shadow_bias: new e.b7(t), u_shadowmap_0: new e.a$(t), u_shadowmap_1: new e.a$(t) }))(t)); } } setTerrainUniformValues(e, t) { if (!this.terrainUniforms) return; const i = this.terrainUniforms; if (!this.failedToCreate) { e.program.set(this.program); for (const e in t) i[e] && i[e].set(this.program, e, t[e]); } } setGlobeUniformValues(e, t) { if (!this.globeUniforms) return; const i = this.globeUniforms; if (!this.failedToCreate) { e.program.set(this.program); for (const e in t) i[e] && i[e].set(this.program, e, t[e]); } } setFogUniformValues(e, t) { if (!this.fogUniforms) return; const i = this.fogUniforms; if (!this.failedToCreate) { e.program.set(this.program); for (const e in t) i[e].set(this.program, e, t[e]); } } setCutoffUniformValues(e, t) { if (!this.cutoffUniforms) return; const i = this.cutoffUniforms; if (!this.failedToCreate) { e.program.set(this.program); for (const e in t) i[e].set(this.program, e, t[e]); } } setLightsUniformValues(e, t) { if (!this.lightsUniforms) return; const i = this.lightsUniforms; if (!this.failedToCreate) { e.program.set(this.program); for (const e in t) i[e].set(this.program, e, t[e]); } } setShadowUniformValues(e, t) { if (this.failedToCreate || !this.shadowUniforms) return; const i = this.shadowUniforms; e.program.set(this.program); for (const e in t) i[e].set(this.program, e, t[e]); } _drawDebugWireframe(t, i, o, r, s, n, a, l, c, h) { const _ = t.options.wireframe; if (!1 === _.terrain && !1 === _.layers2D && !1 === _.layers3D) return; const d = t.context; if (!(() => !(!_.terrain || "terrainRaster" !== this.name && "globeRaster" !== this.name) || !(!_.layers2D || t._terrain && t._terrain.renderingToTexture || !Ni.includes(this.name)) || !(!_.layers3D || !Ui.includes(this.name)))()) return; const u = d.gl, p = t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter, s, d); if (!p) return; const m = [...this.fixedDefines];
41 m.push("DEBUG_WIREFRAME"); const f = t.getOrCreateProgram(this.name, { config: this.configuration, defines: m }); d.program.set(f.program); const g = (e, t, i) => { if (t[e] && i[e]) for (const o in t[e]) i[e][o] && i[e][o].set(i.program, o, t[e][o].current); }; c && c.setUniforms(f.program, d, f.binderUniforms, a, { zoom: l }), g("fixedUniforms", this, f), g("terrainUniforms", this, f), g("globeUniforms", this, f), g("fogUniforms", this, f), g("lightsUniforms", this, f), g("shadowUniforms", this, f), p.bind(), d.setColorMode(new e.a([u.ONE, u.ONE_MINUS_SRC_ALPHA, u.ZERO, u.ONE], e.C.transparent, [!0, !0, !0, !1])), d.setDepthMode(new e.b4(i.func === u.LESS ? u.LEQUAL : i.func, e.b4.ReadOnly, i.range)), d.setStencilMode(e.b6.disabled); const v = 3 * n.primitiveLength * 2, x = 3 * n.primitiveOffset * 2 * 2; h && h > 1 ? u.drawElementsInstanced(u.LINES, v, u.UNSIGNED_SHORT, x, h) : u.drawElements(u.LINES, v, u.UNSIGNED_SHORT, x), s.bind(), d.program.set(this.program), d.setDepthMode(i), d.setStencilMode(o), d.setColorMode(r); } draw(e, t, i, o, r, s, n, a, l, c, h, _, d, u, p, m) { const f = e.context, g = f.gl; if (this.failedToCreate) return; f.program.set(this.program), f.setDepthMode(i), f.setStencilMode(o), f.setColorMode(r), f.setCullFace(s); for (const e of Object.keys(this.fixedUniforms)) this.fixedUniforms[e].set(this.program, e, n[e]); u && u.setUniforms(this.program, f, this.binderUniforms, _, { zoom: d }); const v = { [g.LINES]: 2, [g.TRIANGLES]: 3, [g.LINE_STRIP]: 1 }[t], x = m && m > 0 ? 1 : void 0; for (const s of h.get()) { const n = s.vaos || (s.vaos = {}); (n[a] || (n[a] = new vi)).bind(f, this, l, u ? u.getPaintVertexBuffers() : [], c, s.vertexOffset, p || [], x), m && m > 1 ? g.drawElementsInstanced(t, s.primitiveLength * v, g.UNSIGNED_SHORT, s.primitiveOffset * v * 2, m) : g.drawElements(t, s.primitiveLength * v, g.UNSIGNED_SHORT, s.primitiveOffset * v * 2), t === g.TRIANGLES && this._drawDebugWireframe(e, i, o, r, c, s, _, d, u, m); } } } function ji(t, i) { const o = Math.pow(2, i.tileID.overscaledZ), r = i.tileSize * Math.pow(2, t.transform.tileZoom) / o, s = r * (i.tileID.canonical.x + i.tileID.wrap * o), n = r * i.tileID.canonical.y; return { u_image: 0, u_texsize: i.imageAtlasTexture ? i.imageAtlasTexture.size : [0, 0], u_tile_units_to_pixels: 1 / e.ay(i, 1, t.transform.tileZoom), u_pixel_coord_upper: [s >> 16, n >> 16], u_pixel_coord_lower: [65535 & s, 65535 & n] } } const Vi = e.m.create(), Zi = (t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f) => { const g = i.style.light, v = g.properties.get("position"), x = [v.x, v.y, v.z], y = e.bx.create(); "viewport" === g.properties.get("anchor") && (e.bx.fromRotation(y, -i.transform.angle), e.v.transformMat3(x, x, y)); const b = g.properties.get("color"), w = i.transform, T = { u_matrix: t, u_lightpos: x, u_lightintensity: g.properties.get("intensity"), u_lightcolor: [b.r, b.g, b.b], u_vertical_gradient: +o, u_opacity: r, u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_inv_rot_matrix: Vi, u_merc_center: [0, 0], u_up_dir: [0, 0, 0], u_height_lift: 0, u_ao: s, u_edge_radius: n, u_flood_light_color: d, u_vertical_scale: u, u_flood_light_intensity: p, u_ground_shadow_factor: m, u_emissive_strength: f }; return "globe" === w.projection.name && (T.u_tile_id = [a.canonical.x, a.canonical.y, 1 << a.canonical.z], T.u_zoom_transition = c, T.u_inv_rot_matrix = _, T.u_merc_center = h, T.u_up_dir = w.projection.upVector(new e.t(0, 0, 0), h[0] * e.J, h[1] * e.J), T.u_height_lift = l), T }, Wi = (e, t, i) => ({ u_matrix: e, u_edge_radius: t, u_vertical_scale: i }), Hi = (t, i, o, r, s, n, a, l, c, h, _, d, u, p) => { const m = Zi(t, i, o, r, s, n, a, c, h, _, d, u, p, 1, [0, 0, 0], 0), f = { u_height_factor: -Math.pow(2, a.overscaledZ) / l.tileSize / 8 }; return e.ak(m, ji(i, l), f) }, qi = (e, t) => ({ u_matrix: e, u_emissive_strength: t }), $i = (t, i, o, r) => e.ak(qi(t, i), ji(o, r)), Xi = (e, t, i) => ({ u_matrix: e, u_world: i, u_emissive_strength: t }), Ji = (t, i, o, r, s) => e.ak($i(t, i, o, r), { u_world: s }), Yi = (t, i, o, r) => { const s = e.J / o.tileSize;
41 return { u_matrix: t, u_camera_to_center_distance: i.getCameraToCenterDistance(r), u_extrude_scale: [i.pixelsToGLUnits[0] / s, i.pixelsToGLUnits[1] / s] } }, Ki = (e, t, i = 1) => ({ u_matrix: e, u_color: t, u_overlay: 0, u_overlay_scale: i }), Qi = e.m.create(), eo = (t, i, o, r, s, n, a) => { const l = t.transform, c = "globe" === l.projection.name, h = c ? e.by(l.zoom, i.canonical) * l._pixelsPerMercatorPixel : e.ay(o, 1, n), _ = { u_matrix: i.projMatrix, u_extrude_scale: h, u_intensity: a, u_inv_rot_matrix: Qi, u_merc_center: [0, 0], u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_up_dir: [0, 0, 0] }; if (c) { _.u_inv_rot_matrix = r, _.u_merc_center = s, _.u_tile_id = [i.canonical.x, i.canonical.y, 1 << i.canonical.z], _.u_zoom_transition = e.ao(l.zoom); const t = s[0] * e.J, o = s[1] * e.J; _.u_up_dir = l.projection.upVector(new e.t(0, 0, 0), t, o); } return _ }, to = (e, t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g, v, x, y) => { return { u_matrix: e, u_normalize_matrix: t, u_globe_matrix: i, u_merc_matrix: o, u_grid_matrix: r, u_tl_parent: s, u_scale_parent: c, u_fade_t: h.mix, u_opacity: h.opacity * _.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: _.paint.get("raster-brightness-min"), u_brightness_high: _.paint.get("raster-brightness-max"), u_saturation_factor: (w = _.paint.get("raster-saturation"), w > 0 ? 1 - 1 / (1.001 - w) : -w), u_contrast_factor: (b = _.paint.get("raster-contrast"), b > 0 ? 1 / (1 - b) : 1 + b), u_spin_weights: io(_.paint.get("raster-hue-rotate")), u_perspective_transform: d, u_raster_elevation: u, u_zoom_transition: n, u_merc_center: a, u_cutoff_params: l, u_colorization_mix: oo(m, g), u_colorization_offset: ro(f, g), u_color_ramp: p, u_texture_offset: [x / (v + 2 * x), v / (v + 2 * x)], u_texture_res: [v + 2 * x, v + 2 * x], u_emissive_strength: y }; var b, w; }; function io(e) { e *= Math.PI / 180; const t = Math.sin(e), i = Math.cos(e); return [(2 * i + 1) / 3, (-Math.sqrt(3) * t - i + 1) / 3, (Math.sqrt(3) * t - i + 1) / 3] } function oo([t, i, o, r], [s, n]) { if (s === n) return [0, 0, 0, 0]; const a = (e.bz + 3) / (e.bz + 1) / (n - s); return [t * a, i * a, o * a, r * a] } function ro(t, [i, o]) { return i === o ? 0 : ((t - i) / (o - i) * (e.bz + 3) - 1) / (e.bz + 1) } const so = e.m.create(), no = (t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g, v) => { const x = s.transform, y = { u_is_size_zoom_constant: +("constant" === t || "source" === t), u_is_size_feature_constant: +("constant" === t || "camera" === t), u_size_t: i ? i.uSizeT : 0, u_size: i ? i.uSize : 0, u_camera_to_center_distance: x.getCameraToCenterDistance(f), u_rotate_symbol: +o, u_aspect_ratio: x.width / x.height, u_fade_change: s.options.fadeDuration ? s.symbolFadeChange : 1, u_matrix: n, u_label_plane_matrix: a, u_coord_matrix: l, u_is_text: +c, u_pitch_with_map: +r, u_texsize: h, u_texture: 0, u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_inv_rot_matrix: so, u_merc_center: [0, 0], u_camera_forward: [0, 0, 0], u_ecef_origin: [0, 0, 0], u_tile_matrix: so, u_up_vector: [0, -1, 0], u_icon_transition: v || 0, u_icon_saturation: g }; return "globe" === f.name && (y.u_tile_id = [_.canonical.x, _.canonical.y, 1 << _.canonical.z], y.u_zoom_transition = d, y.u_inv_rot_matrix = p, y.u_merc_center = u, y.u_camera_forward = x._camera.forward(), y.u_ecef_origin = e.bA(x.globeMatrix, _.toUnwrapped()), y.u_tile_matrix = Float32Array.from(x.globeMatrix), y.u_up_vector = m), y }, ao = (t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g) => e.ak(no(t, i, o, r, s, n, a, l, c, h, d, u, p, m, f, g, 1), { u_gamma_scale: r ? s.transform.getCameraToCenterDistance(g) * Math.cos(s.terrain ? 0 : s.transform._pitch) : 1, u_device_pixel_ratio: e.a4.devicePixelRatio, u_is_halo: +_, undefined: void 0 }), lo = (t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f) => e.ak(ao(t, i, o, r, s, n, a, l, !0, c, !0, _, d, u, p, m, f), { u_texsize_icon: h, u_texture_icon: 1 }), co = (e, t, i, o) => ({ u_matrix: e, u_emissive_strength: t, u_opacity: i, u_color: o }), ho = (t, i, o, r, s, n, a) => e.ak(function (t, i, o, r) { const s = o.imageManager.getPattern(t.toString(), i), { width: n, height: a } = o.imageManager.getPixelSize(i), l = Math.pow(2, r.tileID.overscaledZ
41), c = r.tileSize * Math.pow(2, o.transform.tileZoom) / l, h = c * (r.tileID.canonical.x + r.tileID.wrap * l), _ = c * r.tileID.canonical.y; return { u_image: 0, u_pattern_tl: s.tl, u_pattern_br: s.br, u_texsize: [n, a], u_pattern_size: s.displaySize, u_tile_units_to_pixels: 1 / e.ay(r, 1, o.transform.tileZoom), u_pixel_coord_upper: [h >> 16, _ >> 16], u_pixel_coord_lower: [65535 & h, 65535 & _] } }(s, n, r, a), { u_matrix: t, u_emissive_strength: i, u_opacity: o }), _o = { BaseColor: 5, MetallicRoughness: 6, Normal: 7, Occlusion: 8, Emission: 9, ShadowMap0: 10 }, uo = (t, i, o, r, s, n, a, l, c, h, _, d, u = [0, 0, 0]) => { const p = r.style.light, m = p.properties.get("position"), f = [-m.x, -m.y, m.z], g = e.bx.create(); "viewport" === p.properties.get("anchor") && (e.bx.fromRotation(g, -r.transform.angle), e.v.transformMat3(f, f, g)); const v = "MASK" === h.alphaMode, x = p.properties.get("color"), y = d.paint.get("model-ambient-occlusion-intensity"), b = d.paint.get("model-color").constantOr(e.C.white), w = d.paint.get("model-color-mix-intensity").constantOr(0); return { u_matrix: t, u_lighting_matrix: i, u_normal_matrix: o, u_lightpos: f, u_lightintensity: p.properties.get("intensity"), u_lightcolor: [x.r, x.g, x.b], u_camera_pos: u, u_opacity: s, u_baseTextureIsAlpha: 0, u_alphaMask: +v, u_alphaCutoff: h.alphaCutoff, u_baseColorFactor: [n.r, n.g, n.b, n.a], u_emissiveFactor: [a[0], a[1], a[2], 1], u_metallicFactor: l, u_roughnessFactor: c, u_baseColorTexture: _o.BaseColor, u_metallicRoughnessTexture: _o.MetallicRoughness, u_normalTexture: _o.Normal, u_occlusionTexture: _o.Occlusion, u_emissionTexture: _o.Emission, u_color_mix: [b.r, b.g, b.b, w], u_aoIntensity: y, u_emissive_strength: _ } }, po = new Float32Array(16), mo = (e, t = po, i = po) => ({ u_matrix: e, u_instance: t, u_node_matrix: i }), fo = { fillExtrusion: t => ({ u_matrix: new e.a_(t), u_lightpos: new e.b7(t), u_lightintensity: new e.b2(t), u_lightcolor: new e.b7(t), u_vertical_gradient: new e.b2(t), u_opacity: new e.b2(t), u_edge_radius: new e.b2(t), u_ao: new e.b0(t), u_tile_id: new e.b7(t), u_zoom_transition: new e.b2(t), u_inv_rot_matrix: new e.a_(t), u_merc_center: new e.b0(t), u_up_dir: new e.b7(t), u_height_lift: new e.b2(t), u_flood_light_color: new e.b7(t), u_vertical_scale: new e.b2(t), u_flood_light_intensity: new e.b2(t), u_ground_shadow_factor: new e.b7(t), u_emissive_strength: new e.b2(t) }), fillExtrusionDepth: t => ({ u_matrix: new e.a_(t), u_edge_radius: new e.b2(t), u_vertical_scale: new e.b2(t) }), fillExtrusionPattern: t => ({ u_matrix: new e.a_(t), u_lightpos: new e.b7(t), u_lightintensity: new e.b2(t), u_lightcolor: new e.b7(t), u_vertical_gradient: new e.b2(t), u_height_factor: new e.b2(t), u_edge_radius: new e.b2(t), u_ao: new e.b0(t), u_tile_id: new e.b7(t), u_zoom_transition: new e.b2(t), u_inv_rot_matrix: new e.a_(t), u_merc_center: new e.b0(t), u_up_dir: new e.b7(t), u_height_lift: new e.b2(t), u_image: new e.a$(t), u_texsize: new e.b0(t), u_pixel_coord_upper: new e.b0(t), u_pixel_coord_lower: new e.b0(t), u_tile_units_to_pixels: new e.b2(t), u_opacity: new e.b2(t) }), fillExtrusionGroundEffect: t => ({ u_matrix: new e.a_(t), u_opacity: new e.b2(t), u_ao_pass: new e.b2(t), u_meter_to_tile: new e.b2(t), u_ao: new e.b0(t), u_flood_light_intensity: new e.b2(t), u_flood_light_color: new e.b7(t), u_attenuation: new e.b2(t), u_edge_radius: new e.b2(t), u_fb: new e.a$(t), u_fb_size: new e.b2(t) }), fill: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t) }), fillPattern: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t), u_image: new e.a$(t), u_texsize: new e.b0(t), u_pixel_coord_upper: new e.b0(t), u_pixel_coord_lower: new e.b0(t), u_tile_units_to_pixels: new e.b2(t) }), fillOutline: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t), u_world: new e.b0(t) }), fillOutlinePattern: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t), u_world: new e.b0(t), u_image: new e.a$(t), u_texsize: new e.b0(t), u_pixel_coord_upper: new e.b0(t), u_pixel_coord_lower: new e.b0(t), u_tile_units_to_pixels: new e.b2(t) }), circle: e.bB, collisionBox: t => ({ u_matrix: new e.a_(t), u_camera_to_center_distance: new e.b2(t), u_extrude_scale: new e.b0(t) }), collisionCircle: t => ({ u_matrix: new e.a_(t), u_inv_matrix: new e.a_(t), u_camera_to_center_distance: new e.b2(t), u_viewport_size: new e.b0(t) }), debug: t => ({ u_color: new e.b1(t), u_matrix: new e.a_(t), u_overlay: new e.a$(t), u_overlay_scale: new e.b2(t) }), clippingMask: t => ({ u_matrix: new e.a_(t) }), heatmap: t => ({ u_extrude_scale: new e.b2(t), u_intensity: new e.b2(t), u_matrix: new e.a_(t), u_inv_rot_matrix: new e.a_(t), u_merc_center: new e.b0(t), u_tile_id: new e.b7(t), u_zoom_transition: new e.b2(t), u_up_dir: new e.b7(t) }), heatmapTexture: t => ({ u_image: new e.a$(t), u_color_ramp: new e.a$(t), u_opacity: new e.b2(t) }), hillshade: t => ({ u_matrix: new e.a_(t), u_image: new e.a$(t), u_latrange: new e.b0(t), u_light: new e.b0(t), u_shadow: new e.b1(t), u_highlight: new e.b1(t), u_emissive_strength: new e.b2(t), u_accent: new e.b1(t) }), hillshadePrepare: t => ({ u_matrix: new e.a_(t), u_image: new e.a$(t), u_dimension: new e.b0(t), u_zoom: new e.b2(t) }), line: e.bC, linePattern: e.bD, raster: t => ({ u_matrix: new e.a_(t), u_normalize_matrix: new e.a_(t), u_globe_matrix: new e.a_(t), u_merc_matrix: new e.a_(t), u_grid_matrix: new e.b8(t), u_tl_parent: new e.b0(t), u_scale_parent: new e.b2(t), u_fade_t: new e.b2(t), u_opacity: new e.b2(t), u_image0: new e.a$(t), u_image1: new e.a$(t), u_brightness_low: new e.b2(t), u_brightness_high: new e.b2(t), u_saturation_factor: new e.b2(t), u_contrast_factor: new e.b2(t), u_spin_weights: new e.b7(t), u_perspective_transform: new e.b0(t), u_raster_elevation: new e.b2(t), u_zoom_transition: new e.b2(t), u_merc_center: new e.b0(t), u_cutoff_params: new e.b9(t), u_colorization_mix: new e.b9(t), u_colorization_offset: new e.b2(t), u_color_ramp: new e.a$(t), u_texture_offset: new e.b0(t), u_texture_res: new e.b0(t), u_emissive_strength: new e.b2(t) }), symbolIcon: t => ({ u_is_size_zoom_constant: new e.a$(t), u_is_size_feature_constant: new e.a$(t), u_size_t: new e.b2(t), u_size: new e.b2(t), u_camera_to_center_distance: new e.b2(t), u_rotate_symbol: new e.a$(t), u_aspect_ratio: new e.b2(t), u_fade_change: new e.b2(t), u_matrix: new e.a_(t), u_label_plane_matrix: new e.a_(t), u_coord_matrix: new e.a_(t), u_is_text: new e.a$(t), u_pitch_with_map: new e.a$(t), u_texsize: new e.b0(t), u_tile_id: new e.b7(t), u_zoom_transition: new e.b2(t), u_inv_rot_matrix: new e.a_(t), u_merc_center: new e.b0(t), u_camera_forward: new e.b7(t), u_tile_matrix: new e.a_(t), u_up_vector: new e.b7(t), u_ecef_origin: new e.b7(t), u_texture: new e.a$(t), u_icon_transition: new e.b2(t), u_icon_saturation: new e.b2(t) }), symbolSDF: t => ({ u_is_size_zoom_constant: new e.a$(t), u_is_size_feature_constant: new e.a$(t), u_size_t: new e.b2(t), u_size: new e.b2(t), u_camera_to_center_distance: new e.b2(t), u_rotate_symbol: new e.a$(t), u_aspect_ratio: new e.b2(t), u_fade_change: new e.b2(t), u_matrix: new e.a_(t), u_label_plane_matrix: new e.a_(t), u_coord_matrix: new e.a_(t), u_is_text: new e.a$(t), u_pitch_with_map: new e.a$(t), u_texsize: new e.b0(t), u_texture: new e.a$(t), u_gamma_scale: new e.b2(t), u_device_pixel_ratio: new e.b2(t), u_tile_id: new e.b7(t), u_zoom_transition: new e.b2(t), u_inv_rot_matrix: new e.a_(t), u_merc_center: new e.b0(t), u_camera_forward: new e.b7(t), u_tile_matrix: new e.a_(t), u_up_vector: new e.b7(t), u_ecef_origin: new e.b7(t), u_is_halo: new e.a$(t) }), symbolTextAndIcon: t => ({ u_is_size_zoom_constant: new e.a$(t), u_is_size_feature_constant: new e.a$(t), u_size_t: new e.b2(t), u_size: new e.b2(t), u_camera_to_center_distance: new e.b2(t), u_rotate_symbol: new e.a$(t), u_aspect_ratio: new e.b2(t), u_fade_change: new e.b2(t), u_matrix: new e.a_(t), u_label_plane_matrix: new e.a_(t), u_coord_matrix: new e.a_(t), u_is_text: new e.a$(t), u_pitch_with_map: new e.a$(t), u_texsize: new e.b0(t), u_texsize_icon: new e.b0(t), u_texture: new e.a$(t), u_texture_icon: new e.a$(t), u_gamma_scale: new e.b2(t), u_device_pixel_ratio: new e.b2(t), u_is_halo: new e.a$(t) }), background: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t), u_opacity: new e.b2(t), u_color: new e.b1(t) }), backgroundPattern: t => ({ u_matrix: new e.a_(t), u_emissive_strength: new e.b2(t), u_opacity: new e.b2(t), u_image: new e.a$(t), u_pattern_tl: new e.b0(t), u_pattern_br: new e.b0(t), u_texsize: new e.b0(t), u_pattern_size: new e.b0(t), u_pixel_coord_upper: new e.b0(t), u_pixel_coord_lower: new e.b0(t), u_tile_units_to_pixels: new e.b2(t) }), terrainRaster: Ti, terrainDepth: Ti, skybox: t => ({ u_matrix: new e.a_(t), u_sun_direction: new e.b7(t), u_cubemap: new e.a$(t), u_opacity: new e.b2(t), u_temporal_offset: new e.b2(t) }), skyboxGradient: t => ({ u_matrix: new e.a_(t), u_color_ramp: new e.a$(t), u_center_direction: new e.b7(t), u_radius: new e.b2(t), u_opacity: new e.b2(t), u_temporal_offset: new e.b2(t) }), skyboxCapture: t => ({ u_matrix_3f: new e.b8(t), u_sun_direction: new e.b7(t), u_sun_intensity: new e.b2(t), u_color_tint_r: new e.b9(t), u_color_tint_m: new e.b9(t), u_luminance: new e.b2(t) }), globeRaster: t => ({ u_proj_matrix: new e.a_(t), u_globe_matrix: new e.a_(t), u_normalize_matrix: new e.a_(t), u_merc_matrix: new e.a_(t), u_zoom_transition: new e.b2(t), u_merc_center: new e.b0(t), u_image0: new e.a$(t), u_grid_matrix: new e.b8(t), u_skirt_height: new e.b2(t), u_frustum_tl: new e.b7(t), u_frustum_tr: new e.b7(t), u_frustum_br: new e.b7(t), u_frustum_bl: new e.b7(t), u_globe_pos: new e.b7(t), u_globe_radius: new e.b2(t), u_viewport: new e.b0(t) }), globeAtmosphere: t => ({ u_frustum_tl: new e.b7(t), u_frustum_tr: new e.b7(t), u_frustum_br: new e.b7(t), u_frustum_bl: new e.b7(t), u_horizon: new e.b2(t), u_transition: new e.b2(t), u_fadeout_range: new e.b2(t), u_color: new e.b9(t), u_high_color: new e.b9(t), u_space_color: new e.b9(t), u_temporal_offset: new e.b2(t), u_horizon_angle: new e.b2(t) }), model: t => ({ u_matrix: new e.a_(t), u_lighting_matrix: new e.a_(t), u_normal_matrix: new e.a_(t), u_lightpos: new e.b7(t), u_lightintensity: new e.b2(t), u_lightcolor: new e.b7(t), u_camera_pos: new e.b7(t), u_opacity: new e.b2(t), u_baseColorFactor: new e.b9(t), u_emissiveFactor: new e.b9(t), u_metallicFactor: new e.b2(t), u_roughnessFactor: new e.b2(t), u_baseTextureIsAlpha: new e.a$(t), u_alph
41aMask: new e.a$(t), u_alphaCutoff: new e.b2(t), u_baseColorTexture: new e.a$(t), u_metallicRoughnessTexture: new e.a$(t), u_normalTexture: new e.a$(t), u_occlusionTexture: new e.a$(t), u_emissionTexture: new e.a$(t), u_color_mix: new e.b9(t), u_aoIntensity: new e.b2(t), u_emissive_strength: new e.b2(t) }), modelDepth: t => ({ u_matrix: new e.a_(t), u_instance: new e.a_(t), u_node_matrix: new e.a_(t) }), groundShadow: t => ({ u_matrix: new e.a_(t), u_ground_shadow_factor: new e.b7(t) }), stars: t => ({ u_matrix: new e.a_(t), u_up: new e.b7(t), u_right: new e.b7(t), u_intensity_multiplier: new e.b2(t) }) }; let go; function vo(t, i, o, r, s, n, a) { const l = t.context, c = l.gl, h = t.transform, _ = t.getOrCreateProgram("collisionBox"), d = []; let u = 0, p = 0; for (let l = 0; l < r.length; l++) { const m = r[l], f = i.getTile(m), g = f.getBucket(o); if (!g) continue; const v = It(m, g, h); let x = v; 0 === s[0] && 0 === s[1] || (x = t.translatePosMatrix(v, f, s, n)); const y = a ? g.textCollisionBox : g.iconCollisionBox, b = g.collisionCircleArray; if (b.length > 0) { const t = e.m.create(), i = x; e.m.mul(t, g.placementInvProjMatrix, h.glCoordMatrix), e.m.mul(t, t, g.placementViewportMatrix), d.push({ circleArray: b, circleOffset: p, transform: i, invTransform: t, projection: g.getProjection() }), u += b.length / 4, p = u; } y && (t.terrain && t.terrain.setupElevationDraw(f, _), _.draw(t, c.LINES, e.b4.disabled, e.b6.disabled, t.colorModeForRenderPass(), e.b5.disabled, Yi(x, h, f, g.getProjection()), o.id, y.layoutVertexBuffer, y.indexBuffer, y.segments, null, h.zoom, null, [y.collisionVertexBuffer, y.collisionVertexBufferExt])); } if (!a || !d.length) return; const m = t.getOrCreateProgram("collisionCircle"), f = new e.bE; f.resize(4 * u), f._trim(); let g = 0; for (const e of d) for (let t = 0; t < e.circleArray.length / 4; t++) { const i = 4 * t, o = e.circleArray[i + 0], r = e.circleArray[i + 1], s = e.circleArray[i + 2], n = e.circleArray[i + 3]; f.emplace(g++, o, r, s, n, 0), f.emplace(g++, o, r, s, n, 1), f.emplace(g++, o, r, s, n, 2), f.emplace(g++, o, r, s, n, 3); } (!go || go.length < 2 * u) && (go = function (t) { const i = 2 * t, o = new e.bp; o.resize(i), o._trim(); for (let e = 0; e < i; e++) { const t = 6 * e; o.uint16[t + 0] = 4 * e + 0, o.uint16[t + 1] = 4 * e + 1, o.uint16[t + 2] = 4 * e + 2, o.uint16[t + 3] = 4 * e + 2, o.uint16[t + 4] = 4 * e + 3, o.uint16[t + 5] = 4 * e + 0; } return o }(u)); const v = l.createIndexBuffer(go, !0), x = l.createVertexBuffer(f, e.bF.members, !0); for (const i of d) { const r = { u_matrix: i.transform, u_inv_matrix: i.invTransform, u_camera_to_center_distance: (y = h).getCameraToCenterDistance(i.projection), u_viewport_size: [y.width, y.height] }; m.draw(t, c.TRIANGLES, e.b4.disabled, e.b6.disabled, t.colorModeForRenderPass(), e.b5.disabled, r, o.id, x, v, e.bm.simpleSegment(0, 2 * i.circleOffset, i.circleArray.length, i.circleArray.length / 2), null, h.zoom); } var y; x.destroy(), v.destroy(); } const xo = e.m.create(); function yo({ width: t, height: i, anchor: o, textOffset: r, textScale: s }, n) { const { horizontalAlign: a, verticalAlign: l } = e.aY(o), c = -(a - .5) * t, h = -(l - .5) * i, _ = e.aW(o, r); return new e.P((c / s + _[0]) * n, (h / s + _[1]) * n) } function bo(t, i, o, r, s, n, a, l, c, h, _) { const d = t.text.placedSymbolArray, u = t.text.dynamicLayoutVertexArray, p = t.icon.dynamicLayoutVertexArray, m = {}, f = t.getProjection(), g = St(l, f, n), v = n.elevation, x = f.upVectorScale(l.canonical, n.center.lat, n.worldSize).metersToTile; u.clear(); for (let p = 0; p < d.length; p++) { const y = d.get(p), { tileAnchorX: b, tileAnchorY: w, numGlyphs: T } = y, E = y.hidden || !y.crossTileID || t.allowVerticalPlacement && !y.placedOrientation ? null : r[y.crossTileID]; if (E) { let r = 0, d = 0, p = 0; if (v) { const e = v ? v.getAtTileOffset(l, b, w) : 0, [t, i, o] = f.upVector(l.canonical, b, w); r = e * t * x, d = e * i * x, p = e * o * x; } let [C, I, S, M] = ge(y.projectedAnchorX + r, y.projectedAnchorY + d, y.projectedAnchorZ + p, o ? g : a); const L = ve(n.getCameraToCenterDistance(f), M);
41 let P = s.evaluateSizeForFeature(t.textSizeData, h, y) * L / e.aV; o && (P *= t.tilePixelRatio / c); const D = yo(E, P); o ? (({ x: C, y: I, z: S } = f.projectTilePoint(b + D.x, w + D.y, l.canonical)), [C, I, S] = ge(C + r, I + d, S + p, a)) : (i && D._rotate(-n.angle), C += D.x, I += D.y, S = 0); const A = t.allowVerticalPlacement && y.placedOrientation === e.W.vertical ? Math.PI / 2 : 0; for (let t = 0; t < T; t++)e.k(u, C, I, S, A); _ && y.associatedIconIndex >= 0 && (m[y.associatedIconIndex] = { x: C, y: I, z: S, angle: A }); } else Se(T, u); } if (_) { p.clear(); const i = t.icon.placedSymbolArray; for (let t = 0; t < i.length; t++) { const o = i.get(t), { numGlyphs: r } = o, s = m[t]; if (o.hidden || !s) Se(r, p); else { const { x: t, y: i, z: o, angle: n } = s; for (let s = 0; s < r; s++)e.k(p, t, i, o, n); } } t.icon.dynamicLayoutVertexBuffer.updateData(p); } t.text.dynamicLayoutVertexBuffer.updateData(u); } function wo(e, t, i) { return i.iconsInText && t ? "symbolTextAndIcon" : e ? "symbolSDF" : "symbolIcon" } function To(t, i, o, r, s, n, a, l, c, h, _, d, u) { const p = t.context, m = p.gl, f = t.transform, g = "map" === l, v = "map" === c, x = g && "point" !== o.layout.get("symbol-placement"), y = g && !v && !x, b = void 0 !== o.layout.get("symbol-sort-key").constantOr(1); let w = !1; const T = t.depthModeForSublayer(0, e.b4.ReadOnly), E = [e.E(f.center.lng), e.H(f.center.lat)], C = o.layout.get("text-variable-anchor"), I = "globe" === f.projection.name, S = [], M = [0, -1, 0]; let L = M; !I && !f.mercatorFromTransition || g || (L = function (t) { const i = t._camera.getWorldToCamera(t.worldSize, 1), o = e.m.multiply([], i, t.globeMatrix); e.m.invert(o, o); const r = [0, 0, 0], s = [0, 1, 0, 0]; return e.e.transformMat4(s, s, o), r[0] = s[0], r[1] = s[1], r[2] = s[2], e.v.normalize(r, r), r }(f)); for (const l of r) { const r = i.getTile(l), c = r.getBucket(o); if (!c) continue; if ("mercator" === c.projection.name && I) continue; const d = s ? c.text : c.icon; if (!d || c.fullyClipped || !d.segments.get().length) continue; const u = d.programConfigurations.get(o.id), p = s || c.sdfIcons, T = s ? c.textSizeData : c.iconSizeData, P = v || 0 !== f.pitch, D = e.i(T, f.zoom); let A, R, z, O, F = [0, 0], B = null; if (s) R = r.glyphAtlasTexture ? r.glyphAtlasTexture : null, z = m.LINEAR, A = r.glyphAtlasTexture ? r.glyphAtlasTexture.size : [0, 0], c.iconsInText && (F = r.imageAtlasTexture ? r.imageAtlasTexture.size : [0, 0], B = r.imageAtlasTexture ? r.imageAtlasTexture : null, O = P || t.options.rotating || t.options.zooming || "composite" === T.kind || "camera" === T.kind ? m.LINEAR : m.NEAREST); else { const e = 1 !== o.layout.get("icon-size").constantOr(0) || c.iconsNeedLinear; R = r.imageAtlasTexture ? r.imageAtlasTexture : null, z = p || t.options.rotating || t.options.zooming || e || P ? m.LINEAR : m.NEAREST, A = r.imageAtlasTexture ? r.imageAtlasTexture.size : [0, 0]; } const k = "globe" === c.projection.name, N = k ? L : M, U = k ? e.ao(f.zoom) : 0, G = St(l, c.getProjection(), f), j = f.calculatePixelsToTileUnitsMatrix(r), V = pe(G, r.tileID.canonical, v, g, f, c.getProjection(), j), Z = t.terrain && v && x ? e.m.invert(e.m.create(), V) : xo, W = fe(G, r.tileID.canonical, v, g, f, c.getProjection(), j), H = C && c.hasTextData(), q = c.hasIconTextFit() && H && c.hasIconData(); if (x) { const e = f.elevation, i = e ? e.getAtTileOffsetFunc(l, f.center.lat, f.worldSize, c.getProjection()) : null, o = me(G, r.tileID.canonical, v, g, f, c.getProjection(), j); ye(c, G, t, s, o, W, v, h, i, l); } const $ = x || s && C || q, X = t.translatePosMatrix(G, r, n, a), J = $ ? xo : V, Y = t.translatePosMatrix(W, r, n, a, !0), K = c.getProjection().createInversionMatrix(f, l.canonical), Q = o.paint.get("icon-image-cross-fade").constantOr(0), ee = []; t.terrainRenderModeElevated() && v && ee.push("PITCH_WITH_MAP_TERRAIN"), k && (ee.push("PROJECTION_GLOBE_VIEW"), $ && ee.push("PROJECTED_POS_ON_VIEWPORT")), Q > 0 && ee.push("ICON_TRANSITION"), d.zOffsetVertexBuffer && ee.push("Z_OFFSET"); const te = p && 0 !== o.paint.get(s ? "text-halo-width" : "icon-halo-width").constantOr(1); let ie; p ? ie = c.iconsInText ? lo(T.kind, D, y, v, t, X, J, Y, A, F, l, U, E, K, N, c.getProjection()) : ao(T.kind, D, y, v, t, X, J, Y, s, A, !0, l, U, E, K, N, c.getProjection()) : (_ < 1 && ee.push("SATURATION"), ie = no(T.kind, D, y, v, t, X, J, Y, s, A, l, U, E, K, N, c.getProjection(), _, Q)); const oe = { program: t.getOrCreateProgram(wo(p, s, c), { config: u, defines: ee }), buffers: d, uniformValues: ie, atlasTexture: R, atlasTextureIcon: B, atlasInterpolation: z, atlasInterpolationIcon: O, isSDF: p, hasHalo: te, tile: r, labelPlaneMatr
41ixInv: Z }; if (b && c.canOverlap) { w = !0; const t = d.segments.get(); for (const i of t) S.push({ segments: new e.bm([i]), sortKey: i.sortKey, state: oe }); } else S.push({ segments: d.segments, sortKey: 0, state: oe }); } w && S.sort(((e, t) => e.sortKey - t.sortKey)); for (const e of S) { const i = e.state; if (t.terrain && t.terrain.setupElevationDraw(i.tile, i.program, { useDepthForOcclusion: f.depthOcclusionForSymbolsAndCircles, labelPlaneMatrixInv: i.labelPlaneMatrixInv }), p.activeTexture.set(m.TEXTURE0), i.atlasTexture && i.atlasTexture.bind(i.atlasInterpolation, m.CLAMP_TO_EDGE, !0), i.atlasTextureIcon && (p.activeTexture.set(m.TEXTURE1), i.atlasTextureIcon && i.atlasTextureIcon.bind(i.atlasInterpolationIcon, m.CLAMP_TO_EDGE, !0)), t.uploadCommonLightUniforms(t.context, i.program), i.hasHalo) { const r = i.uniformValues; r.u_is_halo = 1, Eo(i.buffers, e.segments, o, t, i.program, T, d, u, r, 2), r.u_is_halo = 0; } else { if (i.isSDF) { const r = i.uniformValues; i.hasHalo && (r.u_is_halo = 1, Eo(i.buffers, e.segments, o, t, i.program, T, d, u, r, 1)), r.u_is_halo = 0; } Eo(i.buffers, e.segments, o, t, i.program, T, d, u, i.uniformValues, 1); } } } function Eo(t, i, o, r, s, n, a, l, c, h) { const _ = [t.dynamicLayoutVertexBuffer, t.opacityVertexBuffer, t.iconTransitioningVertexBuffer, t.globeExtVertexBuffer, t.zOffsetVertexBuffer]; s.draw(r, r.context.gl.TRIANGLES, n, a, l, e.b5.disabled, c, o.id, t.layoutVertexBuffer, t.indexBuffer, i, o.paint, r.transform.zoom, t.programConfigurations.get(o.id), _, h); } function Co(t, i, o, r, s, n, a) { const l = t.context.gl, c = o.paint.get("fill-pattern"), h = c && c.constantOr(1); let _, d, u, p, m; a ? (d = h && !o.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", _ = l.LINES) : (d = h ? "fillPattern" : "fill", _ = l.TRIANGLES); for (const f of r) { const r = i.getTile(f); if (h && !r.patternsLoaded()) continue; const g = r.getBucket(o); if (!g) continue; t.prepareDrawTile(); const v = g.programConfigurations.get(o.id), x = t.isTileAffectedByFog(f), y = t.getOrCreateProgram(d, { config: v, overrideFog: x }); h && (t.context.activeTexture.set(l.TEXTURE0), r.imageAtlasTexture && r.imageAtlasTexture.bind(l.LINEAR, l.CLAMP_TO_EDGE), v.updatePaintBuffers()); const b = c.constantOr(null); if (b && r.imageAtlas) { const e = r.imageAtlas.patternPositions[b.toString()]; e && v.setConstantPatternPositions(e); } const w = t.translatePosMatrix(f.projMatrix, r, o.paint.get("fill-translate"), o.paint.get("fill-translate-anchor")), T = o.paint.get("fill-emissive-strength"); if (a) { p = g.indexBuffer2, m = g.segments2; const e = t.terrain && t.terrain.renderingToTexture ? t.terrain.drapeBufferSize : [l.drawingBufferWidth, l.drawingBufferHeight]; u = "fillOutlinePattern" === d && h ? Ji(w, T, t, r, e) : Xi(w, T, e); } else p = g.indexBuffer, m = g.segments, u = h ? $i(w, T, t, r) : qi(w, T); t.uploadCommonUniforms(t.context, y, f.toUnwrapped()), y.draw(t, _, s, t.stencilModeForClipping(f), n, e.b5.disabled, u, o.id, g.layoutVertexBuffer, p, m, o.paint, t.transform.zoom, v, void 0); } } function Io(t, i, o, r, s, n, a, l) { o.resetLayerRenderingStats(); const c = t.context, h = c.gl, _ = t.transform, d = o.paint.get("fill-extrusion-pattern"), u = d.constantOr(1), p = o.paint.get("fill-extrusion-opacity"), m = t.style.enable3dLights(), f = o.paint.get(m && !u ? "fill-extrusion-ambient-occlusion-wall-radius" : "fill-extrusion-ambient-occlusion-radius"), g = [o.paint.get("fill-extrusion-ambient-occlusion-intensity"), f], v = o.layout.get("fill-extrusion-edge-radius"), x = v > 0 && !o.paint.get("fill-extrusion-rounded-roof"), y = x ? 0 : v, b = "globe" === _.projection.name ? e.bO() : 0, w = "globe" === _.projection.name, T = w ? e.ao(_.zoom) : 0, E = [e.E(_.center.lng), e.H(_.center.lat)], C = o.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0, 3), I = o.paint.get("fill-extrusion-flood-light-intensity"), S = o.paint.get("fill-extrusion-vertical-scale"), M = Ii(t, o.paint.get("fill-extrusion-cutoff-fade-range")), L = o.paint.get("fill-extrusion-emissive-strength"), P = []; let D; w && P.push("PROJECTION_GLOBE_VIEW"), g[0] > 0 && P.push("FAUX_AO"), x && P.push("ZERO_ROOF_RADIUS"), l && P.push("HAS_CENTROID"), I > 0 && P.push("FLOOD_LIGHT"), M.shouldRenderCutoff && P.push("RENDER_CUTOFF"); const A = "shadow" === t.renderPass, R = t.shadowRenderer, z = A && !!R; t.shadowRenderer && (t.shadowRenderer.useNormalOffset = !0); let O = [0, 0, 0]; if (R) { const e = t.style.directionalLight, i = t.style.ambientLight; e && i && (O = wr(e, i)), D = P.concat(["SHADOWS_SINGLE_CASCADE"]); } const F = z ? "fillExtrusionDepth" : u ? "fillExtrusionPattern" : "fillExtrusion", B = o.getLayerRenderingStats(); for (const m of r) { const r = i.getTile(m), f = r.getBucket(o); if (!f || f.projection.name !== _.projection.name) continue; let v = !1; R && (v = 0 === R.getMaxCascadeForTile(m.toUnwrapped())); const x = t.isTileAffectedByFog(m), z = f.programConfigurations.get(o.id), k = t.getOrCreateProgram(F, { config: z, defines: v ? D : P, overrideFog: x }); if (t.terrain && t.terrain.setupElevationDraw(r, k, { useMeterToDem: !0 }), !f.centroidVertexBuffer) { const e = k.attributes.a_centroid_pos; void 0 !== e && h.vertexAttrib2f(e, 0, 0); } !A && R && R.setupShadows(r.tileID.toUnwrapped(), k, "vector-tile", r.tileID.overscaledZ
vendor: 15,019 bytes, line 41
41), u && (t.context.activeTexture.set(h.TEXTURE0), r.imageAtlasTexture && r.imageAtlasTexture.bind(h.LINEAR, h.CLAMP_TO_EDGE), z.updatePaintBuffers()); const N = d.constantOr(null); if (N && r.imageAtlas) { const e = r.imageAtlas.patternPositions[N.toString()]; e && z.setConstantPatternPositions(e); } const U = o.paint.get("fill-extrusion-vertical-gradient"); let G; if (A && R) { if (Ao(r.tileID, f, t)) continue; const e = R.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped()); G = Wi(e, y, S); } else { const e = t.translatePosMatrix(m.expandedProjMatrix, r, o.paint.get("fill-extrusion-translate"), o.paint.get("fill-extrusion-translate-anchor")), i = _.projection.createInversionMatrix(_, m.canonical); G = u ? Hi(e, t, U, p, g, y, m, r, b, T, E, i, C, S) : Zi(e, t, U, p, g, y, m, b, T, E, i, C, S, I, O, L); } t.uploadCommonUniforms(c, k, m.toUnwrapped(), null, M); let j = f.segments; if ("mercator" === _.projection.name && !A && (j = f.getVisibleSegments(r.tileID, t.terrain, t.transform.getFrustum(0)), !j.get().length)) continue; if (B) if (A) for (const e of j.get()) B.numRenderedVerticesInShadowPass += e.primitiveLength; else for (const e of j.get()) B.numRenderedVerticesInTransparentPass += e.primitiveLength; const V = []; (t.terrain || l) && V.push(f.centroidVertexBuffer), w && V.push(f.layoutVertexExtBuffer), k.draw(t, c.gl.TRIANGLES, s, n, a, e.b5.backCCW, G, o.id, f.layoutVertexBuffer, f.indexBuffer, j, o.paint, t.transform.zoom, z, V); } t.shadowRenderer && (t.shadowRenderer.useNormalOffset = !1); } function So(t, i, o, r, s, n, a, l, c, h, _, d, u, p, m, f, g, v, x) { const y = t.context, b = y.gl, w = t.transform, T = t.transform.zoom, E = [], C = Ii(t, o.paint.get("fill-extrusion-cutoff-fade-range")); "clear" === h ? (E.push("CLEAR_SUBPASS"), x && (E.push("CLEAR_FROM_TEXTURE"), y.activeTexture.set(b.TEXTURE0), x.bind(b.LINEAR, b.CLAMP_TO_EDGE))) : "sdf" === h && E.push("SDF_SUBPASS"), g && E.push("HAS_CENTROID"), C.shouldRenderCutoff && E.push("RENDER_CUTOFF"); const I = o.layout.get("fill-extrusion-edge-radius"), S = (e, i, r, h, v) => { const b = i.programConfigurations.get(o.id), w = t.isTileAffectedByFog(e), S = t.getOrCreateProgram("fillExtrusionGroundEffect", { config: b, defines: E, overrideFog: w }), M = ((e, t, i, o, r, s, n, a, l, c, h) => ({ u_matrix: t, u_opacity: i, u_ao_pass: o ? 1 : 0, u_meter_to_tile: r, u_ao: s, u_flood_light_intensity: n, u_flood_light_color: a, u_attenuation: l, u_edge_radius: c, u_fb: 0, u_fb_size: h }))(0, h, _, c, v, [d, u * v], p, m, f, T >= 17 ? 0 : I * v, x ? x.size[0] : 0), L = []; g && L.push(i.hiddenByLandmarkVertexBuffer), t.uploadCommonUniforms(y, S, e.toUnwrapped(), null, C), S.draw(t, y.gl.TRIANGLES, s, n, a, l, M, o.id, i.vertexBuffer, i.indexBuffer, r, o.paint, T, b, L); }; for (const s of r) { const r = i.getTile(s), n = r.getBucket(o); if (!n || n.projection.name !== w.projection.name || !n.groundEffect || n.groundEffect && !n.groundEffect.hasData()) continue; const a = n.groundEffect, l = 1 / n.tileToMeter; { const e = t.translatePosMatrix(s.projMatrix, r, o.paint.get("fill-extrusion-translate"), o.paint.get("fill-extrusion-translate-anchor")), i = a.getDefaultSegment(); S(s, a, i, e, l); } if (v) for (let n = 0; n < 4; n++) { const a = e.bP[n](s), c = i.getTile(a); if (!c) continue; const h = c.getBucket(o); if (!h || h.projection.name !== w.projection.name || !h.groundEffect || h.groundEffect && !h.groundEffect.hasData()) continue; const _ = h.groundEffect; let d, u; 0 === n ? (d = [-e.J, 0, 0], u = 1) : 1 === n ? (d = [e.J, 0, 0], u = 0) : 2 === n ? (d = [0, -e.J, 0], u = 3) : (d = [0, e.J, 0], u = 2); const p = _.regionSegments[u]; if (!p) continue; const m = new Float32Array(16); e.m.translate(m, s.projMatrix, d), S(s, _, p, t.translatePosMatrix(m, r, o.paint.get("fill-extrusion-translate"), o.paint.get("fill-extrusion-translate-anchor")), l); } } } function Mo(t, i, o, r, s, n, a) { 0 === r.centroidVertexArray.length && r.createCentroidsBuffer(); const l = n ? n.findDEMTileFor(o) : null; if (!(l && l.dem || a)) return; const c = t => new e.P(Math.ceil((t + e.bS) * e.bT), 0), h = e => { const t = i.getSource().minzoom, o = e => { const t = i.getTileByID(e); if (t && t.hasData()) return t.getBucket(s) }, r = [0, -1, 1]; for (const i of r) { if (e.overscaledZ + i < t) continue; const r = o(e.calculateScaledKey(e.overscaledZ + i)); if (r) return r } }, _ = [0, 0, 0], d = (t, i) => (_[0] = Math.min(t.min.y, i.min.y), _[1] = Math.max(t.max.y, i.max.y), _[2] = e.J - i.min.x > t.max.x ? i.min.x - e.J : t.max.x, _), u = (t, i) => (_[0] = Math.min(t.min.x, i.min.x), _[1] = Math.max(t.max.x, i.max.x), _[2] = e.J - i.min.y > t.max.y ? i.min.y - e.J : t.max.y, _), p = [(e, t) => d(e, t), (e, t) => d(t, e), (e, t) => u(e, t), (e, t) => u(t, e)], m = (t, i, r, s, a, c, h) => { if (!n) return 0; const _ = [[c ? r : t, c ? t : r, 0], [c ? r : i, c ? i : r, 0]], d = h < 0 ? e.J + h : h, u = [c ? d : (t + i) / 2, c ? (t + i) / 2 : d, 0]; return 0 === r && h < 0 || 0 !== r && h > 0 ? n.getForTilePoints(a, [u], !0, s) : _.push(u), n.getForTilePoints(o, _, !0, l), Math.max(_[0][2], _[1][2], u[2]) / n.exaggeration() }; for (let t = 0; t < 4; t++) { const i = r.borderFeatureIndices[t]; if (0 === i.length) continue; const s = e.bP[t](o), l = h(s); if (!(l && l instanceof e.bQ)) continue; if (r.borderDoneWithNeighborZ[t] === l.canonical.z) continue; 0 === l.centroidVertexArray.length && l.createCentroidsBuffer(); const _ = n ? n.findDEMTileFor(s) : null; if (!(_ && _.dem || a)) continue; const d = (t < 2 ? 1 : 5) - t, u = l.borderDoneWithNeighborZ[d] !== r.canonical.z, v = l.borderFeatureIndices[d]; let x = 0; if (r.canonical.z !== l.canonical.z) { for (const e of i) r.showCentroid(r.featuresOnBorder[e]); if (u) for (const e of v) l.showCentroid(l.featuresOnBorder[e]); r.borderDoneWithNeighborZ[t] = l.canonical.z, l.borderDoneWithNeighborZ[d] = r.canonical.z; } for (const o of i) { const i = r.featuresOnBorder[o], n = r.centroidData[i.centroidDataIndex], h = i.borders[t]; let u; for (; x < v.length;) { u = l.featuresOnBorder[v[x]]; const e = u.borders[d]; if (e[1] > h[0] + 3 || e[0] > h[0] - 3) break; l.showCentroid(u), x++; } if (u && x < v.length) { const o = x; let y = 0; for (; !(u.borders[d][0] > h[1] - 3) && (y++, ++x !== v.length);)u = l.featuresOnBorder[v[x]]; if (u = l.featuresOnBorder[v[o]], y > 1) { const e = u.borders[d]; Math.abs(h[0] - e[0]) < 3 && Math.abs(h[1] - e[1]) < 3 && (y = 1, x = o + 1); } else if (0 === y) { r.showCentroid(i); continue } const b = l.centroidData[u.centroidDataIndex]; a && 1 === y && (((f = n).flags | (g = b).flags) & e.bR ? (f.flags |= e.bR, g.flags |= e.bR) : (f.flags &= ~e.bR, g.flags &= ~e.bR)); const w = i.intersectsCount() > 1 || u.intersectsCount() > 1; if (y > 1) x = o, n.centroidXY = b.centroidXY = new e.P(0, 0); else if (_ && _.dem && !w) { const i = p[t](n, b), o = t % 2 ? e.J - 1 : 0, r = m(i[0], Math.min(e.J - 1, i[1]), o, _, s, t < 2, i[2]); n.centroidXY = b.centroidXY = c(r); } else w ? n.centroidXY = b.centroidXY = new e.P(0, 0) : (n.centroidXY = r.encodeBorderCentroid(i), b.centroidXY = l.encodeBorderCentroid(u)); r.writeCentroidToBuffer(n), l.writeCentroidToBuffer(b); } else r.showCentroid(i); } r.borderDoneWithNeighborZ[t] = l.canonical.z, l.borderDoneWithNeighborZ[d] = r.canonical.z; } var f, g; (r.needsCentroidUpdate || !r.centroidVertexBuffer && 0 !== r.centroidVertexArray.length) && r.uploadCentroid(t); } const Lo = [1, 0, 0], Po = [0, 1, 0], Do = [0, 0, 1]; function Ao(t, i, o) { const r = o.transform, s = o.shadowRenderer; if (!s) return !0; const n = t.toUnwrapped(), a = r.tileSize * s._cascades[o.currentShadowCascade].scale; let l = i.maxHeight; if (r.elevation) { const e = r.elevation.getMinMaxForTile(t); e && (l += e.max); } const c = [...s.shadowDirection]; c[2] = -c[2]; const h = s.computeSimplifiedTileShadowVolume(n, l, a, c); if (!h) return !1; const _ = [Lo, Po, Do, c, [c[0], 0, c[2]], [0, c[1], c[2]]], d = "globe" === r.projection.name, u = r.scaleZoom(a), p = e.F.fromInvProjectionMatrix(r.invProjMatrix, r.worldSize, u, !d), m = s.getCurrentCascadeFrustum(); return 0 === p.intersectsPrecise(h.vertices, h.planes, _) || 0 === m.intersectsPrecise(h.vertices, h.planes, _) } function Ro(e) { const t = e._nearZ, i = e.projection.farthestPixelDistance(e), o = i - t, r = .2 * e.height, s = t + r; return [t, i, (s - r - t) / o, (s - t) / o] } const zo = new e.C(1, 0, 0, 1), Oo = new e.C(0, 1, 0, 1), Fo = new e.C(0, 0, 1, 1), Bo = new e.C(1, 0, 1, 1), ko = new e.C(0, 1, 1, 1); function No(t, i, o, r, s, n) { const a = t.context, l = t.transform, c = a.gl, h = "globe" === l.projection.name, _ = h ? ["PROJECTION_GLOBE_VIEW"] : []; let d = e.m.clone(o.projMatrix); if (h && e.ao(l.zoom) > 0) { const t = e.bU(o.canonical, l), i = e.bV(t); d = e.m.multiply(new Float32Array(16), l.globeMatrix, i), e.m.multiply(d, l.projMatrix, d); } const u = e.m.create(); u[12] += 2 * s / (e.a4.devicePixelRatio * l.width), u[13] += 2 * n / (e.a4.devicePixelRatio * l.height), e.m.multiply(d, u, d); const p = t.getOrCreateProgram("debug", { defines: _ }), m = i.getTileByID(o.key); t.terrain && t.terrain.setupElevationDraw(m, p); const f = e.b4.disabled, g = e.b6.disabled, v = t.colorModeForRenderPass(), x = "$debug"; a.activeTexture.set(c.TEXTURE0), t.emptyTexture.bind(c.LINEAR, c.CLAMP_TO_EDGE), h ? m._makeGlobeTileDebugBuffers(t.context, l) : m._makeDebugTileBoundsBuffers(t.context, l.projection); const y = m._tileDebugBuffer || t.debugBuffer, b = m._tileDebugIndexBuffer || t.debugIndexBuffer, w = m._tileDebugSegments || t.debugSegments; p.draw(t, c.LINE_STRIP, f, g, v, e.b5.disabled, Ki(d, r), x, y, b, w, null, null, null, [m._globeTileDebugBorderBuffer]); const T = m.latestRawTileData, E = Math.floor((T && T.byteLength || 0) / 1024), C = i.getTile(o).tileSize, I = 512 / Math.min(C, 512) * (o.overscaledZ / l.zoom) * .5; let S = o.canonical.toString(); o.overscaledZ !== o.canonical.z && (S += ` => ${o.overscaledZ}`), S += ` ${E}kb`, function (e, t) { e.initDebugOverlayCanvas(); const i = e.debugOverlayCanvas, o = e.context.gl, r = e.debugOverlayCanvas.getContext("2d"); r.clearRect(0, 0, i.width, i.height), r.shadowColor = "white", r.shadowBlur = 2, r.lineWidth = 1.5, r.strokeStyle = "white", r.textBaseline = "top", r.font = "bold 36px Open Sans, sans-serif", r.fillText(t, 5, 5), r.strokeText(t, 5, 5), e.debugOverlayTexture.update(i), e.debugOverlayTexture.bind(o.LINEAR, o.CLAMP_TO_EDGE); }(t, S); const M = m._tileDebugTextBuffer || t.debugBuffer, L = m._tileDebugTextIndexBuffer || t.quadTriangleIndexBuffer, P = m._tileDebugTextSegments || t.debugSegments; p.draw(t, c.TRIANGLES, f, g, e.a.alphaBlended, e.b5.disabled, Ki(d, e.C.transparent, I), x, M, L, P, null, null, null, [m._globeTileDebugTextBuffer]); } function Uo(e, t, i, o) { jo(e, 0, t + i / 2, e.transform.width, i, o); } function Go(e, t, i, o) { jo(e, t - i / 2, 0, i, e.transform.height, o); } function jo(t, i, o, r, s, n) { const a = t.context, l = a.gl; l.enable(l.SCISSOR_TEST), l.scissor(i * e.a4.devicePixelRatio, o * e.a4.devicePixelRatio, r * e.a4.devicePixelRatio, s * e.a4.devicePixelRatio), a.clear({ color: n }), l.disable(l.SCISSOR_TEST); } const Vo = e.bW([{ name: "a_pos_3f", components: 3, type: "Float32" }]), { members: Zo } = Vo; function Wo(e, t, i, o) { e.emplaceBack(t, i, o); } class Ho { constructor(t) { this.vertexArray = new e.bX, this.indices = new e.bp, Wo(this.vertexArray, -1, -1, 1), Wo(this.vertexArray, 1, -1, 1), Wo(this.vertexArray, -1, 1, 1), Wo(this.vertexArray, 1, 1, 1), Wo(this.vertexArray, -1, -1, -1), Wo(this.vertexArray, 1, -1, -1), Wo(this.vertexArray, -1, 1, -1), Wo(this.vertexArray, 1, 1, -1), this.indices.emplaceBack(5, 1, 3), this.indices.emplaceBack(3, 7, 5), this.indices.emplaceBack(6, 2, 0), this.indices.emplaceBack(0, 4, 6), this.indices.emplaceBack(2, 6, 7), this.indices.emplaceBack(7, 3, 2), this.indices.emplaceBack(5, 4, 0), this.indices.emplaceBack(0, 1, 5), this.indices.emplaceBack(0, 2, 3), this.indices.emplaceBack(3, 1, 0), this.indices.emplaceBack(7, 6, 4), this.indices.emplaceBack(4, 5, 7), this.vertexBuffer = t.createVertexBuffer(this.vertexArray, Zo), this.indexBuffer = t.createIndexBuffer(this.indices), this.segment = e.bm.simpleSegment(0, 0, 36, 12); } } function qo(t, i, o, r, s, n) { const a = t.context.gl, l = i.paint.get("sky-atmosphere-color"), c = i.paint.get("sky-atmosphere-halo-color"), h = i.paint.get("sky-atmosphere-sun-intensity"), _ = ((e, t, i, o, r) => ({ u_matrix_3f: e, u_sun_direction: t, u_sun_intensity: i, u_color_tint_r: [o.r, o.g, o.b, o.a], u_color_tint_m: [r.r, r.g, r.b, r.a], u_luminance: 5e-5 }))(e.bx.fromMat4(e.bx.create(), r), s, h, l, c); a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + n, i.skyboxTexture, 0), o.draw(t, a.TRIANGLES, e.b4.disabled, e.b6.disabled, e.a.unblended, e.b5.frontCW, _, "skyboxCapture", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); } const $o = e.bW([{ type: "Float32", name: "a_pos", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }]); class Xo { constructor(t) { const i = new e.bY; 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 o = new e.bp; o.emplaceBack(0, 1, 2), o.emplaceBack(2, 3, 0), this.vertexBuffer = t.createVertexBuffer(i, $o.members), this.indexBuffer = t.createIndexBuffer(o), this.segments = e.bm.simpleSegment(0, 0, 4, 2); } destroy() { this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(); } } const Jo = e.bW([{ type: "Float32", name: "a_pos_3f", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }, { type: "Float32", name: "a_size_scale", components: 1 }, { type: "Float32", name: "a_fade_opacity", components: 1 }]); class Yo { constructor() { this.starsCount = 16e3, this.sizeMultiplier = .15; } } class Ko { constructor(t) { this.colorModeAlphaBlendedWriteRGB = new e.a([e.bZ, e.b_, e.bZ, e.b_], e.C.transparent, [!0, !0, !0, !1]), this.colorModeWriteAlpha = new e.a([e.bZ, e.b$, e.bZ, e.b$], e.C.transparent, [!1, !1, !1, !0]), this.params = new Yo, this.allocatedStarsCount = 0, t.tp.registerParameter(this.params, ["Stars"], "starsCount", { min: 100, max: 16e3, step: 1 }), t.tp.registerParameter(this.params, ["Stars"], "sizeMultiplier", { min: .01, max: 2, step: .01 }); } update(t) { const i = t.context; if (!this.atmosphereBuffer || this.allocatedStarsCount !== this.params.starsCount) { this.atmosphereBuffer = new Xo(i), this.allocatedStarsCount = this.params.starsCount; const t = 100, o = 200, r = function (t) { const i = e.c2(30), o = []; for (let r = 0; r < t; ++r) { const t = 2 * Math.PI * i(), r = Math.acos(1 - 2 * i()) - .5 * Math.PI; o.push(e.v.fromValues(Math.cos(r) * Math.cos(t), Math.cos(r) * Math.sin(t), Math.sin(r))); } return o }(this.allocatedStarsCount), s = e.c2(300), n = new e.c0, a = new e.bp; let l = 0; for (let i = 0; i < r.length;
41 ++i) { const c = e.v.scale([], r[i], 200), h = Math.max(0, 1 + .01 * t * (1 * s() - .5)), _ = Math.max(0, 1 + .01 * o * (1 * s() - .5)); n.emplaceBack(c[0], c[1], c[2], -1, -1, h, _), n.emplaceBack(c[0], c[1], c[2], 1, -1, h, _), n.emplaceBack(c[0], c[1], c[2], 1, 1, h, _), n.emplaceBack(c[0], c[1], c[2], -1, 1, h, _), a.emplaceBack(l + 0, l + 1, l + 2), a.emplaceBack(l + 0, l + 2, l + 3), l += 4; } this.starsVx = i.createVertexBuffer(n, Jo.members), this.starsIdx = i.createIndexBuffer(a), this.starsSegments = e.bm.simpleSegment(0, 0, n.length, a.length); } } destroy() { this.atmosphereBuffer && this.atmosphereBuffer.destroy(), this.starsVx && this.starsVx.destroy(), this.starsIdx && this.starsIdx.destroy(); } drawAtmosphereGlow(t, i) { const o = t.context, r = o.gl, s = t.transform, n = new e.b4(r.LEQUAL, e.b4.ReadOnly, [0, 1]), a = e.ao(s.zoom), l = i.properties.get("color").toArray01(), c = i.properties.get("high-color").toArray01(), h = i.properties.get("space-color").toArray01PremultipliedAlpha(), _ = 5e-4, d = e.c1(i.properties.get("horizon-blend"), 0, 1, _, .25), u = e.bb(t, o, s) && d === _ ? s.worldSize / (2 * Math.PI * 1.025) - 1 : s.globeRadius, p = t.frameCounter / 1e3 % 1, m = e.v.length(s.globeCenterInViewSpace), f = Math.sqrt(Math.pow(m, 2) - Math.pow(u, 2)), g = Math.acos(f / m), v = i => { const _ = "globe" === s.projection.name ? ["PROJECTION_GLOBE_VIEW", "FOG"] : ["FOG"]; i && _.push("ALPHA_PASS"); const u = t.getOrCreateProgram("globeAtmosphere", { defines: _ }), m = ((e, t, i, o, r, s, n, a, l, c, h, _) => ({ u_frustum_tl: e, u_frustum_tr: t, u_frustum_br: i, u_frustum_bl: o, u_horizon: r, u_transition: s, u_fadeout_range: n, u_color: a, u_high_color: l, u_space_color: c, u_temporal_offset: h, u_horizon_angle: _ }))(s.frustumCorners.TL, s.frustumCorners.TR, s.frustumCorners.BR, s.frustumCorners.BL, s.frustumCorners.horizon, a, d, l, c, h, p, g); t.uploadCommonUniforms(o, u); const f = this.atmosphereBuffer; f && u.draw(t, r.TRIANGLES, n, e.b6.disabled, i ? this.colorModeWriteAlpha : this.colorModeAlphaBlendedWriteRGB, e.b5.backCW, m, i ? "atmosphere_glow_alpha" : "atmosphere_glow", f.vertexBuffer, f.indexBuffer, f.segments); }; v(!1), v(!0); } drawStars(t, i) { const o = e.c(i.properties.get("star-intensity"), 0, 1); if (0 === o) return; const r = t.context, s = r.gl, n = t.transform, a = t.getOrCreateProgram("stars"), l = e.q.identity([]); e.q.rotateX(l, l, -n._pitch), e.q.rotateZ(l, l, -n.angle), e.q.rotateX(l, l, e.d(n._center.lat)), e.q.rotateY(l, l, -e.d(n._center.lng)); const c = e.m.fromQuat(new Float32Array(16), l), h = e.m.multiply([], n.starsProjMatrix, c), _ = e.bx.fromMat4([], c), d = e.bx.invert([], _), u = [0, 1, 0]; e.v.transformMat3(u, u, d), e.v.scale(u, u, this.params.sizeMultiplier); const p = [1, 0, 0]; e.v.transformMat3(p, p, d), e.v.scale(p, p, this.params.sizeMultiplier); const m = (f = u, g = p, v = o, { u_matrix: Float32Array.from(h), u_up: f, u_right: g, u_intensity_multiplier: v }); var f, g, v; t.uploadCommonUniforms(r, a), this.starsVx && this.starsIdx && a.draw(t, s.TRIANGLES, e.b4.disabled, e.b6.disabled, this.colorModeAlphaBlendedWriteRGB, e.b5.disabled, m, "atmosphere_stars", this.starsVx, this.starsIdx, this.starsSegments); } } function Qo(t, i) { const o = [...t], r = i.cameraWorldSizeForFog / i.worldSize, s = e.m.identity([]); return e.m.scale(s, s, [r, r, 1]), e.m.multiply(o, s, o), e.m.multiply(o, i.worldToFogMatrix, o), o } function er(e, t, i, o) { const r = i.material, s = o.context, { baseColorTexture: n, metallicRoughnessTexture: a } = r.pbrMetallicRoughness, { normalTexture: l, occlusionTexture: c, emissionTexture: h } = r; function _(t, i, o) { if (t && (e.push(i), s.activeTexture.set(s.gl.TEXTURE0 + o), t.gfxTexture)) { const { minFilter: e, magFilter: i, wrapS: o, wrapT: r } = t.sampler; t.gfxTexture.bindExtraParam(e, i, o, r); } } _(n, "HAS_TEXTURE_u_baseColorTexture", _o.BaseColor), _(a, "HAS_TEXTURE_u_metallicRoughnessTexture", _o.MetallicRoughness), _(l, "HAS_TEXTURE_u_normalTexture", _o.Normal), _(c, "HAS_TEXTURE_u_occlusionTexture", _o.Occlusion), _(h, "HAS_TEXTURE_u_emissionTexture", _o.Emission), i.texcoordBuffer && (e.push("HAS_ATTRIBUTE_a_uv_2f"), t.push(i.texcoordBuffer)), i.colorBuffer && (e.push(12 === i.colorBuffer.itemSize ? "HAS_ATTRIBUTE_a_color_3f" : "HAS_ATTRIBUTE_a_color_4f"), t.push(i.colorBuffer)), i.normalBuffer && (e.push("HAS_ATTRIBUTE_a_normal_3f"), t.push(i.normalBuffer)), i.pbrBuffer && (e.push("HAS_ATTRIBUTE_a_pbr"), e.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"), t.push(i.pbrBuffer)), "OPAQUE" !== r.alphaMode && "MASK" !== r.alphaMode || e.push("UNPREMULT_TEXTURE_IN_SHADER"), r.defined || e.push("DIFFUSE_SHADED"), e.push("USE_STANDARD_DERIVATIVES"); } function tr(t, i, o, r, s, n) { const a = o.paint.get("model-opacity"), l = i.context, c = new e.b4(i.context.gl.LEQUAL, e.b4.ReadWrite, i.depthRangeFor3D), h = i.transform, _ = t.mesh, d = _.material, u = d.pbrMetallicRoughness, p = i.style.fog; let m; m = "pixels" === i.transform.projection.zAxisUnit ? [...t.nodeModelMatrix] : e.m.multiply([], r.zScaleMatrix, t.nodeModelMatrix), e.m.multiply(m, r.negCameraPosMatrix, m); const f = e.m.invert([], m); e.m.transpose(f, f); const g = o.paint.get("model-emissive-strength").constantOr(0), v = uo(new Float32Array(t.worldViewProjection), new Float32Array(m), new Float32Array(f), i, a, u.baseColorFactor, d.emissiveFactor, u.metallicFactor, u.roughnessFactor, d, g, o), x = { defines: [] }, y = [];
41 er(x.defines, y, _, i); const b = i.shadowRenderer; b && (b.useNormalOffset = !1); let w = null; if (p) { const e = Qo(t.nodeModelMatrix, i.transform); if (w = new Float32Array(e), "globe" !== h.projection.name) { const t = _.aabb.min, i = _.aabb.max, [o, r] = p.getOpacityForBounds(e, t[0], t[1], i[0], i[1]); x.overrideFog = o >= Ue || r >= Ue; } } const T = Ii(i, o.paint.get("model-cutoff-fade-range")); T.shouldRenderCutoff && x.defines.push("RENDER_CUTOFF"); const E = i.getOrCreateProgram("model", x); i.uploadCommonUniforms(l, E, null, w, T), "shadow" !== i.renderPass && b && b.setupShadowsFromMatrix(t.nodeModelMatrix, E), E.draw(i, l.gl.TRIANGLES, c, s, n, _.material.doubleSided ? e.b5.disabled : e.b5.backCCW, v, o.id, _.vertexBuffer, _.indexBuffer, _.segments, o.paint, i.transform.zoom, void 0, y); } function ir(t, i, o, r, s, n, a) { let l; l = "globe" === t.projection.name ? e.c5(o, t) : [...o], e.m.multiply(l, l, i.matrix); const c = e.m.multiply([], r, l); if (i.meshes) for (const t of i.meshes) { if ("BLEND" !== t.material.alphaMode) { a.push({ mesh: t, depth: 0, modelIndex: s, worldViewProjection: c, nodeModelMatrix: l }); continue } const i = e.v.transformMat4([], t.centroid, c); i[2] > 0 && n.push({ mesh: t, depth: i[2], modelIndex: s, worldViewProjection: c, nodeModelMatrix: l }); } if (i.children) for (const e of i.children) ir(t, e, o, r, s, n, a); } function or(t, i, o, r) { const s = o.shadowRenderer; if (!s) return; const n = s.getShadowPassDepthMode(), a = s.getShadowPassColorMode(), l = s.calculateShadowPassMatrixFromMatrix(i), c = mo(l); o.getOrCreateProgram("modelDepth", { defines: ["DEPTH_TEXTURE"] }).draw(o, o.context.gl.TRIANGLES, n, e.b6.disabled, a, e.b5.backCCW, c, r.id, t.vertexBuffer, t.indexBuffer, t.segments, r.paint, o.transform.zoom, void 0, void 0); } function rr(t, i, o) { const r = i.updateZoomBasedPaintProperties(), s = function (t, i, o) { let r, s, n, a = t.terrain ? t.terrain.exaggeration() : 0; if (t.terrain && a > 0) { const i = t.terrain, s = i.findDEMTileFor(o); s && s.dem ? r = e.c7.create(i, o, s) : a = 0; } if (0 === a && (i.terrainElevationMin = 0, i.terrainElevationMax = 0), a === i.validForExaggeration && (0 === a || r && r._demTile && r._demTile.tileID === i.validForDEMTile.id && r._dem._timestamp === i.validForDEMTile.timestamp)) return !1; for (const e in i.instancesPerModel) { const t = i.instancesPerModel[e]; for (let e = 0; e < t.instancedDataArray.length; ++e) { const o = (r ? a * r.getElevationAt(0 | t.instancedDataArray.float32[16 * e], 0 | t.instancedDataArray.float32[16 * e + 1], !0, !0) : 0) + t.instancesEvaluatedElevation[e]; t.instancedDataArray.float32[16 * e + 6] = o, s = s ? Math.min(i.terrainElevationMin, o) : o, n = n ? Math.max(i.terrainElevationMax, o) : o; } } return i.terrainElevationMin = s || 0, i.terrainElevationMax = n || 0, i.validForExaggeration = a, i.validForDEMTile = r && r._demTile ? { id: r._demTile.tileID, timestamp: r._dem._timestamp } : { id: void 0, timestamp: 0 }, !0 }(t, i, o); (r || s) && (i.uploaded = !1, i.upload(t.context)); } const sr = { shadowUniformsInitialized: !1, useSingleShadowCascade: !1, tileMatrix: new Float64Array(16), shadowTileMatrix: new Float32Array(16), aabb: new e.c3([0, 0, 0], [e.J, e.J, 0]) }; function nr(t, i) { const o = 1 << t.canonical.z, r = i.getFreeCameraOptions().position, s = i.elevation, n = t.canonical.x / o, a = (t.canonical.x + 1) / o, l = t.canonical.y / o, c = (t.canonical.y + 1) / o; let h = i._centerAltitude; if (s) { const e = s.getMinMaxForTile(t); e && e.max > h && (h = e.max); } const _ = e.c(r.x, n, a) - r.x, d = e.c(r.y, l, c) - r.y, u = e.b(h, i.center.lat) - r.z; return i._zoomFromMercatorZ(Math.sqrt(_ * _ + d * d + u * u)) } function ar(t, i, o, r, s, n, a) { const l = t.context, c = "shadow" === t.renderPass, h = t.shadowRenderer, _ = c && h ? h.getShadowPassDepthMode() : new e.b4(l.gl.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D), d = t.isTileAffectedByFog(n); if (o.meshes) for (const u of o.meshes) { const p = ["MODEL_POSITION_ON_GPU"], m = []; let f, g, v; r.instancedDataArray.length > 20 && p.push("INSTANCED_ARRAYS"); const x = Ii(t, i.paint.get("model-cutoff-fade-range")); if (x.shouldRenderCutoff && p.push("RENDER_CUTOFF"), c && h) f = t.getOrCreateProgram("modelDepth", { defines: p }), g = mo(a.shadowTileMatrix, a.shadowTileMatrix, Float32Array.from(o.matrix)), v = h.getShadowPassColorMode(); else { er(p, m, u, t), f = t.getOrCreateProgram("model", { defines: p, overrideFog: d }); const r = u.material, c = r.pbrMetallicRoughness, _ = i.paint.get("model-opacity"), y = i.paint.get("model-emissive-strength").constantOr(0); g = uo(n.expandedProjMatrix, Float32Array.from(o.matrix), new Float32Array(16), t, _, c.baseColorFactor, r.emissiveFactor, c.metallicFactor, c.roughnessFactor, r, y, i, s), h && (a.shadowUniformsInitialized ? f.setShadowUniformValues(l, h.getShadowUniformValues()) : (h.setupShadows(n.toUnwrapped(), f, "model-tile", n.overscaledZ
41), a.shadowUniformsInitialized = !0)), v = x.shouldRenderCutoff || _ < 1 || "OPAQUE" !== r.alphaMode ? e.a.alphaBlended : e.a.unblended; } t.uploadCommonUniforms(l, f, n.toUnwrapped(), null, x); const y = u.material.doubleSided ? e.b5.disabled : e.b5.backCCW; if (r.instancedDataArray.length > 20) m.push(r.instancedDataBuffer), f.draw(t, l.gl.TRIANGLES, _, e.b6.disabled, v, y, g, i.id, u.vertexBuffer, u.indexBuffer, u.segments, i.paint, t.transform.zoom, void 0, m, r.instancedDataArray.length); else { const o = c ? "u_instance" : "u_normal_matrix"; for (let s = 0; s < r.instancedDataArray.length; ++s)g[o] = new Float32Array(r.instancedDataArray.arrayBuffer, 64 * s, 16), f.draw(t, l.gl.TRIANGLES, _, e.b6.disabled, v, y, g, i.id, u.vertexBuffer, u.indexBuffer, u.segments, i.paint, t.transform.zoom, void 0, m); } } if (o.children) for (const e of o.children) ar(t, i, e, r, s, n, a); } const lr = [1, -1, 1]; function cr(t, i, o, r) { if (!o.modelManager) return !0; const s = o.modelManager; if (!o.shadowRenderer) return !0; const n = o.shadowRenderer, a = i.aabb; let l = !0, c = t.maxHeight; if (0 === c) { let e = 0; for (const i in t.instancesPerModel) { const t = s.getModel(i, r); t ? e = Math.max(e, Math.max(Math.max(t.aabb.max[0], t.aabb.max[1]), t.aabb.max[2])) : l = !1; } c = t.maxScale * e * 1.41 + t.maxVerticalOffset, l && (t.maxHeight = c); } a.max[2] = c, a.min[2] += t.terrainElevationMin, a.max[2] += t.terrainElevationMax, e.v.transformMat4(a.min, a.min, i.tileMatrix), e.v.transformMat4(a.max, a.max, i.tileMatrix); const h = a.intersects(n.getCurrentCascadeFrustum()); return 0 === o.currentShadowCascade && (t.isInsideFirstShadowMapFrustum = 2 === h), 0 === h } class hr { } class _r { constructor() { this._storage = new Map; } getLinesFromTrianglesBuffer(t, i, o) { { const e = this._storage.get(i.id); if (e) return e.lastUsedFrameIdx = t, e.buf } const r = o.gl, s = r.getBufferParameter(r.ELEMENT_ARRAY_BUFFER, r.BUFFER_SIZE), n = new ArrayBuffer(s), a = new Int16Array(n); r.getBufferSubData(r.ELEMENT_ARRAY_BUFFER, 0, new Int16Array(n)); const l = new e.c9; for (let e = 0; e < s / 2; e += 3) { const t = a[e], i = a[e + 1], o = a[e + 2]; l.emplaceBack(t, i), l.emplaceBack(i, o), l.emplaceBack(o, t); } const c = o.bindVertexArrayOES.current, h = new hr; return h.buf = new e.I(o, l), h.lastUsedFrameIdx = t, this._storage.set(i.id, h), o.bindVertexArrayOES.set(c), h.buf } update(e) { for (const [t, i] of this._storage) e - i.lastUsedFrameIdx > 30 && (i.buf.destroy(), this._storage.delete(t)); } destroy() { for (const [e, t] of this._storage) t.buf.destroy(), this._storage.delete(e); } } class dr { registerParameter(e, t, i, o, r) { } registerButton(e, t, i) { } } const ur = { symbol: function (t, i, o, r, s) { if ("translucent" !== t.renderPass) return; const n = e.b6.disabled, a = t.colorModeForRenderPass(); o.layout.get("text-variable-anchor") && function (t, i, o, r, s, n, a) { const l = i.transform, c = "map" === s, h = "map" === n; for (const i of t) { const t = r.getTile(i), s = t.getBucket(o); if (!s || !s.text || !s.text.segments.get().length) continue; const n = e.i(s.textSizeData, l.zoom), _ = St(i, s.getProjection(), l), d = l.calculatePixelsToTileUnitsMatrix(t), u = pe(_, t.tileID.canonical, h, c, l, s.getProjection(), d), p = s.hasIconTextFit() && s.hasIconData(); if (n) { const o = Math.pow(2, l.zoom - t.tileID.overscaledZ); bo(s, c, h, a, e.bG, l, u, i, o, n, p); } } }(r, t, o, i, o.layout.get("text-rotation-alignment"), o.layout.get("text-pitch-alignment"), s), 0 !== o.paint.get("icon-opacity").constantOr(1) && To(t, i, o, r, !1, o.paint.get("icon-translate"), o.paint.get("icon-translate-anchor"), o.layout.get("icon-rotation-alignment"), o.layout.get("icon-pitch-alignment"), o.layout.get("icon-keep-upright"), o.paint.get("icon-color-saturation"), n, a), 0 !== o.paint.get("text-opacity").constantOr(1) && To(t, i, o, r, !0, o.paint.get("text-translate"), o.paint.get("text-translate-anchor"), o.layout.get("text-rotation-alignment"), o.layout.get("text-pitch-alignment"), o.layout.get("text-keep-upright"), o.paint.get("icon-color-saturation"), n, a), i.map.showCollisionBoxes && (vo(t, i, o, r, o.paint.get("text-translate"), o.paint.get("text-translate-anchor"), !0), vo(t, i, o, r, o.paint.get("icon-translate"), o.paint.get("icon-translate-anchor"), !1)); }, circle: function (t, i, o, r) { if ("translucent" !== t.renderPass) return; const s = o.paint.get("circle-opacity"), n = o.paint.get("circle-stroke-width"), a = o.paint.get("circle-stroke-opacity"), l = void 0 !== o.layout.get("
41circle-sort-key").constantOr(1), c = o.paint.get("circle-emissive-strength"); if (0 === s.constantOr(1) && (0 === n.constantOr(1) || 0 === a.constantOr(1))) return; const h = t.context, _ = h.gl, d = t.transform, u = t.depthModeForSublayer(0, e.b4.ReadOnly), p = e.b6.disabled, m = t.colorModeForDrapableLayerRenderPass(c), f = "globe" === d.projection.name, g = [e.E(d.center.lng), e.H(d.center.lat)], v = []; for (let s = 0; s < r.length; s++) { const n = r[s], a = i.getTile(n), c = a.getBucket(o); if (!c || c.projection.name !== d.projection.name) continue; const h = c.programConfigurations.get(o.id), _ = e.bH(o), u = t.isTileAffectedByFog(n); f && _.push("PROJECTION_GLOBE_VIEW"); const p = t.getOrCreateProgram("circle", { config: h, defines: _, overrideFog: u }), m = c.layoutVertexBuffer, x = c.globeExtVertexBuffer, y = c.indexBuffer, b = d.projection.createInversionMatrix(d, n.canonical), w = { programConfiguration: h, program: p, layoutVertexBuffer: m, globeExtVertexBuffer: x, indexBuffer: y, uniformValues: e.bI(t, n, a, b, g, o), tile: a }; if (l) { const t = c.segments.get(); for (const i of t) v.push({ segments: new e.bm([i]), sortKey: i.sortKey, state: w }); } else v.push({ segments: c.segments, sortKey: 0, state: w }); } l && v.sort(((e, t) => e.sortKey - t.sortKey)); const x = { useDepthForOcclusion: d.depthOcclusionForSymbolsAndCircles }; for (const i of v) { const { programConfiguration: r, program: s, layoutVertexBuffer: n, globeExtVertexBuffer: a, indexBuffer: l, uniformValues: c, tile: f } = i.state, g = i.segments; t.terrain && t.terrain.setupElevationDraw(f, s, x), t.uploadCommonUniforms(h, s, f.tileID.toUnwrapped()), s.draw(t, _.TRIANGLES, u, p, m, e.b5.disabled, c, o.id, n, l, g, o.paint, d.zoom, r, [a]); } }, heatmap: function (t, i, o, r) { if (0 !== o.paint.get("heatmap-opacity")) if ("offscreen" === t.renderPass) { const s = t.context, n = s.gl, a = e.b6.disabled, l = new e.a([n.ONE, n.ONE, n.ONE, n.ONE], e.C.transparent, [!0, !0, !0, !0]); !function (e, t, i, o) { const r = e.gl, s = t.width * o, n = t.height * o; e.activeTexture.set(r.TEXTURE1), e.viewport.set([0, 0, s, n]); let a = i.heatmapFbo; if (!a || a && (a.width !== s || a.height !== n)) { a && a.destroy(); const t = r.createTexture(); r.bindTexture(r.TEXTURE_2D, t), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR), a = i.heatmapFbo = e.createFramebuffer(s, n, !0, null), function (e, t, i, o, r, s) { const n = e.gl; n.texImage2D(n.TEXTURE_2D, 0, e.extRenderToTextureHalfFloat ? n.RGBA16F : n.RGBA, r, s, 0, n.RGBA, e.extRenderToTextureHalfFloat ? n.HALF_FLOAT : n.UNSIGNED_BYTE, null), o.colorAttachment.set(i); }(e, 0, t, a, s, n); } else r.bindTexture(r.TEXTURE_2D, a.colorAttachment.get()), e.bindFramebuffer.set(a.framebuffer); }(s, t, o, "globe" === t.transform.projection.name ? .5 : .25), s.clear({ color: e.C.transparent }); const c = t.transform, h = "globe" === c.projection.name, _ = h ? ["PROJECTION_GLOBE_VIEW"] : [], d = h ? e.b5.frontCCW : e.b5.disabled, u = [e.E(c.center.lng), e.H(c.center.lat)]; for (let p = 0; p < r.length; p++) { const m = r[p]; if (i.hasRenderableParent(m)) continue; const f = i.getTile(m), g = f.getBucket(o); if (!g || g.projection.name !== c.projection.name) continue; const v = t.isTileAffectedByFog(m), x = g.programConfigurations.get(o.id), y = t.getOrCreateProgram("heatmap", { config: x, defines: _, overrideFog: v }), { zoom: b } = t.transform; t.terrain && t.terrain.setupElevationDraw(f, y), t.uploadCommonUniforms(s, y, m.toUnwrapped()); const w = c.projection.createInversionMatrix(c, m.canonical); y.draw(t, n.TRIANGLES, e.b4.disabled, a, l, d, eo(t, m, f, w, u, b, o.paint.get("heatmap-intensity")), o.id, g.layoutVertexBuffer, g.indexBuffer, g.segments, o.paint, t.transform.zoom, x, h ? [g.globeExtVertexBuffer] : null); } s.viewport.set([0, 0, t.width, t.height]); } else "translucent" === t.renderPass && (t.context.setColorMode(t.colorModeForRenderPass()), function (t, i) { const o = t.context, r = o.gl, s = i.heatmapFbo; if (!s) return; o.activeTexture.set(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, s.colorAttachment.get()), o.activeTexture.set(r.TEXTURE1); let n = i.colorRampTexture; n || (n = i.colorRampTexture = new e.a9(o, i.colorRamp, r.RGBA)), n.bind(r.LINEAR, r.CLAMP_TO_EDGE), t.getOrCreateProgram("heatmapTexture").draw(t, r.TRIANGLES, e.b4.disabled, e.b6.disabled, t.colorModeForRenderPass(), e.b5.disabled, ((e, t, i, o) => ({ u_image: 0, u_color_ramp: 1, u_opacity: t.paint.get("heatmap-opacity") }))(0, i), i.id, t.viewportBuffer, t.quadTriangleIndexBuffer, t.viewportSegments, i.paint, t.transform.zoom); }(t, o)); }, line: function (t, i, o, r) { if ("translucent" !== t.renderPass) return; const s = o.paint.get("line-opacity"), n = o.paint.get("line-width"); if (0 === s.constantOr(1) || 0 === n.constantOr(1)) return; const a = o.paint.get("line-emissive-strength"), l = t.depthModeForSublayer(0, e.b4.ReadOnly), c = t.colorModeForDrapableLayerRenderPass(a), h = t.terrain && t.terrain.renderingToTexture ? 1 : e.a4.devicePixelRatio, _ = o.paint.get("line-dasharray"), d = _.constantOr(1), u = o.layout.get("line-cap"), p = o.paint.get("line-pattern"), m = p.constantOr(1), f = o.paint.get("line-pattern").constantOr(1), g = 1 !== o.paint.get("line-opacity").constantOr(1); let v = !f && g; const x = o.paint.get("line-gradient"), y = m ? "linePattern" : "line", b = t.context, w = b.gl, T = e.bJ(o); t.terrain && t.terrain.clipOrMaskOverlapStencilType() && (v = !1); for (const s of r) { const r = i.getTile(s); if (m && !r.patternsLoaded()) continue; const n = r.getBucket(o); if (!n) continue; t.prepareDrawTile(); const a = n.programConfigurations.get(o.id), f = t.isTileAffectedByFog(s), g = t.getOrCreateProgram(y, { config: a, defines: T, overrideFog: f }), E = p.constantOr(null); if (E && r.imageAtlas) { const e = r.imageAtlas.patternPositions[E.toString()]; e && a.setConstantPatternPositions(e); } const C = _.constantOr(null), I = u.constantOr(null); if (!m && C && I && r.lineAtlas) { const e = r.lineAtlas.getDash(C, I); e && a.setConstantPatternPositions(e); } let [S, M] = o.paint.get("line-trim-offset"); if ("round" === I || "square" === I) { const e = 1; S !== M && (0 === S && (S -= e), 1 === M && (M += e)); } const L = t.terrain ? s.projMatrix : null, P = m ? e.bK(t, r, o, L, h) : e.bL(t, r, o, L, n.lineClipsArray.length, h, [S, M]); if (x) { const r = n.gradients[o.id]; let a = r.texture; if (o.gradientVersion !== r.version) { let l = 256; if (o.stepInterpolant) { const o = i.getSource().maxzoom, r = s.canonical.z === o ? Math.ceil(1 << t.transform.maxZoom - s.canonical.z) : 1; l = e.c(e.bM(n.maxLineLength / e.J * 1024 * r), 256, b.maxTextureSize); } r.gradient = e.bN({ expression: o.gradientExpression(), evaluationKey: "lineProgress", resolution: l, image: r.gradient || void 0, clips: n.lineClipsArray }), r.texture ? r.texture.update(r.gradient) : r.texture = new e.a9(b, r.gradient, w.RGBA), r.version = o.gradientVersion, a = r.texture; } b.activeTexture.set(w.TEXTURE1), a.bind(o.stepInterpolant ? w.NEAREST : w.LINEAR, w.CLAMP_TO_EDGE); } d && (b.activeTexture.set(w.TEXTURE0), r.lineAtlasTexture && r.lineAtlasTexture.bind(w.LINEAR, w.REPEAT), a.updatePaintBuffers()), m && (b.activeTexture.set(w.TEXTURE0), r.imageAtlasTexture && r.imageAtlasTexture.bind(w.LINEAR, w.CLAMP_TO_EDGE), a.updatePaintBuffers()), t.uploadCommonUniforms(b, g, s.toUnwrapped()); const D = i => { g.draw(t, w.TRIANGLES, l, i, c, e.b5.disabled, P, o.id, n.layoutVertexBuffer, n.indexBuffer, n.segments, o.paint, t.transform.zoom, a, [n.layoutVertexBuffer2]); }; if (v) { const i = t.stencilModeForClipping(s).ref; 0 === i && t.terrain && b.clear({ stencil: 0 }); const o = { func: w.EQUAL, mask: 255 }; P.u_alpha_discard_threshold = .8, D(new e.b6(o, i, 255, w.KEEP, w.KEEP, w.INVERT)), P.u_alpha_discard_threshold = 0, D(new e.b6(o, i, 255, w.KEEP, w.KEEP, w.KEEP)); } else D(t.stencilModeForClipping(s)); } v && (t.resetStencilClippingMasks(), t.terrain && b.clear({ stencil: 0 })); }, fill: function (t, i, o, r) { const s = o.paint.get("fill-color"), n = o.paint.get("fill-opacity"); if (0 === n.constantOr(1)) return; const a = o.paint.get("fill-emissive-strength"), l = t.colorModeForDrapableLayerRenderPass(a), c = o.paint.get("fill-pattern"), h = t.opaquePassEnabledForLayer() && !c.constantOr(1) && 1 === s.constantOr(e.C.transparent).a && 1 === n.constantOr(0) ? "opaque" : "translucent"; if (t.renderPass === h) { const s = t.depthModeForSublayer(1, "opaque" === t.renderPass ? e.b4.ReadWrite : e.b4.ReadOnly); Co(t, i, o, r, s, l, !1); } if ("translucent" === t.renderPass && o.paint.get("fill-antialias")) { const s = t.depthModeForSublayer(o.getPaintProperty("fill-outline-color") ? 2 : 0, e.b4.ReadOnly); Co(t, i, o, r, s, l, !0); } }
41, "fill-extrusion": function (t, i, o, r) { const s = o.paint.get("fill-extrusion-opacity"), n = t.context, a = n.gl, l = t.terrain, c = l && l.renderingToTexture; if (0 === s) return; const h = t.conflationActive && t.layerUsedInConflation(o, i.getSource()); if (h && function (e, t, i, o) { for (const r of o) { const o = t.getTile(r).getBucket(i); o && (o.updateReplacement(r, e.replacementSource), o.uploadCentroid(e.context)); } }(t, i, o, r), l || h) for (const e of r) { const r = i.getTile(e).getBucket(o); r && Mo(t.context, i, e, r, o, l, h); } if ("shadow" === t.renderPass && t.shadowRenderer) { const n = t.shadowRenderer; if (l && s < .65 && o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.am) return; const a = n.getShadowPassDepthMode(), c = n.getShadowPassColorMode(); Io(t, i, o, r, a, e.b6.disabled, c, h); } else if ("translucent" === t.renderPass) { const _ = !o.paint.get("fill-extrusion-pattern").constantOr(1), d = o.paint.get("fill-extrusion-color").constantOr(e.C.white); if (!c && 0 !== d.a) { const n = new e.b4(t.context.gl.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D); 1 === s && _ ? Io(t, i, o, r, n, e.b6.disabled, e.a.unblended, h) : (Io(t, i, o, r, n, e.b6.disabled, e.a.disabled, h), Io(t, i, o, r, n, t.stencilModeFor3D(), t.colorModeForRenderPass(), h), t.resetStencilClippingMasks()); } if (t.style.enable3dLights() && _ && (!l && "globe" !== t.transform.projection.name || c)) { const s = o.paint.get("fill-extrusion-opacity"), _ = o.paint.get("fill-extrusion-ambient-occlusion-intensity"), d = o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"), u = o.paint.get("fill-extrusion-flood-light-intensity"), p = o.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0, 3), m = _ > 0 && d > 0, f = u > 0, g = (e, t, i) => (1 - i) * e + i * t, v = n => { const l = t.depthModeForSublayer(1, e.b4.ReadOnly, a.LEQUAL, !0), c = o.paint.get(n ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), m = g(.1, 3, c), f = t._showOverdrawInspector; if (!f) { const c = new e.b6({ func: a.ALWAYS, mask: 255 }, 255, 255, a.KEEP, a.KEEP, a.REPLACE), f = new e.a([a.ONE, a.ONE, a.ONE, a.ONE], e.C.transparent, [!1, !1, !1, !0], a.MIN); So(t, i, o, r, l, c, f, e.b5.disabled, n, "sdf", s, _, d, u, p, m, h, !1); } { const c = f ? e.b6.disabled : new e.b6({ func: a.EQUAL, mask: 255 }, 255, 255, a.KEEP, a.DECR, a.DECR), g = f ? t.colorModeForRenderPass() : new e.a([a.ONE_MINUS_DST_ALPHA, a.DST_ALPHA, a.ONE, a.ONE], e.C.transparent, [!0, !0, !0, !0]); So(t, i, o, r, l, c, g, e.b5.disabled, n, "color", s, _, d, u, p, m, h, !1); } }; if (c) { const c = (n, l, c) => { const m = t.depthModeForSublayer(1, e.b4.ReadOnly, a.LEQUAL, !1), f = o.paint.get(n ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), v = g(.1, 3, f); { const c = new e.a([a.ONE, a.ONE, a.ONE, a.ONE], e.C.transparent, [!1, !1, !1, !0]); So(t, i, o, r, m, e.b6.disabled, c, e.b5.disabled, n, "clear", s, _, d, u, p, v, h, l); } { const c = new e.b6({ func: a.ALWAYS, mask: 255 }, 255, 255, a.KEEP, a.KEEP, a.REPLACE), f = new e.a([a.ONE, a.ONE, a.ONE, a.ONE], e.C.transparent, [!1, !1, !1, !0], a.MIN); So(t, i, o, r, m, c, f, e.b5.disabled, n, "sdf", s, _, d, u, p, v, h, l); } { const c = n ? a.ZERO : a.ONE_MINUS_DST_ALPHA, f = new e.b6({ func: a.EQUAL, mask: 255 }, 255, 255, a.KEEP, a.DECR, a.DECR), g = new e.a([c, a.DST_ALPHA, a.ONE_MINUS_DST_ALPHA, a.ZERO], e.C.transparent, [!0, !0, !0, !0]); So(t, i, o, r, m, f, g, e.b5.disabled, n, "color", s, _, d, u, p, v, h, l); } { const f = new e.a([a.ONE, a.ONE, a.ONE, n ? a.ZERO : a.ONE], e.C.transparent, [!1, !1, !1, !0], n ? a.FUNC_ADD : a.MAX); So(t, i, o, r, m, e.b6.disabled, f, e.b5.disabled, n, "clear", s, _, d, u, p, v, h, l, c); } }; if (m || f) { let i; if (t.prepareDrawTile(), l) { const t = l.drapeBufferSize[0], o = l.drapeBufferSize[1]; i = l.framebufferCopyTexture, i && (!i || i.size[0] === t && i.size[1] === o) || (i && i.destroy(), i = l.framebufferCopyTexture = new e.a9(n, new e.a5({ width: t, height: o }), a.RGBA)), i.bind(a.LINEAR, a.CLAMP_TO_EDGE), a.copyTexImage2D(a.TEXTURE_2D, 0, a.RGBA, 0, 0, t, o, 0); } m && c(!0, !1, i), f && c(!1, !0, i); } } else m && v(!0), f && v(!1); } } }, hillshade: function (t, i, o, r) { if ("offscreen" !== t.renderPass && "translucent" !== t.renderPass) return; if (t.style.disableElevatedTerrain) return; const s = t.context, n = t.terrain && t.terrain.renderingToTexture, [a, l] = "translucent" !== t.renderPass || n ? [{}, r] : t.stencilConfigForOverlap(r); for (const r of l) { const s = i.getTile(r); if (s.needsHillshadePrepare && "offscreen" === t.renderPass) wi(t, s, o); else if ("translucent" === t.renderPass) { const i = t.depthModeForSublayer(0, e.b4.ReadOnly), l = o.paint.get("hillshade-emissive-strength"), c = t.colorModeForDrapableLayerRenderPass(l), h = n && t.terrain ? t.terrain.stencilModeForRTTOverlap(r) : a[r.overscaledZ]; yi(t, r, s, o, i, h, c); } } s.viewport.set([0, 0, t.width, t.height]), t.resetStencilClippingMasks(); }, raster: function (t, i, o, r, s, n) { if ("translucent" !== t.renderPass) return; if (0 === o.paint.get("raster-opacity")) return; const a = t.context, l = a.gl, c = i.getSource(), h = function (t, i, o) { const r = t.paint.get("raster-color"), s = [], n = t.paint.get("raster-resampling"), a = t.paint.get("raster-color-mix"), l = t.paint.get("raster-color-range"), c = [a[0], a[1], a[2], 0], h = a[3], _ = "nearest" === n ? o.NEAREST : o.LINEAR; if (r && s.push("RASTER_COLOR"), r) { i.activeTexture.set(o.TEXTURE2); let r = t.colorRampTexture; r || (r = t.colorRampTexture = new e.a9(i, t.colorRamp, o.RGBA)), r.bind(o.LINEAR, o.CLAMP_TO_EDGE); } return { mix: c, range: l, offset: h, defines: s, resampling: _ } }(o, a, l), _ = h.defines, d = "globe" === t.transform.projection.name; let u = !1; if (c instanceof e.aK && !r.length) { if (!d) return; if (c.onNorthPole) u = !0, _.push("GLOBE_POLES"); else { if (!c.onSouthPole) return; u = !0, _.push("GLOBE_POLES"); } } const p = o.paint.get("raster-emissive-strength"), m = t.colorModeForDrapableLayerRenderPass(p), f = t.terrain && t.terrain.renderingToTexture, g = c instanceof e.aK && 0 !== o.paint.get("raster-elevation"), v = !t.options.moving, x = "nearest" === o.paint.get("raster-resampling") ? l.NEAREST : l.LINEAR; if (u) { const r = i.getSource(); if (!(r instanceof e.aK)) return; const s = r.texture; if (!s) return; const n = t.globeSharedBuffers; if (!n) return; const c = new e.b4(l.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D), _ = Float32Array.from(t.transform.expandedFarZProjMatrix); let d = e.bj(0, 0, t.transform); const u = Float32Array.from(e.bh(e.bi(new e.t(0, 0, 0)))), f = { opacity: 1, mix: 0 }; t.terrain && t.terrain.prepareDrawTile(), a.activeTexture.set(l.TEXTURE0), s.bind(x, l.CLAMP_TO_EDGE), a.activeTexture.set(l.TEXTURE1), s.bind(x, l.CLAMP_TO_EDGE), s.useMipmap && a.extTextureFilterAnisotropic && t.transform.pitch > 20 && l.texParameterf(l.TEXTURE_2D, a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, a.extTextureFilterAnisotropicMax); const [g, v, y, b] = n.getPoleBuffers(0, !0); let w; r.onNorthPole ? (w = g, t.renderDefaultNorthPole = !1) : (d = e.m.scale(e.m.create(), d, [1, -1, 1]), w = v, t.renderDefaultSouthPole = !1); const T = ((e, t, i, o, r, s, n, a, l, c, h, _) => to(e, t, i, new Float32Array(16), new Float32Array(9), [0, 0], 0, [0, 0], [0, 0, 0, 0], 1, o, r, [0, 0] || [0, 0], n, 2, l, c, h, 1, 0, _))(_, u, d, f, o, 0, o.paint.get("raster-elevation"), 0, h.mix, h.offset, h.range, p), E = t.getOrCreateProgram("raster", { defines: h.defines }); return t.uploadCommonUniforms(a, E, null), void E.draw(t, l.TRIANGLES, c, e.b6.disabled, m, e.b5.disabled, T, o.id, w, y, b) } if (!r.length) return; const [y, b] = c instanceof e.aK || f ? [{}, r] : t.stencilConfigForOverlap(r), w = b[b.length - 1].overscaledZ, T = g && d; T && h.defines.push("PROJECTION_GLOBE_VIEW"), g && h.defines.push("RENDER_CUTOFF"); for (const r of b) { const s = r.toUnwrapped(), _ = i.getTile(r); if (f && (!_ || !_.hasData())) continue; if (!_.texture) continue; let u, b; f ? (u = e.b4.disabled, b = r.projMatrix) : g ? (u = new e.b4(l.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D), b = d ? Float32Array.from(t.transform.expandedFarZProjMatrix) : t.transform.calculateProjMatrix(s, v)) : (u = t.depthModeForSublayer(r.overscaledZ - w, 1 === o.paint.get("raster-opacity") ? e.b4.ReadWrite : e.b4.ReadOnly, l.LESS), b = t.transform.calculateProjMatrix(s, v)); const E = t.terrain && f ? t.terrain.stencilModeForRTTOverlap(r) : y[r.overscaledZ], C = n ? 0 : o.paint.get("raster-fade-duration"); _.registerFadeDuration(C); const I = i.findLoadedParent(r, 0), S = Ri(_, I, i, t.transform, C); let M, L; t.terrain && t.terrain.prepareDrawTile(), a.activeTexture.set(l.TEXTURE0), _.texture && _.texture.bind(x, l.CLAMP_TO_EDGE), a.activeTexture.set(l.TEXTURE1), I ? (I.texture && I.texture.bind(x, l.CLAMP_TO_EDGE), M = Math.pow(2, I.tileID.overscaledZ - _.tileID.overscaledZ
41), L = [_.tileID.canonical.x * M % 1, _.tileID.canonical.y * M % 1]) : _.texture && _.texture.bind(x, l.CLAMP_TO_EDGE), _.texture && _.texture.useMipmap && a.extTextureFilterAnisotropic && t.transform.pitch > 20 && l.texParameterf(l.TEXTURE_2D, a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, a.extTextureFilterAnisotropicMax); const P = t.transform; let D; const A = g ? Ro(P) : [0, 0, 0, 0]; let R, z, O, F, B; T && c instanceof e.aK && c.coordinates.length > 3 ? (R = Float32Array.from(e.bh(e.bi(new e.t(0, 0, 0)))), z = Float32Array.from(P.globeMatrix), O = Float32Array.from(e.bc(P)), F = [e.E(P.center.lng), e.H(P.center.lat)], D = c.elevatedGlobePerspectiveTransform, B = c.elevatedGlobeGridMatrix || new Float32Array(9)) : (D = c instanceof e.aK ? c.perspectiveTransform : [0, 0], R = new Float32Array(16), z = new Float32Array(9), O = new Float32Array(16), F = [0, 0], B = new Float32Array(9)); const k = to(b, R, z, O, B, L || [0, 0], e.ao(t.transform.zoom), F, A, M || 1, S, o, D, g ? o.paint.get("raster-elevation") : 0, 2, h.mix, h.offset, h.range, 1, 0, p), N = t.isTileAffectedByFog(r), U = t.getOrCreateProgram("raster", { defines: h.defines, overrideFog: N }); if (t.uploadCommonUniforms(a, U, s), c instanceof e.aK) { const i = c.elevatedGlobeVertexBuffer, r = c.elevatedGlobeIndexBuffer; if (f || !d) c.boundsBuffer && c.boundsSegments && U.draw(t, l.TRIANGLES, u, e.b6.disabled, m, e.b5.disabled, k, o.id, c.boundsBuffer, t.quadTriangleIndexBuffer, c.boundsSegments); else if (i && r) { const s = P.zoom <= e.Z ? c.elevatedGlobeSegments : c.getSegmentsForLongitude(P.center.lng); s && (U.draw(t, l.TRIANGLES, u, e.b6.disabled, m, e.b5.backCW, k, o.id, i, r, s), U.draw(t, l.TRIANGLES, u, e.b6.disabled, m, e.b5.frontCW, k, o.id, i, r, s)); } } else { const { tileBoundsBuffer: i, tileBoundsIndexBuffer: r, tileBoundsSegments: s } = t.getTileBoundsBuffers(_); U.draw(t, l.TRIANGLES, u, E, m, e.b5.disabled, k, o.id, i, r, s); } } t.resetStencilClippingMasks(); }, background: function (t, i, o, r) { const s = o.paint.get("background-color"), n = o.paint.get("background-opacity"), a = o.paint.get("background-emissive-strength"); if (0 === n) return; const l = t.context, c = l.gl, h = t.transform, _ = h.tileSize, d = o.paint.get("background-pattern"); if (t.isPatternMissing(d, o.scope)) return; const u = !d && 1 === s.a && 1 === n && t.opaquePassEnabledForLayer() ? "opaque" : "translucent"; if (t.renderPass !== u) return; const p = e.b6.disabled, m = t.depthModeForSublayer(0, "opaque" === u ? e.b4.ReadWrite : e.b4.ReadOnly), f = t.colorModeForDrapableLayerRenderPass(a), g = d ? "backgroundPattern" : "background"; let v, x = r; x || (v = t.getBackgroundTiles(), x = Object.values(v).map((e => e.tileID))), d && (l.activeTexture.set(c.TEXTURE0), t.imageManager.bind(t.context, o.scope)); for (const u of x) { const x = t.isTileAffectedByFog(u), y = t.getOrCreateProgram(g, { overrideFog: x }), b = u.toUnwrapped(), w = r ? u.projMatrix : t.transform.calculateProjMatrix(b); t.prepareDrawTile(); const T = i ? i.getTile(u) : v ? v[u.key] : new e.bt(u, _, h.zoom, t), E = d ? ho(w, a, n, t, d, o.scope, { tileID: u, tileSize: _ }) : co(w, a, n, s); t.uploadCommonUniforms(l, y, b); const { tileBoundsBuffer: C, tileBoundsIndexBuffer: I, tileBoundsSegments: S } = t.getTileBoundsBuffers(T); y.draw(t, c.TRIANGLES, m, p, f, e.b5.disabled, E, o.id, C, I, S); } }, sky: function (t, i, o) { const r = t._atmosphere ? e.ao(t.transform.zoom) : 1, s = o.paint.get("sky-opacity") * r; if (0 === s) return; const n = t.context, a = o.paint.get("sky-type"), l = new e.b4(n.gl.LEQUAL, e.b4.ReadOnly, [0, 1]), c = t.frameCounter / 1e3 % 1; "atmosphere" === a ? "offscreen" === t.renderPass ? o.needsSkyboxCapture(t) && (function (t, i, o, r) { const s = t.context, n = s.gl; let a = i.skyboxFbo; if (!a) { a = i.skyboxFbo = s.createFramebuffer(32, 32, !0, null), i.skyboxGeometry = new Ho(s), i.skyboxTexture = s.gl.createTexture(), n.bindTexture(n.TEXTURE_CUBE_MAP, i.skyboxTexture), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MAG_FILTER, n.LINEAR); for (let e = 0; e < 6; ++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + e, 0, n.RGBA, 32, 32, 0, n.RGBA, n.UNSIGNED_BYTE, null); } s.bindFramebuffer.set(a.framebuffer), s.viewport.set([0, 0, 32, 32]); const l = i.getCenter(t, !0), c = t.getOrCreateProgram("skyboxCapture"), h = new Float64Array(16); e.m.identity(h), e.m.rotateY(h, h, .5 * -Math.PI), qo(t, i, c, h, l, 0), e.m.identity(h), e.m.rotateY(h, h, .5 * Math.PI), qo(t, i, c, h, l, 1), e.m.identity(h), e.m.rotateX(h, h, .5 * -Math.PI), qo(t, i, c, h, l, 2), e.m.identity(h), e.m.rotateX(h, h, .5 * Math.PI), qo(t, i, c, h, l, 3), e.m.identity(h), qo(t, i, c, h, l, 4), e.m.identity(h), e.m.rotateY(h, h, Math.PI), qo(t, i, c, h, l, 5), s.viewport.set([0, 0, t.width, t.height]); }(t, o), o.markSkyboxValid(t)) : "sky" === t.renderPass && function (t, i, o, r, s) { const n = t.context, a = n.gl, l = t.transform, c = t.getOrCreateProgram("skybox"); n.activeTexture.set(a.TEXTURE0), a.bindTexture(a.TEXTURE_CUBE_MAP, i.skyboxTexture); const h = ((e, t, i, o, r) => ({ u_matrix: e, u_sun_direction: t, u_cubemap: 0, u_opacity: o, u_temporal_offset: r }))(l.skyboxMatrix, i.getCenter(t, !1), 0, r, s); t.uploadCommonUniforms(n, c), c.draw(t, a.TRIANGLES, o, e.b6.disabled, t.colorModeForRenderPass(), e.b5.backCW, h, "skybox", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); }
vendor: 4,902 bytes, line 41
41(t, o, l, s, c) : "gradient" === a && "sky" === t.renderPass && function (t, i, o, r, s) { const n = t.context, a = n.gl, l = t.transform, c = t.getOrCreateProgram("skyboxGradient"); i.skyboxGeometry || (i.skyboxGeometry = new Ho(n)), n.activeTexture.set(a.TEXTURE0); let h = i.colorRampTexture; h || (h = i.colorRampTexture = new e.a9(n, i.colorRamp, a.RGBA)), h.bind(a.LINEAR, a.CLAMP_TO_EDGE); const _ = ((t, i, o, r, s) => ({ u_matrix: t, u_color_ramp: 0, u_center_direction: i, u_radius: e.d(o), u_opacity: r, u_temporal_offset: s }))(l.skyboxMatrix, i.getCenter(t, !1), i.paint.get("sky-gradient-radius"), r, s); t.uploadCommonUniforms(n, c), c.draw(t, a.TRIANGLES, o, e.b6.disabled, t.colorModeForRenderPass(), e.b5.backCW, _, "skyboxGradient", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); }(t, o, l, s, c); }, debug: function (t, i, o, r, s) { for (let n = 0; n < o.length; n++)if (s) { const s = 1, a = .8, l = new e.C(r.r * a, r.g * a, r.b * a, 1); No(t, i, o[n], r, -s, -s), No(t, i, o[n], r, -s, s), No(t, i, o[n], r, s, s), No(t, i, o[n], r, s, -s), No(t, i, o[n], l, 0, 0); } else No(t, i, o[n], r, 0, 0); }, custom: function (t, i, o, r) { const s = t.context, n = o.implementation; if (!t.transform.projection.unsupportedLayers || !t.transform.projection.unsupportedLayers.includes("custom") || t.terrain && (t.terrain.renderingToTexture || "offscreen" === t.renderPass) && o.isLayerDraped(i)) { if ("offscreen" === t.renderPass) { const i = n.prerender; if (i) { if (t.setCustomLayerDefaults(), s.setColorMode(t.colorModeForRenderPass()), "globe" === t.transform.projection.name) { const o = t.transform.pointMerc; i.call(n, s.gl, t.transform.customLayerMatrix(), t.transform.getProjection(), t.transform.globeToMercatorMatrix(), e.ao(t.transform.zoom), [o.x, o.y], t.transform.pixelsPerMeterRatio); } else i.call(n, s.gl, t.transform.customLayerMatrix()); s.setDirty(), t.setBaseState(); } } else if ("translucent" === t.renderPass) { if (t.terrain && t.terrain.renderingToTexture) { const i = n.renderToTile; if (i) { const o = r[0].canonical, a = new e.M(o.x + r[0].wrap * (1 << o.z), o.y, o.z); s.setDepthMode(e.b4.disabled), s.setStencilMode(e.b6.disabled), s.setColorMode(t.colorModeForRenderPass()), t.setCustomLayerDefaults(), i.call(n, s.gl, a), s.setDirty(), t.setBaseState(); } return } t.setCustomLayerDefaults(), s.setColorMode(t.colorModeForRenderPass()), s.setStencilMode(e.b6.disabled); const i = "3d" === n.renderingMode ? new e.b4(t.context.gl.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D) : t.depthModeForSublayer(0, e.b4.ReadOnly); if (s.setDepthMode(i), "globe" === t.transform.projection.name) { const i = t.transform.pointMerc; n.render(s.gl, t.transform.customLayerMatrix(), t.transform.getProjection(), t.transform.globeToMercatorMatrix(), e.ao(t.transform.zoom), [i.x, i.y], t.transform.pixelsPerMeterRatio); } else n.render(s.gl, t.transform.customLayerMatrix()); s.setDirty(), t.setBaseState(), s.bindFramebuffer.set(null); } } else e.X("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers."); }, model: function (t, i, o, r) { if ("opaque" === t.renderPass) return; const s = o.paint.get("model-opacity"); if (0 === s) return; const n = o.paint.get("model-cast-shadows"); if ("shadow" === t.renderPass) { if (!n) return; if (t.terrain && s < .65 && o._transitionablePaint._values["model-opacity"].value.expression instanceof e.am) return } const a = t.shadowRenderer, l = o.paint.get("model-receive-shadows"); a && (a.useNormalOffset = !0, l || (a.enabled = !1)); const c = () => { a && (a.useNormalOffset = !0, l || (a.enabled = !0)); }, h = i.getSource(); if ("light-beam" === t.renderPass && "batched-model" !== h.type) return; if ("vector" === h.type || "geojson" === h.type) return function (t, i, o, r) { const s = t.transform; if ("mercator" !== s.projection.name) return void e.X(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`); const n = s.getFreeCameraOptions().position; if (!t.modelManager) return; const a = t.modelManager, l = t.shadowRenderer; if (!o._unevaluatedLayout._values.hasOwnProperty("model-id")) return; const c = o._unevaluatedLayout._values["model-id"], h = { ...o.layout.get("model-id").parameters }; for (const _ of r) { const r = i.getTile(_).getBucket(o); if (!r || r.projection.name !== s.projection.name) continue; const d = nr(_, s); h.zoom = d; const u = c.possiblyEvaluate(h); if (rr(t, r, _), sr.shadowUniformsInitialized = !1, sr.useSingleShadowCascade = !!l && 0 === l.getMaxCascadeForTile(_.toUnwrapped()), "shadow" === t.renderPass && l) { if (1 === t.currentShadowCascade && r.isInsideFirstShadowMapFrustum) continue; const i = s.calculatePosMatrix(_.toUnwrapped(), s.worldSize); if (sr.tileMatrix.set(i), sr.shadowTileMatrix = Float32Array.from(l.calculateShadowPassMatrixFromMatr
41ix(i)), sr.aabb.min.fill(0), sr.aabb.max[0] = sr.aabb.max[1] = e.J, sr.aabb.max[2] = 0, cr(r, sr, t, o.scope)) continue } const p = 1 << _.canonical.z, m = [((n.x - _.wrap) * p - _.canonical.x) * e.J, (n.y * p - _.canonical.y) * e.J, n.z * p * e.J]; for (let e in r.instancesPerModel) { const i = r.instancesPerModel[e]; i.features.length > 0 && (e = u.evaluate(i.features[0].feature, {})); const s = a.getModel(e, o.scope); if (s && s.uploaded) for (const e of s.nodes) ar(t, o, e, i, m, _, sr); } } }(t, i, o, r), void c(); if (!h.loaded()) return; if ("batched-model" === h.type) return function (t, i, o, r) { const s = t.context, n = t.transform, a = t.style.fog, l = t.shadowRenderer; if ("mercator" !== n.projection.name) return void e.X(`Drawing 3D landmark models for ${n.projection.name} projection is not yet implemented`); const c = t.transform.getFreeCameraOptions().position, h = e.v.scale([], [c.x, c.y, c.z], t.transform.worldSize); e.v.negate(h, h); const _ = e.m.identity([]), d = e.c4(n.center.lat, n.zoom), u = e.m.fromScaling([], [1, 1, 1 / d]); e.m.translate(_, _, h); const p = o.paint.get("model-opacity"), m = new e.b4(s.gl.LEQUAL, e.b4.ReadWrite, t.depthRangeFor3D), f = new e.b4(s.gl.LEQUAL, e.b4.ReadOnly, t.depthRangeFor3D), g = function (c, h) { for (const d of r) { const r = i.getTile(d).getBucket(o); if (!r || !r.uploaded) continue; let g = !1; l && (g = 0 === l.getMaxCascadeForTile(d.toUnwrapped())); const v = n.calculatePosMatrix(d.toUnwrapped(), n.worldSize), x = r.modelTraits; for (const i of r.getNodesInfo()) { if (i.hiddenByReplacement) continue; if (!i.node.meshes) continue; const r = i.node, y = "light-beam" === t.renderPass, b = [...v], w = i.evaluatedScale; let T = 0; t.terrain && r.elevation && (T = r.elevation * t.terrain.exaggeration()), e.m.translate(b, b, [(r.anchor ? r.anchor[0] : 0) * (w[0] - 1), (r.anchor ? r.anchor[1] : 0) * (w[1] - 1), T]), w !== e.c6 && e.m.scale(b, b, w), e.m.multiply(b, b, r.matrix); const E = e.m.multiply([], u, b); e.m.multiply(E, _, E); const C = e.m.invert([], E); e.m.transpose(C, C), e.m.scale(C, C, lr); const I = e.m.multiply([], n.expandedFarZProjMatrix, b), S = x & e.c8.HasMapboxMeshFeatures, M = S ? 0 : i.evaluatedRMEA[0][2]; for (let _ = 0; _ < r.meshes.length; ++_) { const u = r.meshes[_], v = _ === r.lightMeshIndex; if (v) { if (!y && !t.terrain && t.shadowRenderer) { t.currentLayer < t.firstLightBeamLayer && (t.firstLightBeamLayer = t.currentLayer); continue } } else if (y) continue; const x = { defines: [] }, w = []; er(x.defines, w, u, t), S || x.defines.push("DIFFUSE_SHADED"), g && x.defines.push("SHADOWS_SINGLE_CASCADE"); const T = "shadow" === t.renderPass; if (T) { or(u, b, t, o); continue } let L = null; if (a) { const e = Qo(b, t.transform); if (L = new Float32Array(e), "globe" !== n.projection.name) { const t = u.aabb.min, i = u.aabb.max, [o, r] = a.getOpacityForBounds(e, t[0], t[1], i[0], i[1]); x.overrideFog = o >= Ue || r >= Ue; } } const P = t.getOrCreateProgram("model", x); !T && l && (l.useNormalOffset = !!u.normalBuffer, l.setupShadowsFromMatrix(b, P, l.useNormalOffset)), t.uploadCommonUniforms(s, P, d.toUnwrapped(), L); const D = u.material, A = D.pbrMetallicRoughness; A.metallicFactor = .9, A.roughnessFactor = .5; const R = uo(new Float32Array(I), new Float32Array(E), new Float32Array(C), t, p, A.baseColorFactor, D.emissiveFactor, A.metallicFactor, A.roughnessFactor, D, M, o); P.draw(t, s.gl.TRIANGLES, h && !v ? m : f, e.b6.disabled, c ? v || p < 1 || i.hasTranslucentParts ? e.a.alphaBlended : e.a.unblended : e.a.disabled, e.b5.backCCW, R, o.id, u.vertexBuffer, u.indexBuffer, u.segments, o.paint, t.transform.zoom, void 0, w); } } } }; ((function (e, t, i, o) { const r = e.terrain ? e.terrain.exaggeration() : 0, s = e.transform.zoom; for (const n of o) { const o = t.getTile(n).getBucket(i); o && (e.conflationActive && o.updateReplacement(n, e.replacementSource), o.evaluateScale(e, i), e.terrain && r > 0 && o.elevationUpdate(e.terrain, r, n, i.source), o.needsReEvaluation(e, s, i) && o.evaluate(i)); } }))(t, i, o, r), 1 === p ? g(!0, !0) : (g(!1, !0), g(!0, !1)); }(t, i, o, r), void c(); const _ = h.getModels(), d = [], u = t.transform.getFreeCameraOptions().position, p 
41= e.v.scale([], [u.x, u.y, u.z], t.transform.worldSize); e.v.negate(p, p); const m = [], f = []; let g = 0; for (const i of _) { const r = o.paint.get("model-rotation").constantOr(null), s = o.paint.get("model-scale").constantOr(null), n = o.paint.get("model-translation").constantOr(null); i.computeModelMatrix(t, r, s, n, !0, !0, !1); const a = e.m.identity([]), l = e.c4(i.position.lat, t.transform.zoom), c = e.m.fromScaling([], [1, 1, 1 / l]); e.m.translate(a, a, p), d.push({ zScaleMatrix: c, negCameraPosMatrix: a }); for (const e of i.nodes) ir(t.transform, e, i.matrix, t.transform.expandedFarZProjMatrix, g, m, f); g++; } if (m.sort(((e, t) => t.depth - e.depth)), "shadow" !== t.renderPass) { if (1 === s) for (const i of f) tr(i, t, o, d[i.modelIndex], e.b6.disabled, t.colorModeForRenderPass()); else { for (const i of f) tr(i, t, o, d[i.modelIndex], e.b6.disabled, e.a.disabled); for (const e of f) tr(e, t, o, d[e.modelIndex], t.stencilModeFor3D(), t.colorModeForRenderPass()); t.resetStencilClippingMasks(); } for (const i of m) tr(i, t, o, d[i.modelIndex], e.b6.disabled, t.colorModeForRenderPass()); c(); } else { for (const e of f) or(e.mesh, e.nodeModelMatrix, t, o); for (const e of m) or(e.mesh, e.nodeModelMatrix, t, o); c(); } } }, pr = { modelUpload: function (e, t, i) { const o = t.getSource(); if (!o.loaded()) return; if ("vector" === o.type || "geojson" === o.type) return void (e.modelManager && e.modelManager.upload(e, i)); if ("batched-model" === o.type) return; const r = o.getModels(); for (const t of r) t.upload(e.context); } }; class mr { constructor(t, i, o, r) { this.context = new se(t, i), this.transform = o, this._tileTextures = {}, this.frameCopies = [], this.loadTimeStamps = [], this.tp = r, this._debugParams = { showTerrainProxyTiles: !1 }, r.registerParameter(this._debugParams, ["Terrain"], "showTerrainProxyTiles", {}, (() => { this.style.map.triggerRepaint(); })), this.setup(), this.numSublayers = e.bq.maxUnderzooming + e.bq.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.deferredRenderGpuTimeQueries = [], this.gpuTimers = {}, this.frameCounter = 0, this._backgroundTiles = {}, this.conflationActive = !1, this.replacementSource = new e.ca, this.longestCutoffRange = 0, this.minCutoffZoom = 0, this._fogVisible = !1, this._cachedTileFogOpacities = {}, this._shadowRenderer = new xr(this), this._wireframeDebugCache = new _r, this.renderDefaultNorthPole = !0, this.renderDefaultSouthPole = !0; } updateTerrain(e, t) { const i = !!e && !!e.terrain && this.transform.projection.supportsTerrain; if (!(i || this._terrain && this._terrain.enabled)) return; this._terrain || (this._terrain = new Bi(this, e)); const o = this._terrain; this.transform.elevation = i ? o : null, o.update(e, this.transform, t), this.transform.elevation && !o.enabled && (this.transform.elevation = null); } _updateFog(e) { const t = e.fog; if (!t || "globe" === this.transform.projection.name || t.getOpacity(this.transform.pitch) < 1 || t.properties.get("horizon-blend") < .03) return void (this.transform.fogCullDistSq = null); const [i, o] = t.getFovAdjustedRange(this.transform._fov); if (i > o) return void (this.transform.fogCullDistSq = null); const r = i + .78 * (o - i); this.transform.fogCullDistSq = r * r; } get terrain() { return this.transform._terrainEnabled() && this._terrain && this._terrain.enabled ? this._terrain : null } get shadowRenderer() { return this._shadowRenderer && this._shadowRenderer.enabled ? this._shadowRenderer : null } get wireframeDebugCache() { return this._wireframeDebugCache } resize(t, i) { if (this.width = t * e.a4.devicePixelRatio, this.height = i * e.a4.devicePixelRatio, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (const e of this.style.order) this.style._mergedLayers[e].resize(); } setup() { const t = this.context, i = new e.bo; i.emplaceBack(0, 0), i.emplaceBack(e.J, 0), i.emplaceBack(0, e.J), i.emplaceBack(e.J, e.J), this.tileExtentBuffer = t.createVertexBuffer(i, e.bl.members), this.tileExtentSegments = e.bm.simpleSegment(0, 0, 4, 2); const o = new e.bo; o.emplaceBack(0, 0), o.emplaceBack(e.J, 0), o.emplaceBack(0, e.J), o.emplaceBack(e.J, e.J), this.debugBuffer = t.createVertexBuffer(o, e.bl.members), this.debugSegments = e.bm.simpleSegment(0, 0, 4, 5); const r = new e.bo; r.emplaceBack(-1, -1), r.emplaceBack(1, -1), r.emplaceBack(-1, 1), r.emplaceBack(1, 1), this.viewportBuffer = t.createVertexBuffer(r, e.bl.members), this.viewportSegments = e.bm.simpleSegment(0, 0, 4, 2); const s = new e.cb; s.emplaceBack(0, 0, 0, 0), s.emplaceBack(e.J, 0, e.J, 0), s.emplaceBack(0, e.J, 0, e.J), s.emplaceBack(e.J, e.J, e.J, e.J), this.mercatorBoundsBuffer = t.createVertexBuffer(s, e.cc.members), this.mercatorBoundsSegments = e.bm.simpleSegment(0, 0, 4, 2); const n = new e.bp; n.emplaceBack(0, 1, 2), n.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = t.createIndexBuffer(n); const a = new e.cd; for (const e of [0, 1, 3, 2, 0]) a.emplaceBack(e); this.debugIndexBuffer = t.createIndexBuffer(a), this.emptyTexture = new e.a9(t, new e.a5({ width: 1, height: 1 }, Uint8Array.of(0, 0, 0, 0)), t.gl.RGBA), this.identityMat = e.m.create(); const l = this.context.gl; this.stencilClearMode = new e.b6({ func: l.ALWAYS, mask: 0 }, 0, 255, l.ZERO, l.ZERO, l.ZERO), this.loadTimeStamps.push(performance.now()); } getMercatorTileBoundsBuffers() { return { tileBoundsBuffer: this.mercatorBoundsBuffer, tileBoundsIndexBuffer: this.quadTriangleIndexBuffer, tileBoundsSegments: this.mercatorBoundsSegments } } getTileBoundsBuffers(e) { return e._makeTileBoundsBuffers(this.context, this.transform.projection), e._tileBoundsBuffer ? { tileBoundsBuffer: e._tileBoundsBuffer, tileBoundsIndexBuffer: e._tileBoundsIndexBuffer, tileBoundsSegments: e._tileBoundsSegments } : this.getMercatorTileBoundsBuffers() } clearStencil() { const t = this.context.gl; this.nextStencilID = 1, this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}, this.getOrCreateProgram("clippingMask").draw(this, t.TRIANGLES, e.b4.disabled, this.stencilClearMode, e.a.disabled, e.b5.disabled, Ai(this.identityMat), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments); } resetStencilClippingMasks() { this.terrain || (this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}); } _renderTileClippingMasks(t, i, o) { if (!i || this.currentStencilSource === i.id || !t.isTileClipped() || !o || 0 === o.length) return; if (this._tileClippingMaskIDs && !this.terrain) { let e = !1; for (const t of o) if (void 0 === this._tileClippingMaskIDs[t.key]) { e = !0; break } if (!e) return } this.currentStencilSource = i.id; const r = this.context, s = r.gl; this.nextStencilID + o.length > 256 && this.clearStencil(), r.setColorMode(e.a.disabled), r.setDepthMode(e.b4.disabled); const n = this.getOrCreateProgram("clippingMask"); this._tileClippingMaskIDs = {}; for (const t of o) { const o = i.getTile(t), r = this._tileClippingMaskIDs[t.key] = this.nextStencilID++, { tileBoundsBuffer: a, tileBoundsIndexBuffer: l, tileBoundsSegments: c } = this.getTileBoundsBuffers(o); n.draw(this, s.TRIANGLES, e.b4.disabled, new e.b6({ func: s.ALWAYS, mask: 0 }, r, 255, s.KEEP, s.KEEP, s.REPLACE), e.a.disabled, e.b5.disabled, Ai(t.projMatrix), "$clipping", a, l, c); } } stencilModeFor3D() { this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil(); const t = this.nextStencilID++, i = this.context.gl; return new e.b6({ func: i.NOTEQUAL, mask: 255 }, t, 255, i.KEEP, i.KEEP, i.REPLACE) } stencilModeForClipping(t) { if (this.terrain) return this.terrain.stencilModeForRTTOverlap(t); const i = this.context.gl; return new e.b6({ func: i.EQUAL, mask: 255 }, this._tileClippingMaskIDs[t.key], 0, i.KEEP, i.KEEP, i.REPLACE) } stencilConfigForOverlap(t) { const i = this.context.gl, o = t.sort(((e, t) =>
41 t.overscaledZ - e.overscaledZ)), r = o[o.length - 1].overscaledZ, s = o[0].overscaledZ - r + 1; if (s > 1) { this.currentStencilSource = void 0, this.nextStencilID + s > 256 && this.clearStencil(); const t = {}; for (let o = 0; o < s; o++)t[o + r] = new e.b6({ func: i.GEQUAL, mask: 255 }, o + this.nextStencilID, 255, i.KEEP, i.KEEP, i.REPLACE); return this.nextStencilID += s, [t, o] } return [{ [r]: e.b6.disabled }, o] } colorModeForRenderPass() { const t = this.context.gl; if (this._showOverdrawInspector) { const i = 1 / 8; return new e.a([t.CONSTANT_COLOR, t.ONE, t.CONSTANT_COLOR, t.ONE], new e.C(i, i, i, 0), [!0, !0, !0, !0]) } return "opaque" === this.renderPass ? e.a.unblended : e.a.alphaBlended } colorModeForDrapableLayerRenderPass(t) { const i = this.context.gl; return (() => this.style && this.style.enable3dLights() && this.terrain && this.terrain.renderingToTexture)() && "translucent" === this.renderPass ? new e.a([i.ONE, i.ONE_MINUS_SRC_ALPHA, i.CONSTANT_ALPHA, i.ONE_MINUS_SRC_ALPHA], new e.C(0, 0, 0, void 0 === t ? 0 : t), [!0, !0, !0, !0]) : this.colorModeForRenderPass() } depthModeForSublayer(t, i, o, r = !1) { if (!this.opaquePassEnabledForLayer() && !r) return e.b4.disabled; const s = 1 - ((1 + this.currentLayer) * this.numSublayers + t) * this.depthEpsilon; return new e.b4(o || this.context.gl.LEQUAL, i, [s, s]) } opaquePassEnabledForLayer() { return this.currentLayer < this.opaquePassCutoff } render(t, i) { this._wireframeDebugCache.update(this.frameCounter), this.style = t, this.options = i; const o = this.style._mergedLayers, r = this.style.order, s = r.map((e => o[e])), n = this.style._mergedSourceCaches; this.imageManager = t.imageManager, this.modelManager = t.modelManager, this.symbolFadeChange = t.placement.symbolFadeChange(e.a4.now()), this.imageManager.beginFrame(); let a = 0, l = !1; for (const e in n) { const t = n[e]; t.used && (t.prepare(this.context), t.getSource().usedInConflation && ++a); } const c = {}, h = {}, _ = {}, d = {}, u = {}; for (const e in n) { const t = n[e]; c[e] = t.getVisibleCoordinates(), h[e] = c[e].slice().reverse(), _[e] = t.getVisibleCoordinates(!0).reverse(), d[e] = t.getShadowCasterCoordinates(), u[e] = t.sortCoordinatesByDistance(c[e]); } const p = e => { const t = this.style.getLayerSourceCache(e); return t && t.used ? t.getSource() : null }; if (a) { const e = []; for (const t of s) this.layerUsedInConflation(t, p(t)) && e.push(t); if (e && e.length > 1) { const t = []; for (const i of e) { const e = this.style.getLayerSourceCache(i); e && e.used && e.getSource().usedInConflation && t.push({ layer: i.fqid, cache: e }); } this.replacementSource.setSources(t), l = !0; } } l || this.replacementSource.clear(), this.conflationActive = l, this.minCutoffZoom = 0, this.longestCutoffRange = 0; for (const e of s) { const t = e.cutoffRange(); if (this.longestCutoffRange = Math.max(t, this.longestCutoffRange), t > 0) { const t = p(e); t && (this.minCutoffZoom = Math.max(t.minzoom, this.minCutoffZoom)), e.minzoom && (this.minCutoffZoom = Math.max(e.minzoom, this.minCutoffZoom)); } } this.opaquePassCutoff = 1 / 0; for (let e = 0; e < s.length; e++)if (s[e].is3D()) { this.opaquePassCutoff = e; break } const m = this.style && this.style.fog; m ? (this._fogVisible = 0 !== m.getOpacity(this.transform.pitch), this._fogVisible && "globe" !== this.transform.projection.name && (this._fogVisible = m.isVisibleOnFrustum(this.transform.cameraFrustum))) : this._fogVisible = !1, this._cachedTileFogOpacities = {}, this.terrain && (this.terrain.updateTileBinding(_), this.opaquePassCutoff = 0); const f = this._shadowRenderer; if (f) { f.updateShadowParameters(this.transform, this.style.directionalLight); for (const e in n) for (const t of c[e]) { let e = { min: 0, max: 0 }; this.terrain && (e = this.terrain.getMinMaxForTile(t) || e), f.addShadowReceiver(t.toUnwrapped(), e.min, e.max); } } "globe" !== this.transform.projection.name || this.globeSharedBuffers || (this.globeSharedBuffers = new e.ce(this.context)); for (const e of s) { if (e.isHidden(this.transform.zoom)) continue; const i = t.getLayerSourceCache(e); this.uploadLayer(this, e, i); } if (this.style.fog && this.transform.projection.supportsFog ? (this._atmosphere || (this._atmosphere = new Ko(this)), this._atmosphere.update(this)) : this._atmosphere && (this._atmosphere.de
41stroy(), this._atmosphere = void 0), !e.cf(this.context.gl)) return; this.renderPass = "offscreen"; for (const e of s) { const i = t.getLayerSourceCache(e); if (!e.hasOffscreenPass() || e.isHidden(this.transform.zoom)) continue; const o = i ? h[i.id] : void 0; ("custom" === e.type || "raster" === e.type || e.isSky() || o && o.length) && this.renderLayer(this, i, e, o); } this.depthRangeFor3D = [0, 1 - (s.length + 2) * this.numSublayers * this.depthEpsilon]; const g = this.terrain; g && (this.style.hasSymbolLayers() || this.style.hasCircleLayers()) && !this.transform.isOrthographic && g.drawDepth(), this._shadowRenderer && (this.renderPass = "shadow", this._shadowRenderer.drawShadowPass(this.style, d)), this.context.bindFramebuffer.set(null), this.context.viewport.set([0, 0, this.width, this.height]); const v = "globe" === this.transform.projection.name || this.transform.isHorizonVisible(), x = (() => { if (i.showOverdrawInspector) return e.C.black; if (this.style.fog && this.transform.projection.supportsFog && !v) { const t = this.style.fog.properties.get("color").toArray01(); return new e.C(...t) } if (this.style.fog && this.transform.projection.supportsFog && v) { const t = this.style.fog.properties.get("space-color").toArray01(); return new e.C(...t) } return e.C.transparent })(); if (this.context.clear({ color: x, depth: 1 }), this.clearStencil(), this._showOverdrawInspector = i.showOverdrawInspector, this.renderPass = "opaque", this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && v && this._atmosphere.drawStars(this, this.style.fog), !this.terrain) for (this.currentLayer = r.length - 1; this.currentLayer >= 0; this.currentLayer--) { const e = s[this.currentLayer], i = t.getLayerSourceCache(e); if (e.isSky()) continue; const o = i ? (e.is3D() ? u : h)[i.id] : void 0; this._renderTileClippingMasks(e, i, o), this.renderLayer(this, i, e, o); } if (this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && v && this._atmosphere.drawAtmosphereGlow(this, this.style.fog), this.renderPass = "sky", (!this._atmosphere || e.ao(this.transform.zoom) > 0) && ("globe" === this.transform.projection.name || this.transform.isHorizonVisible())) for (this.currentLayer = 0; this.currentLayer < r.length; this.currentLayer++) { const e = s[this.currentLayer], i = t.getLayerSourceCache(e); e.isSky() && this.renderLayer(this, i, e, i ? h[i.id] : void 0); } this.renderPass = "translucent", this.currentLayer = 0, this.firstLightBeamLayer = Number.MAX_SAFE_INTEGER; let y = 0; for (f && (y = f.getShadowCastingLayerCount()); this.currentLayer < r.length;) { const e = s[this.currentLayer], i = t.getLayerSourceCache(e); if (e.isSky()) { ++this.currentLayer; continue } if (g && this.style.isLayerDraped(e)) { if (e.isHidden(this.transform.zoom)) { ++this.currentLayer; continue } this.currentLayer = g.renderBatch(this.currentLayer); continue } let o; if (i && (o = ("symbol" === e.type ? _ : e.is3D() ? u : h)[i.id]), this._renderTileClippingMasks(e, i, i ? c[i.id] : void 0), this.renderLayer(this, i, e, o), !g && f && y > 0 && e.hasShadowPass() && 0 == --y && (f.drawGroundShadows(), this.firstLightBeamLayer <= this.currentLayer)) { const e = this.currentLayer; for (this.renderPass = "light-beam", this.currentLayer = this.firstLightBeamLayer; this.currentLayer <= e; this.currentLayer++) { const e = s[this.currentLayer]; if (!e.hasLightBeamPass()) continue; const i = t.getLayerSourceCache(e); this.renderLayer(this, i, e, i ? h[i.id] : void 0); } this.currentLayer = e, this.renderPass = "translucent"; } ++this.currentLayer; } if (this.terrain && this.terrain.postRender(), this.options.showTileBoundaries || this.options.showQueryGeometry || this.options.showTileAABBs) { let i = null; s.forEach((e => { const o = t.getLayerSourceCache(e); o && !e.isHidden(this.transform.zoom) && o.getVisibleCoordinates().length && (!i || i.getSource().maxzoom < o.getSource().maxzoom) && (i = o); })), i && this.options.showTileBoundaries && ur.debug(this, i, i.getVisibleCoordinates(), e.C.red, !1); } this.terrain && this._debugParams.showTerrainProxyTiles && ur.debug(this, this.terrain.proxySourceCache, this.terrain.proxyCoords, new e.C(1, .8, .1, 1), !0), this.options.showPadding && function (e) { const t = e.transform.padding; Uo(e, e.transform.height - (t.top || 0), 3, zo), Uo(e, t.bottom || 0, 3, Oo), Go(e, t.left || 0, 3, Fo), Go(e, e.transform.width - (t.right || 0
41), 3, Bo); const i = e.transform.centerPoint; !function (e, t, i, o) { jo(e, t - 1, i - 10, 2, 20, o), jo(e, t - 10, i - 1, 20, 2, o); }(e, i.x, e.transform.height - i.y, ko); }(this), this.context.setDefault(), this.frameCounter = (this.frameCounter + 1) % Number.MAX_SAFE_INTEGER, this.tileLoaded && this.options.speedIndexTiming && (this.loadTimeStamps.push(performance.now()), this.saveCanvasCopy()), l || (this.conflationActive = !1); } uploadLayer(e, t, i) { this.gpuTimingStart(t), (!e.transform.projection.unsupportedLayers || !e.transform.projection.unsupportedLayers.includes(t.type) || e.terrain && "custom" === t.type) && pr[`${t.type}Upload`] && pr[`${t.type}Upload`](e, i, t.scope), this.gpuTimingEnd(); } renderLayer(e, t, i, o) { i.isHidden(this.transform.zoom) || ("background" === i.type || "sky" === i.type || "custom" === i.type || "model" === i.type || "raster" === i.type || o && o.length) && (this.id = i.id, this.gpuTimingStart(i), (!e.transform.projection.unsupportedLayers || !e.transform.projection.unsupportedLayers.includes(i.type) || e.terrain && "custom" === i.type) && ur[i.type](e, t, i, o, this.style.placement.variableOffsets, this.options.isInitialLoad), this.gpuTimingEnd()); } gpuTimingStart(e) { if (!this.options.gpuTiming) return; const t = this.context.extTimerQuery, i = this.context.gl; let o = this.gpuTimers[e.id]; o || (o = this.gpuTimers[e.id] = { calls: 0, cpuTime: 0, query: i.createQuery() }), o.calls++, i.beginQuery(t.TIME_ELAPSED_EXT, o.query); } gpuTimingDeferredRenderStart() { if (this.options.gpuTimingDeferredRender) { const e = this.context.extTimerQuery, t = this.context.gl, i = t.createQuery(); this.deferredRenderGpuTimeQueries.push(i), t.beginQuery(e.TIME_ELAPSED_EXT, i); } } gpuTimingDeferredRenderEnd() { this.options.gpuTimingDeferredRender && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); } gpuTimingEnd() { this.options.gpuTiming && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); } collectGpuTimers() { const e = this.gpuTimers; return this.gpuTimers = {}, e } collectDeferredRenderGpuQueries() { const e = this.deferredRenderGpuTimeQueries; return this.deferredRenderGpuTimeQueries = [], e } queryGpuTimers(e) { const t = {}; for (const i in e) { const o = e[i], r = this.context.extTimerQuery, s = r.getQueryParameter(o.query, this.context.gl.QUERY_RESULT) / 1e6; r.deleteQueryEXT(o.query), t[i] = s; } return t } queryGpuTimeDeferredRender(e) { if (!this.options.gpuTimingDeferredRender) return 0; const t = this.context.extTimerQuery, i = this.context.gl; let o = 0; for (const r of e) o += t.getQueryParameter(r, i.QUERY_RESULT) / 1e6, t.deleteQueryEXT(r); return o } translatePosMatrix(t, i, o, r, s) { if (!o[0] && !o[1]) return t; const n = s ? "map" === r ? this.transform.angle : 0 : "viewport" === r ? -this.transform.angle : 0; if (n) { const e = Math.sin(n), t = Math.cos(n); o = [o[0] * t - o[1] * e, o[0] * e + o[1] * t]; } const a = [s ? o[0] : e.ay(i, o[0], this.transform.zoom), s ? o[1] : e.ay(i, o[1], this.transform.zoom), 0], l = new Float32Array(16); return e.m.translate(l, t, a), l } saveTileTexture(e) { const t = e.size[0], i = this._tileTextures[t]; i ? i.push(e) : this._tileTextures[t] = [e]; } getTileTexture(e) { const t = this._tileTextures[e]; return t && t.length > 0 ? t.pop() : null } isPatternMissing(e, t) { return null === e || void 0 !== e && !this.imageManager.getPattern(e.toString(), t) } terrainRenderModeElevated() { return this.style && !!this.style.getTerrain() && !!this.terrain && !this.terrain.renderingToTexture } linearFloatFilteringSupported() { return null != this.context.extTextureFloatLinear } currentGlobalDefines(e, t, i) { const o = void 0 === i ? this.terrain && this.terrain.renderingToTexture : i, r = this.terrain && 0 === this.terrain.exaggeration(), s = []; return this.style && this.style.enable3dLights() && ("globeRaster" === e || "terrainRaster" === e ? (s.push("LIGHTING_3D_MODE"), s.push("LIGHTING_3D_ALPHA_EMISSIVENESS")) : o || s.push("LIGHTING_3D_MODE")), "shadow" === this.renderPass ? this._shadowMapDebug || s.push("DEPTH_TEXTURE") : this.shadowRenderer && (this.shadowRenderer.useNormalOffset ? s.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET") : s.push("RENDER_SHADOWS", "DEPTH_TEXTURE")), this.terrainRenderModeElevated() && (s.push("TERRAIN"), this.linearFloatFilteringSupported() && s.push("TERRAIN_DEM_FLOAT_FORMAT"), r && s.push("ZERO_EXAGGERATION")), "globe" === this.transform.projection.name && s.push("GLOBE"), !this._fogVisible || o || void 0 !== t && !t || s.push("FOG", "FOG_DITHERING"), o && s.push("RENDER_TO_TEXTURE"), this._showOverdrawInspector && s.push("OVERDRAW_INSPECTOR"), s } getOrCreateProgram(e, t) { this.cache = this.cache || {}; const i = t && t.defines || [], o = t && t.config, r = this.currentGlobalDefines(e, t && t.overrideFog, t && t.overrideRtt).concat(i), s = Gi.cacheKey(mi[e], e, r, o); return this.cache[s] || (this.cache[s] = new Gi(this.context, e, mi[e], o, fo[e], r)), this.cache[s] } setCustomLayerDefaults() { this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.frontFace.setDefault(), this.context.cullFaceSide.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault(); } setBaseState() { const e = this.context.gl; this.context.cullFace.set(!1), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(e.FUNC_ADD); } initDebugOverlayCanvas() { null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new e.a9(this.context, this.debugOverlayCanvas, this.context.gl.RGBA)); } destroy() { this._terrain && this._terrain.destroy(), this._atmosphere && (this._atmosphere.de
vendor: 4,651 bytes, line 41
41stroy(), this._atmosphere = void 0), this.globeSharedBuffers && this.globeSharedBuffers.destroy(), this.emptyTexture.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this._wireframeDebugCache.destroy(); } prepareDrawTile() { this.terrain && this.terrain.prepareDrawTile(); } uploadCommonLightUniforms(t, i) { if (this.style.enable3dLights()) { const o = this.style.directionalLight, r = this.style.ambientLight; if (o && r) { const s = ((t, i) => { const o = t.properties.get("direction"), r = t.properties.get("color").toArray01(), s = t.properties.get("intensity"), n = i.properties.get("color").toArray01(), a = i.properties.get("intensity"), l = [o.x, o.y, o.z], c = e.bv(n, a), h = e.bv(r, s); return { u_lighting_ambient_color: c, u_lighting_directional_dir: l, u_lighting_directional_color: h, u_ground_radiance: ki(l, h, c) } })(o, r); i.setLightsUniformValues(t, s); } } } uploadCommonUniforms(t, i, o, r, s) { if (this.uploadCommonLightUniforms(t, i), this.terrain && this.terrain.renderingToTexture) return; const n = this.style.fog; if (n) { const s = n.getOpacity(this.transform.pitch), a = ((t, i, o, r, s, n, a, l, c, h, _, d) => { const u = t.transform, p = i.properties.get("color").toArray01(); p[3] = r; const m = t.frameCounter / 1e3 % 1, [f, g] = i.properties.get("vertical-range"); return { u_fog_matrix: o ? u.calculateFogTileMatrix(o) : d || t.identityMat, u_fog_range: i.getFovAdjustedRange(u._fov), u_fog_color: p, u_fog_horizon_blend: i.properties.get("horizon-blend"), u_fog_vertical_limit: [Math.min(f, g), g], u_fog_temporal_offset: m, u_frustum_tl: s, u_frustum_tr: n, u_frustum_br: a, u_frustum_bl: l, u_globe_pos: c, u_globe_radius: h, u_viewport: _, u_globe_transition: e.ao(u.zoom), u_is_globe: +("globe" === u.projection.name) } })(this, n, o, s, this.transform.frustumCorners.TL, this.transform.frustumCorners.TR, this.transform.frustumCorners.BR, this.transform.frustumCorners.BL, this.transform.globeCenterInViewSpace, this.transform.globeRadius, [this.transform.width * e.a4.devicePixelRatio, this.transform.height * e.a4.devicePixelRatio], r); i.setFogUniformValues(t, a); } s && i.setCutoffUniformValues(t, s.uniformValues); } setTileLoadedFlag(e) { this.tileLoaded = e; } saveCanvasCopy() { const e = this.canvasCopy(); e && (this.frameCopies.push(e), this.tileLoaded = !1); } canvasCopy() { const e = this.context.gl, t = e.createTexture(); return e.bindTexture(e.TEXTURE_2D, t), e.copyTexImage2D(e.TEXTURE_2D, 0, e.RGBA, 0, 0, e.drawingBufferWidth, e.drawingBufferHeight, 0), t } getCanvasCopiesAndTimestamps() { return { canvasCopies: this.frameCopies, timeStamps: this.loadTimeStamps } } averageElevationNeedsEasing() { if (!this.transform._elevation) return !1; const e = this.style && this.style.fog; return !!e && 0 !== e.getOpacity(this.transform.pitch) } getBackgroundTiles() { const t = this._backgroundTiles, i = this._backgroundTiles = {}, o = this.transform.coveringTiles({ tileSize: 512 }); for (const r of o) i[r.key] = t[r.key] || new e.bt(r, 512, this.transform.tileZoom, this); return i } clearBackgroundTiles() { this._backgroundTiles = {}; } layerUsedInConflation(e, t) { return !(!e.is3D() || e.minzoom && e.minzoom > this.transform.zoom || "building" !== e.sourceLayer && (!t || "batched-model" !== t.type)) } isTileAffectedByFog(e) { if (!this.style || !this.style.fog) return !1; if ("globe" === this.transform.projection.name) return !0; let t = this._cachedTileFogOpacities[e.key]; return t || (this._cachedTileFogOpacities[e.key] = t = this.style.fog.getOpacityForTile(e)), t[0] >= Ue || t[1] >= Ue } } const fr = { cascadeCount: 2, shadowMapResolution: 2048 }; class gr { constructor(e, t) { this.aabb = e, this.lastCascade = t; } } class vr { add(e, t) { const i = this.receivers[e.key]; void 0 !== i ? (i.aabb.min[0] = Math.min(i.aabb.min[0], t.min[0]), i.aabb.min[1] = Math.min(i.aabb.min[1], t.min[1]), i.aabb.min[2] = Math.min(i.aabb.min[2], t.min[2]), i.aabb.max[0] = Math.max(i.aabb.max[0], t.max[0]), i.aabb.max[1] = Math.max(i.aabb.max[1], t.max[1]), i.aabb.max[2] = Math.max(i.aabb.max[2], t.max[2])) : this.receivers[e.key] = new gr(t, null); } clear() { this.receivers = {}; } get(e) { return this.receivers[e.key] } computeRequiredCascades(t, i, o) { const r = e.c3.fromPoints(t.points); let s = 0; for (const t in this.receivers) { const n = this.receivers[t]; if (!n) continue; if (!r.intersectsAabb(n.aabb)) continue; n.aabb.min = r.closestPoint(n.aabb.min), n.aabb.max = r.closestPoint(n.aabb.max); const a = n.aabb.getCorners(); for (let t = 0; t < o.length; t++) { let r = !0; for (const s of a) { const n = [s[0] * i, s[1] * i, s[2]];
41 if (e.v.transformMat4(n, n, o[t].matrix), n[0] < -1 || n[0] > 1 || n[1] < -1 || n[1] > 1) { r = !1; break } } if (n.lastCascade = t, s = Math.max(s, t), r) break } } return s + 1 } } class xr { constructor(t) { this.painter = t, this._enabled = !1, this._shadowLayerCount = 0, this._numCascadesToRender = 0, this._cascades = [], this._groundShadowTiles = [], this._receivers = new vr, this._depthMode = new e.b4(t.context.gl.LEQUAL, e.b4.ReadWrite, [0, 1]), this._uniformValues = { u_light_matrix_0: new Float32Array(16), u_light_matrix_1: new Float32Array(16), u_shadow_intensity: 0, u_fade_range: [0, 0], u_shadow_normal_offset: [1, 1, 1], u_shadow_texel_size: 1, u_shadow_map_resolution: 1, u_shadow_direction: [0, 0, 1], u_shadow_bias: [36e-5, .0012, .012], u_shadowmap_0: 0, u_shadowmap_1: 0 }, this.useNormalOffset = !1, t.tp.registerParameter(fr, ["Shadows"], "cascadeCount", { min: 1, max: 2, step: 1 }), t.tp.registerParameter(fr, ["Shadows"], "shadowMapResolution", { min: 32, max: 2048, step: 32 }); } destroy() { for (const e of this._cascades) e.texture.destroy(), e.framebuffer.destroy(); this._cascades = []; } updateShadowParameters(t, i) { const o = this.painter; if (this._enabled = !1, this._shadowLayerCount = 0, this._receivers.clear(), !i || !i.properties) return; const r = i.properties.get("shadow-intensity"); if (!i.shadowsEnabled() || r <= 0) return; if (this._shadowLayerCount = o.style.order.reduce(((e, i) => { const r = o.style._mergedLayers[i]; return e + (r.hasShadowPass() && !r.isHidden(t.zoom) ? 1 : 0) }), 0), this._enabled = this._shadowLayerCount > 0, !this._enabled) return; const s = o.context, n = fr.shadowMapResolution, a = fr.shadowMapResolution; if (0 === this._cascades.length || fr.shadowMapResolution !== this._cascades[0].texture.size[0]) { this._cascades = []; for (let t = 0; t < fr.cascadeCount; ++t) { const t = o._shadowMapDebug, i = s.gl, r = s.createFramebuffer(n, a, t, "texture"), l = new e.a9(s, { width: n, height: a, data: null }, i.DEPTH_COMPONENT); if (r.depthAttachment.set(l.texture), t) { const t = new e.a9(s, { width: n, height: a, data: null }, i.RGBA); r.colorAttachment.set(t.texture); } this._cascades.push({ framebuffer: r, texture: l, matrix: [], far: 0, boundingSphereRadius: 0, frustum: new e.F, scale: 0 }); } } this.shadowDirection = br(i); let l = 0; if (t.elevation) { const e = t.elevation, i = [1e4, -1e4]; e.visibleDemTiles.filter((e => e.dem)).forEach((e => { const t = e.dem.tree; i[0] = Math.min(i[0], t.minimums[0]), i[1] = Math.max(i[1], t.maximums[0]); })), 1e4 !== i[0] && (l = (i[1] - i[0]) * e.exaggeration()); } const c = 1.5 * t.cameraToCenterDistance, h = 3 * c, _ = new Float64Array(16); for (let i = 0; i < this._cascades.length; ++i) { const o = this._cascades[i]; let r = t.height / 50, s = 1; 1 === fr.cascadeCount ? s = h : 0 === i ? s = c : (r = c, s = h); const [n, a] = Tr(t, this.shadowDirection, r, s, fr.shadowMapResolution, l); o.scale = t.scale, o.matrix = n, o.boundingSphereRadius = a, e.m.invert(_, o.matrix), o.frustum = e.F.fromInvProjectionMatrix(_, 1, 0, !0), o.far = s; } const d = this._cascades.length - 1; this._uniformValues.u_fade_range = [.75 * this._cascades[d].far, this._cascades[d].far], this._uniformValues.u_shadow_intensity = r, this._uniformValues.u_shadow_direction = [this.shadowDirection[0], this.shadowDirection[1], this.shadowDirection[2]], this._uniformValues.u_shadow_texel_size = 1 / fr.shadowMapResolution, this._uniformValues.u_shadow_map_resolution = fr.shadowMapResolution, this._uniformValues.u_shadowmap_0 = _o.ShadowMap0, this._uniformValues.u_shadowmap_1 = _o.ShadowMap0 + 1, this._groundShadowTiles = o.transform.coveringTiles({ tileSize: 512, renderWorldCopies: !0 }); const u = o.transform.elevation; for (const e of this._groundShadowTiles) { let t = { min: 0, max: 0 }; if (u) { const i = u.getMinMaxForTile(e); i && (t = i); } this.addShadowReceiver(e.toUnwrapped(), t.min, t.max); } } get enabled() { return this._enabled } set enabled(e) { this._enabled = e; } drawShadowPass(t, i) { if (!this._enabled) return; const o = this.painter, r = o.context; this._numCascadesToRender = this._receivers.computeRequiredCascades(o.transform.getFrustum(0), o.transform.worldSize, this._cascades), r.viewport.set([0, 0, fr.shadowMapResolution, fr.shadowMapResolution]); for (let s = 0; s < this._numCascadesToRender; ++s) { o.currentShadowCascade = s, r.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer), r.clear({ color: e.C.white, depth: 1 }); for (const e of t.order) { const r = t._mergedLayers[e]; if (!r.hasShadowPass() || r.isHidden(o.transform.zoom)) continue; const s = t.getLayerSourceCache(r), n = s ? i[s.id] : void 0; ("model" === r.type || n && n.length) && o.renderLayer(o, s, r, n); } } o.currentShadowCascade = 0; } drawGroundShadows() { if (!this._enabled) return; const t = this.painter, i = t.style, o = t.context, r = i.directionalLight, s = i.ambientLight; if (!r || !s) return; const n = [], a = Ii(t, t.longestCutoffRange); a.shouldRenderCutoff && n.push("RENDER_CUTOFF"); const l = wr(r, s), c = new e.b4(o.gl.LEQUAL, e.b4.ReadOnly, t.depthRangeFor3D); for (const i of this._groundShadowTiles) { const r = i.toUnwrapped(), s = t.isTileAffectedByFog(i), h = t.getOrCreateProgram("groundShadow", { defines: n, overrideFog: s }); this.setupShadows(r, h), t.uploadCommonUniforms(o, h, r, null, a); const _ = { u_matrix: t.transform.calculateProjMatrix(r), u_ground_shadow_factor: l }; h.draw(t, o.gl.TRIANGLES, c, e.b6.disabled, e.a.multiply, e.b5.disabled, _, "ground_shadow", t.tileExtentBuffer, t.quadTriangleIndexBuffer, t.tileExtentSegments, {}, t.transform.zoom, null, null); } } getShadowPassColorMode() { return this.painter._shadowMapDebug ? e.a.unblended : e.a.disabled } getShadowPassDepthMode() { return this._depthMode } getShadowCastingLayerCount() { return this._shadowLayerCount } calculateShadowPassMatrixFromTile(t) { const i = this.painter.transform, o = i.calculatePosMatrix(t, i.worldSize); return e.m.multiply(o, this._cascades[this.painter.currentShadowCascade].matrix, o), Float32Array.from(o) }
41 calculateShadowPassMatrixFromMatrix(t) { return e.m.multiply(t, this._cascades[this.painter.currentShadowCascade].matrix, t), Float32Array.from(t) } setupShadows(t, i, o, r = 0) { if (!this._enabled) return; const s = this.painter.transform, n = this.painter.context, a = n.gl, l = this._uniformValues, c = new Float64Array(16), h = s.calculatePosMatrix(t, s.worldSize); for (let t = 0; t < this._cascades.length; t++)e.m.multiply(c, this._cascades[t].matrix, h), l[0 === t ? "u_light_matrix_0" : "u_light_matrix_1"] = Float32Array.from(c), n.activeTexture.set(a.TEXTURE0 + _o.ShadowMap0 + t), this._cascades[t].texture.bind(a.NEAREST, a.CLAMP_TO_EDGE); if (this.useNormalOffset = !!o, this.useNormalOffset) { const i = e.cg(t.canonical), n = 2 / s.tileSize * e.J / fr.shadowMapResolution, a = n * this._cascades[0].boundingSphereRadius, c = n * this._cascades[this._cascades.length - 1].boundingSphereRadius, h = ("vector-tile" === o ? 1 : 3) / Math.pow(2, r - t.canonical.z - (1 - s.zoom + Math.floor(s.zoom))); l.u_shadow_normal_offset = [i, a * h, c * h], l.u_shadow_bias = [6e-5, .0012, .012]; } else l.u_shadow_bias = [36e-5, .0012, .012]; i.setShadowUniformValues(n, l); } setupShadowsFromMatrix(t, i, o = !1) { if (!this._enabled) return; const r = this.painter.context, s = r.gl, n = this._uniformValues, a = new Float64Array(16); for (let i = 0; i < fr.cascadeCount; i++)e.m.multiply(a, this._cascades[i].matrix, t), n[0 === i ? "u_light_matrix_0" : "u_light_matrix_1"] = Float32Array.from(a), r.activeTexture.set(s.TEXTURE0 + _o.ShadowMap0 + i), this._cascades[i].texture.bind(s.NEAREST, s.CLAMP_TO_EDGE); if (this.useNormalOffset = o, o) { const e = 5; n.u_shadow_normal_offset = [1, e, e], n.u_shadow_bias = [6e-5, .0012, .012]; } else n.u_shadow_bias = [36e-5, .0012, .012]; i.setShadowUniformValues(r, n); } getShadowUniformValues() { return this._uniformValues } getCurrentCascadeFrustum() { return this._cascades[this.painter.currentShadowCascade].frustum } computeSimplifiedTileShadowVolume(t, i, o, r) { if (r[2] >= 0) return {}; const s = function (t, i, o) { const r = o / (1 << t.canonical.z); return new e.c3([t.canonical.x * r + t.wrap * o, t.canonical.y * r + t.wrap * o, 0], [(t.canonical.x + 1) * r + t.wrap * o, (t.canonical.y + 1) * r + t.wrap * o, i]) }(t, i, o).getCorners(), n = i / -r[2]; r[0] < 0 ? (e.v.add(s[0], s[0], [r[0] * n, 0, 0]), e.v.add(s[3], s[3], [r[0] * n, 0, 0])) : r[0] > 0 && (e.v.add(s[1], s[1], [r[0] * n, 0, 0]), e.v.add(s[2], s[2], [r[0] * n, 0, 0])), r[1] < 0 ? (e.v.add(s[0], s[0], [0, r[1] * n, 0]), e.v.add(s[1], s[1], [0, r[1] * n, 0])) : r[1] > 0 && (e.v.add(s[2], s[2], [0, r[1] * n, 0]), e.v.add(s[3], s[3], [0, r[1] * n, 0])); const a = {}; return a.vertices = s, a.planes = [yr(s[1], s[0], s[4]), yr(s[2], s[1], s[5]), yr(s[3], s[2], s[6]), yr(s[0], s[3], s[7])], a } addShadowReceiver(t, i, o) { this._receivers.add(t, e.c3.fromTileIdAndHeight(t, i, o)); } getMaxCascadeForTile(e) { const t = this._receivers.get(e); return t && t.lastCascade ? t.lastCascade : 0 } } function yr(t, i, o) { const r = e.v.sub([], o, i), s = e.v.sub([], t, i), n = e.v.cross([], r, s), a = e.v.length(n); return 0 === a ? [0, 0, 1, 0] : (e.v.scale(n, n, 1 / a), [n[0], n[1], n[2], -e.v.dot(n, i)]) } function br(t) { const i = t.properties.get("direction"), o = e.b3(i.x, i.y, i.z); o[2] = e.c(o[2], 0, 75); const r = e.ch([o[0], o[1], o[2]]); return e.v.fromValues(r.x, r.y, r.z) } function wr(t, i) { const o = t.properties.get("color"), r = t.properties.get("intensity"), s = t.properties.get("direction"), n = [s.x, s.y, s.z], a = i.properties.get("color"), l = i.properties.get("intensity"), c = Math.max(e.v.dot([0, 0, 1], n), 0), h = [0, 0, 0]; e.v.scale(h, a.toArray01Linear().slice(0, 3), l); const _ = [0, 0, 0]; return e.v.scale(_, o.toArray01Linear().slice(0, 3), c * r), e.bw([h[0] > 0 ? h[0] / (h[0] + _[0]) : 0, h[1] > 0 ? h[1] / (h[1] + _[1]) : 0, h[2] > 0 ? h[2] / (h[2] + _[2]) : 0]) } function Tr(t, i, o, r, s, n) { const a = t.zoom, l = t.scale, c = t.worldSize, h = 1 / c, _ = t.aspect, d = Math.sqrt(1 + _ * _) * Math.tan(.5 * t.fovX), u = d * d, p = r - o, m = r + o; let f, g; u > p / m ? (f = r, g = r * d) : (f = .5 * m * (1 + u), g = .5 * Math.sqrt(p * p + 2 * (r * r + o * o) * u + m * m * u * u)); const v = t.projection.pixelsPerMeter(t.center.lat, c), x = t._camera.getCameraToWorldMercator(), y = [0, 0, -f * h]; e.v.transformMat4(y, y, x); let b = g * h; const w = t._edgeInsets; if (!(0 === w.left && 0 === w.top && 0 === w.right && 0 === w.bottom || w.left === w.right && w.top === w.bottom)) { const i = t._camera.getWorldToCamera(t.worldSize, "meters" === t.projection.zAxisUnit ? v : 1), s = t._camera.getCameraToClipPerspective(t._fov, t.width / t.height, o, r); s[8] = 2 * -t.centerOffset.x / t.width, s[9] = 2 * t.centerOffset.y / t.height; const n = new Float64Array(16); e.m.mul(n, s, i); const h = new Float64Array(16); e.m.invert(h, n); const _ = e.F.fromInvProjectionMatrix(h, c, a, !0); for (const i of _.points) { const o = ((T = i)[0] /= l, T[1] /= l, T[2] = e.b(T[2], t._center.lat), T); b = Math.max(b, e.v.len(e.v.subtract([], y, o))); } } var T; b *= s / (s - 1); const E = Math.acos(i[2]), C = Math.atan2(-i[0], -i[1]), I = new _e; I.position = y, I.setPitchBearing(E, C); const S = I.getWorldToCamera(c, v), M = b * c, L = Math.min(t._mercatorZfromZoom(17) * c * -2, -2 * M), P = I.getCameraToClipOrthographic(-M, M, -M, M, L, (M + n * v) / i[2]), D = new Float64Array(16); e.m.multiply(D, P, S); const A = e.v.fromValues(Math.floor(1e6 * y[0]) / 1e6 * c, Math.floor(1e6 * y[1]) / 1e6 * c, 0), R = .5 * s, z = [0, 0, 0]; e.v.transformMat4(z, A, D), e.v.scale(z, z, R); const O = [Math.floor(z[0]), Math.floor(z[1]), Math.floor(z[2])], F = [0, 0, 0];
41 e.v.sub(F, z, O), e.v.scale(F, F, -1 / R); const B = new Float64Array(16); return e.m.identity(B), e.m.translate(B, B, F), e.m.multiply(D, B, D), [D, M] } class Er extends e.a6 { constructor(e) { super(), this.requestManager = e, this.models = { "": {} }, this.numModelsLoading = {}; } loadModel(t, i) { return e.aO(this.requestManager.transformRequest(i, e.a2.Model).url).then((i => { if (!i) return; const o = e.aP(i), r = new e.aQ(t, void 0, void 0, o); return r.computeBoundsAndApplyParent(), r })).catch((o => { this.fire(new e.a7(new Error(`Could not load model ${t} from ${i}: ${o.message}`))); })) } load(t, i) { this.models[i] || (this.models[i] = {}); const o = Object.keys(t); this.numModelsLoading[i] = (this.numModelsLoading[i] || 0) + o.length; const r = []; for (const e of o) r.push(this.loadModel(e, t[e])); Promise.allSettled(r).then((t => { for (let e = 0; e < t.length; e++) { const { status: r, value: s } = t[e]; "fulfilled" === r && s && (this.models[i][o[e]] = s); } this.numModelsLoading[i] -= o.length, this.fire(new e.a8("data", { dataType: "style" })); })).catch((t => { this.fire(new e.a7(new Error(`Could not load models: ${t.message}`))); })); } isLoaded() { for (const e in this.numModelsLoading) if (this.numModelsLoading[e] > 0) return !1; return !0 } hasModel(e, t) { return !!this.getModel(e, t) } getModel(e, t) { return this.models[t] || (this.models[t] = {}), this.models[t][e] } addModel(e, t, i) { this.models[i] || (this.models[i] = {}), this.hasModel(e, i) && this.removeModel(e, i), this.load({ [e]: this.requestManager.normalizeModelURL(t) }, i); } addModels(e, t) { const i = {}; for (const t in e) i[t] = this.requestManager.normalizeModelURL(e[t]); this.load(i, t); } removeModel(e, t) { this.models[t] || (this.models[t] = {}); const i = this.models[t][e]; delete this.models[t][e], i.destroy(); } listModels(e) { return this.models[e] || (this.models[e] = {}), Object.keys(this.models[e]) } upload(e, t) { this.models[t] || (this.models[t] = {}); for (const i in this.models[t]) this.models[t][i].upload(e.context); } } const Cr = (t, i) => e.ai(t, i && i.filter((e => "source.canvas" !== e.identifier))), Ir = e.p(ut, ["addLayer", "removeLayer", "setLights", "setPaintProperty", "setLayoutProperty", "setSlot", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData", "setTerrain", "setFog", "setProjection", "setCamera", "addImport", "removeImport", "setImportUrl", "setImportData", "setImportConfig"]), Sr = e.p(ut, ["setCenter", "setZoom", "setBearing", "setPitch"]), Mr = { version: 8, layers: [], sources: {} }, Lr = { duration: 300, delay: 0 }, Pr = new Set(["fill", "line", "background", "hillshade", "raster"]); class Dr extends e.a6 { constructor(t, i = {}) { super(), this.map = t, this.scope = i.scope || "", this.fragments = [], this.importDepth = i.importDepth || 0, this.importsCache = i.importsCache || new Map, this.resolvedImports = i.resolvedImports || new Set, this.transition = e.ak({}, Lr), this._buildingIndex = new ht(this), this.crossTileSymbolIndex = new Qt, this._mergedOrder = [], this._drapedFirstOrder = [], this._mergedLayers = {}, this._mergedSourceCaches = {}, this._mergedOtherSourceCaches = {}, this._mergedSymbolSourceCaches = {}, this._has3DLayers = !1, this._hasCircleLayers = !1, this._hasSymbolLayers = !1, this._changes = i.styleChanges || new v, this.dispatcher = i.dispatcher ? i.dispatcher : new e.br(e.bs(), this), i.imageManager ? this.imageManager = i.imageManager : (this.imageManager = new Re, this.imageManager.setEventedParent(this)), this.imageManager.createScope(this.scope), this.glyphManager = i.glyphManager ? i.glyphManager : new e.cj(t._requestManager, i.localFontFamily ? e.ck.all : i.localIdeographFontFamily ? e.ck.ideographs : e.ck.none, i.localFontFamily || i.localIdeographFontFamily), i.modelManager ? this.modelManager = i.modelManager : (this.modelManager = new Er(t._requestManager), this.modelManager.setEventedParent(this)), this._layers = {}, this._serializedLayers = {}, this._sourceCaches = {}, this._otherSourceCaches = {}, this._symbolSourceCaches = {}, this._loaded = !1, this._precompileDone = !1, this._shouldPrecompile = !1, this._availableImages = [], this._order = [], this._markersNeedU
41pdate = !1, this.options = i.configOptions ? i.configOptions : new Map, this._configDependentLayers = i.configDependentLayers ? i.configDependentLayers : new Set, this._config = i.config, this.dispatcher.broadcast("setReferrer", e.cl()); const o = this; this._rtlTextPluginCallback = Dr.registerForPluginStateChange((t => { o.dispatcher.broadcast("syncRTLPluginState", { pluginStatus: t.pluginStatus, pluginURL: t.pluginURL }, ((t, i) => { if (e.cm(t), i && i.every((e => e))) for (const e in o._sourceCaches) { const t = o._sourceCaches[e], i = t.getSource().type; "vector" !== i && "geojson" !== i || t.reload(); } })); })), this.on("data", (e => { if ("source" !== e.dataType || "metadata" !== e.sourceDataType) return; const t = this.getOwnSource(e.sourceId); if (t && t.vectorLayerIds) for (const e in this._layers) { const i = this._layers[e]; i.source === t.id && this._validateLayer(i); } })); } loadURL(t, i = {}) { this.fire(new e.a8("dataloading", { dataType: "style" })); const o = "boolean" == typeof i.validate ? i.validate : !e.cn(t); t = this.map._requestManager.normalizeStyleURL(t, i.accessToken), this.resolvedImports.add(t); const r = this.importsCache.get(t); if (r) return this._load(r, o); const s = this.map._requestManager.transformRequest(t, e.a2.Style); this._request = e.a1(s, ((i, r) => { if (this._request = null, i) this.fire(new e.a7(i)); else if (r) return this.importsCache.set(t, r), this._load(r, o) })); } loadJSON(t, i = {}) { this.fire(new e.a8("dataloading", { dataType: "style" })), this._request = e.a4.frame((() => { this._request = null, this._load(t, !1 !== i.validate); })); } loadEmpty() { this.fire(new e.a8("dataloading", { dataType: "style" })), this._load(Mr, !1); } _loadImports(t, i) { if (this.importDepth >= 4) return e.X("Style doesn't support nesting deeper than 5"), Promise.resolve(); const o = []; for (const e of t) { const t = this._createFragmentStyle(e), r = new Promise((e => { t.once("style.import.load", e), t.once("error", e); })).then((() => this.mergeAll())); if (o.push(r), this.resolvedImports.has(e.url)) { t.loadEmpty(); continue } const s = e.data || this.importsCache.get(e.url); s ? t.loadJSON(s, { validate: i }) : e.url ? t.loadURL(e.url, { validate: i }) : t.loadEmpty(), this.fragments.push({ style: t, id: e.id, config: e.config }); } return Promise.allSettled(o) } _createFragmentStyle(t) { const i = this.scope ? e.aE(t.id, this.scope) : t.id, o = new Dr(this.map, { scope: i, styleChanges: this._changes, importDepth: this.importDepth + 1, importsCache: this.importsCache, resolvedImports: new Set(this.resolvedImports), dispatcher: this.dispatcher, imageManager: this.imageManager, glyphManager: this.glyphManager, modelManager: this.modelManager, config: t.config, configOptions: this.options, configDependentLayers: this._configDependentLayers }); return o.setEventedParent(this.map, { style: o }), o } _reloadImports() { this.mergeAll(), this._updateMapProjection(), this.updateConfigDependencies(), this.map._triggerCameraUpdate(this.camera), this.dispatcher.broadcast("setLayers", { layers: this._serializeLayers(this._order), scope: this.scope, options: this.options }); const t = this.isRootStyle(); this._shouldPrecompile = t, this.fire(new e.a8(t ? "style.load" : "style.import.load")); } _load(t, i) { const o = t.schema; if (this.isRootStyle() && (t.fragment || o && !1 !== t.fragment)) { const o = e.ak({}, Mr, { imports: [{ id: "basemap", data: t, url: "" }] }); return void this._load(o, i) } if (this.setConfig(this._config, o), i && Cr(this, e.aj(t))) return; this._loaded = !0, this.stylesheet = e.co(t); for (const e in t.sources) this.addSource(e, t.sources[e], { validate: !1, isInitialLoad: !0 }); t.sprite ? this._loadSprite(t.sprite) : (this.imageManager.setLoaded(!0, this.scope), this.dispatcher.broadcast("spriteLoaded", { scope: this.scope, isLoaded: !0 })), this.glyphManager.setURL(t.glyphs, this.scope); const r = dt(this.stylesheet.layers); if (this._order = r.map((e => e.id)), this.stylesheet.light && e.X("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."), this.stylesheet.lights) if (1 === this.stylesheet.lights.length && "flat" === this.stylesheet.lights[0].type) { const e = this.stylesheet.lights[0]; this.light = new Oe(e.properties, e.id); } else this.setLights(this.stylesheet.lights); this.light || (this.light = new Oe(this.stylesheet.light)), this._layers = {}, this._serializedLayers = {}; for (const t of r) { const i = e.cp(t, this.scope, this.options); i.isConfigDependent && this._configDependentLayers.add(i.fqid), i.setEventedParent(this, { layer: { id: i.id } }), this._layers[i.id] = i, this._serializedLayers[i.id] = i.serialize(); const o = this.getOwnLayerSourceCache(i), r = !!this.directionalLight && this.directionalLight.shadowsEnabled(); o && i.canCastShadows() && r && (o.castsShadows = !0); } this.stylesheet.models && this.modelManager.addModels(this.stylesheet.models, this.scope); const s = this.stylesheet.terrain; s && (void 0 === this.disableElevatedTerrain && (this.disableElevatedTerrain = e.a4.hasCanvasFingerprintNoise()), this.disableElevatedTerrain ? e.X("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode).") : this.terrainSetForDrapingOnly() || this._createTerrain(s, 1)), this.stylesheet.fog && this._createFog(this.stylesheet.fog), this.stylesheet.transition && this.setTransition(this.stylesheet.transition), this.fire(new e.a8("data", { dataType: "style" })), t.imports ? this._loadImports(t.imports, i).then((() => this._reloadImports())) : this._reloadImports(); } isRootStyle() { return 0 === this.importDepth } mergeAll() { let t, i, o, r, s, n, a, l; this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle((e => { if (e.stylesheet) { if (null != e.light && (t = e.light), e.stylesheet.lights) for (const t of e.stylesheet.lights) "ambient" === t.type && null != e.ambientLight && (i = e.ambientLight), "directional" === t.type && null != e.directionalLight && (o = e.directionalLight); r = this._prioritizeTerrain(r, e.terrain, e.stylesheet.terrain), e.stylesheet.fog && null != e.fog && (s = e.fog), null != e.stylesheet.camera && (l = e.stylesheet.camera), null != e.stylesheet.projection && (n = e.stylesheet.projection), null != e.stylesheet.transition && (a = e.stylesheet.transition); } })), this.light = t, this.ambientLight = i, this.directionalLight = o, this.fog = s, null === r ? delete this.terrain : this.terrain = r, this.camera = l || { "camera-projection": "perspective" }, this.projection = n || { name: "mercator" }, this.transition = e.ak({}, Lr, a), this.mergeSources(), this.mergeLayers(); } forEachFragmentStyle(e) { const t = i => { for (const e of i.fragments) t(e.style); e(i); }; t(this); } _prioritizeTerrain(e, t, i) { const o = e && 0 === e.drapeRenderMode; return null === i ? t && 0 === t.drapeRenderMode ? t : o ? e : null : null != t && (!e || o || t && 1 === t.drapeRenderMode) ? t : e } mergeTerrain() { let e; this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle((t => { e = this._prioritizeTerrain(e, t.terrain, t.stylesheet.terrain); })), null === e ? delete this.terrain : this.terrain = e; } mergeProjection() { let e; this.forEachFragmentStyle((t => { null != t.stylesheet.projection && (e = t.stylesheet.projection); })), this.projection = e || { name: "mercator" }; } mergeSources() { const t = {}, i = {}, o = {}; this.forEachFragmentStyle((r => { for (const i in r._sourceCaches) { const o = e.aE(i, r.scope); t[o] = r._sourceCaches[i]; } for (const t in r._otherSourceCaches) { const o = e.aE(t, r.scope); i[o] = r._otherSourceCaches[t]; } for (const t in r._symbolSourceCaches) { const i = e.aE(t, r.scope); o[i] = r._symbolSourceCaches[t]; } })), this._mergedSourceCaches = t, this._mergedOtherSourceCaches = i, this._mergedSymbolSourceCaches = o; } mergeLayers() { const t = {}, i = [], o = {}; this._has3DLayers = !1, this._hasCircleLayers = !1, this._hasSymbolLayers = !1, this.forEachFragmentStyle((o => { for (const r of o._order) { const s = o._layers[r]; if ("slot" === s.type) { const i = e.cq(r); if (t[i]) continue; t[i] = []; }
41 s.slot && t[s.slot] ? t[s.slot].push(s) : i.push(s); } })), this._mergedOrder = []; const r = (i = []) => { for (const s of i) if ("slot" === s.type) { const i = e.cq(s.id); t[i] && r(t[i]); } else { const t = e.aE(s.id, s.scope); this._mergedOrder.push(t), o[t] = s, s.is3D() && (this._has3DLayers = !0), "circle" === s.type && (this._hasCircleLayers = !0), "symbol" === s.type && (this._hasSymbolLayers = !0); } }; r(i), this._mergedLayers = o, this.updateDrapeFirstLayers(), this._buildingIndex.processLayersChanged(); } terrainSetForDrapingOnly() { return !!this.terrain && 0 === this.terrain.drapeRenderMode } getCamera() { return this.stylesheet.camera } setCamera(t) { return this.stylesheet.camera = e.ak({}, this.stylesheet.camera, t), this.camera = this.stylesheet.camera, this } setProjection(e) { e ? this.stylesheet.projection = e : delete this.stylesheet.projection, this.mergeProjection(), this._updateMapProjection(); } applyProjectionUpdate() { this._loaded && (this.dispatcher.broadcast("setProjection", this.map.transform.projectionOptions), this.map.transform.projection.requiresDraping ? this.getTerrain() || this.stylesheet.terrain || this.setTerrainForDraping() : this.terrainSetForDrapingOnly() && this.setTerrain(null)); } _updateMapProjection() { this.isRootStyle() && (this.map._useExplicitProjection ? this.applyProjectionUpdate() : this.map._prioritizeAndUpdateProjection(null, this.projection)); } _loadSprite(t) { this._spriteRequest = function (t, i, o) { let r, s, n; const a = e.a4.devicePixelRatio > 1 ? "@2x" : ""; let l = e.a1(i.transformRequest(i.normalizeSpriteURL(t, a, ".json"), e.a2.SpriteJSON), ((e, t) => { l = null, n || (n = e, r = t, h()); })), c = e.a3(i.transformRequest(i.normalizeSpriteURL(t, a, ".png"), e.a2.SpriteImage), ((e, t) => { c = null, n || (n = e, s = t, h()); })); function h() { if (n) o(n); else if (r && s) { const t = e.a4.getImageData(s), i = {}; for (const o in r) { const { width: s, height: n, x: a, y: l, sdf: c, pixelRatio: h, stretchX: _, stretchY: d, content: u } = r[o], p = new e.a5({ width: s, height: n }); e.a5.copy(t, p, { x: a, y: l }, { x: 0, y: 0 }, { width: s, height: n }), i[o] = { data: p, pixelRatio: h, sdf: c, stretchX: _, stretchY: d, content: u }; } o(null, i); } } return { cancel() { l && (l.cancel(), l = null), c && (c.cancel(), c = null); } } }(t, this.map._requestManager, ((t, i) => { if (this._spriteRequest = null, t) this.fire(new e.a7(t)); else if (i) for (const e in i) this.imageManager.addImage(e, this.scope, i[e]); this.imageManager.setLoaded(!0, this.scope), this._availableImages = this.imageManager.listImages(this.scope), this.dispatcher.broadcast("setImages", { scope: this.scope, images: this._availableImages }), this.dispatcher.broadcast("spriteLoaded", { scope: this.scope, isLoaded: !0 }), this.fire(new e.a8("data", { dataType: "style" })); })); } _validateLayer(t) { const i = this.getOwnSource(t.source); if (!i) return; const o = t.sourceLayer; o && ("geojson" === i.type || i.vectorLayerIds && -1 === i.vectorLayerIds.indexOf(o)) && this.fire(new e.a7(new Error(`Source layer "${o}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`))); } loaded() { if (!this._loaded) return !1; if (Object.keys(this._changes.getUpdatedSourceCaches()).length) return !1; for (const e in this._sourceCaches) if (!this._sourceCaches[e].loaded()) return !1; if (!this.imageManager.isLoaded()) return !1; if (!this.modelManager.isLoaded()) return !1; for (const { style: e } of this.fragments) if (!e.loaded()) return !1; return !0 } _serializeImports() { if (this.stylesheet.imports) return this.stylesheet.imports.map(((e, t) => { const i = this.fragments[t]; return i && i.style && (e.data = i.style.serialize()), e })) } _serializeSources() { const e = {}; for (const t in this._sourceCaches) { const i = this._sourceCaches[t].getSource(); e[i.id] || (e[i.id] = i.serialize()); } return e }
41 _serializeLayers(e) { const t = []; for (const i of e) { const e = this._layers[i]; e && "custom" !== e.type && t.push(e.serialize()); } return t } hasLightTransitions() { return !(!this.light || !this.light.hasTransition()) || !(!this.ambientLight || !this.ambientLight.hasTransition()) || !(!this.directionalLight || !this.directionalLight.hasTransition()) } hasFogTransition() { return !!this.fog && this.fog.hasTransition() } hasTransitions() { if (this.hasLightTransitions()) return !0; if (this.hasFogTransition()) return !0; for (const e in this._sourceCaches) if (this._sourceCaches[e].hasTransition()) return !0; for (const e in this._layers) if (this._layers[e].hasTransition()) return !0; return !1 } get order() { return this.terrain ? this._drapedFirstOrder : this._mergedOrder } isLayerDraped(e) { return !!this.terrain && ("function" == typeof e.isLayerDraped ? e.isLayerDraped(this.getLayerSourceCache(e)) : Pr.has(e.type)) } _checkLoaded() { if (!this._loaded) throw new Error("Style is not done loading") } _checkLayer(t) { const i = this.getOwnLayer(t); if (i) return i; this.fire(new e.a7(new Error(`The layer '${t}' does not exist in the map's style.`))); } _checkSource(t) { const i = this.getOwnSource(t); if (i) return i; this.fire(new e.a7(new Error(`The source '${t}' does not exist in the map's style.`))); } update(t) { if (!this._loaded) return; this.ambientLight && this.ambientLight.recalculate(t), this.directionalLight && this.directionalLight.recalculate(t); const i = this.calculateLightsBrightness(); t.brightness = i || 0, i !== this._brightness && (this._brightness = i, this.dispatcher.broadcast("setBrightness", i)); const o = this._changes.isDirty(); if (this._changes.isDirty()) { const e = this._changes.getLayerUpdatesByScope(); for (const t in e) { const { updatedIds: i, removedIds: o } = e[t]; (i || o) && this._updateWorkerLayers(t, i, o); } this.updateSourceCaches(), this._updateTilesForChangedImages(), this.updateLayers(t), this.light && this.light.updateTransitions(t), this.ambientLight && this.ambientLight.updateTransitions(t), this.directionalLight && this.directionalLight.updateTransitions(t), this.fog && this.fog.updateTransitions(t), this._changes.reset(); } const r = {}; for (const e in this._mergedSourceCaches) { const t = this._mergedSourceCaches[e]; r[e] = t.used, t.used = !1; } for (const e of this._mergedOrder) { const i = this._mergedLayers[e]; if (i.recalculate(t, this._availableImages), !i.isHidden(t.zoom)) { const e = this.getLayerSourceCache(i); e && (e.used = !0); } if (!this._precompileDone && this._shouldPrecompile) for (let e = i.minzoom || 0; e < (i.maxzoom || 25.5); e++) { const e = this.map.painter; if (e) { const o = i.getProgramIds(); if (!o) continue; for (const r of o) { const o = i.getDefaultProgramParams(r, t.zoom); o && (e.style = this, this.fog && (e._fogVisible = !0, o.overrideFog = !0, e.getOrCreateProgram(r, o)), e._fogVisible = !1, o.overrideFog = !1, e.getOrCreateProgram(r, o), (this.stylesheet.terrain || this.stylesheet.projection && "globe" === this.stylesheet.projection.name) && (o.overrideRtt = !0, e.getOrCreateProgram(r, o))); } } } } this._shouldPrecompile && (this._precompileDone = !0); for (const t in r) { const i = this._mergedSourceCaches[t]; r[t] !== i.used && i.getSource().fire(new e.a8("data", { sourceDataType: "visibility", dataType: "source", sourceId: i.getSource().id })); } this.light && this.light.recalculate(t), this.terrain && this.terrain.recalculate(t), this.fog && this.fog.recalculate(t), this.z = t.zoom, this._markersNeedUpdate && (this._updateMarkersOpacity(), this._markersNeedUpdate = !1), o && this.fire(new e.a8("data", { dataType: "style" })); } _updateTilesForChangedImages() { const e = this._changes.getUpdatedImages(); if (e.length) { for (const t in this._sourceCaches) this._sourceCaches[t].reloadTilesForDependencies(["icons", "patterns"], e); this._changes.resetUpdatedImages(); } } _updateWorkerLayers(e, t, i) { const o = this.getFragmentStyle(e); o && this.dispatcher.broadcast("updateLayers", { layers: t ? o._serializeLayers(t) : [], scope: e, removedIds: i || [], options: o.options }); }
41 setState(i) { if (this._checkLoaded(), Cr(this, e.aj(i))) return !1; (i = e.co(i)).layers = dt(i.layers); const o = function (e, i) { if (!e) return [{ command: ut.setStyle, args: [i] }]; let o = []; try { if (!t(e.version, i.version)) return [{ command: ut.setStyle, args: [i] }]; t(e.center, i.center) || o.push({ command: ut.setCenter, args: [i.center] }), t(e.zoom, i.zoom) || o.push({ command: ut.setZoom, args: [i.zoom] }), t(e.bearing, i.bearing) || o.push({ command: ut.setBearing, args: [i.bearing] }), t(e.pitch, i.pitch) || o.push({ command: ut.setPitch, args: [i.pitch] }), t(e.sprite, i.sprite) || o.push({ command: ut.setSprite, args: [i.sprite] }), t(e.glyphs, i.glyphs) || o.push({ command: ut.setGlyphs, args: [i.glyphs] }), t(e.imports, i.imports) || function (e = [], i = [], o) { i = i || []; const r = (e = e || []).map(xt), s = i.map(xt), n = e.reduce(yt, {}), a = i.reduce(yt, {}), l = r.slice(); let c, h, _, d; for (c = 0, h = 0; c < r.length; c++)_ = r[c], a.hasOwnProperty(_) ? h++ : (o.push({ command: ut.removeImport, args: [_] }), l.splice(l.indexOf(_, h), 1)); for (c = 0, h = 0; c < s.length; c++)_ = s[s.length - 1 - c], l[l.length - 1 - c] !== _ && (n.hasOwnProperty(_) ? (o.push({ command: ut.removeImport, args: [_] }), l.splice(l.lastIndexOf(_, l.length - h), 1)) : h++, d = l[l.length - c], o.push({ command: ut.addImport, args: [a[_], d] }), l.splice(l.length - c, 0, _)); for (const e of i) { const i = n[e.id]; if (!i || t(i, e)) continue; t(i.config, e.config) || o.push({ command: ut.setImportConfig, args: [e.id, e.config] }), t(i.url, e.url) || o.push({ command: ut.setImportUrl, args: [e.id, e.url] }); const r = e.data; t(i && i.data, r) || o.push({ command: ut.setImportData, args: [e.id, r] }); } }(e.imports, i.imports, o), t(e.transition, i.transition) || o.push({ command: ut.setTransition, args: [i.transition] }), t(e.light, i.light) || o.push({ command: ut.setLight, args: [i.light] }), t(e.fog, i.fog) || o.push({ command: ut.setFog, args: [i.fog] }), t(e.projection, i.projection) || o.push({ command: ut.setProjection, args: [i.projection] }), t(e.lights, i.lights) || o.push({ command: ut.setLights, args: [i.lights] }), t(e.camera, i.camera) || o.push({ command: ut.setCamera, args: [i.camera] }); const r = {}, s = []; !function (e, i, o, r) { let s; for (s in i = i || {}, e = e || {}) e.hasOwnProperty(s) && (i.hasOwnProperty(s) || mt(s, o, r)); for (s in i) { if (!i.hasOwnProperty(s)) continue; const n = i[s]; e.hasOwnProperty(s) ? t(e[s], n) || ("geojson" === e[s].type && "geojson" === n.type && gt(e, i, s) ? o.push({ command: ut.setGeoJSONSourceData, args: [s, n.data] }) : ft(s, i, o, r)) : pt(s, i, o); } }(e.sources, i.sources, s, r); const n = []; e.layers && e.layers.forEach((e => { e.source && r[e.source] ? o.push({ command: ut.removeLayer, args: [e.id] }) : n.push(e); })); let a = e.terrain; a && r[a.source] && (o.push({ command: ut.setTerrain, args: [void 0] }), a = void 0), o = o.concat(s), t(a, i.terrain) || o.push({ command: ut.setTerrain, args: [i.terrain] }), function (e, i, o) { i = i || []; const r = (e = e || []).map(xt), s = i.map(xt), n = e.reduce(yt, {}), a = i.reduce(yt, {}), l = r.slice(), c = Object.create(null); let h, _, d, u, p, m, f; for (h = 0, _ = 0; h < r.length; h++)d = r[h], a.hasOwnProperty(d) ? _++ : (o.push({ command: ut.removeLayer, args: [d] }), l.splice(l.indexOf(d, _), 1)); for (h = 0, _ = 0; h < s.length; h++)d = s[s.length - 1 - h], l[l.length - 1 - h] !== d && (n.hasOwnProperty(d) ? (o.push({ command: ut.removeLayer, args: [d] }), l.splice(l.lastIndexOf(d, l.length - _), 1)) : _++, m = l[l.length - h], o.push({ command: ut.addLayer, args: [a[d], m] }), l.splice(l.length - h, 0, d), c[d] = !0); for (h = 0; h < s.length; h++)if (d = s[h], u = n[d], p = a[d], !c[d] && !t(u, p)) if (t(u.source, p.source) && t(u["source-layer"], p["source-layer"]) && t(u.type, p.type)) { for (f in vt(u.layout, p.layout, o, d, null, ut.setLayoutProperty), vt(u.paint, p.paint, o, d, null, ut.setPaintProperty), t(u.slot, p.slot) || o.push({ command: ut.setSlot, args: [d, p.slot] }), t(u.filter, p.filter) || o.push({ command: ut.setFilter, args: [d, p.filter] }), t(u.minzoom, p.minzoom) && t(u.maxzoom, p.maxzoom) || o.push({ command: ut.setLayerZoomRange, args: [d, p.minzoom, p.maxzoom] }), u) u.hasOwnProperty(f) && "layout" !== f && "paint" !== f && "filter" !== f && "metadata" !== f && "minzoom" !== f && "maxzoom" !== f && "slot" !== f && (0 === f.indexOf("paint.") ? vt(u[f], p[f], o, d, f.slice(6), ut.setPaintProperty) : t(u[f], p[f]) || o.push({ command: ut.setLayerProperty, args: [d, f, p[f]] })); for (f in p) p.hasOwnProperty(f) && !u.hasOwnProperty(f) && "layout" !== f && "paint" !== f && "filter" !== f && "metadata" !== f && "minzoom" !== f && "maxzoom" !== f && "slot" !== f && (0 === f.indexOf("paint.") ? vt(u[f], p[f], o, d, f.slice(6), ut.setPaintProperty) : t(u[f], p[f]) || o.push({ command: ut.setLayerProperty, args: [d, f, p[f]] })); } else o.push({ command: ut.removeLayer, args: [d] }), m = l[l.lastIndexOf(d) + 1], o.push({ command: ut.addLayer, args: [p, m] }); }(n, i.layers, o); } catch (e) { console.warn("Unable to compute style diff:", e), o = [{ command: ut.setStyle, args: [i] }]; } return o }(this.serialize(), i).filter((e => !(e.command in Sr))); if (0 === o.length) return !1; const r = o.filter((e => !(e.command in Ir))); if (r.length > 0) throw new Error(`Unimplemented: ${r.map((e => e.command)).join(", ")}.`); return o.forEach((e => { this[e.command].apply(this, e.args); })), this.stylesheet = i, this.mergeAll(), this.dispatcher.broadcast("setLayers", { layers: this._serializeLayers(this._order), scope: this.scope, options: this.options }), !0 } addImage(t, i) { return this.getImage(t) ? this.fire(new e.a7(new Error("An image with this name already exists."))) : (this.imageManager.addImage(t, this.scope, i), this._afterImageUpdated(t), this) } updateImage(e, t) { this.imageManager.updateImage(e, this.scope, t); } getImage(e) { return this.imageManager.getImage(e, this.scope) } removeImage(t) { return this.getImage(t) ? (this.imageManager.removeImage(t, this.scope), this._afterImageUpdated(t), this) : this.fire(new e.a7(new Error("No image with this name exists."))) } _afterImageUpdated(t) { this._availableImages = this.imageManager.listImages(this.scope), this._changes.updateImage(t), this.dispatcher.broadcast("setImages", { scope: this.scope, images: this._availableImages }), this.fire(new e.a8("data", { dataType: "style" })); } listImages() { return this._checkLoaded(), this._availableImages.slice() } addModel(t, i, o = {}
41) { return this._checkLoaded(), this._validate(e.cr, `models.${t}`, i, null, o) || (this.modelManager.addModel(t, i, this.scope), this._changes.setDirty()), this } hasModel(e) { return this.modelManager.hasModel(e, this.scope) } removeModel(t) { return this.hasModel(t) ? (this.modelManager.removeModel(t, this.scope), this) : this.fire(new e.a7(new Error("No model with this ID exists."))) } listModels() { return this._checkLoaded(), this.modelManager.listModels(this.scope) } addSource(t, i, o = {}) { if (this._checkLoaded(), void 0 !== this.getOwnSource(t)) throw new Error(`There is already a source with ID "${t}".`); if (!i.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`); if (["vector", "raster", "geojson", "video", "image"].indexOf(i.type) >= 0 && this._validate(e.cs, `sources.${t}`, i, null, o)) return; this.map && this.map._collectResourceTiming && (i.collectResourceTiming = !0); const r = st(t, i, this.dispatcher, this); r.scope = this.scope, r.setEventedParent(this, (() => ({ isSourceLoaded: this._isSourceCacheLoaded(r.id), source: r.serialize(), sourceId: r.id }))); const s = t => { const i = (t ? "symbol:" : "other:") + r.id, o = e.aE(i, this.scope), s = this._sourceCaches[i] = new e.bq(o, r, t); (t ? this._symbolSourceCaches : this._otherSourceCaches)[r.id] = s, s.onAdd(this.map); }; s(!1), "vector" !== i.type && "geojson" !== i.type || s(!0), r.onAdd && r.onAdd(this.map), o.isInitialLoad || (this.mergeSources(), this._changes.setDirty()); } removeSource(t) { this._checkLoaded(); const i = this.getOwnSource(t); if (!i) throw new Error("There is no source with this ID"); for (const i in this._layers) if (this._layers[i].source === t) return this.fire(new e.a7(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`))); if (this.terrain && this.terrain.scope === this.scope && this.terrain.get().source === t) return this.fire(new e.a7(new Error(`Source "${t}" cannot be removed while terrain is using it.`))); const o = this.getOwnSourceCaches(t); for (const t of o) { const i = e.cq(t.id); delete this._sourceCaches[i], this._changes.discardSourceCacheUpdate(t.id), t.fire(new e.a8("data", { sourceDataType: "metadata", dataType: "source", sourceId: t.getSource().id })), t.setEventedParent(null), t.clearTiles(); } return delete this._otherSourceCaches[t], delete this._symbolSourceCaches[t], this.mergeSources(), i.setEventedParent(null), i.onRemove && i.onRemove(this.map), this._changes.setDirty(), this } setGeoJSONSourceData(e, t) { this._checkLoaded(), this.getOwnSource(e).setData(t), this._changes.setDirty(); } getOwnSource(e) { const t = this.getOwnSourceCache(e); return t && t.getSource() } getOwnSources() { const e = []; for (const t in this._otherSourceCaches) { const i = this.getOwnSourceCache(t); i && e.push(i.getSource()); } return e } areTilesLoaded() { const e = this._mergedSourceCaches; for (const t in e) { const i = e[t]._tiles; for (const e in i) { const t = i[e]; if ("loaded" !== t.state && "errored" !== t.state) return !1 } } return !0 } setLights(t) { if (this._checkLoaded(), !t) return delete this.ambientLight, void delete this.directionalLight; const i = this._getTransitionParameters(); for (const o of t) { if (this._validate(e.ct, "lights", o)) return; switch (o.type) { case "ambient": if (this.ambientLight) { const e = this.ambientLight; e.set(o), e.updateTransitions(i); } else this.ambientLight = new qe(o, $e, this.scope, this.options); break; case "directional": if (this.directionalLight) { const e = this.directionalLight; e.set(o), e.updateTransitions(i); } else this.directionalLight = new qe(o, Xe, this.scope, this.options); } } const o = new e.al(this.z || 0, i); this.ambientLight && this.ambientLight.recalculate(o), this.directionalLight && this.directionalLight.recalculate(o), this._brightness = this.calculateLightsBrightness(), this.dispatcher.broadcast("setBrightness", this._brightness); } calculateLightsBrightness() { const t = this.directionalLight, i = this.ambientLight; if (!t || !i) return; const o = e => .2126 * (e[0] <= .03928 ? e[0] / 12.92 : Math.pow((e[0] + .055) / 1.055, 2.4)) + .7152 * (e[1] <= .03928 ? e[1] / 12.92 : Math.pow((e[1] + .055) / 1.055, 2.4)) + .0722 * (e[2] <= .03928 ? e[2] / 12.92 : Math.pow((e[2] + .055) / 1.055, 2.4)), r = t.properties.get("color").toArray01(), s = t.properties.get("intensity"), n = t.properties.get("direction"), a = 1 - e.b3(n.x, n.y, n.z)[2] / 90, l = o(r) * s * a, c = i.properties.get("color").toArray01(), h = i.properties.get("intensity"); return (l + o(c) * h) / 2 } getBrightness() { return this._brightness } getLights() { if (!this.enable3dLights()) return null; const e = []; return this.directionalLight && e.push(this.directionalLight.get()), this.ambientLight && e.push(this.ambientLight.get()), e } enable3dLights() { return !!this.ambientLight && !!this.directionalLight } getFragmentStyle(t) { if (!t) return this; if (e.cu(t)) { const i = e.cv(t), o = this.fragments.find((({ id: e }) => e === i)); if (!o) throw new Error(`Style import not found: ${t}`); const r = e.cq(t); return o.style.getFragmentStyle(r) } { const e = this.fragments.find((({ id: e }) => e === t)); if (!e) throw new Error(`Style import not found: ${t}`); return e.style } } getConfigProperty(t, i) { const o = this.getFragmentStyle(t); if (!o) return null; const r = e.aE(i, o.scope), s = o.options.get(r), n = s ? s.value || s.default : null; return n ? n.serialize() : null } setConfigProperty(t, i, o) { const r = e.cw(o); if ("success" !== r.result) return void Cr(this, r.value); const s = r.value.expression, n = this.getFragmentStyle(t); if (!n) return; const a = e.aE(i, n.scope), l = n.options.get(a); l && (this.options.set(a, { ...l, value: s }), this.updateConfigDependencies()); } setConfig(t, i) { if (this._config = t, t || i) if (i) for (const o in i) { let r, s; const n = e.cw(i[o].default); if ("success" === n.result && (r = n.value.expression), t && void 0 !== t[o]) { const i = e.cw(t[o
41]); "success" === i.result && (s = i.value.expression); } const { minValue: a, maxValue: l, stepValue: c, type: h, values: _ } = i[o]; if (r) { const t = e.aE(o, this.scope); this.options.set(t, { default: r, value: s, minValue: a, maxValue: l, stepValue: c, type: h, values: _ }); } else this.fire(new e.a7(new Error(`No schema defined for config option "${o}".`))); } else this.fire(new e.a7(new Error("Attempting to set config for a style without schema."))); } updateConfigDependencies() { for (const e of this._configDependentLayers) { const t = this.getLayer(e); t && (t.possiblyEvaluateVisibility(), this._updateLayer(t)); } this.ambientLight && this.ambientLight.updateConfig(this.options), this.directionalLight && this.directionalLight.updateConfig(this.options), this._changes.setDirty(); } addLayer(t, i, o = {}) { this._checkLoaded(); const r = t.id; if (this._layers[r]) return void this.fire(new e.a7(new Error(`Layer with id "${r}" already exists on this map`))); let s; if ("custom" === t.type) { if (Cr(this, e.cx(t))) return; s = e.cp(t, this.scope, this.options); } else { if ("object" == typeof t.source && (this.addSource(r, t.source), t = e.co(t), t = e.ak(t, { source: r })), this._validate(e.cy, `layers.${r}`, t, { arrayIndex: -1 }, o)) return; s = e.cp(t, this.scope, this.options), this._validateLayer(s), s.setEventedParent(this, { layer: { id: r } }), this._serializedLayers[s.id] = s.serialize(); } s.isConfigDependent && this._configDependentLayers.add(s.fqid); let n = this._order.length; if (i) { const t = this._order.indexOf(i); if (-1 === t) return void this.fire(new e.a7(new Error(`Layer with i
41d "${i}" does not exist on this map.`))); s.slot === this._layers[i].slot ? n = t : e.X(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`); } this._order.splice(n, 0, r), this._layerOrderChanged = !0, this._layers[r] = s; const a = this.getOwnLayerSourceCache(s), l = !!this.directionalLight && this.directionalLight.shadowsEnabled(); a && s.canCastShadows() && l && (a.castsShadows = !0); const c = this._changes.getRemovedLayer(s); if (c && s.source && a && "custom" !== s.type) { this._changes.discardLayerRemoval(s); const t = e.aE(s.source, s.scope); c.type !== s.type ? this._changes.updateSourceCache(t, "clear") : (this._changes.updateSourceCache(t, "reload"), a.pause()); } this._updateLayer(s), s.onAdd && s.onAdd(this.map), s.scope = this.scope, this.mergeLayers(); } moveLayer(t, i) { this._checkLoaded(); const o = this._checkLayer(t); if (!o) return; if (t === i) return; const r = this._order.indexOf(t); this._order.splice(r, 1); let s = this._order.length; if (i) { const t = this._order.indexOf(i); if (-1 === t) return void this.fire(new e.a7(new Error(`Layer with i
41d "${i}" does not exist on this map.`))); o.slot === this._layers[i].slot ? s = t : e.X(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`); } this._order.splice(s, 0, t), this._changes.setDirty(), this._layerOrderChanged = !0, this.mergeLayers(); } removeLayer(e) { this._checkLoaded(); const t = this._checkLayer(e); if (!t) return; t.setEventedParent(null); const i = this._order.indexOf(e); this._order.splice(i, 1), delete this._layers[e], delete this._serializedLayers[e], this._changes.setDirty(), this._layerOrderChanged = !0, this._configDependentLayers.delete(t.fqid), this._changes.removeLayer(t); const o = this.getOwnLayerSourceCache(t); if (o && o.castsShadows) { let e = !1; for (const i in this._layers) if (this._layers[i].source === t.source && this._layers[i].canCastShadows()) { e = !0; break } o.castsShadows = e; } t.onRemove && t.onRemove(this.map), this.mergeLayers(); } getOwnLayer(e) { return this._layers[e] } hasLayer(e) { return e in this._mergedLayers } hasLayerType(e) { for (const t in this._layers) if (this._layers[t].type === e) return !0; return !1 } setLayerZoomRange(e, t, i) { this._checkLoaded(); const o = this._checkLayer(e); o && (o.minzoom === t && o.maxzoom === i || (null != t && (o.minzoom = t), null != i && (o.maxzoom = i), this._updateLayer(o))); } setSlot(e, t) { this._checkLoaded(); const i = this._checkLayer(e); i && i.slot !== t && (i.slot = t, this._updateLayer(i)); } setFilter(i, o, r = {}) { this._checkLoaded(); const s = this._checkLayer(i); if (s && !t(s.filter, o)) return null == o ? (s.filter = void 0, void this._updateLayer(s)) : void (this._validate(e.cz, `layers.${s.id}.filter`, o, { layerType: s.type }, r) || (s.filter = e.co(o), this._updateLayer(s))) } getFilter(t) { const i = this._checkLayer(t); if (i) return e.co(i.filter) } setLayoutProperty(e, i, o, r = {}) { this._checkLoaded(); const s = this._checkLayer(e); s && (t(s.getLayoutProperty(i), o) || (s.setLayoutProperty(i, o, r), s.isConfigDependent && this._configDependentLayers.add(s.fqid), this._updateLayer(s))); } getLayoutProperty(e, t) { const i = this._checkLayer(e); if (i) return i.getLayoutProperty(t) } setPaintProperty(e, i, o, r = {}) { this._checkLoaded(); const s = this._checkLayer(e); if (!s) return; if (t(s.getPaintProperty(i), o)) return; const n = s.setPaintProperty(i, o, r); s.isConfigDependent && this._configDependentLayers.add(s.fqid), n && this._updateLayer(s), this._changes.updatePaintProperties(s); } getPaintProperty(e, t) { const i = this._checkLayer(e); if (i) return i.getPaintProperty(t) } setFeatureState(t, i) { this._checkLoaded(); const o = t.source, r = t.sourceLayer, s = this._checkSource(o); if (!s) return; const n = s.type; if ("geojson" === n && r) return void this.fire(new e.a7(new Error("GeoJSON sources cannot have a sourceLayer parameter."))); if ("vector" === n && !r) return void this.fire(new e.a7(new Error("The sourceLayer parameter must be provided for vector source types."))); void 0 === t.id && this.fire(new e.a7(new Error("The feature id parameter must be provided."))); const a = this.getOwnSourceCaches(o); for (const e of a) e.setFeatureState(r, t.id, i); } removeFeatureState(t, i) { this._checkLoaded(); const o = t.source, r = this._checkSource(o); if (!r) return; const s = r.type, n = "vector" === s ? t.sourceLayer : void 0; if ("vector" === s && !n) return void this.fire(new e.a7(new Error("The sourceLayer parameter must be provided for vector source types."))); if (i && "string" != typeof t.id && "number" != typeof t.id) return void this.fire(new e.a7(new Error("A feature id is required to remove its specific state property."))); const a = this.getOwnSourceCaches(o); for (const e of a) e.removeFeatureState(n, t.id, i); } getFeatureState(t) { this._checkLoaded(); const i = t.source, o = t.sourceLayer, r = this._checkSource(i); if (r) { if ("vector" !== r.type || o) return void 0 === t.id && this.fire(new e.a7(new Error("The feature id parameter must be provided."))), this.getOwnSourceCaches(i)[0].getFeatureState(o, t.id); this.fire(new e.a7(new Error("The sourceLayer parameter must be provided for vector source types."))); } } setTransition(t) { return this.stylesheet.transition = e.ak({}, this.stylesheet.transition, t), this.transition = this.stylesheet.transition, this } getTransition() { return e.ak({}, this.stylesheet.transition) } serialize() { this._checkLoaded(); const t = this.getTerrain(), i = t && this.terrain && this.terrain.scope === this.scope ? t : this.stylesheet.terrain; return e.cA({ version: this.stylesheet.version, name: this.stylesheet.name, metadata: this.stylesheet.metadata, imports: this._serializeImports(), schema: this.stylesheet.schema, camera: this.stylesheet.camera, light: this.stylesheet.light, lights: this.stylesheet.lights, terrain: i, fog: this.stylesheet.fog, center: this.stylesheet.center, zoom: this.stylesheet.zoom, bearing: this.stylesheet.bearing, pitch: this.stylesheet.pitch, sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, projection: this.stylesheet.projection, sources: this._serializeSources(), layers: this._serializeLayers(this._order) }, (e => void 0 !== e)) } _updateLayer(t) { this._changes.updateLayer(t); const i = this.getLayerSourceCache(t), o = e.aE(t.source, t.scope), r = this._changes.getUpd
41atedSourceCaches(); t.source && !r[o] && i && "raster" !== i.getSource().type && (this._changes.updateSourceCache(o, "reload"), i.pause()), t.invalidateCompiledFilter(); } _flattenAndSortRenderedFeatures(e) { const t = e => "fill-extrusion" === this._mergedLayers[e].type, i = this.order, o = {}, r = []; for (let s = i.length - 1; s >= 0; s--) { const n = i[s]; if (t(n)) { o[n] = s; for (const t of e) { const e = t[n]; if (e) for (const t of e) r.push(t); } } } r.sort(((e, t) => t.intersectionZ - e.intersectionZ)); const s = []; for (let n = i.length - 1; n >= 0; n--) { const a = i[n]; if (t(a)) for (let e = r.length - 1; e >= 0; e--) { const t = r[e].feature; if (o[t.layer.id] < n) break; s.push(t), r.pop(); } else for (const t of e) { const e = t[a]; if (e) for (const t of e) s.push(t.feature); } } return s } queryRenderedFeatures(t, i, o) { i && i.filter && this._validate(e.cz, "queryRenderedFeatures.filter", i.filter, null, i), i.scope = this.scope, i.availableImages = this._availableImages, i.serializedLayers = this._serializedLayers; const r = {}; if (i && i.layers) { if (!Array.isArray(i.layers)) return this.fire(new e.a7(new Error("parameters.layers must be an Array."))), []; for (const t of i.layers) { const i = this._mergedLayers[t]; if (!i) return this.fire(new e.a7(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))), []; r[i.source] = !0; } } const s = [], n = i.serializedLayers || {}, a = i && i.layers ? i.layers.some((e => { const t = this.getLayer(e); return t && t.is3D() })) : this.has3DLayers(), l = Je.createFromScreenPoints(t, o); for (const e in this._mergedSourceCaches) { const t = this._mergedSourceCaches[e].getSource(); if (!t || t.scope !== i.scope) continue; const c = this._mergedSourceCaches[e].getSource().id; i.layers && !r[c] || s.push(at(this._mergedSourceCaches[e], this._mergedLayers, n, l, i, o, a, !!this.map._showQueryGeometry)); } return this.placement && s.push(function (e, t, i, o, r, s, n) { const a = {}, l = s.queryRenderedSymbols(o), c = []; for (const e of Object.keys(l).map(Number)) c.push(n[e]); c.sort(ct); for (const i of c) { const o = i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId], t, i.bucketIndex, i.sourceLayerIndex, r.filter, r.layers, r.availableImages, e); for (const e in o) { const t = a[e] = a[e] || [], r = o[e]; r.sort(((e, t) => { const o = i.featureSortOrder; if (o) { const i = o.indexOf(e.featureIndex); return o.indexOf(t.featureIndex) - i } return t.featureIndex - e.featureIndex })); for (const e of r) t.push(e); } } for (const t in a) a[t].forEach((o => { const r = o.feature, s = i(e[t]); if (!s) return; const n = s.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._mergedLayers, n, this.getLayerSourceCache.bind(this), l.screenGeometry, i, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(s) } querySourceFeatures(t, i) { i && i.filter && this._validate(e.cz, "querySourceFeatures.filter", i.filter, null, i); const o = this.getOwnSourceCaches(t); let r = []; for (const e of o) r = r.concat(lt(e, i)); return r } addSourceType(e, t, i) { return Dr.getSourceType(e) ? i(new Error(`A source type called "${e}" already exists.`)) : (Dr.setSourceType(e, t), t.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", { name: e, url: t.workerSourceURL }, i) : i(null, null)) } getFlatLight() { return this.light.getLight() } setFlatLight(e, i, o = {}) { this._checkLoaded(); const r = this.light.getLight(); let s = !1; for (const i in e) if (!t(e[i], r[i])) { s = !0; break } if (!s) return; const n = this._getTransitionParameters(); this.light.setLight(e, i, o), this.light.updateTransitions(n); } getTerrain() { return this.terrain && 1 === this.terrain.drapeRenderMode ? this.terrain.get() : null } setTerrainForDraping() { this.setTerrain({ source: "", exaggeration: 0 }, 0); } setTerrain(i, o = 1) { if (this._checkLoaded(), !i) return delete this.terrain, null === i ? this.stylesheet.terrain = null : delete this.stylesheet.terrain, this._force3DLayerUpdate(), void (this._markersNeedU
41pdate = !0); let r = i; const s = null == i.source; if (1 === o) { if ("object" == typeof r.source) { const t = "terrain-dem-src"; this.addSource(t, r.source), r = e.co(r), r = e.ak(r, { source: t }); } const t = e.ak({}, r), i = {}; if (this.terrain && s) { t.source = this.terrain.get().source; const e = this.terrain ? this.getFragmentStyle(this.terrain.scope) : null; e && (i.style = e.serialize()); } if (this._validate(e.cB, "terrain", t, i)) return } if (!this.terrain || this.terrain.scope !== this.scope && !s || this.terrain && o !== this.terrain.drapeRenderMode) { if (!r) return; this._createTerrain(r, o), this.fire(new e.a8("data", { dataType: "style" })); } else { const o = this.terrain, s = o.get(); for (const t of Object.keys(e.ae.terrain)) !r.hasOwnProperty(t) && e.ae.terrain[t].default && (r[t] = e.ae.terrain[t].default); for (const r in i) if (!t(i[r], s[r])) { o.set(i, this.options), this.stylesheet.terrain = i; const t = this._getTransitionParameters({ duration: 0 }); o.updateTransitions(t), this.fire(new e.a8("data", { dataType: "style" })); break } } this.mergeTerrain(), this.updateDrapeFirstLayers(), this._markersNeedUpdate = !0; } _createFog(e) { const t = this.fog = new He(e, this.map.transform); this.stylesheet.fog = t.get(); const i = this._getTransitionParameters({ duration: 0 }); t.updateTransitions(i); } _updateMarkersOpacity() { 0 !== this.map._markers.length && this.map._requestDomTask((() => { for (const e of this.map._markers) e._evaluateOpacity(); })); } getFog() { return this.fog ? this.fog.get() : null } setFog(e) { if (this._checkLoaded(), !e) return delete this.fog, delete this.stylesheet.fog, void (this._markersNeedUpdate = !0); if (this.fog) { const i = this.fog; if (!t(i.get(), e)) { i.set(e), this.stylesheet.fog = i.get(); const t = this._getTransitionParameters({ duration: 0 }); i.updateTransitions(t); } } else this._createFog(e); this._markersNeedUpdate = !0; } _getTransitionParameters(t) { return { now: e.a4.now(), transition: e.ak(this.transition, t) } } updateDrapeFirstLayers() { if (!this.terrain) return; const e = [], t = []; for (const i in this._mergedLayers) this.isLayerDraped(this._mergedLayers[i]) ? e.push(i) : t.push(i); this._drapedFirstOrder = [], this._drapedFirstOrder.push(...e), this._drapedFirstOrder.push(...t); } _createTerrain(e, t) { const i = this.terrain = new Be(e, t, this.scope, this.options); 1 === t && (this.stylesheet.terrain = e), this.mergeTerrain(), this.updateDrapeFirstLayers(), this._force3DLayerUpdate(); const o = this._getTransitionParameters({ duration: 0 }); i.updateTransitions(o); } _force3DLayerUpdate() { for (const e in this._layers) { const t = this._layers[e]; "fill-extrusion" === t.type && this._updateLayer(t); } } _forceSymbolLayerUpdate() { for (const e in this._layers) { const t = this._layers[e]; "symbol" === t.type && this._updateLayer(t); } } _validate(t, i, o, r, s = {}) { if (s && !1 === s.validate) return !1; const n = e.ak({}, this.serialize()); return Cr(this, t.call(e.aj, e.ak({ key: i, style: n, value: o, styleSpec: e.ae }, r))) } _remove() { this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.cancel(), this._spriteRequest = null), e.cC.off("pluginStateChange", this._rtlTextPluginCallback); for (const e in this._mergedLayers) this._mergedLayers[e].setEventedParent(null); for (const e in this._mergedSourceCaches) this._mergedSourceCaches[e].clearTiles(), this._mergedSourceCaches[e].setEventedParent(null); this.setEventedParent(null), delete this.fog, delete this.terrain, delete this.ambientLight, delete this.directionalLight, this.isRootStyle() && (this.imageManager.setEventedParent(null), this.modelManager.setEventedParent(null), this.dispatcher.remove()); } clearSource(e) { const t = this.getSourceCaches(e); for (const e of t) e.clearTiles(); } clearSources() { for (const e in this._mergedSourceCaches) this._mergedSourceCaches[e].clearTiles(); } reloadSource(e) { const t = this.getSourceCaches(e); for (const e of t) e.resume(), e.reload(); }
41 reloadSources() { for (const e of this.getSources()) e.reload && e.reload(); } updateSources(e) { let t; this.directionalLight && (t = br(this.directionalLight)); for (const i in this._mergedSourceCaches) this._mergedSourceCaches[i].update(e, void 0, void 0, t); } _generateCollisionBoxes() { for (const e in this._sourceCaches) { const t = this._sourceCaches[e]; t.resume(), t.reload(); } } _updatePlacement(t, i, o, r, s = !1) { let n = !1, a = !1; const l = {}, c = {}; for (const i of this._mergedOrder) { const o = this._mergedLayers[i]; if ("symbol" !== o.type) continue; const r = e.aE(o.source, o.scope); let s = l[r]; if (!s) { const e = this.getLayerSourceCache(o); if (!e) continue; const t = e.getRenderableIds(!0).map((t => e.getTileByID(t))); c[r] = t.slice(), s = l[r] = t.sort(((e, t) => t.tileID.overscaledZ - e.tileID.overscaledZ || (e.tileID.isLessThan(t.tileID) ? -1 : 1))); } const a = this.crossTileSymbolIndex.addLayer(o, s, t.center.lng, t.projection); n = n || a; } if (this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder), s = s || this._layerOrderChanged || 0 === o, this._layerOrderChanged && this.fire(new e.a8("neworder")), (s || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(e.a4.now(), t.zoom)) && (this.pauseablePlacement = new $t(t, this._mergedOrder, s, i, o, r, this.placement, this.fog && t.projection.supportsFog ? this.fog.state : null, this._buildingIndex), this._layerOrderChanged = !1), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._mergedOrder, this._mergedLayers, l, c), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(e.a4.now()), a = !0), n && this.pauseablePlacement.placement.setStale()), a || n) for (const t of this._mergedOrder) { const i = this._mergedLayers[t]; "symbol" === i.type && this.placement.updateLayerOpacities(i, l[e.aE(i.source, i.scope)]); } return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(e.a4.now()) } _releaseSymbolFadeTiles() { for (const e in this._sourceCaches) this._sourceCaches[e].releaseSymbolFadeTiles(); } addImport(t) { this._checkLoaded(); const i = this.stylesheet.imports = this.stylesheet.imports || []; return -1 !== i.findIndex((({ id: e }) => e === t.id)) ? this.fire(new e.a7(new Error(`Import with id '${t.id}' already exists in the map's style.`))) : (i.push(t), this._loadImports([t], !0), this) } setImportUrl(e, t) { this._checkLoaded(); const i = this.stylesheet.imports || [], o = this.getImportIndex(e); if (-1 === o) return this; i[o].url = t; const r = this.fragments[o]; return r.style = this._createFragmentStyle(i[o]), r.style.on("style.import.load", (() => this.mergeAll())), r.style.loadURL(t), this } setImportData(e, t) { this._checkLoaded(); const i = this.getImportIndex(e), o = this.stylesheet.imports || []; return -1 === i ? this : t ? (this.fragments[i].style.setState(t), this._reloadImports(), this) : (delete o[i].data, this.setImportUrl(e, o[i].url)) } setImportConfig(e, t) { this._checkLoaded(); const i = this.getImportIndex(e), o = this.stylesheet.imports || []; if (-1 === i) return this; t ? o[i].config = t : delete o[i].config; const r = this.fragments[i], s = r.style.stylesheet && r.style.stylesheet.schema; return r.config = t, r.style.setConfig(t, s), this.updateConfigDependencies(), this } removeImport(e) { this._checkLoaded(); const t = this.stylesheet.imports || [], i = this.getImportIndex(e); return -1 === i || (t.splice(i, 1), this.fragments[i].style._remove(), this.fragments.splice(i, 1), this._reloadImports()), this } getImportIndex(t) { const i = (this.stylesheet.imports || []).findIndex((e => e.id === t)); return -1 === i && this.fire(new e.a7(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))), i } getLayer(e) { return this._mergedLayers[e] } getSources() { const e = []; for (const t in this._mergedOtherSourceCaches) { const i = this._mergedOtherSourceCaches[t]; i && e.push(i.getSource()); } return e }
41 getSource(e, t) { const i = this.getSourceCache(e, t); return i && i.getSource() } getLayerSource(e) { const t = this.getLayerSourceCache(e); return t && t.getSource() } getSourceCache(t, i) { const o = e.aE(t, i); return this._mergedOtherSourceCaches[o] } getLayerSourceCache(t) { const i = e.aE(t.source, t.scope); return "symbol" === t.type ? this._mergedSymbolSourceCaches[i] : this._mergedOtherSourceCaches[i] } getSourceCaches(e) { const t = []; return this._mergedOtherSourceCaches[e] && t.push(this._mergedOtherSourceCaches[e]), this._mergedSymbolSourceCaches[e] && t.push(this._mergedSymbolSourceCaches[e]), t } updateSourceCaches() { const e = this._changes.getUpdatedSourceCaches(); for (const t in e) { const i = e[t]; "reload" === i ? this.reloadSource(t) : "clear" === i && this.clearSource(t); } } updateLayers(e) { const t = this._changes.getUpdatedPaintProperties(); for (const i of t) { const t = this.getLayer(i); t && t.updateTransitions(e); } } getImages(e, t, i) { this.imageManager.getImages(t.icons, t.scope, i), this._updateTilesForChangedImages(); const o = e => { e && e.setDependencies(t.tileID.key, t.type, t.icons); }; o(this._otherSourceCaches[t.source]), o(this._symbolSourceCaches[t.source]); } getGlyphs(e, t, i) { this.glyphManager.getGlyphs(t.stacks, t.scope, i); } getResource(t, i, o) { return e.cD(i, o) } getOwnSourceCache(e) { return this._otherSourceCaches[e] } getOwnLayerSourceCache(e) { return "symbol" === e.type ? this._symbolSourceCaches[e.source] : this._otherSourceCaches[e.source] } getOwnSourceCaches(e) { const t = []; return this._otherSourceCaches[e] && t.push(this._otherSourceCaches[e]), this._symbolSourceCaches[e] && t.push(this._symbolSourceCaches[e]), t } _isSourceCacheLoaded(t) { const i = this.getOwnSourceCaches(t); return 0 === i.length ? (this.fire(new e.a7(new Error(`There is no source with ID '${t}'`))), !1) : i.every((e => e.loaded())) } has3DLayers() { return this._has3DLayers } hasSymbolLayers() { return this._hasSymbolLayers } hasCircleLayers() { return this._hasCircleLayers } _clearWorkerCaches() { this.dispatcher.broadcast("clearCaches"); } destroy() { this._clearWorkerCaches(), this.terrainSetForDrapingOnly() && (delete this.terrain, delete this.stylesheet.terrain); } } function Ar(e, t) { let i = !1, o = null; const r = () => { o = null, i && (e(), o = setTimeout(r, t), i = !1); }; return () => (i = !0, o || r(), o) } Dr.getSourceType = function (e) { return rt[e] }, Dr.setSourceType = function (e, t) { rt[e] = t; }, Dr.registerForPluginStateChange = e.ci; class Rr { constructor(t) { this._hashName = t && encodeURIComponent(t), e.aR(["_getCurrentHash", "_onHashChange", "_updateHash"], this), this._updateHash = Ar(this._updateHashUnthrottled.bind(this), 300); } addTo(e) { return this._map = e, window.addEventListener("hashchange", this._onHashChange, !1), e.on("moveend", this._updateHash), this } remove() { return this._map ? (this._map.off("moveend", this._updateHash), window.removeEventListener("hashchange", this._onHashChange, !1), clearTimeout(this._updateHash()), this._map = void 0, this) : this } getHashString() { const e = this._map; if (!e) return ""; const t = zr(e); if (this._hashName) { const e = this._hashName; let i = !1; const o = location.hash.slice(1).split("&").map((o => { const r = o.split("=")[0]; return r === e ? (i = !0, `${r}=${t}`) : o })).filter((e => e)); return i || o.push(`${e}=${t}`), `#${o.join("&")}` } return `#${t}` } _getCurrentHash() { const e = location.hash.replace("#", ""); if (this._hashName) { let t; return e.split("&").map((e => e.split("="))).forEach((e => { e[0] === this._hashName && (t = e); })), (t && t[1] || "").split("/") } return e.split("/") } _onHashChange() { const e = this._map; if (!e) return !1; const t = this._getCurrentHash(); if (t.length >= 3 && !t.some((e => isNaN(e)))) { const i = e.dragRotate.isEnabled() && e.touchZoomRotate.isEnabled() ? +(t[3] || 0) : e.getBearing(); return e.jumpTo({ center: [+t[2], +t[1]], zoom: +t[0], bearing: i, pitch: +(t[4] || 0) }), !0 } return !1 } _updateHashUnthrottled() { history.replaceState(history.state, "", location.href.replace(/(#.+)?$/, this.getHashString())); } } function zr(e, t) { const i = e.getCenter(), o = Math.round(100 * e.getZoom()) / 100, r = Math.
vendor: 44,056 bytes, line 41
41ceil((o * Math.LN2 + Math.log(512 / 360 / .5)) / Math.LN10), s = Math.pow(10, r), n = Math.round(i.lng * s) / s, a = Math.round(i.lat * s) / s, l = e.getBearing(), c = e.getPitch(); let h = t ? `/${n}/${a}/${o}` : `${o}/${a}/${n}`; return (l || c) && (h += "/" + Math.round(10 * l) / 10), c && (h += `/${Math.round(c)}`), h } const Or = { linearity: .3, easing: e.cE(0, 0, .3, 1) }, Fr = e.ak({ deceleration: 2500, maxSpeed: 1400 }, Or), Br = e.ak({ deceleration: 20, maxSpeed: 1400 }, Or), kr = e.ak({ deceleration: 1e3, maxSpeed: 360 }, Or), Nr = e.ak({ deceleration: 1e3, maxSpeed: 90 }, Or); class Ur { constructor(e) { this._map = e, this.clear(); } clear() { this._inertiaBuffer = []; } record(t) { this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: e.a4.now(), settings: t }); } _drainInertiaBuffer() { const t = this._inertiaBuffer, i = e.a4.now(); for (; t.length > 0 && i - t[0].time > 160;)t.shift(); } _onMoveEnd(t) { if (this._map._prefersReducedMotion()) return; if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return; const i = { zoom: 0, bearing: 0, pitch: 0, pan: new e.P(0, 0), pinchAround: void 0, around: void 0 }; for (const { settings: e } of this._inertiaBuffer) i.zoom += e.zoomDelta || 0, i.bearing += e.bearingDelta || 0, i.pitch += e.pitchDelta || 0, e.panDelta && i.pan._add(e.panDelta), e.around && (i.around = e.around), e.pinchAround && (i.pinchAround = e.pinchAround); const o = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, r = {}; if (i.pan.mag()) { const s = jr(i.pan.mag(), o, e.ak({}, Fr, t || {})); r.offset = i.pan.mult(s.amount / i.pan.mag()), r.center = this._map.transform.center, Gr(r, s); } if (i.zoom) { const e = jr(i.zoom, o, Br); r.zoom = this._map.transform.zoom + e.amount, Gr(r, e); } if (i.bearing) { const t = jr(i.bearing, o, kr); r.bearing = this._map.transform.bearing + e.c(t.amount, -179, 179), Gr(r, t); } if (i.pitch) { const e = jr(i.pitch, o, Nr); r.pitch = this._map.transform.pitch + e.amount, Gr(r, e); } if (r.zoom || r.bearing) { const e = void 0 === i.pinchAround ? i.around : i.pinchAround; r.around = e ? this._map.unproject(e) : this._map.getCenter(); } return this.clear(), r.noMoveStart = !0, r } } function Gr(e, t) { (!e.duration || e.duration < t.duration) && (e.duration = t.duration, e.easing = t.easing); } function jr(t, i, o) { const { maxSpeed: r, linearity: s, deceleration: n } = o, a = e.c(t * s / (i / 1e3), -r, r), l = Math.abs(a) / (n * s); return { easing: o.easing, duration: 1e3 * l, amount: a * (l / 2) } } class Vr extends e.a8 { preventDefault() { this._defaultPrevented = !0; } get defaultPrevented() { return this._defaultPrevented } constructor(t, i, o, r = {}) { const s = p(i.getCanvasContainer(), o), n = i.unproject(s); super(t, e.ak({ point: s, lngLat: n, originalEvent: o }, r)), this._defaultPrevented = !1, this.target = i; } } class Zr extends e.a8 { preventDefault() { this._defaultPrevented = !0; } get defaultPrevented() { return this._defaultPrevented } constructor(t, i, o) { const r = "touchend" === t ? o.changedTouches : o.touches, s = m(i.getCanvasContainer(), r), n = s.map((e => i.unproject(e))), a = s.reduce(((e, t, i, o) => e.add(t.div(o.length))), new e.P(0, 0)); super(t, { points: s, point: a, lngLats: n, lngLat: i.unproject(a), originalEvent: o }), this._defaultPrevented = !1; } } class Wr extends e.a8 { preventDefault() { this._defaultPrevented = !0; } get defaultPrevented() { return this._defaultPrevented } constructor(e, t, i) { super(e, { originalEvent: i }), this._defaultPrevented = !1; } } class Hr { constructor(e, t) { this._map = e, this._clickTolerance = t.clickTolerance; } reset() { this._mousedownPos = void 0; } wheel(e) { return this._firePreventable(new Wr(e.type, this._map, e)) } mousedown(e, t) { return this._mousedownPos = t, this._firePreventable(new Vr(e.type, this._map, e)) } mouseup(e) { this._map.fire(new Vr(e.type, this._map, e)); } preclick(t) { const i = e.ak({}, t); i.type = "preclick", this._map.fire(new Vr(i.type, this._map, i)); } click(e, t) { this._mousedownPos && this._mousedownPos.dist(t) >= this._clickTolerance || (this.preclick(e), this._map.fire(new Vr(e.type, this._map, e))); } dblclick(e) { return this._firePreventable(new Vr(e.type, this._map, e)) } mouseover(e) { this._map.fire(new Vr(e.type, this._map, e)); } mouseout(e) { this._map.fire(new Vr(e.type, this._map, e)); } touchstart(e) { return this._firePreventable(new Zr(e.type, this._map, e)) } touchmove(e) { this._map.fire(new Zr(e.type, this._map, e)); } touchend(e) { this._map.fire(new Zr(e.type, this._map, e)); } touchcancel(e) { this._map.fire(new Zr(e.type, this._map, e)); } _firePreventable(e) { if (this._map.fire(e), e.defaultPrevented) return {} } isEnabled() { return !0 } isActive() { return !1 } enable() { } disable() { } } class qr { constructor(e) { this._map = e; } reset() { this._delayContextMenu = !1, this._contextMenuEvent = void 0; } mousemove(e) { this._map.fire(new Vr(e.type, this._map, e)); } mousedown() { this._delayContextMenu = !0; } mouseup() { this._delayContextMenu = !1, this._contextMenuEvent && (this._map.fire(new Vr("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent); } contextmenu(e) { this._delayContextMenu ? this._contextMenuEvent = e : this._map.fire(new Vr(e.type, this._map, e)), this._map.listens("contextmenu") && e.preventDefault(); } isEnabled() { return !0 } isActive() { return !1 } enable() { } disable() { } } class $r { constructor(e, t) { this._map = e, this._el = e.getCanvasContainer(), this._container = e.getContainer(), this._clickTolerance = t.clickTolerance || 1; } isEnabled() { return !!this._enabled } isActive() { return !!this._active } enable() { this.isEnabled() || (this._enabled = !0); } disable() { this.isEnabled() && (this._enabled = !1); } mousedown(e, t) { this.isEnabled() && e.shiftKey && 0 === e.button && (h(), this._startPos = this._lastPos = t, this._active = !0); } mousemoveWindow(e, t) { if (!this._active) return; const i = t, o = this._startPos, r = this._lastPos; if (!o || !r || r.equals(i) || !this._box && i.dist(o) < this._clickTolerance) return; this._lastPos = i, this._box || (this._box = s("div", "mapboxgl-boxzoom", this._container), this._container.classList.add("mapboxgl-crosshair"), this._fireEvent("boxzoomstart", e)); const n = Math.min(o.x, i.x), a = Math.max(o.x, i.x), l = Math.min(o.y, i.y), c = Math.max(o.y, i.y); this._map._requestDomTask((() => { this._box && (this._box.style.transform = `translate(${n}px,${l}px)`, this._box.style.width = a - n + "px", this._box.style.height = c - l + "px"); })); } mouseupWindow(t, i) { if (!this._active) return; const o = this._startPos, r = i; if (o && 0 === t.button) { if (this.reset(), u(), o.x !== r.x || o.y !== r.y) return this._map.fire(new e.a8("boxzoomend", { originalEvent: t })), { cameraAnimation: e => e.fitScreenCoordinates(o, r, this._map.getBearing(), { linear: !1 }) }; this._fireEvent("boxzoomcancel", t); } } keydown(e) { this._active && 27 === e.keyCode && (this.reset(), this._fireEvent("boxzoomcancel", e)); } blur() { this.reset(); } reset() { this._active = !1, this._container.classList.remove("mapboxgl-crosshair"), this._box && (this._box.remove(), this._box = null), _(), delete this._startPos, delete this._lastPos; } _fireEvent(t, i) { return this._map.fire(new e.a8(t, { originalEvent: i })) } } function Xr(e, t) { const i = {}; for (let o = 0; o < e.length; o++)i[e[o].identifier] = t[o]; return i } class Jr { constructor(e) { this.reset(), this.numTouches = e.numTouches; } reset() { this.centroid = void 0, this.startTime = 0, this.touches = {}, this.aborted = !1; } touchstart(t, i, o) { (this.centroid || o.length > this.numTouches) && (this.aborted = !0), this.aborted || (0 === this.startTime && (this.startTime = t.timeStamp), o.length === this.numTouches && (this.centroid = function (t) { const i = new e.P(0, 0); for (const e of t) i._add(e); return i.div(t.length) }(i), this.touches = Xr(o, i))); } touchmove(e, t, i) { if (this.aborted || !this.centroid) return; const o = Xr(i, t); for (const e in this.touches) { const t = o[e]; (!t || t.dist(this.touches[e]) > 30) && (this.aborted = !0); } } touchend(e, t, i) { if ((!this.centroid || e.timeStamp - this.startTime > 500) && (this.aborted = !0), 0 === i.length) { const e = !this.aborted && this.centroid; if (this.reset(), e) return e } } } class Yr { constructor(e) { this.singleTap = new Jr(e), this.numTaps = e.numTaps, this.reset(); } reset() { this.lastTime = 1 / 0, this.lastTap = void 0, this.count = 0, this.singleTap.reset(); } touchstart(e, t, i) { this.singleTap.touchstart(e, t, i); } touchmove(e, t, i) { this.singleTap.touchmove(e, t, i); } touchend(e, t, i) { const o = this.singleTap.touchend(e, t, i); if (o) { const t = e.timeStamp - this.lastTime < 500, i = !this.lastTap || this.lastTap.dist(o) < 30; if (t && i || this.reset(), this.count++, this.lastTime = e.timeStamp, this.lastTap = o, this.count === this.numTaps) return this.reset(), o } } } class Kr { constructor() { this._zoomIn = new Yr({ numTouches: 1, numTaps: 2 }), this._zoomOut = new Yr({ numTouches: 2, numTaps: 1 }), this.reset(); } reset() { this._active = !1, this._zoomIn.reset(), this._zoomOut.reset(); } touchstart(e, t, i) { this._zoomIn.touchstart(e, t, i), this._zoomOut.touchstart(e, t, i); } touchmove(e, t, i) { this._zoomIn.touchmove(e, t, i), this._zoomOut.touchmove(e, t, i); } touchend(e, t, i) { const o = this._zoomIn.touchend(e, t, i), r = this._zoomOut.touchend(e, t, i); return o ? (this._active = !0, e.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: t => t.easeTo({ duration: 300, zoom: t.getZoom() + 1, around: t.unproject(o) }, { originalEvent: e }) }) : r ? (this._active = !0, e.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: t => t.easeTo({ duration: 300, zoom: t.getZoom() - 1, around: t.unproject(r) }, { originalEvent: e }) }) : void 0 } touchcancel() { this.reset(); } enable() { this._enabled = !0; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } } const Qr = { 0: 1, 2: 2 }; class es { constructor(e) { this.reset(), this._clickTolerance = e.clickTolerance || 1; } blur() { this.reset(); } reset() { this._active = !1, this._moved = !1, this._lastPoint = void 0, this._eventButton = void 0; } _correctButton(e, t) { return !1 } _move(e, t) { return {} } mousedown(e, t) { if (this._lastPoint) return; const i = f(e); this._correctButton(e, i) && (this._lastPoint = t, this._eventButton = i); } mousemoveWindow(e, t) { const i = this._lastPoint; if (i) if (e.preventDefault(), null != this._eventButton && function (e, t) { const i = Qr[t]; return void 0 === e.buttons || (e.buttons & i) !== i }(e, this._eventButton)) this.reset(); else if (this._moved || !(t.dist(i) < this._clickTolerance)) return this._moved = !0, this._lastPoint = t, this._move(i, t) } mouseupWindow(e) { this._lastPoint && f(e) === this._eventButton && (this._moved && u(), this.reset()); } enable() { this._enabled = !0; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } } class ts extends es { mousedown(e, t) { super.mousedown(e, t), this._lastPoint && (this._active = !0); } _correctButton(e, t) { return 0 === t && !e.ctrlKey } _move(e, t) { return { around: t, panDelta: t.sub(e) } } } class is extends es { _correctButton(e, t) { return 0 === t && e.ctrlKey || 2 === t } _move(e, t) { const i = .8 * (t.x - e.x); if (i) return this._active = !0, { bearingDelta: i } } contextmenu(e) { e.preventDefault(); } } class os extends es { _correctButton(e, t) { return 0 === t && e.ctrlKey || 2 === t } _move(e, t) { const i = -.5 * (t.y - e.y); if (i) return this._active = !0, { pitchDelta: i } } contextmenu(e) { e.preventDefault(); } } class rs { constructor(t, i) { this._map = t, this._el = t.getCanvasContainer(), this._minTouches = 1, this._clickTolerance = i.clickTolerance || 1, this.reset(), e.aR(["_addTouchPanBlocker", "_showTouchPanBlockerAlert"], this); } reset() { this._active = !1, this._touches = {}, this._sum = new e.P(0, 0); } touchstart(e, t, i) { return this._calculateTransform(e, t, i) } touchmove(t, i, o) { if (this._active && !(o.length < this._minTouches)) { if (this._map._cooperativeGestures && !this._map.isMoving()) { if (1 === o.length && !e.cF()) return void this._showTouchPanBlockerAlert(); "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); } return t.cancelable && t.preventDefault(), this._calculateTransform(t, i, o) } } touchend(e, t, i) { this._calculateTransform(e, t, i), this._active && i.length < this._minTouches && this.reset(); } touchcancel() { this.reset(); } _calculateTransform(t, i, o) { o.length > 0 && (this._active = !0); const r = Xr(o, i), s = new e.P(0, 0), n = new e.P(0, 0); let a = 0; for (const e in r) { const t = r[e], i = this._touches[e]; i && (s._add(t), n._add(t.sub(i)), a++, r[e] = t); } if (this._touches = r, a < this._minTouches || !n.mag()) return; const l = n.div(a); return this._sum._add(l), this._sum.mag() < this._clickTolerance ? void 0 : { around: s.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 = s("div", "mapboxgl-touch-pan-blocker", this._map._container), this._alertContainer.textContent = this._map._getUIString("TouchPanBlocker.Message"), this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth)))}px`); } _showTouchPanBlockerAlert() { this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = setTimeout((() => { this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"), this._alertContainer.removeAttribute("role"); }), 500); } } class ss { constructor() { this.reset(); } reset() { this._active = !1, this._firstTwoTouches = void 0; } _start(e) { } _move(e, t, i) { return {} } touchstart(e, t, i) { this._firstTwoTouches || i.length < 2 || (this._firstTwoTouches = [i[0].identifier, i[1].identifier], this._start([t[0], t[1]])); } touchmove(e, t, i) { const o = this._firstTwoTouches; if (!o) return; e.preventDefault(); const [r, s] = o, n = ns(i, t, r), a = ns(i, t, s); if (!n || !a) return; const l = this._aroundCenter ? null : n.add(a).div(2); return this._move([n, a], l, e) } touchend(e, t, i) { if (!this._firstTwoTouches) return; const [o, r] = this._firstTwoTouches, s = ns(i, t, o), n = ns(i, t, r); s && n || (this._active && u(), this.reset()); } touchcancel() { this.reset(); } enable(e) { this._enabled = !0, this._aroundCenter = !!e && "center" === e.around; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } } function ns(e, t, i) { for (let o = 0; o < e.length; o++)if (e[o].identifier === i) return t[o] } function as(e, t) { return Math.log(e / t) / Math.LN2 } class ls extends ss { reset() { super.reset(), this._distance = 0, this._startDistance = 0; } _start(e) { this._startDistance = this._distance = e[0].dist(e[1]); } _move(e, t) { const i = this._distance; if (this._distance = e[0].dist(e[1]), this._active || !(Math.abs(as(this._distance, this._startDistance)) < .1)) return this._active = !0, { zoomDelta: as(this._distance, i), pinchAround: t } } } function cs(e, t) { return 180 * e.angleWith(t) / Math.PI } class hs extends ss { reset() { super.reset(), this._minDiameter = 0, this._startVector = void 0, this._vector = void 0; } _start(e) { this._startVector = this._vector = e[0].sub(e[1]), this._minDiameter = e[0].dist(e[1]); } _move(e, t) { const i = this._vector; if (this._vector = e[0].sub(e[1]), i && (this._active || !this._isBelowThreshold(this._vector))) return this._active = !0, { bearingDelta: cs(this._vector, i), pinchAround: t } } _isBelowThreshold(e) { this._minDiameter = Math.min(this._minDiameter, e.mag()); const t = 25 / (Math.PI * this._minDiameter) * 360, i = this._startVector; if (!i) return !1; const o = cs(e, i); return Math.abs(o) < t } } function _s(e) { return Math.abs(e.y) > Math.abs(e.x) } class ds extends ss { constructor(e) { super(), this._map = e; } reset() { super.reset(), this._valid = void 0, this._firstMove = void 0, this._lastPoints = void 0; } _start(e) { this._lastPoints = e, _s(e[0].sub(e[1])) && (this._valid = !1); } _move(t, i, o) { const r = this._lastPoints; if (!r) return; const s = t[0].sub(r[0]), n = t[1].sub(r[1]); return this._map._cooperativeGestures && !e.cF() && o.touches.length < 3 || (this._valid = this.gestureBeginsVertically(s, n, o.timeStamp), !this._valid) ? void 0 : (this._lastPoints = t, this._active = !0, { pitchDelta: (s.y + n.y) / 2 * -.5 }) } gestureBeginsVertically(e, t, i) { if (void 0 !== this._valid) return this._valid; const o = e.mag() >= 2, r = t.mag() >= 2; if (!o && !r) return; if (!o || !r) return null == this._firstMove && (this._firstMove = i), i - this._firstMove < 100 && void 0; const s = e.y > 0 == t.y > 0; return _s(e) && _s(t) && s } } const us = { panStep: 100, bearingStep: 15, pitchStep: 10 }; class ps { constructor() { const e = us; this._panStep = e.panStep, this._bearingStep = e.bearingStep, this._pitchStep = e.pitchStep, this._rotationDisabled = !1; } blur() { this.reset(); } reset() { this._active = !1; } keydown(e) { if (e.altKey || e.ctrlKey || e.metaKey) return; let t = 0, i = 0, o = 0, r = 0, s = 0; switch (e.keyCode) { case 61: case 107: case 171: case 187: t = 1; break; case 189: case 109: case 173: t = -1; break; case 37: e.shiftKey ? i = -1 : (e.preventDefault(), r = -1); break; case 39: e.shiftKey ? i = 1 : (e.preventDefault(), r = 1); break; case 38: e.shiftKey ? o = 1 : (e.preventDefault(), s = -1); break; case 40: e.shiftKey ? o = -1 : (e.preventDefault(), s = 1); break; default: return }return this._rotationDisabled && (i = 0, o = 0), { cameraAnimation: n => { const a = n.getZoom(); n.easeTo({ duration: 300, easeId: "keyboardHandler", easing: ms, zoom: t ? Math.round(a) + t * (e.shiftKey ? 2 : 1) : a, bearing: n.getBearing() + i * this._bearingStep, pitch: n.getPitch() + o * this._pitchStep, offset: [-r * this._panStep, -s * this._panStep], center: n.getCenter() }, { originalEvent: e }); } } } enable() { this._enabled = !0; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } disableRotation() { this._rotationDisabled = !0; } enableRotation() { this._rotationDisabled = !1; } } function ms(e) { return e * (2 - e) } const fs = 4.000244140625; class gs { constructor(t, i) { this._map = t, this._el = t.getCanvasContainer(), this._handler = i, this._delta = 0, this._lastDelta = 0, this._defaultZoomRate = .01, this._wheelZoomRate = .0022222222222222222, e.aR(["_onTimeout", "_addScrollZoomBlocker", "_showBlockerAlert"], this); } setZoomRate(e) { this._defaultZoomRate = e; } setWheelZoomRate(e) { this._wheelZoomRate = e; } isEnabled() { return !!this._enabled } isActive() { return this._active || void 0 !== this._finishTimeout } isZooming() { return !!this._zooming } enable(e) { this.isEnabled() || (this._enabled = !0, this._aroundCenter = !!e && "center" === e.around, this._map._cooperativeGestures && this._addScrollZoomBlocker()); } disable() { this.isEnabled() && (this._enabled = !1, this._map._cooperativeGestures && (clearTimeout(this._alertTimer), this._alertContainer.remove())); } wheel(t) { if (!this.isEnabled()) return; if (this._map._cooperativeGestures) { if (!(t.ctrlKey || t.metaKey || this.isZooming() || e.cF())) return void this._showBlockerAlert(); "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); } let i = t.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * t.deltaY : t.deltaY; const o = e.a4.now(), r = o - (this._lastWheelEventTime || 0); this._lastWheelEventTime = o, 0 !== i && i % fs == 0 ? this._type = "wheel" : 0 !== i && Math.abs(i) < 4 ? this._type = "trackpad" : r > 400 ? (this._type = null, this._lastValue = i, this._timeout = setTimeout(this._onTimeout, 40, t)) : this._type || (this._type = Math.abs(r * i) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, i += this._lastValue)), t.shiftKey && i && (i /= 4), this._type && (this._lastWheelEvent = t, this._delta -= i, this._active || this._start(t)), t.preventDefault(); } _onTimeout(e) { this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(e); } _start(e) { if (!this._delta) return; this._frameId && (this._frameId = null), this._active = !0, this.isZooming() || (this._zooming = !0), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout); const t = p(this._el, e); this._aroundPoint = this._aroundCenter ? this._map.transform.centerPoint : t, 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 t = this._map.transform; "wheel" === this._type && t.projection.wrap && (t._center.lng >= 180 || t._center.lng <= -180) && (this._prevEase = null, this._easing = null, this._lastWheelEvent = null, this._lastWheelEventTime = 0); const i = () => t._terrainEnabled() && this._aroundCoord ? t.computeZoomRelativeTo(this._aroundCoord) : t.zoom; if (0 !== this._delta) { const e = "wheel" === this._type && Math.abs(this._delta) > fs ? this._wheelZoomRate : this._defaultZoomRate; let o = 2 / (1 + Math.exp(-Math.abs(this._delta * e))); this._delta < 0 && 0 !== o && (o = 1 / o); const r = i(), s = Math.pow(2, r), n = "number" == typeof this._targetZoom ? t.zoomScale(this._targetZoom) : s; this._targetZoom = Math.min(t.maxZoom, Math.max(t.minZoom, t.scaleZoom(n * o))), "wheel" === this._type && (this._startZoom = r, this._easing = this._smoothOutEasing(200)), this._lastDelta = this._delta, this._delta = 0; } const o = "number" == typeof this._targetZoom ? this._targetZoom : i(), r = this._startZoom, s = this._easing; let n, a = !1; if ("wheel" === this._type && r && s) { const t = Math.min((e.a4.now() - this._lastWheelEventTime) / 200, 1), i = s(t); n = e.n(r, o, i), t < 1 ? this._frameId || (this._frameId = !0) : a = !0; } else n = o, a = !0; this._active = !0, a && (this._active = !1, this._finishTimeout = setTimeout((() => { this._zooming = !1, this._handler._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout; }), 200)); let l = n - i(); return l * this._lastDelta < 0 && (l = 0), { noInertia: !0, needsRenderFrame: !a, zoomDelta: l, around: this._aroundPoint, aroundCoord: this._aroundCoord, originalEvent: this._lastWheelEvent } } _smoothOutEasing(t) { let i = e.cG; if (this._prevEase) { const t = this._prevEase, o = (e.a4.now() - t.start) / t.duration, r = t.easing(o + .01) - t.easing(o), s = .27 / Math.sqrt(r * r + 1e-4) * .01, n = Math.sqrt(.0729 - s * s); i = e.cE(s, n, .25, 1); } return this._prevEase = { start: e.a4.now(), duration: t, easing: i }, i } blur() { this.reset(); } reset() { this._active = !1; } _addScrollZoomBlocker() { this._map && !this._alertContainer && (this._alertContainer = s("div", "mapboxgl-scroll-zoom-blocker", this._map._container), this._alertContainer.textContent = /(Mac|iPad)/i.test(navigator.userAgent) ? this._map._getUIString("ScrollZoomBlocker.CmdMessage") : this._map._getUIString("ScrollZoomBlocker.CtrlMessage"), this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth)))}px`); } _showBlockerAlert() { this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = setTimeout((() => { this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.removeAttribute("role"); }), 200); } } class vs { constructor(e, t) { this._clickZoom = e, this._tapZoom = t; } enable() { this._clickZoom.enable(), this._tapZoom.enable(); } disable() { this._clickZoom.disable(), this._tapZoom.disable(); } isEnabled() { return this._clickZoom.isEnabled() && this._tapZoom.isEnabled() } isActive() { return this._clickZoom.isActive() || this._tapZoom.isActive() } } class xs { constructor() { this.reset(); } reset() { this._active = !1; } blur() { this.reset(); } dblclick(e, t) { return e.preventDefault(), { cameraAnimation: i => { i.easeTo({ duration: 300, zoom: i.getZoom() + (e.shiftKey ? -1 : 1), around: i.unproject(t) }, { originalEvent: e }); } } } enable() { this._enabled = !0; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } } class ys { constructor() { this._tap = new Yr({ numTouches: 1, numTaps: 1 }), this.reset(); } reset() { this._active = !1, this._swipePoint = void 0, this._swipeTouch = 0, this._tapTime = 0, this._tap.reset(); } touchstart(e, t, i) { this._swipePoint || (this._tapTime && e.timeStamp - this._tapTime > 500 && this.reset(), this._tapTime ? i.length > 0 && (this._swipePoint = t[0], this._swipeTouch = i[0].identifier) : this._tap.touchstart(e, t, i)); } touchmove(e, t, i) { if (this._tapTime) { if (this._swipePoint) { if (i[0].identifier !== this._swipeTouch) return; const o = t[0], r = o.y - this._swipePoint.y; return this._swipePoint = o, e.preventDefault(), this._active = !0, { zoomDelta: r / 128 } } } else this._tap.touchmove(e, t, i); } touchend(e, t, i) { this._tapTime ? this._swipePoint && 0 === i.length && this.reset() : this._tap.touchend(e, t, i) && (this._tapTime = e.timeStamp); } touchcancel() { this.reset(); } enable() { this._enabled = !0; } disable() { this._enabled = !1, this.reset(); } isEnabled() { return this._enabled } isActive() { return this._active } } class bs { constructor(e, t, i) { this._el = e, this._mousePan = t, this._touchPan = i; } enable(e) { this._inertiaOptions = e || {}, this._mousePan.enable(), this._touchPan.enable(), this._el.classList.add("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 ws { constructor(e, t, i) { this._pitchWithRotate = e.pitchWithRotate, this._mouseRotate = t, 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 Ts { constructor(e, t, i, o) { this._el = e, this._touchZoom = t, this._touchRotate = i, this._tapDragZoom = o, this._rotationDisabled = !1, this._enabled = !0; } enable(e) { this._touchZoom.enable(e), this._rotationDisabled || this._touchRotate.enable(e), this._tapDragZoom.enable(), this._el.classList.add("mapboxgl-touch-zoom-rotate"); } disable() { this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove("mapboxgl-touch-zoom-rotate"); } isEnabled() { return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled() } isActive() { return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive() } disableRotation() { this._rotationDisabled = !0, this._touchRotate.disable(); } enableRotation() { this._rotationDisabled = !1, this._touchZoom.isEnabled() && this._touchRotate.enable(); } } const Es = e => e.zoom || e.drag || e.pitch || e.rotate; class Cs extends e.a8 { } class Is { constructor() { this.constants = [1, 1, .01], this.radius = 0; } setup(t, i) { const o = e.v.sub([], i, t); this.radius = e.v.length(o[2] < 0 ? e.v.div([], o, this.constants) : [o[0], o[1], 0]); } projectRay(t) { e.v.div(t, t, this.constants), e.v.normalize(t, t), e.v.mul(t, t, this.constants); const i = e.v.scale([], t, this.radius); if (i[2] > 0) { const t = e.v.scale([], [0, 0, 1], e.v.dot(i, [0, 0, 1])), o = e.v.scale([], e.v.normalize([], [i[0], i[1], 0]), this.radius), r = e.v.add([], i, e.v.scale([], e.v.sub([], e.v.add([], o, t), i), 2)); i[0] = r[0], i[1] = r[1]; } return i } } function Ss(e) { return e.panDelta && e.panDelta.mag() || e.zoomDelta || e.bearingDelta || e.pitchDelta } class Ms { constructor(t, i) { this._map = t, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new Ur(t), this._bearingSnap = i.bearingSnap, this._previousActiveHandlers = {}, this._trackingEllipsoid = new Is, this._dragOrigin = null, this._eventsInProgress = {}, this._addDefaultHandlers(i), e.aR(["handleEvent", "handleWindowEvent"], this); const o = this._el; this._listeners = [[o, "touchstart", { passive: !0 }], [o, "touchmove", { passive: !1 }], [o, "touchend", void 0], [o, "touchcancel", void 0], [o, "mousedown", void 0], [o, "mousemove", void 0], [o, "mouseup", void 0], [document, "mousemove", { capture: !0 }], [document, "mouseup", void 0], [o, "mouseover", void 0], [o, "mouseout", void 0], [o, "dblclick", void 0], [o, "click", void 0], [o, "keydown", { capture: !1 }], [o, "keyup", void 0], [o, "wheel", { passive: !1 }], [o, "contextmenu", void 0], [window, "blur", void 0]]; for (const [e, t, i] of this._listeners) { const o = e === document ? this.handleWindowEvent : this.handleEvent; e.addEventListener(t, o, i); } } destroy() { for (const [e, t, i] of this._listeners) { const o = e === document ? this.handleWindowEvent : this.handleEvent; e.removeEventListener(t, o, i); } } _addDefaultHandlers(e) { const t = this._map, i = t.getCanvasContainer(); this._add("mapEvent", new Hr(t, e)); const o = t.boxZoom = new $r(t, e); this._add("boxZoom", o); const r = new Kr, s = new xs; t.doubleClickZoom = new vs(s, r), this._add("tapZoom", r), this._add("clickZoom", s); const n = new ys; this._add("tapDragZoom", n); const a = t.touchPitch = new ds(t); this._add("touchPitch", a); const l = new is(e), c = new os(e); t.dragRotate = new ws(e, l, c), this._add("mouseRotate", l, ["mousePitch"]), this._add("mousePitch", c, ["mouseRotate"]); const h = new ts(e), _ = new rs(t, e); t.dragPan = new bs(i, h, _), this._add("mousePan", h), this._add("touchPan", _, ["touchZoom", "touchRotate"]); const d = new hs, u = new ls; t.touchZoomRotate = new Ts(i, u, d, n), this._add("touchRotate", d, ["touchPan", "touchZoom"]), this._add("touchZoom", u, ["touchPan", "touchRotate"]), this._add("blockableMapEvent", new qr(t)); const p = t.scrollZoom = new gs(t, this); this._add("scrollZoom", p, ["mousePan"]); const m = t.keyboard = new ps; this._add("keyboard", m); for (const i of ["boxZoom", "doubleClickZoom", "tapDragZoom", "touchPitch", "dragRotate", "dragPan", "touchZoomRotate", "scrollZoom", "keyboard"]) e.interactive && e[i] && t[i].enable(e[i]); } _add(e, t, i) { this._handlers.push({ handlerName: e, handler: t, allowed: i }), this._handlersById[e] = t; } stop(e) { if (!this._updatingCamera) { for (const { handler: e } of this._handlers) e.reset(); this._inertia.clear(), this._fireEvents({}, {}, e), this._changes = [], this._originalZoom = void 0; } } isActive() { for (const { handler: e } of this._handlers) if (e.isActive()) return !0; return !1 } isZooming() { return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming() } isRotating() { return !!this._eventsInProgress.rotate } isMoving() { return !!Es(this._eventsInProgress) || this.isZooming() } _isDragging() { return !!this._eventsInProgress.drag } _blockedByActive(e, t, i) { for (const o in e) if (o !== i && (!t || t.indexOf(o) < 0)) return !0; return !1 } handleWindowEvent(e) { this.handleEvent(e, `${e.type}Window`); } _getMapTouches(e) { const t = []; for (const i of e) this._el.contains(i.target) && t.push(i); return t } handleEvent(e, t) { this._updatingCamera = !0; const i = "renderFrame" === e.type, o = i ? void 0 : e, r = { needsRenderFrame: !1 }, s = {}, n = {}, a = e.touches ? this._getMapTouches(e.touches) : void 0, l = a ? m(this._el, a) : i ? void 0 : p(this._el, e); for (const { handlerName: i, handler: c, allowed: h } of this._handlers) { if (!c.isEnabled()) continue; let _; this._blockedByActive(n, h, i) ? c.reset() : c[t || e.type] && (_ = c[t || e.type](e, l, a), this.mergeHandlerResult(r, s, _, i, o), _ && _.needsRenderFrame && this._triggerRenderFrame()), (_ || c.isActive()) && (n[i] = c); } const c = {}; for (const e in this._previousActiveHandlers) n[e] || (c[e] = o); this._previousActiveHandlers = n, (Object.keys(c).length || Ss(r)) && (this._changes.push([r, s, c]), this._triggerRenderFrame()), (Object.keys(n).length || Ss(r)) && this._map._stop(!0), this._updatingCamera = !1; const { cameraAnimation: h } = r; h && (this._inertia.clear(), this._fireEvents({}, {}, !0), this._changes = [], h(this._map)); } mergeHandlerResult(t, i, o, r, s) { if (!o) return; e.ak(t, o); const n = { handlerName: r, originalEvent: o.originalEvent || s }; void 0 !== o.zoomDelta && (i.zoom = n), void 0 !== o.panDelta && (i.drag = n), void 0 !== o.pitchDelta && (i.pitch = n), void 0 !== o.bearingDelta && (i.rotate = n); } _applyChanges() { const t = {}, i = {}, o = {}; for (const [r, s, n] of this._changes) r.panDelta && (t.panDelta = (t.panDelta || new e.P(0, 0))._add(r.panDelta)), r.zoomDelta && (t.zoomDelta = (t.zoomDelta || 0) + r.zoomDelta), r.bearingDelta && (t.bearingDelta = (t.bearingDelta || 0) + r.bearingDelta), r.pitchDelta && (t.pitchDelta = (t.pitchDelta || 0) + r.pitchDelta), void 0 !== r.around && (t.around = r.around), void 0 !== r.aroundCoord && (t.aroundCoord = r.aroundCoord), void 0 !== r.pinchAround && (t.pinchAround = r.pinchAround), r.noInertia && (t.noInertia = r.noInertia), e.ak(i, s), e.ak(o, n); this._updateMapTransform(t, i, o), this._changes = []; } _updateMapTransform(t, i, o) { const r = this._map, s = r.transform, n = e => [e.x, e.y, e.z]; if ((e => { const t = this._eventsInProgress.drag; return t && !this._handlersById[t.handlerName].isActive() })() && !Ss(t)) { const e = s.zoom; s.cameraElevationReference = "sea", null != this._originalZoom && s._orthographicProjectionAtLowPitch && "globe" !== s.projection.name && 0 === s.pitch ? (s.cameraElevationReference = "ground", s.zoom = this._originalZoom) : (s.recenterOnTerrain(), s.cameraElevationReference = "ground"), e !== s.zoom && this._map._update(!0); } if (s._isCameraConstrained && r._stop(!0), !Ss(t)) return void this._fireEvents(i, o, !0); let { panDelta: a, zoomDelta: l, bearingDelta: c, pitchDelta: h, around: _, aroundCoord: d, pinchAround: u } = t; s._isCameraConstrained && (l > 0 && (l = 0), s._isCameraConstrained = !1), void 0 !== u && (_ = u), (l || (e => i[e] && !this._eventsInProgress[e])("drag")) && _ && (this._dragOrigin = n(s.pointCoordinate3D(_)), this._originalZoom = s.zoom, this._trackingEllipsoid.setup(s._camera.position, this._dragOrigin)), s.cameraElevationReference = "sea", r._stop(!0), _ = _ || r.transform.centerPoint, c && (s.bearing += c), h && (s.pitch += h), s._updateCameraState(); const p = [0, 0, 0]; if (a) if ("mercator" === s.projection.name) { const e = this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(_).dir), t = this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(_.sub(a)).dir); p[0] = t[0] - e[0], p[1] = t[1] - e[1]; } else { const t = s.pointCoordinate(_); if ("globe" === s.projection.name) { a = a.rotate(-s.angle); const i = s._pixelsPerMercatorPixel / s.worldSize; p[0] = -a.x * e.cH(e.l(t.y)) * i, p[1] = -a.y * e.cH(s.center.lat) * i; } else { const e = s.pointCoordinate(_.sub(a)); t && e && (p[0] = e.x - t.x, p[1] = e.y - t.y); } } const m = s.zoom, f = [0, 0, 0]; if (l) { const t = n(d || s.pointCoordinate3D(_)), i = { dir: e.v.normalize([], e.v.sub([], t, s._camera.position)) }; if (i.dir[2] < 0) { const o = s.zoomDeltaToMovement(t, l); e.v.scale(f, i.dir, o); } } const g = e.v.add(p, p, f); s._translateCameraConstrained(g), l && Math.abs(s.zoom - m) > 1e-4 && s.recenterOnTerrain(), s.cameraElevationReference = "ground", this._map._update(), t.noInertia || this._inertia.record(t), this._fireEvents(i, o, !0); } _fireEvents(t, i, o) { const r = Es(this._eventsInProgress), s = Es(t), n = {}; for (const e in t) { const { originalEvent: i } = t[e]; this._eventsInProgress[e] || (n[`${e}start`] = i), this._eventsInProgress[e] = t[e]; } !r && s && this._fireEvent("movestart", s.originalEvent); for (const e in n) this._fireEvent(e, n[e]); s && this._fireEvent("move", s.originalEvent); for (const e in t) { const { originalEvent: i } = t[e]; this._fireEvent(e, i); } const a = {}; let l; for (const e in this._eventsInProgress) { const { handlerName: t, originalEvent: o } = this._eventsInProgress[e]; this._handlersById[t].isActive() || (delete this._eventsInProgress[e], l = i[t] || o, a[`${e}end`] = l); } for (const e in a) this._fireEvent(e, a[e]); const c = Es(this._eventsInProgress); if (o && (r || s) && !c) { this._updatingCamera = !0; const t = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i = e => 0 !== e && -this._bearingSnap < e && e < this._bearingSnap; t ? (i(t.bearing || this._map.getBearing()) && (t.bearing = 0), this._map.easeTo(t, { originalEvent: l })) : (this._map.fire(new e.a8("moveend", { originalEvent: l })), i(this._map.getBearing()) && this._map.resetNorth()), this._updatingCamera = !1; } } _fireEvent(t, i) { this._map.fire(new e.a8(t, i ? { originalEvent: i } : {})); } _requestFrame() { return this._map.triggerRepaint(), this._map._renderTaskQueue.add((e => { this._frameId = void 0, this.handleEvent(new Cs("renderFrame", { timeStamp: e })), this._applyChanges(); })) } _triggerRenderFrame() { void 0 === this._frameId && (this._frameId = this._requestFrame()); } } const Ls = "map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections."; class Ps extends e.a6 { constructor(t, i) { super(), this._moving = !1, this._zooming = !1, this.transform = t, this._bearingSnap = i.bearingSnap, this._respectPrefersReducedMotion = !1 !== i.respectPrefersReducedMotion, e.aR(["_renderFrameCallback"], this); } getCenter() { return new e.L(this.transform.center.lng, this.transform.center.lat) } setCenter(e, t) { return this.jumpTo({ center: e }, t) } panBy(t, i, o) { return t = e.P.convert(t).mult(-1), this.panTo(this.transform.center, e.ak({ offset: t }, i), o) } panTo(t, i, o) { return this.easeTo(e.ak({ center: t }, i), o) } getZoom() { return this.transform.zoom } setZoom(e, t) { return this.jumpTo({ zoom: e }, t), this } zoomTo(t, i, o) { return this.easeTo(e.ak({ zoom: t }, i), o) } zoomIn(e, t) { return this.zoomTo(this.getZoom() + 1, e, t), this } zoomOut(e, t) { return this.zoomTo(this.getZoom() - 1, e, t), this } getBearing() { return this.transform.bearing } setBearing(e, t) { return this.jumpTo({ bearing: e }, t), this } getPadding() { return this.transform.padding } setPadding(e, t) { return this.jumpTo({ padding: e }, t), this } rotateTo(t, i, o) { return this.easeTo(e.ak({ bearing: t }, i), o) } resetNorth(t, i) { return this.rotateTo(0, e.ak({ duration: 1e3 }, t), i), this } resetNorthPitch(t, i) { return this.easeTo(e.ak({ bearing: 0, pitch: 0, duration: 1e3 }, t), i), this } snapToNorth(e, t) { return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(e, t) : this } getPitch() { return this.transform.pitch } setPitch(e, t) { return this.jumpTo({ pitch: e }, t), this } cameraForBounds(t, i) { t = e.D.convert(t); const o = i && i.bearing || 0, r = i && i.pitch || 0, s = t.getNorthWest(), n = t.getSouthEast(); return this._cameraForBounds(this.transform, s, n, o, r, i) } _extendCameraOptions(t) { const i = { top: 0, bottom: 0, right: 0, left: 0 }; if ("number" == typeof (t = e.ak({ padding: i, offset: [0, 0], maxZoom: this.transform.maxZoom }, t)).padding) { const e = t.padding; t.padding = { top: e, bottom: e, right: e, left: e }; } return t.padding = e.ak(i, t.padding), t } _minimumAABBFrustumDistance(e, t) { const i = t.max[0] - t.min[0], o = t.max[1] - t.min[1]; return i / o > e.aspect ? i / (2 * Math.tan(.5 * e.fovX) * e.aspect) : o / (2 * Math.tan(.5 * e.fovY) * e.aspect) } _cameraForBoundsOnGlobe(t, i, o, r, s, n) { const a = t.clone(), l = this._extendCameraOptions(n); a.bearing = r, a.pitch = s; const c = e.L.convert(i), h = e.L.convert(o), _ = .5 * (c.lat + h.lat), d = .5 * (c.lng + h.lng), u = e.cI(_, d), p = e.v.normalize([], u), m = e.v.normalize([], e.v.cross([], p, [0, 1, 0])), f = e.v.cross([], m, p), g = [m[0], m[1], m[2], 0, f[0], f[1], f[2], 0, p[0], p[1], p[2], 0, 0, 0, 0, 1], v = [u, e.cI(c.lat, c.lng), e.cI(h.lat, c.lng), e.cI(h.lat, h.lng), e.cI(c.lat, h.lng), e.cI(_, c.lng), e.cI(_, h.lng), e.cI(c.lat, d), e.cI(h.lat, d)]; let x = e.c3.fromPoints(v.map((t => [e.v.dot(m, t), e.v.dot(f, t), e.v.dot(p, t)]))); const y = e.v.transformMat4([], x.center, g); 0 === e.v.squaredLength(y) && e.v.set(y, 0, 0, 1), e.v.normalize(y, y), e.v.scale(y, y, e.aC), a.center = e.cJ(y); const b = a.getWorldToCameraMatrix(), w = e.m.invert(new Float64Array(16), b); x = e.c3.applyTransform(x, e.m.multiply([], b, g)), e.v.transformMat4(y, y, b); const T = .5 * (x.max[2] - x.min[2]), E = this._minimumAABBFrustumDistance(a, x), C = e.v.scale([], [0, 0, 1], T), I = e.v.add(C, y, C), S = E + (0 === a.pitch ? 0 : e.v.distance(y, I)), M = a.globeCenterInViewSpace, L = e.v.sub([], y, [M[0], M[1], M[2]]); e.v.normalize(L, L), e.v.scale(L, L, S); const P = e.v.add([], y, L); e.v.transformMat4(P, P, w); const D = e.cL / e.aC, A = e.v.length(P), R = e.b(Math.max(A * D - e.cL, Number.EPSILON), 0), z = Math.min(a.zoomFromMercatorZAdjusted(R), l.maxZoom); return z > .5 * (e.Z + e.G) ? (a.setProjection({ name: "mercator" }), a.zoom = z, this._cameraForBounds(a, i, o, r, s, n)) : { center: a.center, zoom: z, bearing: r, pitch: s } } queryTerrainElevation(t, i) { const o = this.transform.elevation; return o ? (i = e.ak({}, { exaggerated: !0 }, i), o.getAtPoint(e.M.fromLngLat(t), null, i.exaggerated)) : null } _cameraForBounds(t, i, o, r, s, n) { if ("globe" === t.projection.name) return this._cameraForBoundsOnGlobe(t, i, o, r, s, n); const a = t.clone(), l = this._extendCameraOptions(n), c = a.padding; a.bearing = r, a.pitch = s; const h = e.L.convert(i), _ = e.L.convert(o), d = new e.L(h.lng, _.lat), u = new e.L(_.lng, h.lat), p = a.project(h), m = a.project(_), f = this.queryTerrainElevation(h), g = this.queryTerrainElevation(_), v = this.queryTerrainElevation(d), x = this.queryTerrainElevation(u), y = [[p.x, p.y, Math.min(f || 0, g || 0, v || 0, x || 0)], [m.x, m.y, Math.max(f || 0, g || 0, v || 0, x || 0)]]; let b = e.c3.fromPoints(y); const w = a.getWorldToCameraMatrix(), T = e.m.invert(new Float64Array(16), w); b = e.c3.applyTransform(b, w); const E = e.v.sub([], b.max, b.min), C = c.left || 0, I = c.right || 0, S = c.bottom || 0, M = c.top || 0, { left
41: L, right: P, top: D, bottom: A } = l.padding, R = .5 * (C + I), z = .5 * (M + S), O = Math.min(a.scaleZoom(a.scale * Math.min((a.width - (C + I + L + P)) / E[0], (a.height - (S + M + A + D)) / E[1])), l.maxZoom), F = a.scale / a.zoomScale(O); b = new e.c3([b.min[0] - (L + R) * F, b.min[1] - (A + z) * F, b.min[2]], [b.max[0] + (P + R) * F, b.max[1] + (D + z) * F, b.max[2]]); const B = .5 * E[2], k = this._minimumAABBFrustumDistance(a, b), N = [0, 0, 1, 0]; e.e.transformMat4(N, N, w), e.e.normalize(N, N); const U = e.v.scale([], N, k + B), G = e.v.add([], b.center, U), j = ("number" == typeof l.offset.x && "number" == typeof l.offset.y ? new e.P(l.offset.x, l.offset.y) : e.P.convert(l.offset)).rotate(-e.d(r)); b.center[0] -= j.x * F, b.center[1] += j.y * F, e.v.transformMat4(b.center, b.center, T), e.v.transformMat4(G, G, T); const V = [b.center[0], b.center[1], G[2] * a.pixelsPerMeter]; e.v.scale(V, V, 1 / a.worldSize); const Z = e.cK(V[0]), W = e.l(V[1]), H = Math.min(a._zoomFromMercatorZ(V[2]), l.maxZoom), q = new e.L(Z, W); return a.mercatorFromTransition && H < .5 * (e.Z + e.G) ? (a.setProjection({ name: "globe" }), a.zoom = H, this._cameraForBounds(a, i, o, r, s, n)) : { center: q, zoom: H, bearing: r, pitch: s } } fitBounds(e, t, i) { const o = this.cameraForBounds(e, t); return this._fitInternal(o, t, i) } fitScreenCoordinates(t, i, o, r, s) { const n = e.P.convert(t), a = e.P.convert(i), l = new e.P(Math.min(n.x, a.x), Math.min(n.y, a.y)), c = new e.P(Math.max(n.x, a.x), Math.max(n.y, a.y)); if ("mercator" === this.transform.projection.name && this.transform.anyCornerOffEdge(n, a)) return this; const h = this.transform.pointLocation3D(l), _ = this.transform.pointLocation3D(c), d = this.transform.pointLocation3D(new e.P(l.x, c.y)), u = this.transform.pointLocation3D(new e.P(c.x, l.y)), p = [Math.min(h.lng, _.lng, d.lng, u.lng), Math.min(h.lat, _.lat, d.lat, u.lat)], m = [Math.max(h.lng, _.lng, d.lng, u.lng), Math.max(h.lat, _.lat, d.lat, u.lat)], f = r && r.pitch ? r.pitch : this.getPitch(), g = this._cameraForBounds(this.transform, p, m, o, f, r); return this._fitInternal(g, r, s) } _fitInternal(t, i, o) { return t ? (delete (i = e.ak(t, i)).padding, i.linear ? this.easeTo(i, o) : this.flyTo(i, o)) : this } jumpTo(t, i) { this.stop(); const o = t.preloadOnly ? this.transform.clone() : this.transform; let r = !1, s = !1, n = !1; return "zoom" in t && o.zoom !== +t.zoom && (r = !0, o.zoom = +t.zoom), void 0 !== t.center && (o.center = e.L.convert(t.center)), "bearing" in t && o.bearing !== +t.bearing && (s = !0, o.bearing = +t.bearing), "pitch" in t && o.pitch !== +t.pitch && (n = !0, o.pitch = +t.pitch), null == t.padding || o.isPaddingEqual(t.padding) || (o.padding = t.padding), t.preloadOnly ? (this._preloadTiles(o), this) : (this.fire(new e.a8("movestart", i)).fire(new e.a8("move", i)), r && this.fire(new e.a8("zoomstart", i)).fire(new e.a8("zoom", i)).fire(new e.a8("zoomend", i)), s && this.fire(new e.a8("rotatestart", i)).fire(new e.a8("rotate", i)).fire(new e.a8("rotateend", i)), n && this.fire(new e.a8("pitchstart", i)).fire(new e.a8("pitch", i)).fire(new e.a8("pitchend", i)), this.fire(new e.a8("moveend", i))) } getFreeCameraOptions() { return this.transform.projection.supportsFreeCamera || e.X(Ls), this.transform.getFreeCameraOptions() } setFreeCameraOptions(t, i) { const o = this.transform; if (!o.projection.supportsFreeCamera) return e.X(Ls), this; this.stop(); const r = o.zoom, s = o.pitch, n = o.bearing; o.setFreeCameraOptions(t); const a = r !== o.zoom, l = s !== o.pitch, c = n !== o.bearing; return this.fire(new e.a8("movestart", i)).fire(new e.a8("move", i)), a && this.fire(new e.a8("zoomstart", i)).fire(new e.a8("zoom", i)).fire(new e.a8("zoomend", i)), c && this.fire(new e.a8("rotatestart", i)).fire(new e.a8("rotate", i)).fire(new e.a8("rotateend", i)), l && this.fire(new e.a8("pitchstart", i)).fire(new e.a8("pitch", i)).fire(new e.a8("pitchend", i)), this.fire(new e.a8("moveend", i)), this } easeTo(t, i) { this._stop(!1, t.easeId), (!1 === (t = e.ak({ offset: [0, 0], duration: 500, easing: e.cG }, t)).animate || this._prefersReducedMotion(t)) && (t.duration = 0); const o = this.transform, r = this.getZoom(), s = this.getBearing(), n = this.getPitch(), a = this.getPadding(), l = "zoom" in t ? +t.zoom : r, c = "bearing" in t ? this._normalizeBearing(t.bearing, s) : s, h = "pitch" in t ? +t.pitch : n, _ = "padding" in t ? t.padding : o.padding, d = e.P.convert(t.offset); let u, p, m; if ("globe" === o.projection.name) { const i = e.M.fromLngLat(o.center), r = d.rotate(-o.angle); i.x += r.x / o.worldSize, i.y += r.y / o.worldSize; const s = i.toLngLat(), n = e.L.convert(t.center || s);
vendor: 34,182 bytes, line 41
41 this._normalizeCenter(n), u = o.centerPoint.add(r), p = new e.P(i.x, i.y).mult(o.worldSize), m = new e.P(e.E(n.lng), e.H(n.lat)).mult(o.worldSize).sub(p); } else { u = o.centerPoint.add(d); const i = o.pointLocation(u), r = e.L.convert(t.center || i); this._normalizeCenter(r), p = o.project(i), m = o.project(r).sub(p); } const f = o.zoomScale(l - r); let g, v; t.around && (g = e.L.convert(t.around), v = o.locationPoint(g)); const x = this._zooming || l !== r, y = this._rotating || s !== c, b = this._pitching || h !== n, w = !o.isPaddingEqual(_), T = o => T => { if (x && (o.zoom = e.n(r, l, T)), y && (o.bearing = e.n(s, c, T)), b && (o.pitch = e.n(n, h, T)), w && (o.interpolatePadding(a, _, T), u = o.centerPoint.add(d)), g) o.setLocationAtPoint(g, v); else { const e = o.zoomScale(o.zoom - r), t = l > r ? Math.min(2, f) : Math.max(.5, f), i = Math.pow(t, 1 - T), s = o.unproject(p.add(m.mult(T * i)).mult(e)); o.setLocationAtPoint(o.renderWorldCopies ? s.wrap() : s, u); } return t.preloadOnly || this._fireMoveEvents(i), o }; if (t.preloadOnly) { const e = this._emulate(T, t.duration, o); return this._preloadTiles(e), this } const E = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching }; return this._zooming = x, this._rotating = y, this._pitching = b, this._easeId = t.easeId, this._prepareEase(i, t.noMoveStart, E), this._ease(T(o), (e => { "sea" === o.cameraElevationReference && o.recenterOnTerrain(), this._afterEase(i, e); }), t), this } _prepareEase(t, i, o = {}) { this._moving = !0, this.transform.cameraElevationReference = "sea", this.transform._orthographicProjectionAtLowPitch && 0 === this.transform.pitch && "globe" !== this.transform.projection.name && (this.transform.cameraElevationReference = "ground"), i || o.moving || this.fire(new e.a8("movestart", t)), this._zooming && !o.zooming && this.fire(new e.a8("zoomstart", t)), this._rotating && !o.rotating && this.fire(new e.a8("rotatestart", t)), this._pitching && !o.pitching && this.fire(new e.a8("pitchstart", t)); } _fireMoveEvents(t) { this.fire(new e.a8("move", t)), this._zooming && this.fire(new e.a8("zoom", t)), this._rotating && this.fire(new e.a8("rotate", t)), this._pitching && this.fire(new e.a8("pitch", t)); } _afterEase(t, i) { if (this._easeId && i && this._easeId === i) return; this._easeId = void 0, this.transform.cameraElevationReference = "ground"; const o = this._zooming, r = this._rotating, s = this._pitching; this._moving = !1, this._zooming = !1, this._rotating = !1, this._pitching = !1, o && this.fire(new e.a8("zoomend", t)), r && this.fire(new e.a8("rotateend", t)), s && this.fire(new e.a8("pitchend", t)), this.fire(new e.a8("moveend", t)); } flyTo(t, i) { if (this._prefersReducedMotion(t)) { const o = e.p(t, ["center", "zoom", "bearing", "pitch", "around"]); return this.jumpTo(o, i) } this.stop(), t = e.ak({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: e.cG }, t); const o = this.transform, r = this.getZoom(), s = this.getBearing(), n = this.getPitch(), a = "zoom" in t ? e.c(+t.zoom, o.minZoom, o.maxZoom) : r, l = "bearing" in t ? this._normalizeBearing(t.bearing, s) : s, c = "pitch" in t ? +t.pitch : n, h = o.zoomScale(a - r), _ = e.P.convert(t.offset), d = o.centerPoint.add(_), u = o.pointLocation(d); let p = t.center; if (p && t.padding) { const e = this._cameraForBounds(this.transform, p, p, l, c, t); e && (p = e.center); } p = e.L.convert(p || u), this._normalizeCenter(p); const m = o.project(u), f = o.project(p).sub(m); let g = t.curve; const v = Math.max(o.width, o.height), x = v / h, y = f.mag(); if ("minZoom" in t) { const i = e.c(Math.min(t.minZoom, r, a), o.minZoom, o.maxZoom), s = v / o.zoomScale(i - r); g = Math.sqrt(s / y * 2); } const b = g * g; function w(e) { const t = (x * x - v * v + (e ? -1 : 1) * b * b * y * y) / (2 * (e ? x : v) * b * y); return Math.log(Math.sqrt(t * t + 1) - t) } function T(e) { return (Math.exp(e) - Math.exp(-e)) / 2 } function E(e) { return (Math.exp(e) + Math.exp(-e)) / 2 } const C = w(0); let I = function (e) { return E(C) / E(C + g * e) }, S = function (e) { return v * ((E(C) * (T(t = C + g * e) / E(t)) - T(C)) / b) / y; var t; }, M = (w(1) - C) / g; if (Math.abs(y) < 1e-6 || !isFinite(M)) { if (Math.abs(v - x) < 1e-6) return this.easeTo(t, i); const e = x < v ? -1 : 1; M = Math.abs(Math.log(x / v)) / g, S = function () { return 0 }, I = function (t) { return Math.exp(e * g * t) }; } t.duration = "duration" in t ? +t.duration : 1e3 * M / ("screenSpeed" in t ? +t.screenSpeed / g : +t.speed), t.maxDuration && t.duration > t.maxDuration && (t.duration = 0); const L = s !== l, P = c !== n, D = o => h => { const _ = h * M, u = 1 / I(_); o.zoom = 1 === h ? a : r + o.scaleZoom(u), L && (o.bearing = e.n(s, l, h)), P && (o.pitch = e.n(n, c, h)); const g = 1 === h ? p : o.unproject(m.add(f.mult(S(_))).mult(u)); return o.setLocationAtPoint(o.renderWorldCopies ? g.wrap() : g, d), o._updateCameraOnTerrain(), t.preloadOnly || this._fireMoveEvents(i), o }; if (t.preloadOnly) { const e = this._emulate(D, t.duration, o); return this._preloadTiles(e), this } return this._zooming = !0, this._rotating = L, this._pitching = P, this._prepareEase(i, !1), this._ease(D(o), (() => this._afterEase(i)), t), this } isEasing() { return !!this._easeFrameId } stop() { return this._stop() } _stop(e, t) { if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), this._easeFrameId = void 0, this._onEaseFrame = void 0), this._onEaseEnd) { const e = this._onEaseEnd; this._onEaseEnd = void 0, e.call(this, t); } if (!e) { const e = this.handlers; e && e.stop(!1); } return this } _ease(t, i, o) { !1 === o.animate || 0 === o.duration ? (t(1), i()) : (this._easeStart = e.a4.now(), this._easeOptions = o, this._onEaseFrame = t, this._onEaseEnd = i, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback)); } _renderFrameCallback() { const t = Math.min((e.a4.now() - this._easeStart) / this._easeOptions.duration, 1), i = this._onEaseFrame; i && i(this._easeOptions.easing(t)), t < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop(); } _normalizeBearing(t, i) { t = e.w(t, -180, 180); const o = Math.abs(t - i); return Math.abs(t - 360 - i) < o && (t -= 360), Math.abs(t + 360 - i) < o && (t += 360), t } _normalizeCenter(e) { const t = this.transform; if (t.maxBounds) return; if ("globe" !== t.projection.name && !t.renderWorldCopies) return; const i = e.lng - t.center.lng; e.lng += i > 180 ? -360 : i < -180 ? 360 : 0; } _prefersReducedMotion(t) { return this._respectPrefersReducedMotion && e.a4.prefersReducedMotion && !(t && t.essential) } _emulate(e, t, i) { const o = Math.ceil(15 * t / 1e3), r = [], s = e(i.clone()); for (let e = 0; e <= o; e++) { const t = s(e / o); r.push(t.clone()); } return r } } class Ds { constructor(t = {}) { this.options = t, e.aR(["_toggleAttribution", "_updateEditLink", "_updateData", "_updateCompact"], this); } getDefaultPosition() { return "bottom-right" } onAdd(e) { const t = this.options && this.options.compact; return this._map = e, this._container = s("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"), this._compactButton = s("button", "mapboxgl-ctrl-attrib-button", this._container), s("span", "mapboxgl-ctrl-icon", this._compactButton).setAttribute("aria-hidden", "true"), this._compactButton.type = "button", this._compactButton.addEventListener("click", this._toggleAttribution), this._setElementTitle(this._compactButton, "ToggleAttribution"), this._innerContainer = s("div", "mapboxgl-ctrl-attrib-inner", this._container), t && 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 === t && (this._map.on("resize", this._updateCompact), this._updateCompact()), this._container } onRemove() { this._container.remove(), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("moveend", this._updateEditLink), this._map.off("resize", this._updateCompact), this._map = void 0, this._attribHTML = void 0; } _setElementTitle(e, t) { const i = this._map._getUIString(`AttributionControl.${t}`); e.removeAttribute("title"), e.firstElementChild && e.firstElementChild.setAttribute("title", i); } _toggleAttribution() { this._container.classList.contains("mapboxgl-compact-show") ? (this._container.classList.remove("mapboxgl-compact-show"), this._compactButton.setAttribute("aria-expanded", "false")) : (this._container.classList.add("mapboxgl-compact-show"), this._compactButton.setAttribute("aria-expanded", "true")); } _updateEditLink() { let t = this._editLink; t || (t = this._editLink = this._container.querySelector(".mapbox-improve-map")); const i = [{ key: "owner", value: this.styleOwner }, { key: "id", value: this.styleId }, { key: "access_token", value: this._map._requestManager._customAccessToken || e.cM.ACCESS_TOKEN }]; if (t) { const o = i.reduce(((e, t, o) => (t.value && (e += `${t.key}=${t.value}${o < i.length - 1 ? "&" : ""}`), e)), "?"); t.href = `${e.cM.FEEDBACK_URL}/${o}#${zr(this._map, !0)}`, t.rel = "noopener nofollow", this._setElementTitle(t, "MapFeedback"); } } _updateData(e) { !e || "metadata" !== e.sourceDataType && "visibility" !== e.sourceDataType && "style" !== e.dataType || (this._updateAttributions(), this._updateEditLink()); } _updateAttributions() { if (!this._map.style) return; let e = []; if (this._map.style.stylesheet) { const e = this._map.style.stylesheet; this.styleOwner = e.owner, this.styleId = e.id; } const t = this._map.style._mergedSourceCaches; for (const i in t) { const o = t[i]; if (o.used) { const t = o.getSource(); t.attribution && e.indexOf(t.attribution) < 0 && e.push(t.attribution); } } e.sort(((e, t) => e.length - t.length)), e = e.filter(((t, i) => { for (let o = i + 1; o < e.length; o++)if (e[o].indexOf(t) >= 0) return !1; return !0 })), this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? e = [...this.options.customAttribution, ...e] : e.unshift(this.options.customAttribution)); const i = e.join(" | "); i !== this._attribHTML && (this._attribHTML = i, e.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 As { constructor() { e.aR(["_updateLogo", "_updateCompact"], this); } onAdd(e) { this._map = e, this._container = s("div", "mapboxgl-ctrl"); const t = s("a", "mapboxgl-ctrl-logo"); return t.target = "_blank", t.rel = "noopener nofollow", t.href = "https://www.mapbox.com/", t.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), t.setAttribute("rel", "noopener nofollow"), this._container.appendChild(t), this._container.style.display = "none", this._map.on("sourcedata", this._updateLogo), this._updateLogo(), this._map.on("resize", this._updateCompact), this._updateCompact(), this._container } onRemove() { this._container.remove(), this._map.off("sourcedata", this._updateLogo), this._map.off("resize", this._updateCompact); } getDefaultPosition() { return "bottom-left" } _updateLogo(e) { e && "metadata" !== e.sourceDataType || (this._container.style.display = this._logoRequired() ? "block" : "none"); } _logoRequired() { if (!this._map.style) return !0; const e = this._map.style._sourceCaches; if (0 === Object.entries(e).length) return !0; for (const t in e) { const i = e[t].getSource(); if (i.hasOwnProperty("mapbox_logo") && !i.mapbox_logo) return !1 } return !0 } _updateCompact() { const e = this._container.children; if (e.length) { const t = e[0]; this._map.getCanvasContainer().offsetWidth < 250 ? t.classList.add("mapboxgl-compact") : t.classList.remove("mapboxgl-compact"); } } } class Rs { constructor() { this._queue = [], this._id = 0, this._cleared = !1, this._currentlyRunning = !1; } add(e) { const t = ++this._id; return this._queue.push({ callback: e, id: t, cancelled: !1 }), t } remove(e) { const t = this._currentlyRunning, i = t ? this._queue.concat(t) : this._queue; for (const t of i) if (t.id === e) return void (t.cancelled = !0) } run(e = 0) { const t = this._currentlyRunning = this._queue; this._queue = []; for (const i of t) if (!i.cancelled && (i.callback(e), this._cleared)) break; this._cleared = !1, this._currentlyRunning = !1; } clear() { this._currentlyRunning && (this._cleared = !0), this._queue = []; } } function zs(t, i, o) { if (t = new e.L(t.lng, t.lat), i) { const r = new e.L(t.lng - 360, t.lat), s = new e.L(t.lng + 360, t.lat), n = 360 * Math.ceil(Math.abs(t.lng - o.center.lng) / 360), a = o.locationPoint(t).distSqr(i), l = i.x < 0 || i.y < 0 || i.x > o.width || i.y > o.height; o.locationPoint(r).distSqr(i) < a && (l || Math.abs(r.lng - o.center.lng) < n) ? t = r : o.locationPoint(s).distSqr(i) < a && (l || Math.abs(s.lng - o.center.lng) < n) && (t = s); } for (; Math.abs(t.lng - o.center.lng) > 180;) { const e = o.locationPoint(t); if (e.x >= 0 && e.y >= 0 && e.x <= o.width && e.y <= o.height) break; t.lng > o.center.lng ? t.lng -= 360 : t.lng += 360; } return t } const Os = { 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 Fs extends e.a6 { constructor(t, i) { if (super(), (t instanceof HTMLElement || i) && (t = e.ak({ element: t }, i)), e.aR(["_update", "_onMove", "_onUp", "_addDragHandler", "_onMapClick", "_onKeyPress", "_clearFadeTimer"], this), this._anchor = t && t.anchor || "center", this._color = t && t.color || "#3FB1CE", this._scale = t && t.scale || 1, this._draggable = t && t.draggable || !1, this._clickTolerance = t && t.clickTolerance || 0, this._isDragging = !1, this._state = "inactive", this._rotation = t && t.rotation || 0, this._rotationAlignment = t && t.rotationAlignment || "auto", this._pitchAlignment = t && t.pitchAlignment && t.pitchAlignment || "auto", this._updateMoving = () => this._update(!0), this._occludedOpacity = t && t.occludedOpacity || .2, t && t.element) this._element = t.element, this._offset = e.P.convert(t && t.offset || [0, 0]); else { this._defaultMarker = !0, this._element = s("div"); const i = 41, o = 27, r = n("svg", { display: "block", height: i * this._scale + "px", width: o * this._scale + "px", viewBox: `0 0 ${o} ${i}` }, this._element), a = n("radialGradient", { id: "shadowGradient" }, n("defs", {}, r)); n("stop", { offset: "10%", "stop-opacity": .4 }, a), n("stop", { offset: "100%", "stop-opacity": .05 }, a), n("ellipse", { cx: 13.5, cy: 34.8, rx: 10.5, ry: 5.25, fill: "url(#shadowGradient)" }, r), n("path", { fill: this._color, d: "M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z" }, r), n("path", { opacity: .25, d: "M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z" }, r), n("circle", { fill: "white", cx: 13.5, cy: 13.5, r: 5.5 }, r), this._offset = e.P.convert(t && t.offset || [0, -14]); } this._element.hasAttribute("aria-label") || this._element.setAttribute("aria-label", "Map marker"), this._element.hasAttribute("role") || this._element.setAttribute("role", "img"), this._element.classList.add("mapboxgl-marker"), this._element.addEventListener("dragstart", (e => { e.preventDefault(); })), this._element.addEventListener("mousedown", (e => { e.preventDefault(); })); const o = this._element.classList; for (const e in Os) o.remove(`mapboxgl-marker-anchor-${e}`); o.add(`mapboxgl-marker-anchor-${this._anchor}`); const r = t && t.className ? t.className.trim().split(/\s+/) : []; o.add(...r), this._popup = null; } addTo(e) { return e === this._map || (this.remove(), this._map = e, e.getCanvasContainer().appendChild(this._element), e.on("move", this._updateMoving), e.on("moveend", this._update), e.on("remove", this._clearFadeTimer), e._addMarker(this), this.setDraggable(this._draggable), this._update(), e.on("click", this._onMapClick)), this } remove() { const e = this._map; return e && (e.off("click", this._onMapClick), e.off("move", this._updateMoving), e.off("moveend", this._update), e.off("mousedown", this._addDragHandler), e.off("touchstart", this._addDragHandler), e.off("mouseup", this._onUp), e.off("touchend", this._onUp), e.off("mousemove", this._onMove), e.off("touchmove", this._onMove), e.off("remove", this._clearFadeTimer), e._removeMarker(this), this._map = void 0), this._clearFadeTimer(), this._element.remove(), this._popup && this._popup.remove(), this } getLngLat() { return this._lngLat } setLngLat(t) { return this._lngLat = e.L.convert(t), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(!0), this } getElement() { return this._element } setPopup(e) { if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeAttribute("role"), this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), e) { if (!("offset" in e.options)) { const t = 38.1, i = 13.5, o = Math.sqrt(Math.pow(i, 2) / 2); e.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -t], "bottom-left": [o, -1 * (t - i + o)], "bottom-right": [-o, -1 * (t - i + o)], left: [i, -1 * (t - i)], right: [-i, -1 * (t - i)] } : this._offset; } this._popup = e, e._marker = this, this._lngLat && this._popup.setLngLat(this._lngLat), this._element.setAttribute("role", "button"), this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress), this._element.setAttribute("aria-expanded", "false"); } return this } _onKeyPress(e) { const t = e.code, i = e.charCode || e.keyCode; "Space" !== t && "Enter" !== t && 32 !== i && 13 !== i || this.togglePopup(); } _onMapClick(e) { const t = e.originalEvent.target, i = this._element; this._popup && (t === i || i.contains(t)) && this.togglePopup(); } getPopup() { return this._popup } togglePopup() { const e = this._popup; return e ? (e.isOpen() ? (e.remove(), this._element.setAttribute("aria-expanded", "false")) : this._map && (e.addTo(this._map), this._element.setAttribute("aria-expanded", "true")), this) : this } _behindTerrain() { const e = this._map, t = this._pos; if (!e || !t) return !1; const i = e.unproject(t), o = e.getFreeCameraOptions(); if (!o.position) return !1; const r = o.position.toLngLat(); return r.distanceTo(i) < .9 * r.distanceTo(this._lngLat) } _evaluateOpacity() { const t = this._map; if (!t) return; const i = this._pos; if (!i || i.x < 0 || i.x > t.transform.width || i.y < 0 || i.y > t.transform.height) return void this._clearFadeTimer(); const o = t.unproject(i); let r; t._showingGlobe() && e.cN(t.transform, this._lngLat) ? r = 0 : (r = 1 - t._queryFogOpacity(o), t.transform._terrainEnabled() && t.getTerrain() && this._behindTerrain() && (r *= this._occludedOpacity)), this._element.style.opacity = `${r}`, this._element.style.pointerEvents = r > 0 ? "auto" : "none", this._popup && this._popup._setOpacity(r), this._fadeTimer = null; } _clearFadeTimer() { this._fadeTimer && (clearTimeout(this._fadeTimer), this._fadeTimer = null); } _updateDOM() { const e = this._pos; if (!e || !this._map) return; const t = this._offset.mult(this._scale); this._element.style.transform = `\n            translate(${e.x}px,${e.y}px)\n            ${Os[this._anchor]}\n            ${this._calculateXYTransform()} ${this._calculateZTransform()}\n            translate(${t.x}px,${t.y}px)\n        `; } _calculateXYTransform() { const t = this._pos, i = this._map, o = this.getPitchAlignment(); if (!i || !t || "map" !== o) return ""; if (!i._showingGlobe()) { const e = i.getPitch(); return e ? `rotateX(${e}deg)` : "" } const r = e.Y(e.cO(i.transform, this._lngLat)), s = t.sub(e.cP(i.transform)), n = Math.abs(s.x) + Math.abs(s.y); if (0 === n) return ""; const a = r / n; return `rotateX(${-s.y * a}deg) rotateY(${s.x * a}deg)` } _calculateZTransform() { const t = this._pos, i = this._map; if (!i || !t) return ""; let o = 0; const r = this.getRotationAlignment(); if ("map" === r) if (i._showingGlobe()) { const t = i.project(new e.L(this._lngLat.lng, this._lngLat.lat + .001)), r = i.project(new e.L(this._lngLat.lng, this._lngLat.lat - .001)).sub(t); o = e.Y(Math.atan2(r.y, r.x)) - 90; } else o = -i.getBearing(); else if ("horizon" === r) { const r = e.an(4, 6, i.getZoom()), s = e.cP(i.transform); s.y += r * i.transform.height; const n = t.sub(s), a = e.Y(Math.atan2(n.y, n.x)); o = (a > 90 ? a - 270 : a + 90) * (1 - r); } return o += this._rotation, o ? `rotateZ(${o}deg)` : "" } _update(e) { cancelAnimationFrame(this._updateFrameId); const t = this._map; t && (t.transform.renderWorldCopies && (this._lngLat = zs(this._lngLat, this._pos, t.transform)), this._pos = t.project(this._lngLat), !0 === e ? this._updateFrameId = requestAnimationFrame((() => { this._element && this._pos && this._anchor && (this._pos = this._pos.round(), this._updateDOM()); })) : this._pos = this._pos.round(), t._requestDomTask((() => { this._map && (this._element && this._pos && this._anchor && this._updateDOM(), (t._showingGlobe() || t.getTerrain() || t.getFog()) && !this._fadeTimer && (this._fadeTimer = setTimeout(this._evaluateOpacity.bind(this), 60))); }))); } getOffset() { return this._offset } setOffset(t) { return this._offset = e.P.convert(t), this._update(), this } addClassName(e) { return this._element.classList.add(e), this } removeClassName(e) { return this._element.classList.remove(e), this } toggleClassName(e) { return this._element.classList.toggle(e) } _onMove(t) { const i = this._map; if (!i) return; const o = this._pointerdownPos, r = this._positionDelta; if (o && r) { if (!this._isDragging) { const e = this._clickTolerance || i._clickTolerance; if (t.point.dist(o) < e) return; this._isDragging = !0; } this._pos = t.point.sub(r), this._lngLat = i.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new e.a8("dragstart"))), this.fire(new e.a8("drag")); } } _onUp() { this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = !1; const t = this._map; t && (t.off("mousemove", this._onMove), t.off("touchmove", this._onMove)), "active" === this._state && this.fire(new e.a8("dragend")), this._state = "inactive"; } _addDragHandler(e) { const t = this._map, i = this._pos; t && i && this._element.contains(e.originalEvent.target) && (e.preventDefault(), this._positionDelta = e.point.sub(i), this._pointerdownPos = e.point, this._state = "pending", t.on("mousemove", this._onMove), t.on("touchmove", this._onMove), t.once("mouseup", this._onUp), t.once("touchend", this._onUp)); } setDraggable(e) { this._draggable = !!e; const t = this._map; return t && (e ? (t.on("mousedown", this._addDragHandler), t.on("touchstart", this._addDragHandler)) : (t.off("mousedown", this._addDragHandler), t.off("touchstart", this._addDragHandler))), this } isDraggable() { return this._draggable } setRotation(e) { return this._rotation = e || 0, this._update(), this } getRotation() { return this._rotation } setRotationAlignment(e) { return this._rotationAlignment = e || "auto", this._update(), this } getRotationAlignment() { return "auto" === this._rotationAlignment || "horizon" === this._rotationAlignment && this._map && !this._map._showingGlobe() ? "viewport" : this._rotationAlignment } setPitchAlignment(e) { return this._pitchAlignment = e || "auto", this._update(), this } getPitchAlignment() { return "auto" === this._pitchAlignment ? this.getRotationAlignment() : this._pitchAlignment } setOccludedOpacity(e) { return this._occludedOpacity = e || .2, this._update(), this } getOccludedOpacity() { return this._occludedOpacity } } const Bs = { closeButton: !0, closeOnClick: !0, focusAfterOpen: !0, className: "", maxWidth: "240px" }, ks = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", "); function Ns(t = new e.P(0, 0), i = "bottom") { if ("number" == typeof t) { const o = Math.round(Math.sqrt(.5 * Math.pow(t, 2))); switch (i) { case "top": return new e.P(0, t); case "top-left": return new e.P(o, o); case "top-right": return new e.P(-o, o); case "bottom": return new e.P(0, -t); case "bottom-left": return new e.P(o, -o); case "bottom-right": return new e.P(-o, -o); case "left": return new e.P(t, 0); case "right": return new e.P(-t, 0) }return new e.P(0, 0) } return t instanceof e.P || Array.isArray(t) ? e.P.convert(t) : e.P.convert(t[i] || [0, 0]) } class Us { constructor(e) { this.jumpTo(e); } getValue(t) { if (t <= this._startTime) return this._start; if (t >= this._endTime) return this._end; const i = e.ba((t - this._startTime) / (this._endTime - this._startTime)); return this._start * (1 - i) + this._end * i } isEasing(e) { return e >= this._startTime && e <= this._endTime } jumpTo(e) { this._startTime = -1 / 0, this._endTime = -1 / 0, this._start = e, this._end = e; } easeTo(e, t, i) { this._start = this.getValue(t), this._end = e, this._startTime = t, this._endTime = t + i; } } const Gs = { "AttributionControl.ToggleAttribution": "Toggle attribution", "AttributionControl.MapFeedback": "Map feedback", "FullscreenControl.Enter": "Enter fullscreen", "FullscreenControl.Exit": "Exit fullscreen", "GeolocateControl.FindMyLocation": "Find my location", "GeolocateControl.LocationNotAvailable": "Location not available", "LogoControl.Title": "Mapbox logo", "Map.Title": "Map", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map", "ScrollZoomBlocker.CmdMessage": "Use ⌘ + scroll to zoom the map", "TouchPanBlocker.Message": "Use two fingers to move the map" }, js = { center: [0, 0], zoom: 0, bearing: 0, pitch: 0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 85, interactive: !0, scrollZoom: !0, boxZoom: !0, dragRotate: !0, dragPan: !0, keyboard: !0, doubleClickZoom: !0, touchZoomRotate: !0, touchPitch: !0, cooperativeGestures: !1, performanceMetricsCollection: !0, bearingSnap: 7, clickTolerance: 3, pitchWithRotate: !0, hash: !1, attributionControl: !0, antialias: !1, failIfMajorPerformanceCaveat: !1, preserveDrawingBuffer: !1, trackResize: !0, renderWorldCopies: !0, refreshExpiredTiles: !0, minTileCacheSize: null, maxTileCacheSize: null, localIdeographFontFamily: "sans-serif", localFontFamily: null, transformRequest: null, accessToken: null, fadeDuration: 300, respectPrefersReducedMotion: !0, crossSourceCollisions: !0, collectResourceTiming: !1, testMode: !1 }; class Vs { constructor() { this.showOverdrawInspector = !1, this.showTileBoundaries = !1, this.continuousRedraw = !1, this.showTerrainWireframe = !1, this.showLayers2DWireframe = !1, this.showLayers3DWireframe = !1; } } const Zs = { showCompass: !0, showZoom: !0, visualizePitch: !1 }; class Ws { constructor(t, i, o = !1) { this._clickTolerance = 10, this.element = i, this.mouseRotate = new is({ clickTolerance: t.dragRotate._mouseRotate._clickTolerance }), this.map = t, o && (this.mousePitch = new os({ clickTolerance: t.dragRotate._mousePitch._clickTolerance })), e.aR(["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(e, t) { this.mouseRotate.mousedown(e, t), this.mousePitch && this.mousePitch.mousedown(e, t), h(); } move(e, t) { const i = this.map, o = this.mouseRotate.mousemoveWindow(e, t), r = o && o.bearingDelta; if (r && i.setBearing(i.getBearing() + r), this.mousePitch) { const o = this.mousePitch.mousemoveWindow(e, t), r = o && o.pitchDelta; r && i.setPitch(i.getPitch() + r); } } off() { const e = this.element; e.removeEventListener("mousedown", this.mousedown), e.removeEventListener("touchstart", this.touchstart, { passive: !1 }), e.removeEventListener("touchmove", this.touchmove), e.removeEventListener("touchend", this.touchend), e.removeEventListener("touchcancel", this.reset), this.offTemp(); } offTemp() { _(), window.removeEventListener("mousemove", this.mousemove), window.removeEventListener("mouseup", this.mouseup); } mousedown(t) { this.down(e.ak({}, t, { ctrlKey: !0, preventDefault: () => t.preventDefault() }), p(this.element, t)), window.addEventListener("mousemove", this.mousemove), window.addEventListener("mouseup", this.mouseup); } mousemove(e) { this.move(e, p(this.element, e)); } mouseup(e) { this.mouseRotate.mouseupWindow(e), this.mousePitch && this.mousePitch.mouseupWindow(e), this.offTemp(); } touchstart(e) { 1 !== e.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = m(this.element, e.targetTouches)[0], this.down({ type: "mousedown", button: 0, ctrlKey: !0, preventDefault: () => e.preventDefault() }, this._startPos)); } touchmove(e) { 1 !== e.targetTouches.length ? this.reset() : (this._lastPos = m(this.element, e.targetTouches)[0], this.move({ preventDefault: () => e.preventDefault() }, this._lastPos)); } touchend(e) { 0 === e.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), this.reset(); } reset() { this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp(); } } const Hs = { positionOptions: { enableHighAccuracy: !1, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: !1, showAccuracyCircle: !0, showUserLocation: !0, showUserHeading: !1 }, qs = { maxWidth: 100, unit: "metric" }, $s = { kilometer: "km", meter: "m", mile: "mi", foot: "ft", "nautical-mile": "nm" }, Xs = { version: e.c$, supported: i, setRTLTextPlugin: e.d1, getRTLTextPluginStatus: e.d2, Map: class extends Ps { constructor(t) { const i = t; if (null != (t = e.ak({}, js, t)).minZoom && null != t.maxZoom && t.minZoom > t.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom"); if (null != t.minPitch && null != t.maxPitch && t.minPitch > t.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch"); if (null != t.minPitch && t.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0"); if (null != t.maxPitch && t.maxPitch > 85) throw new Error("maxPitch must be less than or equal to 85"); if (t.antialias && e.cQ(window) && (t.antialias = !1, e.X("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")), super(new De(t.minZoom, t.maxZoom, t.minPitch, t.maxPitch, t.renderWorldCopies), t), this._repaint = !1, this._interactive = t.interactive, this._minTileCacheSize = t.minTileCacheSize, this._maxTileCacheSize = t.maxTileCacheSize, this._failIfMajorPerformanceCaveat = t.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = t.preserveDrawingBuffer, this._antialias = t.antialias, this._trackResize = t.trackResize, this._bearingSnap = t.bearingSnap, this._refreshExpiredTiles = t.refreshExpiredTiles, this._fadeDuration = t.fadeDuration, this._isInitialLoad = !0, this._crossSourceCollisions = t.crossSourceCollisions, this._collectResourceTiming = t.collectResourceTiming, this._language = this._parseLanguage(t.language), this._worldview = t.worldview, this._renderTaskQueue = new Rs, this._domRenderTaskQueue = new Rs, this._controls = [], this._markers = [], this._popups = [], this._mapId = e.cR(), this._locale = e.ak({}, Gs, t.locale), this._clickTolerance = t.clickTolerance, this._cooperativeGestures = t.cooperativeGestures, this._performanceMetricsCollection = t.performanceMetricsCollection, this._containerWidth = 0, this._containerHeight = 0, this._averageElevationLastSampledAt = -1 / 0, this._averageElevationExaggeration = 0, this._averageElevation = new Us(0), this._interactionRange = [1 / 0, -1 / 0], this._visibilityHidden = 0, this._useExplicitProjection = !1, this._requestManager = new e.cS(t.transformRequest, t.accessToken, t.testMode), this._silenceAuthErrors = !!t.testMode, this._contextCreateOptions = t.contextCreateOptions ? { ...t.contextCreateOptions } : {}, "string" == typeof t.container) { const e = document.getElementById(t.container); if (!e) throw new Error(`Container '${t.container.toString()}' not found.`); this._container = e; } else { if (!(t.container instanceof HTMLElement)) throw new Error("Invalid type: 'container' must be a String or HTMLElement."); this._container = t.container; } if (this._container.childNodes.length > 0 && e.X("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."), t.maxBounds && this.setMaxBounds(t.maxBounds), e.aR(["_onWindowOnline", "_onWindowResize", "_onVisibilityChange", "_onMapScroll", "_contextLost", "_
41contextRestored"], this), this._setupContainer(), this._debugParams = new Vs, this._tp = t.devtools ? new dr(this) : new dr, this._tp.registerParameter(this._debugParams, ["Debug"], "showOverdrawInspector", void 0, (() => { this._update(); })), this._tp.registerParameter(this._debugParams, ["Debug"], "showTileBoundaries", void 0, (() => { this._update(); })), this._tp.registerParameter(this._debugParams, ["Debug"], "continuousRedraw", void 0, (e => { this.repaint = e; })), this._tp.registerParameter(this._debugParams, ["Debug", "Wireframe"], "showTerrainWireframe", void 0, (() => { this._update(); })), this._tp.registerParameter(this._debugParams, ["Debug", "Wireframe"], "showLayers2DWireframe", void 0, (() => { this._update(); })), this._tp.registerParameter(this._debugParams, ["Debug", "Wireframe"], "showLayers3DWireframe", void 0, (() => { this._update(); })), this._setupPainter(), void 0 === this.painter) throw new Error("Failed to initialize WebGL."); if (this.on("move", (() => this._update(!1))), this.on("moveend", (() => this._update(!1))), this.on("zoom", (() => this._update(!0))), this._fullscreenchangeEvent = "onfullscreenchange" in document ? "fullscreenchange" : "webkitfullscreenchange", window.addEventListener("online", this._onWindowOnline, !1), window.addEventListener("resize", this._onWindowResize, !1), window.addEventListener("orientationchange", this._onWindowResize, !1), window.addEventListener(this._fullscreenchangeEvent, this._onWindowResize, !1), window.addEventListener("visibilitychange", this._onVisibilityChange, !1), this.handlers = new Ms(this, t), this._localFontFamily = t.localFontFamily, this._localIdeographFontFamily = t.localIdeographFontFamily, (t.style || !t.testMode) && this.setStyle(t.style || e.cM.DEFAULT_STYLE, { localFontFamily: this._localFontFamily, localIdeographFontFamily: this._localIdeographFontFamily }), t.projection && this.setProjection(t.projection), t.hash && (this._hash = new Rr("string" == typeof t.hash && t.hash || void 0).addTo(this)), !this._hash || !this._hash._onHashChange()) { null == i.center && null == i.zoom || (this.transform._unmodified = !1), this.jumpTo({ center: t.center, zoom: t.zoom, bearing: t.bearing, pitch: t.pitch }); const o = t.bounds; o && (this.resize(), this.fitBounds(o, e.ak({}, t.fitBoundsOptions, { duration: 0 }))); } this.resize(), t.attributionControl && this.addControl(new Ds({ customAttribution: t.customAttribution })), this._logoControl = new As, this.addControl(this._logoControl, t.logoPosition), this.on("style.load", (() => { this.transform.unmodified && this.jumpTo(this.style.stylesheet); })), this.on("data", (t => { this._update("style" === t.dataType), this.fire(new e.a8(`${t.dataType}data`, t)); })), this.on("dataloading", (t => { this.fire(new e.a8(`${t.dataType}dataloading`, t)); })); } _getMapId() { return this._mapId } addControl(t, i) { if (void 0 === i && (i = t.getDefaultPosition ? t.getDefaultPosition() : "top-right"), !t || !t.onAdd) return this.fire(new e.a7(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))); const o = t.onAdd(this); this._controls.push(t); const r = this._controlPositions[i]; return -1 !== i.indexOf("bottom") ? r.insertBefore(o, r.firstChild) : r.appendChild(o), this } removeControl(t) { if (!t || !t.onRemove) return this.fire(new e.a7(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods."))); const i = this._controls.indexOf(t); return i > -1 && this._controls.splice(i, 1), t.onRemove(this), this } hasControl(e) { return this._controls.indexOf(e) > -1 } getContainer() { return this._container } getCanvasContainer() { return this._canvasContainer } getCanvas() { return this._canvas } resize(t) { 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 e.a8("movestart", t)).fire(new e.a8("move", t)), this.fire(new e.a8("resize", t)), i && this.fire(new e.a8("moveend", t)), this } getBounds() { return this.transform.getBounds() } getMaxBounds() { return this.transform.getMaxBounds() || null } setMaxBounds(t) { return this.transform.setMaxBounds(e.D.convert(t)), this._update() } setMinZoom(t) { if ((t = null == t ? -2 : t) >= -2 && t <= this.transform.maxZoom) return this.transform.minZoom = t, this._update(), this.getZoom() < t ? this.setZoom(t) : this.fire(new e.a8("zoomstart")).fire(new e.a8("zoom")).fire(new e.a8("zoomend")), this; throw new Error("minZoom must be between -2 and the current maxZoom, inclusive") } getMinZoom() { return this.transform.minZoom } setMaxZoom(t) { if ((t = null == t ? 22 : t) >= this.transform.minZoom) return this.transform.maxZoom = t, this._update(), this.getZoom() > t ? this.setZoom(t) : this.fire(new e.a8("zoomstart")).fire(new e.a8("zoom")).fire(new e.a8("zoomend")), this;
41 throw new Error("maxZoom must be greater than the current minZoom") } getMaxZoom() { return this.transform.maxZoom } setMinPitch(t) { if ((t = null == t ? 0 : t) < 0) throw new Error("minPitch must be greater than or equal to 0"); if (t >= 0 && t <= this.transform.maxPitch) return this.transform.minPitch = t, this._update(), this.getPitch() < t ? this.setPitch(t) : this.fire(new e.a8("pitchstart")).fire(new e.a8("pitch")).fire(new e.a8("pitchend")), this; throw new Error("minPitch must be between 0 and the current maxPitch, inclusive") } getMinPitch() { return this.transform.minPitch } setMaxPitch(t) { if ((t = null == t ? 85 : t) > 85) throw new Error("maxPitch must be less than or equal to 85"); if (t >= this.transform.minPitch) return this.transform.maxPitch = t, this._update(), this.getPitch() > t ? this.setPitch(t) : this.fire(new e.a8("pitchstart")).fire(new e.a8("pitch")).fire(new e.a8("pitchend")), this; throw new Error("maxPitch must be greater than or equal to minPitch") } getMaxPitch() { return this.transform.maxPitch } getRenderWorldCopies() { return this.transform.renderWorldCopies } setRenderWorldCopies(e) { return this.transform.renderWorldCopies = e, this.transform.renderWorldCopies || this._forceMarkerAndPopupUpdate(!0), this._update() } getLanguage() { return this._language } _parseLanguage(e) { return "auto" === e ? navigator.language : Array.isArray(e) ? 0 === e.length ? void 0 : e.map((e => "auto" === e ? navigator.language : e)) : e } setLanguage(e) { const t = this._parseLanguage(e); if (!this.style || t === this._language) return this; this._language = t, this.style.reloadSources(); for (const e of this._controls) e._setLanguage && e._setLanguage(this._language); return this } getWorldview() { return this._worldview } setWorldview(e) { return this.style && e !== this._worldview ? (this._worldview = e, this.style.reloadSources(), this) : this } getProjection() { return this.transform.mercatorFromTransition ? { name: "globe", center: [0, 0] } : this.transform.getProjection() } _showingGlobe() { return "globe" === this.transform.projection.name } setProjection(e) { return this._lazyInitEmptyStyle(), e ? "string" == typeof e && (e = { name: e }) : e = null, this._useExplicitProjection = !!e, this._prioritizeAndUpdateProjection(e, this.style.projection) } _updateProjectionTransition() { if ("globe" !== this.getProjection().name) return; const t = this.transform, i = t.projection.name; let o; "globe" === i && t.zoom >= e.G ? (t.setMercatorFromTransition(), o = !0) : "mercator" === i && t.zoom < e.G && (t.setProjection({ name: "globe" }), o = !0), o && (this.style.applyProjectionUpdate(), this.style._forceSymbolLayerUpdate()); } _prioritizeAndUpdateProjection(e, t) { return this._updateProjection(e || t || { name: "mercator" }) } _updateProjection(t) { let i; return i = "globe" === t.name && this.transform.zoom >= e.G ? this.transform.setMercatorFromTransition() : this.transform.setProjection(t), this.style.applyProjectionUpdate(), i && (this.painter.clearBackgroundTiles(), this.style.clearSources(), this._update(!0), this._forceMarkerAndPopupUpdate(!0)), this } project(t) { return this.transform.locationPoint3D(e.L.convert(t)) } unproject(t) { return this.transform.pointLocation3D(e.P.convert(t)) } isMoving() { return this._moving || this.handlers && this.handlers.isMoving() || !1 } isZooming() { return this._zooming || this.handlers && this.handlers.isZooming() || !1 } isRotating() { return this._rotating || this.handlers && this.handlers.isRotating() || !1 } _isDragging() { return this.handlers && this.handlers._isDragging() || !1 } _createDelegatedListener(e, t, i) { if ("mouseenter" === e || "mouseover" === e) { let o = !1; const r = r => { const s = t.filter((e => this.getLayer(e))), n = s.length ? this.queryRenderedFeatures(r.point, { layers: s }) : []; n.length ? o || (o = !0, i.call(this, new Vr(e, this, r.originalEvent, { features: n }))) : o = !1; }, s = () => { o = !1; }; return { layers: new Set(t), listener: i, delegates: { mousemove: r, mouseout: s } } } if ("mouseleave" === e || "mouseout" === e) { let o = !1; const r = r => { const s = t.filter((e => this.getLayer(e))); (s.length ? this.queryRenderedFeatures(r.point, { layers: s }) : []).length ? o = !0 : o && (o = !1, i.call(this, new Vr(e, this, r.originalEvent))); }, s = t => { o && (o = !1, i.call(this, new Vr(e, this, t.originalEvent))); }; return { layers: new Set(t), listener: i, delegates: { mousemove: r, mouseout: s } } } { const o = e => { const o = t.filter((e => this.getLayer(e))), r = o.length ? this.queryRenderedFeatures(e.point, { layers: o }) : []; r.length && (e.features = r, i.call(this, e), delete e.features); }; return { layers: new Set(t), listener: i, delegates: { [e]: o } } } } on(e, t, i) { if (void 0 === i) return super.on(e, t); if (Array.isArray(t) || (t = [t]), t) for (const e of t) if (!this._isValidId(e)) return this; const o = this._createDelegatedListener(e, t, i); this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[e] = this._delegatedListeners[e] || [], this._delegatedListeners[e].push(o); for (const e in o.delegates) this.on(e, o.delegates[e]); return this } once(e, t, i) { if (void 0 === i) return super.once(e, t); if (Array.isArray(t) || (t = [t]), t) for (const e of t) if (!this._isValidId(e)) return this; const o = this._createDelegatedListener(e, t, i); for (const e in o.delegates) this.once(e, o.delegates[e]); return this } off(e, t, i) { if (void 0 === i) return super.off(e, t); t = new Set(Array.isArray(t) ? t : [t]); for (const e of t) if (!this._isValidId(e)) return this; const o = (e, t) => { if (e.size !== t.size) return !1; for (const i of e) if (!t.has(i)) return !1; return !0 }, r = this._delegatedListeners ? this._delegatedListeners[e] : void 0; return r && (e => { for (let r = 0; r < e.length; r++) { const s = e[r]; if (s.listener === i && o(s.layers, t)) { for (const e in s.delegates) this.off(e, s.delegates[e]); return e.splice(r, 1), this } } })(r), this } queryRenderedFeatures(t, i) { if (!this.style) return []; if (void 0 !== i || void 0 === t || t instanceof e.P || Array.isArray(t) || (i = t, t = void 0), t = t || [[0, 0], [this.transform.width, this.transform.height]], (i = i || {}).layers && Array.isArray(i.layers)) for (const e of i.layers) if (!this._isValidId(e)) return []; return this.style.queryRenderedFeatures(t, i, this.transform) } querySourceFeatures(e, t) { return this._isValidId(e) ? this.style.querySourceFeatures(e, t) : [] } isPointOnSurface(t) { const { name: i } = this.transform.projection; return "globe" !== i && "mercator" !== i && e.X(`${i} projection does not support isPointOnSurface, this API may behave unex
41pectedly.`), this.transform.isPointOnSurface(e.P.convert(t)) } setStyle(t, i) { return !1 !== (i = e.ak({}, { localIdeographFontFamily: this._localIdeographFontFamily, localFontFamily: this._localFontFamily }, i)).diff && i.localIdeographFontFamily === this._localIdeographFontFamily && i.localFontFamily === this._localFontFamily && this.style && t ? (this._diffStyle(t, i), this) : (this._localIdeographFontFamily = i.localIdeographFontFamily, this._localFontFamily = i.localFontFamily, this._updateStyle(t, i)) } _getUIString(e) { const t = this._locale[e]; if (null == t) throw new Error(`Missing UI string '${e}'`); return t } _updateStyle(e, t) { return this.style && (this.style.setEventedParent(null), this.style._remove(), this.style = void 0), e && (this.style = new Dr(this, t || {}), this.style.setEventedParent(this, { style: this.style }), "string" == typeof e ? this.style.loadURL(e) : this.style.loadJSON(e)), this._updateTerrain(), this } _lazyInitEmptyStyle() { this.style || (this.style = new Dr(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty()); } _diffStyle(t, i) { if ("string" == typeof t) { const o = this._requestManager.normalizeStyleURL(t), r = this._requestManager.transformRequest(o, e.a2.Style); e.a1(r, ((t, o) => { t ? this.fire(new e.a7(t)) : o && this._updateDiff(o, i); })); } else "object" == typeof t && this._updateDiff(t, i); } _updateDiff(t, i) { try { this.style.setState(t) && this._update(!0); } catch (o) { e.X(`Unable to perform style diff: ${o.message || o.error || o}.  Rebuilding the style from scratch.`), this._updateStyle(t, i); } } getStyle() { if (this.style) return this.style.serialize() } isStyleLoaded() { return this.style ? this.style.loaded() : (e.X("There is no style added to the map."), !1) } _isValidId(t) { return null == t ? (this.fire(new e.a7(new Error("IDs can't be empty."))), !1) : !e.cu(t) || (this.fire(new e.a7(new Error(`IDs can't contain special symbols: "${t}".`))), !1) } addSource(e, t) { return this._isValidId(e) ? (this._lazyInitEmptyStyle(), this.style.addSource(e, t), this._update(!0)) : this } isSourceLoaded(e) { return !!this._isValidId(e) && !!this.style && this.style._isSourceCacheLoaded(e) } areTilesLoaded() { return this.style.areTilesLoaded() } addSourceType(e, t, i) { this._lazyInitEmptyStyle(), this.style.addSourceType(e, t, i); } removeSource(e) { return this._isValidId(e) ? (this.style.removeSource(e), this._updateTerrain(), this._update(!0)) : this } getSource(e) { return this._isValidId(e) ? this.style.getOwnSource(e) : null } addImage(t, i, { pixelRatio: o = 1, sdf: r = !1, stretchX: s, stretchY: n, content: a } = {}) { if (this._lazyInitEmptyStyle(), i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap) { const { width: l, height: c, data: h } = e.a4.getImageData(i); this.style.addImage(t, { data: new e.a5({ width: l, height: c }, h), pixelRatio: o, stretchX: s, stretchY: n, content: a, sdf: r, version: 0 }); } else if (void 0 === i.width || void 0 === i.height) this.fire(new e.a7(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(t, { data: new e.a5({ width: l, height: c }, new Uint8Array(h.data)), pixelRatio: o, stretchX: s, stretchY: n, content: a, sdf: r, version: 0, userImage: h }), h.onAdd && h.onAdd(this, t); } } updateImage(t, i) { this._lazyInitEmptyStyle(); const o = this.style.getImage(t); if (!o) return void this.fire(new e.a7(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead."))); const r = i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap ? e.a4.getImageData(i) : i, { width: s, height: n } = r, a = r.data; if (void 0 === s || void 0 === n) return void this.fire(new e.a7(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`"))); if (s !== o.data.width || n !== o.data.height) return void this.fire(new e.a7(new Error(`The width and height of the updated image (${s}, ${n})\n                must be that same as the previous version of the image\n                (${o.data.width}, ${o.data.height})`))); const l = !(i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap); o.data.replace(a, l), this.style.updateImage(t, o); } hasImage(t) { return t ? !!this.style && !!this.style.getImage(t) : (this.fire(new e.a7(new Error("Missing required image id"))), !1) } removeImage(e) { this.style.removeImage(e); } loadImage(t, i) { e.a3(this._requestManager.transformRequest(t, e.a2.Image), ((t, o) => { i(t, o instanceof HTMLImageElement ? e.a4.getImageData(o) : o); })); } listImages() { return this.style.listImages() } addModel(e, t) { this._lazyInitEmptyStyle(), this.style.addModel(e, t); } hasModel(t) { return t ? this.style.hasModel(t) : (this.fire(new e.a7(new Error("Missing required model id"))), !1) } removeModel(e) { this.style.removeModel(e); } listModels() { return this.style.listModels() } addLayer(e, t) { return this._isValidId(e.id) ? (this._lazyInitEmptyStyle(), this.style.addLayer(e, t), this._update(!0)) : this } moveLayer(e, t) { return this._isValidId(e) ? (this.style.moveLayer(e, t), this._update(!0)) : this } removeLayer(e) { return this._isValidId(e) ? (this.style.removeLayer(e), this._update(!0)) : this } getLayer(e) { return this._isValidId(e) ? this.style.getOwnLayer(e) : null } setLayerZoomRange(e, t, i) { return this._isValidId(e) ? (this.style.setLayerZoomRange(e, t, i), this._update(!0)) : this } setFilter(e, t, i = {}) { return this._isValidId(e) ? (this.style.setFilter(e, t, i), this._update(!0)) : this } getFilter(e) { return this._isValidId(e) ? this.style.getFilter(e) : null } setPaintProperty(e, t, i, o = {}) { return this._isValidId(e) ? (this.style.setPaintProperty(e, t, i, o), this._update(!0)) : this } getPaintProperty(e, t) { return this._isValidId(e) ? this.style.getPaintProperty(e, t) : null } setLayoutProperty(e, t, i, o = {}) { return this._isValidId(e) ? (this.style.setLayoutProperty(e, t, i, o), this._update(!0)) : this } getLayoutProperty(e, t) { return this._isValidId(e) ? this.style.getLayoutProperty(e, t) : null } getConfigProperty(e, t) { return this.style.getConfigProperty(e, t) } setConfigProperty(e, t, i) { return this.style.setConfigProperty(e, t, i), this._update(!0) } setLights(e) { if (this._lazyInitEmptyStyle(), e && 1 === e.length && "flat" === e[0].type) { const t = e[0]; t.properties ? this.style.setFlatLight(t.properties, t.id, {}) : this.style.setFlatLight({}, "flat"); } else this.style.setLights(e), this.painter.terrain && (this.painter.terrain.invalidateRenderCache = !0); return this._update(!0) } getLights() { const e = this.style.getLights() || []; return 0 === e.length && e.push({ id: this.style.light.id, type: "flat", properties: this.style.getFlatLight() }), e } setLight(e, t = {}
vendor: 4,441 bytes, line 41
41) { return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."), this.setLights([{ id: "flat", type: "flat", properties: e }]) } getLight() { return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."), this.style.getFlatLight() } setTerrain(e) { return this._lazyInitEmptyStyle(), !e && this.transform.projection.requiresDraping ? this.style.setTerrainForDraping() : this.style.setTerrain(e), this._averageElevationLastSampledAt = -1 / 0, this._update(!0) } getTerrain() { return this.style ? this.style.getTerrain() : null } setFog(e) { return this._lazyInitEmptyStyle(), this.style.setFog(e), this._update(!0) } getFog() { return this.style ? this.style.getFog() : null } setCamera(e) { return this.style.setCamera(e), this._triggerCameraUpdate(e) } _triggerCameraUpdate(e) { return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic" === e["camera-projection"])) } getCamera() { return this.style.camera } _queryFogOpacity(t) { return this.style && this.style.fog ? this.style.fog.getOpacityAtLatLng(e.L.convert(t), this.transform) : 0 } setFeatureState(e, t) { return this._isValidId(e.source) ? (this.style.setFeatureState(e, t), this._update()) : this } removeFeatureState(e, t) { return this._isValidId(e.source) ? (this.style.removeFeatureState(e, t), this._update()) : this } getFeatureState(e) { return this._isValidId(e.source) ? this.style.getFeatureState(e) : null } _updateContainerDimensions() { if (!this._container) return; const e = this._container.getBoundingClientRect().width || 400, t = this._container.getBoundingClientRect().height || 300; let i, o, r, s = this._container; for (; s && (!o || !r);) { const e = window.getComputedStyle(s).transform; e && "none" !== e && (i = e.match(/matrix.*\((.+)\)/)[1].split(", "), i[0] && "0" !== i[0] && "1" !== i[0] && (o = i[0]), i[3] && "0" !== i[3] && "1" !== i[3] && (r = i[3])), s = s.parentElement; } this._containerWidth = o ? Math.abs(e / o) : e, this._containerHeight = r ? Math.abs(t / r) : t; } _detectMissingCSS() { "rgb(250, 128, 114)" !== window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") && e.X("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/."); } _setupContainer() { const e = this._container; e.classList.add("mapboxgl-map"), (this._missingCSSCanary = s("div", "mapboxgl-canary", e)).style.visibility = "hidden", this._detectMissingCSS(); const t = this._canvasContainer = s("div", "mapboxgl-canvas-container", e); this._canvas = s("canvas", "mapboxgl-canvas", t), this._interactive && (t.classList.add("mapboxgl-interactive"), this._canvas.setAttribute("tabindex", "0")), this._canvas.addEventListener("webglcontextlost", this._contextLost, !1), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region"), this._updateContainerDimensions(), this._resizeCanvas(this._containerWidth, this._containerHeight); const i = this._controlContainer = s("div", "mapboxgl-control-container", e), o = this._controlPositions = {};["top-left", "top-right", "bottom-left", "bottom-right"].forEach((e => { o[e] = s("div", `mapboxgl-ctrl-${e}`, i); })), this._container.addEventListener("scroll", this._onMapScroll, !1); } _resizeCanvas(t, i) { const o = e.a4.devicePixelRatio || 1; this._canvas.width = o * Math.ceil(t), this._canvas.height = o * Math.ceil(i), this._canvas.style.width = `${t}px`, this._canvas.style.height = `${i}px`; } _addMarker(e) { this._markers.push(e); } _removeMarker(e) { const t = this._markers.indexOf(e); -1 !== t && this._markers.splice(t, 1); } _addPopup(e) { this._popups.push(e); } _removePopup(e) { const t = this._popups.indexOf(e); -1 !== t && this._popups.splice(t, 1); } _setupPainter() { const t = e.ak({}, i.webGLContextAttributes, { failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || !1 }), o = this._canvas.getContext("webgl2", t); o ? (e.cT(o, !0), this.painter = new mr(o, this._contextCreateOptions, this.transform, this._tp), this.on("data", (e =>
41 { "source" === e.dataType && this.painter.setTileLoadedFlag(!0); })), e.cU.testSupport(o)) : this.fire(new e.a7(new Error("Failed to initialize WebGL"))); } _contextLost(t) { t.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.fire(new e.a8("webglcontextlost", { originalEvent: t })); } _contextRestored(t) { this._setupPainter(), this.resize(), this._update(), this.fire(new e.a8("webglcontextrestored", { originalEvent: t })); } _onMapScroll(e) { if (e.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, !1 } loaded() { return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded() } _update(e) { return this.style ? (this._styleDirty = this._styleDirty || e, this._sourcesDirty = !0, this.triggerRepaint(), this) : this } _requestRenderFrame(e) { return this._update(), this._renderTaskQueue.add(e) } _cancelRenderFrame(e) { this._renderTaskQueue.remove(e); } _requestDomTask(e) { !this.loaded() || this.loaded() && !this.isMoving() ? e() : this._domRenderTaskQueue.add(e); } _render(t) { let i; this.fire(new e.a8("renderstart")); const o = this.painter.context.extTimerQuery, r = e.a4.now(), s = this.painter.context.gl; if (this.listens("gpu-timing-frame") && (i = s.createQuery(), s.beginQuery(o.TIME_ELAPSED_EXT, i)), this.painter.context.setDirty(), this.painter.setBaseState(), (this.isMoving() || this.isRotating() || this.isZooming()) && (this._interactionRange[0] = Math.min(this._interactionRange[0], performance.now()), this._interactionRange[1] = Math.max(this._interactionRange[1], performance.now())), this._renderTaskQueue.run(t), this._domRenderTaskQueue.run(t), this._removed) return; this._updateProjectionTransition(); const n = this._isInitialLoad ? 0 : this._fadeDuration; if (this.style && this._styleDirty) { this._styleDirty = !1; const t = this.transform.zoom, i = this.transform.pitch, o = e.a4.now(), r = new e.al(t, { now: o, fadeDuration: n, pitch: i, transition: this.style.transition }); this.style.update(r); } this.style && this.style.hasFogTransition() && (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(r), this.style.updateSources(this.transform), this._forceMarkerAndPopupUpdate()) : a = this._updateAverageElevation(r), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, n, this._crossSourceCollisions), this.style && this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries || this._debugParams.showTileBoundaries, wireframe: { terrain: this.showTerrainWireframe || this._debugParams.showTerrainWireframe, layers2D: this.showLayers2DWireframe || this._debugParams.showLayers2DWireframe, layers3D: this.showLayers3DWireframe || this._debugParams.showLayers3DWireframe }, showOverdrawInspector: this._showOverdrawInspector || this._debugParams.showOverdrawInspector, showQueryGeometry: !!this._showQueryGeometry, showTileAABBs: this.showTileAABBs, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: n, 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 e.a8("render")), this.loaded() && !this._loaded && (this._loaded = !0, this.fire(new e.a8("load"))), this.style && this.style.hasTransitions() && (this._styleDirty = !0), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(), i) { const t = e.a4.now() - r; s.endQuery(o.TIME_ELAPSED_EXT), setTimeout((() => { const o = s.getQueryParameter(i, s.QUERY_RESULT) / 1e6; s.deleteQuery(i), this.fire(new e.a8("gpu-timing-frame", { cpuTime: t, gpuTime: o })); }), 50); } if (this.listens("gpu-timing-layer")) { const t = this.painter.collectGpuTimers(); setTimeout((() => { const i = this.painter.queryGpuTimers(t); this.fire(new e.a8("gpu-timing-layer", { layerTimes: i })); }), 50); } if (this.listens("gpu-timing-deferred-render")) { const t = this.painter.collectDeferredRenderGpuQueries(); setTimeout((() => { const i = this.painter.queryGpuTimeDeferredRender(t); this.fire(new e.a8("gpu-timing-deferred-render", { gpuTime: i })); }), 50); } const l = this._sourcesDirty || this._styleDirty || this._placementDirty || a; if (l || this._repaint) this.triggerRepaint(); else { const t = !this.isMoving() && this.loaded(); if (t && (a = this._updateAverageElevation(r, !0)), a) this.triggerRepaint(); else if (this._triggerFrame(!1), t && (this.fire(new e.a8("idle")), this._isInitialLoad = !1, this.speedIndexTiming)) { const t = this._calculateSpeedIndex(); this.fire(new e.a8("speedindexcompleted", { speedIndex: t })), this.speedIndexTiming = !1; } } !this._loaded || this._fullyLoaded || l || (this._fullyLoaded = !0, this._performanceMetricsCollection && e.cV(this._requestManager._customAccessToken, { width: this.painter.width, height: this.painter.height, interactionRange: this._interactionRange, visibilityHidden: this._visibilityHidden, terrainEnabled: !!this.painter.style.getTerrain(), fogEnabled: !!this.painter.style.getFog(), projection: this.getProjection().name, zoom: this.transform.zoom, renderer: this.painter.context.renderer, vendor: this.painter.context.vendor }), this._authenticate()); }
vendor: 11,906 bytes, line 41
41 _forceMarkerAndPopupUpdate(e) { for (const t of this._markers) e && !this.getRenderWorldCopies() && (t._lngLat = t._lngLat.wrap()), t._update(); for (const t of this._popups) !e || this.getRenderWorldCopies() || t._trackPointer || (t._lngLat = t._lngLat.wrap()), t._update(); } _updateAverageElevation(e, t = !1) { const i = e => (this.transform.averageElevation = e, this._update(!1), !0); if (!this.painter.averageElevationNeedsEasing()) return 0 !== this.transform.averageElevation && i(0); const o = this.transform.elevation && this.transform.elevation.exaggeration() !== this._averageElevationExaggeration; if (o || (t || e - this._averageElevationLastSampledAt > 500) && !this._averageElevation.isEasing(e)) { const t = this.transform.averageElevation; let r = this.transform.sampleAverageElevation(); this.transform.elevation && (this._averageElevationExaggeration = this.transform.elevation.exaggeration()), isNaN(r) ? r = 0 : this._averageElevationLastSampledAt = e; const s = Math.abs(t - r); if (s > 1) { if (this._isInitialLoad || o) return this._averageElevation.jumpTo(r), i(r); this._averageElevation.easeTo(r, e, 300); } else if (s > 1e-4) return this._averageElevation.jumpTo(r), i(r) } return !!this._averageElevation.isEasing(e) && i(this._averageElevation.getValue(e)) } _authenticate() { e.cW(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (t => { if (t && (t.message === e.cX || 401 === t.status)) { const t = this.painter.context.gl; e.cT(t, !1), this._logoControl instanceof As && this._logoControl._updateLogo(), t && t.clear(t.DEPTH_BUFFER_BIT | t.COLOR_BUFFER_BIT | t.STENCIL_BUFFER_BIT), this._silenceAuthErrors || this.fire(new e.a7(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/"))); } })), e.cY(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (() => { })); } _updateTerrain() { const e = this._isDragging(); this.painter.updateTerrain(this.style, e); } _calculateSpeedIndex() { const e = this.painter.canvasCopy(), t = this.painter.getCanvasCopiesAndTimestamps(); t.timeStamps.push(performance.now()); const i = this.painter.context.gl, o = i.createFramebuffer(); function r(e) { i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, e, 0); const t = new Uint8Array(i.drawingBufferWidth * i.drawingBufferHeight * 4); return i.readPixels(0, 0, i.drawingBufferWidth, i.drawingBufferHeight, i.RGBA, i.UNSIGNED_BYTE, t), t } return i.bindFramebuffer(i.FRAMEBUFFER, o), this._canvasPixelComparison(r(e), t.canvasCopies.map(r), t.timeStamps) } _canvasPixelComparison(e, t, i) { let o = i[1] - i[0]; const r = e.length / 4; for (let s = 0; s < t.length; s++) { const n = t[s]; let a = 0; for (let t = 0; t < n.length; t += 4)n[t] === e[t] && n[t + 1] === e[t + 1] && n[t + 2] === e[t + 2] && n[t + 3] === e[t + 3] && (a += 1); o += (i[s + 2] - i[s + 1]) * (1 - a / r); } return o } remove() { this._hash && this._hash.remove(); for (const e of this._controls) e.onRemove(this); this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this._domRenderTaskQueue.clear(), this.style && this.style.destroy(), this.painter.destroy(), this.handlers && this.handlers.destroy(), this.handlers = void 0, this.setStyle(null), window.removeEventListener("resize", this._onWindowResize, !1), window.removeEventListener("orientationchange", this._onWindowResize, !1), window.removeEventListener(this._fullscreenchangeEvent, this._onWindowResize, !1), window.removeEventListener("online", this._onWindowOnline, !1), window.removeEventListener("visibilitychange", this._onVisibilityChange, !1); const t = this.painter.context.gl.getExtension("WEBGL_lose_context"); t && t.loseContext(), this._canvas.removeEventListener("webglcontextlost", this._contextLost, !1), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, !1), this._canvasContainer.remove(), this._controlContainer.remove(), this._missingCSSCanary.remove(), this._canvas = void 0, this._canvasContainer = void 0, this._controlContainer = void 0, this._missingCSSCanary = void 0, this._container.classList.remove("mapboxgl-map"), this._container.removeEventListener("scroll", this._onMapScroll, !1), e.cZ(this.painter.context.gl), this._removed = !0, this.fire(new e.a8("remove")); } triggerRepaint() { this._triggerFrame(!0); } _triggerFrame(t) { this._renderNextFrame = this._renderNextFrame || t, this.style && !this._frame && (this._frame = e.a4.frame((e => { const t = !!this._renderNextFrame; this._frame = null, this._renderNextFrame = null, t && this._render(e); }))); } _preloadTiles(t) { const i = this.style ? Object.values(this.style._sourceCaches) : []; return e.c_(i, ((e, i) => e._preloadTiles(t, i)), (() => { this.triggerRepaint(); })), this } _onWindowOnline() { this._update(); } _onWindowResize(e) { this._trackResize && this.resize({ originalEvent: e })._update(); } _onVisibilityChange() { "hidden" === document.visibilityState && this._visibilityHidden++; } get showTileBoundaries() { return !!this._showTileBoundaries } set showTileBoundaries(e) { this._showTileBoundaries !== e && (this._showTileBoundaries = e, this._update()); } get showTerrainWireframe() { return !!this._showTerrainWireframe } set showTerrainWireframe(e) { this._showTerrainWireframe !== e && (this._showTerrainWireframe = e, this._update()); } get showLayers2DWireframe() { return !!this._showLayers2DWireframe } set showLayers2DWireframe(e) { this._showLayers2DWireframe !== e && (this._showLayers2DWireframe = e, this._update()); } get showLayers3DWireframe() { return !!this._showLayers3DWireframe } set showLayers3DWireframe(e) { this._showLayers3DWireframe !== e && (this._showLayers3DWireframe = e, this._update()); } get speedIndexTiming() { return !!this._speedIndexTiming } set speedIndexTiming(e) { this._speedIndexTiming !== e && (this._speedIndexTiming = e, this._update()); } get showPadding() { return !!this._showPadding } set showPadding(e) { this._showPadding !== e && (this._showPadding = e, this._update()); } get showCollisionBoxes() { return !!this._showCollisionBoxes } set showCollisionBoxes(e) { this._showCollisionBoxes !== e && (this._showCollisionBoxes = e, e ? this.style._generateCollisionBoxes() : this._update()); } get showOverdrawInspector() { return !!this._showOverdrawInspector } set showOverdrawInspector(e) { this._showOverdrawInspector !== e && (this._showOverdrawInspector = e, this._update()); } get repaint() { return !!this._repaint } set repaint(e) { this._repaint !== e && (this._repaint = e, this.triggerRepaint()); } get vertices() { return !!this._vertices } set vertices(e) { this._vertices = e, this._update(); } get showTileAABBs() { return !!this._showTileAABBs } set showTileAABBs(e) { this._showTileAABBs !== e && (this._showTileAABBs = e, e && this._update()); } _setCacheLimits(t, i) { e.d0(t, i); } get version() { return e.c$ } }, NavigationControl: class { constructor(t) { this.options = e.ak({}, Zs, t), this._container = s("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.addEventListener("contextmenu", (e => e.preventDefault())), this.options.showZoom && (e.aR(["_setButtonTitle", "_updateZoomButtons"], this), this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", (e => { this._map && this._map.zoomIn({}, { originalEvent: e }); })), s("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", (e => { this._map && this._map.zoomOut({}, { originalEvent: e }); })), s("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (e.aR(["_rotateCompassArrow"], this), this._compass = this._createButton("mapboxgl-ctrl-compass", (e => { const t = this._map; t && (this.options.visualizePitch ? t.resetNorthPitch({}, { originalEvent: e }) : t.resetNorth({}, { originalEvent: e })); })), this._compassIcon = s("span", "mapboxgl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true")); } _updateZoomButtons() { const e = this._map; if (!e) return; const t = e.getZoom(), i = t === e.getMaxZoom(), o = t === e.getMinZoom(); this._zoomInButton.disabled = i, this._zoomOutButton.disabled = o, this._zoomInButton.setAttribute("aria-disabled", i.toString()), this._zoomOutButton.setAttribute("aria-disabled", o.toString()); } _rotateCompassArrow() { const e = this._map; if (!e) return; const t = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(e.transform.pitch * (Math.PI / 180)), .5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle * (180 / Math.PI)}deg)` : `rotate(${e.transform.angle * (180 / Math.PI)}deg)`; e._requestDomTask((() => { this._compassIcon && (this._compassIcon.style.transform = t); })); } onAdd(e) { return this._map = e, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), e.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && e.on("pitch", this._rotateCompassArrow), e.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new Ws(e, this._compass, this.options.visualizePitch)), this._container } onRemove() { const e = this._map; e && (this._container.remove(), this.options.showZoom && e.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && e.off("pitch", this._rotateCompassArrow), e.off("rotate", this._rotateCompassArrow), this._handler && this._handler.off(), this._handler = void 0), this._map = void 0); } _createButton(e, t) { const i = s("button", e, this._container); return i.type = "button", i.addEventListener("click", t), i } _setButtonTitle(e, t) { if (!this._map) return; const i = this._map._getUIString(`NavigationControl.${t}`); e.setAttribute("aria-label", i), e.firstElementChild && e.firstElementChild.setAttribute("title", i); } }, GeolocateControl: class extends e.a6 { constructor(t) { super(); const i = navigator.geolocation; this.options = e.ak({ geolocation: i }, Hs, t), e.aR(["_onSuccess", "_onError", "_onZoom", "_finish", "_setupUI", "_updateCamera", "_updateMarker", "_updateMarkerRotation", "_onDeviceOrientation"], this), this._updateMarkerRotationThrottled = Ar(this._updateMarkerRotation, 20), this._numberOfWatches = 0; } onAdd(e) { return this._map = e, this._container = s("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkGeolocationSupport(this._setupUI), this._container } onRemove() { void 0 !== this._geolocationWatchID && (this.options.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), this._container.remove(), this._map.off("zoom", this._onZoom), this._map = void 0, this._numberOfWatches = 0, this._noTimeout = !1; } _checkGeolocationSupport(e) { const t = (t = !!this.options.geolocation) => { this._supportsGeolocation = t, e(t); }; void 0 !== this._supportsGeolocation ? e(this._supportsGeolocation) : void 0 !== navigator.permissions ? navigator.permissions.query({ name: "geolocation" }).then((e => t("denied" !== e.state))).catch((() => t())) : t(); } _isOutOfMapMaxBounds(e) { const t = this._map.getMaxBounds(), i = e.coords; return !!t && (i.longitude < t.getWest() || i.longitude > t.getEast() || i.latitude < t.getSouth() || i.latitude > t.getNorth()) } _setErrorState() { switch (this._watchState) { case "WAITING_ACTIVE": this._watchState = "ACTIVE_E
41RROR", 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(t) { if (this._map) { if (this._isOutOfMapMaxBounds(t)) return this._setErrorState(), this.fire(new e.a8("outofmaxbounds", t)), this._updateMarker(), void this._finish(); if (this.options.trackUserLocation) switch (this._lastKnownPosition = t, 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(t), this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(t), this.options.showUserLocation && this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"), this.fire(new e.a8("geolocate", t)), this._finish(); } } _updateCamera(t) { const i = new e.L(t.coords.longitude, t.coords.latitude), o = t.coords.accuracy, r = this._map.getBearing(), s = e.ak({ bearing: r }, this.options.fitBoundsOptions); this._map.fitBounds(i.toBounds(o), s, { geolocateSource: !0 }); } _updateMarker(t) { if (t) { const i = new e.L(t.coords.longitude, t.coords.latitude); this._accuracyCircleMarker.setLngLat(i).addTo(this._map), this._userLocationDotMarker.setLngLat(i).addTo(this._map), this._accuracy = t.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove(); } _updateCircleRadius() { const t = this._map.transform, i = e.b(1, t._center.lat) * t.worldSize, o = Math.ceil(2 * this._accuracy * i); this._circleElement.style.width = `${o}px`, this._circleElement.style.height = `${o}px`; } _onZoom() { this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); } _updateMarkerRotation() { this._userLocationDotMarker && "number" == typeof this._heading ? (this._userLocationDotMarker.setRotation(this._heading), this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")) : (this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"), this._userLocationDotMarker.setRotation(0)); } _onError(t) { if (this._map) { if (this.options.trackUserLocation) if (1 === t.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 e = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.setAttribute("aria-label", e), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e), void 0 !== this._geolocationWatchID && this._clearWatch(); } else { if (3 === t.code && this._noTimeout) return; this._setErrorState(); } "OFF" !== this._watchState && this.options.showUserLocation && this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"), this.fire(new e.a8("error", t)), this._finish(); } } _finish() { this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0; } _setupUI(t) { if (void 0 !== this._map) { if (this._container.addEventListener("contextmenu", (e => e.preventDefault())), this._geolocateButton = s("button", "mapboxgl-ctrl-geolocate", this._container), s("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", !1 === t) { e.X("Geolocation support is not available so the GeolocateControl will be disabled."); const t = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.disabled = !0, this._geolocateButton.setAttribute("aria-label", t), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", t); } else { const e = this._map._getUIString("GeolocateControl.FindMyLocation"); this._geolocateButton.setAttribute("aria-label", e), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e); } this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = s("div", "mapboxgl-user-location"), this._dotElement.appendChild(s("div", "mapboxgl-user-location-dot")), this._dotElement.appendChild(s("div", "mapboxgl-user-location-heading")), this._userLocationDotMarker = new Fs({ element: this._dotElement, rotationAlignment: "map", pitchAlignment: "map" }), this._circleElement = s("div", "mapboxgl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Fs({ 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", (t => { t.geolocateSource || "ACTIVE_LOCK" !== this._watchState || t.originalEvent && "resize" === t.originalEvent.type || (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this.fire(new e.a8("trackuserlocationend"))); })); } } _onDeviceOrientation(e) { this._userLocationDotMarker && (e.webkitCompassHeading ? this._heading = e.webkitCompassHeading : !0 === e.absolute && (this._heading = -1 * e.alpha), this._updateMarkerRotationThrottled()); } trigger() { if (!this._setup) return e.X("Geolocate control triggered before added to a map"), !1; if (this.options.trackUserLocation) { switch (this._watchState) { case "OFF": this._watchState = "WAITING_ACTIVE", this.fire(new e.a8("trackuserlocationstart")); break;
41 case "WAITING_ACTIVE": case "ACTIVE_LOCK": case "ACTIVE_ERROR": case "BACKGROUND_ERROR": this._numberOfWatches--, this._noTimeout = !1, this._watchState = "OFF", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this.fire(new e.a8("trackuserlocationend")); break; case "BACKGROUND": this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new e.a8("trackuserlocationstart")); }switch (this._watchState) { case "WAITING_ACTIVE": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"); break; case "ACTIVE_LOCK": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"); break; case "ACTIVE_ERROR": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"); break; case "BACKGROUND": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"); break; case "BACKGROUND_ERROR": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"); }if ("OFF" === this._watchState && void 0 !== this._geolocationWatchID) this._clearWatch(); else if (void 0 === this._geolocationWatchID) { let e; this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), this._numberOfWatches++, this._numberOfWatches > 1 ? (e = { maximumAge: 6e5, timeout: 0 }, this._noTimeout = !0) : (e = this.options.positionOptions, this._noTimeout = !1), this._geolocationWatchID = this.options.geolocation.watchPosition(this._onSuccess, this._onError, e), this.options.showUserHeading && this._addDeviceOrientationListener(); } } else this.options.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4); return !0 } _addDeviceOrientationListener() { const e = () => { "ondeviceorientationabsolute" in window ? window.addEventListener("deviceorientationabsolute", this._onDeviceOrientation) : window.addEventListener("deviceorientation", this._onDeviceOrientation); }; "undefined" != typeof DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceOrientationEvent.requestPermission().then((t => { "granted" === t && e(); })).catch(console.error) : e(); } _clearWatch() { this.options.geolocation.clearWatch(this._geolocationWatchID), window.removeEventListener("deviceorientation", this._onDeviceOrientation), window.removeEventListener("deviceorientationabsolute", this._onDeviceOrientation), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null); } }, AttributionControl: Ds, ScaleControl: class { constructor(t) { this.options = e.ak({}, qs, t), this._isNumberFormatSupported = function () { try { return new Intl.NumberFormat("en", { style: "unit", unitDisplay: "short", unit: "meter" }), !0 } catch (e) { return !1 } }(), e.aR(["_update", "_setScale", "setUnit"], this); } getDefaultPosition() { return "bottom-left" } _update() { const e = this.options.maxWidth || 100, t = this._map, i = t._containerHeight / 2, o = t._containerWidth / 2 - e / 2, r = t.unproject([o, i]), s = t.unproject([o + e, i]), n = r.distanceTo(s); if ("imperial" === this.options.unit) { const t = 3.2808 * n; t > 5280 ? this._setScale(e, t / 5280, "mile") : this._setScale(e, t, "foot"); } else "nautical" === this.options.unit ? this._setScale(e, n / 1852, "nautical-mile") : n >
vendor: 7,571 bytes, line 41
41= 1e3 ? this._setScale(e, n / 1e3, "kilometer") : this._setScale(e, n, "meter"); } _setScale(e, t, i) { this._map._requestDomTask((() => { const o = function (e) { const t = Math.pow(10, `${Math.floor(e)}`.length - 1); let i = e / t; return i = i >= 10 ? 10 : i >= 5 ? 5 : i >= 3 ? 3 : i >= 2 ? 2 : i >= 1 ? 1 : function (e) { const t = Math.pow(10, Math.ceil(-Math.log(e) / Math.LN10)); return Math.round(e * t) / t }(i), t * i }(t), r = o / t; this._container.innerHTML = this._isNumberFormatSupported && "nautical-mile" !== i ? new Intl.NumberFormat(this._language, { style: "unit", unitDisplay: "short", unit: i }).format(o) : `${o}&nbsp;${$s[i]}`, this._container.style.width = e * r + "px"; })); } onAdd(e) { return this._map = e, this._language = e.getLanguage(), this._container = s("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", e.getContainer()), this._container.dir = "auto", this._map.on("move", this._update), this._update(), this._container } onRemove() { this._container.remove(), this._map.off("move", this._update), this._map = void 0; } _setLanguage(e) { this._language = e, this._update(); } setUnit(e) { this.options.unit = e, this._update(); } }, FullscreenControl: class { constructor(t) { this._fullscreen = !1, t && t.container && (t.container instanceof HTMLElement ? this._container = t.container : e.X("Full screen control 'container' must be a DOM element.")), e.aR(["_onClickFullscreen", "_changeIcon"], this), "onfullscreenchange" in document ? this._fullscreenchange = "fullscreenchange" : "onwebkitfullscreenchange" in document && (this._fullscreenchange = "webkitfullscreenchange"); } onAdd(t) { return this._map = t, this._container || (this._container = this._map.getContainer()), this._controlContainer = s("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none", e.X("This device does not support fullscreen mode.")), this._controlContainer } onRemove() { this._controlContainer.remove(), this._map = null, document.removeEventListener(this._fullscreenchange, this._changeIcon); } _checkFullscreenSupport() { return !(!document.fullscreenEnabled && !document.webkitFullscreenEnabled) } _setupUI() { const e = this._fullscreenButton = s("button", "mapboxgl-ctrl-fullscreen", this._controlContainer); s("span", "mapboxgl-ctrl-icon", e).setAttribute("aria-hidden", "true"), e.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), document.addEventListener(this._fullscreenchange, this._changeIcon); } _updateTitle() { const e = this._getTitle(); this._fullscreenButton.setAttribute("aria-label", e), this._fullscreenButton.firstElementChild && this._fullscreenButton.firstElementChild.setAttribute("title", e); } _getTitle() { return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter") } _isFullscreen() { return this._fullscreen } _changeIcon() { (document.fullscreenElement || document.webkitFullscreenElement) === this._container !== this._fullscreen && (this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"), this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"), this._updateTitle()); } _onClickFullscreen() { this._isFullscreen() ? document.exitFullscreen ? document.exitFullscreen() : document.webkitCancelFullScreen && document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen(); } }, Popup: class extends e.a6 { constructor(t) { super(), this.options = e.ak(Object.create(Bs), t), e.aR(["_update", "_onClose", "remove", "_onMouseEvent"], this), this._classList = new Set(t && t.className ? t.className.trim().split(/\s+/) : []); } addTo(t) { return this._map && this.remove(), this._map = t, this.options.closeOnClick && t.on("preclick", this._onClose), this.options.closeOnMove && t.on("move", this._onClose), t.on("remove", this.remove), this._update(), t._addPopup(this), this._focusFirstElement(), this._trackPointer ? (t.on("mousemove", this._onMouseEvent), t.on("mouseup", this._onMouseEvent), t._canvasContainer.classList.add("mapboxgl-track-pointer")) : t.on("move", this._update), this.fire(new e.a8("open")), this } isOpen() { return !!this._map } remove() { this._content && this._content.remove(), this._container && (this._container.remove(), this._container = void 0); const t = this._map; return t && (t.off("move", this._update), t.off("move", this._onClose), t.off("preclick", this._onClose), t.off("click", this._onClose), t.off("remove", this.remove), t.off("mousemove", this._onMouseEvent), t.off("mouseup", this._onMouseEvent), t.off("drag", this._onMouseEvent), t._canvasContainer && t._canvasContainer.classList.remove("mapboxgl-track-pointer"), t._removePopup(this), this._map = void 0), this.fire(new e.a8("close")), this } getLngLat() { return this._lngLat } setLngLat(t) { this._lngLat = e.L.convert(t), 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 e = this._map; return e && (e.off("move", this._update), e.on("mousemove", this._onMouseEvent), e.on("drag", this._onMouseEvent), e._canvasContainer.classList.add("mapboxgl-track-pointer")), this } getElement() { return this._container } setText(e) { return this.setDOMContent(document.createTextNode(e)) } setHTML(e) { const t = document.createDocumentFragment(), i = document.createElement("body"); let o; for (i.innerHTML = e; o = i.firstChild, o;)t.appendChild(o); return this.setDOMContent(t) } getMaxWidth() { return this._container && this._container.style.maxWidth } setMaxWidth(e) { return this.options.maxWidth = e, this._update(), this } setDOMContent(e) { let t = this._content; if (t) for (; t.hasChildNodes();)t.firstChild && t.removeChild(t.firstChild); else t = this._content = s("div", "mapboxgl-popup-content", this._container || void 0); if (t.appendChild(e), this.options.closeButton) { const e = this._closeButton = s("button", "mapboxgl-popup-close-button", t); e.type = "button", e.setAttribute("aria-label", "Close popup"), e.setAttribute("aria-hidden", "true"), e.innerHTML = "&#215;", e.addEventListener("click", this._onClose); } return this._update(), this._focusFirstElement(), this } addClassName(e) { return this._classList.add(e), this._updateClassList(), this } removeClassName(e) { return this._classList.delete(e), this._updateClassList(), this } setOffset(e) { return this.options.offset = e, this._update(), this } toggleClassName(e) { let t; return this._classList.delete(e) ? t = !1 : (this._classList.add(e), t = !0), this._updateClassList(), t } _onMouseEvent(e) { this._update(e.point); } _getAnchor(e) { if (this.options.anchor) return this.options.anchor; const t = this._map, i = this._container, o = this._pos; if (!t || !i || !o) return "bottom"; const r = i.offsetWidth, s = i.offsetHeight, n = o.x < r / 2, a = o.x > t.transform.width - r / 2; if (o.y + e < s) return n ? "top-left" : a ? "top-right" : "top"; if (o.y > t.transform.height - s) { if (n) return "bottom-left"; if (a) return "bottom-right" } return n ? "left" : a ? "right" : "bottom" } _updateClassList() { const e = this._container; if (!e) return; const t = [...this._classList];
41 t.push("mapboxgl-popup"), this._anchor && t.push(`mapboxgl-popup-anchor-${this._anchor}`), this._trackPointer && t.push("mapboxgl-popup-track-pointer"), e.className = t.join(" "); } _update(t) { const i = this._map, o = this._content; if (!i || !this._lngLat && !this._trackPointer || !o) return; let r = this._container; if (r || (r = this._container = s("div", "mapboxgl-popup", i.getContainer()), this._tip = s("div", "mapboxgl-popup-tip", r), r.appendChild(o)), this.options.maxWidth && r.style.maxWidth !== this.options.maxWidth && (r.style.maxWidth = this.options.maxWidth), i.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = zs(this._lngLat, this._pos, i.transform)), !this._trackPointer || t) { const e = this._pos = this._trackPointer && t ? t : i.project(this._lngLat), o = Ns(this.options.offset), r = this._anchor = this._getAnchor(o.y), s = Ns(this.options.offset, r), n = e.add(s).round(); i._requestDomTask((() => { this._container && r && (this._container.style.transform = `${Os[r]} translate(${n.x}px,${n.y}px)`); })); } if (!this._marker && i._showingGlobe()) { const t = e.cN(i.transform, this._lngLat) ? 0 : 1; this._setOpacity(t); } this._updateClassList(); } _focusFirstElement() { if (!this.options.focusAfterOpen || !this._container) return; const e = this._container.querySelector(ks); e && e.focus(); } _onClose() { this.remove(); } _setOpacity(e) { this._container && (this._container.style.opacity = `${e}`), this._content && (this._content.style.pointerEvents = e ? "auto" : "none"); } }, Marker: Fs, Style: Dr, LngLat: e.L, LngLatBounds: e.D, Point: e.P, MercatorCoordinate: e.M, FreeCameraOptions: he, Evented: e.a6, config: e.cM, prewarm: e.d3, clearPrewarmedResources: e.d4, get accessToken() { return e.cM.ACCESS_TOKEN }, set accessToken(t) { e.cM.ACCESS_TOKEN = t; }, get baseApiUrl() { return e.cM.API_URL }, set baseApiUrl(t) { e.cM.API_URL = t; }, get workerCount() { return e.d5.workerCount }, set workerCount(t) { e.d5.workerCount = t; }, get maxParallelImageRequests() { return e.cM.MAX_PARALLEL_IMAGE_REQUESTS }, set maxParallelImageRequests(t) { e.cM.MAX_PARALLEL_IMAGE_REQUESTS = t; }, clearStorage(t) { e.d6(t); }, get workerUrl() { return e.d7.workerUrl }, set workerUrl(t) { e.d7.workerUrl = t; }, get workerClass() { return e.d7.workerClass }, set workerClass(t) { e.d7.workerClass = t; }, get workerParams() { return e.d7.workerParams }, set workerParams(t) { e.d7.workerParams = t; }, get dracoUrl() { return e.d8() }, set dracoUrl(t) { e.d9(t); }, setNow: e.a4.setNow, restoreNow: e.a4.restoreNow }; return Xs }));
42
43    //
44    // Our custom intro provides a specialized "define()" function, called by the
45    // AMD modules below, that sets up the worker blob URL and then executes the
46    // main module, storing its exported value as 'mapboxgl'
47
48
49    var mapboxgl$1 = mapboxgl;
50
51    return mapboxgl$1;
52
53}));
54//# sourceMappingURL=mapbox-gl.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.