All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 17s
- Add "Définir le cadrage" button in multi mode to save current map center and zoom as default framing - Add getCurrentZoom() method in MapPreview to retrieve current zoom level - Fix: prevent automatic save on initial load with isInitialLoad flag to avoid marking page as modified when loading existing data - Style: dark button theme for save framing button Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
20235 lines
1.2 MiB
20235 lines
1.2 MiB
(function() {
|
||
"use strict";
|
||
function getDefaultExportFromCjs(x) {
|
||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
||
}
|
||
var maplibreGl$1 = { exports: {} };
|
||
var maplibreGl = maplibreGl$1.exports;
|
||
var hasRequiredMaplibreGl;
|
||
function requireMaplibreGl() {
|
||
if (hasRequiredMaplibreGl) return maplibreGl$1.exports;
|
||
hasRequiredMaplibreGl = 1;
|
||
(function(module, exports$1) {
|
||
(function(global, factory) {
|
||
module.exports = factory();
|
||
})(maplibreGl, (function() {
|
||
var shared, worker, maplibregl2;
|
||
function define(_, chunk) {
|
||
if (!shared) {
|
||
shared = chunk;
|
||
} else if (!worker) {
|
||
worker = chunk;
|
||
} else {
|
||
var workerBundleString = "var sharedChunk = {}; (" + shared + ")(sharedChunk); (" + worker + ")(sharedChunk);";
|
||
var sharedChunk = {};
|
||
shared(sharedChunk);
|
||
maplibregl2 = chunk(sharedChunk);
|
||
if (typeof window !== "undefined") {
|
||
maplibregl2.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: "text/javascript" }));
|
||
}
|
||
}
|
||
}
|
||
define(["exports"], (function(t) {
|
||
function e(t2, e2, r2, n2) {
|
||
return new (r2 || (r2 = Promise))((function(i3, a2) {
|
||
function s2(t3) {
|
||
try {
|
||
l2(n2.next(t3));
|
||
} catch (t4) {
|
||
a2(t4);
|
||
}
|
||
}
|
||
function o2(t3) {
|
||
try {
|
||
l2(n2.throw(t3));
|
||
} catch (t4) {
|
||
a2(t4);
|
||
}
|
||
}
|
||
function l2(t3) {
|
||
var e3;
|
||
t3.done ? i3(t3.value) : (e3 = t3.value, e3 instanceof r2 ? e3 : new r2((function(t4) {
|
||
t4(e3);
|
||
}))).then(s2, o2);
|
||
}
|
||
l2((n2 = n2.apply(t2, e2 || [])).next());
|
||
}));
|
||
}
|
||
function r(t2) {
|
||
return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
|
||
}
|
||
"function" == typeof SuppressedError && SuppressedError;
|
||
var n = i2;
|
||
function i2(t2, e2) {
|
||
this.x = t2, this.y = e2;
|
||
}
|
||
i2.prototype = { clone: function() {
|
||
return new i2(this.x, this.y);
|
||
}, add: function(t2) {
|
||
return this.clone()._add(t2);
|
||
}, sub: function(t2) {
|
||
return this.clone()._sub(t2);
|
||
}, multByPoint: function(t2) {
|
||
return this.clone()._multByPoint(t2);
|
||
}, divByPoint: function(t2) {
|
||
return this.clone()._divByPoint(t2);
|
||
}, mult: function(t2) {
|
||
return this.clone()._mult(t2);
|
||
}, div: function(t2) {
|
||
return this.clone()._div(t2);
|
||
}, rotate: function(t2) {
|
||
return this.clone()._rotate(t2);
|
||
}, rotateAround: function(t2, e2) {
|
||
return this.clone()._rotateAround(t2, e2);
|
||
}, matMult: function(t2) {
|
||
return this.clone()._matMult(t2);
|
||
}, 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(t2) {
|
||
return this.x === t2.x && this.y === t2.y;
|
||
}, dist: function(t2) {
|
||
return Math.sqrt(this.distSqr(t2));
|
||
}, distSqr: function(t2) {
|
||
var e2 = t2.x - this.x, r2 = t2.y - this.y;
|
||
return e2 * e2 + r2 * r2;
|
||
}, angle: function() {
|
||
return Math.atan2(this.y, this.x);
|
||
}, angleTo: function(t2) {
|
||
return Math.atan2(this.y - t2.y, this.x - t2.x);
|
||
}, angleWith: function(t2) {
|
||
return this.angleWithSep(t2.x, t2.y);
|
||
}, angleWithSep: function(t2, e2) {
|
||
return Math.atan2(this.x * e2 - this.y * t2, this.x * t2 + this.y * e2);
|
||
}, _matMult: function(t2) {
|
||
var e2 = t2[2] * this.x + t2[3] * this.y;
|
||
return this.x = t2[0] * this.x + t2[1] * this.y, this.y = e2, this;
|
||
}, _add: function(t2) {
|
||
return this.x += t2.x, this.y += t2.y, this;
|
||
}, _sub: function(t2) {
|
||
return this.x -= t2.x, this.y -= t2.y, this;
|
||
}, _mult: function(t2) {
|
||
return this.x *= t2, this.y *= t2, this;
|
||
}, _div: function(t2) {
|
||
return this.x /= t2, this.y /= t2, this;
|
||
}, _multByPoint: function(t2) {
|
||
return this.x *= t2.x, this.y *= t2.y, this;
|
||
}, _divByPoint: function(t2) {
|
||
return this.x /= t2.x, this.y /= t2.y, this;
|
||
}, _unit: function() {
|
||
return this._div(this.mag()), this;
|
||
}, _perp: function() {
|
||
var t2 = this.y;
|
||
return this.y = this.x, this.x = -t2, this;
|
||
}, _rotate: function(t2) {
|
||
var e2 = Math.cos(t2), r2 = Math.sin(t2), n2 = r2 * this.x + e2 * this.y;
|
||
return this.x = e2 * this.x - r2 * this.y, this.y = n2, this;
|
||
}, _rotateAround: function(t2, e2) {
|
||
var r2 = Math.cos(t2), n2 = Math.sin(t2), i3 = e2.y + n2 * (this.x - e2.x) + r2 * (this.y - e2.y);
|
||
return this.x = e2.x + r2 * (this.x - e2.x) - n2 * (this.y - e2.y), this.y = i3, this;
|
||
}, _round: function() {
|
||
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
|
||
} }, i2.convert = function(t2) {
|
||
return t2 instanceof i2 ? t2 : Array.isArray(t2) ? new i2(t2[0], t2[1]) : t2;
|
||
};
|
||
var a = r(n), s = o;
|
||
function o(t2, e2, r2, n2) {
|
||
this.cx = 3 * t2, this.bx = 3 * (r2 - t2) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e2, this.by = 3 * (n2 - e2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t2, this.p1y = e2, this.p2x = r2, this.p2y = n2;
|
||
}
|
||
o.prototype = { sampleCurveX: function(t2) {
|
||
return ((this.ax * t2 + this.bx) * t2 + this.cx) * t2;
|
||
}, sampleCurveY: function(t2) {
|
||
return ((this.ay * t2 + this.by) * t2 + this.cy) * t2;
|
||
}, sampleCurveDerivativeX: function(t2) {
|
||
return (3 * this.ax * t2 + 2 * this.bx) * t2 + this.cx;
|
||
}, solveCurveX: function(t2, e2) {
|
||
if (void 0 === e2 && (e2 = 1e-6), t2 < 0) return 0;
|
||
if (t2 > 1) return 1;
|
||
for (var r2 = t2, n2 = 0; n2 < 8; n2++) {
|
||
var i3 = this.sampleCurveX(r2) - t2;
|
||
if (Math.abs(i3) < e2) return r2;
|
||
var a2 = this.sampleCurveDerivativeX(r2);
|
||
if (Math.abs(a2) < 1e-6) break;
|
||
r2 -= i3 / a2;
|
||
}
|
||
var s2 = 0, o2 = 1;
|
||
for (r2 = t2, n2 = 0; n2 < 20 && (i3 = this.sampleCurveX(r2), !(Math.abs(i3 - t2) < e2)); n2++) t2 > i3 ? s2 = r2 : o2 = r2, r2 = 0.5 * (o2 - s2) + s2;
|
||
return r2;
|
||
}, solve: function(t2, e2) {
|
||
return this.sampleCurveY(this.solveCurveX(t2, e2));
|
||
} };
|
||
var l = r(s);
|
||
let u, c;
|
||
function h() {
|
||
return null == u && (u = "undefined" != typeof OffscreenCanvas && new OffscreenCanvas(1, 1).getContext("2d") && "function" == typeof createImageBitmap), u;
|
||
}
|
||
function p() {
|
||
if (null == c && (c = false, h())) {
|
||
const t2 = 5, e2 = new OffscreenCanvas(t2, t2).getContext("2d", { willReadFrequently: true });
|
||
if (e2) {
|
||
for (let r3 = 0; r3 < t2 * t2; r3++) {
|
||
const n2 = 4 * r3;
|
||
e2.fillStyle = `rgb(${n2},${n2 + 1},${n2 + 2})`, e2.fillRect(r3 % t2, Math.floor(r3 / t2), 1, 1);
|
||
}
|
||
const r2 = e2.getImageData(0, 0, t2, t2).data;
|
||
for (let e3 = 0; e3 < t2 * t2 * 4; e3++) if (e3 % 4 != 3 && r2[e3] !== e3) {
|
||
c = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return c || false;
|
||
}
|
||
function f(t2, e2, r2, n2) {
|
||
const i3 = new l(t2, e2, r2, n2);
|
||
return function(t3) {
|
||
return i3.solve(t3);
|
||
};
|
||
}
|
||
const d = f(0.25, 0.1, 0.25, 1);
|
||
function y(t2, e2, r2) {
|
||
return Math.min(r2, Math.max(e2, t2));
|
||
}
|
||
function m(t2, e2, r2) {
|
||
const n2 = r2 - e2, i3 = ((t2 - e2) % n2 + n2) % n2 + e2;
|
||
return i3 === e2 ? r2 : i3;
|
||
}
|
||
function g(t2, ...e2) {
|
||
for (const r2 of e2) for (const e3 in r2) t2[e3] = r2[e3];
|
||
return t2;
|
||
}
|
||
let x = 1;
|
||
function v(t2, e2, r2) {
|
||
const n2 = {};
|
||
for (const i3 in t2) n2[i3] = e2.call(r2 || this, t2[i3], i3, t2);
|
||
return n2;
|
||
}
|
||
function b(t2, e2, r2) {
|
||
const n2 = {};
|
||
for (const i3 in t2) e2.call(r2 || this, t2[i3], i3, t2) && (n2[i3] = t2[i3]);
|
||
return n2;
|
||
}
|
||
function w(t2) {
|
||
return Array.isArray(t2) ? t2.map(w) : "object" == typeof t2 && t2 ? v(t2, w) : t2;
|
||
}
|
||
const _ = {};
|
||
function A(t2) {
|
||
_[t2] || ("undefined" != typeof console && console.warn(t2), _[t2] = true);
|
||
}
|
||
function S(t2, e2, r2) {
|
||
return (r2.y - t2.y) * (e2.x - t2.x) > (e2.y - t2.y) * (r2.x - t2.x);
|
||
}
|
||
function k(t2) {
|
||
let e2 = 0;
|
||
for (let r2, n2, i3 = 0, a2 = t2.length, s2 = a2 - 1; i3 < a2; s2 = i3++) r2 = t2[i3], n2 = t2[s2], e2 += (n2.x - r2.x) * (r2.y + n2.y);
|
||
return e2;
|
||
}
|
||
function I() {
|
||
return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope;
|
||
}
|
||
let z = null;
|
||
function M(t2) {
|
||
return "undefined" != typeof ImageBitmap && t2 instanceof ImageBitmap;
|
||
}
|
||
const C = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
|
||
function B(t2, r2, n2, i3, a2) {
|
||
return e(this, void 0, void 0, (function* () {
|
||
if ("undefined" == typeof VideoFrame) throw new Error("VideoFrame not supported");
|
||
const e2 = new VideoFrame(t2, { timestamp: 0 });
|
||
try {
|
||
const s2 = null == e2 ? void 0 : e2.format;
|
||
if (!s2 || !s2.startsWith("BGR") && !s2.startsWith("RGB")) throw new Error(`Unrecognized format ${s2}`);
|
||
const o2 = s2.startsWith("BGR"), l2 = new Uint8ClampedArray(i3 * a2 * 4);
|
||
if (yield e2.copyTo(l2, (function(t3, e3, r3, n3, i4) {
|
||
const a3 = 4 * Math.max(-e3, 0), s3 = (Math.max(0, r3) - r3) * n3 * 4 + a3, o3 = 4 * n3, l3 = Math.max(0, e3), u2 = Math.max(0, r3);
|
||
return { rect: { x: l3, y: u2, width: Math.min(t3.width, e3 + n3) - l3, height: Math.min(t3.height, r3 + i4) - u2 }, layout: [{ offset: s3, stride: o3 }] };
|
||
})(t2, r2, n2, i3, a2)), o2) for (let t3 = 0; t3 < l2.length; t3 += 4) {
|
||
const e3 = l2[t3];
|
||
l2[t3] = l2[t3 + 2], l2[t3 + 2] = e3;
|
||
}
|
||
return l2;
|
||
} finally {
|
||
e2.close();
|
||
}
|
||
}));
|
||
}
|
||
let P, V, E, F;
|
||
const T = { now: "undefined" != typeof performance && performance && performance.now ? performance.now.bind(performance) : Date.now.bind(Date), frame(t2) {
|
||
const e2 = requestAnimationFrame(t2);
|
||
return { cancel: () => cancelAnimationFrame(e2) };
|
||
}, getImageData(t2, e2 = 0) {
|
||
return this.getImageCanvasContext(t2).getImageData(-e2, -e2, t2.width + 2 * e2, t2.height + 2 * e2);
|
||
}, getImageCanvasContext(t2) {
|
||
const e2 = window.document.createElement("canvas"), r2 = e2.getContext("2d", { willReadFrequently: true });
|
||
if (!r2) throw new Error("failed to create canvas 2d context");
|
||
return e2.width = t2.width, e2.height = t2.height, r2.drawImage(t2, 0, 0, t2.width, t2.height), r2;
|
||
}, resolveURL: (t2) => (E || (E = document.createElement("a")), E.href = t2, E.href), hardwareConcurrency: "undefined" != typeof navigator && navigator.hardwareConcurrency || 4, get prefersReducedMotion() {
|
||
return !!matchMedia && (null == F && (F = matchMedia("(prefers-reduced-motion: reduce)")), F.matches);
|
||
} }, $ = { MAX_PARALLEL_IMAGE_REQUESTS: 16, MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: 8, MAX_TILE_CACHE_ZOOM_LEVELS: 5, REGISTERED_PROTOCOLS: {}, WORKER_URL: "" };
|
||
class L extends Error {
|
||
constructor(t2, e2, r2, n2) {
|
||
super(`AJAXError: ${e2} (${t2}): ${r2}`), this.status = t2, this.statusText = e2, this.url = r2, this.body = n2;
|
||
}
|
||
}
|
||
const D = I() ? () => self.worker && self.worker.referrer : () => ("blob:" === window.location.protocol ? window.parent : window).location.href, O = (t2) => $.REGISTERED_PROTOCOLS[t2.substring(0, t2.indexOf("://"))];
|
||
function U(t2, e2) {
|
||
const r2 = new AbortController(), n2 = new Request(t2.url, { method: t2.method || "GET", body: t2.body, credentials: t2.credentials, headers: t2.headers, cache: t2.cache, referrer: D(), signal: r2.signal });
|
||
let i3 = false, a2 = false;
|
||
"json" === t2.type && n2.headers.set("Accept", "application/json");
|
||
return a2 || fetch(n2).then(((r3) => r3.ok ? ((r4) => {
|
||
("arrayBuffer" === t2.type || "image" === t2.type ? r4.arrayBuffer() : "json" === t2.type ? r4.json() : r4.text()).then(((t3) => {
|
||
a2 || (i3 = true, e2(null, t3, r4.headers.get("Cache-Control"), r4.headers.get("Expires")));
|
||
})).catch(((t3) => {
|
||
a2 || e2(new Error(t3.message));
|
||
}));
|
||
})(r3) : r3.blob().then(((n3) => e2(new L(r3.status, r3.statusText, t2.url, n3)))))).catch(((t3) => {
|
||
20 !== t3.code && e2(new Error(t3.message));
|
||
})), { cancel: () => {
|
||
a2 = true, i3 || r2.abort();
|
||
} };
|
||
}
|
||
const R = function(t2, e2) {
|
||
if (/:\/\//.test(t2.url) && !/^https?:|^file:/.test(t2.url)) {
|
||
if (I() && self.worker && self.worker.actor) return self.worker.actor.send("getResource", t2, e2);
|
||
if (!I()) return (O(t2.url) || U)(t2, e2);
|
||
}
|
||
if (!(/^file:/.test(r2 = t2.url) || /^file:/.test(D()) && !/^\w+:/.test(r2))) {
|
||
if (fetch && Request && AbortController && Object.prototype.hasOwnProperty.call(Request.prototype, "signal")) return U(t2, e2);
|
||
if (I() && self.worker && self.worker.actor) return self.worker.actor.send("getResource", t2, e2, void 0, true);
|
||
}
|
||
var r2;
|
||
return (function(t3, e3) {
|
||
const r3 = new XMLHttpRequest();
|
||
r3.open(t3.method || "GET", t3.url, true), "arrayBuffer" !== t3.type && "image" !== t3.type || (r3.responseType = "arraybuffer");
|
||
for (const e4 in t3.headers) r3.setRequestHeader(e4, t3.headers[e4]);
|
||
return "json" === t3.type && (r3.responseType = "text", r3.setRequestHeader("Accept", "application/json")), r3.withCredentials = "include" === t3.credentials, r3.onerror = () => {
|
||
e3(new Error(r3.statusText));
|
||
}, r3.onload = () => {
|
||
if ((r3.status >= 200 && r3.status < 300 || 0 === r3.status) && null !== r3.response) {
|
||
let n2 = r3.response;
|
||
if ("json" === t3.type) try {
|
||
n2 = JSON.parse(r3.response);
|
||
} catch (t4) {
|
||
return e3(t4);
|
||
}
|
||
e3(null, n2, r3.getResponseHeader("Cache-Control"), r3.getResponseHeader("Expires"));
|
||
} else {
|
||
const n2 = new Blob([r3.response], { type: r3.getResponseHeader("Content-Type") });
|
||
e3(new L(r3.status, r3.statusText, t3.url, n2));
|
||
}
|
||
}, r3.send(t3.body), { cancel: () => r3.abort() };
|
||
})(t2, e2);
|
||
}, q = function(t2, e2) {
|
||
return R(g(t2, { type: "arrayBuffer" }), e2);
|
||
};
|
||
function j(t2) {
|
||
if (!t2 || t2.indexOf("://") <= 0 || 0 === t2.indexOf("data:image/") || 0 === t2.indexOf("blob:")) return true;
|
||
const e2 = new URL(t2), r2 = window.location;
|
||
return e2.protocol === r2.protocol && e2.host === r2.host;
|
||
}
|
||
function N(t2, e2, r2) {
|
||
r2[t2] && -1 !== r2[t2].indexOf(e2) || (r2[t2] = r2[t2] || [], r2[t2].push(e2));
|
||
}
|
||
function Z(t2, e2, r2) {
|
||
if (r2 && r2[t2]) {
|
||
const n2 = r2[t2].indexOf(e2);
|
||
-1 !== n2 && r2[t2].splice(n2, 1);
|
||
}
|
||
}
|
||
class K {
|
||
constructor(t2, e2 = {}) {
|
||
g(this, e2), this.type = t2;
|
||
}
|
||
}
|
||
class G extends K {
|
||
constructor(t2, e2 = {}) {
|
||
super("error", g({ error: t2 }, e2));
|
||
}
|
||
}
|
||
class J {
|
||
on(t2, e2) {
|
||
return this._listeners = this._listeners || {}, N(t2, e2, this._listeners), this;
|
||
}
|
||
off(t2, e2) {
|
||
return Z(t2, e2, this._listeners), Z(t2, e2, this._oneTimeListeners), this;
|
||
}
|
||
once(t2, e2) {
|
||
return e2 ? (this._oneTimeListeners = this._oneTimeListeners || {}, N(t2, e2, this._oneTimeListeners), this) : new Promise(((e3) => this.once(t2, e3)));
|
||
}
|
||
fire(t2, e2) {
|
||
"string" == typeof t2 && (t2 = new K(t2, e2 || {}));
|
||
const r2 = t2.type;
|
||
if (this.listens(r2)) {
|
||
t2.target = this;
|
||
const e3 = this._listeners && this._listeners[r2] ? this._listeners[r2].slice() : [];
|
||
for (const r3 of e3) r3.call(this, t2);
|
||
const n2 = this._oneTimeListeners && this._oneTimeListeners[r2] ? this._oneTimeListeners[r2].slice() : [];
|
||
for (const e4 of n2) Z(r2, e4, this._oneTimeListeners), e4.call(this, t2);
|
||
const i3 = this._eventedParent;
|
||
i3 && (g(t2, "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData), i3.fire(t2));
|
||
} else t2 instanceof G && console.error(t2.error);
|
||
return this;
|
||
}
|
||
listens(t2) {
|
||
return this._listeners && this._listeners[t2] && this._listeners[t2].length > 0 || this._oneTimeListeners && this._oneTimeListeners[t2] && this._oneTimeListeners[t2].length > 0 || this._eventedParent && this._eventedParent.listens(t2);
|
||
}
|
||
setEventedParent(t2, e2) {
|
||
return this._eventedParent = t2, this._eventedParentData = e2, this;
|
||
}
|
||
}
|
||
var X = { $version: 8, $root: { version: { required: true, type: "enum", values: [8] }, name: { type: "string" }, metadata: { type: "*" }, center: { type: "array", value: "number" }, zoom: { type: "number" }, bearing: { type: "number", default: 0, period: 360, units: "degrees" }, pitch: { type: "number", default: 0, units: "degrees" }, light: { type: "light" }, terrain: { type: "terrain" }, sources: { required: true, type: "sources" }, sprite: { type: "sprite" }, glyphs: { type: "string" }, transition: { type: "transition" }, layers: { required: true, type: "array", value: "layer" } }, sources: { "*": { type: "source" } }, source: ["source_vector", "source_raster", "source_raster_dem", "source_geojson", "source_video", "source_image"], source_vector: { type: { required: true, type: "enum", values: { vector: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, attribution: { type: "string" }, promoteId: { type: "promoteId" }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_raster: { type: { required: true, type: "enum", values: { raster: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, attribution: { type: "string" }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_raster_dem: { type: { required: true, type: "enum", values: { "raster-dem": {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, attribution: { type: "string" }, encoding: { type: "enum", values: { terrarium: {}, mapbox: {}, custom: {} }, default: "mapbox" }, redFactor: { type: "number", default: 1 }, blueFactor: { type: "number", default: 1 }, greenFactor: { type: "number", default: 1 }, baseShift: { type: "number", default: 0 }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_geojson: { type: { required: true, type: "enum", values: { geojson: {} } }, data: { required: true, type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, filter: { type: "*" }, tolerance: { type: "number", default: 0.375 }, cluster: { type: "boolean", default: false }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterMinPoints: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: false }, generateId: { type: "boolean", default: false }, promoteId: { type: "promoteId" } }, source_video: { type: { required: true, type: "enum", values: { video: {} } }, urls: { required: true, type: "array", value: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: true, type: "enum", values: { image: {} } }, url: { required: true, type: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: true }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, background: {} }, required: true }, metadata: { type: "*" }, source: { type: "string" }, "source-layer": { type: "string" }, minzoom: { type: "number", minimum: 0, maximum: 24 }, maxzoom: { type: "number", minimum: 0, maximum: 24 }, filter: { type: "filter" }, layout: { type: "layout" }, paint: { type: "paint" } }, layout: ["layout_fill", "layout_line", "layout_circle", "layout_heatmap", "layout_fill-extrusion", "layout_symbol", "layout_raster", "layout_hillshade", "layout_background"], layout_background: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_fill: { "fill-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_circle: { "circle-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_heatmap: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, "layout_fill-extrusion": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_line: { "line-cap": { type: "enum", values: { butt: {}, round: {}, square: {} }, default: "butt", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_symbol: { "symbol-placement": { type: "enum", values: { point: {}, line: {}, "line-center": {} }, default: "point", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: false, requires: ["icon-image", { "!": "icon-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: false, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: false, requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-size": { type: "number", default: 1, minimum: 0, units: "factor of the original icon size", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-text-fit": { type: "enum", values: { none: {}, width: {}, height: {}, both: {} }, default: "none", requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-text-fit-padding": { type: "array", value: "number", length: 4, default: [0, 0, 0, 0], units: "pixels", requires: ["icon-image", "text-field", { "icon-text-fit": ["both", "width", "height"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "padding", default: [2], units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-keep-upright": { type: "boolean", default: false, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, "viewport-glyph": {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"], requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-radial-offset": { type: "number", units: "ems", default: 0, requires: ["text-field"], "property-type": "data-driven", expression: { interpolated: true, parameters: ["zoom", "feature"] } }, "text-variable-anchor": { type: "array", value: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-variable-anchor-offset": { type: "variableAnchorOffsetCollection", requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["text-field", { "!": "text-variable-anchor" }], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-angle": { type: "number", default: 45, units: "degrees", requires: ["text-field", { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: true, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-offset": { type: "array", value: "number", units: "ems", length: 2, default: [0, 0], requires: ["text-field", { "!": "text-radial-offset" }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: false, requires: ["text-field", { "!": "text-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: false, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: false, requires: ["text-field", "icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_raster: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_hillshade: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, filter: { type: "array", value: "*" }, filter_operator: { type: "enum", values: { "==": {}, "!=": {}, ">": {}, ">=": {}, "<": {}, "<=": {}, in: {}, "!in": {}, all: {}, any: {}, none: {}, has: {}, "!has": {}, within: {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: false } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "*", minimum: 1 }, light: { anchor: { type: "enum", default: "viewport", values: { map: {}, viewport: {} }, "property-type": "data-constant", transition: false, expression: { interpolated: false, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: true, expression: { interpolated: true, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, intensity: { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true } }, terrain: { source: { type: "string", required: true }, exaggeration: { type: "number", minimum: 0, default: 1 } }, paint: ["paint_fill", "paint_line", "paint_circle", "paint_heatmap", "paint_fill-extrusion", "paint_symbol", "paint_raster", "paint_hillshade", "paint_background"], paint_fill: { "fill-antialias": { type: "boolean", default: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: true, requires: [{ "!": "fill-pattern" }, { "fill-antialias": true }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, requires: ["fill-extrusion-height"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: true, transition: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "line-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: true, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "cross-faded" }, "line-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: false, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: true } }], expression: { interpolated: true, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: false, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "heatmap-color": { type: "color", default: ["interpolate", ["linear"], ["heatmap-density"], 0, "rgba(0, 0, 255, 0)", 0.1, "royalblue", 0.3, "cyan", 0.5, "lime", 0.7, "yellow", 1, "red"], transition: false, expression: { interpolated: true, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: true, overridable: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: true, units: "degrees", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: false, units: "milliseconds", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "number", default: 335, minimum: 0, maximum: 359, transition: false, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: 0.5, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "color", default: "#FFFFFF", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "background-pattern" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, transition: { duration: { type: "number", default: 300, minimum: 0, units: "milliseconds" }, delay: { type: "number", default: 0, minimum: 0, units: "milliseconds" } }, "property-type": { "data-driven": { type: "property-type" }, "cross-faded": { type: "property-type" }, "cross-faded-data-driven": { type: "property-type" }, "color-ramp": { type: "property-type" }, "data-constant": { type: "property-type" }, constant: { type: "property-type" } }, promoteId: { "*": { type: "string" } } };
|
||
const Y = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
|
||
function H(t2, e2) {
|
||
const r2 = {};
|
||
for (const e3 in t2) "ref" !== e3 && (r2[e3] = t2[e3]);
|
||
return Y.forEach(((t3) => {
|
||
t3 in e2 && (r2[t3] = e2[t3]);
|
||
})), r2;
|
||
}
|
||
function W(t2, e2) {
|
||
if (Array.isArray(t2)) {
|
||
if (!Array.isArray(e2) || t2.length !== e2.length) return false;
|
||
for (let r2 = 0; r2 < t2.length; r2++) if (!W(t2[r2], e2[r2])) return false;
|
||
return true;
|
||
}
|
||
if ("object" == typeof t2 && null !== t2 && null !== e2) {
|
||
if ("object" != typeof e2) return false;
|
||
if (Object.keys(t2).length !== Object.keys(e2).length) return false;
|
||
for (const r2 in t2) if (!W(t2[r2], e2[r2])) return false;
|
||
return true;
|
||
}
|
||
return t2 === e2;
|
||
}
|
||
const Q = { setStyle: "setStyle", addLayer: "addLayer", removeLayer: "removeLayer", setPaintProperty: "setPaintProperty", setLayoutProperty: "setLayoutProperty", setFilter: "setFilter", addSource: "addSource", removeSource: "removeSource", setGeoJSONSourceData: "setGeoJSONSourceData", setLayerZoomRange: "setLayerZoomRange", setLayerProperty: "setLayerProperty", setCenter: "setCenter", setZoom: "setZoom", setBearing: "setBearing", setPitch: "setPitch", setSprite: "setSprite", setGlyphs: "setGlyphs", setTransition: "setTransition", setLight: "setLight" };
|
||
function tt(t2, e2, r2) {
|
||
r2.push({ command: Q.addSource, args: [t2, e2[t2]] });
|
||
}
|
||
function et(t2, e2, r2) {
|
||
e2.push({ command: Q.removeSource, args: [t2] }), r2[t2] = true;
|
||
}
|
||
function rt(t2, e2, r2, n2) {
|
||
et(t2, r2, n2), tt(t2, e2, r2);
|
||
}
|
||
function nt(t2, e2, r2) {
|
||
let n2;
|
||
for (n2 in t2[r2]) if (Object.prototype.hasOwnProperty.call(t2[r2], n2) && "data" !== n2 && !W(t2[r2][n2], e2[r2][n2])) return false;
|
||
for (n2 in e2[r2]) if (Object.prototype.hasOwnProperty.call(e2[r2], n2) && "data" !== n2 && !W(t2[r2][n2], e2[r2][n2])) return false;
|
||
return true;
|
||
}
|
||
function it(t2, e2, r2, n2, i3, a2) {
|
||
let s2;
|
||
for (s2 in e2 = e2 || {}, t2 = t2 || {}) Object.prototype.hasOwnProperty.call(t2, s2) && (W(t2[s2], e2[s2]) || r2.push({ command: a2, args: [n2, s2, e2[s2], i3] }));
|
||
for (s2 in e2) Object.prototype.hasOwnProperty.call(e2, s2) && !Object.prototype.hasOwnProperty.call(t2, s2) && (W(t2[s2], e2[s2]) || r2.push({ command: a2, args: [n2, s2, e2[s2], i3] }));
|
||
}
|
||
function at(t2) {
|
||
return t2.id;
|
||
}
|
||
function st(t2, e2) {
|
||
return t2[e2.id] = e2, t2;
|
||
}
|
||
class ot {
|
||
constructor(t2, e2, r2, n2) {
|
||
this.message = (t2 ? `${t2}: ` : "") + r2, n2 && (this.identifier = n2), null != e2 && e2.__line__ && (this.line = e2.__line__);
|
||
}
|
||
}
|
||
function lt(t2, ...e2) {
|
||
for (const r2 of e2) for (const e3 in r2) t2[e3] = r2[e3];
|
||
return t2;
|
||
}
|
||
class ut extends Error {
|
||
constructor(t2, e2) {
|
||
super(e2), this.message = e2, this.key = t2;
|
||
}
|
||
}
|
||
class ct {
|
||
constructor(t2, e2 = []) {
|
||
this.parent = t2, this.bindings = {};
|
||
for (const [t3, r2] of e2) this.bindings[t3] = r2;
|
||
}
|
||
concat(t2) {
|
||
return new ct(this, t2);
|
||
}
|
||
get(t2) {
|
||
if (this.bindings[t2]) return this.bindings[t2];
|
||
if (this.parent) return this.parent.get(t2);
|
||
throw new Error(`${t2} not found in scope.`);
|
||
}
|
||
has(t2) {
|
||
return !!this.bindings[t2] || !!this.parent && this.parent.has(t2);
|
||
}
|
||
}
|
||
const ht = { kind: "null" }, pt = { kind: "number" }, ft = { kind: "string" }, dt = { kind: "boolean" }, yt = { kind: "color" }, mt = { kind: "object" }, gt = { kind: "value" }, xt = { kind: "collator" }, vt = { kind: "formatted" }, bt = { kind: "padding" }, wt = { kind: "resolvedImage" }, _t = { kind: "variableAnchorOffsetCollection" };
|
||
function At(t2, e2) {
|
||
return { kind: "array", itemType: t2, N: e2 };
|
||
}
|
||
function St(t2) {
|
||
if ("array" === t2.kind) {
|
||
const e2 = St(t2.itemType);
|
||
return "number" == typeof t2.N ? `array<${e2}, ${t2.N}>` : "value" === t2.itemType.kind ? "array" : `array<${e2}>`;
|
||
}
|
||
return t2.kind;
|
||
}
|
||
const kt = [ht, pt, ft, dt, yt, vt, mt, At(gt), bt, wt, _t];
|
||
function It(t2, e2) {
|
||
if ("error" === e2.kind) return null;
|
||
if ("array" === t2.kind) {
|
||
if ("array" === e2.kind && (0 === e2.N && "value" === e2.itemType.kind || !It(t2.itemType, e2.itemType)) && ("number" != typeof t2.N || t2.N === e2.N)) return null;
|
||
} else {
|
||
if (t2.kind === e2.kind) return null;
|
||
if ("value" === t2.kind) {
|
||
for (const t3 of kt) if (!It(t3, e2)) return null;
|
||
}
|
||
}
|
||
return `Expected ${St(t2)} but found ${St(e2)} instead.`;
|
||
}
|
||
function zt(t2, e2) {
|
||
return e2.some(((e3) => e3.kind === t2.kind));
|
||
}
|
||
function Mt(t2, e2) {
|
||
return e2.some(((e3) => "null" === e3 ? null === t2 : "array" === e3 ? Array.isArray(t2) : "object" === e3 ? t2 && !Array.isArray(t2) && "object" == typeof t2 : e3 === typeof t2));
|
||
}
|
||
function Ct(t2, e2) {
|
||
return "array" === t2.kind && "array" === e2.kind ? t2.itemType.kind === e2.itemType.kind && "number" == typeof t2.N : t2.kind === e2.kind;
|
||
}
|
||
const Bt = 0.96422, Pt = 0.82521, Vt = 4 / 29, Et = 6 / 29, Ft = 3 * Et * Et, Tt = Et * Et * Et, $t = Math.PI / 180, Lt = 180 / Math.PI;
|
||
function Dt(t2) {
|
||
return (t2 %= 360) < 0 && (t2 += 360), t2;
|
||
}
|
||
function Ot([t2, e2, r2, n2]) {
|
||
let i3, a2;
|
||
const s2 = Rt((0.2225045 * (t2 = Ut(t2)) + 0.7168786 * (e2 = Ut(e2)) + 0.0606169 * (r2 = Ut(r2))) / 1);
|
||
t2 === e2 && e2 === r2 ? i3 = a2 = s2 : (i3 = Rt((0.4360747 * t2 + 0.3850649 * e2 + 0.1430804 * r2) / Bt), a2 = Rt((0.0139322 * t2 + 0.0971045 * e2 + 0.7141733 * r2) / Pt));
|
||
const o2 = 116 * s2 - 16;
|
||
return [o2 < 0 ? 0 : o2, 500 * (i3 - s2), 200 * (s2 - a2), n2];
|
||
}
|
||
function Ut(t2) {
|
||
return t2 <= 0.04045 ? t2 / 12.92 : Math.pow((t2 + 0.055) / 1.055, 2.4);
|
||
}
|
||
function Rt(t2) {
|
||
return t2 > Tt ? Math.pow(t2, 1 / 3) : t2 / Ft + Vt;
|
||
}
|
||
function qt([t2, e2, r2, n2]) {
|
||
let i3 = (t2 + 16) / 116, a2 = isNaN(e2) ? i3 : i3 + e2 / 500, s2 = isNaN(r2) ? i3 : i3 - r2 / 200;
|
||
return i3 = 1 * Nt(i3), a2 = Bt * Nt(a2), s2 = Pt * Nt(s2), [jt(3.1338561 * a2 - 1.6168667 * i3 - 0.4906146 * s2), jt(-0.9787684 * a2 + 1.9161415 * i3 + 0.033454 * s2), jt(0.0719453 * a2 - 0.2289914 * i3 + 1.4052427 * s2), n2];
|
||
}
|
||
function jt(t2) {
|
||
return (t2 = t2 <= 304e-5 ? 12.92 * t2 : 1.055 * Math.pow(t2, 1 / 2.4) - 0.055) < 0 ? 0 : t2 > 1 ? 1 : t2;
|
||
}
|
||
function Nt(t2) {
|
||
return t2 > Et ? t2 * t2 * t2 : Ft * (t2 - Vt);
|
||
}
|
||
function Zt(t2) {
|
||
return parseInt(t2.padEnd(2, t2), 16) / 255;
|
||
}
|
||
function Kt(t2, e2) {
|
||
return Gt(e2 ? t2 / 100 : t2, 0, 1);
|
||
}
|
||
function Gt(t2, e2, r2) {
|
||
return Math.min(Math.max(e2, t2), r2);
|
||
}
|
||
function Jt(t2) {
|
||
return !t2.some(Number.isNaN);
|
||
}
|
||
const Xt = { aliceblue: [240, 248, 255], antiquewhite: [250, 235, 215], aqua: [0, 255, 255], aquamarine: [127, 255, 212], azure: [240, 255, 255], beige: [245, 245, 220], bisque: [255, 228, 196], black: [0, 0, 0], blanchedalmond: [255, 235, 205], blue: [0, 0, 255], blueviolet: [138, 43, 226], brown: [165, 42, 42], burlywood: [222, 184, 135], cadetblue: [95, 158, 160], chartreuse: [127, 255, 0], chocolate: [210, 105, 30], coral: [255, 127, 80], cornflowerblue: [100, 149, 237], cornsilk: [255, 248, 220], crimson: [220, 20, 60], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgoldenrod: [184, 134, 11], darkgray: [169, 169, 169], darkgreen: [0, 100, 0], darkgrey: [169, 169, 169], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkseagreen: [143, 188, 143], darkslateblue: [72, 61, 139], darkslategray: [47, 79, 79], darkslategrey: [47, 79, 79], darkturquoise: [0, 206, 209], darkviolet: [148, 0, 211], deeppink: [255, 20, 147], deepskyblue: [0, 191, 255], dimgray: [105, 105, 105], dimgrey: [105, 105, 105], dodgerblue: [30, 144, 255], firebrick: [178, 34, 34], floralwhite: [255, 250, 240], forestgreen: [34, 139, 34], fuchsia: [255, 0, 255], gainsboro: [220, 220, 220], ghostwhite: [248, 248, 255], gold: [255, 215, 0], goldenrod: [218, 165, 32], gray: [128, 128, 128], green: [0, 128, 0], greenyellow: [173, 255, 47], grey: [128, 128, 128], honeydew: [240, 255, 240], hotpink: [255, 105, 180], indianred: [205, 92, 92], indigo: [75, 0, 130], ivory: [255, 255, 240], khaki: [240, 230, 140], lavender: [230, 230, 250], lavenderblush: [255, 240, 245], lawngreen: [124, 252, 0], lemonchiffon: [255, 250, 205], lightblue: [173, 216, 230], lightcoral: [240, 128, 128], lightcyan: [224, 255, 255], lightgoldenrodyellow: [250, 250, 210], lightgray: [211, 211, 211], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightsalmon: [255, 160, 122], lightseagreen: [32, 178, 170], lightskyblue: [135, 206, 250], lightslategray: [119, 136, 153], lightslategrey: [119, 136, 153], lightsteelblue: [176, 196, 222], lightyellow: [255, 255, 224], lime: [0, 255, 0], limegreen: [50, 205, 50], linen: [250, 240, 230], magenta: [255, 0, 255], maroon: [128, 0, 0], mediumaquamarine: [102, 205, 170], mediumblue: [0, 0, 205], mediumorchid: [186, 85, 211], mediumpurple: [147, 112, 219], mediumseagreen: [60, 179, 113], mediumslateblue: [123, 104, 238], mediumspringgreen: [0, 250, 154], mediumturquoise: [72, 209, 204], mediumvioletred: [199, 21, 133], midnightblue: [25, 25, 112], mintcream: [245, 255, 250], mistyrose: [255, 228, 225], moccasin: [255, 228, 181], navajowhite: [255, 222, 173], navy: [0, 0, 128], oldlace: [253, 245, 230], olive: [128, 128, 0], olivedrab: [107, 142, 35], orange: [255, 165, 0], orangered: [255, 69, 0], orchid: [218, 112, 214], palegoldenrod: [238, 232, 170], palegreen: [152, 251, 152], paleturquoise: [175, 238, 238], palevioletred: [219, 112, 147], papayawhip: [255, 239, 213], peachpuff: [255, 218, 185], peru: [205, 133, 63], pink: [255, 192, 203], plum: [221, 160, 221], powderblue: [176, 224, 230], purple: [128, 0, 128], rebeccapurple: [102, 51, 153], red: [255, 0, 0], rosybrown: [188, 143, 143], royalblue: [65, 105, 225], saddlebrown: [139, 69, 19], salmon: [250, 128, 114], sandybrown: [244, 164, 96], seagreen: [46, 139, 87], seashell: [255, 245, 238], sienna: [160, 82, 45], silver: [192, 192, 192], skyblue: [135, 206, 235], slateblue: [106, 90, 205], slategray: [112, 128, 144], slategrey: [112, 128, 144], snow: [255, 250, 250], springgreen: [0, 255, 127], steelblue: [70, 130, 180], tan: [210, 180, 140], teal: [0, 128, 128], thistle: [216, 191, 216], tomato: [255, 99, 71], turquoise: [64, 224, 208], violet: [238, 130, 238], wheat: [245, 222, 179], white: [255, 255, 255], whitesmoke: [245, 245, 245], yellow: [255, 255, 0], yellowgreen: [154, 205, 50] };
|
||
class Yt {
|
||
constructor(t2, e2, r2, n2 = 1, i3 = true) {
|
||
this.r = t2, this.g = e2, this.b = r2, this.a = n2, i3 || (this.r *= n2, this.g *= n2, this.b *= n2, n2 || this.overwriteGetter("rgb", [t2, e2, r2, n2]));
|
||
}
|
||
static parse(t2) {
|
||
if (t2 instanceof Yt) return t2;
|
||
if ("string" != typeof t2) return;
|
||
const e2 = (function(t3) {
|
||
if ("transparent" === (t3 = t3.toLowerCase().trim())) return [0, 0, 0, 0];
|
||
const e3 = Xt[t3];
|
||
if (e3) {
|
||
const [t4, r3, n2] = e3;
|
||
return [t4 / 255, r3 / 255, n2 / 255, 1];
|
||
}
|
||
if (t3.startsWith("#") && /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t3)) {
|
||
const e4 = t3.length < 6 ? 1 : 2;
|
||
let r3 = 1;
|
||
return [Zt(t3.slice(r3, r3 += e4)), Zt(t3.slice(r3, r3 += e4)), Zt(t3.slice(r3, r3 += e4)), Zt(t3.slice(r3, r3 + e4) || "ff")];
|
||
}
|
||
if (t3.startsWith("rgb")) {
|
||
const e4 = t3.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
|
||
if (e4) {
|
||
const [t4, r3, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2] = e4, f2 = [i3 || " ", o2 || " ", c2].join("");
|
||
if (" " === f2 || " /" === f2 || ",," === f2 || ",,," === f2) {
|
||
const t5 = [n2, s2, u2].join(""), e5 = "%%%" === t5 ? 100 : "" === t5 ? 255 : 0;
|
||
if (e5) {
|
||
const t6 = [Gt(+r3 / e5, 0, 1), Gt(+a2 / e5, 0, 1), Gt(+l2 / e5, 0, 1), h2 ? Kt(+h2, p2) : 1];
|
||
if (Jt(t6)) return t6;
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
const r2 = t3.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
|
||
if (r2) {
|
||
const [t4, e4, n2, i3, a2, s2, o2, l2, u2] = r2, c2 = [n2 || " ", a2 || " ", o2].join("");
|
||
if (" " === c2 || " /" === c2 || ",," === c2 || ",,," === c2) {
|
||
const t5 = [+e4, Gt(+i3, 0, 100), Gt(+s2, 0, 100), l2 ? Kt(+l2, u2) : 1];
|
||
if (Jt(t5)) return (function([t6, e5, r3, n3]) {
|
||
function i4(n4) {
|
||
const i5 = (n4 + t6 / 30) % 12, a3 = e5 * Math.min(r3, 1 - r3);
|
||
return r3 - a3 * Math.max(-1, Math.min(i5 - 3, 9 - i5, 1));
|
||
}
|
||
return t6 = Dt(t6), e5 /= 100, r3 /= 100, [i4(0), i4(8), i4(4), n3];
|
||
})(t5);
|
||
}
|
||
}
|
||
})(t2);
|
||
return e2 ? new Yt(...e2, false) : void 0;
|
||
}
|
||
get rgb() {
|
||
const { r: t2, g: e2, b: r2, a: n2 } = this, i3 = n2 || 1 / 0;
|
||
return this.overwriteGetter("rgb", [t2 / i3, e2 / i3, r2 / i3, n2]);
|
||
}
|
||
get hcl() {
|
||
return this.overwriteGetter("hcl", (function(t2) {
|
||
const [e2, r2, n2, i3] = Ot(t2), a2 = Math.sqrt(r2 * r2 + n2 * n2);
|
||
return [Math.round(1e4 * a2) ? Dt(Math.atan2(n2, r2) * Lt) : NaN, a2, e2, i3];
|
||
})(this.rgb));
|
||
}
|
||
get lab() {
|
||
return this.overwriteGetter("lab", Ot(this.rgb));
|
||
}
|
||
overwriteGetter(t2, e2) {
|
||
return Object.defineProperty(this, t2, { value: e2 }), e2;
|
||
}
|
||
toString() {
|
||
const [t2, e2, r2, n2] = this.rgb;
|
||
return `rgba(${[t2, e2, r2].map(((t3) => Math.round(255 * t3))).join(",")},${n2})`;
|
||
}
|
||
}
|
||
Yt.black = new Yt(0, 0, 0, 1), Yt.white = new Yt(1, 1, 1, 1), Yt.transparent = new Yt(0, 0, 0, 0), Yt.red = new Yt(1, 0, 0, 1);
|
||
class Ht {
|
||
constructor(t2, e2, r2) {
|
||
this.sensitivity = t2 ? e2 ? "variant" : "case" : e2 ? "accent" : "base", this.locale = r2, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" });
|
||
}
|
||
compare(t2, e2) {
|
||
return this.collator.compare(t2, e2);
|
||
}
|
||
resolvedLocale() {
|
||
return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;
|
||
}
|
||
}
|
||
class Wt {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
this.text = t2, this.image = e2, this.scale = r2, this.fontStack = n2, this.textColor = i3;
|
||
}
|
||
}
|
||
class Qt {
|
||
constructor(t2) {
|
||
this.sections = t2;
|
||
}
|
||
static fromString(t2) {
|
||
return new Qt([new Wt(t2, null, null, null, null)]);
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.sections.length || !this.sections.some(((t2) => 0 !== t2.text.length || t2.image && 0 !== t2.image.name.length));
|
||
}
|
||
static factory(t2) {
|
||
return t2 instanceof Qt ? t2 : Qt.fromString(t2);
|
||
}
|
||
toString() {
|
||
return 0 === this.sections.length ? "" : this.sections.map(((t2) => t2.text)).join("");
|
||
}
|
||
}
|
||
class te {
|
||
constructor(t2) {
|
||
this.values = t2.slice();
|
||
}
|
||
static parse(t2) {
|
||
if (t2 instanceof te) return t2;
|
||
if ("number" == typeof t2) return new te([t2, t2, t2, t2]);
|
||
if (Array.isArray(t2) && !(t2.length < 1 || t2.length > 4)) {
|
||
for (const e2 of t2) if ("number" != typeof e2) return;
|
||
switch (t2.length) {
|
||
case 1:
|
||
t2 = [t2[0], t2[0], t2[0], t2[0]];
|
||
break;
|
||
case 2:
|
||
t2 = [t2[0], t2[1], t2[0], t2[1]];
|
||
break;
|
||
case 3:
|
||
t2 = [t2[0], t2[1], t2[2], t2[1]];
|
||
}
|
||
return new te(t2);
|
||
}
|
||
}
|
||
toString() {
|
||
return JSON.stringify(this.values);
|
||
}
|
||
}
|
||
const ee = /* @__PURE__ */ new Set(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]);
|
||
class re {
|
||
constructor(t2) {
|
||
this.values = t2.slice();
|
||
}
|
||
static parse(t2) {
|
||
if (t2 instanceof re) return t2;
|
||
if (Array.isArray(t2) && !(t2.length < 1) && t2.length % 2 == 0) {
|
||
for (let e2 = 0; e2 < t2.length; e2 += 2) {
|
||
const r2 = t2[e2], n2 = t2[e2 + 1];
|
||
if ("string" != typeof r2 || !ee.has(r2)) return;
|
||
if (!Array.isArray(n2) || 2 !== n2.length || "number" != typeof n2[0] || "number" != typeof n2[1]) return;
|
||
}
|
||
return new re(t2);
|
||
}
|
||
}
|
||
toString() {
|
||
return JSON.stringify(this.values);
|
||
}
|
||
}
|
||
class ne {
|
||
constructor(t2) {
|
||
this.name = t2.name, this.available = t2.available;
|
||
}
|
||
toString() {
|
||
return this.name;
|
||
}
|
||
static fromString(t2) {
|
||
return t2 ? new ne({ name: t2, available: false }) : null;
|
||
}
|
||
}
|
||
function ie(t2, e2, r2, n2) {
|
||
return "number" == typeof t2 && t2 >= 0 && t2 <= 255 && "number" == typeof e2 && e2 >= 0 && e2 <= 255 && "number" == typeof r2 && r2 >= 0 && r2 <= 255 ? void 0 === n2 || "number" == typeof n2 && n2 >= 0 && n2 <= 1 ? null : `Invalid rgba value [${[t2, e2, r2, n2].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${("number" == typeof n2 ? [t2, e2, r2, n2] : [t2, e2, r2]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`;
|
||
}
|
||
function ae(t2) {
|
||
if (null === t2 || "string" == typeof t2 || "boolean" == typeof t2 || "number" == typeof t2 || t2 instanceof Yt || t2 instanceof Ht || t2 instanceof Qt || t2 instanceof te || t2 instanceof re || t2 instanceof ne) return true;
|
||
if (Array.isArray(t2)) {
|
||
for (const e2 of t2) if (!ae(e2)) return false;
|
||
return true;
|
||
}
|
||
if ("object" == typeof t2) {
|
||
for (const e2 in t2) if (!ae(t2[e2])) return false;
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function se(t2) {
|
||
if (null === t2) return ht;
|
||
if ("string" == typeof t2) return ft;
|
||
if ("boolean" == typeof t2) return dt;
|
||
if ("number" == typeof t2) return pt;
|
||
if (t2 instanceof Yt) return yt;
|
||
if (t2 instanceof Ht) return xt;
|
||
if (t2 instanceof Qt) return vt;
|
||
if (t2 instanceof te) return bt;
|
||
if (t2 instanceof re) return _t;
|
||
if (t2 instanceof ne) return wt;
|
||
if (Array.isArray(t2)) {
|
||
const e2 = t2.length;
|
||
let r2;
|
||
for (const e3 of t2) {
|
||
const t3 = se(e3);
|
||
if (r2) {
|
||
if (r2 === t3) continue;
|
||
r2 = gt;
|
||
break;
|
||
}
|
||
r2 = t3;
|
||
}
|
||
return At(r2 || gt, e2);
|
||
}
|
||
return mt;
|
||
}
|
||
function oe(t2) {
|
||
const e2 = typeof t2;
|
||
return null === t2 ? "" : "string" === e2 || "number" === e2 || "boolean" === e2 ? String(t2) : t2 instanceof Yt || t2 instanceof Qt || t2 instanceof te || t2 instanceof re || t2 instanceof ne ? t2.toString() : JSON.stringify(t2);
|
||
}
|
||
class le {
|
||
constructor(t2, e2) {
|
||
this.type = t2, this.value = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length) return e2.error(`'literal' expression requires exactly one argument, but found ${t2.length - 1} instead.`);
|
||
if (!ae(t2[1])) return e2.error("invalid value");
|
||
const r2 = t2[1];
|
||
let n2 = se(r2);
|
||
const i3 = e2.expectedType;
|
||
return "array" !== n2.kind || 0 !== n2.N || !i3 || "array" !== i3.kind || "number" == typeof i3.N && 0 !== i3.N || (n2 = i3), new le(n2, r2);
|
||
}
|
||
evaluate() {
|
||
return this.value;
|
||
}
|
||
eachChild() {
|
||
}
|
||
outputDefined() {
|
||
return true;
|
||
}
|
||
}
|
||
class ue {
|
||
constructor(t2) {
|
||
this.name = "ExpressionEvaluationError", this.message = t2;
|
||
}
|
||
toJSON() {
|
||
return this.message;
|
||
}
|
||
}
|
||
const ce = { string: ft, number: pt, boolean: dt, object: mt };
|
||
class he {
|
||
constructor(t2, e2) {
|
||
this.type = t2, this.args = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 2) return e2.error("Expected at least one argument.");
|
||
let r2, n2 = 1;
|
||
const i3 = t2[0];
|
||
if ("array" === i3) {
|
||
let i4, a3;
|
||
if (t2.length > 2) {
|
||
const r3 = t2[1];
|
||
if ("string" != typeof r3 || !(r3 in ce) || "object" === r3) return e2.error('The item type argument of "array" must be one of string, number, boolean', 1);
|
||
i4 = ce[r3], n2++;
|
||
} else i4 = gt;
|
||
if (t2.length > 3) {
|
||
if (null !== t2[2] && ("number" != typeof t2[2] || t2[2] < 0 || t2[2] !== Math.floor(t2[2]))) return e2.error('The length argument to "array" must be a positive integer literal', 2);
|
||
a3 = t2[2], n2++;
|
||
}
|
||
r2 = At(i4, a3);
|
||
} else {
|
||
if (!ce[i3]) throw new Error(`Types doesn't contain name = ${i3}`);
|
||
r2 = ce[i3];
|
||
}
|
||
const a2 = [];
|
||
for (; n2 < t2.length; n2++) {
|
||
const r3 = e2.parse(t2[n2], n2, gt);
|
||
if (!r3) return null;
|
||
a2.push(r3);
|
||
}
|
||
return new he(r2, a2);
|
||
}
|
||
evaluate(t2) {
|
||
for (let e2 = 0; e2 < this.args.length; e2++) {
|
||
const r2 = this.args[e2].evaluate(t2);
|
||
if (!It(this.type, se(r2))) return r2;
|
||
if (e2 === this.args.length - 1) throw new ue(`Expected value to be of type ${St(this.type)}, but found ${St(se(r2))} instead.`);
|
||
}
|
||
throw new Error();
|
||
}
|
||
eachChild(t2) {
|
||
this.args.forEach(t2);
|
||
}
|
||
outputDefined() {
|
||
return this.args.every(((t2) => t2.outputDefined()));
|
||
}
|
||
}
|
||
const pe = { "to-boolean": dt, "to-color": yt, "to-number": pt, "to-string": ft };
|
||
class fe {
|
||
constructor(t2, e2) {
|
||
this.type = t2, this.args = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 2) return e2.error("Expected at least one argument.");
|
||
const r2 = t2[0];
|
||
if (!pe[r2]) throw new Error(`Can't parse ${r2} as it is not part of the known types`);
|
||
if (("to-boolean" === r2 || "to-string" === r2) && 2 !== t2.length) return e2.error("Expected one argument.");
|
||
const n2 = pe[r2], i3 = [];
|
||
for (let r3 = 1; r3 < t2.length; r3++) {
|
||
const n3 = e2.parse(t2[r3], r3, gt);
|
||
if (!n3) return null;
|
||
i3.push(n3);
|
||
}
|
||
return new fe(n2, i3);
|
||
}
|
||
evaluate(t2) {
|
||
switch (this.type.kind) {
|
||
case "boolean":
|
||
return Boolean(this.args[0].evaluate(t2));
|
||
case "color": {
|
||
let e2, r2;
|
||
for (const n2 of this.args) {
|
||
if (e2 = n2.evaluate(t2), r2 = null, e2 instanceof Yt) return e2;
|
||
if ("string" == typeof e2) {
|
||
const r3 = t2.parseColor(e2);
|
||
if (r3) return r3;
|
||
} else if (Array.isArray(e2) && (r2 = e2.length < 3 || e2.length > 4 ? `Invalid rbga value ${JSON.stringify(e2)}: expected an array containing either three or four numeric values.` : ie(e2[0], e2[1], e2[2], e2[3]), !r2)) return new Yt(e2[0] / 255, e2[1] / 255, e2[2] / 255, e2[3]);
|
||
}
|
||
throw new ue(r2 || `Could not parse color from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
|
||
}
|
||
case "padding": {
|
||
let e2;
|
||
for (const r2 of this.args) {
|
||
e2 = r2.evaluate(t2);
|
||
const n2 = te.parse(e2);
|
||
if (n2) return n2;
|
||
}
|
||
throw new ue(`Could not parse padding from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
|
||
}
|
||
case "variableAnchorOffsetCollection": {
|
||
let e2;
|
||
for (const r2 of this.args) {
|
||
e2 = r2.evaluate(t2);
|
||
const n2 = re.parse(e2);
|
||
if (n2) return n2;
|
||
}
|
||
throw new ue(`Could not parse variableAnchorOffsetCollection from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
|
||
}
|
||
case "number": {
|
||
let e2 = null;
|
||
for (const r2 of this.args) {
|
||
if (e2 = r2.evaluate(t2), null === e2) return 0;
|
||
const n2 = Number(e2);
|
||
if (!isNaN(n2)) return n2;
|
||
}
|
||
throw new ue(`Could not convert ${JSON.stringify(e2)} to number.`);
|
||
}
|
||
case "formatted":
|
||
return Qt.fromString(oe(this.args[0].evaluate(t2)));
|
||
case "resolvedImage":
|
||
return ne.fromString(oe(this.args[0].evaluate(t2)));
|
||
default:
|
||
return oe(this.args[0].evaluate(t2));
|
||
}
|
||
}
|
||
eachChild(t2) {
|
||
this.args.forEach(t2);
|
||
}
|
||
outputDefined() {
|
||
return this.args.every(((t2) => t2.outputDefined()));
|
||
}
|
||
}
|
||
const de = ["Unknown", "Point", "LineString", "Polygon"];
|
||
class ye {
|
||
constructor() {
|
||
this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null, this.canonical = null;
|
||
}
|
||
id() {
|
||
return this.feature && "id" in this.feature ? this.feature.id : null;
|
||
}
|
||
geometryType() {
|
||
return this.feature ? "number" == typeof this.feature.type ? de[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 || {};
|
||
}
|
||
parseColor(t2) {
|
||
let e2 = this._parseColorCache[t2];
|
||
return e2 || (e2 = this._parseColorCache[t2] = Yt.parse(t2)), e2;
|
||
}
|
||
}
|
||
class me {
|
||
constructor(t2, e2, r2 = [], n2, i3 = new ct(), a2 = []) {
|
||
this.registry = t2, this.path = r2, this.key = r2.map(((t3) => `[${t3}]`)).join(""), this.scope = i3, this.errors = a2, this.expectedType = n2, this._isConstant = e2;
|
||
}
|
||
parse(t2, e2, r2, n2, i3 = {}) {
|
||
return e2 ? this.concat(e2, r2, n2)._parse(t2, i3) : this._parse(t2, i3);
|
||
}
|
||
_parse(t2, e2) {
|
||
function r2(t3, e3, r3) {
|
||
return "assert" === r3 ? new he(e3, [t3]) : "coerce" === r3 ? new fe(e3, [t3]) : t3;
|
||
}
|
||
if (null !== t2 && "string" != typeof t2 && "boolean" != typeof t2 && "number" != typeof t2 || (t2 = ["literal", t2]), Array.isArray(t2)) {
|
||
if (0 === t2.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
|
||
const n2 = t2[0];
|
||
if ("string" != typeof n2) return this.error(`Expression name must be a string, but found ${typeof n2} instead. If you wanted a literal array, use ["literal", [...]].`, 0), null;
|
||
const i3 = this.registry[n2];
|
||
if (i3) {
|
||
let n3 = i3.parse(t2, this);
|
||
if (!n3) return null;
|
||
if (this.expectedType) {
|
||
const t3 = this.expectedType, i4 = n3.type;
|
||
if ("string" !== t3.kind && "number" !== t3.kind && "boolean" !== t3.kind && "object" !== t3.kind && "array" !== t3.kind || "value" !== i4.kind) if ("color" !== t3.kind && "formatted" !== t3.kind && "resolvedImage" !== t3.kind || "value" !== i4.kind && "string" !== i4.kind) if ("padding" !== t3.kind || "value" !== i4.kind && "number" !== i4.kind && "array" !== i4.kind) if ("variableAnchorOffsetCollection" !== t3.kind || "value" !== i4.kind && "array" !== i4.kind) {
|
||
if (this.checkSubtype(t3, i4)) return null;
|
||
} else n3 = r2(n3, t3, e2.typeAnnotation || "coerce");
|
||
else n3 = r2(n3, t3, e2.typeAnnotation || "coerce");
|
||
else n3 = r2(n3, t3, e2.typeAnnotation || "coerce");
|
||
else n3 = r2(n3, t3, e2.typeAnnotation || "assert");
|
||
}
|
||
if (!(n3 instanceof le) && "resolvedImage" !== n3.type.kind && this._isConstant(n3)) {
|
||
const t3 = new ye();
|
||
try {
|
||
n3 = new le(n3.type, n3.evaluate(t3));
|
||
} catch (t4) {
|
||
return this.error(t4.message), null;
|
||
}
|
||
}
|
||
return n3;
|
||
}
|
||
return this.error(`Unknown expression "${n2}". If you wanted a literal array, use ["literal", [...]].`, 0);
|
||
}
|
||
return this.error(void 0 === t2 ? "'undefined' value invalid. Use null instead." : "object" == typeof t2 ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof t2} instead.`);
|
||
}
|
||
concat(t2, e2, r2) {
|
||
const n2 = "number" == typeof t2 ? this.path.concat(t2) : this.path, i3 = r2 ? this.scope.concat(r2) : this.scope;
|
||
return new me(this.registry, this._isConstant, n2, e2 || null, i3, this.errors);
|
||
}
|
||
error(t2, ...e2) {
|
||
const r2 = `${this.key}${e2.map(((t3) => `[${t3}]`)).join("")}`;
|
||
this.errors.push(new ut(r2, t2));
|
||
}
|
||
checkSubtype(t2, e2) {
|
||
const r2 = It(t2, e2);
|
||
return r2 && this.error(r2), r2;
|
||
}
|
||
}
|
||
class ge {
|
||
constructor(t2, e2, r2) {
|
||
this.type = xt, this.locale = r2, this.caseSensitive = t2, this.diacriticSensitive = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length) return e2.error("Expected one argument.");
|
||
const r2 = t2[1];
|
||
if ("object" != typeof r2 || Array.isArray(r2)) return e2.error("Collator options argument must be an object.");
|
||
const n2 = e2.parse(void 0 !== r2["case-sensitive"] && r2["case-sensitive"], 1, dt);
|
||
if (!n2) return null;
|
||
const i3 = e2.parse(void 0 !== r2["diacritic-sensitive"] && r2["diacritic-sensitive"], 1, dt);
|
||
if (!i3) return null;
|
||
let a2 = null;
|
||
return r2.locale && (a2 = e2.parse(r2.locale, 1, ft), !a2) ? null : new ge(n2, i3, a2);
|
||
}
|
||
evaluate(t2) {
|
||
return new Ht(this.caseSensitive.evaluate(t2), this.diacriticSensitive.evaluate(t2), this.locale ? this.locale.evaluate(t2) : null);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.caseSensitive), t2(this.diacriticSensitive), this.locale && t2(this.locale);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
const xe = 8192;
|
||
function ve(t2, e2) {
|
||
t2[0] = Math.min(t2[0], e2[0]), t2[1] = Math.min(t2[1], e2[1]), t2[2] = Math.max(t2[2], e2[0]), t2[3] = Math.max(t2[3], e2[1]);
|
||
}
|
||
function be(t2, e2) {
|
||
return !(t2[0] <= e2[0] || t2[2] >= e2[2] || t2[1] <= e2[1] || t2[3] >= e2[3]);
|
||
}
|
||
function we(t2, e2) {
|
||
const r2 = (180 + t2[0]) / 360, n2 = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t2[1] * Math.PI / 360))) / 360, i3 = Math.pow(2, e2.z);
|
||
return [Math.round(r2 * i3 * xe), Math.round(n2 * i3 * xe)];
|
||
}
|
||
function _e(t2, e2, r2) {
|
||
const n2 = t2[0] - e2[0], i3 = t2[1] - e2[1], a2 = t2[0] - r2[0], s2 = t2[1] - r2[1];
|
||
return n2 * s2 - a2 * i3 == 0 && n2 * a2 <= 0 && i3 * s2 <= 0;
|
||
}
|
||
function Ae(t2, e2) {
|
||
let r2 = false;
|
||
for (let s2 = 0, o2 = e2.length; s2 < o2; s2++) {
|
||
const o3 = e2[s2];
|
||
for (let e3 = 0, s3 = o3.length; e3 < s3 - 1; e3++) {
|
||
if (_e(t2, o3[e3], o3[e3 + 1])) return false;
|
||
(i3 = o3[e3])[1] > (n2 = t2)[1] != (a2 = o3[e3 + 1])[1] > n2[1] && n2[0] < (a2[0] - i3[0]) * (n2[1] - i3[1]) / (a2[1] - i3[1]) + i3[0] && (r2 = !r2);
|
||
}
|
||
}
|
||
var n2, i3, a2;
|
||
return r2;
|
||
}
|
||
function Se(t2, e2) {
|
||
for (let r2 = 0; r2 < e2.length; r2++) if (Ae(t2, e2[r2])) return true;
|
||
return false;
|
||
}
|
||
function ke(t2, e2, r2, n2) {
|
||
const i3 = n2[0] - r2[0], a2 = n2[1] - r2[1], s2 = (t2[0] - r2[0]) * a2 - i3 * (t2[1] - r2[1]), o2 = (e2[0] - r2[0]) * a2 - i3 * (e2[1] - r2[1]);
|
||
return s2 > 0 && o2 < 0 || s2 < 0 && o2 > 0;
|
||
}
|
||
function Ie(t2, e2, r2) {
|
||
for (const u2 of r2) for (let r3 = 0; r3 < u2.length - 1; ++r3) if (0 != (o2 = [(s2 = u2[r3 + 1])[0] - (a2 = u2[r3])[0], s2[1] - a2[1]])[0] * (l2 = [(i3 = e2)[0] - (n2 = t2)[0], i3[1] - n2[1]])[1] - o2[1] * l2[0] && ke(n2, i3, a2, s2) && ke(a2, s2, n2, i3)) return true;
|
||
var n2, i3, a2, s2, o2, l2;
|
||
return false;
|
||
}
|
||
function ze(t2, e2) {
|
||
for (let r2 = 0; r2 < t2.length; ++r2) if (!Ae(t2[r2], e2)) return false;
|
||
for (let r2 = 0; r2 < t2.length - 1; ++r2) if (Ie(t2[r2], t2[r2 + 1], e2)) return false;
|
||
return true;
|
||
}
|
||
function Me(t2, e2) {
|
||
for (let r2 = 0; r2 < e2.length; r2++) if (ze(t2, e2[r2])) return true;
|
||
return false;
|
||
}
|
||
function Ce(t2, e2, r2) {
|
||
const n2 = [];
|
||
for (let i3 = 0; i3 < t2.length; i3++) {
|
||
const a2 = [];
|
||
for (let n3 = 0; n3 < t2[i3].length; n3++) {
|
||
const s2 = we(t2[i3][n3], r2);
|
||
ve(e2, s2), a2.push(s2);
|
||
}
|
||
n2.push(a2);
|
||
}
|
||
return n2;
|
||
}
|
||
function Be(t2, e2, r2) {
|
||
const n2 = [];
|
||
for (let i3 = 0; i3 < t2.length; i3++) {
|
||
const a2 = Ce(t2[i3], e2, r2);
|
||
n2.push(a2);
|
||
}
|
||
return n2;
|
||
}
|
||
function Pe(t2, e2, r2, n2) {
|
||
if (t2[0] < r2[0] || t2[0] > r2[2]) {
|
||
const e3 = 0.5 * n2;
|
||
let i3 = t2[0] - r2[0] > e3 ? -n2 : r2[0] - t2[0] > e3 ? n2 : 0;
|
||
0 === i3 && (i3 = t2[0] - r2[2] > e3 ? -n2 : r2[2] - t2[0] > e3 ? n2 : 0), t2[0] += i3;
|
||
}
|
||
ve(e2, t2);
|
||
}
|
||
function Ve(t2, e2, r2, n2) {
|
||
const i3 = Math.pow(2, n2.z) * xe, a2 = [n2.x * xe, n2.y * xe], s2 = [];
|
||
for (const n3 of t2) for (const t3 of n3) {
|
||
const n4 = [t3.x + a2[0], t3.y + a2[1]];
|
||
Pe(n4, e2, r2, i3), s2.push(n4);
|
||
}
|
||
return s2;
|
||
}
|
||
function Ee(t2, e2, r2, n2) {
|
||
const i3 = Math.pow(2, n2.z) * xe, a2 = [n2.x * xe, n2.y * xe], s2 = [];
|
||
for (const r3 of t2) {
|
||
const t3 = [];
|
||
for (const n3 of r3) {
|
||
const r4 = [n3.x + a2[0], n3.y + a2[1]];
|
||
ve(e2, r4), t3.push(r4);
|
||
}
|
||
s2.push(t3);
|
||
}
|
||
if (e2[2] - e2[0] <= i3 / 2) {
|
||
(o2 = e2)[0] = o2[1] = 1 / 0, o2[2] = o2[3] = -1 / 0;
|
||
for (const t3 of s2) for (const n3 of t3) Pe(n3, e2, r2, i3);
|
||
}
|
||
var o2;
|
||
return s2;
|
||
}
|
||
class Fe {
|
||
constructor(t2, e2) {
|
||
this.type = dt, this.geojson = t2, this.geometries = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length) return e2.error(`'within' expression requires exactly one argument, but found ${t2.length - 1} instead.`);
|
||
if (ae(t2[1])) {
|
||
const e3 = t2[1];
|
||
if ("FeatureCollection" === e3.type) for (let t3 = 0; t3 < e3.features.length; ++t3) {
|
||
const r2 = e3.features[t3].geometry.type;
|
||
if ("Polygon" === r2 || "MultiPolygon" === r2) return new Fe(e3, e3.features[t3].geometry);
|
||
}
|
||
else if ("Feature" === e3.type) {
|
||
const t3 = e3.geometry.type;
|
||
if ("Polygon" === t3 || "MultiPolygon" === t3) return new Fe(e3, e3.geometry);
|
||
} else if ("Polygon" === e3.type || "MultiPolygon" === e3.type) return new Fe(e3, e3);
|
||
}
|
||
return e2.error("'within' expression requires valid geojson object that contains polygon geometry type.");
|
||
}
|
||
evaluate(t2) {
|
||
if (null != t2.geometry() && null != t2.canonicalID()) {
|
||
if ("Point" === t2.geometryType()) return (function(t3, e2) {
|
||
const r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i3 = t3.canonicalID();
|
||
if ("Polygon" === e2.type) {
|
||
const a2 = Ce(e2.coordinates, n2, i3), s2 = Ve(t3.geometry(), r2, n2, i3);
|
||
if (!be(r2, n2)) return false;
|
||
for (const t4 of s2) if (!Ae(t4, a2)) return false;
|
||
}
|
||
if ("MultiPolygon" === e2.type) {
|
||
const a2 = Be(e2.coordinates, n2, i3), s2 = Ve(t3.geometry(), r2, n2, i3);
|
||
if (!be(r2, n2)) return false;
|
||
for (const t4 of s2) if (!Se(t4, a2)) return false;
|
||
}
|
||
return true;
|
||
})(t2, this.geometries);
|
||
if ("LineString" === t2.geometryType()) return (function(t3, e2) {
|
||
const r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i3 = t3.canonicalID();
|
||
if ("Polygon" === e2.type) {
|
||
const a2 = Ce(e2.coordinates, n2, i3), s2 = Ee(t3.geometry(), r2, n2, i3);
|
||
if (!be(r2, n2)) return false;
|
||
for (const t4 of s2) if (!ze(t4, a2)) return false;
|
||
}
|
||
if ("MultiPolygon" === e2.type) {
|
||
const a2 = Be(e2.coordinates, n2, i3), s2 = Ee(t3.geometry(), r2, n2, i3);
|
||
if (!be(r2, n2)) return false;
|
||
for (const t4 of s2) if (!Me(t4, a2)) return false;
|
||
}
|
||
return true;
|
||
})(t2, this.geometries);
|
||
}
|
||
return false;
|
||
}
|
||
eachChild() {
|
||
}
|
||
outputDefined() {
|
||
return true;
|
||
}
|
||
}
|
||
class Te {
|
||
constructor(t2, e2) {
|
||
this.type = e2.type, this.name = t2, this.boundExpression = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length || "string" != typeof t2[1]) return e2.error("'var' expression requires exactly one string literal argument.");
|
||
const r2 = t2[1];
|
||
return e2.scope.has(r2) ? new Te(r2, e2.scope.get(r2)) : e2.error(`Unknown variable "${r2}". Make sure "${r2}" has been bound in an enclosing "let" expression before using it.`, 1);
|
||
}
|
||
evaluate(t2) {
|
||
return this.boundExpression.evaluate(t2);
|
||
}
|
||
eachChild() {
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class $e {
|
||
constructor(t2, e2, r2, n2) {
|
||
this.name = t2, this.type = e2, this._evaluate = r2, this.args = n2;
|
||
}
|
||
evaluate(t2) {
|
||
return this._evaluate(t2, this.args);
|
||
}
|
||
eachChild(t2) {
|
||
this.args.forEach(t2);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
static parse(t2, e2) {
|
||
const r2 = t2[0], n2 = $e.definitions[r2];
|
||
if (!n2) return e2.error(`Unknown expression "${r2}". If you wanted a literal array, use ["literal", [...]].`, 0);
|
||
const i3 = Array.isArray(n2) ? n2[0] : n2.type, a2 = Array.isArray(n2) ? [[n2[1], n2[2]]] : n2.overloads, s2 = a2.filter((([e3]) => !Array.isArray(e3) || e3.length === t2.length - 1));
|
||
let o2 = null;
|
||
for (const [n3, a3] of s2) {
|
||
o2 = new me(e2.registry, Le, e2.path, null, e2.scope);
|
||
const s3 = [];
|
||
let l2 = false;
|
||
for (let e3 = 1; e3 < t2.length; e3++) {
|
||
const r3 = t2[e3], i4 = Array.isArray(n3) ? n3[e3 - 1] : n3.type, a4 = o2.parse(r3, 1 + s3.length, i4);
|
||
if (!a4) {
|
||
l2 = true;
|
||
break;
|
||
}
|
||
s3.push(a4);
|
||
}
|
||
if (!l2) if (Array.isArray(n3) && n3.length !== s3.length) o2.error(`Expected ${n3.length} arguments, but found ${s3.length} instead.`);
|
||
else {
|
||
for (let t3 = 0; t3 < s3.length; t3++) {
|
||
const e3 = Array.isArray(n3) ? n3[t3] : n3.type, r3 = s3[t3];
|
||
o2.concat(t3 + 1).checkSubtype(e3, r3.type);
|
||
}
|
||
if (0 === o2.errors.length) return new $e(r2, i3, a3, s3);
|
||
}
|
||
}
|
||
if (1 === s2.length) e2.errors.push(...o2.errors);
|
||
else {
|
||
const r3 = (s2.length ? s2 : a2).map((([t3]) => {
|
||
return e3 = t3, Array.isArray(e3) ? `(${e3.map(St).join(", ")})` : `(${St(e3.type)}...)`;
|
||
var e3;
|
||
})).join(" | "), n3 = [];
|
||
for (let r4 = 1; r4 < t2.length; r4++) {
|
||
const i4 = e2.parse(t2[r4], 1 + n3.length);
|
||
if (!i4) return null;
|
||
n3.push(St(i4.type));
|
||
}
|
||
e2.error(`Expected arguments of type ${r3}, but found (${n3.join(", ")}) instead.`);
|
||
}
|
||
return null;
|
||
}
|
||
static register(t2, e2) {
|
||
$e.definitions = e2;
|
||
for (const r2 in e2) t2[r2] = $e;
|
||
}
|
||
}
|
||
function Le(t2) {
|
||
if (t2 instanceof Te) return Le(t2.boundExpression);
|
||
if (t2 instanceof $e && "error" === t2.name) return false;
|
||
if (t2 instanceof ge) return false;
|
||
if (t2 instanceof Fe) return false;
|
||
const e2 = t2 instanceof fe || t2 instanceof he;
|
||
let r2 = true;
|
||
return t2.eachChild(((t3) => {
|
||
r2 = e2 ? r2 && Le(t3) : r2 && t3 instanceof le;
|
||
})), !!r2 && De(t2) && Ue(t2, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]);
|
||
}
|
||
function De(t2) {
|
||
if (t2 instanceof $e) {
|
||
if ("get" === t2.name && 1 === t2.args.length) return false;
|
||
if ("feature-state" === t2.name) return false;
|
||
if ("has" === t2.name && 1 === t2.args.length) return false;
|
||
if ("properties" === t2.name || "geometry-type" === t2.name || "id" === t2.name) return false;
|
||
if (/^filter-/.test(t2.name)) return false;
|
||
}
|
||
if (t2 instanceof Fe) return false;
|
||
let e2 = true;
|
||
return t2.eachChild(((t3) => {
|
||
e2 && !De(t3) && (e2 = false);
|
||
})), e2;
|
||
}
|
||
function Oe(t2) {
|
||
if (t2 instanceof $e && "feature-state" === t2.name) return false;
|
||
let e2 = true;
|
||
return t2.eachChild(((t3) => {
|
||
e2 && !Oe(t3) && (e2 = false);
|
||
})), e2;
|
||
}
|
||
function Ue(t2, e2) {
|
||
if (t2 instanceof $e && e2.indexOf(t2.name) >= 0) return false;
|
||
let r2 = true;
|
||
return t2.eachChild(((t3) => {
|
||
r2 && !Ue(t3, e2) && (r2 = false);
|
||
})), r2;
|
||
}
|
||
function Re(t2, e2) {
|
||
const r2 = t2.length - 1;
|
||
let n2, i3, a2 = 0, s2 = r2, o2 = 0;
|
||
for (; a2 <= s2; ) if (o2 = Math.floor((a2 + s2) / 2), n2 = t2[o2], i3 = t2[o2 + 1], n2 <= e2) {
|
||
if (o2 === r2 || e2 < i3) return o2;
|
||
a2 = o2 + 1;
|
||
} else {
|
||
if (!(n2 > e2)) throw new ue("Input is not a number.");
|
||
s2 = o2 - 1;
|
||
}
|
||
return 0;
|
||
}
|
||
class qe {
|
||
constructor(t2, e2, r2) {
|
||
this.type = t2, this.input = e2, this.labels = [], this.outputs = [];
|
||
for (const [t3, e3] of r2) this.labels.push(t3), this.outputs.push(e3);
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
|
||
if ((t2.length - 1) % 2 != 0) return e2.error("Expected an even number of arguments.");
|
||
const r2 = e2.parse(t2[1], 1, pt);
|
||
if (!r2) return null;
|
||
const n2 = [];
|
||
let i3 = null;
|
||
e2.expectedType && "value" !== e2.expectedType.kind && (i3 = e2.expectedType);
|
||
for (let r3 = 1; r3 < t2.length; r3 += 2) {
|
||
const a2 = 1 === r3 ? -1 / 0 : t2[r3], s2 = t2[r3 + 1], o2 = r3, l2 = r3 + 1;
|
||
if ("number" != typeof a2) return e2.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', o2);
|
||
if (n2.length && n2[n2.length - 1][0] >= a2) return e2.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', o2);
|
||
const u2 = e2.parse(s2, l2, i3);
|
||
if (!u2) return null;
|
||
i3 = i3 || u2.type, n2.push([a2, u2]);
|
||
}
|
||
return new qe(i3, r2, n2);
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.labels, r2 = this.outputs;
|
||
if (1 === e2.length) return r2[0].evaluate(t2);
|
||
const n2 = this.input.evaluate(t2);
|
||
if (n2 <= e2[0]) return r2[0].evaluate(t2);
|
||
const i3 = e2.length;
|
||
return n2 >= e2[i3 - 1] ? r2[i3 - 1].evaluate(t2) : r2[Re(e2, n2)].evaluate(t2);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input);
|
||
for (const e2 of this.outputs) t2(e2);
|
||
}
|
||
outputDefined() {
|
||
return this.outputs.every(((t2) => t2.outputDefined()));
|
||
}
|
||
}
|
||
function je(t2, e2, r2) {
|
||
return t2 + r2 * (e2 - t2);
|
||
}
|
||
function Ne(t2, e2, r2) {
|
||
return t2.map(((t3, n2) => je(t3, e2[n2], r2)));
|
||
}
|
||
const Ze = { number: je, color: function(t2, e2, r2, n2 = "rgb") {
|
||
switch (n2) {
|
||
case "rgb": {
|
||
const [n3, i3, a2, s2] = Ne(t2.rgb, e2.rgb, r2);
|
||
return new Yt(n3, i3, a2, s2, false);
|
||
}
|
||
case "hcl": {
|
||
const [n3, i3, a2, s2] = t2.hcl, [o2, l2, u2, c2] = e2.hcl;
|
||
let h2, p2;
|
||
if (isNaN(n3) || isNaN(o2)) isNaN(n3) ? isNaN(o2) ? h2 = NaN : (h2 = o2, 1 !== a2 && 0 !== a2 || (p2 = l2)) : (h2 = n3, 1 !== u2 && 0 !== u2 || (p2 = i3));
|
||
else {
|
||
let t3 = o2 - n3;
|
||
o2 > n3 && t3 > 180 ? t3 -= 360 : o2 < n3 && n3 - o2 > 180 && (t3 += 360), h2 = n3 + r2 * t3;
|
||
}
|
||
const [f2, d2, y2, m2] = (function([t3, e3, r3, n4]) {
|
||
return t3 = isNaN(t3) ? 0 : t3 * $t, qt([r3, Math.cos(t3) * e3, Math.sin(t3) * e3, n4]);
|
||
})([h2, null != p2 ? p2 : je(i3, l2, r2), je(a2, u2, r2), je(s2, c2, r2)]);
|
||
return new Yt(f2, d2, y2, m2, false);
|
||
}
|
||
case "lab": {
|
||
const [n3, i3, a2, s2] = qt(Ne(t2.lab, e2.lab, r2));
|
||
return new Yt(n3, i3, a2, s2, false);
|
||
}
|
||
}
|
||
}, array: Ne, padding: function(t2, e2, r2) {
|
||
return new te(Ne(t2.values, e2.values, r2));
|
||
}, variableAnchorOffsetCollection: function(t2, e2, r2) {
|
||
const n2 = t2.values, i3 = e2.values;
|
||
if (n2.length !== i3.length) throw new ue(`Cannot interpolate values of different length. from: ${t2.toString()}, to: ${e2.toString()}`);
|
||
const a2 = [];
|
||
for (let t3 = 0; t3 < n2.length; t3 += 2) {
|
||
if (n2[t3] !== i3[t3]) throw new ue(`Cannot interpolate values containing mismatched anchors. from[${t3}]: ${n2[t3]}, to[${t3}]: ${i3[t3]}`);
|
||
a2.push(n2[t3]);
|
||
const [e3, s2] = n2[t3 + 1], [o2, l2] = i3[t3 + 1];
|
||
a2.push([je(e3, o2, r2), je(s2, l2, r2)]);
|
||
}
|
||
return new re(a2);
|
||
} };
|
||
class Ke {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
this.type = t2, this.operator = e2, this.interpolation = r2, this.input = n2, this.labels = [], this.outputs = [];
|
||
for (const [t3, e3] of i3) this.labels.push(t3), this.outputs.push(e3);
|
||
}
|
||
static interpolationFactor(t2, e2, r2, n2) {
|
||
let i3 = 0;
|
||
if ("exponential" === t2.name) i3 = Ge(e2, t2.base, r2, n2);
|
||
else if ("linear" === t2.name) i3 = Ge(e2, 1, r2, n2);
|
||
else if ("cubic-bezier" === t2.name) {
|
||
const a2 = t2.controlPoints;
|
||
i3 = new l(a2[0], a2[1], a2[2], a2[3]).solve(Ge(e2, 1, r2, n2));
|
||
}
|
||
return i3;
|
||
}
|
||
static parse(t2, e2) {
|
||
let [r2, n2, i3, ...a2] = t2;
|
||
if (!Array.isArray(n2) || 0 === n2.length) return e2.error("Expected an interpolation type expression.", 1);
|
||
if ("linear" === n2[0]) n2 = { name: "linear" };
|
||
else if ("exponential" === n2[0]) {
|
||
const t3 = n2[1];
|
||
if ("number" != typeof t3) return e2.error("Exponential interpolation requires a numeric base.", 1, 1);
|
||
n2 = { name: "exponential", base: t3 };
|
||
} else {
|
||
if ("cubic-bezier" !== n2[0]) return e2.error(`Unknown interpolation type ${String(n2[0])}`, 1, 0);
|
||
{
|
||
const t3 = n2.slice(1);
|
||
if (4 !== t3.length || t3.some(((t4) => "number" != typeof t4 || t4 < 0 || t4 > 1))) return e2.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
|
||
n2 = { name: "cubic-bezier", controlPoints: t3 };
|
||
}
|
||
}
|
||
if (t2.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
|
||
if ((t2.length - 1) % 2 != 0) return e2.error("Expected an even number of arguments.");
|
||
if (i3 = e2.parse(i3, 2, pt), !i3) return null;
|
||
const s2 = [];
|
||
let o2 = null;
|
||
"interpolate-hcl" === r2 || "interpolate-lab" === r2 ? o2 = yt : e2.expectedType && "value" !== e2.expectedType.kind && (o2 = e2.expectedType);
|
||
for (let t3 = 0; t3 < a2.length; t3 += 2) {
|
||
const r3 = a2[t3], n3 = a2[t3 + 1], i4 = t3 + 3, l2 = t3 + 4;
|
||
if ("number" != typeof r3) return e2.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', i4);
|
||
if (s2.length && s2[s2.length - 1][0] >= r3) return e2.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', i4);
|
||
const u2 = e2.parse(n3, l2, o2);
|
||
if (!u2) return null;
|
||
o2 = o2 || u2.type, s2.push([r3, u2]);
|
||
}
|
||
return Ct(o2, pt) || Ct(o2, yt) || Ct(o2, bt) || Ct(o2, _t) || Ct(o2, At(pt)) ? new Ke(o2, r2, n2, i3, s2) : e2.error(`Type ${St(o2)} is not interpolatable.`);
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.labels, r2 = this.outputs;
|
||
if (1 === e2.length) return r2[0].evaluate(t2);
|
||
const n2 = this.input.evaluate(t2);
|
||
if (n2 <= e2[0]) return r2[0].evaluate(t2);
|
||
const i3 = e2.length;
|
||
if (n2 >= e2[i3 - 1]) return r2[i3 - 1].evaluate(t2);
|
||
const a2 = Re(e2, n2), s2 = Ke.interpolationFactor(this.interpolation, n2, e2[a2], e2[a2 + 1]), o2 = r2[a2].evaluate(t2), l2 = r2[a2 + 1].evaluate(t2);
|
||
switch (this.operator) {
|
||
case "interpolate":
|
||
return Ze[this.type.kind](o2, l2, s2);
|
||
case "interpolate-hcl":
|
||
return Ze.color(o2, l2, s2, "hcl");
|
||
case "interpolate-lab":
|
||
return Ze.color(o2, l2, s2, "lab");
|
||
}
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input);
|
||
for (const e2 of this.outputs) t2(e2);
|
||
}
|
||
outputDefined() {
|
||
return this.outputs.every(((t2) => t2.outputDefined()));
|
||
}
|
||
}
|
||
function Ge(t2, e2, r2, n2) {
|
||
const i3 = n2 - r2, a2 = t2 - r2;
|
||
return 0 === i3 ? 0 : 1 === e2 ? a2 / i3 : (Math.pow(e2, a2) - 1) / (Math.pow(e2, i3) - 1);
|
||
}
|
||
class Je {
|
||
constructor(t2, e2) {
|
||
this.type = t2, this.args = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 2) return e2.error("Expectected at least one argument.");
|
||
let r2 = null;
|
||
const n2 = e2.expectedType;
|
||
n2 && "value" !== n2.kind && (r2 = n2);
|
||
const i3 = [];
|
||
for (const n3 of t2.slice(1)) {
|
||
const t3 = e2.parse(n3, 1 + i3.length, r2, void 0, { typeAnnotation: "omit" });
|
||
if (!t3) return null;
|
||
r2 = r2 || t3.type, i3.push(t3);
|
||
}
|
||
if (!r2) throw new Error("No output type");
|
||
const a2 = n2 && i3.some(((t3) => It(n2, t3.type)));
|
||
return new Je(a2 ? gt : r2, i3);
|
||
}
|
||
evaluate(t2) {
|
||
let e2, r2 = null, n2 = 0;
|
||
for (const i3 of this.args) if (n2++, r2 = i3.evaluate(t2), r2 && r2 instanceof ne && !r2.available && (e2 || (e2 = r2.name), r2 = null, n2 === this.args.length && (r2 = e2)), null !== r2) break;
|
||
return r2;
|
||
}
|
||
eachChild(t2) {
|
||
this.args.forEach(t2);
|
||
}
|
||
outputDefined() {
|
||
return this.args.every(((t2) => t2.outputDefined()));
|
||
}
|
||
}
|
||
class Xe {
|
||
constructor(t2, e2) {
|
||
this.type = e2.type, this.bindings = [].concat(t2), this.result = e2;
|
||
}
|
||
evaluate(t2) {
|
||
return this.result.evaluate(t2);
|
||
}
|
||
eachChild(t2) {
|
||
for (const e2 of this.bindings) t2(e2[1]);
|
||
t2(this.result);
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 4) return e2.error(`Expected at least 3 arguments, but found ${t2.length - 1} instead.`);
|
||
const r2 = [];
|
||
for (let n3 = 1; n3 < t2.length - 1; n3 += 2) {
|
||
const i3 = t2[n3];
|
||
if ("string" != typeof i3) return e2.error(`Expected string, but found ${typeof i3} instead.`, n3);
|
||
if (/[^a-zA-Z0-9_]/.test(i3)) return e2.error("Variable names must contain only alphanumeric characters or '_'.", n3);
|
||
const a2 = e2.parse(t2[n3 + 1], n3 + 1);
|
||
if (!a2) return null;
|
||
r2.push([i3, a2]);
|
||
}
|
||
const n2 = e2.parse(t2[t2.length - 1], t2.length - 1, e2.expectedType, r2);
|
||
return n2 ? new Xe(r2, n2) : null;
|
||
}
|
||
outputDefined() {
|
||
return this.result.outputDefined();
|
||
}
|
||
}
|
||
class Ye {
|
||
constructor(t2, e2, r2) {
|
||
this.type = t2, this.index = e2, this.input = r2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (3 !== t2.length) return e2.error(`Expected 2 arguments, but found ${t2.length - 1} instead.`);
|
||
const r2 = e2.parse(t2[1], 1, pt), n2 = e2.parse(t2[2], 2, At(e2.expectedType || gt));
|
||
return r2 && n2 ? new Ye(n2.type.itemType, r2, n2) : null;
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.index.evaluate(t2), r2 = this.input.evaluate(t2);
|
||
if (e2 < 0) throw new ue(`Array index out of bounds: ${e2} < 0.`);
|
||
if (e2 >= r2.length) throw new ue(`Array index out of bounds: ${e2} > ${r2.length - 1}.`);
|
||
if (e2 !== Math.floor(e2)) throw new ue(`Array index must be an integer, but found ${e2} instead.`);
|
||
return r2[e2];
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.index), t2(this.input);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class He {
|
||
constructor(t2, e2) {
|
||
this.type = dt, this.needle = t2, this.haystack = e2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (3 !== t2.length) return e2.error(`Expected 2 arguments, but found ${t2.length - 1} instead.`);
|
||
const r2 = e2.parse(t2[1], 1, gt), n2 = e2.parse(t2[2], 2, gt);
|
||
return r2 && n2 ? zt(r2.type, [dt, ft, pt, ht, gt]) ? new He(r2, n2) : e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(r2.type)} instead`) : null;
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.needle.evaluate(t2), r2 = this.haystack.evaluate(t2);
|
||
if (!r2) return false;
|
||
if (!Mt(e2, ["boolean", "string", "number", "null"])) throw new ue(`Expected first argument to be of type boolean, string, number or null, but found ${St(se(e2))} instead.`);
|
||
if (!Mt(r2, ["string", "array"])) throw new ue(`Expected second argument to be of type array or string, but found ${St(se(r2))} instead.`);
|
||
return r2.indexOf(e2) >= 0;
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.needle), t2(this.haystack);
|
||
}
|
||
outputDefined() {
|
||
return true;
|
||
}
|
||
}
|
||
class We {
|
||
constructor(t2, e2, r2) {
|
||
this.type = pt, this.needle = t2, this.haystack = e2, this.fromIndex = r2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length <= 2 || t2.length >= 5) return e2.error(`Expected 3 or 4 arguments, but found ${t2.length - 1} instead.`);
|
||
const r2 = e2.parse(t2[1], 1, gt), n2 = e2.parse(t2[2], 2, gt);
|
||
if (!r2 || !n2) return null;
|
||
if (!zt(r2.type, [dt, ft, pt, ht, gt])) return e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(r2.type)} instead`);
|
||
if (4 === t2.length) {
|
||
const i3 = e2.parse(t2[3], 3, pt);
|
||
return i3 ? new We(r2, n2, i3) : null;
|
||
}
|
||
return new We(r2, n2);
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.needle.evaluate(t2), r2 = this.haystack.evaluate(t2);
|
||
if (!Mt(e2, ["boolean", "string", "number", "null"])) throw new ue(`Expected first argument to be of type boolean, string, number or null, but found ${St(se(e2))} instead.`);
|
||
if (!Mt(r2, ["string", "array"])) throw new ue(`Expected second argument to be of type array or string, but found ${St(se(r2))} instead.`);
|
||
if (this.fromIndex) {
|
||
const n2 = this.fromIndex.evaluate(t2);
|
||
return r2.indexOf(e2, n2);
|
||
}
|
||
return r2.indexOf(e2);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.needle), t2(this.haystack), this.fromIndex && t2(this.fromIndex);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class Qe {
|
||
constructor(t2, e2, r2, n2, i3, a2) {
|
||
this.inputType = t2, this.type = e2, this.input = r2, this.cases = n2, this.outputs = i3, this.otherwise = a2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 5) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
|
||
if (t2.length % 2 != 1) return e2.error("Expected an even number of arguments.");
|
||
let r2, n2;
|
||
e2.expectedType && "value" !== e2.expectedType.kind && (n2 = e2.expectedType);
|
||
const i3 = {}, a2 = [];
|
||
for (let s3 = 2; s3 < t2.length - 1; s3 += 2) {
|
||
let o3 = t2[s3];
|
||
const l2 = t2[s3 + 1];
|
||
Array.isArray(o3) || (o3 = [o3]);
|
||
const u2 = e2.concat(s3);
|
||
if (0 === o3.length) return u2.error("Expected at least one branch label.");
|
||
for (const t3 of o3) {
|
||
if ("number" != typeof t3 && "string" != typeof t3) return u2.error("Branch labels must be numbers or strings.");
|
||
if ("number" == typeof t3 && Math.abs(t3) > Number.MAX_SAFE_INTEGER) return u2.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
|
||
if ("number" == typeof t3 && Math.floor(t3) !== t3) return u2.error("Numeric branch labels must be integer values.");
|
||
if (r2) {
|
||
if (u2.checkSubtype(r2, se(t3))) return null;
|
||
} else r2 = se(t3);
|
||
if (void 0 !== i3[String(t3)]) return u2.error("Branch labels must be unique.");
|
||
i3[String(t3)] = a2.length;
|
||
}
|
||
const c2 = e2.parse(l2, s3, n2);
|
||
if (!c2) return null;
|
||
n2 = n2 || c2.type, a2.push(c2);
|
||
}
|
||
const s2 = e2.parse(t2[1], 1, gt);
|
||
if (!s2) return null;
|
||
const o2 = e2.parse(t2[t2.length - 1], t2.length - 1, n2);
|
||
return o2 ? "value" !== s2.type.kind && e2.concat(1).checkSubtype(r2, s2.type) ? null : new Qe(r2, n2, s2, i3, a2, o2) : null;
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.input.evaluate(t2);
|
||
return (se(e2) === this.inputType && this.outputs[this.cases[e2]] || this.otherwise).evaluate(t2);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input), this.outputs.forEach(t2), t2(this.otherwise);
|
||
}
|
||
outputDefined() {
|
||
return this.outputs.every(((t2) => t2.outputDefined())) && this.otherwise.outputDefined();
|
||
}
|
||
}
|
||
class tr {
|
||
constructor(t2, e2, r2) {
|
||
this.type = t2, this.branches = e2, this.otherwise = r2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 4) return e2.error(`Expected at least 3 arguments, but found only ${t2.length - 1}.`);
|
||
if (t2.length % 2 != 0) return e2.error("Expected an odd number of arguments.");
|
||
let r2;
|
||
e2.expectedType && "value" !== e2.expectedType.kind && (r2 = e2.expectedType);
|
||
const n2 = [];
|
||
for (let i4 = 1; i4 < t2.length - 1; i4 += 2) {
|
||
const a2 = e2.parse(t2[i4], i4, dt);
|
||
if (!a2) return null;
|
||
const s2 = e2.parse(t2[i4 + 1], i4 + 1, r2);
|
||
if (!s2) return null;
|
||
n2.push([a2, s2]), r2 = r2 || s2.type;
|
||
}
|
||
const i3 = e2.parse(t2[t2.length - 1], t2.length - 1, r2);
|
||
if (!i3) return null;
|
||
if (!r2) throw new Error("Can't infer output type");
|
||
return new tr(r2, n2, i3);
|
||
}
|
||
evaluate(t2) {
|
||
for (const [e2, r2] of this.branches) if (e2.evaluate(t2)) return r2.evaluate(t2);
|
||
return this.otherwise.evaluate(t2);
|
||
}
|
||
eachChild(t2) {
|
||
for (const [e2, r2] of this.branches) t2(e2), t2(r2);
|
||
t2(this.otherwise);
|
||
}
|
||
outputDefined() {
|
||
return this.branches.every((([t2, e2]) => e2.outputDefined())) && this.otherwise.outputDefined();
|
||
}
|
||
}
|
||
class er {
|
||
constructor(t2, e2, r2, n2) {
|
||
this.type = t2, this.input = e2, this.beginIndex = r2, this.endIndex = n2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length <= 2 || t2.length >= 5) return e2.error(`Expected 3 or 4 arguments, but found ${t2.length - 1} instead.`);
|
||
const r2 = e2.parse(t2[1], 1, gt), n2 = e2.parse(t2[2], 2, pt);
|
||
if (!r2 || !n2) return null;
|
||
if (!zt(r2.type, [At(gt), ft, gt])) return e2.error(`Expected first argument to be of type array or string, but found ${St(r2.type)} instead`);
|
||
if (4 === t2.length) {
|
||
const i3 = e2.parse(t2[3], 3, pt);
|
||
return i3 ? new er(r2.type, r2, n2, i3) : null;
|
||
}
|
||
return new er(r2.type, r2, n2);
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.input.evaluate(t2), r2 = this.beginIndex.evaluate(t2);
|
||
if (!Mt(e2, ["string", "array"])) throw new ue(`Expected first argument to be of type array or string, but found ${St(se(e2))} instead.`);
|
||
if (this.endIndex) {
|
||
const n2 = this.endIndex.evaluate(t2);
|
||
return e2.slice(r2, n2);
|
||
}
|
||
return e2.slice(r2);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input), t2(this.beginIndex), this.endIndex && t2(this.endIndex);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
function rr(t2, e2) {
|
||
return "==" === t2 || "!=" === t2 ? "boolean" === e2.kind || "string" === e2.kind || "number" === e2.kind || "null" === e2.kind || "value" === e2.kind : "string" === e2.kind || "number" === e2.kind || "value" === e2.kind;
|
||
}
|
||
function nr(t2, e2, r2, n2) {
|
||
return 0 === n2.compare(e2, r2);
|
||
}
|
||
function ir(t2, e2, r2) {
|
||
const n2 = "==" !== t2 && "!=" !== t2;
|
||
return class i3 {
|
||
constructor(t3, e3, r3) {
|
||
this.type = dt, this.lhs = t3, this.rhs = e3, this.collator = r3, this.hasUntypedArgument = "value" === t3.type.kind || "value" === e3.type.kind;
|
||
}
|
||
static parse(t3, e3) {
|
||
if (3 !== t3.length && 4 !== t3.length) return e3.error("Expected two or three arguments.");
|
||
const r3 = t3[0];
|
||
let a2 = e3.parse(t3[1], 1, gt);
|
||
if (!a2) return null;
|
||
if (!rr(r3, a2.type)) return e3.concat(1).error(`"${r3}" comparisons are not supported for type '${St(a2.type)}'.`);
|
||
let s2 = e3.parse(t3[2], 2, gt);
|
||
if (!s2) return null;
|
||
if (!rr(r3, s2.type)) return e3.concat(2).error(`"${r3}" comparisons are not supported for type '${St(s2.type)}'.`);
|
||
if (a2.type.kind !== s2.type.kind && "value" !== a2.type.kind && "value" !== s2.type.kind) return e3.error(`Cannot compare types '${St(a2.type)}' and '${St(s2.type)}'.`);
|
||
n2 && ("value" === a2.type.kind && "value" !== s2.type.kind ? a2 = new he(s2.type, [a2]) : "value" !== a2.type.kind && "value" === s2.type.kind && (s2 = new he(a2.type, [s2])));
|
||
let o2 = null;
|
||
if (4 === t3.length) {
|
||
if ("string" !== a2.type.kind && "string" !== s2.type.kind && "value" !== a2.type.kind && "value" !== s2.type.kind) return e3.error("Cannot use collator to compare non-string types.");
|
||
if (o2 = e3.parse(t3[3], 3, xt), !o2) return null;
|
||
}
|
||
return new i3(a2, s2, o2);
|
||
}
|
||
evaluate(i4) {
|
||
const a2 = this.lhs.evaluate(i4), s2 = this.rhs.evaluate(i4);
|
||
if (n2 && this.hasUntypedArgument) {
|
||
const e3 = se(a2), r3 = se(s2);
|
||
if (e3.kind !== r3.kind || "string" !== e3.kind && "number" !== e3.kind) throw new ue(`Expected arguments for "${t2}" to be (string, string) or (number, number), but found (${e3.kind}, ${r3.kind}) instead.`);
|
||
}
|
||
if (this.collator && !n2 && this.hasUntypedArgument) {
|
||
const t3 = se(a2), r3 = se(s2);
|
||
if ("string" !== t3.kind || "string" !== r3.kind) return e2(i4, a2, s2);
|
||
}
|
||
return this.collator ? r2(i4, a2, s2, this.collator.evaluate(i4)) : e2(i4, a2, s2);
|
||
}
|
||
eachChild(t3) {
|
||
t3(this.lhs), t3(this.rhs), this.collator && t3(this.collator);
|
||
}
|
||
outputDefined() {
|
||
return true;
|
||
}
|
||
};
|
||
}
|
||
const ar = ir("==", (function(t2, e2, r2) {
|
||
return e2 === r2;
|
||
}), nr), sr = ir("!=", (function(t2, e2, r2) {
|
||
return e2 !== r2;
|
||
}), (function(t2, e2, r2, n2) {
|
||
return !nr(0, e2, r2, n2);
|
||
})), or = ir("<", (function(t2, e2, r2) {
|
||
return e2 < r2;
|
||
}), (function(t2, e2, r2, n2) {
|
||
return n2.compare(e2, r2) < 0;
|
||
})), lr = ir(">", (function(t2, e2, r2) {
|
||
return e2 > r2;
|
||
}), (function(t2, e2, r2, n2) {
|
||
return n2.compare(e2, r2) > 0;
|
||
})), ur = ir("<=", (function(t2, e2, r2) {
|
||
return e2 <= r2;
|
||
}), (function(t2, e2, r2, n2) {
|
||
return n2.compare(e2, r2) <= 0;
|
||
})), cr = ir(">=", (function(t2, e2, r2) {
|
||
return e2 >= r2;
|
||
}), (function(t2, e2, r2, n2) {
|
||
return n2.compare(e2, r2) >= 0;
|
||
}));
|
||
class hr {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
this.type = ft, this.number = t2, this.locale = e2, this.currency = r2, this.minFractionDigits = n2, this.maxFractionDigits = i3;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (3 !== t2.length) return e2.error("Expected two arguments.");
|
||
const r2 = e2.parse(t2[1], 1, pt);
|
||
if (!r2) return null;
|
||
const n2 = t2[2];
|
||
if ("object" != typeof n2 || Array.isArray(n2)) return e2.error("NumberFormat options argument must be an object.");
|
||
let i3 = null;
|
||
if (n2.locale && (i3 = e2.parse(n2.locale, 1, ft), !i3)) return null;
|
||
let a2 = null;
|
||
if (n2.currency && (a2 = e2.parse(n2.currency, 1, ft), !a2)) return null;
|
||
let s2 = null;
|
||
if (n2["min-fraction-digits"] && (s2 = e2.parse(n2["min-fraction-digits"], 1, pt), !s2)) return null;
|
||
let o2 = null;
|
||
return n2["max-fraction-digits"] && (o2 = e2.parse(n2["max-fraction-digits"], 1, pt), !o2) ? null : new hr(r2, i3, a2, s2, o2);
|
||
}
|
||
evaluate(t2) {
|
||
return new Intl.NumberFormat(this.locale ? this.locale.evaluate(t2) : [], { style: this.currency ? "currency" : "decimal", currency: this.currency ? this.currency.evaluate(t2) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(t2) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(t2) : void 0 }).format(this.number.evaluate(t2));
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.number), this.locale && t2(this.locale), this.currency && t2(this.currency), this.minFractionDigits && t2(this.minFractionDigits), this.maxFractionDigits && t2(this.maxFractionDigits);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class pr {
|
||
constructor(t2) {
|
||
this.type = vt, this.sections = t2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (t2.length < 2) return e2.error("Expected at least one argument.");
|
||
const r2 = t2[1];
|
||
if (!Array.isArray(r2) && "object" == typeof r2) return e2.error("First argument must be an image or text section.");
|
||
const n2 = [];
|
||
let i3 = false;
|
||
for (let r3 = 1; r3 <= t2.length - 1; ++r3) {
|
||
const a2 = t2[r3];
|
||
if (i3 && "object" == typeof a2 && !Array.isArray(a2)) {
|
||
i3 = false;
|
||
let t3 = null;
|
||
if (a2["font-scale"] && (t3 = e2.parse(a2["font-scale"], 1, pt), !t3)) return null;
|
||
let r4 = null;
|
||
if (a2["text-font"] && (r4 = e2.parse(a2["text-font"], 1, At(ft)), !r4)) return null;
|
||
let s2 = null;
|
||
if (a2["text-color"] && (s2 = e2.parse(a2["text-color"], 1, yt), !s2)) return null;
|
||
const o2 = n2[n2.length - 1];
|
||
o2.scale = t3, o2.font = r4, o2.textColor = s2;
|
||
} else {
|
||
const a3 = e2.parse(t2[r3], 1, gt);
|
||
if (!a3) return null;
|
||
const s2 = a3.type.kind;
|
||
if ("string" !== s2 && "value" !== s2 && "null" !== s2 && "resolvedImage" !== s2) return e2.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
|
||
i3 = true, n2.push({ content: a3, scale: null, font: null, textColor: null });
|
||
}
|
||
}
|
||
return new pr(n2);
|
||
}
|
||
evaluate(t2) {
|
||
return new Qt(this.sections.map(((e2) => {
|
||
const r2 = e2.content.evaluate(t2);
|
||
return se(r2) === wt ? new Wt("", r2, null, null, null) : new Wt(oe(r2), null, e2.scale ? e2.scale.evaluate(t2) : null, e2.font ? e2.font.evaluate(t2).join(",") : null, e2.textColor ? e2.textColor.evaluate(t2) : null);
|
||
})));
|
||
}
|
||
eachChild(t2) {
|
||
for (const e2 of this.sections) t2(e2.content), e2.scale && t2(e2.scale), e2.font && t2(e2.font), e2.textColor && t2(e2.textColor);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class fr {
|
||
constructor(t2) {
|
||
this.type = wt, this.input = t2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length) return e2.error("Expected two arguments.");
|
||
const r2 = e2.parse(t2[1], 1, ft);
|
||
return r2 ? new fr(r2) : e2.error("No image name provided.");
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.input.evaluate(t2), r2 = ne.fromString(e2);
|
||
return r2 && t2.availableImages && (r2.available = t2.availableImages.indexOf(e2) > -1), r2;
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
class dr {
|
||
constructor(t2) {
|
||
this.type = pt, this.input = t2;
|
||
}
|
||
static parse(t2, e2) {
|
||
if (2 !== t2.length) return e2.error(`Expected 1 argument, but found ${t2.length - 1} instead.`);
|
||
const r2 = e2.parse(t2[1], 1);
|
||
return r2 ? "array" !== r2.type.kind && "string" !== r2.type.kind && "value" !== r2.type.kind ? e2.error(`Expected argument of type string or array, but found ${St(r2.type)} instead.`) : new dr(r2) : null;
|
||
}
|
||
evaluate(t2) {
|
||
const e2 = this.input.evaluate(t2);
|
||
if ("string" == typeof e2) return e2.length;
|
||
if (Array.isArray(e2)) return e2.length;
|
||
throw new ue(`Expected value to be of type string or array, but found ${St(se(e2))} instead.`);
|
||
}
|
||
eachChild(t2) {
|
||
t2(this.input);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
}
|
||
const yr = { "==": ar, "!=": sr, ">": lr, "<": or, ">=": cr, "<=": ur, array: he, at: Ye, boolean: he, case: tr, coalesce: Je, collator: ge, format: pr, image: fr, in: He, "index-of": We, interpolate: Ke, "interpolate-hcl": Ke, "interpolate-lab": Ke, length: dr, let: Xe, literal: le, match: Qe, number: he, "number-format": hr, object: he, slice: er, step: qe, string: he, "to-boolean": fe, "to-color": fe, "to-number": fe, "to-string": fe, var: Te, within: Fe };
|
||
function mr(t2, [e2, r2, n2, i3]) {
|
||
e2 = e2.evaluate(t2), r2 = r2.evaluate(t2), n2 = n2.evaluate(t2);
|
||
const a2 = i3 ? i3.evaluate(t2) : 1, s2 = ie(e2, r2, n2, a2);
|
||
if (s2) throw new ue(s2);
|
||
return new Yt(e2 / 255, r2 / 255, n2 / 255, a2, false);
|
||
}
|
||
function gr(t2, e2) {
|
||
return t2 in e2;
|
||
}
|
||
function xr(t2, e2) {
|
||
const r2 = e2[t2];
|
||
return void 0 === r2 ? null : r2;
|
||
}
|
||
function vr(t2) {
|
||
return { type: t2 };
|
||
}
|
||
function br(t2) {
|
||
return { result: "success", value: t2 };
|
||
}
|
||
function wr(t2) {
|
||
return { result: "error", value: t2 };
|
||
}
|
||
function _r(t2) {
|
||
return "data-driven" === t2["property-type"] || "cross-faded-data-driven" === t2["property-type"];
|
||
}
|
||
function Ar(t2) {
|
||
return !!t2.expression && t2.expression.parameters.indexOf("zoom") > -1;
|
||
}
|
||
function Sr(t2) {
|
||
return !!t2.expression && t2.expression.interpolated;
|
||
}
|
||
function kr(t2) {
|
||
return t2 instanceof Number ? "number" : t2 instanceof String ? "string" : t2 instanceof Boolean ? "boolean" : Array.isArray(t2) ? "array" : null === t2 ? "null" : typeof t2;
|
||
}
|
||
function Ir(t2) {
|
||
return "object" == typeof t2 && null !== t2 && !Array.isArray(t2);
|
||
}
|
||
function zr(t2) {
|
||
return t2;
|
||
}
|
||
function Mr(t2, e2) {
|
||
const r2 = "color" === e2.type, n2 = t2.stops && "object" == typeof t2.stops[0][0], i3 = n2 || !(n2 || void 0 !== t2.property), a2 = t2.type || (Sr(e2) ? "exponential" : "interval");
|
||
if (r2 || "padding" === e2.type) {
|
||
const n3 = r2 ? Yt.parse : te.parse;
|
||
(t2 = lt({}, t2)).stops && (t2.stops = t2.stops.map(((t3) => [t3[0], n3(t3[1])]))), t2.default = n3(t2.default ? t2.default : e2.default);
|
||
}
|
||
if (t2.colorSpace && "rgb" !== (s2 = t2.colorSpace) && "hcl" !== s2 && "lab" !== s2) throw new Error(`Unknown color space: "${t2.colorSpace}"`);
|
||
var s2;
|
||
let o2, l2, u2;
|
||
if ("exponential" === a2) o2 = Vr;
|
||
else if ("interval" === a2) o2 = Pr;
|
||
else if ("categorical" === a2) {
|
||
o2 = Br, l2 = /* @__PURE__ */ Object.create(null);
|
||
for (const e3 of t2.stops) l2[e3[0]] = e3[1];
|
||
u2 = typeof t2.stops[0][0];
|
||
} else {
|
||
if ("identity" !== a2) throw new Error(`Unknown function type "${a2}"`);
|
||
o2 = Er;
|
||
}
|
||
if (n2) {
|
||
const r3 = {}, n3 = [];
|
||
for (let e3 = 0; e3 < t2.stops.length; e3++) {
|
||
const i5 = t2.stops[e3], a4 = i5[0].zoom;
|
||
void 0 === r3[a4] && (r3[a4] = { zoom: a4, type: t2.type, property: t2.property, default: t2.default, stops: [] }, n3.push(a4)), r3[a4].stops.push([i5[0].value, i5[1]]);
|
||
}
|
||
const i4 = [];
|
||
for (const t3 of n3) i4.push([r3[t3].zoom, Mr(r3[t3], e2)]);
|
||
const a3 = { name: "linear" };
|
||
return { kind: "composite", interpolationType: a3, interpolationFactor: Ke.interpolationFactor.bind(void 0, a3), zoomStops: i4.map(((t3) => t3[0])), evaluate: ({ zoom: r4 }, n4) => Vr({ stops: i4, base: t2.base }, e2, r4).evaluate(r4, n4) };
|
||
}
|
||
if (i3) {
|
||
const r3 = "exponential" === a2 ? { name: "exponential", base: void 0 !== t2.base ? t2.base : 1 } : null;
|
||
return { kind: "camera", interpolationType: r3, interpolationFactor: Ke.interpolationFactor.bind(void 0, r3), zoomStops: t2.stops.map(((t3) => t3[0])), evaluate: ({ zoom: r4 }) => o2(t2, e2, r4, l2, u2) };
|
||
}
|
||
return { kind: "source", evaluate(r3, n3) {
|
||
const i4 = n3 && n3.properties ? n3.properties[t2.property] : void 0;
|
||
return void 0 === i4 ? Cr(t2.default, e2.default) : o2(t2, e2, i4, l2, u2);
|
||
} };
|
||
}
|
||
function Cr(t2, e2, r2) {
|
||
return void 0 !== t2 ? t2 : void 0 !== e2 ? e2 : void 0 !== r2 ? r2 : void 0;
|
||
}
|
||
function Br(t2, e2, r2, n2, i3) {
|
||
return Cr(typeof r2 === i3 ? n2[r2] : void 0, t2.default, e2.default);
|
||
}
|
||
function Pr(t2, e2, r2) {
|
||
if ("number" !== kr(r2)) return Cr(t2.default, e2.default);
|
||
const n2 = t2.stops.length;
|
||
if (1 === n2) return t2.stops[0][1];
|
||
if (r2 <= t2.stops[0][0]) return t2.stops[0][1];
|
||
if (r2 >= t2.stops[n2 - 1][0]) return t2.stops[n2 - 1][1];
|
||
const i3 = Re(t2.stops.map(((t3) => t3[0])), r2);
|
||
return t2.stops[i3][1];
|
||
}
|
||
function Vr(t2, e2, r2) {
|
||
const n2 = void 0 !== t2.base ? t2.base : 1;
|
||
if ("number" !== kr(r2)) return Cr(t2.default, e2.default);
|
||
const i3 = t2.stops.length;
|
||
if (1 === i3) return t2.stops[0][1];
|
||
if (r2 <= t2.stops[0][0]) return t2.stops[0][1];
|
||
if (r2 >= t2.stops[i3 - 1][0]) return t2.stops[i3 - 1][1];
|
||
const a2 = Re(t2.stops.map(((t3) => t3[0])), r2), s2 = (function(t3, e3, r3, n3) {
|
||
const i4 = n3 - r3, a3 = t3 - r3;
|
||
return 0 === i4 ? 0 : 1 === e3 ? a3 / i4 : (Math.pow(e3, a3) - 1) / (Math.pow(e3, i4) - 1);
|
||
})(r2, n2, t2.stops[a2][0], t2.stops[a2 + 1][0]), o2 = t2.stops[a2][1], l2 = t2.stops[a2 + 1][1], u2 = Ze[e2.type] || zr;
|
||
return "function" == typeof o2.evaluate ? { evaluate(...e3) {
|
||
const r3 = o2.evaluate.apply(void 0, e3), n3 = l2.evaluate.apply(void 0, e3);
|
||
if (void 0 !== r3 && void 0 !== n3) return u2(r3, n3, s2, t2.colorSpace);
|
||
} } : u2(o2, l2, s2, t2.colorSpace);
|
||
}
|
||
function Er(t2, e2, r2) {
|
||
switch (e2.type) {
|
||
case "color":
|
||
r2 = Yt.parse(r2);
|
||
break;
|
||
case "formatted":
|
||
r2 = Qt.fromString(r2.toString());
|
||
break;
|
||
case "resolvedImage":
|
||
r2 = ne.fromString(r2.toString());
|
||
break;
|
||
case "padding":
|
||
r2 = te.parse(r2);
|
||
break;
|
||
default:
|
||
kr(r2) === e2.type || "enum" === e2.type && e2.values[r2] || (r2 = void 0);
|
||
}
|
||
return Cr(r2, t2.default, e2.default);
|
||
}
|
||
$e.register(yr, { error: [{ kind: "error" }, [ft], (t2, [e2]) => {
|
||
throw new ue(e2.evaluate(t2));
|
||
}], typeof: [ft, [gt], (t2, [e2]) => St(se(e2.evaluate(t2)))], "to-rgba": [At(pt, 4), [yt], (t2, [e2]) => {
|
||
const [r2, n2, i3, a2] = e2.evaluate(t2).rgb;
|
||
return [255 * r2, 255 * n2, 255 * i3, a2];
|
||
}], rgb: [yt, [pt, pt, pt], mr], rgba: [yt, [pt, pt, pt, pt], mr], has: { type: dt, overloads: [[[ft], (t2, [e2]) => gr(e2.evaluate(t2), t2.properties())], [[ft, mt], (t2, [e2, r2]) => gr(e2.evaluate(t2), r2.evaluate(t2))]] }, get: { type: gt, overloads: [[[ft], (t2, [e2]) => xr(e2.evaluate(t2), t2.properties())], [[ft, mt], (t2, [e2, r2]) => xr(e2.evaluate(t2), r2.evaluate(t2))]] }, "feature-state": [gt, [ft], (t2, [e2]) => xr(e2.evaluate(t2), t2.featureState || {})], properties: [mt, [], (t2) => t2.properties()], "geometry-type": [ft, [], (t2) => t2.geometryType()], id: [gt, [], (t2) => t2.id()], zoom: [pt, [], (t2) => t2.globals.zoom], "heatmap-density": [pt, [], (t2) => t2.globals.heatmapDensity || 0], "line-progress": [pt, [], (t2) => t2.globals.lineProgress || 0], accumulated: [gt, [], (t2) => void 0 === t2.globals.accumulated ? null : t2.globals.accumulated], "+": [pt, vr(pt), (t2, e2) => {
|
||
let r2 = 0;
|
||
for (const n2 of e2) r2 += n2.evaluate(t2);
|
||
return r2;
|
||
}], "*": [pt, vr(pt), (t2, e2) => {
|
||
let r2 = 1;
|
||
for (const n2 of e2) r2 *= n2.evaluate(t2);
|
||
return r2;
|
||
}], "-": { type: pt, overloads: [[[pt, pt], (t2, [e2, r2]) => e2.evaluate(t2) - r2.evaluate(t2)], [[pt], (t2, [e2]) => -e2.evaluate(t2)]] }, "/": [pt, [pt, pt], (t2, [e2, r2]) => e2.evaluate(t2) / r2.evaluate(t2)], "%": [pt, [pt, pt], (t2, [e2, r2]) => e2.evaluate(t2) % r2.evaluate(t2)], ln2: [pt, [], () => Math.LN2], pi: [pt, [], () => Math.PI], e: [pt, [], () => Math.E], "^": [pt, [pt, pt], (t2, [e2, r2]) => Math.pow(e2.evaluate(t2), r2.evaluate(t2))], sqrt: [pt, [pt], (t2, [e2]) => Math.sqrt(e2.evaluate(t2))], log10: [pt, [pt], (t2, [e2]) => Math.log(e2.evaluate(t2)) / Math.LN10], ln: [pt, [pt], (t2, [e2]) => Math.log(e2.evaluate(t2))], log2: [pt, [pt], (t2, [e2]) => Math.log(e2.evaluate(t2)) / Math.LN2], sin: [pt, [pt], (t2, [e2]) => Math.sin(e2.evaluate(t2))], cos: [pt, [pt], (t2, [e2]) => Math.cos(e2.evaluate(t2))], tan: [pt, [pt], (t2, [e2]) => Math.tan(e2.evaluate(t2))], asin: [pt, [pt], (t2, [e2]) => Math.asin(e2.evaluate(t2))], acos: [pt, [pt], (t2, [e2]) => Math.acos(e2.evaluate(t2))], atan: [pt, [pt], (t2, [e2]) => Math.atan(e2.evaluate(t2))], min: [pt, vr(pt), (t2, e2) => Math.min(...e2.map(((e3) => e3.evaluate(t2))))], max: [pt, vr(pt), (t2, e2) => Math.max(...e2.map(((e3) => e3.evaluate(t2))))], abs: [pt, [pt], (t2, [e2]) => Math.abs(e2.evaluate(t2))], round: [pt, [pt], (t2, [e2]) => {
|
||
const r2 = e2.evaluate(t2);
|
||
return r2 < 0 ? -Math.round(-r2) : Math.round(r2);
|
||
}], floor: [pt, [pt], (t2, [e2]) => Math.floor(e2.evaluate(t2))], ceil: [pt, [pt], (t2, [e2]) => Math.ceil(e2.evaluate(t2))], "filter-==": [dt, [ft, gt], (t2, [e2, r2]) => t2.properties()[e2.value] === r2.value], "filter-id-==": [dt, [gt], (t2, [e2]) => t2.id() === e2.value], "filter-type-==": [dt, [ft], (t2, [e2]) => t2.geometryType() === e2.value], "filter-<": [dt, [ft, gt], (t2, [e2, r2]) => {
|
||
const n2 = t2.properties()[e2.value], i3 = r2.value;
|
||
return typeof n2 == typeof i3 && n2 < i3;
|
||
}], "filter-id-<": [dt, [gt], (t2, [e2]) => {
|
||
const r2 = t2.id(), n2 = e2.value;
|
||
return typeof r2 == typeof n2 && r2 < n2;
|
||
}], "filter->": [dt, [ft, gt], (t2, [e2, r2]) => {
|
||
const n2 = t2.properties()[e2.value], i3 = r2.value;
|
||
return typeof n2 == typeof i3 && n2 > i3;
|
||
}], "filter-id->": [dt, [gt], (t2, [e2]) => {
|
||
const r2 = t2.id(), n2 = e2.value;
|
||
return typeof r2 == typeof n2 && r2 > n2;
|
||
}], "filter-<=": [dt, [ft, gt], (t2, [e2, r2]) => {
|
||
const n2 = t2.properties()[e2.value], i3 = r2.value;
|
||
return typeof n2 == typeof i3 && n2 <= i3;
|
||
}], "filter-id-<=": [dt, [gt], (t2, [e2]) => {
|
||
const r2 = t2.id(), n2 = e2.value;
|
||
return typeof r2 == typeof n2 && r2 <= n2;
|
||
}], "filter->=": [dt, [ft, gt], (t2, [e2, r2]) => {
|
||
const n2 = t2.properties()[e2.value], i3 = r2.value;
|
||
return typeof n2 == typeof i3 && n2 >= i3;
|
||
}], "filter-id->=": [dt, [gt], (t2, [e2]) => {
|
||
const r2 = t2.id(), n2 = e2.value;
|
||
return typeof r2 == typeof n2 && r2 >= n2;
|
||
}], "filter-has": [dt, [gt], (t2, [e2]) => e2.value in t2.properties()], "filter-has-id": [dt, [], (t2) => null !== t2.id() && void 0 !== t2.id()], "filter-type-in": [dt, [At(ft)], (t2, [e2]) => e2.value.indexOf(t2.geometryType()) >= 0], "filter-id-in": [dt, [At(gt)], (t2, [e2]) => e2.value.indexOf(t2.id()) >= 0], "filter-in-small": [dt, [ft, At(gt)], (t2, [e2, r2]) => r2.value.indexOf(t2.properties()[e2.value]) >= 0], "filter-in-large": [dt, [ft, At(gt)], (t2, [e2, r2]) => (function(t3, e3, r3, n2) {
|
||
for (; r3 <= n2; ) {
|
||
const i3 = r3 + n2 >> 1;
|
||
if (e3[i3] === t3) return true;
|
||
e3[i3] > t3 ? n2 = i3 - 1 : r3 = i3 + 1;
|
||
}
|
||
return false;
|
||
})(t2.properties()[e2.value], r2.value, 0, r2.value.length - 1)], all: { type: dt, overloads: [[[dt, dt], (t2, [e2, r2]) => e2.evaluate(t2) && r2.evaluate(t2)], [vr(dt), (t2, e2) => {
|
||
for (const r2 of e2) if (!r2.evaluate(t2)) return false;
|
||
return true;
|
||
}]] }, any: { type: dt, overloads: [[[dt, dt], (t2, [e2, r2]) => e2.evaluate(t2) || r2.evaluate(t2)], [vr(dt), (t2, e2) => {
|
||
for (const r2 of e2) if (r2.evaluate(t2)) return true;
|
||
return false;
|
||
}]] }, "!": [dt, [dt], (t2, [e2]) => !e2.evaluate(t2)], "is-supported-script": [dt, [ft], (t2, [e2]) => {
|
||
const r2 = t2.globals && t2.globals.isSupportedScript;
|
||
return !r2 || r2(e2.evaluate(t2));
|
||
}], upcase: [ft, [ft], (t2, [e2]) => e2.evaluate(t2).toUpperCase()], downcase: [ft, [ft], (t2, [e2]) => e2.evaluate(t2).toLowerCase()], concat: [ft, vr(gt), (t2, e2) => e2.map(((e3) => oe(e3.evaluate(t2)))).join("")], "resolved-locale": [ft, [xt], (t2, [e2]) => e2.evaluate(t2).resolvedLocale()] });
|
||
class Fr {
|
||
constructor(t2, e2) {
|
||
var r2;
|
||
this.expression = t2, this._warningHistory = {}, this._evaluator = new ye(), this._defaultValue = e2 ? "color" === (r2 = e2).type && Ir(r2.default) ? new Yt(0, 0, 0, 0) : "color" === r2.type ? Yt.parse(r2.default) || null : "padding" === r2.type ? te.parse(r2.default) || null : "variableAnchorOffsetCollection" === r2.type ? re.parse(r2.default) || null : void 0 === r2.default ? null : r2.default : null, this._enumValues = e2 && "enum" === e2.type ? e2.values : null;
|
||
}
|
||
evaluateWithoutErrorHandling(t2, e2, r2, n2, i3, a2) {
|
||
return this._evaluator.globals = t2, this._evaluator.feature = e2, this._evaluator.featureState = r2, this._evaluator.canonical = n2, this._evaluator.availableImages = i3 || null, this._evaluator.formattedSection = a2, this.expression.evaluate(this._evaluator);
|
||
}
|
||
evaluate(t2, e2, r2, n2, i3, a2) {
|
||
this._evaluator.globals = t2, this._evaluator.feature = e2 || null, this._evaluator.featureState = r2 || null, this._evaluator.canonical = n2, this._evaluator.availableImages = i3 || null, this._evaluator.formattedSection = a2 || null;
|
||
try {
|
||
const t3 = this.expression.evaluate(this._evaluator);
|
||
if (null == t3 || "number" == typeof t3 && t3 != t3) return this._defaultValue;
|
||
if (this._enumValues && !(t3 in this._enumValues)) throw new ue(`Expected value to be one of ${Object.keys(this._enumValues).map(((t4) => JSON.stringify(t4))).join(", ")}, but found ${JSON.stringify(t3)} instead.`);
|
||
return t3;
|
||
} catch (t3) {
|
||
return this._warningHistory[t3.message] || (this._warningHistory[t3.message] = true, "undefined" != typeof console && console.warn(t3.message)), this._defaultValue;
|
||
}
|
||
}
|
||
}
|
||
function Tr(t2) {
|
||
return Array.isArray(t2) && t2.length > 0 && "string" == typeof t2[0] && t2[0] in yr;
|
||
}
|
||
function $r(t2, e2) {
|
||
const r2 = new me(yr, Le, [], e2 ? (function(t3) {
|
||
const e3 = { color: yt, string: ft, number: pt, enum: ft, boolean: dt, formatted: vt, padding: bt, resolvedImage: wt, variableAnchorOffsetCollection: _t };
|
||
return "array" === t3.type ? At(e3[t3.value] || gt, t3.length) : e3[t3.type];
|
||
})(e2) : void 0), n2 = r2.parse(t2, void 0, void 0, void 0, e2 && "string" === e2.type ? { typeAnnotation: "coerce" } : void 0);
|
||
return n2 ? br(new Fr(n2, e2)) : wr(r2.errors);
|
||
}
|
||
class Lr {
|
||
constructor(t2, e2) {
|
||
this.kind = t2, this._styleExpression = e2, this.isStateDependent = "constant" !== t2 && !Oe(e2.expression);
|
||
}
|
||
evaluateWithoutErrorHandling(t2, e2, r2, n2, i3, a2) {
|
||
return this._styleExpression.evaluateWithoutErrorHandling(t2, e2, r2, n2, i3, a2);
|
||
}
|
||
evaluate(t2, e2, r2, n2, i3, a2) {
|
||
return this._styleExpression.evaluate(t2, e2, r2, n2, i3, a2);
|
||
}
|
||
}
|
||
class Dr {
|
||
constructor(t2, e2, r2, n2) {
|
||
this.kind = t2, this.zoomStops = r2, this._styleExpression = e2, this.isStateDependent = "camera" !== t2 && !Oe(e2.expression), this.interpolationType = n2;
|
||
}
|
||
evaluateWithoutErrorHandling(t2, e2, r2, n2, i3, a2) {
|
||
return this._styleExpression.evaluateWithoutErrorHandling(t2, e2, r2, n2, i3, a2);
|
||
}
|
||
evaluate(t2, e2, r2, n2, i3, a2) {
|
||
return this._styleExpression.evaluate(t2, e2, r2, n2, i3, a2);
|
||
}
|
||
interpolationFactor(t2, e2, r2) {
|
||
return this.interpolationType ? Ke.interpolationFactor(this.interpolationType, t2, e2, r2) : 0;
|
||
}
|
||
}
|
||
function Or(t2, e2) {
|
||
const r2 = $r(t2, e2);
|
||
if ("error" === r2.result) return r2;
|
||
const n2 = r2.value.expression, i3 = De(n2);
|
||
if (!i3 && !_r(e2)) return wr([new ut("", "data expressions not supported")]);
|
||
const a2 = Ue(n2, ["zoom"]);
|
||
if (!a2 && !Ar(e2)) return wr([new ut("", "zoom expressions not supported")]);
|
||
const s2 = Rr(n2);
|
||
return s2 || a2 ? s2 instanceof ut ? wr([s2]) : s2 instanceof Ke && !Sr(e2) ? wr([new ut("", '"interpolate" expressions cannot be used with this property')]) : br(s2 ? new Dr(i3 ? "camera" : "composite", r2.value, s2.labels, s2 instanceof Ke ? s2.interpolation : void 0) : new Lr(i3 ? "constant" : "source", r2.value)) : wr([new ut("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
|
||
}
|
||
class Ur {
|
||
constructor(t2, e2) {
|
||
this._parameters = t2, this._specification = e2, lt(this, Mr(this._parameters, this._specification));
|
||
}
|
||
static deserialize(t2) {
|
||
return new Ur(t2._parameters, t2._specification);
|
||
}
|
||
static serialize(t2) {
|
||
return { _parameters: t2._parameters, _specification: t2._specification };
|
||
}
|
||
}
|
||
function Rr(t2) {
|
||
let e2 = null;
|
||
if (t2 instanceof Xe) e2 = Rr(t2.result);
|
||
else if (t2 instanceof Je) {
|
||
for (const r2 of t2.args) if (e2 = Rr(r2), e2) break;
|
||
} else (t2 instanceof qe || t2 instanceof Ke) && t2.input instanceof $e && "zoom" === t2.input.name && (e2 = t2);
|
||
return e2 instanceof ut || t2.eachChild(((t3) => {
|
||
const r2 = Rr(t3);
|
||
r2 instanceof ut ? e2 = r2 : !e2 && r2 ? e2 = new ut("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : e2 && r2 && e2 !== r2 && (e2 = new ut("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));
|
||
})), e2;
|
||
}
|
||
function qr(t2) {
|
||
if (true === t2 || false === t2) return true;
|
||
if (!Array.isArray(t2) || 0 === t2.length) return false;
|
||
switch (t2[0]) {
|
||
case "has":
|
||
return t2.length >= 2 && "$id" !== t2[1] && "$type" !== t2[1];
|
||
case "in":
|
||
return t2.length >= 3 && ("string" != typeof t2[1] || Array.isArray(t2[2]));
|
||
case "!in":
|
||
case "!has":
|
||
case "none":
|
||
return false;
|
||
case "==":
|
||
case "!=":
|
||
case ">":
|
||
case ">=":
|
||
case "<":
|
||
case "<=":
|
||
return 3 !== t2.length || Array.isArray(t2[1]) || Array.isArray(t2[2]);
|
||
case "any":
|
||
case "all":
|
||
for (const e2 of t2.slice(1)) if (!qr(e2) && "boolean" != typeof e2) return false;
|
||
return true;
|
||
default:
|
||
return true;
|
||
}
|
||
}
|
||
const jr = { type: "boolean", default: false, transition: false, "property-type": "data-driven", expression: { interpolated: false, parameters: ["zoom", "feature"] } };
|
||
function Nr(t2) {
|
||
if (null == t2) return { filter: () => true, needGeometry: false };
|
||
qr(t2) || (t2 = Gr(t2));
|
||
const e2 = $r(t2, jr);
|
||
if ("error" === e2.result) throw new Error(e2.value.map(((t3) => `${t3.key}: ${t3.message}`)).join(", "));
|
||
return { filter: (t3, r2, n2) => e2.value.evaluate(t3, r2, {}, n2), needGeometry: Kr(t2) };
|
||
}
|
||
function Zr(t2, e2) {
|
||
return t2 < e2 ? -1 : t2 > e2 ? 1 : 0;
|
||
}
|
||
function Kr(t2) {
|
||
if (!Array.isArray(t2)) return false;
|
||
if ("within" === t2[0]) return true;
|
||
for (let e2 = 1; e2 < t2.length; e2++) if (Kr(t2[e2])) return true;
|
||
return false;
|
||
}
|
||
function Gr(t2) {
|
||
if (!t2) return true;
|
||
const e2 = t2[0];
|
||
return t2.length <= 1 ? "any" !== e2 : "==" === e2 ? Jr(t2[1], t2[2], "==") : "!=" === e2 ? Hr(Jr(t2[1], t2[2], "==")) : "<" === e2 || ">" === e2 || "<=" === e2 || ">=" === e2 ? Jr(t2[1], t2[2], e2) : "any" === e2 ? (r2 = t2.slice(1), ["any"].concat(r2.map(Gr))) : "all" === e2 ? ["all"].concat(t2.slice(1).map(Gr)) : "none" === e2 ? ["all"].concat(t2.slice(1).map(Gr).map(Hr)) : "in" === e2 ? Xr(t2[1], t2.slice(2)) : "!in" === e2 ? Hr(Xr(t2[1], t2.slice(2))) : "has" === e2 ? Yr(t2[1]) : "!has" === e2 ? Hr(Yr(t2[1])) : "within" !== e2 || t2;
|
||
var r2;
|
||
}
|
||
function Jr(t2, e2, r2) {
|
||
switch (t2) {
|
||
case "$type":
|
||
return [`filter-type-${r2}`, e2];
|
||
case "$id":
|
||
return [`filter-id-${r2}`, e2];
|
||
default:
|
||
return [`filter-${r2}`, t2, e2];
|
||
}
|
||
}
|
||
function Xr(t2, e2) {
|
||
if (0 === e2.length) return false;
|
||
switch (t2) {
|
||
case "$type":
|
||
return ["filter-type-in", ["literal", e2]];
|
||
case "$id":
|
||
return ["filter-id-in", ["literal", e2]];
|
||
default:
|
||
return e2.length > 200 && !e2.some(((t3) => typeof t3 != typeof e2[0])) ? ["filter-in-large", t2, ["literal", e2.sort(Zr)]] : ["filter-in-small", t2, ["literal", e2]];
|
||
}
|
||
}
|
||
function Yr(t2) {
|
||
switch (t2) {
|
||
case "$type":
|
||
return true;
|
||
case "$id":
|
||
return ["filter-has-id"];
|
||
default:
|
||
return ["filter-has", t2];
|
||
}
|
||
}
|
||
function Hr(t2) {
|
||
return ["!", t2];
|
||
}
|
||
function Wr(t2) {
|
||
const e2 = typeof t2;
|
||
if ("number" === e2 || "boolean" === e2 || "string" === e2 || null == t2) return JSON.stringify(t2);
|
||
if (Array.isArray(t2)) {
|
||
let e3 = "[";
|
||
for (const r3 of t2) e3 += `${Wr(r3)},`;
|
||
return `${e3}]`;
|
||
}
|
||
const r2 = Object.keys(t2).sort();
|
||
let n2 = "{";
|
||
for (let e3 = 0; e3 < r2.length; e3++) n2 += `${JSON.stringify(r2[e3])}:${Wr(t2[r2[e3]])},`;
|
||
return `${n2}}`;
|
||
}
|
||
function Qr(t2) {
|
||
let e2 = "";
|
||
for (const r2 of Y) e2 += `/${Wr(t2[r2])}`;
|
||
return e2;
|
||
}
|
||
function tn(t2) {
|
||
const e2 = t2.value;
|
||
return e2 ? [new ot(t2.key, e2, "constants have been deprecated as of v8")] : [];
|
||
}
|
||
function en(t2) {
|
||
return t2 instanceof Number || t2 instanceof String || t2 instanceof Boolean ? t2.valueOf() : t2;
|
||
}
|
||
function rn(t2) {
|
||
if (Array.isArray(t2)) return t2.map(rn);
|
||
if (t2 instanceof Object && !(t2 instanceof Number || t2 instanceof String || t2 instanceof Boolean)) {
|
||
const e2 = {};
|
||
for (const r2 in t2) e2[r2] = rn(t2[r2]);
|
||
return e2;
|
||
}
|
||
return en(t2);
|
||
}
|
||
function nn(t2) {
|
||
const e2 = t2.key, r2 = t2.value, n2 = t2.valueSpec || {}, i3 = t2.objectElementValidators || {}, a2 = t2.style, s2 = t2.styleSpec, o2 = t2.validateSpec;
|
||
let l2 = [];
|
||
const u2 = kr(r2);
|
||
if ("object" !== u2) return [new ot(e2, r2, `object expected, ${u2} found`)];
|
||
for (const t3 in r2) {
|
||
const u3 = t3.split(".")[0], c2 = n2[u3] || n2["*"];
|
||
let h2;
|
||
if (i3[u3]) h2 = i3[u3];
|
||
else if (n2[u3]) h2 = o2;
|
||
else if (i3["*"]) h2 = i3["*"];
|
||
else {
|
||
if (!n2["*"]) {
|
||
l2.push(new ot(e2, r2[t3], `unknown property "${t3}"`));
|
||
continue;
|
||
}
|
||
h2 = o2;
|
||
}
|
||
l2 = l2.concat(h2({ key: (e2 ? `${e2}.` : e2) + t3, value: r2[t3], valueSpec: c2, style: a2, styleSpec: s2, object: r2, objectKey: t3, validateSpec: o2 }, r2));
|
||
}
|
||
for (const t3 in n2) i3[t3] || n2[t3].required && void 0 === n2[t3].default && void 0 === r2[t3] && l2.push(new ot(e2, r2, `missing required property "${t3}"`));
|
||
return l2;
|
||
}
|
||
function an(t2) {
|
||
const e2 = t2.value, r2 = t2.valueSpec, n2 = t2.style, i3 = t2.styleSpec, a2 = t2.key, s2 = t2.arrayElementValidator || t2.validateSpec;
|
||
if ("array" !== kr(e2)) return [new ot(a2, e2, `array expected, ${kr(e2)} found`)];
|
||
if (r2.length && e2.length !== r2.length) return [new ot(a2, e2, `array length ${r2.length} expected, length ${e2.length} found`)];
|
||
if (r2["min-length"] && e2.length < r2["min-length"]) return [new ot(a2, e2, `array length at least ${r2["min-length"]} expected, length ${e2.length} found`)];
|
||
let o2 = { type: r2.value, values: r2.values };
|
||
i3.$version < 7 && (o2.function = r2.function), "object" === kr(r2.value) && (o2 = r2.value);
|
||
let l2 = [];
|
||
for (let r3 = 0; r3 < e2.length; r3++) l2 = l2.concat(s2({ array: e2, arrayIndex: r3, value: e2[r3], valueSpec: o2, validateSpec: t2.validateSpec, style: n2, styleSpec: i3, key: `${a2}[${r3}]` }));
|
||
return l2;
|
||
}
|
||
function sn(t2) {
|
||
const e2 = t2.key, r2 = t2.value, n2 = t2.valueSpec;
|
||
let i3 = kr(r2);
|
||
return "number" === i3 && r2 != r2 && (i3 = "NaN"), "number" !== i3 ? [new ot(e2, r2, `number expected, ${i3} found`)] : "minimum" in n2 && r2 < n2.minimum ? [new ot(e2, r2, `${r2} is less than the minimum value ${n2.minimum}`)] : "maximum" in n2 && r2 > n2.maximum ? [new ot(e2, r2, `${r2} is greater than the maximum value ${n2.maximum}`)] : [];
|
||
}
|
||
function on(t2) {
|
||
const e2 = t2.valueSpec, r2 = en(t2.value.type);
|
||
let n2, i3, a2, s2 = {};
|
||
const o2 = "categorical" !== r2 && void 0 === t2.value.property, l2 = !o2, u2 = "array" === kr(t2.value.stops) && "array" === kr(t2.value.stops[0]) && "object" === kr(t2.value.stops[0][0]), c2 = nn({ key: t2.key, value: t2.value, valueSpec: t2.styleSpec.function, validateSpec: t2.validateSpec, style: t2.style, styleSpec: t2.styleSpec, objectElementValidators: { stops: function(t3) {
|
||
if ("identity" === r2) return [new ot(t3.key, t3.value, 'identity function may not have a "stops" property')];
|
||
let e3 = [];
|
||
const n3 = t3.value;
|
||
return e3 = e3.concat(an({ key: t3.key, value: n3, valueSpec: t3.valueSpec, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec, arrayElementValidator: h2 })), "array" === kr(n3) && 0 === n3.length && e3.push(new ot(t3.key, n3, "array must have at least one stop")), e3;
|
||
}, default: function(t3) {
|
||
return t3.validateSpec({ key: t3.key, value: t3.value, valueSpec: e2, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec });
|
||
} } });
|
||
return "identity" === r2 && o2 && c2.push(new ot(t2.key, t2.value, 'missing required property "property"')), "identity" === r2 || t2.value.stops || c2.push(new ot(t2.key, t2.value, 'missing required property "stops"')), "exponential" === r2 && t2.valueSpec.expression && !Sr(t2.valueSpec) && c2.push(new ot(t2.key, t2.value, "exponential functions not supported")), t2.styleSpec.$version >= 8 && (l2 && !_r(t2.valueSpec) ? c2.push(new ot(t2.key, t2.value, "property functions not supported")) : o2 && !Ar(t2.valueSpec) && c2.push(new ot(t2.key, t2.value, "zoom functions not supported"))), "categorical" !== r2 && !u2 || void 0 !== t2.value.property || c2.push(new ot(t2.key, t2.value, '"property" property is required')), c2;
|
||
function h2(t3) {
|
||
let r3 = [];
|
||
const n3 = t3.value, o3 = t3.key;
|
||
if ("array" !== kr(n3)) return [new ot(o3, n3, `array expected, ${kr(n3)} found`)];
|
||
if (2 !== n3.length) return [new ot(o3, n3, `array length 2 expected, length ${n3.length} found`)];
|
||
if (u2) {
|
||
if ("object" !== kr(n3[0])) return [new ot(o3, n3, `object expected, ${kr(n3[0])} found`)];
|
||
if (void 0 === n3[0].zoom) return [new ot(o3, n3, "object stop key must have zoom")];
|
||
if (void 0 === n3[0].value) return [new ot(o3, n3, "object stop key must have value")];
|
||
if (a2 && a2 > en(n3[0].zoom)) return [new ot(o3, n3[0].zoom, "stop zoom values must appear in ascending order")];
|
||
en(n3[0].zoom) !== a2 && (a2 = en(n3[0].zoom), i3 = void 0, s2 = {}), r3 = r3.concat(nn({ key: `${o3}[0]`, value: n3[0], valueSpec: { zoom: {} }, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec, objectElementValidators: { zoom: sn, value: p2 } }));
|
||
} else r3 = r3.concat(p2({ key: `${o3}[0]`, value: n3[0], validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec }, n3));
|
||
return Tr(rn(n3[1])) ? r3.concat([new ot(`${o3}[1]`, n3[1], "expressions are not allowed in function stops.")]) : r3.concat(t3.validateSpec({ key: `${o3}[1]`, value: n3[1], valueSpec: e2, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec }));
|
||
}
|
||
function p2(t3, a3) {
|
||
const o3 = kr(t3.value), l3 = en(t3.value), u3 = null !== t3.value ? t3.value : a3;
|
||
if (n2) {
|
||
if (o3 !== n2) return [new ot(t3.key, u3, `${o3} stop domain type must match previous stop domain type ${n2}`)];
|
||
} else n2 = o3;
|
||
if ("number" !== o3 && "string" !== o3 && "boolean" !== o3) return [new ot(t3.key, u3, "stop domain value must be a number, string, or boolean")];
|
||
if ("number" !== o3 && "categorical" !== r2) {
|
||
let n3 = `number expected, ${o3} found`;
|
||
return _r(e2) && void 0 === r2 && (n3 += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new ot(t3.key, u3, n3)];
|
||
}
|
||
return "categorical" !== r2 || "number" !== o3 || isFinite(l3) && Math.floor(l3) === l3 ? "categorical" !== r2 && "number" === o3 && void 0 !== i3 && l3 < i3 ? [new ot(t3.key, u3, "stop domain values must appear in ascending order")] : (i3 = l3, "categorical" === r2 && l3 in s2 ? [new ot(t3.key, u3, "stop domain values must be unique")] : (s2[l3] = true, [])) : [new ot(t3.key, u3, `integer expected, found ${l3}`)];
|
||
}
|
||
}
|
||
function ln(t2) {
|
||
const e2 = ("property" === t2.expressionContext ? Or : $r)(rn(t2.value), t2.valueSpec);
|
||
if ("error" === e2.result) return e2.value.map(((e3) => new ot(`${t2.key}${e3.key}`, t2.value, e3.message)));
|
||
const r2 = e2.value.expression || e2.value._styleExpression.expression;
|
||
if ("property" === t2.expressionContext && "text-font" === t2.propertyKey && !r2.outputDefined()) return [new ot(t2.key, t2.value, `Invalid data expression for "${t2.propertyKey}". Output values must be contained as literals within the expression.`)];
|
||
if ("property" === t2.expressionContext && "layout" === t2.propertyType && !Oe(r2)) return [new ot(t2.key, t2.value, '"feature-state" data expressions are not supported with layout properties.')];
|
||
if ("filter" === t2.expressionContext && !Oe(r2)) return [new ot(t2.key, t2.value, '"feature-state" data expressions are not supported with filters.')];
|
||
if (t2.expressionContext && 0 === t2.expressionContext.indexOf("cluster")) {
|
||
if (!Ue(r2, ["zoom", "feature-state"])) return [new ot(t2.key, t2.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
|
||
if ("cluster-initial" === t2.expressionContext && !De(r2)) return [new ot(t2.key, t2.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
|
||
}
|
||
return [];
|
||
}
|
||
function un(t2) {
|
||
const e2 = t2.key, r2 = t2.value, n2 = t2.valueSpec, i3 = [];
|
||
return Array.isArray(n2.values) ? -1 === n2.values.indexOf(en(r2)) && i3.push(new ot(e2, r2, `expected one of [${n2.values.join(", ")}], ${JSON.stringify(r2)} found`)) : -1 === Object.keys(n2.values).indexOf(en(r2)) && i3.push(new ot(e2, r2, `expected one of [${Object.keys(n2.values).join(", ")}], ${JSON.stringify(r2)} found`)), i3;
|
||
}
|
||
function cn(t2) {
|
||
return qr(rn(t2.value)) ? ln(lt({}, t2, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : hn(t2);
|
||
}
|
||
function hn(t2) {
|
||
const e2 = t2.value, r2 = t2.key;
|
||
if ("array" !== kr(e2)) return [new ot(r2, e2, `array expected, ${kr(e2)} found`)];
|
||
const n2 = t2.styleSpec;
|
||
let i3, a2 = [];
|
||
if (e2.length < 1) return [new ot(r2, e2, "filter array must have at least 1 element")];
|
||
switch (a2 = a2.concat(un({ key: `${r2}[0]`, value: e2[0], valueSpec: n2.filter_operator, style: t2.style, styleSpec: t2.styleSpec })), en(e2[0])) {
|
||
case "<":
|
||
case "<=":
|
||
case ">":
|
||
case ">=":
|
||
e2.length >= 2 && "$type" === en(e2[1]) && a2.push(new ot(r2, e2, `"$type" cannot be use with operator "${e2[0]}"`));
|
||
case "==":
|
||
case "!=":
|
||
3 !== e2.length && a2.push(new ot(r2, e2, `filter array for operator "${e2[0]}" must have 3 elements`));
|
||
case "in":
|
||
case "!in":
|
||
e2.length >= 2 && (i3 = kr(e2[1]), "string" !== i3 && a2.push(new ot(`${r2}[1]`, e2[1], `string expected, ${i3} found`)));
|
||
for (let s2 = 2; s2 < e2.length; s2++) i3 = kr(e2[s2]), "$type" === en(e2[1]) ? a2 = a2.concat(un({ key: `${r2}[${s2}]`, value: e2[s2], valueSpec: n2.geometry_type, style: t2.style, styleSpec: t2.styleSpec })) : "string" !== i3 && "number" !== i3 && "boolean" !== i3 && a2.push(new ot(`${r2}[${s2}]`, e2[s2], `string, number, or boolean expected, ${i3} found`));
|
||
break;
|
||
case "any":
|
||
case "all":
|
||
case "none":
|
||
for (let n3 = 1; n3 < e2.length; n3++) a2 = a2.concat(hn({ key: `${r2}[${n3}]`, value: e2[n3], style: t2.style, styleSpec: t2.styleSpec }));
|
||
break;
|
||
case "has":
|
||
case "!has":
|
||
i3 = kr(e2[1]), 2 !== e2.length ? a2.push(new ot(r2, e2, `filter array for "${e2[0]}" operator must have 2 elements`)) : "string" !== i3 && a2.push(new ot(`${r2}[1]`, e2[1], `string expected, ${i3} found`));
|
||
break;
|
||
case "within":
|
||
i3 = kr(e2[1]), 2 !== e2.length ? a2.push(new ot(r2, e2, `filter array for "${e2[0]}" operator must have 2 elements`)) : "object" !== i3 && a2.push(new ot(`${r2}[1]`, e2[1], `object expected, ${i3} found`));
|
||
}
|
||
return a2;
|
||
}
|
||
function pn(t2, e2) {
|
||
const r2 = t2.key, n2 = t2.validateSpec, i3 = t2.style, a2 = t2.styleSpec, s2 = t2.value, o2 = t2.objectKey, l2 = a2[`${e2}_${t2.layerType}`];
|
||
if (!l2) return [];
|
||
const u2 = o2.match(/^(.*)-transition$/);
|
||
if ("paint" === e2 && u2 && l2[u2[1]] && l2[u2[1]].transition) return n2({ key: r2, value: s2, valueSpec: a2.transition, style: i3, styleSpec: a2 });
|
||
const c2 = t2.valueSpec || l2[o2];
|
||
if (!c2) return [new ot(r2, s2, `unknown property "${o2}"`)];
|
||
let h2;
|
||
if ("string" === kr(s2) && _r(c2) && !c2.tokens && (h2 = /^{([^}]+)}$/.exec(s2))) return [new ot(r2, s2, `"${o2}" does not support interpolation syntax
|
||
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h2[1])} }\`.`)];
|
||
const p2 = [];
|
||
return "symbol" === t2.layerType && ("text-field" === o2 && i3 && !i3.glyphs && p2.push(new ot(r2, s2, 'use of "text-field" requires a style "glyphs" property')), "text-font" === o2 && Ir(rn(s2)) && "identity" === en(s2.type) && p2.push(new ot(r2, s2, '"text-font" does not support identity functions'))), p2.concat(n2({ key: t2.key, value: s2, valueSpec: c2, style: i3, styleSpec: a2, expressionContext: "property", propertyType: e2, propertyKey: o2 }));
|
||
}
|
||
function fn(t2) {
|
||
return pn(t2, "paint");
|
||
}
|
||
function dn(t2) {
|
||
return pn(t2, "layout");
|
||
}
|
||
function yn(t2) {
|
||
let e2 = [];
|
||
const r2 = t2.value, n2 = t2.key, i3 = t2.style, a2 = t2.styleSpec;
|
||
r2.type || r2.ref || e2.push(new ot(n2, r2, 'either "type" or "ref" is required'));
|
||
let s2 = en(r2.type);
|
||
const o2 = en(r2.ref);
|
||
if (r2.id) {
|
||
const a3 = en(r2.id);
|
||
for (let s3 = 0; s3 < t2.arrayIndex; s3++) {
|
||
const t3 = i3.layers[s3];
|
||
en(t3.id) === a3 && e2.push(new ot(n2, r2.id, `duplicate layer id "${r2.id}", previously used at line ${t3.id.__line__}`));
|
||
}
|
||
}
|
||
if ("ref" in r2) {
|
||
let t3;
|
||
["type", "source", "source-layer", "filter", "layout"].forEach(((t4) => {
|
||
t4 in r2 && e2.push(new ot(n2, r2[t4], `"${t4}" is prohibited for ref layers`));
|
||
})), i3.layers.forEach(((e3) => {
|
||
en(e3.id) === o2 && (t3 = e3);
|
||
})), t3 ? t3.ref ? e2.push(new ot(n2, r2.ref, "ref cannot reference another ref layer")) : s2 = en(t3.type) : e2.push(new ot(n2, r2.ref, `ref layer "${o2}" not found`));
|
||
} else if ("background" !== s2) if (r2.source) {
|
||
const t3 = i3.sources && i3.sources[r2.source], a3 = t3 && en(t3.type);
|
||
t3 ? "vector" === a3 && "raster" === s2 ? e2.push(new ot(n2, r2.source, `layer "${r2.id}" requires a raster source`)) : "raster-dem" !== a3 && "hillshade" === s2 ? e2.push(new ot(n2, r2.source, `layer "${r2.id}" requires a raster-dem source`)) : "raster" === a3 && "raster" !== s2 ? e2.push(new ot(n2, r2.source, `layer "${r2.id}" requires a vector source`)) : "vector" !== a3 || r2["source-layer"] ? "raster-dem" === a3 && "hillshade" !== s2 ? e2.push(new ot(n2, r2.source, "raster-dem source can only be used with layer type 'hillshade'.")) : "line" !== s2 || !r2.paint || !r2.paint["line-gradient"] || "geojson" === a3 && t3.lineMetrics || e2.push(new ot(n2, r2, `layer "${r2.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : e2.push(new ot(n2, r2, `layer "${r2.id}" must specify a "source-layer"`)) : e2.push(new ot(n2, r2.source, `source "${r2.source}" not found`));
|
||
} else e2.push(new ot(n2, r2, 'missing required property "source"'));
|
||
return e2 = e2.concat(nn({ key: n2, value: r2, valueSpec: a2.layer, style: t2.style, styleSpec: t2.styleSpec, validateSpec: t2.validateSpec, objectElementValidators: { "*": () => [], type: () => t2.validateSpec({ key: `${n2}.type`, value: r2.type, valueSpec: a2.layer.type, style: t2.style, styleSpec: t2.styleSpec, validateSpec: t2.validateSpec, object: r2, objectKey: "type" }), filter: cn, layout: (t3) => nn({ layer: r2, key: t3.key, value: t3.value, style: t3.style, styleSpec: t3.styleSpec, validateSpec: t3.validateSpec, objectElementValidators: { "*": (t4) => dn(lt({ layerType: s2 }, t4)) } }), paint: (t3) => nn({ layer: r2, key: t3.key, value: t3.value, style: t3.style, styleSpec: t3.styleSpec, validateSpec: t3.validateSpec, objectElementValidators: { "*": (t4) => fn(lt({ layerType: s2 }, t4)) } }) } })), e2;
|
||
}
|
||
function mn(t2) {
|
||
const e2 = t2.value, r2 = t2.key, n2 = kr(e2);
|
||
return "string" !== n2 ? [new ot(r2, e2, `string expected, ${n2} found`)] : [];
|
||
}
|
||
const gn = { promoteId: function({ key: t2, value: e2 }) {
|
||
if ("string" === kr(e2)) return mn({ key: t2, value: e2 });
|
||
{
|
||
const r2 = [];
|
||
for (const n2 in e2) r2.push(...mn({ key: `${t2}.${n2}`, value: e2[n2] }));
|
||
return r2;
|
||
}
|
||
} };
|
||
function xn(t2) {
|
||
const e2 = t2.value, r2 = t2.key, n2 = t2.styleSpec, i3 = t2.style, a2 = t2.validateSpec;
|
||
if (!e2.type) return [new ot(r2, e2, '"type" is required')];
|
||
const s2 = en(e2.type);
|
||
let o2;
|
||
switch (s2) {
|
||
case "vector":
|
||
case "raster":
|
||
return o2 = nn({ key: r2, value: e2, valueSpec: n2[`source_${s2.replace("-", "_")}`], style: t2.style, styleSpec: n2, objectElementValidators: gn, validateSpec: a2 }), o2;
|
||
case "raster-dem":
|
||
return o2 = (function(t3) {
|
||
var e3;
|
||
const r3 = null !== (e3 = t3.sourceName) && void 0 !== e3 ? e3 : "", n3 = t3.value, i4 = t3.styleSpec, a3 = i4.source_raster_dem, s3 = t3.style;
|
||
let o3 = [];
|
||
const l2 = kr(n3);
|
||
if (void 0 === n3) return o3;
|
||
if ("object" !== l2) return o3.push(new ot("source_raster_dem", n3, `object expected, ${l2} found`)), o3;
|
||
const u2 = "custom" === en(n3.encoding), c2 = ["redFactor", "greenFactor", "blueFactor", "baseShift"], h2 = t3.value.encoding ? `"${t3.value.encoding}"` : "Default";
|
||
for (const e4 in n3) !u2 && c2.includes(e4) ? o3.push(new ot(e4, n3[e4], `In "${r3}": "${e4}" is only valid when "encoding" is set to "custom". ${h2} encoding found`)) : a3[e4] ? o3 = o3.concat(t3.validateSpec({ key: e4, value: n3[e4], valueSpec: a3[e4], validateSpec: t3.validateSpec, style: s3, styleSpec: i4 })) : o3.push(new ot(e4, n3[e4], `unknown property "${e4}"`));
|
||
return o3;
|
||
})({ sourceName: r2, value: e2, style: t2.style, styleSpec: n2, validateSpec: a2 }), o2;
|
||
case "geojson":
|
||
if (o2 = nn({ key: r2, value: e2, valueSpec: n2.source_geojson, style: i3, styleSpec: n2, validateSpec: a2, objectElementValidators: gn }), e2.cluster) for (const t3 in e2.clusterProperties) {
|
||
const [n3, i4] = e2.clusterProperties[t3], s3 = "string" == typeof n3 ? [n3, ["accumulated"], ["get", t3]] : n3;
|
||
o2.push(...ln({ key: `${r2}.${t3}.map`, value: i4, expressionContext: "cluster-map" })), o2.push(...ln({ key: `${r2}.${t3}.reduce`, value: s3, expressionContext: "cluster-reduce" }));
|
||
}
|
||
return o2;
|
||
case "video":
|
||
return nn({ key: r2, value: e2, valueSpec: n2.source_video, style: i3, validateSpec: a2, styleSpec: n2 });
|
||
case "image":
|
||
return nn({ key: r2, value: e2, valueSpec: n2.source_image, style: i3, validateSpec: a2, styleSpec: n2 });
|
||
case "canvas":
|
||
return [new ot(r2, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")];
|
||
default:
|
||
return un({ key: `${r2}.type`, value: e2.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] } });
|
||
}
|
||
}
|
||
function vn(t2) {
|
||
const e2 = t2.value, r2 = t2.styleSpec, n2 = r2.light, i3 = t2.style;
|
||
let a2 = [];
|
||
const s2 = kr(e2);
|
||
if (void 0 === e2) return a2;
|
||
if ("object" !== s2) return a2 = a2.concat([new ot("light", e2, `object expected, ${s2} found`)]), a2;
|
||
for (const s3 in e2) {
|
||
const o2 = s3.match(/^(.*)-transition$/);
|
||
a2 = a2.concat(o2 && n2[o2[1]] && n2[o2[1]].transition ? t2.validateSpec({ key: s3, value: e2[s3], valueSpec: r2.transition, validateSpec: t2.validateSpec, style: i3, styleSpec: r2 }) : n2[s3] ? t2.validateSpec({ key: s3, value: e2[s3], valueSpec: n2[s3], validateSpec: t2.validateSpec, style: i3, styleSpec: r2 }) : [new ot(s3, e2[s3], `unknown property "${s3}"`)]);
|
||
}
|
||
return a2;
|
||
}
|
||
function bn(t2) {
|
||
const e2 = t2.value, r2 = t2.styleSpec, n2 = r2.terrain, i3 = t2.style;
|
||
let a2 = [];
|
||
const s2 = kr(e2);
|
||
if (void 0 === e2) return a2;
|
||
if ("object" !== s2) return a2 = a2.concat([new ot("terrain", e2, `object expected, ${s2} found`)]), a2;
|
||
for (const s3 in e2) a2 = a2.concat(n2[s3] ? t2.validateSpec({ key: s3, value: e2[s3], valueSpec: n2[s3], validateSpec: t2.validateSpec, style: i3, styleSpec: r2 }) : [new ot(s3, e2[s3], `unknown property "${s3}"`)]);
|
||
return a2;
|
||
}
|
||
function wn(t2) {
|
||
let e2 = [];
|
||
const r2 = t2.value, n2 = t2.key;
|
||
if (Array.isArray(r2)) {
|
||
const i3 = [], a2 = [];
|
||
for (const s2 in r2) r2[s2].id && i3.includes(r2[s2].id) && e2.push(new ot(n2, r2, `all the sprites' ids must be unique, but ${r2[s2].id} is duplicated`)), i3.push(r2[s2].id), r2[s2].url && a2.includes(r2[s2].url) && e2.push(new ot(n2, r2, `all the sprites' URLs must be unique, but ${r2[s2].url} is duplicated`)), a2.push(r2[s2].url), e2 = e2.concat(nn({ key: `${n2}[${s2}]`, value: r2[s2], valueSpec: { id: { type: "string", required: true }, url: { type: "string", required: true } }, validateSpec: t2.validateSpec }));
|
||
return e2;
|
||
}
|
||
return mn({ key: n2, value: r2 });
|
||
}
|
||
const _n = { "*": () => [], array: an, boolean: function(t2) {
|
||
const e2 = t2.value, r2 = t2.key, n2 = kr(e2);
|
||
return "boolean" !== n2 ? [new ot(r2, e2, `boolean expected, ${n2} found`)] : [];
|
||
}, number: sn, color: function(t2) {
|
||
const e2 = t2.key, r2 = t2.value, n2 = kr(r2);
|
||
return "string" !== n2 ? [new ot(e2, r2, `color expected, ${n2} found`)] : Yt.parse(String(r2)) ? [] : [new ot(e2, r2, `color expected, "${r2}" found`)];
|
||
}, constants: tn, enum: un, filter: cn, function: on, layer: yn, object: nn, source: xn, light: vn, terrain: bn, string: mn, formatted: function(t2) {
|
||
return 0 === mn(t2).length ? [] : ln(t2);
|
||
}, resolvedImage: function(t2) {
|
||
return 0 === mn(t2).length ? [] : ln(t2);
|
||
}, padding: function(t2) {
|
||
const e2 = t2.key, r2 = t2.value;
|
||
if ("array" === kr(r2)) {
|
||
if (r2.length < 1 || r2.length > 4) return [new ot(e2, r2, `padding requires 1 to 4 values; ${r2.length} values found`)];
|
||
const n2 = { type: "number" };
|
||
let i3 = [];
|
||
for (let a2 = 0; a2 < r2.length; a2++) i3 = i3.concat(t2.validateSpec({ key: `${e2}[${a2}]`, value: r2[a2], validateSpec: t2.validateSpec, valueSpec: n2 }));
|
||
return i3;
|
||
}
|
||
return sn({ key: e2, value: r2, valueSpec: {} });
|
||
}, variableAnchorOffsetCollection: function(t2) {
|
||
const e2 = t2.key, r2 = t2.value, n2 = kr(r2), i3 = t2.styleSpec;
|
||
if ("array" !== n2 || r2.length < 1 || r2.length % 2 != 0) return [new ot(e2, r2, "variableAnchorOffsetCollection requires a non-empty array of even length")];
|
||
let a2 = [];
|
||
for (let n3 = 0; n3 < r2.length; n3 += 2) a2 = a2.concat(un({ key: `${e2}[${n3}]`, value: r2[n3], valueSpec: i3.layout_symbol["text-anchor"] })), a2 = a2.concat(an({ key: `${e2}[${n3 + 1}]`, value: r2[n3 + 1], valueSpec: { length: 2, value: "number" }, validateSpec: t2.validateSpec, style: t2.style, styleSpec: i3 }));
|
||
return a2;
|
||
}, sprite: wn };
|
||
function An(t2) {
|
||
const e2 = t2.value, r2 = t2.valueSpec, n2 = t2.styleSpec;
|
||
return t2.validateSpec = An, r2.expression && Ir(en(e2)) ? on(t2) : r2.expression && Tr(rn(e2)) ? ln(t2) : r2.type && _n[r2.type] ? _n[r2.type](t2) : nn(lt({}, t2, { valueSpec: r2.type ? n2[r2.type] : r2 }));
|
||
}
|
||
function Sn(t2) {
|
||
const e2 = t2.value, r2 = t2.key, n2 = mn(t2);
|
||
return n2.length || (-1 === e2.indexOf("{fontstack}") && n2.push(new ot(r2, e2, '"glyphs" url must include a "{fontstack}" token')), -1 === e2.indexOf("{range}") && n2.push(new ot(r2, e2, '"glyphs" url must include a "{range}" token'))), n2;
|
||
}
|
||
function kn(t2, e2 = X) {
|
||
let r2 = [];
|
||
return r2 = r2.concat(An({ key: "", value: t2, valueSpec: e2.$root, styleSpec: e2, style: t2, validateSpec: An, objectElementValidators: { glyphs: Sn, "*": () => [] } })), t2.constants && (r2 = r2.concat(tn({ key: "constants", value: t2.constants }))), zn(r2);
|
||
}
|
||
function In(t2) {
|
||
return function(e2) {
|
||
return t2({ ...e2, validateSpec: An });
|
||
};
|
||
}
|
||
function zn(t2) {
|
||
return [].concat(t2).sort(((t3, e2) => t3.line - e2.line));
|
||
}
|
||
function Mn(t2) {
|
||
return function(...e2) {
|
||
return zn(t2.apply(this, e2));
|
||
};
|
||
}
|
||
kn.source = Mn(In(xn)), kn.sprite = Mn(In(wn)), kn.glyphs = Mn(In(Sn)), kn.light = Mn(In(vn)), kn.terrain = Mn(In(bn)), kn.layer = Mn(In(yn)), kn.filter = Mn(In(cn)), kn.paintProperty = Mn(In(fn)), kn.layoutProperty = Mn(In(dn));
|
||
const Cn = kn, Bn = Cn.light, Pn = Cn.paintProperty, Vn = Cn.layoutProperty;
|
||
function En(t2, e2) {
|
||
let r2 = false;
|
||
if (e2 && e2.length) for (const n2 of e2) t2.fire(new G(new Error(n2.message))), r2 = true;
|
||
return r2;
|
||
}
|
||
class Fn {
|
||
constructor(t2, e2, r2) {
|
||
const n2 = this.cells = [];
|
||
if (t2 instanceof ArrayBuffer) {
|
||
this.arrayBuffer = t2;
|
||
const i4 = new Int32Array(this.arrayBuffer);
|
||
t2 = i4[0], this.d = (e2 = i4[1]) + 2 * (r2 = i4[2]);
|
||
for (let t3 = 0; t3 < this.d * this.d; t3++) {
|
||
const e3 = i4[3 + t3], r3 = i4[3 + t3 + 1];
|
||
n2.push(e3 === r3 ? null : i4.subarray(e3, r3));
|
||
}
|
||
const a2 = i4[3 + n2.length + 1];
|
||
this.keys = i4.subarray(i4[3 + n2.length], a2), this.bboxes = i4.subarray(a2), this.insert = this._insertReadonly;
|
||
} else {
|
||
this.d = e2 + 2 * r2;
|
||
for (let t3 = 0; t3 < this.d * this.d; t3++) n2.push([]);
|
||
this.keys = [], this.bboxes = [];
|
||
}
|
||
this.n = e2, this.extent = t2, this.padding = r2, this.scale = e2 / t2, this.uid = 0;
|
||
const i3 = r2 / e2 * t2;
|
||
this.min = -i3, this.max = t2 + i3;
|
||
}
|
||
insert(t2, e2, r2, n2, i3) {
|
||
this._forEachCell(e2, r2, n2, i3, this._insertCell, this.uid++, void 0, void 0), this.keys.push(t2), this.bboxes.push(e2), this.bboxes.push(r2), this.bboxes.push(n2), this.bboxes.push(i3);
|
||
}
|
||
_insertReadonly() {
|
||
throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.");
|
||
}
|
||
_insertCell(t2, e2, r2, n2, i3, a2) {
|
||
this.cells[i3].push(a2);
|
||
}
|
||
query(t2, e2, r2, n2, i3) {
|
||
const a2 = this.min, s2 = this.max;
|
||
if (t2 <= a2 && e2 <= a2 && s2 <= r2 && s2 <= n2 && !i3) return Array.prototype.slice.call(this.keys);
|
||
{
|
||
const a3 = [];
|
||
return this._forEachCell(t2, e2, r2, n2, this._queryCell, a3, {}, i3), a3;
|
||
}
|
||
}
|
||
_queryCell(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
const l2 = this.cells[i3];
|
||
if (null !== l2) {
|
||
const i4 = this.keys, u2 = this.bboxes;
|
||
for (let c2 = 0; c2 < l2.length; c2++) {
|
||
const h2 = l2[c2];
|
||
if (void 0 === s2[h2]) {
|
||
const l3 = 4 * h2;
|
||
(o2 ? o2(u2[l3 + 0], u2[l3 + 1], u2[l3 + 2], u2[l3 + 3]) : t2 <= u2[l3 + 2] && e2 <= u2[l3 + 3] && r2 >= u2[l3 + 0] && n2 >= u2[l3 + 1]) ? (s2[h2] = true, a2.push(i4[h2])) : s2[h2] = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
_forEachCell(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
const l2 = this._convertToCellCoord(t2), u2 = this._convertToCellCoord(e2), c2 = this._convertToCellCoord(r2), h2 = this._convertToCellCoord(n2);
|
||
for (let p2 = l2; p2 <= c2; p2++) for (let l3 = u2; l3 <= h2; l3++) {
|
||
const u3 = this.d * l3 + p2;
|
||
if ((!o2 || o2(this._convertFromCellCoord(p2), this._convertFromCellCoord(l3), this._convertFromCellCoord(p2 + 1), this._convertFromCellCoord(l3 + 1))) && i3.call(this, t2, e2, r2, n2, u3, a2, s2, o2)) return;
|
||
}
|
||
}
|
||
_convertFromCellCoord(t2) {
|
||
return (t2 - this.padding) / this.scale;
|
||
}
|
||
_convertToCellCoord(t2) {
|
||
return Math.max(0, Math.min(this.d - 1, Math.floor(t2 * this.scale) + this.padding));
|
||
}
|
||
toArrayBuffer() {
|
||
if (this.arrayBuffer) return this.arrayBuffer;
|
||
const t2 = this.cells, e2 = 3 + this.cells.length + 1 + 1;
|
||
let r2 = 0;
|
||
for (let t3 = 0; t3 < this.cells.length; t3++) r2 += this.cells[t3].length;
|
||
const n2 = new Int32Array(e2 + r2 + this.keys.length + this.bboxes.length);
|
||
n2[0] = this.extent, n2[1] = this.n, n2[2] = this.padding;
|
||
let i3 = e2;
|
||
for (let e3 = 0; e3 < t2.length; e3++) {
|
||
const r3 = t2[e3];
|
||
n2[3 + e3] = i3, n2.set(r3, i3), i3 += r3.length;
|
||
}
|
||
return n2[3 + t2.length] = i3, n2.set(this.keys, i3), i3 += this.keys.length, n2[3 + t2.length + 1] = i3, n2.set(this.bboxes, i3), i3 += this.bboxes.length, n2.buffer;
|
||
}
|
||
static serialize(t2, e2) {
|
||
const r2 = t2.toArrayBuffer();
|
||
return e2 && e2.push(r2), { buffer: r2 };
|
||
}
|
||
static deserialize(t2) {
|
||
return new Fn(t2.buffer);
|
||
}
|
||
}
|
||
const Tn = {};
|
||
function $n(t2, e2, r2 = {}) {
|
||
if (Tn[t2]) throw new Error(`${t2} is already registered.`);
|
||
Object.defineProperty(e2, "_classRegistryKey", { value: t2, writeable: false }), Tn[t2] = { klass: e2, omit: r2.omit || [], shallow: r2.shallow || [] };
|
||
}
|
||
$n("Object", Object), $n("TransferableGridIndex", Fn), $n("Color", Yt), $n("Error", Error), $n("AJAXError", L), $n("ResolvedImage", ne), $n("StylePropertyFunction", Ur), $n("StyleExpression", Fr, { omit: ["_evaluator"] }), $n("ZoomDependentExpression", Dr), $n("ZoomConstantExpression", Lr), $n("CompoundExpression", $e, { omit: ["_evaluate"] });
|
||
for (const t2 in yr) yr[t2]._classRegistryKey || $n(`Expression_${t2}`, yr[t2]);
|
||
function Ln(t2) {
|
||
return t2 && "undefined" != typeof ArrayBuffer && (t2 instanceof ArrayBuffer || t2.constructor && "ArrayBuffer" === t2.constructor.name);
|
||
}
|
||
function Dn(t2, e2) {
|
||
if (null == t2 || "boolean" == typeof t2 || "number" == typeof t2 || "string" == typeof t2 || t2 instanceof Boolean || t2 instanceof Number || t2 instanceof String || t2 instanceof Date || t2 instanceof RegExp || t2 instanceof Blob) return t2;
|
||
if (Ln(t2)) return e2 && e2.push(t2), t2;
|
||
if (M(t2)) return e2 && e2.push(t2), t2;
|
||
if (ArrayBuffer.isView(t2)) {
|
||
const r2 = t2;
|
||
return e2 && e2.push(r2.buffer), r2;
|
||
}
|
||
if (t2 instanceof ImageData) return e2 && e2.push(t2.data.buffer), t2;
|
||
if (Array.isArray(t2)) {
|
||
const r2 = [];
|
||
for (const n2 of t2) r2.push(Dn(n2, e2));
|
||
return r2;
|
||
}
|
||
if ("object" == typeof t2) {
|
||
const r2 = t2.constructor, n2 = r2._classRegistryKey;
|
||
if (!n2) throw new Error("can't serialize object of unregistered class");
|
||
if (!Tn[n2]) throw new Error(`${n2} is not registered.`);
|
||
const i3 = r2.serialize ? r2.serialize(t2, e2) : {};
|
||
if (r2.serialize) {
|
||
if (e2 && i3 === e2[e2.length - 1]) throw new Error("statically serialized object won't survive transfer of $name property");
|
||
} else {
|
||
for (const r3 in t2) {
|
||
if (!t2.hasOwnProperty(r3)) continue;
|
||
if (Tn[n2].omit.indexOf(r3) >= 0) continue;
|
||
const a2 = t2[r3];
|
||
i3[r3] = Tn[n2].shallow.indexOf(r3) >= 0 ? a2 : Dn(a2, e2);
|
||
}
|
||
t2 instanceof Error && (i3.message = t2.message);
|
||
}
|
||
if (i3.$name) throw new Error("$name property is reserved for worker serialization logic.");
|
||
return "Object" !== n2 && (i3.$name = n2), i3;
|
||
}
|
||
throw new Error("can't serialize object of type " + typeof t2);
|
||
}
|
||
function On(t2) {
|
||
if (null == t2 || "boolean" == typeof t2 || "number" == typeof t2 || "string" == typeof t2 || t2 instanceof Boolean || t2 instanceof Number || t2 instanceof String || t2 instanceof Date || t2 instanceof RegExp || t2 instanceof Blob || Ln(t2) || M(t2) || ArrayBuffer.isView(t2) || t2 instanceof ImageData) return t2;
|
||
if (Array.isArray(t2)) return t2.map(On);
|
||
if ("object" == typeof t2) {
|
||
const e2 = t2.$name || "Object";
|
||
if (!Tn[e2]) throw new Error(`can't deserialize unregistered class ${e2}`);
|
||
const { klass: r2 } = Tn[e2];
|
||
if (!r2) throw new Error(`can't deserialize unregistered class ${e2}`);
|
||
if (r2.deserialize) return r2.deserialize(t2);
|
||
const n2 = Object.create(r2.prototype);
|
||
for (const r3 of Object.keys(t2)) {
|
||
if ("$name" === r3) continue;
|
||
const i3 = t2[r3];
|
||
n2[r3] = Tn[e2].shallow.indexOf(r3) >= 0 ? i3 : On(i3);
|
||
}
|
||
return n2;
|
||
}
|
||
throw new Error("can't deserialize object of type " + typeof t2);
|
||
}
|
||
class Un {
|
||
constructor() {
|
||
this.first = true;
|
||
}
|
||
update(t2, e2) {
|
||
const r2 = Math.floor(t2);
|
||
return this.first ? (this.first = false, this.lastIntegerZoom = r2, this.lastIntegerZoomTime = 0, this.lastZoom = t2, this.lastFloorZoom = r2, true) : (this.lastFloorZoom > r2 ? (this.lastIntegerZoom = r2 + 1, this.lastIntegerZoomTime = e2) : this.lastFloorZoom < r2 && (this.lastIntegerZoom = r2, this.lastIntegerZoomTime = e2), t2 !== this.lastZoom && (this.lastZoom = t2, this.lastFloorZoom = r2, true));
|
||
}
|
||
}
|
||
const Rn = { "Latin-1 Supplement": (t2) => t2 >= 128 && t2 <= 255, Arabic: (t2) => t2 >= 1536 && t2 <= 1791, "Arabic Supplement": (t2) => t2 >= 1872 && t2 <= 1919, "Arabic Extended-A": (t2) => t2 >= 2208 && t2 <= 2303, "Hangul Jamo": (t2) => t2 >= 4352 && t2 <= 4607, "Unified Canadian Aboriginal Syllabics": (t2) => t2 >= 5120 && t2 <= 5759, Khmer: (t2) => t2 >= 6016 && t2 <= 6143, "Unified Canadian Aboriginal Syllabics Extended": (t2) => t2 >= 6320 && t2 <= 6399, "General Punctuation": (t2) => t2 >= 8192 && t2 <= 8303, "Letterlike Symbols": (t2) => t2 >= 8448 && t2 <= 8527, "Number Forms": (t2) => t2 >= 8528 && t2 <= 8591, "Miscellaneous Technical": (t2) => t2 >= 8960 && t2 <= 9215, "Control Pictures": (t2) => t2 >= 9216 && t2 <= 9279, "Optical Character Recognition": (t2) => t2 >= 9280 && t2 <= 9311, "Enclosed Alphanumerics": (t2) => t2 >= 9312 && t2 <= 9471, "Geometric Shapes": (t2) => t2 >= 9632 && t2 <= 9727, "Miscellaneous Symbols": (t2) => t2 >= 9728 && t2 <= 9983, "Miscellaneous Symbols and Arrows": (t2) => t2 >= 11008 && t2 <= 11263, "CJK Radicals Supplement": (t2) => t2 >= 11904 && t2 <= 12031, "Kangxi Radicals": (t2) => t2 >= 12032 && t2 <= 12255, "Ideographic Description Characters": (t2) => t2 >= 12272 && t2 <= 12287, "CJK Symbols and Punctuation": (t2) => t2 >= 12288 && t2 <= 12351, Hiragana: (t2) => t2 >= 12352 && t2 <= 12447, Katakana: (t2) => t2 >= 12448 && t2 <= 12543, Bopomofo: (t2) => t2 >= 12544 && t2 <= 12591, "Hangul Compatibility Jamo": (t2) => t2 >= 12592 && t2 <= 12687, Kanbun: (t2) => t2 >= 12688 && t2 <= 12703, "Bopomofo Extended": (t2) => t2 >= 12704 && t2 <= 12735, "CJK Strokes": (t2) => t2 >= 12736 && t2 <= 12783, "Katakana Phonetic Extensions": (t2) => t2 >= 12784 && t2 <= 12799, "Enclosed CJK Letters and Months": (t2) => t2 >= 12800 && t2 <= 13055, "CJK Compatibility": (t2) => t2 >= 13056 && t2 <= 13311, "CJK Unified Ideographs Extension A": (t2) => t2 >= 13312 && t2 <= 19903, "Yijing Hexagram Symbols": (t2) => t2 >= 19904 && t2 <= 19967, "CJK Unified Ideographs": (t2) => t2 >= 19968 && t2 <= 40959, "Yi Syllables": (t2) => t2 >= 40960 && t2 <= 42127, "Yi Radicals": (t2) => t2 >= 42128 && t2 <= 42191, "Hangul Jamo Extended-A": (t2) => t2 >= 43360 && t2 <= 43391, "Hangul Syllables": (t2) => t2 >= 44032 && t2 <= 55215, "Hangul Jamo Extended-B": (t2) => t2 >= 55216 && t2 <= 55295, "Private Use Area": (t2) => t2 >= 57344 && t2 <= 63743, "CJK Compatibility Ideographs": (t2) => t2 >= 63744 && t2 <= 64255, "Arabic Presentation Forms-A": (t2) => t2 >= 64336 && t2 <= 65023, "Vertical Forms": (t2) => t2 >= 65040 && t2 <= 65055, "CJK Compatibility Forms": (t2) => t2 >= 65072 && t2 <= 65103, "Small Form Variants": (t2) => t2 >= 65104 && t2 <= 65135, "Arabic Presentation Forms-B": (t2) => t2 >= 65136 && t2 <= 65279, "Halfwidth and Fullwidth Forms": (t2) => t2 >= 65280 && t2 <= 65519 };
|
||
function qn(t2) {
|
||
for (const e2 of t2) if (Zn(e2.charCodeAt(0))) return true;
|
||
return false;
|
||
}
|
||
function jn(t2) {
|
||
for (const e2 of t2) if (!Nn(e2.charCodeAt(0))) return false;
|
||
return true;
|
||
}
|
||
function Nn(t2) {
|
||
return !(Rn.Arabic(t2) || Rn["Arabic Supplement"](t2) || Rn["Arabic Extended-A"](t2) || Rn["Arabic Presentation Forms-A"](t2) || Rn["Arabic Presentation Forms-B"](t2));
|
||
}
|
||
function Zn(t2) {
|
||
return !(746 !== t2 && 747 !== t2 && (t2 < 4352 || !(Rn["Bopomofo Extended"](t2) || Rn.Bopomofo(t2) || Rn["CJK Compatibility Forms"](t2) && !(t2 >= 65097 && t2 <= 65103) || Rn["CJK Compatibility Ideographs"](t2) || Rn["CJK Compatibility"](t2) || Rn["CJK Radicals Supplement"](t2) || Rn["CJK Strokes"](t2) || !(!Rn["CJK Symbols and Punctuation"](t2) || t2 >= 12296 && t2 <= 12305 || t2 >= 12308 && t2 <= 12319 || 12336 === t2) || Rn["CJK Unified Ideographs Extension A"](t2) || Rn["CJK Unified Ideographs"](t2) || Rn["Enclosed CJK Letters and Months"](t2) || Rn["Hangul Compatibility Jamo"](t2) || Rn["Hangul Jamo Extended-A"](t2) || Rn["Hangul Jamo Extended-B"](t2) || Rn["Hangul Jamo"](t2) || Rn["Hangul Syllables"](t2) || Rn.Hiragana(t2) || Rn["Ideographic Description Characters"](t2) || Rn.Kanbun(t2) || Rn["Kangxi Radicals"](t2) || Rn["Katakana Phonetic Extensions"](t2) || Rn.Katakana(t2) && 12540 !== t2 || !(!Rn["Halfwidth and Fullwidth Forms"](t2) || 65288 === t2 || 65289 === t2 || 65293 === t2 || t2 >= 65306 && t2 <= 65310 || 65339 === t2 || 65341 === t2 || 65343 === t2 || t2 >= 65371 && t2 <= 65503 || 65507 === t2 || t2 >= 65512 && t2 <= 65519) || !(!Rn["Small Form Variants"](t2) || t2 >= 65112 && t2 <= 65118 || t2 >= 65123 && t2 <= 65126) || Rn["Unified Canadian Aboriginal Syllabics"](t2) || Rn["Unified Canadian Aboriginal Syllabics Extended"](t2) || Rn["Vertical Forms"](t2) || Rn["Yijing Hexagram Symbols"](t2) || Rn["Yi Syllables"](t2) || Rn["Yi Radicals"](t2))));
|
||
}
|
||
function Kn(t2) {
|
||
return !(Zn(t2) || (function(t3) {
|
||
return !!(Rn["Latin-1 Supplement"](t3) && (167 === t3 || 169 === t3 || 174 === t3 || 177 === t3 || 188 === t3 || 189 === t3 || 190 === t3 || 215 === t3 || 247 === t3) || Rn["General Punctuation"](t3) && (8214 === t3 || 8224 === t3 || 8225 === t3 || 8240 === t3 || 8241 === t3 || 8251 === t3 || 8252 === t3 || 8258 === t3 || 8263 === t3 || 8264 === t3 || 8265 === t3 || 8273 === t3) || Rn["Letterlike Symbols"](t3) || Rn["Number Forms"](t3) || Rn["Miscellaneous Technical"](t3) && (t3 >= 8960 && t3 <= 8967 || t3 >= 8972 && t3 <= 8991 || t3 >= 8996 && t3 <= 9e3 || 9003 === t3 || t3 >= 9085 && t3 <= 9114 || t3 >= 9150 && t3 <= 9165 || 9167 === t3 || t3 >= 9169 && t3 <= 9179 || t3 >= 9186 && t3 <= 9215) || Rn["Control Pictures"](t3) && 9251 !== t3 || Rn["Optical Character Recognition"](t3) || Rn["Enclosed Alphanumerics"](t3) || Rn["Geometric Shapes"](t3) || Rn["Miscellaneous Symbols"](t3) && !(t3 >= 9754 && t3 <= 9759) || Rn["Miscellaneous Symbols and Arrows"](t3) && (t3 >= 11026 && t3 <= 11055 || t3 >= 11088 && t3 <= 11097 || t3 >= 11192 && t3 <= 11243) || Rn["CJK Symbols and Punctuation"](t3) || Rn.Katakana(t3) || Rn["Private Use Area"](t3) || Rn["CJK Compatibility Forms"](t3) || Rn["Small Form Variants"](t3) || Rn["Halfwidth and Fullwidth Forms"](t3) || 8734 === t3 || 8756 === t3 || 8757 === t3 || t3 >= 9984 && t3 <= 10087 || t3 >= 10102 && t3 <= 10131 || 65532 === t3 || 65533 === t3);
|
||
})(t2));
|
||
}
|
||
function Gn(t2) {
|
||
return t2 >= 1424 && t2 <= 2303 || Rn["Arabic Presentation Forms-A"](t2) || Rn["Arabic Presentation Forms-B"](t2);
|
||
}
|
||
function Jn(t2, e2) {
|
||
return !(!e2 && Gn(t2) || t2 >= 2304 && t2 <= 3583 || t2 >= 3840 && t2 <= 4255 || Rn.Khmer(t2));
|
||
}
|
||
function Xn(t2) {
|
||
for (const e2 of t2) if (Gn(e2.charCodeAt(0))) return true;
|
||
return false;
|
||
}
|
||
const Yn = "deferred", Hn = "loading", Wn = "loaded";
|
||
let Qn = null, ti = "unavailable", ei = null;
|
||
const ri = function(t2) {
|
||
t2 && "string" == typeof t2 && t2.indexOf("NetworkError") > -1 && (ti = "error"), Qn && Qn(t2);
|
||
};
|
||
function ni() {
|
||
ii.fire(new K("pluginStateChange", { pluginStatus: ti, pluginURL: ei }));
|
||
}
|
||
const ii = new J(), ai = function() {
|
||
return ti;
|
||
}, si = function() {
|
||
if (ti !== Yn || !ei) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");
|
||
ti = Hn, ni(), ei && q({ url: ei }, ((t2) => {
|
||
t2 ? ri(t2) : (ti = Wn, ni());
|
||
}));
|
||
}, oi = { applyArabicShaping: null, processBidirectionalText: null, processStyledBidirectionalText: null, isLoaded: () => ti === Wn || null != oi.applyArabicShaping, isLoading: () => ti === Hn, setState(t2) {
|
||
if (!I()) throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");
|
||
ti = t2.pluginStatus, ei = t2.pluginURL;
|
||
}, isParsed() {
|
||
if (!I()) throw new Error("rtl-text-plugin is only parsed on the worker-threads");
|
||
return null != oi.applyArabicShaping && null != oi.processBidirectionalText && null != oi.processStyledBidirectionalText;
|
||
}, getPluginURL() {
|
||
if (!I()) throw new Error("rtl-text-plugin url can only be queried from the worker threads");
|
||
return ei;
|
||
} };
|
||
class li {
|
||
constructor(t2, e2) {
|
||
this.zoom = t2, e2 ? (this.now = e2.now, this.fadeDuration = e2.fadeDuration, this.zoomHistory = e2.zoomHistory, this.transition = e2.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Un(), this.transition = {});
|
||
}
|
||
isSupportedScript(t2) {
|
||
return (function(t3, e2) {
|
||
for (const r2 of t3) if (!Jn(r2.charCodeAt(0), e2)) return false;
|
||
return true;
|
||
})(t2, oi.isLoaded());
|
||
}
|
||
crossFadingFactor() {
|
||
return 0 === this.fadeDuration ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);
|
||
}
|
||
getCrossfadeParameters() {
|
||
const t2 = this.zoom, e2 = t2 - Math.floor(t2), r2 = this.crossFadingFactor();
|
||
return t2 > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: e2 + (1 - e2) * r2 } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - r2) * e2 };
|
||
}
|
||
}
|
||
class ui {
|
||
constructor(t2, e2) {
|
||
this.property = t2, this.value = e2, this.expression = (function(t3, e3) {
|
||
if (Ir(t3)) return new Ur(t3, e3);
|
||
if (Tr(t3)) {
|
||
const r2 = Or(t3, e3);
|
||
if ("error" === r2.result) throw new Error(r2.value.map(((t4) => `${t4.key}: ${t4.message}`)).join(", "));
|
||
return r2.value;
|
||
}
|
||
{
|
||
let r2 = t3;
|
||
return "color" === e3.type && "string" == typeof t3 ? r2 = Yt.parse(t3) : "padding" !== e3.type || "number" != typeof t3 && !Array.isArray(t3) ? "variableAnchorOffsetCollection" === e3.type && Array.isArray(t3) && (r2 = re.parse(t3)) : r2 = te.parse(t3), { kind: "constant", evaluate: () => r2 };
|
||
}
|
||
})(void 0 === e2 ? t2.specification.default : e2, t2.specification);
|
||
}
|
||
isDataDriven() {
|
||
return "source" === this.expression.kind || "composite" === this.expression.kind;
|
||
}
|
||
possiblyEvaluate(t2, e2, r2) {
|
||
return this.property.possiblyEvaluate(this, t2, e2, r2);
|
||
}
|
||
}
|
||
class ci {
|
||
constructor(t2) {
|
||
this.property = t2, this.value = new ui(t2, void 0);
|
||
}
|
||
transitioned(t2, e2) {
|
||
return new pi(this.property, this.value, e2, g({}, t2.transition, this.transition), t2.now);
|
||
}
|
||
untransitioned() {
|
||
return new pi(this.property, this.value, null, {}, 0);
|
||
}
|
||
}
|
||
class hi {
|
||
constructor(t2) {
|
||
this._properties = t2, this._values = Object.create(t2.defaultTransitionablePropertyValues);
|
||
}
|
||
getValue(t2) {
|
||
return w(this._values[t2].value.value);
|
||
}
|
||
setValue(t2, e2) {
|
||
Object.prototype.hasOwnProperty.call(this._values, t2) || (this._values[t2] = new ci(this._values[t2].property)), this._values[t2].value = new ui(this._values[t2].property, null === e2 ? void 0 : w(e2));
|
||
}
|
||
getTransition(t2) {
|
||
return w(this._values[t2].transition);
|
||
}
|
||
setTransition(t2, e2) {
|
||
Object.prototype.hasOwnProperty.call(this._values, t2) || (this._values[t2] = new ci(this._values[t2].property)), this._values[t2].transition = w(e2) || void 0;
|
||
}
|
||
serialize() {
|
||
const t2 = {};
|
||
for (const e2 of Object.keys(this._values)) {
|
||
const r2 = this.getValue(e2);
|
||
void 0 !== r2 && (t2[e2] = r2);
|
||
const n2 = this.getTransition(e2);
|
||
void 0 !== n2 && (t2[`${e2}-transition`] = n2);
|
||
}
|
||
return t2;
|
||
}
|
||
transitioned(t2, e2) {
|
||
const r2 = new fi(this._properties);
|
||
for (const n2 of Object.keys(this._values)) r2._values[n2] = this._values[n2].transitioned(t2, e2._values[n2]);
|
||
return r2;
|
||
}
|
||
untransitioned() {
|
||
const t2 = new fi(this._properties);
|
||
for (const e2 of Object.keys(this._values)) t2._values[e2] = this._values[e2].untransitioned();
|
||
return t2;
|
||
}
|
||
}
|
||
class pi {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
this.property = t2, this.value = e2, this.begin = i3 + n2.delay || 0, this.end = this.begin + n2.duration || 0, t2.specification.transition && (n2.delay || n2.duration) && (this.prior = r2);
|
||
}
|
||
possiblyEvaluate(t2, e2, r2) {
|
||
const n2 = t2.now || 0, i3 = this.value.possiblyEvaluate(t2, e2, r2), a2 = this.prior;
|
||
if (a2) {
|
||
if (n2 > this.end) return this.prior = null, i3;
|
||
if (this.value.isDataDriven()) return this.prior = null, i3;
|
||
if (n2 < this.begin) return a2.possiblyEvaluate(t2, e2, r2);
|
||
{
|
||
const s2 = (n2 - this.begin) / (this.end - this.begin);
|
||
return this.property.interpolate(a2.possiblyEvaluate(t2, e2, r2), i3, (function(t3) {
|
||
if (t3 <= 0) return 0;
|
||
if (t3 >= 1) return 1;
|
||
const e3 = t3 * t3, r3 = e3 * t3;
|
||
return 4 * (t3 < 0.5 ? r3 : 3 * (t3 - e3) + r3 - 0.75);
|
||
})(s2));
|
||
}
|
||
}
|
||
return i3;
|
||
}
|
||
}
|
||
class fi {
|
||
constructor(t2) {
|
||
this._properties = t2, this._values = Object.create(t2.defaultTransitioningPropertyValues);
|
||
}
|
||
possiblyEvaluate(t2, e2, r2) {
|
||
const n2 = new mi(this._properties);
|
||
for (const i3 of Object.keys(this._values)) n2._values[i3] = this._values[i3].possiblyEvaluate(t2, e2, r2);
|
||
return n2;
|
||
}
|
||
hasTransition() {
|
||
for (const t2 of Object.keys(this._values)) if (this._values[t2].prior) return true;
|
||
return false;
|
||
}
|
||
}
|
||
class di {
|
||
constructor(t2) {
|
||
this._properties = t2, this._values = Object.create(t2.defaultPropertyValues);
|
||
}
|
||
hasValue(t2) {
|
||
return void 0 !== this._values[t2].value;
|
||
}
|
||
getValue(t2) {
|
||
return w(this._values[t2].value);
|
||
}
|
||
setValue(t2, e2) {
|
||
this._values[t2] = new ui(this._values[t2].property, null === e2 ? void 0 : w(e2));
|
||
}
|
||
serialize() {
|
||
const t2 = {};
|
||
for (const e2 of Object.keys(this._values)) {
|
||
const r2 = this.getValue(e2);
|
||
void 0 !== r2 && (t2[e2] = r2);
|
||
}
|
||
return t2;
|
||
}
|
||
possiblyEvaluate(t2, e2, r2) {
|
||
const n2 = new mi(this._properties);
|
||
for (const i3 of Object.keys(this._values)) n2._values[i3] = this._values[i3].possiblyEvaluate(t2, e2, r2);
|
||
return n2;
|
||
}
|
||
}
|
||
class yi {
|
||
constructor(t2, e2, r2) {
|
||
this.property = t2, this.value = e2, this.parameters = r2;
|
||
}
|
||
isConstant() {
|
||
return "constant" === this.value.kind;
|
||
}
|
||
constantOr(t2) {
|
||
return "constant" === this.value.kind ? this.value.value : t2;
|
||
}
|
||
evaluate(t2, e2, r2, n2) {
|
||
return this.property.evaluate(this.value, this.parameters, t2, e2, r2, n2);
|
||
}
|
||
}
|
||
class mi {
|
||
constructor(t2) {
|
||
this._properties = t2, this._values = Object.create(t2.defaultPossiblyEvaluatedValues);
|
||
}
|
||
get(t2) {
|
||
return this._values[t2];
|
||
}
|
||
}
|
||
class gi {
|
||
constructor(t2) {
|
||
this.specification = t2;
|
||
}
|
||
possiblyEvaluate(t2, e2) {
|
||
if (t2.isDataDriven()) throw new Error("Value should not be data driven");
|
||
return t2.expression.evaluate(e2);
|
||
}
|
||
interpolate(t2, e2, r2) {
|
||
const n2 = Ze[this.specification.type];
|
||
return n2 ? n2(t2, e2, r2) : t2;
|
||
}
|
||
}
|
||
class xi {
|
||
constructor(t2, e2) {
|
||
this.specification = t2, this.overrides = e2;
|
||
}
|
||
possiblyEvaluate(t2, e2, r2, n2) {
|
||
return new yi(this, "constant" === t2.expression.kind || "camera" === t2.expression.kind ? { kind: "constant", value: t2.expression.evaluate(e2, null, {}, r2, n2) } : t2.expression, e2);
|
||
}
|
||
interpolate(t2, e2, r2) {
|
||
if ("constant" !== t2.value.kind || "constant" !== e2.value.kind) return t2;
|
||
if (void 0 === t2.value.value || void 0 === e2.value.value) return new yi(this, { kind: "constant", value: void 0 }, t2.parameters);
|
||
const n2 = Ze[this.specification.type];
|
||
if (n2) {
|
||
const i3 = n2(t2.value.value, e2.value.value, r2);
|
||
return new yi(this, { kind: "constant", value: i3 }, t2.parameters);
|
||
}
|
||
return t2;
|
||
}
|
||
evaluate(t2, e2, r2, n2, i3, a2) {
|
||
return "constant" === t2.kind ? t2.value : t2.evaluate(e2, r2, n2, i3, a2);
|
||
}
|
||
}
|
||
class vi extends xi {
|
||
possiblyEvaluate(t2, e2, r2, n2) {
|
||
if (void 0 === t2.value) return new yi(this, { kind: "constant", value: void 0 }, e2);
|
||
if ("constant" === t2.expression.kind) {
|
||
const i3 = t2.expression.evaluate(e2, null, {}, r2, n2), a2 = "resolvedImage" === t2.property.specification.type && "string" != typeof i3 ? i3.name : i3, s2 = this._calculate(a2, a2, a2, e2);
|
||
return new yi(this, { kind: "constant", value: s2 }, e2);
|
||
}
|
||
if ("camera" === t2.expression.kind) {
|
||
const r3 = this._calculate(t2.expression.evaluate({ zoom: e2.zoom - 1 }), t2.expression.evaluate({ zoom: e2.zoom }), t2.expression.evaluate({ zoom: e2.zoom + 1 }), e2);
|
||
return new yi(this, { kind: "constant", value: r3 }, e2);
|
||
}
|
||
return new yi(this, t2.expression, e2);
|
||
}
|
||
evaluate(t2, e2, r2, n2, i3, a2) {
|
||
if ("source" === t2.kind) {
|
||
const s2 = t2.evaluate(e2, r2, n2, i3, a2);
|
||
return this._calculate(s2, s2, s2, e2);
|
||
}
|
||
return "composite" === t2.kind ? this._calculate(t2.evaluate({ zoom: Math.floor(e2.zoom) - 1 }, r2, n2), t2.evaluate({ zoom: Math.floor(e2.zoom) }, r2, n2), t2.evaluate({ zoom: Math.floor(e2.zoom) + 1 }, r2, n2), e2) : t2.value;
|
||
}
|
||
_calculate(t2, e2, r2, n2) {
|
||
return n2.zoom > n2.zoomHistory.lastIntegerZoom ? { from: t2, to: e2 } : { from: r2, to: e2 };
|
||
}
|
||
interpolate(t2) {
|
||
return t2;
|
||
}
|
||
}
|
||
class bi {
|
||
constructor(t2) {
|
||
this.specification = t2;
|
||
}
|
||
possiblyEvaluate(t2, e2, r2, n2) {
|
||
if (void 0 !== t2.value) {
|
||
if ("constant" === t2.expression.kind) {
|
||
const i3 = t2.expression.evaluate(e2, null, {}, r2, n2);
|
||
return this._calculate(i3, i3, i3, e2);
|
||
}
|
||
return this._calculate(t2.expression.evaluate(new li(Math.floor(e2.zoom - 1), e2)), t2.expression.evaluate(new li(Math.floor(e2.zoom), e2)), t2.expression.evaluate(new li(Math.floor(e2.zoom + 1), e2)), e2);
|
||
}
|
||
}
|
||
_calculate(t2, e2, r2, n2) {
|
||
return n2.zoom > n2.zoomHistory.lastIntegerZoom ? { from: t2, to: e2 } : { from: r2, to: e2 };
|
||
}
|
||
interpolate(t2) {
|
||
return t2;
|
||
}
|
||
}
|
||
class wi {
|
||
constructor(t2) {
|
||
this.specification = t2;
|
||
}
|
||
possiblyEvaluate(t2, e2, r2, n2) {
|
||
return !!t2.expression.evaluate(e2, null, {}, r2, n2);
|
||
}
|
||
interpolate() {
|
||
return false;
|
||
}
|
||
}
|
||
class _i {
|
||
constructor(t2) {
|
||
this.properties = t2, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [];
|
||
for (const e2 in t2) {
|
||
const r2 = t2[e2];
|
||
r2.specification.overridable && this.overridableProperties.push(e2);
|
||
const n2 = this.defaultPropertyValues[e2] = new ui(r2, void 0), i3 = this.defaultTransitionablePropertyValues[e2] = new ci(r2);
|
||
this.defaultTransitioningPropertyValues[e2] = i3.untransitioned(), this.defaultPossiblyEvaluatedValues[e2] = n2.possiblyEvaluate({});
|
||
}
|
||
}
|
||
}
|
||
$n("DataDrivenProperty", xi), $n("DataConstantProperty", gi), $n("CrossFadedDataDrivenProperty", vi), $n("CrossFadedProperty", bi), $n("ColorRampProperty", wi);
|
||
const Ai = "-transition";
|
||
class Si extends J {
|
||
constructor(t2, e2) {
|
||
if (super(), this.id = t2.id, this.type = t2.type, this._featureFilter = { filter: () => true, needGeometry: false }, "custom" !== t2.type && (this.metadata = t2.metadata, this.minzoom = t2.minzoom, this.maxzoom = t2.maxzoom, "background" !== t2.type && (this.source = t2.source, this.sourceLayer = t2["source-layer"], this.filter = t2.filter), e2.layout && (this._unevaluatedLayout = new di(e2.layout)), e2.paint)) {
|
||
this._transitionablePaint = new hi(e2.paint);
|
||
for (const e3 in t2.paint) this.setPaintProperty(e3, t2.paint[e3], { validate: false });
|
||
for (const e3 in t2.layout) this.setLayoutProperty(e3, t2.layout[e3], { validate: false });
|
||
this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new mi(e2.paint);
|
||
}
|
||
}
|
||
getCrossfadeParameters() {
|
||
return this._crossfadeParameters;
|
||
}
|
||
getLayoutProperty(t2) {
|
||
return "visibility" === t2 ? this.visibility : this._unevaluatedLayout.getValue(t2);
|
||
}
|
||
setLayoutProperty(t2, e2, r2 = {}) {
|
||
null != e2 && this._validate(Vn, `layers.${this.id}.layout.${t2}`, t2, e2, r2) || ("visibility" !== t2 ? this._unevaluatedLayout.setValue(t2, e2) : this.visibility = e2);
|
||
}
|
||
getPaintProperty(t2) {
|
||
return t2.endsWith(Ai) ? this._transitionablePaint.getTransition(t2.slice(0, -11)) : this._transitionablePaint.getValue(t2);
|
||
}
|
||
setPaintProperty(t2, e2, r2 = {}) {
|
||
if (null != e2 && this._validate(Pn, `layers.${this.id}.paint.${t2}`, t2, e2, r2)) return false;
|
||
if (t2.endsWith(Ai)) return this._transitionablePaint.setTransition(t2.slice(0, -11), e2 || void 0), false;
|
||
{
|
||
const r3 = this._transitionablePaint._values[t2], n2 = "cross-faded-data-driven" === r3.property.specification["property-type"], i3 = r3.value.isDataDriven(), a2 = r3.value;
|
||
this._transitionablePaint.setValue(t2, e2), this._handleSpecialPaintPropertyUpdate(t2);
|
||
const s2 = this._transitionablePaint._values[t2].value;
|
||
return s2.isDataDriven() || i3 || n2 || this._handleOverridablePaintPropertyUpdate(t2, a2, s2);
|
||
}
|
||
}
|
||
_handleSpecialPaintPropertyUpdate(t2) {
|
||
}
|
||
_handleOverridablePaintPropertyUpdate(t2, e2, r2) {
|
||
return false;
|
||
}
|
||
isHidden(t2) {
|
||
return !!(this.minzoom && t2 < this.minzoom) || !!(this.maxzoom && t2 >= this.maxzoom) || "none" === this.visibility;
|
||
}
|
||
updateTransitions(t2) {
|
||
this._transitioningPaint = this._transitionablePaint.transitioned(t2, this._transitioningPaint);
|
||
}
|
||
hasTransition() {
|
||
return this._transitioningPaint.hasTransition();
|
||
}
|
||
recalculate(t2, e2) {
|
||
t2.getCrossfadeParameters && (this._crossfadeParameters = t2.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t2, void 0, e2)), this.paint = this._transitioningPaint.possiblyEvaluate(t2, void 0, e2);
|
||
}
|
||
serialize() {
|
||
const t2 = { id: this.id, type: this.type, source: this.source, "source-layer": this.sourceLayer, metadata: this.metadata, minzoom: this.minzoom, maxzoom: this.maxzoom, filter: this.filter, layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), paint: this._transitionablePaint && this._transitionablePaint.serialize() };
|
||
return this.visibility && (t2.layout = t2.layout || {}, t2.layout.visibility = this.visibility), b(t2, ((t3, e2) => !(void 0 === t3 || "layout" === e2 && !Object.keys(t3).length || "paint" === e2 && !Object.keys(t3).length)));
|
||
}
|
||
_validate(t2, e2, r2, n2, i3 = {}) {
|
||
return (!i3 || false !== i3.validate) && En(this, t2.call(Cn, { key: e2, layerType: this.type, objectKey: r2, value: n2, styleSpec: X, style: { glyphs: true, sprite: true } }));
|
||
}
|
||
is3D() {
|
||
return false;
|
||
}
|
||
isTileClipped() {
|
||
return false;
|
||
}
|
||
hasOffscreenPass() {
|
||
return false;
|
||
}
|
||
resize() {
|
||
}
|
||
isStateDependent() {
|
||
for (const t2 in this.paint._values) {
|
||
const e2 = this.paint.get(t2);
|
||
if (e2 instanceof yi && _r(e2.property.specification) && ("source" === e2.value.kind || "composite" === e2.value.kind) && e2.value.isStateDependent) return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
const ki = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array };
|
||
class Ii {
|
||
constructor(t2, e2) {
|
||
this._structArray = t2, this._pos1 = e2 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;
|
||
}
|
||
}
|
||
class zi {
|
||
constructor() {
|
||
this.isTransferred = false, this.capacity = -1, this.resize(0);
|
||
}
|
||
static serialize(t2, e2) {
|
||
return t2._trim(), e2 && (t2.isTransferred = true, e2.push(t2.arrayBuffer)), { length: t2.length, arrayBuffer: t2.arrayBuffer };
|
||
}
|
||
static deserialize(t2) {
|
||
const e2 = Object.create(this.prototype);
|
||
return e2.arrayBuffer = t2.arrayBuffer, e2.length = t2.length, e2.capacity = t2.arrayBuffer.byteLength / e2.bytesPerElement, e2._refreshViews(), e2;
|
||
}
|
||
_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(t2) {
|
||
this.reserve(t2), this.length = t2;
|
||
}
|
||
reserve(t2) {
|
||
if (t2 > this.capacity) {
|
||
this.capacity = Math.max(t2, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
|
||
const e2 = this.uint8;
|
||
this._refreshViews(), e2 && this.uint8.set(e2);
|
||
}
|
||
}
|
||
_refreshViews() {
|
||
throw new Error("_refreshViews() must be implemented by each concrete StructArray layout");
|
||
}
|
||
}
|
||
function Mi(t2, e2 = 1) {
|
||
let r2 = 0, n2 = 0;
|
||
return { members: t2.map(((t3) => {
|
||
const i3 = ki[t3.type].BYTES_PER_ELEMENT, a2 = r2 = Ci(r2, Math.max(e2, i3)), s2 = t3.components || 1;
|
||
return n2 = Math.max(n2, i3), r2 += i3 * s2, { name: t3.name, type: t3.type, components: s2, offset: a2 };
|
||
})), size: Ci(r2, Math.max(n2, e2)), alignment: e2 };
|
||
}
|
||
function Ci(t2, e2) {
|
||
return Math.ceil(t2 / e2) * e2;
|
||
}
|
||
class Bi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2) {
|
||
const r2 = this.length;
|
||
return this.resize(r2 + 1), this.emplace(r2, t2, e2);
|
||
}
|
||
emplace(t2, e2, r2) {
|
||
const n2 = 2 * t2;
|
||
return this.int16[n2 + 0] = e2, this.int16[n2 + 1] = r2, t2;
|
||
}
|
||
}
|
||
Bi.prototype.bytesPerElement = 4, $n("StructArrayLayout2i4", Bi);
|
||
class Pi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2) {
|
||
const n2 = this.length;
|
||
return this.resize(n2 + 1), this.emplace(n2, t2, e2, r2);
|
||
}
|
||
emplace(t2, e2, r2, n2) {
|
||
const i3 = 3 * t2;
|
||
return this.int16[i3 + 0] = e2, this.int16[i3 + 1] = r2, this.int16[i3 + 2] = n2, t2;
|
||
}
|
||
}
|
||
Pi.prototype.bytesPerElement = 6, $n("StructArrayLayout3i6", Pi);
|
||
class Vi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2) {
|
||
const i3 = this.length;
|
||
return this.resize(i3 + 1), this.emplace(i3, t2, e2, r2, n2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3) {
|
||
const a2 = 4 * t2;
|
||
return this.int16[a2 + 0] = e2, this.int16[a2 + 1] = r2, this.int16[a2 + 2] = n2, this.int16[a2 + 3] = i3, t2;
|
||
}
|
||
}
|
||
Vi.prototype.bytesPerElement = 8, $n("StructArrayLayout4i8", Vi);
|
||
class Ei extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = this.length;
|
||
return this.resize(s2 + 1), this.emplace(s2, t2, e2, r2, n2, i3, a2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2) {
|
||
const o2 = 6 * t2;
|
||
return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.int16[o2 + 2] = n2, this.int16[o2 + 3] = i3, this.int16[o2 + 4] = a2, this.int16[o2 + 5] = s2, t2;
|
||
}
|
||
}
|
||
Ei.prototype.bytesPerElement = 12, $n("StructArrayLayout2i4i12", Ei);
|
||
class Fi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = this.length;
|
||
return this.resize(s2 + 1), this.emplace(s2, t2, e2, r2, n2, i3, a2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2) {
|
||
const o2 = 4 * t2, l2 = 8 * t2;
|
||
return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.uint8[l2 + 4] = n2, this.uint8[l2 + 5] = i3, this.uint8[l2 + 6] = a2, this.uint8[l2 + 7] = s2, t2;
|
||
}
|
||
}
|
||
Fi.prototype.bytesPerElement = 8, $n("StructArrayLayout2i4ub8", Fi);
|
||
class Ti extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2) {
|
||
const r2 = this.length;
|
||
return this.resize(r2 + 1), this.emplace(r2, t2, e2);
|
||
}
|
||
emplace(t2, e2, r2) {
|
||
const n2 = 2 * t2;
|
||
return this.float32[n2 + 0] = e2, this.float32[n2 + 1] = r2, t2;
|
||
}
|
||
}
|
||
Ti.prototype.bytesPerElement = 8, $n("StructArrayLayout2f8", Ti);
|
||
class $i extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2) {
|
||
const c2 = this.length;
|
||
return this.resize(c2 + 1), this.emplace(c2, t2, e2, r2, n2, i3, a2, s2, o2, l2, u2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2) {
|
||
const h2 = 10 * t2;
|
||
return this.uint16[h2 + 0] = e2, this.uint16[h2 + 1] = r2, this.uint16[h2 + 2] = n2, this.uint16[h2 + 3] = i3, this.uint16[h2 + 4] = a2, this.uint16[h2 + 5] = s2, this.uint16[h2 + 6] = o2, this.uint16[h2 + 7] = l2, this.uint16[h2 + 8] = u2, this.uint16[h2 + 9] = c2, t2;
|
||
}
|
||
}
|
||
$i.prototype.bytesPerElement = 20, $n("StructArrayLayout10ui20", $i);
|
||
class Li extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2) {
|
||
const p2 = this.length;
|
||
return this.resize(p2 + 1), this.emplace(p2, t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2) {
|
||
const f2 = 12 * t2;
|
||
return this.int16[f2 + 0] = e2, this.int16[f2 + 1] = r2, this.int16[f2 + 2] = n2, this.int16[f2 + 3] = i3, this.uint16[f2 + 4] = a2, this.uint16[f2 + 5] = s2, this.uint16[f2 + 6] = o2, this.uint16[f2 + 7] = l2, this.int16[f2 + 8] = u2, this.int16[f2 + 9] = c2, this.int16[f2 + 10] = h2, this.int16[f2 + 11] = p2, t2;
|
||
}
|
||
}
|
||
Li.prototype.bytesPerElement = 24, $n("StructArrayLayout4i4ui4i24", Li);
|
||
class Di extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2) {
|
||
const n2 = this.length;
|
||
return this.resize(n2 + 1), this.emplace(n2, t2, e2, r2);
|
||
}
|
||
emplace(t2, e2, r2, n2) {
|
||
const i3 = 3 * t2;
|
||
return this.float32[i3 + 0] = e2, this.float32[i3 + 1] = r2, this.float32[i3 + 2] = n2, t2;
|
||
}
|
||
}
|
||
Di.prototype.bytesPerElement = 12, $n("StructArrayLayout3f12", Di);
|
||
class Oi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2) {
|
||
const e2 = this.length;
|
||
return this.resize(e2 + 1), this.emplace(e2, t2);
|
||
}
|
||
emplace(t2, e2) {
|
||
return this.uint32[1 * t2 + 0] = e2, t2;
|
||
}
|
||
}
|
||
Oi.prototype.bytesPerElement = 4, $n("StructArrayLayout1ul4", Oi);
|
||
class Ui extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2, s2, o2, l2) {
|
||
const u2 = this.length;
|
||
return this.resize(u2 + 1), this.emplace(u2, t2, e2, r2, n2, i3, a2, s2, o2, l2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2) {
|
||
const c2 = 10 * t2, h2 = 5 * t2;
|
||
return this.int16[c2 + 0] = e2, this.int16[c2 + 1] = r2, this.int16[c2 + 2] = n2, this.int16[c2 + 3] = i3, this.int16[c2 + 4] = a2, this.int16[c2 + 5] = s2, this.uint32[h2 + 3] = o2, this.uint16[c2 + 8] = l2, this.uint16[c2 + 9] = u2, t2;
|
||
}
|
||
}
|
||
Ui.prototype.bytesPerElement = 20, $n("StructArrayLayout6i1ul2ui20", Ui);
|
||
class Ri extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = this.length;
|
||
return this.resize(s2 + 1), this.emplace(s2, t2, e2, r2, n2, i3, a2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2) {
|
||
const o2 = 6 * t2;
|
||
return this.int16[o2 + 0] = e2, this.int16[o2 + 1] = r2, this.int16[o2 + 2] = n2, this.int16[o2 + 3] = i3, this.int16[o2 + 4] = a2, this.int16[o2 + 5] = s2, t2;
|
||
}
|
||
}
|
||
Ri.prototype.bytesPerElement = 12, $n("StructArrayLayout2i2i2i12", Ri);
|
||
class qi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3) {
|
||
const a2 = this.length;
|
||
return this.resize(a2 + 1), this.emplace(a2, t2, e2, r2, n2, i3);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = 4 * t2, o2 = 8 * t2;
|
||
return this.float32[s2 + 0] = e2, this.float32[s2 + 1] = r2, this.float32[s2 + 2] = n2, this.int16[o2 + 6] = i3, this.int16[o2 + 7] = a2, t2;
|
||
}
|
||
}
|
||
qi.prototype.bytesPerElement = 16, $n("StructArrayLayout2f1f2i16", qi);
|
||
class ji extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2) {
|
||
const i3 = this.length;
|
||
return this.resize(i3 + 1), this.emplace(i3, t2, e2, r2, n2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3) {
|
||
const a2 = 12 * t2, s2 = 3 * t2;
|
||
return this.uint8[a2 + 0] = e2, this.uint8[a2 + 1] = r2, this.float32[s2 + 1] = n2, this.float32[s2 + 2] = i3, t2;
|
||
}
|
||
}
|
||
ji.prototype.bytesPerElement = 12, $n("StructArrayLayout2ub2f12", ji);
|
||
class Ni extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2) {
|
||
const n2 = this.length;
|
||
return this.resize(n2 + 1), this.emplace(n2, t2, e2, r2);
|
||
}
|
||
emplace(t2, e2, r2, n2) {
|
||
const i3 = 3 * t2;
|
||
return this.uint16[i3 + 0] = e2, this.uint16[i3 + 1] = r2, this.uint16[i3 + 2] = n2, t2;
|
||
}
|
||
}
|
||
Ni.prototype.bytesPerElement = 6, $n("StructArrayLayout3ui6", Ni);
|
||
class Zi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2) {
|
||
const g2 = this.length;
|
||
return this.resize(g2 + 1), this.emplace(g2, t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2) {
|
||
const x2 = 24 * t2, v2 = 12 * t2, b2 = 48 * t2;
|
||
return this.int16[x2 + 0] = e2, this.int16[x2 + 1] = r2, this.uint16[x2 + 2] = n2, this.uint16[x2 + 3] = i3, this.uint32[v2 + 2] = a2, this.uint32[v2 + 3] = s2, this.uint32[v2 + 4] = o2, this.uint16[x2 + 10] = l2, this.uint16[x2 + 11] = u2, this.uint16[x2 + 12] = c2, this.float32[v2 + 7] = h2, this.float32[v2 + 8] = p2, this.uint8[b2 + 36] = f2, this.uint8[b2 + 37] = d2, this.uint8[b2 + 38] = y2, this.uint32[v2 + 10] = m2, this.int16[x2 + 22] = g2, t2;
|
||
}
|
||
}
|
||
Zi.prototype.bytesPerElement = 48, $n("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", Zi);
|
||
class Ki extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A2, S2, k2, I2, z2) {
|
||
const M2 = this.length;
|
||
return this.resize(M2 + 1), this.emplace(M2, t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A2, S2, k2, I2, z2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, A2, S2, k2, I2, z2, M2) {
|
||
const C2 = 32 * t2, B2 = 16 * t2;
|
||
return this.int16[C2 + 0] = e2, this.int16[C2 + 1] = r2, this.int16[C2 + 2] = n2, this.int16[C2 + 3] = i3, this.int16[C2 + 4] = a2, this.int16[C2 + 5] = s2, this.int16[C2 + 6] = o2, this.int16[C2 + 7] = l2, this.uint16[C2 + 8] = u2, this.uint16[C2 + 9] = c2, this.uint16[C2 + 10] = h2, this.uint16[C2 + 11] = p2, this.uint16[C2 + 12] = f2, this.uint16[C2 + 13] = d2, this.uint16[C2 + 14] = y2, this.uint16[C2 + 15] = m2, this.uint16[C2 + 16] = g2, this.uint16[C2 + 17] = x2, this.uint16[C2 + 18] = v2, this.uint16[C2 + 19] = b2, this.uint16[C2 + 20] = w2, this.uint16[C2 + 21] = _2, this.uint16[C2 + 22] = A2, this.uint32[B2 + 12] = S2, this.float32[B2 + 13] = k2, this.float32[B2 + 14] = I2, this.uint16[C2 + 30] = z2, this.uint16[C2 + 31] = M2, t2;
|
||
}
|
||
}
|
||
Ki.prototype.bytesPerElement = 64, $n("StructArrayLayout8i15ui1ul2f2ui64", Ki);
|
||
class Gi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2) {
|
||
const e2 = this.length;
|
||
return this.resize(e2 + 1), this.emplace(e2, t2);
|
||
}
|
||
emplace(t2, e2) {
|
||
return this.float32[1 * t2 + 0] = e2, t2;
|
||
}
|
||
}
|
||
Gi.prototype.bytesPerElement = 4, $n("StructArrayLayout1f4", Gi);
|
||
class Ji extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2) {
|
||
const n2 = this.length;
|
||
return this.resize(n2 + 1), this.emplace(n2, t2, e2, r2);
|
||
}
|
||
emplace(t2, e2, r2, n2) {
|
||
const i3 = 3 * t2;
|
||
return this.uint16[6 * t2 + 0] = e2, this.float32[i3 + 1] = r2, this.float32[i3 + 2] = n2, t2;
|
||
}
|
||
}
|
||
Ji.prototype.bytesPerElement = 12, $n("StructArrayLayout1ui2f12", Ji);
|
||
class Xi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2) {
|
||
const n2 = this.length;
|
||
return this.resize(n2 + 1), this.emplace(n2, t2, e2, r2);
|
||
}
|
||
emplace(t2, e2, r2, n2) {
|
||
const i3 = 4 * t2;
|
||
return this.uint32[2 * t2 + 0] = e2, this.uint16[i3 + 2] = r2, this.uint16[i3 + 3] = n2, t2;
|
||
}
|
||
}
|
||
Xi.prototype.bytesPerElement = 8, $n("StructArrayLayout1ul2ui8", Xi);
|
||
class Yi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2) {
|
||
const r2 = this.length;
|
||
return this.resize(r2 + 1), this.emplace(r2, t2, e2);
|
||
}
|
||
emplace(t2, e2, r2) {
|
||
const n2 = 2 * t2;
|
||
return this.uint16[n2 + 0] = e2, this.uint16[n2 + 1] = r2, t2;
|
||
}
|
||
}
|
||
Yi.prototype.bytesPerElement = 4, $n("StructArrayLayout2ui4", Yi);
|
||
class Hi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2) {
|
||
const e2 = this.length;
|
||
return this.resize(e2 + 1), this.emplace(e2, t2);
|
||
}
|
||
emplace(t2, e2) {
|
||
return this.uint16[1 * t2 + 0] = e2, t2;
|
||
}
|
||
}
|
||
Hi.prototype.bytesPerElement = 2, $n("StructArrayLayout1ui2", Hi);
|
||
class Wi extends zi {
|
||
_refreshViews() {
|
||
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
|
||
}
|
||
emplaceBack(t2, e2, r2, n2) {
|
||
const i3 = this.length;
|
||
return this.resize(i3 + 1), this.emplace(i3, t2, e2, r2, n2);
|
||
}
|
||
emplace(t2, e2, r2, n2, i3) {
|
||
const a2 = 4 * t2;
|
||
return this.float32[a2 + 0] = e2, this.float32[a2 + 1] = r2, this.float32[a2 + 2] = n2, this.float32[a2 + 3] = i3, t2;
|
||
}
|
||
}
|
||
Wi.prototype.bytesPerElement = 16, $n("StructArrayLayout4f16", Wi);
|
||
class Qi extends Ii {
|
||
get anchorPointX() {
|
||
return this._structArray.int16[this._pos2 + 0];
|
||
}
|
||
get anchorPointY() {
|
||
return this._structArray.int16[this._pos2 + 1];
|
||
}
|
||
get x1() {
|
||
return this._structArray.int16[this._pos2 + 2];
|
||
}
|
||
get y1() {
|
||
return this._structArray.int16[this._pos2 + 3];
|
||
}
|
||
get x2() {
|
||
return this._structArray.int16[this._pos2 + 4];
|
||
}
|
||
get y2() {
|
||
return this._structArray.int16[this._pos2 + 5];
|
||
}
|
||
get featureIndex() {
|
||
return this._structArray.uint32[this._pos4 + 3];
|
||
}
|
||
get sourceLayerIndex() {
|
||
return this._structArray.uint16[this._pos2 + 8];
|
||
}
|
||
get bucketIndex() {
|
||
return this._structArray.uint16[this._pos2 + 9];
|
||
}
|
||
get anchorPoint() {
|
||
return new a(this.anchorPointX, this.anchorPointY);
|
||
}
|
||
}
|
||
Qi.prototype.size = 20;
|
||
class ta extends Ui {
|
||
get(t2) {
|
||
return new Qi(this, t2);
|
||
}
|
||
}
|
||
$n("CollisionBoxArray", ta);
|
||
class ea extends Ii {
|
||
get anchorX() {
|
||
return this._structArray.int16[this._pos2 + 0];
|
||
}
|
||
get anchorY() {
|
||
return this._structArray.int16[this._pos2 + 1];
|
||
}
|
||
get glyphStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 2];
|
||
}
|
||
get numGlyphs() {
|
||
return this._structArray.uint16[this._pos2 + 3];
|
||
}
|
||
get vertexStartIndex() {
|
||
return this._structArray.uint32[this._pos4 + 2];
|
||
}
|
||
get lineStartIndex() {
|
||
return this._structArray.uint32[this._pos4 + 3];
|
||
}
|
||
get lineLength() {
|
||
return this._structArray.uint32[this._pos4 + 4];
|
||
}
|
||
get segment() {
|
||
return this._structArray.uint16[this._pos2 + 10];
|
||
}
|
||
get lowerSize() {
|
||
return this._structArray.uint16[this._pos2 + 11];
|
||
}
|
||
get upperSize() {
|
||
return this._structArray.uint16[this._pos2 + 12];
|
||
}
|
||
get lineOffsetX() {
|
||
return this._structArray.float32[this._pos4 + 7];
|
||
}
|
||
get lineOffsetY() {
|
||
return this._structArray.float32[this._pos4 + 8];
|
||
}
|
||
get writingMode() {
|
||
return this._structArray.uint8[this._pos1 + 36];
|
||
}
|
||
get placedOrientation() {
|
||
return this._structArray.uint8[this._pos1 + 37];
|
||
}
|
||
set placedOrientation(t2) {
|
||
this._structArray.uint8[this._pos1 + 37] = t2;
|
||
}
|
||
get hidden() {
|
||
return this._structArray.uint8[this._pos1 + 38];
|
||
}
|
||
set hidden(t2) {
|
||
this._structArray.uint8[this._pos1 + 38] = t2;
|
||
}
|
||
get crossTileID() {
|
||
return this._structArray.uint32[this._pos4 + 10];
|
||
}
|
||
set crossTileID(t2) {
|
||
this._structArray.uint32[this._pos4 + 10] = t2;
|
||
}
|
||
get associatedIconIndex() {
|
||
return this._structArray.int16[this._pos2 + 22];
|
||
}
|
||
}
|
||
ea.prototype.size = 48;
|
||
class ra extends Zi {
|
||
get(t2) {
|
||
return new ea(this, t2);
|
||
}
|
||
}
|
||
$n("PlacedSymbolArray", ra);
|
||
class na extends Ii {
|
||
get anchorX() {
|
||
return this._structArray.int16[this._pos2 + 0];
|
||
}
|
||
get anchorY() {
|
||
return this._structArray.int16[this._pos2 + 1];
|
||
}
|
||
get rightJustifiedTextSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 2];
|
||
}
|
||
get centerJustifiedTextSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 3];
|
||
}
|
||
get leftJustifiedTextSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 4];
|
||
}
|
||
get verticalPlacedTextSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 5];
|
||
}
|
||
get placedIconSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 6];
|
||
}
|
||
get verticalPlacedIconSymbolIndex() {
|
||
return this._structArray.int16[this._pos2 + 7];
|
||
}
|
||
get key() {
|
||
return this._structArray.uint16[this._pos2 + 8];
|
||
}
|
||
get textBoxStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 9];
|
||
}
|
||
get textBoxEndIndex() {
|
||
return this._structArray.uint16[this._pos2 + 10];
|
||
}
|
||
get verticalTextBoxStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 11];
|
||
}
|
||
get verticalTextBoxEndIndex() {
|
||
return this._structArray.uint16[this._pos2 + 12];
|
||
}
|
||
get iconBoxStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 13];
|
||
}
|
||
get iconBoxEndIndex() {
|
||
return this._structArray.uint16[this._pos2 + 14];
|
||
}
|
||
get verticalIconBoxStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 15];
|
||
}
|
||
get verticalIconBoxEndIndex() {
|
||
return this._structArray.uint16[this._pos2 + 16];
|
||
}
|
||
get featureIndex() {
|
||
return this._structArray.uint16[this._pos2 + 17];
|
||
}
|
||
get numHorizontalGlyphVertices() {
|
||
return this._structArray.uint16[this._pos2 + 18];
|
||
}
|
||
get numVerticalGlyphVertices() {
|
||
return this._structArray.uint16[this._pos2 + 19];
|
||
}
|
||
get numIconVertices() {
|
||
return this._structArray.uint16[this._pos2 + 20];
|
||
}
|
||
get numVerticalIconVertices() {
|
||
return this._structArray.uint16[this._pos2 + 21];
|
||
}
|
||
get useRuntimeCollisionCircles() {
|
||
return this._structArray.uint16[this._pos2 + 22];
|
||
}
|
||
get crossTileID() {
|
||
return this._structArray.uint32[this._pos4 + 12];
|
||
}
|
||
set crossTileID(t2) {
|
||
this._structArray.uint32[this._pos4 + 12] = t2;
|
||
}
|
||
get textBoxScale() {
|
||
return this._structArray.float32[this._pos4 + 13];
|
||
}
|
||
get collisionCircleDiameter() {
|
||
return this._structArray.float32[this._pos4 + 14];
|
||
}
|
||
get textAnchorOffsetStartIndex() {
|
||
return this._structArray.uint16[this._pos2 + 30];
|
||
}
|
||
get textAnchorOffsetEndIndex() {
|
||
return this._structArray.uint16[this._pos2 + 31];
|
||
}
|
||
}
|
||
na.prototype.size = 64;
|
||
class ia extends Ki {
|
||
get(t2) {
|
||
return new na(this, t2);
|
||
}
|
||
}
|
||
$n("SymbolInstanceArray", ia);
|
||
class aa extends Gi {
|
||
getoffsetX(t2) {
|
||
return this.float32[1 * t2 + 0];
|
||
}
|
||
}
|
||
$n("GlyphOffsetArray", aa);
|
||
class sa extends Pi {
|
||
getx(t2) {
|
||
return this.int16[3 * t2 + 0];
|
||
}
|
||
gety(t2) {
|
||
return this.int16[3 * t2 + 1];
|
||
}
|
||
gettileUnitDistanceFromAnchor(t2) {
|
||
return this.int16[3 * t2 + 2];
|
||
}
|
||
}
|
||
$n("SymbolLineVertexArray", sa);
|
||
class oa extends Ii {
|
||
get textAnchor() {
|
||
return this._structArray.uint16[this._pos2 + 0];
|
||
}
|
||
get textOffset0() {
|
||
return this._structArray.float32[this._pos4 + 1];
|
||
}
|
||
get textOffset1() {
|
||
return this._structArray.float32[this._pos4 + 2];
|
||
}
|
||
}
|
||
oa.prototype.size = 12;
|
||
class la extends Ji {
|
||
get(t2) {
|
||
return new oa(this, t2);
|
||
}
|
||
}
|
||
$n("TextAnchorOffsetArray", la);
|
||
class ua extends Ii {
|
||
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];
|
||
}
|
||
}
|
||
ua.prototype.size = 8;
|
||
class ca extends Xi {
|
||
get(t2) {
|
||
return new ua(this, t2);
|
||
}
|
||
}
|
||
$n("FeatureIndexArray", ca);
|
||
class ha extends Bi {
|
||
}
|
||
class pa extends Bi {
|
||
}
|
||
class fa extends Bi {
|
||
}
|
||
class da extends Ei {
|
||
}
|
||
class ya extends Fi {
|
||
}
|
||
class ma extends Ti {
|
||
}
|
||
class ga extends $i {
|
||
}
|
||
class xa extends Li {
|
||
}
|
||
class va extends Di {
|
||
}
|
||
class ba extends Oi {
|
||
}
|
||
class wa extends Ri {
|
||
}
|
||
class _a extends ji {
|
||
}
|
||
class Aa extends Ni {
|
||
}
|
||
class Sa extends Yi {
|
||
}
|
||
const ka = Mi([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Ia } = ka;
|
||
class za {
|
||
constructor(t2 = []) {
|
||
this.segments = t2;
|
||
}
|
||
prepareSegment(t2, e2, r2, n2) {
|
||
let i3 = this.segments[this.segments.length - 1];
|
||
return t2 > za.MAX_VERTEX_ARRAY_LENGTH && A(`Max vertices per segment is ${za.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t2}`), (!i3 || i3.vertexLength + t2 > za.MAX_VERTEX_ARRAY_LENGTH || i3.sortKey !== n2) && (i3 = { vertexOffset: e2.length, primitiveOffset: r2.length, vertexLength: 0, primitiveLength: 0 }, void 0 !== n2 && (i3.sortKey = n2), this.segments.push(i3)), i3;
|
||
}
|
||
get() {
|
||
return this.segments;
|
||
}
|
||
destroy() {
|
||
for (const t2 of this.segments) for (const e2 in t2.vaos) t2.vaos[e2].destroy();
|
||
}
|
||
static simpleSegment(t2, e2, r2, n2) {
|
||
return new za([{ vertexOffset: t2, primitiveOffset: e2, vertexLength: r2, primitiveLength: n2, vaos: {}, sortKey: 0 }]);
|
||
}
|
||
}
|
||
function Ma(t2, e2) {
|
||
return 256 * (t2 = y(Math.floor(t2), 0, 255)) + y(Math.floor(e2), 0, 255);
|
||
}
|
||
za.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, $n("SegmentVector", za);
|
||
const Ca = Mi([{ name: "a_pattern_from", components: 4, type: "Uint16" }, { name: "a_pattern_to", components: 4, type: "Uint16" }, { name: "a_pixel_ratio_from", components: 1, type: "Uint16" }, { name: "a_pixel_ratio_to", components: 1, type: "Uint16" }]);
|
||
var Ba = { exports: {} }, Pa = { exports: {} };
|
||
Pa.exports = function(t2, e2) {
|
||
var r2, n2, i3, a2, s2, o2, l2, u2;
|
||
for (n2 = t2.length - (r2 = 3 & t2.length), i3 = e2, s2 = 3432918353, o2 = 461845907, u2 = 0; u2 < n2; ) l2 = 255 & t2.charCodeAt(u2) | (255 & t2.charCodeAt(++u2)) << 8 | (255 & t2.charCodeAt(++u2)) << 16 | (255 & t2.charCodeAt(++u2)) << 24, ++u2, i3 = 27492 + (65535 & (a2 = 5 * (65535 & (i3 = (i3 ^= l2 = (65535 & (l2 = (l2 = (65535 & l2) * s2 + (((l2 >>> 16) * s2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295) << 13 | i3 >>> 19)) + ((5 * (i3 >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (a2 >>> 16) & 65535) << 16);
|
||
switch (l2 = 0, r2) {
|
||
case 3:
|
||
l2 ^= (255 & t2.charCodeAt(u2 + 2)) << 16;
|
||
case 2:
|
||
l2 ^= (255 & t2.charCodeAt(u2 + 1)) << 8;
|
||
case 1:
|
||
i3 ^= l2 = (65535 & (l2 = (l2 = (65535 & (l2 ^= 255 & t2.charCodeAt(u2))) * s2 + (((l2 >>> 16) * s2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295;
|
||
}
|
||
return i3 ^= t2.length, i3 = 2246822507 * (65535 & (i3 ^= i3 >>> 16)) + ((2246822507 * (i3 >>> 16) & 65535) << 16) & 4294967295, i3 = 3266489909 * (65535 & (i3 ^= i3 >>> 13)) + ((3266489909 * (i3 >>> 16) & 65535) << 16) & 4294967295, (i3 ^= i3 >>> 16) >>> 0;
|
||
};
|
||
var Va = Pa.exports, Ea = { exports: {} };
|
||
Ea.exports = function(t2, e2) {
|
||
for (var r2, n2 = t2.length, i3 = e2 ^ n2, a2 = 0; n2 >= 4; ) r2 = 1540483477 * (65535 & (r2 = 255 & t2.charCodeAt(a2) | (255 & t2.charCodeAt(++a2)) << 8 | (255 & t2.charCodeAt(++a2)) << 16 | (255 & t2.charCodeAt(++a2)) << 24)) + ((1540483477 * (r2 >>> 16) & 65535) << 16), i3 = 1540483477 * (65535 & i3) + ((1540483477 * (i3 >>> 16) & 65535) << 16) ^ (r2 = 1540483477 * (65535 & (r2 ^= r2 >>> 24)) + ((1540483477 * (r2 >>> 16) & 65535) << 16)), n2 -= 4, ++a2;
|
||
switch (n2) {
|
||
case 3:
|
||
i3 ^= (255 & t2.charCodeAt(a2 + 2)) << 16;
|
||
case 2:
|
||
i3 ^= (255 & t2.charCodeAt(a2 + 1)) << 8;
|
||
case 1:
|
||
i3 = 1540483477 * (65535 & (i3 ^= 255 & t2.charCodeAt(a2))) + ((1540483477 * (i3 >>> 16) & 65535) << 16);
|
||
}
|
||
return i3 = 1540483477 * (65535 & (i3 ^= i3 >>> 13)) + ((1540483477 * (i3 >>> 16) & 65535) << 16), (i3 ^= i3 >>> 15) >>> 0;
|
||
};
|
||
var Fa = Va, Ta = Ea.exports;
|
||
Ba.exports = Fa, Ba.exports.murmur3 = Fa, Ba.exports.murmur2 = Ta;
|
||
var $a = r(Ba.exports);
|
||
class La {
|
||
constructor() {
|
||
this.ids = [], this.positions = [], this.indexed = false;
|
||
}
|
||
add(t2, e2, r2, n2) {
|
||
this.ids.push(Da(t2)), this.positions.push(e2, r2, n2);
|
||
}
|
||
getPositions(t2) {
|
||
if (!this.indexed) throw new Error("Trying to get index, but feature positions are not indexed");
|
||
const e2 = Da(t2);
|
||
let r2 = 0, n2 = this.ids.length - 1;
|
||
for (; r2 < n2; ) {
|
||
const t3 = r2 + n2 >> 1;
|
||
this.ids[t3] >= e2 ? n2 = t3 : r2 = t3 + 1;
|
||
}
|
||
const i3 = [];
|
||
for (; this.ids[r2] === e2; ) i3.push({ index: this.positions[3 * r2], start: this.positions[3 * r2 + 1], end: this.positions[3 * r2 + 2] }), r2++;
|
||
return i3;
|
||
}
|
||
static serialize(t2, e2) {
|
||
const r2 = new Float64Array(t2.ids), n2 = new Uint32Array(t2.positions);
|
||
return Oa(r2, n2, 0, r2.length - 1), e2 && e2.push(r2.buffer, n2.buffer), { ids: r2, positions: n2 };
|
||
}
|
||
static deserialize(t2) {
|
||
const e2 = new La();
|
||
return e2.ids = t2.ids, e2.positions = t2.positions, e2.indexed = true, e2;
|
||
}
|
||
}
|
||
function Da(t2) {
|
||
const e2 = +t2;
|
||
return !isNaN(e2) && e2 <= Number.MAX_SAFE_INTEGER ? e2 : $a(String(t2));
|
||
}
|
||
function Oa(t2, e2, r2, n2) {
|
||
for (; r2 < n2; ) {
|
||
const i3 = t2[r2 + n2 >> 1];
|
||
let a2 = r2 - 1, s2 = n2 + 1;
|
||
for (; ; ) {
|
||
do {
|
||
a2++;
|
||
} while (t2[a2] < i3);
|
||
do {
|
||
s2--;
|
||
} while (t2[s2] > i3);
|
||
if (a2 >= s2) break;
|
||
Ua(t2, a2, s2), Ua(e2, 3 * a2, 3 * s2), Ua(e2, 3 * a2 + 1, 3 * s2 + 1), Ua(e2, 3 * a2 + 2, 3 * s2 + 2);
|
||
}
|
||
s2 - r2 < n2 - s2 ? (Oa(t2, e2, r2, s2), r2 = s2 + 1) : (Oa(t2, e2, s2 + 1, n2), n2 = s2);
|
||
}
|
||
}
|
||
function Ua(t2, e2, r2) {
|
||
const n2 = t2[e2];
|
||
t2[e2] = t2[r2], t2[r2] = n2;
|
||
}
|
||
$n("FeaturePositionMap", La);
|
||
class Ra {
|
||
constructor(t2, e2) {
|
||
this.gl = t2.gl, this.location = e2;
|
||
}
|
||
}
|
||
class qa extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = 0;
|
||
}
|
||
set(t2) {
|
||
this.current !== t2 && (this.current = t2, this.gl.uniform1f(this.location, t2));
|
||
}
|
||
}
|
||
class ja extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = [0, 0, 0, 0];
|
||
}
|
||
set(t2) {
|
||
t2[0] === this.current[0] && t2[1] === this.current[1] && t2[2] === this.current[2] && t2[3] === this.current[3] || (this.current = t2, this.gl.uniform4f(this.location, t2[0], t2[1], t2[2], t2[3]));
|
||
}
|
||
}
|
||
class Na extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = Yt.transparent;
|
||
}
|
||
set(t2) {
|
||
t2.r === this.current.r && t2.g === this.current.g && t2.b === this.current.b && t2.a === this.current.a || (this.current = t2, this.gl.uniform4f(this.location, t2.r, t2.g, t2.b, t2.a));
|
||
}
|
||
}
|
||
const Za = new Float32Array(16);
|
||
function Ka(t2) {
|
||
return [Ma(255 * t2.r, 255 * t2.g), Ma(255 * t2.b, 255 * t2.a)];
|
||
}
|
||
class Ga {
|
||
constructor(t2, e2, r2) {
|
||
this.value = t2, this.uniformNames = e2.map(((t3) => `u_${t3}`)), this.type = r2;
|
||
}
|
||
setUniform(t2, e2, r2) {
|
||
t2.set(r2.constantOr(this.value));
|
||
}
|
||
getBinding(t2, e2, r2) {
|
||
return "color" === this.type ? new Na(t2, e2) : new qa(t2, e2);
|
||
}
|
||
}
|
||
class Ja {
|
||
constructor(t2, e2) {
|
||
this.uniformNames = e2.map(((t3) => `u_${t3}`)), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;
|
||
}
|
||
setConstantPatternPositions(t2, e2) {
|
||
this.pixelRatioFrom = e2.pixelRatio, this.pixelRatioTo = t2.pixelRatio, this.patternFrom = e2.tlbr, this.patternTo = t2.tlbr;
|
||
}
|
||
setUniform(t2, e2, r2, n2) {
|
||
const i3 = "u_pattern_to" === n2 ? this.patternTo : "u_pattern_from" === n2 ? this.patternFrom : "u_pixel_ratio_to" === n2 ? this.pixelRatioTo : "u_pixel_ratio_from" === n2 ? this.pixelRatioFrom : null;
|
||
i3 && t2.set(i3);
|
||
}
|
||
getBinding(t2, e2, r2) {
|
||
return "u_pattern" === r2.substr(0, 9) ? new ja(t2, e2) : new qa(t2, e2);
|
||
}
|
||
}
|
||
class Xa {
|
||
constructor(t2, e2, r2, n2) {
|
||
this.expression = t2, this.type = r2, this.maxValue = 0, this.paintVertexAttributes = e2.map(((t3) => ({ name: `a_${t3}`, type: "Float32", components: "color" === r2 ? 2 : 1, offset: 0 }))), this.paintVertexArray = new n2();
|
||
}
|
||
populatePaintArray(t2, e2, r2, n2, i3) {
|
||
const a2 = this.paintVertexArray.length, s2 = this.expression.evaluate(new li(0), e2, {}, n2, [], i3);
|
||
this.paintVertexArray.resize(t2), this._setPaintValue(a2, t2, s2);
|
||
}
|
||
updatePaintArray(t2, e2, r2, n2) {
|
||
const i3 = this.expression.evaluate({ zoom: 0 }, r2, n2);
|
||
this._setPaintValue(t2, e2, i3);
|
||
}
|
||
_setPaintValue(t2, e2, r2) {
|
||
if ("color" === this.type) {
|
||
const n2 = Ka(r2);
|
||
for (let r3 = t2; r3 < e2; r3++) this.paintVertexArray.emplace(r3, n2[0], n2[1]);
|
||
} else {
|
||
for (let n2 = t2; n2 < e2; n2++) this.paintVertexArray.emplace(n2, r2);
|
||
this.maxValue = Math.max(this.maxValue, Math.abs(r2));
|
||
}
|
||
}
|
||
upload(t2) {
|
||
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
|
||
}
|
||
destroy() {
|
||
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
|
||
}
|
||
}
|
||
class Ya {
|
||
constructor(t2, e2, r2, n2, i3, a2) {
|
||
this.expression = t2, this.uniformNames = e2.map(((t3) => `u_${t3}_t`)), this.type = r2, this.useIntegerZoom = n2, this.zoom = i3, this.maxValue = 0, this.paintVertexAttributes = e2.map(((t3) => ({ name: `a_${t3}`, type: "Float32", components: "color" === r2 ? 4 : 2, offset: 0 }))), this.paintVertexArray = new a2();
|
||
}
|
||
populatePaintArray(t2, e2, r2, n2, i3) {
|
||
const a2 = this.expression.evaluate(new li(this.zoom), e2, {}, n2, [], i3), s2 = this.expression.evaluate(new li(this.zoom + 1), e2, {}, n2, [], i3), o2 = this.paintVertexArray.length;
|
||
this.paintVertexArray.resize(t2), this._setPaintValue(o2, t2, a2, s2);
|
||
}
|
||
updatePaintArray(t2, e2, r2, n2) {
|
||
const i3 = this.expression.evaluate({ zoom: this.zoom }, r2, n2), a2 = this.expression.evaluate({ zoom: this.zoom + 1 }, r2, n2);
|
||
this._setPaintValue(t2, e2, i3, a2);
|
||
}
|
||
_setPaintValue(t2, e2, r2, n2) {
|
||
if ("color" === this.type) {
|
||
const i3 = Ka(r2), a2 = Ka(n2);
|
||
for (let r3 = t2; r3 < e2; r3++) this.paintVertexArray.emplace(r3, i3[0], i3[1], a2[0], a2[1]);
|
||
} else {
|
||
for (let i3 = t2; i3 < e2; i3++) this.paintVertexArray.emplace(i3, r2, n2);
|
||
this.maxValue = Math.max(this.maxValue, Math.abs(r2), Math.abs(n2));
|
||
}
|
||
}
|
||
upload(t2) {
|
||
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
|
||
}
|
||
destroy() {
|
||
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
|
||
}
|
||
setUniform(t2, e2) {
|
||
const r2 = this.useIntegerZoom ? Math.floor(e2.zoom) : e2.zoom, n2 = y(this.expression.interpolationFactor(r2, this.zoom, this.zoom + 1), 0, 1);
|
||
t2.set(n2);
|
||
}
|
||
getBinding(t2, e2, r2) {
|
||
return new qa(t2, e2);
|
||
}
|
||
}
|
||
class Ha {
|
||
constructor(t2, e2, r2, n2, i3, a2) {
|
||
this.expression = t2, this.type = e2, this.useIntegerZoom = r2, this.zoom = n2, this.layerId = a2, this.zoomInPaintVertexArray = new i3(), this.zoomOutPaintVertexArray = new i3();
|
||
}
|
||
populatePaintArray(t2, e2, r2) {
|
||
const n2 = this.zoomInPaintVertexArray.length;
|
||
this.zoomInPaintVertexArray.resize(t2), this.zoomOutPaintVertexArray.resize(t2), this._setPaintValues(n2, t2, e2.patterns && e2.patterns[this.layerId], r2);
|
||
}
|
||
updatePaintArray(t2, e2, r2, n2, i3) {
|
||
this._setPaintValues(t2, e2, r2.patterns && r2.patterns[this.layerId], i3);
|
||
}
|
||
_setPaintValues(t2, e2, r2, n2) {
|
||
if (!n2 || !r2) return;
|
||
const { min: i3, mid: a2, max: s2 } = r2, o2 = n2[i3], l2 = n2[a2], u2 = n2[s2];
|
||
if (o2 && l2 && u2) for (let r3 = t2; r3 < e2; r3++) this.zoomInPaintVertexArray.emplace(r3, l2.tl[0], l2.tl[1], l2.br[0], l2.br[1], o2.tl[0], o2.tl[1], o2.br[0], o2.br[1], l2.pixelRatio, o2.pixelRatio), this.zoomOutPaintVertexArray.emplace(r3, l2.tl[0], l2.tl[1], l2.br[0], l2.br[1], u2.tl[0], u2.tl[1], u2.br[0], u2.br[1], l2.pixelRatio, u2.pixelRatio);
|
||
}
|
||
upload(t2) {
|
||
this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = t2.createVertexBuffer(this.zoomInPaintVertexArray, Ca.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = t2.createVertexBuffer(this.zoomOutPaintVertexArray, Ca.members, this.expression.isStateDependent));
|
||
}
|
||
destroy() {
|
||
this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
|
||
}
|
||
}
|
||
class Wa {
|
||
constructor(t2, e2, r2) {
|
||
this.binders = {}, this._buffers = [];
|
||
const n2 = [];
|
||
for (const i3 in t2.paint._values) {
|
||
if (!r2(i3)) continue;
|
||
const a2 = t2.paint.get(i3);
|
||
if (!(a2 instanceof yi && _r(a2.property.specification))) continue;
|
||
const s2 = ts(i3, t2.type), o2 = a2.value, l2 = a2.property.specification.type, u2 = a2.property.useIntegerZoom, c2 = a2.property.specification["property-type"], h2 = "cross-faded" === c2 || "cross-faded-data-driven" === c2;
|
||
if ("constant" === o2.kind) this.binders[i3] = h2 ? new Ja(o2.value, s2) : new Ga(o2.value, s2, l2), n2.push(`/u_${i3}`);
|
||
else if ("source" === o2.kind || h2) {
|
||
const r3 = es(i3, l2, "source");
|
||
this.binders[i3] = h2 ? new Ha(o2, l2, u2, e2, r3, t2.id) : new Xa(o2, s2, l2, r3), n2.push(`/a_${i3}`);
|
||
} else {
|
||
const t3 = es(i3, l2, "composite");
|
||
this.binders[i3] = new Ya(o2, s2, l2, u2, e2, t3), n2.push(`/z_${i3}`);
|
||
}
|
||
}
|
||
this.cacheKey = n2.sort().join("");
|
||
}
|
||
getMaxValue(t2) {
|
||
const e2 = this.binders[t2];
|
||
return e2 instanceof Xa || e2 instanceof Ya ? e2.maxValue : 0;
|
||
}
|
||
populatePaintArrays(t2, e2, r2, n2, i3) {
|
||
for (const a2 in this.binders) {
|
||
const s2 = this.binders[a2];
|
||
(s2 instanceof Xa || s2 instanceof Ya || s2 instanceof Ha) && s2.populatePaintArray(t2, e2, r2, n2, i3);
|
||
}
|
||
}
|
||
setConstantPatternPositions(t2, e2) {
|
||
for (const r2 in this.binders) {
|
||
const n2 = this.binders[r2];
|
||
n2 instanceof Ja && n2.setConstantPatternPositions(t2, e2);
|
||
}
|
||
}
|
||
updatePaintArrays(t2, e2, r2, n2, i3) {
|
||
let a2 = false;
|
||
for (const s2 in t2) {
|
||
const o2 = e2.getPositions(s2);
|
||
for (const e3 of o2) {
|
||
const o3 = r2.feature(e3.index);
|
||
for (const r3 in this.binders) {
|
||
const l2 = this.binders[r3];
|
||
if ((l2 instanceof Xa || l2 instanceof Ya || l2 instanceof Ha) && true === l2.expression.isStateDependent) {
|
||
const u2 = n2.paint.get(r3);
|
||
l2.expression = u2.value, l2.updatePaintArray(e3.start, e3.end, o3, t2[s2], i3), a2 = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return a2;
|
||
}
|
||
defines() {
|
||
const t2 = [];
|
||
for (const e2 in this.binders) {
|
||
const r2 = this.binders[e2];
|
||
(r2 instanceof Ga || r2 instanceof Ja) && t2.push(...r2.uniformNames.map(((t3) => `#define HAS_UNIFORM_${t3}`)));
|
||
}
|
||
return t2;
|
||
}
|
||
getBinderAttributes() {
|
||
const t2 = [];
|
||
for (const e2 in this.binders) {
|
||
const r2 = this.binders[e2];
|
||
if (r2 instanceof Xa || r2 instanceof Ya) for (let e3 = 0; e3 < r2.paintVertexAttributes.length; e3++) t2.push(r2.paintVertexAttributes[e3].name);
|
||
else if (r2 instanceof Ha) for (let e3 = 0; e3 < Ca.members.length; e3++) t2.push(Ca.members[e3].name);
|
||
}
|
||
return t2;
|
||
}
|
||
getBinderUniforms() {
|
||
const t2 = [];
|
||
for (const e2 in this.binders) {
|
||
const r2 = this.binders[e2];
|
||
if (r2 instanceof Ga || r2 instanceof Ja || r2 instanceof Ya) for (const e3 of r2.uniformNames) t2.push(e3);
|
||
}
|
||
return t2;
|
||
}
|
||
getPaintVertexBuffers() {
|
||
return this._buffers;
|
||
}
|
||
getUniforms(t2, e2) {
|
||
const r2 = [];
|
||
for (const n2 in this.binders) {
|
||
const i3 = this.binders[n2];
|
||
if (i3 instanceof Ga || i3 instanceof Ja || i3 instanceof Ya) {
|
||
for (const a2 of i3.uniformNames) if (e2[a2]) {
|
||
const s2 = i3.getBinding(t2, e2[a2], a2);
|
||
r2.push({ name: a2, property: n2, binding: s2 });
|
||
}
|
||
}
|
||
}
|
||
return r2;
|
||
}
|
||
setUniforms(t2, e2, r2, n2) {
|
||
for (const { name: t3, property: i3, binding: a2 } of e2) this.binders[i3].setUniform(a2, n2, r2.get(i3), t3);
|
||
}
|
||
updatePaintBuffers(t2) {
|
||
this._buffers = [];
|
||
for (const e2 in this.binders) {
|
||
const r2 = this.binders[e2];
|
||
if (t2 && r2 instanceof Ha) {
|
||
const e3 = 2 === t2.fromScale ? r2.zoomInPaintVertexBuffer : r2.zoomOutPaintVertexBuffer;
|
||
e3 && this._buffers.push(e3);
|
||
} else (r2 instanceof Xa || r2 instanceof Ya) && r2.paintVertexBuffer && this._buffers.push(r2.paintVertexBuffer);
|
||
}
|
||
}
|
||
upload(t2) {
|
||
for (const e2 in this.binders) {
|
||
const r2 = this.binders[e2];
|
||
(r2 instanceof Xa || r2 instanceof Ya || r2 instanceof Ha) && r2.upload(t2);
|
||
}
|
||
this.updatePaintBuffers();
|
||
}
|
||
destroy() {
|
||
for (const t2 in this.binders) {
|
||
const e2 = this.binders[t2];
|
||
(e2 instanceof Xa || e2 instanceof Ya || e2 instanceof Ha) && e2.destroy();
|
||
}
|
||
}
|
||
}
|
||
class Qa {
|
||
constructor(t2, e2, r2 = (() => true)) {
|
||
this.programConfigurations = {};
|
||
for (const n2 of t2) this.programConfigurations[n2.id] = new Wa(n2, e2, r2);
|
||
this.needsUpload = false, this._featureMap = new La(), this._bufferOffset = 0;
|
||
}
|
||
populatePaintArrays(t2, e2, r2, n2, i3, a2) {
|
||
for (const r3 in this.programConfigurations) this.programConfigurations[r3].populatePaintArrays(t2, e2, n2, i3, a2);
|
||
void 0 !== e2.id && this._featureMap.add(e2.id, r2, this._bufferOffset, t2), this._bufferOffset = t2, this.needsUpload = true;
|
||
}
|
||
updatePaintArrays(t2, e2, r2, n2) {
|
||
for (const i3 of r2) this.needsUpload = this.programConfigurations[i3.id].updatePaintArrays(t2, this._featureMap, e2, i3, n2) || this.needsUpload;
|
||
}
|
||
get(t2) {
|
||
return this.programConfigurations[t2];
|
||
}
|
||
upload(t2) {
|
||
if (this.needsUpload) {
|
||
for (const e2 in this.programConfigurations) this.programConfigurations[e2].upload(t2);
|
||
this.needsUpload = false;
|
||
}
|
||
}
|
||
destroy() {
|
||
for (const t2 in this.programConfigurations) this.programConfigurations[t2].destroy();
|
||
}
|
||
}
|
||
function ts(t2, e2) {
|
||
return { "text-opacity": ["opacity"], "icon-opacity": ["opacity"], "text-color": ["fill_color"], "icon-color": ["fill_color"], "text-halo-color": ["halo_color"], "icon-halo-color": ["halo_color"], "text-halo-blur": ["halo_blur"], "icon-halo-blur": ["halo_blur"], "text-halo-width": ["halo_width"], "icon-halo-width": ["halo_width"], "line-gap-width": ["gapwidth"], "line-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"], "fill-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"], "fill-extrusion-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"] }[t2] || [t2.replace(`${e2}-`, "").replace(/-/g, "_")];
|
||
}
|
||
function es(t2, e2, r2) {
|
||
const n2 = { color: { source: Ti, composite: Wi }, number: { source: Gi, composite: Ti } }, i3 = (function(t3) {
|
||
return { "line-pattern": { source: ga, composite: ga }, "fill-pattern": { source: ga, composite: ga }, "fill-extrusion-pattern": { source: ga, composite: ga } }[t3];
|
||
})(t2);
|
||
return i3 && i3[r2] || n2[e2][r2];
|
||
}
|
||
$n("ConstantBinder", Ga), $n("CrossFadedConstantBinder", Ja), $n("SourceExpressionBinder", Xa), $n("CrossFadedCompositeBinder", Ha), $n("CompositeExpressionBinder", Ya), $n("ProgramConfiguration", Wa, { omit: ["_buffers"] }), $n("ProgramConfigurationSet", Qa);
|
||
const rs = 8192, ns = Math.pow(2, 14) - 1, is = -ns - 1;
|
||
function as(t2) {
|
||
const e2 = rs / t2.extent, r2 = t2.loadGeometry();
|
||
for (let t3 = 0; t3 < r2.length; t3++) {
|
||
const n2 = r2[t3];
|
||
for (let t4 = 0; t4 < n2.length; t4++) {
|
||
const r3 = n2[t4], i3 = Math.round(r3.x * e2), a2 = Math.round(r3.y * e2);
|
||
r3.x = y(i3, is, ns), r3.y = y(a2, is, ns), (i3 < r3.x || i3 > r3.x + 1 || a2 < r3.y || a2 > r3.y + 1) && A("Geometry exceeds allowed extent, reduce your vector tile buffer size");
|
||
}
|
||
}
|
||
return r2;
|
||
}
|
||
function ss(t2, e2) {
|
||
return { type: t2.type, id: t2.id, properties: t2.properties, geometry: e2 ? as(t2) : [] };
|
||
}
|
||
function os(t2, e2, r2, n2, i3) {
|
||
t2.emplaceBack(2 * e2 + (n2 + 1) / 2, 2 * r2 + (i3 + 1) / 2);
|
||
}
|
||
class ls {
|
||
constructor(t2) {
|
||
this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasPattern = false, this.layoutVertexArray = new pa(), this.indexArray = new Aa(), this.segments = new za(), this.programConfigurations = new Qa(t2.layers, t2.zoom), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
|
||
}
|
||
populate(t2, e2, r2) {
|
||
const n2 = this.layers[0], i3 = [];
|
||
let a2 = null, s2 = false;
|
||
"circle" === n2.type && (a2 = n2.layout.get("circle-sort-key"), s2 = !a2.isConstant());
|
||
for (const { feature: e3, id: n3, index: o2, sourceLayerIndex: l2 } of t2) {
|
||
const t3 = this.layers[0]._featureFilter.needGeometry, u2 = ss(e3, t3);
|
||
if (!this.layers[0]._featureFilter.filter(new li(this.zoom), u2, r2)) continue;
|
||
const c2 = s2 ? a2.evaluate(u2, {}, r2) : void 0, h2 = { id: n3, properties: e3.properties, type: e3.type, sourceLayerIndex: l2, index: o2, geometry: t3 ? u2.geometry : as(e3), patterns: {}, sortKey: c2 };
|
||
i3.push(h2);
|
||
}
|
||
s2 && i3.sort(((t3, e3) => t3.sortKey - e3.sortKey));
|
||
for (const n3 of i3) {
|
||
const { geometry: i4, index: a3, sourceLayerIndex: s3 } = n3, o2 = t2[a3].feature;
|
||
this.addFeature(n3, i4, a3, r2), e2.featureIndex.insert(o2, i4, a3, s3, this.index);
|
||
}
|
||
}
|
||
update(t2, e2, r2) {
|
||
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, r2);
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.layoutVertexArray.length;
|
||
}
|
||
uploadPending() {
|
||
return !this.uploaded || this.programConfigurations.needsUpload;
|
||
}
|
||
upload(t2) {
|
||
this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, Ia), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
|
||
}
|
||
addFeature(t2, e2, r2, n2) {
|
||
for (const r3 of e2) for (const e3 of r3) {
|
||
const r4 = e3.x, n3 = e3.y;
|
||
if (r4 < 0 || r4 >= rs || n3 < 0 || n3 >= rs) continue;
|
||
const i3 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, t2.sortKey), a2 = i3.vertexLength;
|
||
os(this.layoutVertexArray, r4, n3, -1, -1), os(this.layoutVertexArray, r4, n3, 1, -1), os(this.layoutVertexArray, r4, n3, 1, 1), os(this.layoutVertexArray, r4, n3, -1, 1), this.indexArray.emplaceBack(a2, a2 + 1, a2 + 2), this.indexArray.emplaceBack(a2, a2 + 3, a2 + 2), i3.vertexLength += 4, i3.primitiveLength += 2;
|
||
}
|
||
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, r2, {}, n2);
|
||
}
|
||
}
|
||
function us(t2, e2) {
|
||
for (let r2 = 0; r2 < t2.length; r2++) if (xs(e2, t2[r2])) return true;
|
||
for (let r2 = 0; r2 < e2.length; r2++) if (xs(t2, e2[r2])) return true;
|
||
return !!fs(t2, e2);
|
||
}
|
||
function cs(t2, e2, r2) {
|
||
return !!xs(t2, e2) || !!ys(e2, t2, r2);
|
||
}
|
||
function hs(t2, e2) {
|
||
if (1 === t2.length) return gs(e2, t2[0]);
|
||
for (let r2 = 0; r2 < e2.length; r2++) {
|
||
const n2 = e2[r2];
|
||
for (let e3 = 0; e3 < n2.length; e3++) if (xs(t2, n2[e3])) return true;
|
||
}
|
||
for (let r2 = 0; r2 < t2.length; r2++) if (gs(e2, t2[r2])) return true;
|
||
for (let r2 = 0; r2 < e2.length; r2++) if (fs(t2, e2[r2])) return true;
|
||
return false;
|
||
}
|
||
function ps(t2, e2, r2) {
|
||
if (t2.length > 1) {
|
||
if (fs(t2, e2)) return true;
|
||
for (let n2 = 0; n2 < e2.length; n2++) if (ys(e2[n2], t2, r2)) return true;
|
||
}
|
||
for (let n2 = 0; n2 < t2.length; n2++) if (ys(t2[n2], e2, r2)) return true;
|
||
return false;
|
||
}
|
||
function fs(t2, e2) {
|
||
if (0 === t2.length || 0 === e2.length) return false;
|
||
for (let r2 = 0; r2 < t2.length - 1; r2++) {
|
||
const n2 = t2[r2], i3 = t2[r2 + 1];
|
||
for (let t3 = 0; t3 < e2.length - 1; t3++) if (ds(n2, i3, e2[t3], e2[t3 + 1])) return true;
|
||
}
|
||
return false;
|
||
}
|
||
function ds(t2, e2, r2, n2) {
|
||
return S(t2, r2, n2) !== S(e2, r2, n2) && S(t2, e2, r2) !== S(t2, e2, n2);
|
||
}
|
||
function ys(t2, e2, r2) {
|
||
const n2 = r2 * r2;
|
||
if (1 === e2.length) return t2.distSqr(e2[0]) < n2;
|
||
for (let r3 = 1; r3 < e2.length; r3++) if (ms(t2, e2[r3 - 1], e2[r3]) < n2) return true;
|
||
return false;
|
||
}
|
||
function ms(t2, e2, r2) {
|
||
const n2 = e2.distSqr(r2);
|
||
if (0 === n2) return t2.distSqr(e2);
|
||
const i3 = ((t2.x - e2.x) * (r2.x - e2.x) + (t2.y - e2.y) * (r2.y - e2.y)) / n2;
|
||
return t2.distSqr(i3 < 0 ? e2 : i3 > 1 ? r2 : r2.sub(e2)._mult(i3)._add(e2));
|
||
}
|
||
function gs(t2, e2) {
|
||
let r2, n2, i3, a2 = false;
|
||
for (let s2 = 0; s2 < t2.length; s2++) {
|
||
r2 = t2[s2];
|
||
for (let t3 = 0, s3 = r2.length - 1; t3 < r2.length; s3 = t3++) n2 = r2[t3], i3 = r2[s3], n2.y > e2.y != i3.y > e2.y && e2.x < (i3.x - n2.x) * (e2.y - n2.y) / (i3.y - n2.y) + n2.x && (a2 = !a2);
|
||
}
|
||
return a2;
|
||
}
|
||
function xs(t2, e2) {
|
||
let r2 = false;
|
||
for (let n2 = 0, i3 = t2.length - 1; n2 < t2.length; i3 = n2++) {
|
||
const a2 = t2[n2], s2 = t2[i3];
|
||
a2.y > e2.y != s2.y > e2.y && e2.x < (s2.x - a2.x) * (e2.y - a2.y) / (s2.y - a2.y) + a2.x && (r2 = !r2);
|
||
}
|
||
return r2;
|
||
}
|
||
function vs(t2, e2, r2) {
|
||
const n2 = r2[0], i3 = r2[2];
|
||
if (t2.x < n2.x && e2.x < n2.x || t2.x > i3.x && e2.x > i3.x || t2.y < n2.y && e2.y < n2.y || t2.y > i3.y && e2.y > i3.y) return false;
|
||
const a2 = S(t2, e2, r2[0]);
|
||
return a2 !== S(t2, e2, r2[1]) || a2 !== S(t2, e2, r2[2]) || a2 !== S(t2, e2, r2[3]);
|
||
}
|
||
function bs(t2, e2, r2) {
|
||
const n2 = e2.paint.get(t2).value;
|
||
return "constant" === n2.kind ? n2.value : r2.programConfigurations.get(e2.id).getMaxValue(t2);
|
||
}
|
||
function ws(t2) {
|
||
return Math.sqrt(t2[0] * t2[0] + t2[1] * t2[1]);
|
||
}
|
||
function _s(t2, e2, r2, n2, i3) {
|
||
if (!e2[0] && !e2[1]) return t2;
|
||
const s2 = a.convert(e2)._mult(i3);
|
||
"viewport" === r2 && s2._rotate(-n2);
|
||
const o2 = [];
|
||
for (let e3 = 0; e3 < t2.length; e3++) o2.push(t2[e3].sub(s2));
|
||
return o2;
|
||
}
|
||
let As, Ss;
|
||
$n("CircleBucket", ls, { omit: ["layers"] });
|
||
var ks = { get paint() {
|
||
return Ss = Ss || new _i({ "circle-radius": new xi(X.paint_circle["circle-radius"]), "circle-color": new xi(X.paint_circle["circle-color"]), "circle-blur": new xi(X.paint_circle["circle-blur"]), "circle-opacity": new xi(X.paint_circle["circle-opacity"]), "circle-translate": new gi(X.paint_circle["circle-translate"]), "circle-translate-anchor": new gi(X.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new gi(X.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new gi(X.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new xi(X.paint_circle["circle-stroke-width"]), "circle-stroke-color": new xi(X.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new xi(X.paint_circle["circle-stroke-opacity"]) });
|
||
}, get layout() {
|
||
return As = As || new _i({ "circle-sort-key": new xi(X.layout_circle["circle-sort-key"]) });
|
||
} }, Is = 1e-6, zs = "undefined" != typeof Float32Array ? Float32Array : Array;
|
||
function Ms(t2) {
|
||
return t2[0] = 1, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = 1, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = 1, t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0, t2[15] = 1, t2;
|
||
}
|
||
function Cs(t2, e2, r2) {
|
||
var n2 = e2[0], i3 = e2[1], a2 = e2[2], s2 = e2[3], o2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], y2 = e2[12], m2 = e2[13], g2 = e2[14], x2 = e2[15], v2 = r2[0], b2 = r2[1], w2 = r2[2], _2 = r2[3];
|
||
return t2[0] = v2 * n2 + b2 * o2 + w2 * h2 + _2 * y2, t2[1] = v2 * i3 + b2 * l2 + w2 * p2 + _2 * m2, t2[2] = v2 * a2 + b2 * u2 + w2 * f2 + _2 * g2, t2[3] = v2 * s2 + b2 * c2 + w2 * d2 + _2 * x2, t2[4] = (v2 = r2[4]) * n2 + (b2 = r2[5]) * o2 + (w2 = r2[6]) * h2 + (_2 = r2[7]) * y2, t2[5] = v2 * i3 + b2 * l2 + w2 * p2 + _2 * m2, t2[6] = v2 * a2 + b2 * u2 + w2 * f2 + _2 * g2, t2[7] = v2 * s2 + b2 * c2 + w2 * d2 + _2 * x2, t2[8] = (v2 = r2[8]) * n2 + (b2 = r2[9]) * o2 + (w2 = r2[10]) * h2 + (_2 = r2[11]) * y2, t2[9] = v2 * i3 + b2 * l2 + w2 * p2 + _2 * m2, t2[10] = v2 * a2 + b2 * u2 + w2 * f2 + _2 * g2, t2[11] = v2 * s2 + b2 * c2 + w2 * d2 + _2 * x2, t2[12] = (v2 = r2[12]) * n2 + (b2 = r2[13]) * o2 + (w2 = r2[14]) * h2 + (_2 = r2[15]) * y2, t2[13] = v2 * i3 + b2 * l2 + w2 * p2 + _2 * m2, t2[14] = v2 * a2 + b2 * u2 + w2 * f2 + _2 * g2, t2[15] = v2 * s2 + b2 * c2 + w2 * d2 + _2 * x2, t2;
|
||
}
|
||
Math.hypot || (Math.hypot = function() {
|
||
for (var t2 = 0, e2 = arguments.length; e2--; ) t2 += arguments[e2] * arguments[e2];
|
||
return Math.sqrt(t2);
|
||
});
|
||
var Bs, Ps = Cs;
|
||
function Vs(t2, e2, r2) {
|
||
var n2 = e2[0], i3 = e2[1], a2 = e2[2], s2 = e2[3];
|
||
return t2[0] = r2[0] * n2 + r2[4] * i3 + r2[8] * a2 + r2[12] * s2, t2[1] = r2[1] * n2 + r2[5] * i3 + r2[9] * a2 + r2[13] * s2, t2[2] = r2[2] * n2 + r2[6] * i3 + r2[10] * a2 + r2[14] * s2, t2[3] = r2[3] * n2 + r2[7] * i3 + r2[11] * a2 + r2[15] * s2, t2;
|
||
}
|
||
Bs = new zs(4), zs != Float32Array && (Bs[0] = 0, Bs[1] = 0, Bs[2] = 0, Bs[3] = 0);
|
||
class Es extends Si {
|
||
constructor(t2) {
|
||
super(t2, ks);
|
||
}
|
||
createBucket(t2) {
|
||
return new ls(t2);
|
||
}
|
||
queryRadius(t2) {
|
||
const e2 = t2;
|
||
return bs("circle-radius", this, e2) + bs("circle-stroke-width", this, e2) + ws(this.paint.get("circle-translate"));
|
||
}
|
||
queryIntersectsFeature(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
const l2 = _s(t2, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), a2.angle, s2), u2 = this.paint.get("circle-radius").evaluate(e2, r2) + this.paint.get("circle-stroke-width").evaluate(e2, r2), c2 = "map" === this.paint.get("circle-pitch-alignment"), h2 = c2 ? l2 : (function(t3, e3) {
|
||
return t3.map(((t4) => Fs(t4, e3)));
|
||
})(l2, o2), p2 = c2 ? u2 * s2 : u2;
|
||
for (const t3 of n2) for (const e3 of t3) {
|
||
const t4 = c2 ? e3 : Fs(e3, o2);
|
||
let r3 = p2;
|
||
const n3 = Vs([], [e3.x, e3.y, 0, 1], o2);
|
||
if ("viewport" === this.paint.get("circle-pitch-scale") && "map" === this.paint.get("circle-pitch-alignment") ? r3 *= n3[3] / a2.cameraToCenterDistance : "map" === this.paint.get("circle-pitch-scale") && "viewport" === this.paint.get("circle-pitch-alignment") && (r3 *= a2.cameraToCenterDistance / n3[3]), cs(h2, t4, r3)) return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
function Fs(t2, e2) {
|
||
const r2 = Vs([], [t2.x, t2.y, 0, 1], e2);
|
||
return new a(r2[0] / r2[3], r2[1] / r2[3]);
|
||
}
|
||
class Ts extends ls {
|
||
}
|
||
let $s;
|
||
$n("HeatmapBucket", Ts, { omit: ["layers"] });
|
||
var Ls = { get paint() {
|
||
return $s = $s || new _i({ "heatmap-radius": new xi(X.paint_heatmap["heatmap-radius"]), "heatmap-weight": new xi(X.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new gi(X.paint_heatmap["heatmap-intensity"]), "heatmap-color": new wi(X.paint_heatmap["heatmap-color"]), "heatmap-opacity": new gi(X.paint_heatmap["heatmap-opacity"]) });
|
||
} };
|
||
function Ds(t2, { width: e2, height: r2 }, n2, i3) {
|
||
if (i3) {
|
||
if (i3 instanceof Uint8ClampedArray) i3 = new Uint8Array(i3.buffer);
|
||
else if (i3.length !== e2 * r2 * n2) throw new RangeError(`mismatched image size. expected: ${i3.length} but got: ${e2 * r2 * n2}`);
|
||
} else i3 = new Uint8Array(e2 * r2 * n2);
|
||
return t2.width = e2, t2.height = r2, t2.data = i3, t2;
|
||
}
|
||
function Os(t2, { width: e2, height: r2 }, n2) {
|
||
if (e2 === t2.width && r2 === t2.height) return;
|
||
const i3 = Ds({}, { width: e2, height: r2 }, n2);
|
||
Us(t2, i3, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t2.width, e2), height: Math.min(t2.height, r2) }, n2), t2.width = e2, t2.height = r2, t2.data = i3.data;
|
||
}
|
||
function Us(t2, e2, r2, n2, i3, a2) {
|
||
if (0 === i3.width || 0 === i3.height) return e2;
|
||
if (i3.width > t2.width || i3.height > t2.height || r2.x > t2.width - i3.width || r2.y > t2.height - i3.height) throw new RangeError("out of range source coordinates for image copy");
|
||
if (i3.width > e2.width || i3.height > e2.height || n2.x > e2.width - i3.width || n2.y > e2.height - i3.height) throw new RangeError("out of range destination coordinates for image copy");
|
||
const s2 = t2.data, o2 = e2.data;
|
||
if (s2 === o2) throw new Error("srcData equals dstData, so image is already copied");
|
||
for (let l2 = 0; l2 < i3.height; l2++) {
|
||
const u2 = ((r2.y + l2) * t2.width + r2.x) * a2, c2 = ((n2.y + l2) * e2.width + n2.x) * a2;
|
||
for (let t3 = 0; t3 < i3.width * a2; t3++) o2[c2 + t3] = s2[u2 + t3];
|
||
}
|
||
return e2;
|
||
}
|
||
class Rs {
|
||
constructor(t2, e2) {
|
||
Ds(this, t2, 1, e2);
|
||
}
|
||
resize(t2) {
|
||
Os(this, t2, 1);
|
||
}
|
||
clone() {
|
||
return new Rs({ width: this.width, height: this.height }, new Uint8Array(this.data));
|
||
}
|
||
static copy(t2, e2, r2, n2, i3) {
|
||
Us(t2, e2, r2, n2, i3, 1);
|
||
}
|
||
}
|
||
class qs {
|
||
constructor(t2, e2) {
|
||
Ds(this, t2, 4, e2);
|
||
}
|
||
resize(t2) {
|
||
Os(this, t2, 4);
|
||
}
|
||
replace(t2, e2) {
|
||
e2 ? this.data.set(t2) : this.data = t2 instanceof Uint8ClampedArray ? new Uint8Array(t2.buffer) : t2;
|
||
}
|
||
clone() {
|
||
return new qs({ width: this.width, height: this.height }, new Uint8Array(this.data));
|
||
}
|
||
static copy(t2, e2, r2, n2, i3) {
|
||
Us(t2, e2, r2, n2, i3, 4);
|
||
}
|
||
}
|
||
function js(t2) {
|
||
const e2 = {}, r2 = t2.resolution || 256, n2 = t2.clips ? t2.clips.length : 1, i3 = t2.image || new qs({ width: r2, height: n2 });
|
||
if (Math.log(r2) / Math.LN2 % 1 != 0) throw new Error(`width is not a power of 2 - ${r2}`);
|
||
const a2 = (r3, n3, a3) => {
|
||
e2[t2.evaluationKey] = a3;
|
||
const s2 = t2.expression.evaluate(e2);
|
||
i3.data[r3 + n3 + 0] = Math.floor(255 * s2.r / s2.a), i3.data[r3 + n3 + 1] = Math.floor(255 * s2.g / s2.a), i3.data[r3 + n3 + 2] = Math.floor(255 * s2.b / s2.a), i3.data[r3 + n3 + 3] = Math.floor(255 * s2.a);
|
||
};
|
||
if (t2.clips) for (let e3 = 0, i4 = 0; e3 < n2; ++e3, i4 += 4 * r2) for (let n3 = 0, s2 = 0; n3 < r2; n3++, s2 += 4) {
|
||
const o2 = n3 / (r2 - 1), { start: l2, end: u2 } = t2.clips[e3];
|
||
a2(i4, s2, l2 * (1 - o2) + u2 * o2);
|
||
}
|
||
else for (let t3 = 0, e3 = 0; t3 < r2; t3++, e3 += 4) a2(0, e3, t3 / (r2 - 1));
|
||
return i3;
|
||
}
|
||
$n("AlphaImage", Rs), $n("RGBAImage", qs);
|
||
class Ns extends Si {
|
||
createBucket(t2) {
|
||
return new Ts(t2);
|
||
}
|
||
constructor(t2) {
|
||
super(t2, Ls), this._updateColorRamp();
|
||
}
|
||
_handleSpecialPaintPropertyUpdate(t2) {
|
||
"heatmap-color" === t2 && this._updateColorRamp();
|
||
}
|
||
_updateColorRamp() {
|
||
this.colorRamp = js({ 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() {
|
||
return 0;
|
||
}
|
||
queryIntersectsFeature() {
|
||
return false;
|
||
}
|
||
hasOffscreenPass() {
|
||
return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility;
|
||
}
|
||
}
|
||
let Zs;
|
||
var Ks = { get paint() {
|
||
return Zs = Zs || new _i({ "hillshade-illumination-direction": new gi(X.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new gi(X.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new gi(X.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new gi(X.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new gi(X.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new gi(X.paint_hillshade["hillshade-accent-color"]) });
|
||
} };
|
||
class Gs extends Si {
|
||
constructor(t2) {
|
||
super(t2, Ks);
|
||
}
|
||
hasOffscreenPass() {
|
||
return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility;
|
||
}
|
||
}
|
||
const Js = Mi([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Xs } = Js;
|
||
var Ys = { exports: {} };
|
||
function Hs(t2, e2, r2) {
|
||
r2 = r2 || 2;
|
||
var n2, i3, a2, s2, o2, l2, u2, c2 = e2 && e2.length, h2 = c2 ? e2[0] * r2 : t2.length, p2 = Ws(t2, 0, h2, r2, true), f2 = [];
|
||
if (!p2 || p2.next === p2.prev) return f2;
|
||
if (c2 && (p2 = (function(t3, e3, r3, n3) {
|
||
var i4, a3, s3, o3 = [];
|
||
for (i4 = 0, a3 = e3.length; i4 < a3; i4++) (s3 = Ws(t3, e3[i4] * n3, i4 < a3 - 1 ? e3[i4 + 1] * n3 : t3.length, n3, false)) === s3.next && (s3.steiner = true), o3.push(uo(s3));
|
||
for (o3.sort(ao), i4 = 0; i4 < o3.length; i4++) r3 = so(o3[i4], r3);
|
||
return r3;
|
||
})(t2, e2, p2, r2)), t2.length > 80 * r2) {
|
||
n2 = a2 = t2[0], i3 = s2 = t2[1];
|
||
for (var d2 = r2; d2 < h2; d2 += r2) (o2 = t2[d2]) < n2 && (n2 = o2), (l2 = t2[d2 + 1]) < i3 && (i3 = l2), o2 > a2 && (a2 = o2), l2 > s2 && (s2 = l2);
|
||
u2 = 0 !== (u2 = Math.max(a2 - n2, s2 - i3)) ? 32767 / u2 : 0;
|
||
}
|
||
return to(p2, f2, r2, n2, i3, u2, 0), f2;
|
||
}
|
||
function Ws(t2, e2, r2, n2, i3) {
|
||
var a2, s2;
|
||
if (i3 === Ao(t2, e2, r2, n2) > 0) for (a2 = e2; a2 < r2; a2 += n2) s2 = bo(a2, t2[a2], t2[a2 + 1], s2);
|
||
else for (a2 = r2 - n2; a2 >= e2; a2 -= n2) s2 = bo(a2, t2[a2], t2[a2 + 1], s2);
|
||
return s2 && fo(s2, s2.next) && (wo(s2), s2 = s2.next), s2;
|
||
}
|
||
function Qs(t2, e2) {
|
||
if (!t2) return t2;
|
||
e2 || (e2 = t2);
|
||
var r2, n2 = t2;
|
||
do {
|
||
if (r2 = false, n2.steiner || !fo(n2, n2.next) && 0 !== po(n2.prev, n2, n2.next)) n2 = n2.next;
|
||
else {
|
||
if (wo(n2), (n2 = e2 = n2.prev) === n2.next) break;
|
||
r2 = true;
|
||
}
|
||
} while (r2 || n2 !== e2);
|
||
return e2;
|
||
}
|
||
function to(t2, e2, r2, n2, i3, a2, s2) {
|
||
if (t2) {
|
||
!s2 && a2 && (function(t3, e3, r3, n3) {
|
||
var i4 = t3;
|
||
do {
|
||
0 === i4.z && (i4.z = lo(i4.x, i4.y, e3, r3, n3)), i4.prevZ = i4.prev, i4.nextZ = i4.next, i4 = i4.next;
|
||
} while (i4 !== t3);
|
||
i4.prevZ.nextZ = null, i4.prevZ = null, (function(t4) {
|
||
var e4, r4, n4, i5, a3, s3, o3, l3, u3 = 1;
|
||
do {
|
||
for (r4 = t4, t4 = null, a3 = null, s3 = 0; r4; ) {
|
||
for (s3++, n4 = r4, o3 = 0, e4 = 0; e4 < u3 && (o3++, n4 = n4.nextZ); e4++) ;
|
||
for (l3 = u3; o3 > 0 || l3 > 0 && n4; ) 0 !== o3 && (0 === l3 || !n4 || r4.z <= n4.z) ? (i5 = r4, r4 = r4.nextZ, o3--) : (i5 = n4, n4 = n4.nextZ, l3--), a3 ? a3.nextZ = i5 : t4 = i5, i5.prevZ = a3, a3 = i5;
|
||
r4 = n4;
|
||
}
|
||
a3.nextZ = null, u3 *= 2;
|
||
} while (s3 > 1);
|
||
})(i4);
|
||
})(t2, n2, i3, a2);
|
||
for (var o2, l2, u2 = t2; t2.prev !== t2.next; ) if (o2 = t2.prev, l2 = t2.next, a2 ? ro(t2, n2, i3, a2) : eo(t2)) e2.push(o2.i / r2 | 0), e2.push(t2.i / r2 | 0), e2.push(l2.i / r2 | 0), wo(t2), t2 = l2.next, u2 = l2.next;
|
||
else if ((t2 = l2) === u2) {
|
||
s2 ? 1 === s2 ? to(t2 = no(Qs(t2), e2, r2), e2, r2, n2, i3, a2, 2) : 2 === s2 && io(t2, e2, r2, n2, i3, a2) : to(Qs(t2), e2, r2, n2, i3, a2, 1);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
function eo(t2) {
|
||
var e2 = t2.prev, r2 = t2, n2 = t2.next;
|
||
if (po(e2, r2, n2) >= 0) return false;
|
||
for (var i3 = e2.x, a2 = r2.x, s2 = n2.x, o2 = e2.y, l2 = r2.y, u2 = n2.y, c2 = i3 < a2 ? i3 < s2 ? i3 : s2 : a2 < s2 ? a2 : s2, h2 = o2 < l2 ? o2 < u2 ? o2 : u2 : l2 < u2 ? l2 : u2, p2 = i3 > a2 ? i3 > s2 ? i3 : s2 : a2 > s2 ? a2 : s2, f2 = o2 > l2 ? o2 > u2 ? o2 : u2 : l2 > u2 ? l2 : u2, d2 = n2.next; d2 !== e2; ) {
|
||
if (d2.x >= c2 && d2.x <= p2 && d2.y >= h2 && d2.y <= f2 && co(i3, o2, a2, l2, s2, u2, d2.x, d2.y) && po(d2.prev, d2, d2.next) >= 0) return false;
|
||
d2 = d2.next;
|
||
}
|
||
return true;
|
||
}
|
||
function ro(t2, e2, r2, n2) {
|
||
var i3 = t2.prev, a2 = t2, s2 = t2.next;
|
||
if (po(i3, a2, s2) >= 0) return false;
|
||
for (var o2 = i3.x, l2 = a2.x, u2 = s2.x, c2 = i3.y, h2 = a2.y, p2 = s2.y, f2 = o2 < l2 ? o2 < u2 ? o2 : u2 : l2 < u2 ? l2 : u2, d2 = c2 < h2 ? c2 < p2 ? c2 : p2 : h2 < p2 ? h2 : p2, y2 = o2 > l2 ? o2 > u2 ? o2 : u2 : l2 > u2 ? l2 : u2, m2 = c2 > h2 ? c2 > p2 ? c2 : p2 : h2 > p2 ? h2 : p2, g2 = lo(f2, d2, e2, r2, n2), x2 = lo(y2, m2, e2, r2, n2), v2 = t2.prevZ, b2 = t2.nextZ; v2 && v2.z >= g2 && b2 && b2.z <= x2; ) {
|
||
if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i3 && v2 !== s2 && co(o2, c2, l2, h2, u2, p2, v2.x, v2.y) && po(v2.prev, v2, v2.next) >= 0) return false;
|
||
if (v2 = v2.prevZ, b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i3 && b2 !== s2 && co(o2, c2, l2, h2, u2, p2, b2.x, b2.y) && po(b2.prev, b2, b2.next) >= 0) return false;
|
||
b2 = b2.nextZ;
|
||
}
|
||
for (; v2 && v2.z >= g2; ) {
|
||
if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i3 && v2 !== s2 && co(o2, c2, l2, h2, u2, p2, v2.x, v2.y) && po(v2.prev, v2, v2.next) >= 0) return false;
|
||
v2 = v2.prevZ;
|
||
}
|
||
for (; b2 && b2.z <= x2; ) {
|
||
if (b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i3 && b2 !== s2 && co(o2, c2, l2, h2, u2, p2, b2.x, b2.y) && po(b2.prev, b2, b2.next) >= 0) return false;
|
||
b2 = b2.nextZ;
|
||
}
|
||
return true;
|
||
}
|
||
function no(t2, e2, r2) {
|
||
var n2 = t2;
|
||
do {
|
||
var i3 = n2.prev, a2 = n2.next.next;
|
||
!fo(i3, a2) && yo(i3, n2, n2.next, a2) && xo(i3, a2) && xo(a2, i3) && (e2.push(i3.i / r2 | 0), e2.push(n2.i / r2 | 0), e2.push(a2.i / r2 | 0), wo(n2), wo(n2.next), n2 = t2 = a2), n2 = n2.next;
|
||
} while (n2 !== t2);
|
||
return Qs(n2);
|
||
}
|
||
function io(t2, e2, r2, n2, i3, a2) {
|
||
var s2 = t2;
|
||
do {
|
||
for (var o2 = s2.next.next; o2 !== s2.prev; ) {
|
||
if (s2.i !== o2.i && ho(s2, o2)) {
|
||
var l2 = vo(s2, o2);
|
||
return s2 = Qs(s2, s2.next), l2 = Qs(l2, l2.next), to(s2, e2, r2, n2, i3, a2, 0), void to(l2, e2, r2, n2, i3, a2, 0);
|
||
}
|
||
o2 = o2.next;
|
||
}
|
||
s2 = s2.next;
|
||
} while (s2 !== t2);
|
||
}
|
||
function ao(t2, e2) {
|
||
return t2.x - e2.x;
|
||
}
|
||
function so(t2, e2) {
|
||
var r2 = (function(t3, e3) {
|
||
var r3, n3 = e3, i3 = t3.x, a2 = t3.y, s2 = -1 / 0;
|
||
do {
|
||
if (a2 <= n3.y && a2 >= n3.next.y && n3.next.y !== n3.y) {
|
||
var o2 = n3.x + (a2 - n3.y) * (n3.next.x - n3.x) / (n3.next.y - n3.y);
|
||
if (o2 <= i3 && o2 > s2 && (s2 = o2, r3 = n3.x < n3.next.x ? n3 : n3.next, o2 === i3)) return r3;
|
||
}
|
||
n3 = n3.next;
|
||
} while (n3 !== e3);
|
||
if (!r3) return null;
|
||
var l2, u2 = r3, c2 = r3.x, h2 = r3.y, p2 = 1 / 0;
|
||
n3 = r3;
|
||
do {
|
||
i3 >= n3.x && n3.x >= c2 && i3 !== n3.x && co(a2 < h2 ? i3 : s2, a2, c2, h2, a2 < h2 ? s2 : i3, a2, n3.x, n3.y) && (l2 = Math.abs(a2 - n3.y) / (i3 - n3.x), xo(n3, t3) && (l2 < p2 || l2 === p2 && (n3.x > r3.x || n3.x === r3.x && oo(r3, n3))) && (r3 = n3, p2 = l2)), n3 = n3.next;
|
||
} while (n3 !== u2);
|
||
return r3;
|
||
})(t2, e2);
|
||
if (!r2) return e2;
|
||
var n2 = vo(r2, t2);
|
||
return Qs(n2, n2.next), Qs(r2, r2.next);
|
||
}
|
||
function oo(t2, e2) {
|
||
return po(t2.prev, t2, e2.prev) < 0 && po(e2.next, t2, t2.next) < 0;
|
||
}
|
||
function lo(t2, e2, r2, n2, i3) {
|
||
return (t2 = 1431655765 & ((t2 = 858993459 & ((t2 = 252645135 & ((t2 = 16711935 & ((t2 = (t2 - r2) * i3 | 0) | t2 << 8)) | t2 << 4)) | t2 << 2)) | t2 << 1)) | (e2 = 1431655765 & ((e2 = 858993459 & ((e2 = 252645135 & ((e2 = 16711935 & ((e2 = (e2 - n2) * i3 | 0) | e2 << 8)) | e2 << 4)) | e2 << 2)) | e2 << 1)) << 1;
|
||
}
|
||
function uo(t2) {
|
||
var e2 = t2, r2 = t2;
|
||
do {
|
||
(e2.x < r2.x || e2.x === r2.x && e2.y < r2.y) && (r2 = e2), e2 = e2.next;
|
||
} while (e2 !== t2);
|
||
return r2;
|
||
}
|
||
function co(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
return (i3 - s2) * (e2 - o2) >= (t2 - s2) * (a2 - o2) && (t2 - s2) * (n2 - o2) >= (r2 - s2) * (e2 - o2) && (r2 - s2) * (a2 - o2) >= (i3 - s2) * (n2 - o2);
|
||
}
|
||
function ho(t2, e2) {
|
||
return t2.next.i !== e2.i && t2.prev.i !== e2.i && !(function(t3, e3) {
|
||
var r2 = t3;
|
||
do {
|
||
if (r2.i !== t3.i && r2.next.i !== t3.i && r2.i !== e3.i && r2.next.i !== e3.i && yo(r2, r2.next, t3, e3)) return true;
|
||
r2 = r2.next;
|
||
} while (r2 !== t3);
|
||
return false;
|
||
})(t2, e2) && (xo(t2, e2) && xo(e2, t2) && (function(t3, e3) {
|
||
var r2 = t3, n2 = false, i3 = (t3.x + e3.x) / 2, a2 = (t3.y + e3.y) / 2;
|
||
do {
|
||
r2.y > a2 != r2.next.y > a2 && r2.next.y !== r2.y && i3 < (r2.next.x - r2.x) * (a2 - r2.y) / (r2.next.y - r2.y) + r2.x && (n2 = !n2), r2 = r2.next;
|
||
} while (r2 !== t3);
|
||
return n2;
|
||
})(t2, e2) && (po(t2.prev, t2, e2.prev) || po(t2, e2.prev, e2)) || fo(t2, e2) && po(t2.prev, t2, t2.next) > 0 && po(e2.prev, e2, e2.next) > 0);
|
||
}
|
||
function po(t2, e2, r2) {
|
||
return (e2.y - t2.y) * (r2.x - e2.x) - (e2.x - t2.x) * (r2.y - e2.y);
|
||
}
|
||
function fo(t2, e2) {
|
||
return t2.x === e2.x && t2.y === e2.y;
|
||
}
|
||
function yo(t2, e2, r2, n2) {
|
||
var i3 = go(po(t2, e2, r2)), a2 = go(po(t2, e2, n2)), s2 = go(po(r2, n2, t2)), o2 = go(po(r2, n2, e2));
|
||
return i3 !== a2 && s2 !== o2 || !(0 !== i3 || !mo(t2, r2, e2)) || !(0 !== a2 || !mo(t2, n2, e2)) || !(0 !== s2 || !mo(r2, t2, n2)) || !(0 !== o2 || !mo(r2, e2, n2));
|
||
}
|
||
function mo(t2, e2, r2) {
|
||
return e2.x <= Math.max(t2.x, r2.x) && e2.x >= Math.min(t2.x, r2.x) && e2.y <= Math.max(t2.y, r2.y) && e2.y >= Math.min(t2.y, r2.y);
|
||
}
|
||
function go(t2) {
|
||
return t2 > 0 ? 1 : t2 < 0 ? -1 : 0;
|
||
}
|
||
function xo(t2, e2) {
|
||
return po(t2.prev, t2, t2.next) < 0 ? po(t2, e2, t2.next) >= 0 && po(t2, t2.prev, e2) >= 0 : po(t2, e2, t2.prev) < 0 || po(t2, t2.next, e2) < 0;
|
||
}
|
||
function vo(t2, e2) {
|
||
var r2 = new _o(t2.i, t2.x, t2.y), n2 = new _o(e2.i, e2.x, e2.y), i3 = t2.next, a2 = e2.prev;
|
||
return t2.next = e2, e2.prev = t2, r2.next = i3, i3.prev = r2, n2.next = r2, r2.prev = n2, a2.next = n2, n2.prev = a2, n2;
|
||
}
|
||
function bo(t2, e2, r2, n2) {
|
||
var i3 = new _o(t2, e2, r2);
|
||
return n2 ? (i3.next = n2.next, i3.prev = n2, n2.next.prev = i3, n2.next = i3) : (i3.prev = i3, i3.next = i3), i3;
|
||
}
|
||
function wo(t2) {
|
||
t2.next.prev = t2.prev, t2.prev.next = t2.next, t2.prevZ && (t2.prevZ.nextZ = t2.nextZ), t2.nextZ && (t2.nextZ.prevZ = t2.prevZ);
|
||
}
|
||
function _o(t2, e2, r2) {
|
||
this.i = t2, this.x = e2, this.y = r2, this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = false;
|
||
}
|
||
function Ao(t2, e2, r2, n2) {
|
||
for (var i3 = 0, a2 = e2, s2 = r2 - n2; a2 < r2; a2 += n2) i3 += (t2[s2] - t2[a2]) * (t2[a2 + 1] + t2[s2 + 1]), s2 = a2;
|
||
return i3;
|
||
}
|
||
Ys.exports = Hs, Ys.exports.default = Hs, Hs.deviation = function(t2, e2, r2, n2) {
|
||
var i3 = e2 && e2.length, a2 = Math.abs(Ao(t2, 0, i3 ? e2[0] * r2 : t2.length, r2));
|
||
if (i3) for (var s2 = 0, o2 = e2.length; s2 < o2; s2++) a2 -= Math.abs(Ao(t2, e2[s2] * r2, s2 < o2 - 1 ? e2[s2 + 1] * r2 : t2.length, r2));
|
||
var l2 = 0;
|
||
for (s2 = 0; s2 < n2.length; s2 += 3) {
|
||
var u2 = n2[s2] * r2, c2 = n2[s2 + 1] * r2, h2 = n2[s2 + 2] * r2;
|
||
l2 += Math.abs((t2[u2] - t2[h2]) * (t2[c2 + 1] - t2[u2 + 1]) - (t2[u2] - t2[c2]) * (t2[h2 + 1] - t2[u2 + 1]));
|
||
}
|
||
return 0 === a2 && 0 === l2 ? 0 : Math.abs((l2 - a2) / a2);
|
||
}, Hs.flatten = function(t2) {
|
||
for (var e2 = t2[0][0].length, r2 = { vertices: [], holes: [], dimensions: e2 }, n2 = 0, i3 = 0; i3 < t2.length; i3++) {
|
||
for (var a2 = 0; a2 < t2[i3].length; a2++) for (var s2 = 0; s2 < e2; s2++) r2.vertices.push(t2[i3][a2][s2]);
|
||
i3 > 0 && r2.holes.push(n2 += t2[i3 - 1].length);
|
||
}
|
||
return r2;
|
||
};
|
||
var So = r(Ys.exports);
|
||
function ko(t2, e2, r2, n2, i3) {
|
||
Io(t2, e2, r2, n2 || t2.length - 1, i3 || Mo);
|
||
}
|
||
function Io(t2, e2, r2, n2, i3) {
|
||
for (; n2 > r2; ) {
|
||
if (n2 - r2 > 600) {
|
||
var a2 = n2 - r2 + 1, s2 = e2 - r2 + 1, o2 = Math.log(a2), l2 = 0.5 * Math.exp(2 * o2 / 3), u2 = 0.5 * Math.sqrt(o2 * l2 * (a2 - l2) / a2) * (s2 - a2 / 2 < 0 ? -1 : 1);
|
||
Io(t2, e2, Math.max(r2, Math.floor(e2 - s2 * l2 / a2 + u2)), Math.min(n2, Math.floor(e2 + (a2 - s2) * l2 / a2 + u2)), i3);
|
||
}
|
||
var c2 = t2[e2], h2 = r2, p2 = n2;
|
||
for (zo(t2, r2, e2), i3(t2[n2], c2) > 0 && zo(t2, r2, n2); h2 < p2; ) {
|
||
for (zo(t2, h2, p2), h2++, p2--; i3(t2[h2], c2) < 0; ) h2++;
|
||
for (; i3(t2[p2], c2) > 0; ) p2--;
|
||
}
|
||
0 === i3(t2[r2], c2) ? zo(t2, r2, p2) : zo(t2, ++p2, n2), p2 <= e2 && (r2 = p2 + 1), e2 <= p2 && (n2 = p2 - 1);
|
||
}
|
||
}
|
||
function zo(t2, e2, r2) {
|
||
var n2 = t2[e2];
|
||
t2[e2] = t2[r2], t2[r2] = n2;
|
||
}
|
||
function Mo(t2, e2) {
|
||
return t2 < e2 ? -1 : t2 > e2 ? 1 : 0;
|
||
}
|
||
function Co(t2, e2) {
|
||
const r2 = t2.length;
|
||
if (r2 <= 1) return [t2];
|
||
const n2 = [];
|
||
let i3, a2;
|
||
for (let e3 = 0; e3 < r2; e3++) {
|
||
const r3 = k(t2[e3]);
|
||
0 !== r3 && (t2[e3].area = Math.abs(r3), void 0 === a2 && (a2 = r3 < 0), a2 === r3 < 0 ? (i3 && n2.push(i3), i3 = [t2[e3]]) : i3.push(t2[e3]));
|
||
}
|
||
if (i3 && n2.push(i3), e2 > 1) for (let t3 = 0; t3 < n2.length; t3++) n2[t3].length <= e2 || (ko(n2[t3], e2, 1, n2[t3].length - 1, Bo), n2[t3] = n2[t3].slice(0, e2));
|
||
return n2;
|
||
}
|
||
function Bo(t2, e2) {
|
||
return e2.area - t2.area;
|
||
}
|
||
function Po(t2, e2, r2) {
|
||
const n2 = r2.patternDependencies;
|
||
let i3 = false;
|
||
for (const r3 of e2) {
|
||
const e3 = r3.paint.get(`${t2}-pattern`);
|
||
e3.isConstant() || (i3 = true);
|
||
const a2 = e3.constantOr(null);
|
||
a2 && (i3 = true, n2[a2.to] = true, n2[a2.from] = true);
|
||
}
|
||
return i3;
|
||
}
|
||
function Vo(t2, e2, r2, n2, i3) {
|
||
const a2 = i3.patternDependencies;
|
||
for (const s2 of e2) {
|
||
const e3 = s2.paint.get(`${t2}-pattern`).value;
|
||
if ("constant" !== e3.kind) {
|
||
let t3 = e3.evaluate({ zoom: n2 - 1 }, r2, {}, i3.availableImages), o2 = e3.evaluate({ zoom: n2 }, r2, {}, i3.availableImages), l2 = e3.evaluate({ zoom: n2 + 1 }, r2, {}, i3.availableImages);
|
||
t3 = t3 && t3.name ? t3.name : t3, o2 = o2 && o2.name ? o2.name : o2, l2 = l2 && l2.name ? l2.name : l2, a2[t3] = true, a2[o2] = true, a2[l2] = true, r2.patterns[s2.id] = { min: t3, mid: o2, max: l2 };
|
||
}
|
||
}
|
||
return r2;
|
||
}
|
||
class Eo {
|
||
constructor(t2) {
|
||
this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasPattern = false, this.patternFeatures = [], this.layoutVertexArray = new fa(), this.indexArray = new Aa(), this.indexArray2 = new Sa(), this.programConfigurations = new Qa(t2.layers, t2.zoom), this.segments = new za(), this.segments2 = new za(), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
|
||
}
|
||
populate(t2, e2, r2) {
|
||
this.hasPattern = Po("fill", this.layers, e2);
|
||
const n2 = this.layers[0].layout.get("fill-sort-key"), i3 = !n2.isConstant(), a2 = [];
|
||
for (const { feature: s2, id: o2, index: l2, sourceLayerIndex: u2 } of t2) {
|
||
const t3 = this.layers[0]._featureFilter.needGeometry, c2 = ss(s2, t3);
|
||
if (!this.layers[0]._featureFilter.filter(new li(this.zoom), c2, r2)) continue;
|
||
const h2 = i3 ? n2.evaluate(c2, {}, r2, e2.availableImages) : void 0, p2 = { id: o2, properties: s2.properties, type: s2.type, sourceLayerIndex: u2, index: l2, geometry: t3 ? c2.geometry : as(s2), patterns: {}, sortKey: h2 };
|
||
a2.push(p2);
|
||
}
|
||
i3 && a2.sort(((t3, e3) => t3.sortKey - e3.sortKey));
|
||
for (const n3 of a2) {
|
||
const { geometry: i4, index: a3, sourceLayerIndex: s2 } = n3;
|
||
if (this.hasPattern) {
|
||
const t3 = Vo("fill", this.layers, n3, this.zoom, e2);
|
||
this.patternFeatures.push(t3);
|
||
} else this.addFeature(n3, i4, a3, r2, {});
|
||
e2.featureIndex.insert(t2[a3].feature, i4, a3, s2, this.index);
|
||
}
|
||
}
|
||
update(t2, e2, r2) {
|
||
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, r2);
|
||
}
|
||
addFeatures(t2, e2, r2) {
|
||
for (const t3 of this.patternFeatures) this.addFeature(t3, t3.geometry, t3.index, e2, r2);
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.layoutVertexArray.length;
|
||
}
|
||
uploadPending() {
|
||
return !this.uploaded || this.programConfigurations.needsUpload;
|
||
}
|
||
upload(t2) {
|
||
this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, Xs), this.indexBuffer = t2.createIndexBuffer(this.indexArray), this.indexBuffer2 = t2.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(t2), this.uploaded = true;
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
|
||
}
|
||
addFeature(t2, e2, r2, n2, i3) {
|
||
for (const t3 of Co(e2, 500)) {
|
||
let e3 = 0;
|
||
for (const r4 of t3) e3 += r4.length;
|
||
const r3 = this.segments.prepareSegment(e3, this.layoutVertexArray, this.indexArray), n3 = r3.vertexLength, i4 = [], a2 = [];
|
||
for (const e4 of t3) {
|
||
if (0 === e4.length) continue;
|
||
e4 !== t3[0] && a2.push(i4.length / 2);
|
||
const r4 = this.segments2.prepareSegment(e4.length, this.layoutVertexArray, this.indexArray2), n4 = r4.vertexLength;
|
||
this.layoutVertexArray.emplaceBack(e4[0].x, e4[0].y), this.indexArray2.emplaceBack(n4 + e4.length - 1, n4), i4.push(e4[0].x), i4.push(e4[0].y);
|
||
for (let t4 = 1; t4 < e4.length; t4++) this.layoutVertexArray.emplaceBack(e4[t4].x, e4[t4].y), this.indexArray2.emplaceBack(n4 + t4 - 1, n4 + t4), i4.push(e4[t4].x), i4.push(e4[t4].y);
|
||
r4.vertexLength += e4.length, r4.primitiveLength += e4.length;
|
||
}
|
||
const s2 = So(i4, a2);
|
||
for (let t4 = 0; t4 < s2.length; t4 += 3) this.indexArray.emplaceBack(n3 + s2[t4], n3 + s2[t4 + 1], n3 + s2[t4 + 2]);
|
||
r3.vertexLength += e3, r3.primitiveLength += s2.length / 3;
|
||
}
|
||
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, r2, i3, n2);
|
||
}
|
||
}
|
||
let Fo, To;
|
||
$n("FillBucket", Eo, { omit: ["layers", "patternFeatures"] });
|
||
var $o = { get paint() {
|
||
return To = To || new _i({ "fill-antialias": new gi(X.paint_fill["fill-antialias"]), "fill-opacity": new xi(X.paint_fill["fill-opacity"]), "fill-color": new xi(X.paint_fill["fill-color"]), "fill-outline-color": new xi(X.paint_fill["fill-outline-color"]), "fill-translate": new gi(X.paint_fill["fill-translate"]), "fill-translate-anchor": new gi(X.paint_fill["fill-translate-anchor"]), "fill-pattern": new vi(X.paint_fill["fill-pattern"]) });
|
||
}, get layout() {
|
||
return Fo = Fo || new _i({ "fill-sort-key": new xi(X.layout_fill["fill-sort-key"]) });
|
||
} };
|
||
class Lo extends Si {
|
||
constructor(t2) {
|
||
super(t2, $o);
|
||
}
|
||
recalculate(t2, e2) {
|
||
super.recalculate(t2, e2);
|
||
const r2 = this.paint._values["fill-outline-color"];
|
||
"constant" === r2.value.kind && void 0 === r2.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]);
|
||
}
|
||
createBucket(t2) {
|
||
return new Eo(t2);
|
||
}
|
||
queryRadius() {
|
||
return ws(this.paint.get("fill-translate"));
|
||
}
|
||
queryIntersectsFeature(t2, e2, r2, n2, i3, a2, s2) {
|
||
return hs(_s(t2, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), a2.angle, s2), n2);
|
||
}
|
||
isTileClipped() {
|
||
return true;
|
||
}
|
||
}
|
||
const Do = Mi([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), Oo = Mi([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: Uo } = Do;
|
||
var Ro = {}, qo = n, jo = No;
|
||
function No(t2, e2, r2, n2, i3) {
|
||
this.properties = {}, this.extent = r2, this.type = 0, this._pbf = t2, this._geometry = -1, this._keys = n2, this._values = i3, t2.readFields(Zo, this, e2);
|
||
}
|
||
function Zo(t2, e2, r2) {
|
||
1 == t2 ? e2.id = r2.readVarint() : 2 == t2 ? (function(t3, e3) {
|
||
for (var r3 = t3.readVarint() + t3.pos; t3.pos < r3; ) {
|
||
var n2 = e3._keys[t3.readVarint()], i3 = e3._values[t3.readVarint()];
|
||
e3.properties[n2] = i3;
|
||
}
|
||
})(r2, e2) : 3 == t2 ? e2.type = r2.readVarint() : 4 == t2 && (e2._geometry = r2.pos);
|
||
}
|
||
function Ko(t2) {
|
||
for (var e2, r2, n2 = 0, i3 = 0, a2 = t2.length, s2 = a2 - 1; i3 < a2; s2 = i3++) n2 += ((r2 = t2[s2]).x - (e2 = t2[i3]).x) * (e2.y + r2.y);
|
||
return n2;
|
||
}
|
||
No.types = ["Unknown", "Point", "LineString", "Polygon"], No.prototype.loadGeometry = function() {
|
||
var t2 = this._pbf;
|
||
t2.pos = this._geometry;
|
||
for (var e2, r2 = t2.readVarint() + t2.pos, n2 = 1, i3 = 0, a2 = 0, s2 = 0, o2 = []; t2.pos < r2; ) {
|
||
if (i3 <= 0) {
|
||
var l2 = t2.readVarint();
|
||
n2 = 7 & l2, i3 = l2 >> 3;
|
||
}
|
||
if (i3--, 1 === n2 || 2 === n2) a2 += t2.readSVarint(), s2 += t2.readSVarint(), 1 === n2 && (e2 && o2.push(e2), e2 = []), e2.push(new qo(a2, s2));
|
||
else {
|
||
if (7 !== n2) throw new Error("unknown command " + n2);
|
||
e2 && e2.push(e2[0].clone());
|
||
}
|
||
}
|
||
return e2 && o2.push(e2), o2;
|
||
}, No.prototype.bbox = function() {
|
||
var t2 = this._pbf;
|
||
t2.pos = this._geometry;
|
||
for (var e2 = t2.readVarint() + t2.pos, r2 = 1, n2 = 0, i3 = 0, a2 = 0, s2 = 1 / 0, o2 = -1 / 0, l2 = 1 / 0, u2 = -1 / 0; t2.pos < e2; ) {
|
||
if (n2 <= 0) {
|
||
var c2 = t2.readVarint();
|
||
r2 = 7 & c2, n2 = c2 >> 3;
|
||
}
|
||
if (n2--, 1 === r2 || 2 === r2) (i3 += t2.readSVarint()) < s2 && (s2 = i3), i3 > o2 && (o2 = i3), (a2 += t2.readSVarint()) < l2 && (l2 = a2), a2 > u2 && (u2 = a2);
|
||
else if (7 !== r2) throw new Error("unknown command " + r2);
|
||
}
|
||
return [s2, l2, o2, u2];
|
||
}, No.prototype.toGeoJSON = function(t2, e2, r2) {
|
||
var n2, i3, a2 = this.extent * Math.pow(2, r2), s2 = this.extent * t2, o2 = this.extent * e2, l2 = this.loadGeometry(), u2 = No.types[this.type];
|
||
function c2(t3) {
|
||
for (var e3 = 0; e3 < t3.length; e3++) {
|
||
var r3 = t3[e3];
|
||
t3[e3] = [360 * (r3.x + s2) / a2 - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (r3.y + o2) / a2) * Math.PI / 180)) - 90];
|
||
}
|
||
}
|
||
switch (this.type) {
|
||
case 1:
|
||
var h2 = [];
|
||
for (n2 = 0; n2 < l2.length; n2++) h2[n2] = l2[n2][0];
|
||
c2(l2 = h2);
|
||
break;
|
||
case 2:
|
||
for (n2 = 0; n2 < l2.length; n2++) c2(l2[n2]);
|
||
break;
|
||
case 3:
|
||
for (l2 = (function(t3) {
|
||
var e3 = t3.length;
|
||
if (e3 <= 1) return [t3];
|
||
for (var r3, n3, i4 = [], a3 = 0; a3 < e3; a3++) {
|
||
var s3 = Ko(t3[a3]);
|
||
0 !== s3 && (void 0 === n3 && (n3 = s3 < 0), n3 === s3 < 0 ? (r3 && i4.push(r3), r3 = [t3[a3]]) : r3.push(t3[a3]));
|
||
}
|
||
return r3 && i4.push(r3), i4;
|
||
})(l2), n2 = 0; n2 < l2.length; n2++) for (i3 = 0; i3 < l2[n2].length; i3++) c2(l2[n2][i3]);
|
||
}
|
||
1 === l2.length ? l2 = l2[0] : u2 = "Multi" + u2;
|
||
var p2 = { type: "Feature", geometry: { type: u2, coordinates: l2 }, properties: this.properties };
|
||
return "id" in this && (p2.id = this.id), p2;
|
||
};
|
||
var Go = jo, Jo = Xo;
|
||
function Xo(t2, e2) {
|
||
this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = t2, this._keys = [], this._values = [], this._features = [], t2.readFields(Yo, this, e2), this.length = this._features.length;
|
||
}
|
||
function Yo(t2, e2, r2) {
|
||
15 === t2 ? e2.version = r2.readVarint() : 1 === t2 ? e2.name = r2.readString() : 5 === t2 ? e2.extent = r2.readVarint() : 2 === t2 ? e2._features.push(r2.pos) : 3 === t2 ? e2._keys.push(r2.readString()) : 4 === t2 && e2._values.push((function(t3) {
|
||
for (var e3 = null, r3 = t3.readVarint() + t3.pos; t3.pos < r3; ) {
|
||
var n2 = t3.readVarint() >> 3;
|
||
e3 = 1 === n2 ? t3.readString() : 2 === n2 ? t3.readFloat() : 3 === n2 ? t3.readDouble() : 4 === n2 ? t3.readVarint64() : 5 === n2 ? t3.readVarint() : 6 === n2 ? t3.readSVarint() : 7 === n2 ? t3.readBoolean() : null;
|
||
}
|
||
return e3;
|
||
})(r2));
|
||
}
|
||
Xo.prototype.feature = function(t2) {
|
||
if (t2 < 0 || t2 >= this._features.length) throw new Error("feature index out of bounds");
|
||
this._pbf.pos = this._features[t2];
|
||
var e2 = this._pbf.readVarint() + this._pbf.pos;
|
||
return new Go(this._pbf, e2, this.extent, this._keys, this._values);
|
||
};
|
||
var Ho = Jo;
|
||
function Wo(t2, e2, r2) {
|
||
if (3 === t2) {
|
||
var n2 = new Ho(r2, r2.readVarint() + r2.pos);
|
||
n2.length && (e2[n2.name] = n2);
|
||
}
|
||
}
|
||
Ro.VectorTile = function(t2, e2) {
|
||
this.layers = t2.readFields(Wo, {}, e2);
|
||
}, Ro.VectorTileFeature = jo, Ro.VectorTileLayer = Jo;
|
||
const Qo = Ro.VectorTileFeature.types, tl = Math.pow(2, 13);
|
||
function el(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
t2.emplaceBack(e2, r2, 2 * Math.floor(n2 * tl) + s2, i3 * tl * 2, a2 * tl * 2, Math.round(o2));
|
||
}
|
||
class rl {
|
||
constructor(t2) {
|
||
this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasPattern = false, this.layoutVertexArray = new da(), this.centroidVertexArray = new ha(), this.indexArray = new Aa(), this.programConfigurations = new Qa(t2.layers, t2.zoom), this.segments = new za(), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
|
||
}
|
||
populate(t2, e2, r2) {
|
||
this.features = [], this.hasPattern = Po("fill-extrusion", this.layers, e2);
|
||
for (const { feature: n2, id: i3, index: a2, sourceLayerIndex: s2 } of t2) {
|
||
const t3 = this.layers[0]._featureFilter.needGeometry, o2 = ss(n2, t3);
|
||
if (!this.layers[0]._featureFilter.filter(new li(this.zoom), o2, r2)) continue;
|
||
const l2 = { id: i3, sourceLayerIndex: s2, index: a2, geometry: t3 ? o2.geometry : as(n2), properties: n2.properties, type: n2.type, patterns: {} };
|
||
this.hasPattern ? this.features.push(Vo("fill-extrusion", this.layers, l2, this.zoom, e2)) : this.addFeature(l2, l2.geometry, a2, r2, {}), e2.featureIndex.insert(n2, l2.geometry, a2, s2, this.index, true);
|
||
}
|
||
}
|
||
addFeatures(t2, e2, r2) {
|
||
for (const t3 of this.features) {
|
||
const { geometry: n2 } = t3;
|
||
this.addFeature(t3, n2, t3.index, e2, r2);
|
||
}
|
||
}
|
||
update(t2, e2, r2) {
|
||
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, r2);
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.layoutVertexArray.length && 0 === this.centroidVertexArray.length;
|
||
}
|
||
uploadPending() {
|
||
return !this.uploaded || this.programConfigurations.needsUpload;
|
||
}
|
||
upload(t2) {
|
||
this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, Uo), this.centroidVertexBuffer = t2.createVertexBuffer(this.centroidVertexArray, Oo.members, true), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.centroidVertexBuffer.destroy());
|
||
}
|
||
addFeature(t2, e2, r2, n2, i3) {
|
||
const a2 = { x: 0, y: 0, vertexCount: 0 };
|
||
for (const r3 of Co(e2, 500)) {
|
||
let e3 = 0;
|
||
for (const t3 of r3) e3 += t3.length;
|
||
let n3 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
|
||
for (const t3 of r3) {
|
||
if (0 === t3.length) continue;
|
||
if (il(t3)) continue;
|
||
let e4 = 0;
|
||
for (let r4 = 0; r4 < t3.length; r4++) {
|
||
const i5 = t3[r4];
|
||
if (r4 >= 1) {
|
||
const s3 = t3[r4 - 1];
|
||
if (!nl(i5, s3)) {
|
||
n3.vertexLength + 4 > za.MAX_VERTEX_ARRAY_LENGTH && (n3 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
|
||
const t4 = i5.sub(s3)._perp()._unit(), r5 = s3.dist(i5);
|
||
e4 + r5 > 32768 && (e4 = 0), el(this.layoutVertexArray, i5.x, i5.y, t4.x, t4.y, 0, 0, e4), el(this.layoutVertexArray, i5.x, i5.y, t4.x, t4.y, 0, 1, e4), a2.x += 2 * i5.x, a2.y += 2 * i5.y, a2.vertexCount += 2, e4 += r5, el(this.layoutVertexArray, s3.x, s3.y, t4.x, t4.y, 0, 0, e4), el(this.layoutVertexArray, s3.x, s3.y, t4.x, t4.y, 0, 1, e4), a2.x += 2 * s3.x, a2.y += 2 * s3.y, a2.vertexCount += 2;
|
||
const o3 = n3.vertexLength;
|
||
this.indexArray.emplaceBack(o3, o3 + 2, o3 + 1), this.indexArray.emplaceBack(o3 + 1, o3 + 2, o3 + 3), n3.vertexLength += 4, n3.primitiveLength += 2;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (n3.vertexLength + e3 > za.MAX_VERTEX_ARRAY_LENGTH && (n3 = this.segments.prepareSegment(e3, this.layoutVertexArray, this.indexArray)), "Polygon" !== Qo[t2.type]) continue;
|
||
const i4 = [], s2 = [], o2 = n3.vertexLength;
|
||
for (const t3 of r3) if (0 !== t3.length) {
|
||
t3 !== r3[0] && s2.push(i4.length / 2);
|
||
for (let e4 = 0; e4 < t3.length; e4++) {
|
||
const r4 = t3[e4];
|
||
el(this.layoutVertexArray, r4.x, r4.y, 0, 0, 1, 1, 0), a2.x += r4.x, a2.y += r4.y, a2.vertexCount += 1, i4.push(r4.x), i4.push(r4.y);
|
||
}
|
||
}
|
||
const l2 = So(i4, s2);
|
||
for (let t3 = 0; t3 < l2.length; t3 += 3) this.indexArray.emplaceBack(o2 + l2[t3], o2 + l2[t3 + 2], o2 + l2[t3 + 1]);
|
||
n3.primitiveLength += l2.length / 3, n3.vertexLength += e3;
|
||
}
|
||
for (let t3 = 0; t3 < a2.vertexCount; t3++) this.centroidVertexArray.emplaceBack(Math.floor(a2.x / a2.vertexCount), Math.floor(a2.y / a2.vertexCount));
|
||
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, r2, i3, n2);
|
||
}
|
||
}
|
||
function nl(t2, e2) {
|
||
return t2.x === e2.x && (t2.x < 0 || t2.x > rs) || t2.y === e2.y && (t2.y < 0 || t2.y > rs);
|
||
}
|
||
function il(t2) {
|
||
return t2.every(((t3) => t3.x < 0)) || t2.every(((t3) => t3.x > rs)) || t2.every(((t3) => t3.y < 0)) || t2.every(((t3) => t3.y > rs));
|
||
}
|
||
let al;
|
||
$n("FillExtrusionBucket", rl, { omit: ["layers", "features"] });
|
||
var sl = { get paint() {
|
||
return al = al || new _i({ "fill-extrusion-opacity": new gi(X["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new xi(X["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new gi(X["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new gi(X["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new vi(X["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new xi(X["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new xi(X["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new gi(X["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) });
|
||
} };
|
||
class ol extends Si {
|
||
constructor(t2) {
|
||
super(t2, sl);
|
||
}
|
||
createBucket(t2) {
|
||
return new rl(t2);
|
||
}
|
||
queryRadius() {
|
||
return ws(this.paint.get("fill-extrusion-translate"));
|
||
}
|
||
is3D() {
|
||
return true;
|
||
}
|
||
queryIntersectsFeature(t2, e2, r2, n2, i3, s2, o2, l2) {
|
||
const u2 = _s(t2, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), s2.angle, o2), c2 = this.paint.get("fill-extrusion-height").evaluate(e2, r2), h2 = this.paint.get("fill-extrusion-base").evaluate(e2, r2), p2 = (function(t3, e3, r3, n3) {
|
||
const i4 = [];
|
||
for (const r4 of t3) {
|
||
const t4 = [r4.x, r4.y, 0, 1];
|
||
Vs(t4, t4, e3), i4.push(new a(t4[0] / t4[3], t4[1] / t4[3]));
|
||
}
|
||
return i4;
|
||
})(u2, l2), f2 = (function(t3, e3, r3, n3) {
|
||
const i4 = [], s3 = [], o3 = n3[8] * e3, l3 = n3[9] * e3, u3 = n3[10] * e3, c3 = n3[11] * e3, h3 = n3[8] * r3, p3 = n3[9] * r3, f3 = n3[10] * r3, d2 = n3[11] * r3;
|
||
for (const e4 of t3) {
|
||
const t4 = [], r4 = [];
|
||
for (const i5 of e4) {
|
||
const e5 = i5.x, s4 = i5.y, y2 = n3[0] * e5 + n3[4] * s4 + n3[12], m2 = n3[1] * e5 + n3[5] * s4 + n3[13], g2 = n3[2] * e5 + n3[6] * s4 + n3[14], x2 = n3[3] * e5 + n3[7] * s4 + n3[15], v2 = g2 + u3, b2 = x2 + c3, w2 = y2 + h3, _2 = m2 + p3, A2 = g2 + f3, S2 = x2 + d2, k2 = new a((y2 + o3) / b2, (m2 + l3) / b2);
|
||
k2.z = v2 / b2, t4.push(k2);
|
||
const I2 = new a(w2 / S2, _2 / S2);
|
||
I2.z = A2 / S2, r4.push(I2);
|
||
}
|
||
i4.push(t4), s3.push(r4);
|
||
}
|
||
return [i4, s3];
|
||
})(n2, h2, c2, l2);
|
||
return (function(t3, e3, r3) {
|
||
let n3 = 1 / 0;
|
||
hs(r3, e3) && (n3 = ul(r3, e3[0]));
|
||
for (let i4 = 0; i4 < e3.length; i4++) {
|
||
const a2 = e3[i4], s3 = t3[i4];
|
||
for (let t4 = 0; t4 < a2.length - 1; t4++) {
|
||
const e4 = a2[t4], i5 = [e4, a2[t4 + 1], s3[t4 + 1], s3[t4], e4];
|
||
us(r3, i5) && (n3 = Math.min(n3, ul(r3, i5)));
|
||
}
|
||
}
|
||
return n3 !== 1 / 0 && n3;
|
||
})(f2[0], f2[1], p2);
|
||
}
|
||
}
|
||
function ll(t2, e2) {
|
||
return t2.x * e2.x + t2.y * e2.y;
|
||
}
|
||
function ul(t2, e2) {
|
||
if (1 === t2.length) {
|
||
let r2 = 0;
|
||
const n2 = e2[r2++];
|
||
let i3;
|
||
for (; !i3 || n2.equals(i3); ) if (i3 = e2[r2++], !i3) return 1 / 0;
|
||
for (; r2 < e2.length; r2++) {
|
||
const a2 = e2[r2], s2 = t2[0], o2 = i3.sub(n2), l2 = a2.sub(n2), u2 = s2.sub(n2), c2 = ll(o2, o2), h2 = ll(o2, l2), p2 = ll(l2, l2), f2 = ll(u2, o2), d2 = ll(u2, l2), y2 = c2 * p2 - h2 * h2, m2 = (p2 * f2 - h2 * d2) / y2, g2 = (c2 * d2 - h2 * f2) / y2, x2 = n2.z * (1 - m2 - g2) + i3.z * m2 + a2.z * g2;
|
||
if (isFinite(x2)) return x2;
|
||
}
|
||
return 1 / 0;
|
||
}
|
||
{
|
||
let t3 = 1 / 0;
|
||
for (const r2 of e2) t3 = Math.min(t3, r2.z);
|
||
return t3;
|
||
}
|
||
}
|
||
const cl = Mi([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: hl } = cl, pl = Mi([{ name: "a_uv_x", components: 1, type: "Float32" }, { name: "a_split_index", components: 1, type: "Float32" }]), { members: fl } = pl, dl = Ro.VectorTileFeature.types, yl = Math.cos(Math.PI / 180 * 37.5), ml = Math.pow(2, 14) / 0.5;
|
||
class gl {
|
||
constructor(t2) {
|
||
this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasPattern = false, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach(((t3) => {
|
||
this.gradients[t3.id] = {};
|
||
})), this.layoutVertexArray = new ya(), this.layoutVertexArray2 = new ma(), this.indexArray = new Aa(), this.programConfigurations = new Qa(t2.layers, t2.zoom), this.segments = new za(), this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
|
||
}
|
||
populate(t2, e2, r2) {
|
||
this.hasPattern = Po("line", this.layers, e2);
|
||
const n2 = this.layers[0].layout.get("line-sort-key"), i3 = !n2.isConstant(), a2 = [];
|
||
for (const { feature: e3, id: s2, index: o2, sourceLayerIndex: l2 } of t2) {
|
||
const t3 = this.layers[0]._featureFilter.needGeometry, u2 = ss(e3, t3);
|
||
if (!this.layers[0]._featureFilter.filter(new li(this.zoom), u2, r2)) continue;
|
||
const c2 = i3 ? n2.evaluate(u2, {}, r2) : void 0, h2 = { id: s2, properties: e3.properties, type: e3.type, sourceLayerIndex: l2, index: o2, geometry: t3 ? u2.geometry : as(e3), patterns: {}, sortKey: c2 };
|
||
a2.push(h2);
|
||
}
|
||
i3 && a2.sort(((t3, e3) => t3.sortKey - e3.sortKey));
|
||
for (const n3 of a2) {
|
||
const { geometry: i4, index: a3, sourceLayerIndex: s2 } = n3;
|
||
if (this.hasPattern) {
|
||
const t3 = Vo("line", this.layers, n3, this.zoom, e2);
|
||
this.patternFeatures.push(t3);
|
||
} else this.addFeature(n3, i4, a3, r2, {});
|
||
e2.featureIndex.insert(t2[a3].feature, i4, a3, s2, this.index);
|
||
}
|
||
}
|
||
update(t2, e2, r2) {
|
||
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, r2);
|
||
}
|
||
addFeatures(t2, e2, r2) {
|
||
for (const t3 of this.patternFeatures) this.addFeature(t3, t3.geometry, t3.index, e2, r2);
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.layoutVertexArray.length;
|
||
}
|
||
uploadPending() {
|
||
return !this.uploaded || this.programConfigurations.needsUpload;
|
||
}
|
||
upload(t2) {
|
||
this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = t2.createVertexBuffer(this.layoutVertexArray2, fl)), this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, hl), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
|
||
}
|
||
lineFeatureClips(t2) {
|
||
if (t2.properties && Object.prototype.hasOwnProperty.call(t2.properties, "mapbox_clip_start") && Object.prototype.hasOwnProperty.call(t2.properties, "mapbox_clip_end")) return { start: +t2.properties.mapbox_clip_start, end: +t2.properties.mapbox_clip_end };
|
||
}
|
||
addFeature(t2, e2, r2, n2, i3) {
|
||
const a2 = this.layers[0].layout, s2 = a2.get("line-join").evaluate(t2, {}), o2 = a2.get("line-cap"), l2 = a2.get("line-miter-limit"), u2 = a2.get("line-round-limit");
|
||
this.lineClips = this.lineFeatureClips(t2);
|
||
for (const r3 of e2) this.addLine(r3, t2, s2, o2, l2, u2);
|
||
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, r2, i3, n2);
|
||
}
|
||
addLine(t2, e2, r2, n2, i3, a2) {
|
||
if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineClips) {
|
||
this.lineClipsArray.push(this.lineClips);
|
||
for (let e3 = 0; e3 < t2.length - 1; e3++) this.totalDistance += t2[e3].dist(t2[e3 + 1]);
|
||
this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);
|
||
}
|
||
const s2 = "Polygon" === dl[e2.type];
|
||
let o2 = t2.length;
|
||
for (; o2 >= 2 && t2[o2 - 1].equals(t2[o2 - 2]); ) o2--;
|
||
let l2 = 0;
|
||
for (; l2 < o2 - 1 && t2[l2].equals(t2[l2 + 1]); ) l2++;
|
||
if (o2 < (s2 ? 3 : 2)) return;
|
||
"bevel" === r2 && (i3 = 1.05);
|
||
const u2 = this.overscaling <= 16 ? 15 * rs / (512 * this.overscaling) : 0, c2 = this.segments.prepareSegment(10 * o2, this.layoutVertexArray, this.indexArray);
|
||
let h2, p2, f2, d2, y2;
|
||
this.e1 = this.e2 = -1, s2 && (h2 = t2[o2 - 2], y2 = t2[l2].sub(h2)._unit()._perp());
|
||
for (let e3 = l2; e3 < o2; e3++) {
|
||
if (f2 = e3 === o2 - 1 ? s2 ? t2[l2 + 1] : void 0 : t2[e3 + 1], f2 && t2[e3].equals(f2)) continue;
|
||
y2 && (d2 = y2), h2 && (p2 = h2), h2 = t2[e3], y2 = f2 ? f2.sub(h2)._unit()._perp() : d2, d2 = d2 || y2;
|
||
let m2 = d2.add(y2);
|
||
0 === m2.x && 0 === m2.y || m2._unit();
|
||
const g2 = d2.x * y2.x + d2.y * y2.y, x2 = m2.x * y2.x + m2.y * y2.y, v2 = 0 !== x2 ? 1 / x2 : 1 / 0, b2 = 2 * Math.sqrt(2 - 2 * x2), w2 = x2 < yl && p2 && f2, _2 = d2.x * y2.y - d2.y * y2.x > 0;
|
||
if (w2 && e3 > l2) {
|
||
const t3 = h2.dist(p2);
|
||
if (t3 > 2 * u2) {
|
||
const e4 = h2.sub(h2.sub(p2)._mult(u2 / t3)._round());
|
||
this.updateDistance(p2, e4), this.addCurrentVertex(e4, d2, 0, 0, c2), p2 = e4;
|
||
}
|
||
}
|
||
const A2 = p2 && f2;
|
||
let S2 = A2 ? r2 : s2 ? "butt" : n2;
|
||
if (A2 && "round" === S2 && (v2 < a2 ? S2 = "miter" : v2 <= 2 && (S2 = "fakeround")), "miter" === S2 && v2 > i3 && (S2 = "bevel"), "bevel" === S2 && (v2 > 2 && (S2 = "flipbevel"), v2 < i3 && (S2 = "miter")), p2 && this.updateDistance(p2, h2), "miter" === S2) m2._mult(v2), this.addCurrentVertex(h2, m2, 0, 0, c2);
|
||
else if ("flipbevel" === S2) {
|
||
if (v2 > 100) m2 = y2.mult(-1);
|
||
else {
|
||
const t3 = v2 * d2.add(y2).mag() / d2.sub(y2).mag();
|
||
m2._perp()._mult(t3 * (_2 ? -1 : 1));
|
||
}
|
||
this.addCurrentVertex(h2, m2, 0, 0, c2), this.addCurrentVertex(h2, m2.mult(-1), 0, 0, c2);
|
||
} else if ("bevel" === S2 || "fakeround" === S2) {
|
||
const t3 = -Math.sqrt(v2 * v2 - 1), e4 = _2 ? t3 : 0, r3 = _2 ? 0 : t3;
|
||
if (p2 && this.addCurrentVertex(h2, d2, e4, r3, c2), "fakeround" === S2) {
|
||
const t4 = Math.round(180 * b2 / Math.PI / 20);
|
||
for (let e5 = 1; e5 < t4; e5++) {
|
||
let r4 = e5 / t4;
|
||
if (0.5 !== r4) {
|
||
const t5 = r4 - 0.5;
|
||
r4 += r4 * t5 * (r4 - 1) * ((1.0904 + g2 * (g2 * (3.55645 - 1.43519 * g2) - 3.2452)) * t5 * t5 + (0.848013 + g2 * (0.215638 * g2 - 1.06021)));
|
||
}
|
||
const n3 = y2.sub(d2)._mult(r4)._add(d2)._unit()._mult(_2 ? -1 : 1);
|
||
this.addHalfVertex(h2, n3.x, n3.y, false, _2, 0, c2);
|
||
}
|
||
}
|
||
f2 && this.addCurrentVertex(h2, y2, -e4, -r3, c2);
|
||
} else if ("butt" === S2) this.addCurrentVertex(h2, m2, 0, 0, c2);
|
||
else if ("square" === S2) {
|
||
const t3 = p2 ? 1 : -1;
|
||
this.addCurrentVertex(h2, m2, t3, t3, c2);
|
||
} else "round" === S2 && (p2 && (this.addCurrentVertex(h2, d2, 0, 0, c2), this.addCurrentVertex(h2, d2, 1, 1, c2, true)), f2 && (this.addCurrentVertex(h2, y2, -1, -1, c2, true), this.addCurrentVertex(h2, y2, 0, 0, c2)));
|
||
if (w2 && e3 < o2 - 1) {
|
||
const t3 = h2.dist(f2);
|
||
if (t3 > 2 * u2) {
|
||
const e4 = h2.add(f2.sub(h2)._mult(u2 / t3)._round());
|
||
this.updateDistance(h2, e4), this.addCurrentVertex(e4, y2, 0, 0, c2), h2 = e4;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
addCurrentVertex(t2, e2, r2, n2, i3, a2 = false) {
|
||
const s2 = e2.y * n2 - e2.x, o2 = -e2.y - e2.x * n2;
|
||
this.addHalfVertex(t2, e2.x + e2.y * r2, e2.y - e2.x * r2, a2, false, r2, i3), this.addHalfVertex(t2, s2, o2, a2, true, -n2, i3), this.distance > ml / 2 && 0 === this.totalDistance && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(t2, e2, r2, n2, i3, a2));
|
||
}
|
||
addHalfVertex({ x: t2, y: e2 }, r2, n2, i3, a2, s2, o2) {
|
||
const l2 = 0.5 * (this.lineClips ? this.scaledDistance * (ml - 1) : this.scaledDistance);
|
||
this.layoutVertexArray.emplaceBack((t2 << 1) + (i3 ? 1 : 0), (e2 << 1) + (a2 ? 1 : 0), Math.round(63 * r2) + 128, Math.round(63 * n2) + 128, 1 + (0 === s2 ? 0 : s2 < 0 ? -1 : 1) | (63 & l2) << 2, l2 >> 6), this.lineClips && this.layoutVertexArray2.emplaceBack((this.scaledDistance - this.lineClips.start) / (this.lineClips.end - this.lineClips.start), this.lineClipsArray.length);
|
||
const u2 = o2.vertexLength++;
|
||
this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, u2), o2.primitiveLength++), a2 ? this.e2 = u2 : this.e1 = u2;
|
||
}
|
||
updateScaledDistance() {
|
||
this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;
|
||
}
|
||
updateDistance(t2, e2) {
|
||
this.distance += t2.dist(e2), this.updateScaledDistance();
|
||
}
|
||
}
|
||
let xl, vl;
|
||
$n("LineBucket", gl, { omit: ["layers", "patternFeatures"] });
|
||
var bl = { get paint() {
|
||
return vl = vl || new _i({ "line-opacity": new xi(X.paint_line["line-opacity"]), "line-color": new xi(X.paint_line["line-color"]), "line-translate": new gi(X.paint_line["line-translate"]), "line-translate-anchor": new gi(X.paint_line["line-translate-anchor"]), "line-width": new xi(X.paint_line["line-width"]), "line-gap-width": new xi(X.paint_line["line-gap-width"]), "line-offset": new xi(X.paint_line["line-offset"]), "line-blur": new xi(X.paint_line["line-blur"]), "line-dasharray": new bi(X.paint_line["line-dasharray"]), "line-pattern": new vi(X.paint_line["line-pattern"]), "line-gradient": new wi(X.paint_line["line-gradient"]) });
|
||
}, get layout() {
|
||
return xl = xl || new _i({ "line-cap": new gi(X.layout_line["line-cap"]), "line-join": new xi(X.layout_line["line-join"]), "line-miter-limit": new gi(X.layout_line["line-miter-limit"]), "line-round-limit": new gi(X.layout_line["line-round-limit"]), "line-sort-key": new xi(X.layout_line["line-sort-key"]) });
|
||
} };
|
||
class wl extends xi {
|
||
possiblyEvaluate(t2, e2) {
|
||
return e2 = new li(Math.floor(e2.zoom), { now: e2.now, fadeDuration: e2.fadeDuration, zoomHistory: e2.zoomHistory, transition: e2.transition }), super.possiblyEvaluate(t2, e2);
|
||
}
|
||
evaluate(t2, e2, r2, n2) {
|
||
return e2 = g({}, e2, { zoom: Math.floor(e2.zoom) }), super.evaluate(t2, e2, r2, n2);
|
||
}
|
||
}
|
||
let _l;
|
||
class Al extends Si {
|
||
constructor(t2) {
|
||
super(t2, bl), this.gradientVersion = 0, _l || (_l = new wl(bl.paint.properties["line-width"].specification), _l.useIntegerZoom = true);
|
||
}
|
||
_handleSpecialPaintPropertyUpdate(t2) {
|
||
if ("line-gradient" === t2) {
|
||
const t3 = this.gradientExpression();
|
||
this.stepInterpolant = !!(function(t4) {
|
||
return void 0 !== t4._styleExpression;
|
||
})(t3) && t3._styleExpression.expression instanceof qe, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER;
|
||
}
|
||
}
|
||
gradientExpression() {
|
||
return this._transitionablePaint._values["line-gradient"].value.expression;
|
||
}
|
||
recalculate(t2, e2) {
|
||
super.recalculate(t2, e2), this.paint._values["line-floorwidth"] = _l.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, t2);
|
||
}
|
||
createBucket(t2) {
|
||
return new gl(t2);
|
||
}
|
||
queryRadius(t2) {
|
||
const e2 = t2, r2 = Sl(bs("line-width", this, e2), bs("line-gap-width", this, e2)), n2 = bs("line-offset", this, e2);
|
||
return r2 / 2 + Math.abs(n2) + ws(this.paint.get("line-translate"));
|
||
}
|
||
queryIntersectsFeature(t2, e2, r2, n2, i3, s2, o2) {
|
||
const l2 = _s(t2, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), s2.angle, o2), u2 = o2 / 2 * Sl(this.paint.get("line-width").evaluate(e2, r2), this.paint.get("line-gap-width").evaluate(e2, r2)), c2 = this.paint.get("line-offset").evaluate(e2, r2);
|
||
return c2 && (n2 = (function(t3, e3) {
|
||
const r3 = [];
|
||
for (let n3 = 0; n3 < t3.length; n3++) {
|
||
const i4 = t3[n3], s3 = [];
|
||
for (let t4 = 0; t4 < i4.length; t4++) {
|
||
const r4 = i4[t4 - 1], n4 = i4[t4], o3 = i4[t4 + 1], l3 = 0 === t4 ? new a(0, 0) : n4.sub(r4)._unit()._perp(), u3 = t4 === i4.length - 1 ? new a(0, 0) : o3.sub(n4)._unit()._perp(), c3 = l3._add(u3)._unit(), h2 = c3.x * u3.x + c3.y * u3.y;
|
||
0 !== h2 && c3._mult(1 / h2), s3.push(c3._mult(e3)._add(n4));
|
||
}
|
||
r3.push(s3);
|
||
}
|
||
return r3;
|
||
})(n2, c2 * o2)), (function(t3, e3, r3) {
|
||
for (let n3 = 0; n3 < e3.length; n3++) {
|
||
const i4 = e3[n3];
|
||
if (t3.length >= 3) {
|
||
for (let e4 = 0; e4 < i4.length; e4++) if (xs(t3, i4[e4])) return true;
|
||
}
|
||
if (ps(t3, i4, r3)) return true;
|
||
}
|
||
return false;
|
||
})(l2, n2, u2);
|
||
}
|
||
isTileClipped() {
|
||
return true;
|
||
}
|
||
}
|
||
function Sl(t2, e2) {
|
||
return e2 > 0 ? e2 + 2 * t2 : t2;
|
||
}
|
||
const kl = Mi([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), Il = Mi([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
|
||
Mi([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
|
||
const zl = Mi([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }]);
|
||
Mi([{ type: "Int16", name: "anchorPointX" }, { type: "Int16", name: "anchorPointY" }, { type: "Int16", name: "x1" }, { type: "Int16", name: "y1" }, { type: "Int16", name: "x2" }, { type: "Int16", name: "y2" }, { type: "Uint32", name: "featureIndex" }, { type: "Uint16", name: "sourceLayerIndex" }, { type: "Uint16", name: "bucketIndex" }]);
|
||
const Ml = Mi([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), Cl = Mi([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
|
||
function Bl(t2, e2, r2) {
|
||
return t2.sections.forEach(((t3) => {
|
||
t3.text = (function(t4, e3, r3) {
|
||
const n2 = e3.layout.get("text-transform").evaluate(r3, {});
|
||
return "uppercase" === n2 ? t4 = t4.toLocaleUpperCase() : "lowercase" === n2 && (t4 = t4.toLocaleLowerCase()), oi.applyArabicShaping && (t4 = oi.applyArabicShaping(t4)), t4;
|
||
})(t3.text, e2, r2);
|
||
})), t2;
|
||
}
|
||
Mi([{ name: "triangle", components: 3, type: "Uint16" }]), Mi([{ type: "Int16", name: "anchorX" }, { type: "Int16", name: "anchorY" }, { 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" }]), Mi([{ type: "Int16", name: "anchorX" }, { type: "Int16", name: "anchorY" }, { 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", name: "textBoxScale" }, { type: "Float32", name: "collisionCircleDiameter" }, { type: "Uint16", name: "textAnchorOffsetStartIndex" }, { type: "Uint16", name: "textAnchorOffsetEndIndex" }]), Mi([{ type: "Float32", name: "offsetX" }]), Mi([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]), Mi([{ type: "Uint16", name: "textAnchor" }, { type: "Float32", components: 2, name: "textOffset" }]);
|
||
const Pl = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" };
|
||
var Vl = 24, El = $l, Fl = function(t2, e2, r2, n2, i3) {
|
||
var a2, s2, o2 = 8 * i3 - n2 - 1, l2 = (1 << o2) - 1, u2 = l2 >> 1, c2 = -7, h2 = i3 - 1, p2 = -1, f2 = t2[e2 + h2];
|
||
for (h2 += p2, a2 = f2 & (1 << -c2) - 1, f2 >>= -c2, c2 += o2; c2 > 0; a2 = 256 * a2 + t2[e2 + h2], h2 += p2, c2 -= 8) ;
|
||
for (s2 = a2 & (1 << -c2) - 1, a2 >>= -c2, c2 += n2; c2 > 0; s2 = 256 * s2 + t2[e2 + h2], h2 += p2, c2 -= 8) ;
|
||
if (0 === a2) a2 = 1 - u2;
|
||
else {
|
||
if (a2 === l2) return s2 ? NaN : 1 / 0 * (f2 ? -1 : 1);
|
||
s2 += Math.pow(2, n2), a2 -= u2;
|
||
}
|
||
return (f2 ? -1 : 1) * s2 * Math.pow(2, a2 - n2);
|
||
}, Tl = function(t2, e2, r2, n2, i3, a2) {
|
||
var s2, o2, l2, u2 = 8 * a2 - i3 - 1, c2 = (1 << u2) - 1, h2 = c2 >> 1, p2 = 23 === i3 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f2 = 0, d2 = 1, y2 = e2 < 0 || 0 === e2 && 1 / e2 < 0 ? 1 : 0;
|
||
for (e2 = Math.abs(e2), isNaN(e2) || e2 === 1 / 0 ? (o2 = isNaN(e2) ? 1 : 0, s2 = c2) : (s2 = Math.floor(Math.log(e2) / Math.LN2), e2 * (l2 = Math.pow(2, -s2)) < 1 && (s2--, l2 *= 2), (e2 += s2 + h2 >= 1 ? p2 / l2 : p2 * Math.pow(2, 1 - h2)) * l2 >= 2 && (s2++, l2 /= 2), s2 + h2 >= c2 ? (o2 = 0, s2 = c2) : s2 + h2 >= 1 ? (o2 = (e2 * l2 - 1) * Math.pow(2, i3), s2 += h2) : (o2 = e2 * Math.pow(2, h2 - 1) * Math.pow(2, i3), s2 = 0)); i3 >= 8; t2[r2 + f2] = 255 & o2, f2 += d2, o2 /= 256, i3 -= 8) ;
|
||
for (s2 = s2 << i3 | o2, u2 += i3; u2 > 0; t2[r2 + f2] = 255 & s2, f2 += d2, s2 /= 256, u2 -= 8) ;
|
||
t2[r2 + f2 - d2] |= 128 * y2;
|
||
};
|
||
function $l(t2) {
|
||
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t2) ? t2 : new Uint8Array(t2 || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
|
||
}
|
||
$l.Varint = 0, $l.Fixed64 = 1, $l.Bytes = 2, $l.Fixed32 = 5;
|
||
var Ll = 4294967296, Dl = 1 / Ll, Ol = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf8");
|
||
function Ul(t2) {
|
||
return t2.type === $l.Bytes ? t2.readVarint() + t2.pos : t2.pos + 1;
|
||
}
|
||
function Rl(t2, e2, r2) {
|
||
return r2 ? 4294967296 * e2 + (t2 >>> 0) : 4294967296 * (e2 >>> 0) + (t2 >>> 0);
|
||
}
|
||
function ql(t2, e2, r2) {
|
||
var n2 = e2 <= 16383 ? 1 : e2 <= 2097151 ? 2 : e2 <= 268435455 ? 3 : Math.floor(Math.log(e2) / (7 * Math.LN2));
|
||
r2.realloc(n2);
|
||
for (var i3 = r2.pos - 1; i3 >= t2; i3--) r2.buf[i3 + n2] = r2.buf[i3];
|
||
}
|
||
function jl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeVarint(t2[r2]);
|
||
}
|
||
function Nl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeSVarint(t2[r2]);
|
||
}
|
||
function Zl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeFloat(t2[r2]);
|
||
}
|
||
function Kl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeDouble(t2[r2]);
|
||
}
|
||
function Gl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeBoolean(t2[r2]);
|
||
}
|
||
function Jl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeFixed32(t2[r2]);
|
||
}
|
||
function Xl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeSFixed32(t2[r2]);
|
||
}
|
||
function Yl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeFixed64(t2[r2]);
|
||
}
|
||
function Hl(t2, e2) {
|
||
for (var r2 = 0; r2 < t2.length; r2++) e2.writeSFixed64(t2[r2]);
|
||
}
|
||
function Wl(t2, e2) {
|
||
return (t2[e2] | t2[e2 + 1] << 8 | t2[e2 + 2] << 16) + 16777216 * t2[e2 + 3];
|
||
}
|
||
function Ql(t2, e2, r2) {
|
||
t2[r2] = e2, t2[r2 + 1] = e2 >>> 8, t2[r2 + 2] = e2 >>> 16, t2[r2 + 3] = e2 >>> 24;
|
||
}
|
||
function tu(t2, e2) {
|
||
return (t2[e2] | t2[e2 + 1] << 8 | t2[e2 + 2] << 16) + (t2[e2 + 3] << 24);
|
||
}
|
||
$l.prototype = { destroy: function() {
|
||
this.buf = null;
|
||
}, readFields: function(t2, e2, r2) {
|
||
for (r2 = r2 || this.length; this.pos < r2; ) {
|
||
var n2 = this.readVarint(), i3 = n2 >> 3, a2 = this.pos;
|
||
this.type = 7 & n2, t2(i3, e2, this), this.pos === a2 && this.skip(n2);
|
||
}
|
||
return e2;
|
||
}, readMessage: function(t2, e2) {
|
||
return this.readFields(t2, e2, this.readVarint() + this.pos);
|
||
}, readFixed32: function() {
|
||
var t2 = Wl(this.buf, this.pos);
|
||
return this.pos += 4, t2;
|
||
}, readSFixed32: function() {
|
||
var t2 = tu(this.buf, this.pos);
|
||
return this.pos += 4, t2;
|
||
}, readFixed64: function() {
|
||
var t2 = Wl(this.buf, this.pos) + Wl(this.buf, this.pos + 4) * Ll;
|
||
return this.pos += 8, t2;
|
||
}, readSFixed64: function() {
|
||
var t2 = Wl(this.buf, this.pos) + tu(this.buf, this.pos + 4) * Ll;
|
||
return this.pos += 8, t2;
|
||
}, readFloat: function() {
|
||
var t2 = Fl(this.buf, this.pos, true, 23, 4);
|
||
return this.pos += 4, t2;
|
||
}, readDouble: function() {
|
||
var t2 = Fl(this.buf, this.pos, true, 52, 8);
|
||
return this.pos += 8, t2;
|
||
}, readVarint: function(t2) {
|
||
var e2, r2, n2 = this.buf;
|
||
return e2 = 127 & (r2 = n2[this.pos++]), r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 7, r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 14, r2 < 128 ? e2 : (e2 |= (127 & (r2 = n2[this.pos++])) << 21, r2 < 128 ? e2 : (function(t3, e3, r3) {
|
||
var n3, i3, a2 = r3.buf;
|
||
if (n3 = (112 & (i3 = a2[r3.pos++])) >> 4, i3 < 128) return Rl(t3, n3, e3);
|
||
if (n3 |= (127 & (i3 = a2[r3.pos++])) << 3, i3 < 128) return Rl(t3, n3, e3);
|
||
if (n3 |= (127 & (i3 = a2[r3.pos++])) << 10, i3 < 128) return Rl(t3, n3, e3);
|
||
if (n3 |= (127 & (i3 = a2[r3.pos++])) << 17, i3 < 128) return Rl(t3, n3, e3);
|
||
if (n3 |= (127 & (i3 = a2[r3.pos++])) << 24, i3 < 128) return Rl(t3, n3, e3);
|
||
if (n3 |= (1 & (i3 = a2[r3.pos++])) << 31, i3 < 128) return Rl(t3, n3, e3);
|
||
throw new Error("Expected varint not more than 10 bytes");
|
||
})(e2 |= (15 & (r2 = n2[this.pos])) << 28, t2, this))));
|
||
}, readVarint64: function() {
|
||
return this.readVarint(true);
|
||
}, readSVarint: function() {
|
||
var t2 = this.readVarint();
|
||
return t2 % 2 == 1 ? (t2 + 1) / -2 : t2 / 2;
|
||
}, readBoolean: function() {
|
||
return Boolean(this.readVarint());
|
||
}, readString: function() {
|
||
var t2 = this.readVarint() + this.pos, e2 = this.pos;
|
||
return this.pos = t2, t2 - e2 >= 12 && Ol ? (function(t3, e3, r2) {
|
||
return Ol.decode(t3.subarray(e3, r2));
|
||
})(this.buf, e2, t2) : (function(t3, e3, r2) {
|
||
for (var n2 = "", i3 = e3; i3 < r2; ) {
|
||
var a2, s2, o2, l2 = t3[i3], u2 = null, c2 = l2 > 239 ? 4 : l2 > 223 ? 3 : l2 > 191 ? 2 : 1;
|
||
if (i3 + c2 > r2) break;
|
||
1 === c2 ? l2 < 128 && (u2 = l2) : 2 === c2 ? 128 == (192 & (a2 = t3[i3 + 1])) && (u2 = (31 & l2) << 6 | 63 & a2) <= 127 && (u2 = null) : 3 === c2 ? (s2 = t3[i3 + 2], 128 == (192 & (a2 = t3[i3 + 1])) && 128 == (192 & s2) && ((u2 = (15 & l2) << 12 | (63 & a2) << 6 | 63 & s2) <= 2047 || u2 >= 55296 && u2 <= 57343) && (u2 = null)) : 4 === c2 && (s2 = t3[i3 + 2], o2 = t3[i3 + 3], 128 == (192 & (a2 = t3[i3 + 1])) && 128 == (192 & s2) && 128 == (192 & o2) && ((u2 = (15 & l2) << 18 | (63 & a2) << 12 | (63 & s2) << 6 | 63 & o2) <= 65535 || u2 >= 1114112) && (u2 = null)), null === u2 ? (u2 = 65533, c2 = 1) : u2 > 65535 && (u2 -= 65536, n2 += String.fromCharCode(u2 >>> 10 & 1023 | 55296), u2 = 56320 | 1023 & u2), n2 += String.fromCharCode(u2), i3 += c2;
|
||
}
|
||
return n2;
|
||
})(this.buf, e2, t2);
|
||
}, readBytes: function() {
|
||
var t2 = this.readVarint() + this.pos, e2 = this.buf.subarray(this.pos, t2);
|
||
return this.pos = t2, e2;
|
||
}, readPackedVarint: function(t2, e2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readVarint(e2));
|
||
var r2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < r2; ) t2.push(this.readVarint(e2));
|
||
return t2;
|
||
}, readPackedSVarint: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readSVarint());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readSVarint());
|
||
return t2;
|
||
}, readPackedBoolean: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readBoolean());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readBoolean());
|
||
return t2;
|
||
}, readPackedFloat: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readFloat());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readFloat());
|
||
return t2;
|
||
}, readPackedDouble: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readDouble());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readDouble());
|
||
return t2;
|
||
}, readPackedFixed32: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readFixed32());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readFixed32());
|
||
return t2;
|
||
}, readPackedSFixed32: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readSFixed32());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readSFixed32());
|
||
return t2;
|
||
}, readPackedFixed64: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readFixed64());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readFixed64());
|
||
return t2;
|
||
}, readPackedSFixed64: function(t2) {
|
||
if (this.type !== $l.Bytes) return t2.push(this.readSFixed64());
|
||
var e2 = Ul(this);
|
||
for (t2 = t2 || []; this.pos < e2; ) t2.push(this.readSFixed64());
|
||
return t2;
|
||
}, skip: function(t2) {
|
||
var e2 = 7 & t2;
|
||
if (e2 === $l.Varint) for (; this.buf[this.pos++] > 127; ) ;
|
||
else if (e2 === $l.Bytes) this.pos = this.readVarint() + this.pos;
|
||
else if (e2 === $l.Fixed32) this.pos += 4;
|
||
else {
|
||
if (e2 !== $l.Fixed64) throw new Error("Unimplemented type: " + e2);
|
||
this.pos += 8;
|
||
}
|
||
}, writeTag: function(t2, e2) {
|
||
this.writeVarint(t2 << 3 | e2);
|
||
}, realloc: function(t2) {
|
||
for (var e2 = this.length || 16; e2 < this.pos + t2; ) e2 *= 2;
|
||
if (e2 !== this.length) {
|
||
var r2 = new Uint8Array(e2);
|
||
r2.set(this.buf), this.buf = r2, this.length = e2;
|
||
}
|
||
}, finish: function() {
|
||
return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
|
||
}, writeFixed32: function(t2) {
|
||
this.realloc(4), Ql(this.buf, t2, this.pos), this.pos += 4;
|
||
}, writeSFixed32: function(t2) {
|
||
this.realloc(4), Ql(this.buf, t2, this.pos), this.pos += 4;
|
||
}, writeFixed64: function(t2) {
|
||
this.realloc(8), Ql(this.buf, -1 & t2, this.pos), Ql(this.buf, Math.floor(t2 * Dl), this.pos + 4), this.pos += 8;
|
||
}, writeSFixed64: function(t2) {
|
||
this.realloc(8), Ql(this.buf, -1 & t2, this.pos), Ql(this.buf, Math.floor(t2 * Dl), this.pos + 4), this.pos += 8;
|
||
}, writeVarint: function(t2) {
|
||
(t2 = +t2 || 0) > 268435455 || t2 < 0 ? (function(t3, e2) {
|
||
var r2, n2;
|
||
if (t3 >= 0 ? (r2 = t3 % 4294967296 | 0, n2 = t3 / 4294967296 | 0) : (n2 = ~(-t3 / 4294967296), 4294967295 ^ (r2 = ~(-t3 % 4294967296)) ? r2 = r2 + 1 | 0 : (r2 = 0, n2 = n2 + 1 | 0)), t3 >= 18446744073709552e3 || t3 < -18446744073709552e3) throw new Error("Given varint doesn't fit into 10 bytes");
|
||
e2.realloc(10), (function(t4, e3, r3) {
|
||
r3.buf[r3.pos++] = 127 & t4 | 128, t4 >>>= 7, r3.buf[r3.pos++] = 127 & t4 | 128, t4 >>>= 7, r3.buf[r3.pos++] = 127 & t4 | 128, t4 >>>= 7, r3.buf[r3.pos++] = 127 & t4 | 128, r3.buf[r3.pos] = 127 & (t4 >>>= 7);
|
||
})(r2, 0, e2), (function(t4, e3) {
|
||
var r3 = (7 & t4) << 4;
|
||
e3.buf[e3.pos++] |= r3 | ((t4 >>>= 3) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4)))));
|
||
})(n2, e2);
|
||
})(t2, this) : (this.realloc(4), this.buf[this.pos++] = 127 & t2 | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = 127 & (t2 >>>= 7) | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = 127 & (t2 >>>= 7) | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = t2 >>> 7 & 127))));
|
||
}, writeSVarint: function(t2) {
|
||
this.writeVarint(t2 < 0 ? 2 * -t2 - 1 : 2 * t2);
|
||
}, writeBoolean: function(t2) {
|
||
this.writeVarint(Boolean(t2));
|
||
}, writeString: function(t2) {
|
||
t2 = String(t2), this.realloc(4 * t2.length), this.pos++;
|
||
var e2 = this.pos;
|
||
this.pos = (function(t3, e3, r3) {
|
||
for (var n2, i3, a2 = 0; a2 < e3.length; a2++) {
|
||
if ((n2 = e3.charCodeAt(a2)) > 55295 && n2 < 57344) {
|
||
if (!i3) {
|
||
n2 > 56319 || a2 + 1 === e3.length ? (t3[r3++] = 239, t3[r3++] = 191, t3[r3++] = 189) : i3 = n2;
|
||
continue;
|
||
}
|
||
if (n2 < 56320) {
|
||
t3[r3++] = 239, t3[r3++] = 191, t3[r3++] = 189, i3 = n2;
|
||
continue;
|
||
}
|
||
n2 = i3 - 55296 << 10 | n2 - 56320 | 65536, i3 = null;
|
||
} else i3 && (t3[r3++] = 239, t3[r3++] = 191, t3[r3++] = 189, i3 = null);
|
||
n2 < 128 ? t3[r3++] = n2 : (n2 < 2048 ? t3[r3++] = n2 >> 6 | 192 : (n2 < 65536 ? t3[r3++] = n2 >> 12 | 224 : (t3[r3++] = n2 >> 18 | 240, t3[r3++] = n2 >> 12 & 63 | 128), t3[r3++] = n2 >> 6 & 63 | 128), t3[r3++] = 63 & n2 | 128);
|
||
}
|
||
return r3;
|
||
})(this.buf, t2, this.pos);
|
||
var r2 = this.pos - e2;
|
||
r2 >= 128 && ql(e2, r2, this), this.pos = e2 - 1, this.writeVarint(r2), this.pos += r2;
|
||
}, writeFloat: function(t2) {
|
||
this.realloc(4), Tl(this.buf, t2, this.pos, true, 23, 4), this.pos += 4;
|
||
}, writeDouble: function(t2) {
|
||
this.realloc(8), Tl(this.buf, t2, this.pos, true, 52, 8), this.pos += 8;
|
||
}, writeBytes: function(t2) {
|
||
var e2 = t2.length;
|
||
this.writeVarint(e2), this.realloc(e2);
|
||
for (var r2 = 0; r2 < e2; r2++) this.buf[this.pos++] = t2[r2];
|
||
}, writeRawMessage: function(t2, e2) {
|
||
this.pos++;
|
||
var r2 = this.pos;
|
||
t2(e2, this);
|
||
var n2 = this.pos - r2;
|
||
n2 >= 128 && ql(r2, n2, this), this.pos = r2 - 1, this.writeVarint(n2), this.pos += n2;
|
||
}, writeMessage: function(t2, e2, r2) {
|
||
this.writeTag(t2, $l.Bytes), this.writeRawMessage(e2, r2);
|
||
}, writePackedVarint: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, jl, e2);
|
||
}, writePackedSVarint: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Nl, e2);
|
||
}, writePackedBoolean: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Gl, e2);
|
||
}, writePackedFloat: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Zl, e2);
|
||
}, writePackedDouble: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Kl, e2);
|
||
}, writePackedFixed32: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Jl, e2);
|
||
}, writePackedSFixed32: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Xl, e2);
|
||
}, writePackedFixed64: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Yl, e2);
|
||
}, writePackedSFixed64: function(t2, e2) {
|
||
e2.length && this.writeMessage(t2, Hl, e2);
|
||
}, writeBytesField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Bytes), this.writeBytes(e2);
|
||
}, writeFixed32Field: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed32), this.writeFixed32(e2);
|
||
}, writeSFixed32Field: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed32), this.writeSFixed32(e2);
|
||
}, writeFixed64Field: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed64), this.writeFixed64(e2);
|
||
}, writeSFixed64Field: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed64), this.writeSFixed64(e2);
|
||
}, writeVarintField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Varint), this.writeVarint(e2);
|
||
}, writeSVarintField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Varint), this.writeSVarint(e2);
|
||
}, writeStringField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Bytes), this.writeString(e2);
|
||
}, writeFloatField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed32), this.writeFloat(e2);
|
||
}, writeDoubleField: function(t2, e2) {
|
||
this.writeTag(t2, $l.Fixed64), this.writeDouble(e2);
|
||
}, writeBooleanField: function(t2, e2) {
|
||
this.writeVarintField(t2, Boolean(e2));
|
||
} };
|
||
var eu = r(El);
|
||
const ru = 3;
|
||
function nu(t2, e2, r2) {
|
||
1 === t2 && r2.readMessage(iu, e2);
|
||
}
|
||
function iu(t2, e2, r2) {
|
||
if (3 === t2) {
|
||
const { id: t3, bitmap: n2, width: i3, height: a2, left: s2, top: o2, advance: l2 } = r2.readMessage(au, {});
|
||
e2.push({ id: t3, bitmap: new Rs({ width: i3 + 2 * ru, height: a2 + 2 * ru }, n2), metrics: { width: i3, height: a2, left: s2, top: o2, advance: l2 } });
|
||
}
|
||
}
|
||
function au(t2, e2, r2) {
|
||
1 === t2 ? e2.id = r2.readVarint() : 2 === t2 ? e2.bitmap = r2.readBytes() : 3 === t2 ? e2.width = r2.readVarint() : 4 === t2 ? e2.height = r2.readVarint() : 5 === t2 ? e2.left = r2.readSVarint() : 6 === t2 ? e2.top = r2.readSVarint() : 7 === t2 && (e2.advance = r2.readVarint());
|
||
}
|
||
const su = ru;
|
||
function ou(t2) {
|
||
let e2 = 0, r2 = 0;
|
||
for (const n3 of t2) e2 += n3.w * n3.h, r2 = Math.max(r2, n3.w);
|
||
t2.sort(((t3, e3) => e3.h - t3.h));
|
||
const n2 = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e2 / 0.95)), r2), h: 1 / 0 }];
|
||
let i3 = 0, a2 = 0;
|
||
for (const e3 of t2) for (let t3 = n2.length - 1; t3 >= 0; t3--) {
|
||
const r3 = n2[t3];
|
||
if (!(e3.w > r3.w || e3.h > r3.h)) {
|
||
if (e3.x = r3.x, e3.y = r3.y, a2 = Math.max(a2, e3.y + e3.h), i3 = Math.max(i3, e3.x + e3.w), e3.w === r3.w && e3.h === r3.h) {
|
||
const e4 = n2.pop();
|
||
t3 < n2.length && (n2[t3] = e4);
|
||
} else e3.h === r3.h ? (r3.x += e3.w, r3.w -= e3.w) : e3.w === r3.w ? (r3.y += e3.h, r3.h -= e3.h) : (n2.push({ x: r3.x + e3.w, y: r3.y, w: r3.w - e3.w, h: e3.h }), r3.y += e3.h, r3.h -= e3.h);
|
||
break;
|
||
}
|
||
}
|
||
return { w: i3, h: a2, fill: e2 / (i3 * a2) || 0 };
|
||
}
|
||
const lu = 1;
|
||
class uu {
|
||
constructor(t2, { pixelRatio: e2, version: r2, stretchX: n2, stretchY: i3, content: a2 }) {
|
||
this.paddedRect = t2, this.pixelRatio = e2, this.stretchX = n2, this.stretchY = i3, this.content = a2, this.version = r2;
|
||
}
|
||
get tl() {
|
||
return [this.paddedRect.x + lu, this.paddedRect.y + lu];
|
||
}
|
||
get br() {
|
||
return [this.paddedRect.x + this.paddedRect.w - lu, this.paddedRect.y + this.paddedRect.h - lu];
|
||
}
|
||
get tlbr() {
|
||
return this.tl.concat(this.br);
|
||
}
|
||
get displaySize() {
|
||
return [(this.paddedRect.w - 2 * lu) / this.pixelRatio, (this.paddedRect.h - 2 * lu) / this.pixelRatio];
|
||
}
|
||
}
|
||
class cu {
|
||
constructor(t2, e2) {
|
||
const r2 = {}, n2 = {};
|
||
this.haveRenderCallbacks = [];
|
||
const i3 = [];
|
||
this.addImages(t2, r2, i3), this.addImages(e2, n2, i3);
|
||
const { w: a2, h: s2 } = ou(i3), o2 = new qs({ width: a2 || 1, height: s2 || 1 });
|
||
for (const e3 in t2) {
|
||
const n3 = t2[e3], i4 = r2[e3].paddedRect;
|
||
qs.copy(n3.data, o2, { x: 0, y: 0 }, { x: i4.x + lu, y: i4.y + lu }, n3.data);
|
||
}
|
||
for (const t3 in e2) {
|
||
const r3 = e2[t3], i4 = n2[t3].paddedRect, a3 = i4.x + lu, s3 = i4.y + lu, l2 = r3.data.width, u2 = r3.data.height;
|
||
qs.copy(r3.data, o2, { x: 0, y: 0 }, { x: a3, y: s3 }, r3.data), qs.copy(r3.data, o2, { x: 0, y: u2 - 1 }, { x: a3, y: s3 - 1 }, { width: l2, height: 1 }), qs.copy(r3.data, o2, { x: 0, y: 0 }, { x: a3, y: s3 + u2 }, { width: l2, height: 1 }), qs.copy(r3.data, o2, { x: l2 - 1, y: 0 }, { x: a3 - 1, y: s3 }, { width: 1, height: u2 }), qs.copy(r3.data, o2, { x: 0, y: 0 }, { x: a3 + l2, y: s3 }, { width: 1, height: u2 });
|
||
}
|
||
this.image = o2, this.iconPositions = r2, this.patternPositions = n2;
|
||
}
|
||
addImages(t2, e2, r2) {
|
||
for (const n2 in t2) {
|
||
const i3 = t2[n2], a2 = { x: 0, y: 0, w: i3.data.width + 2 * lu, h: i3.data.height + 2 * lu };
|
||
r2.push(a2), e2[n2] = new uu(a2, i3), i3.hasRenderCallback && this.haveRenderCallbacks.push(n2);
|
||
}
|
||
}
|
||
patchUpdatedImages(t2, e2) {
|
||
t2.dispatchRenderCallbacks(this.haveRenderCallbacks);
|
||
for (const r2 in t2.updatedImages) this.patchUpdatedImage(this.iconPositions[r2], t2.getImage(r2), e2), this.patchUpdatedImage(this.patternPositions[r2], t2.getImage(r2), e2);
|
||
}
|
||
patchUpdatedImage(t2, e2, r2) {
|
||
if (!t2 || !e2) return;
|
||
if (t2.version === e2.version) return;
|
||
t2.version = e2.version;
|
||
const [n2, i3] = t2.tl;
|
||
r2.update(e2.data, void 0, { x: n2, y: i3 });
|
||
}
|
||
}
|
||
var hu;
|
||
$n("ImagePosition", uu), $n("ImageAtlas", cu), t.ai = void 0, (hu = t.ai || (t.ai = {}))[hu.none = 0] = "none", hu[hu.horizontal = 1] = "horizontal", hu[hu.vertical = 2] = "vertical", hu[hu.horizontalOnly = 3] = "horizontalOnly";
|
||
const pu = -17;
|
||
class fu {
|
||
constructor() {
|
||
this.scale = 1, this.fontStack = "", this.imageName = null;
|
||
}
|
||
static forText(t2, e2) {
|
||
const r2 = new fu();
|
||
return r2.scale = t2 || 1, r2.fontStack = e2, r2;
|
||
}
|
||
static forImage(t2) {
|
||
const e2 = new fu();
|
||
return e2.imageName = t2, e2;
|
||
}
|
||
}
|
||
class du {
|
||
constructor() {
|
||
this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;
|
||
}
|
||
static fromFeature(t2, e2) {
|
||
const r2 = new du();
|
||
for (let n2 = 0; n2 < t2.sections.length; n2++) {
|
||
const i3 = t2.sections[n2];
|
||
i3.image ? r2.addImageSection(i3) : r2.addTextSection(i3, e2);
|
||
}
|
||
return r2;
|
||
}
|
||
length() {
|
||
return this.text.length;
|
||
}
|
||
getSection(t2) {
|
||
return this.sections[this.sectionIndex[t2]];
|
||
}
|
||
getSectionIndex(t2) {
|
||
return this.sectionIndex[t2];
|
||
}
|
||
getCharCode(t2) {
|
||
return this.text.charCodeAt(t2);
|
||
}
|
||
verticalizePunctuation() {
|
||
this.text = (function(t2) {
|
||
let e2 = "";
|
||
for (let r2 = 0; r2 < t2.length; r2++) {
|
||
const n2 = t2.charCodeAt(r2 + 1) || null, i3 = t2.charCodeAt(r2 - 1) || null;
|
||
e2 += n2 && Kn(n2) && !Pl[t2[r2 + 1]] || i3 && Kn(i3) && !Pl[t2[r2 - 1]] || !Pl[t2[r2]] ? t2[r2] : Pl[t2[r2]];
|
||
}
|
||
return e2;
|
||
})(this.text);
|
||
}
|
||
trim() {
|
||
let t2 = 0;
|
||
for (let e3 = 0; e3 < this.text.length && mu[this.text.charCodeAt(e3)]; e3++) t2++;
|
||
let e2 = this.text.length;
|
||
for (let r2 = this.text.length - 1; r2 >= 0 && r2 >= t2 && mu[this.text.charCodeAt(r2)]; r2--) e2--;
|
||
this.text = this.text.substring(t2, e2), this.sectionIndex = this.sectionIndex.slice(t2, e2);
|
||
}
|
||
substring(t2, e2) {
|
||
const r2 = new du();
|
||
return r2.text = this.text.substring(t2, e2), r2.sectionIndex = this.sectionIndex.slice(t2, e2), r2.sections = this.sections, r2;
|
||
}
|
||
toString() {
|
||
return this.text;
|
||
}
|
||
getMaxScale() {
|
||
return this.sectionIndex.reduce(((t2, e2) => Math.max(t2, this.sections[e2].scale)), 0);
|
||
}
|
||
addTextSection(t2, e2) {
|
||
this.text += t2.text, this.sections.push(fu.forText(t2.scale, t2.fontStack || e2));
|
||
const r2 = this.sections.length - 1;
|
||
for (let e3 = 0; e3 < t2.text.length; ++e3) this.sectionIndex.push(r2);
|
||
}
|
||
addImageSection(t2) {
|
||
const e2 = t2.image ? t2.image.name : "";
|
||
if (0 === e2.length) return void A("Can't add FormattedSection with an empty image.");
|
||
const r2 = this.getNextImageSectionCharCode();
|
||
r2 ? (this.text += String.fromCharCode(r2), this.sections.push(fu.forImage(e2)), this.sectionIndex.push(this.sections.length - 1)) : A("Reached maximum number of images 6401");
|
||
}
|
||
getNextImageSectionCharCode() {
|
||
return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
|
||
}
|
||
}
|
||
function yu(e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2, m2) {
|
||
const g2 = du.fromFeature(e2, a2);
|
||
let x2;
|
||
p2 === t.ai.vertical && g2.verticalizePunctuation();
|
||
const { processBidirectionalText: v2, processStyledBidirectionalText: b2 } = oi;
|
||
if (v2 && 1 === g2.sections.length) {
|
||
x2 = [];
|
||
const t2 = v2(g2.toString(), Au(g2, c2, s2, r2, i3, d2, y2));
|
||
for (const e3 of t2) {
|
||
const t3 = new du();
|
||
t3.text = e3, t3.sections = g2.sections;
|
||
for (let r3 = 0; r3 < e3.length; r3++) t3.sectionIndex.push(0);
|
||
x2.push(t3);
|
||
}
|
||
} else if (b2) {
|
||
x2 = [];
|
||
const t2 = b2(g2.text, g2.sectionIndex, Au(g2, c2, s2, r2, i3, d2, y2));
|
||
for (const e3 of t2) {
|
||
const t3 = new du();
|
||
t3.text = e3[0], t3.sectionIndex = e3[1], t3.sections = g2.sections, x2.push(t3);
|
||
}
|
||
} else x2 = (function(t2, e3) {
|
||
const r3 = [], n3 = t2.text;
|
||
let i4 = 0;
|
||
for (const n4 of e3) r3.push(t2.substring(i4, n4)), i4 = n4;
|
||
return i4 < n3.length && r3.push(t2.substring(i4, n3.length)), r3;
|
||
})(g2, Au(g2, c2, s2, r2, i3, d2, y2));
|
||
const w2 = [], _2 = { positionedLines: w2, text: g2.toString(), top: h2[1], bottom: h2[1], left: h2[0], right: h2[0], writingMode: p2, iconsInText: false, verticalizable: false };
|
||
return (function(e3, r3, n3, i4, a3, s3, o3, l3, u3, c3, h3, p3) {
|
||
let f3 = 0, d3 = pu, y3 = 0, m3 = 0;
|
||
const g3 = "right" === l3 ? 1 : "left" === l3 ? 0 : 0.5;
|
||
let x3 = 0;
|
||
for (const o4 of a3) {
|
||
o4.trim();
|
||
const a4 = o4.getMaxScale(), l4 = (a4 - 1) * Vl, b4 = { positionedGlyphs: [], lineOffset: 0 };
|
||
e3.positionedLines[x3] = b4;
|
||
const w4 = b4.positionedGlyphs;
|
||
let _4 = 0;
|
||
if (!o4.length()) {
|
||
d3 += s3, ++x3;
|
||
continue;
|
||
}
|
||
for (let s4 = 0; s4 < o4.length(); s4++) {
|
||
const y4 = o4.getSection(s4), m4 = o4.getSectionIndex(s4), g4 = o4.getCharCode(s4);
|
||
let x4 = 0, b5 = null, A3 = null, S2 = null, k2 = Vl;
|
||
const I2 = !(u3 === t.ai.horizontal || !h3 && !Zn(g4) || h3 && (mu[g4] || (v3 = g4, Rn.Arabic(v3) || Rn["Arabic Supplement"](v3) || Rn["Arabic Extended-A"](v3) || Rn["Arabic Presentation Forms-A"](v3) || Rn["Arabic Presentation Forms-B"](v3))));
|
||
if (y4.imageName) {
|
||
const t2 = i4[y4.imageName];
|
||
if (!t2) continue;
|
||
S2 = y4.imageName, e3.iconsInText = e3.iconsInText || true, A3 = t2.paddedRect;
|
||
const r4 = t2.displaySize;
|
||
y4.scale = y4.scale * Vl / p3, b5 = { width: r4[0], height: r4[1], left: lu, top: -su, advance: I2 ? r4[1] : r4[0] }, x4 = l4 + (Vl - r4[1] * y4.scale), k2 = b5.advance;
|
||
const n4 = I2 ? r4[0] * y4.scale - Vl * a4 : r4[1] * y4.scale - Vl * a4;
|
||
n4 > 0 && n4 > _4 && (_4 = n4);
|
||
} else {
|
||
const t2 = n3[y4.fontStack], e4 = t2 && t2[g4];
|
||
if (e4 && e4.rect) A3 = e4.rect, b5 = e4.metrics;
|
||
else {
|
||
const t3 = r3[y4.fontStack], e5 = t3 && t3[g4];
|
||
if (!e5) continue;
|
||
b5 = e5.metrics;
|
||
}
|
||
x4 = (a4 - y4.scale) * Vl;
|
||
}
|
||
I2 ? (e3.verticalizable = true, w4.push({ glyph: g4, imageName: S2, x: f3, y: d3 + x4, vertical: I2, scale: y4.scale, fontStack: y4.fontStack, sectionIndex: m4, metrics: b5, rect: A3 }), f3 += k2 * y4.scale + c3) : (w4.push({ glyph: g4, imageName: S2, x: f3, y: d3 + x4, vertical: I2, scale: y4.scale, fontStack: y4.fontStack, sectionIndex: m4, metrics: b5, rect: A3 }), f3 += b5.advance * y4.scale + c3);
|
||
}
|
||
0 !== w4.length && (y3 = Math.max(f3 - c3, y3), ku(w4, 0, w4.length - 1, g3, _4)), f3 = 0;
|
||
const A2 = s3 * a4 + _4;
|
||
b4.lineOffset = Math.max(_4, l4), d3 += A2, m3 = Math.max(A2, m3), ++x3;
|
||
}
|
||
var v3;
|
||
const b3 = d3 - pu, { horizontalAlign: w3, verticalAlign: _3 } = Su(o3);
|
||
(function(t2, e4, r4, n4, i5, a4, s4, o4, l4) {
|
||
const u4 = (e4 - r4) * i5;
|
||
let c4 = 0;
|
||
c4 = a4 !== s4 ? -o4 * n4 - pu : (-n4 * l4 + 0.5) * s4;
|
||
for (const e5 of t2) for (const t3 of e5.positionedGlyphs) t3.x += u4, t3.y += c4;
|
||
})(e3.positionedLines, g3, w3, _3, y3, m3, s3, b3, a3.length), e3.top += -_3 * b3, e3.bottom = e3.top + b3, e3.left += -w3 * y3, e3.right = e3.left + y3;
|
||
})(_2, r2, n2, i3, x2, o2, l2, u2, p2, c2, f2, m2), !(function(t2) {
|
||
for (const e3 of t2) if (0 !== e3.positionedGlyphs.length) return false;
|
||
return true;
|
||
})(w2) && _2;
|
||
}
|
||
const mu = { 9: true, 10: true, 11: true, 12: true, 13: true, 32: true }, gu = { 10: true, 32: true, 38: true, 40: true, 41: true, 43: true, 45: true, 47: true, 173: true, 183: true, 8203: true, 8208: true, 8211: true, 8231: true };
|
||
function xu(t2, e2, r2, n2, i3, a2) {
|
||
if (e2.imageName) {
|
||
const t3 = n2[e2.imageName];
|
||
return t3 ? t3.displaySize[0] * e2.scale * Vl / a2 + i3 : 0;
|
||
}
|
||
{
|
||
const n3 = r2[e2.fontStack], a3 = n3 && n3[t2];
|
||
return a3 ? a3.metrics.advance * e2.scale + i3 : 0;
|
||
}
|
||
}
|
||
function vu(t2, e2, r2, n2) {
|
||
const i3 = Math.pow(t2 - e2, 2);
|
||
return n2 ? t2 < e2 ? i3 / 2 : 2 * i3 : i3 + Math.abs(r2) * r2;
|
||
}
|
||
function bu(t2, e2, r2) {
|
||
let n2 = 0;
|
||
return 10 === t2 && (n2 -= 1e4), r2 && (n2 += 150), 40 !== t2 && 65288 !== t2 || (n2 += 50), 41 !== e2 && 65289 !== e2 || (n2 += 50), n2;
|
||
}
|
||
function wu(t2, e2, r2, n2, i3, a2) {
|
||
let s2 = null, o2 = vu(e2, r2, i3, a2);
|
||
for (const t3 of n2) {
|
||
const n3 = vu(e2 - t3.x, r2, i3, a2) + t3.badness;
|
||
n3 <= o2 && (s2 = t3, o2 = n3);
|
||
}
|
||
return { index: t2, x: e2, priorBreak: s2, badness: o2 };
|
||
}
|
||
function _u(t2) {
|
||
return t2 ? _u(t2.priorBreak).concat(t2.index) : [];
|
||
}
|
||
function Au(t2, e2, r2, n2, i3, a2, s2) {
|
||
if ("point" !== a2) return [];
|
||
if (!t2) return [];
|
||
const o2 = [], l2 = (function(t3, e3, r3, n3, i4, a3) {
|
||
let s3 = 0;
|
||
for (let r4 = 0; r4 < t3.length(); r4++) {
|
||
const o3 = t3.getSection(r4);
|
||
s3 += xu(t3.getCharCode(r4), o3, n3, i4, e3, a3);
|
||
}
|
||
return s3 / Math.max(1, Math.ceil(s3 / r3));
|
||
})(t2, e2, r2, n2, i3, s2), u2 = t2.text.indexOf("") >= 0;
|
||
let c2 = 0;
|
||
for (let r3 = 0; r3 < t2.length(); r3++) {
|
||
const a3 = t2.getSection(r3), p2 = t2.getCharCode(r3);
|
||
if (mu[p2] || (c2 += xu(p2, a3, n2, i3, e2, s2)), r3 < t2.length() - 1) {
|
||
const e3 = !((h2 = p2) < 11904 || !(Rn["Bopomofo Extended"](h2) || Rn.Bopomofo(h2) || Rn["CJK Compatibility Forms"](h2) || Rn["CJK Compatibility Ideographs"](h2) || Rn["CJK Compatibility"](h2) || Rn["CJK Radicals Supplement"](h2) || Rn["CJK Strokes"](h2) || Rn["CJK Symbols and Punctuation"](h2) || Rn["CJK Unified Ideographs Extension A"](h2) || Rn["CJK Unified Ideographs"](h2) || Rn["Enclosed CJK Letters and Months"](h2) || Rn["Halfwidth and Fullwidth Forms"](h2) || Rn.Hiragana(h2) || Rn["Ideographic Description Characters"](h2) || Rn["Kangxi Radicals"](h2) || Rn["Katakana Phonetic Extensions"](h2) || Rn.Katakana(h2) || Rn["Vertical Forms"](h2) || Rn["Yi Radicals"](h2) || Rn["Yi Syllables"](h2)));
|
||
(gu[p2] || e3 || a3.imageName) && o2.push(wu(r3 + 1, c2, l2, o2, bu(p2, t2.getCharCode(r3 + 1), e3 && u2), false));
|
||
}
|
||
}
|
||
var h2;
|
||
return _u(wu(t2.length(), c2, l2, o2, 0, true));
|
||
}
|
||
function Su(t2) {
|
||
let e2 = 0.5, r2 = 0.5;
|
||
switch (t2) {
|
||
case "right":
|
||
case "top-right":
|
||
case "bottom-right":
|
||
e2 = 1;
|
||
break;
|
||
case "left":
|
||
case "top-left":
|
||
case "bottom-left":
|
||
e2 = 0;
|
||
}
|
||
switch (t2) {
|
||
case "bottom":
|
||
case "bottom-right":
|
||
case "bottom-left":
|
||
r2 = 1;
|
||
break;
|
||
case "top":
|
||
case "top-right":
|
||
case "top-left":
|
||
r2 = 0;
|
||
}
|
||
return { horizontalAlign: e2, verticalAlign: r2 };
|
||
}
|
||
function ku(t2, e2, r2, n2, i3) {
|
||
if (!n2 && !i3) return;
|
||
const a2 = t2[r2], s2 = (t2[r2].x + a2.metrics.advance * a2.scale) * n2;
|
||
for (let n3 = e2; n3 <= r2; n3++) t2[n3].x -= s2, t2[n3].y += i3;
|
||
}
|
||
function Iu(t2, e2, r2) {
|
||
const { horizontalAlign: n2, verticalAlign: i3 } = Su(r2), a2 = e2[0] - t2.displaySize[0] * n2, s2 = e2[1] - t2.displaySize[1] * i3;
|
||
return { image: t2, top: s2, bottom: s2 + t2.displaySize[1], left: a2, right: a2 + t2.displaySize[0] };
|
||
}
|
||
function zu(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = t2.image;
|
||
let o2;
|
||
if (s2.content) {
|
||
const t3 = s2.content, e3 = s2.pixelRatio || 1;
|
||
o2 = [t3[0] / e3, t3[1] / e3, s2.displaySize[0] - t3[2] / e3, s2.displaySize[1] - t3[3] / e3];
|
||
}
|
||
const l2 = e2.left * a2, u2 = e2.right * a2;
|
||
let c2, h2, p2, f2;
|
||
"width" === r2 || "both" === r2 ? (f2 = i3[0] + l2 - n2[3], h2 = i3[0] + u2 + n2[1]) : (f2 = i3[0] + (l2 + u2 - s2.displaySize[0]) / 2, h2 = f2 + s2.displaySize[0]);
|
||
const d2 = e2.top * a2, y2 = e2.bottom * a2;
|
||
return "height" === r2 || "both" === r2 ? (c2 = i3[1] + d2 - n2[0], p2 = i3[1] + y2 + n2[2]) : (c2 = i3[1] + (d2 + y2 - s2.displaySize[1]) / 2, p2 = c2 + s2.displaySize[1]), { image: s2, top: c2, right: h2, bottom: p2, left: f2, collisionPadding: o2 };
|
||
}
|
||
const Mu = 255, Cu = 128, Bu = Mu * Cu;
|
||
function Pu(t2, e2) {
|
||
const { expression: r2 } = e2;
|
||
if ("constant" === r2.kind) return { kind: "constant", layoutSize: r2.evaluate(new li(t2 + 1)) };
|
||
if ("source" === r2.kind) return { kind: "source" };
|
||
{
|
||
const { zoomStops: e3, interpolationType: n2 } = r2;
|
||
let i3 = 0;
|
||
for (; i3 < e3.length && e3[i3] <= t2; ) i3++;
|
||
i3 = Math.max(0, i3 - 1);
|
||
let a2 = i3;
|
||
for (; a2 < e3.length && e3[a2] < t2 + 1; ) a2++;
|
||
a2 = Math.min(e3.length - 1, a2);
|
||
const s2 = e3[i3], o2 = e3[a2];
|
||
return "composite" === r2.kind ? { kind: "composite", minZoom: s2, maxZoom: o2, interpolationType: n2 } : { kind: "camera", minZoom: s2, maxZoom: o2, minSize: r2.evaluate(new li(s2)), maxSize: r2.evaluate(new li(o2)), interpolationType: n2 };
|
||
}
|
||
}
|
||
function Vu(t2, e2, r2) {
|
||
let n2 = "never";
|
||
const i3 = t2.get(e2);
|
||
return i3 ? n2 = i3 : t2.get(r2) && (n2 = "always"), n2;
|
||
}
|
||
const Eu = Ro.VectorTileFeature.types, Fu = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
|
||
function Tu(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2) {
|
||
const f2 = o2 ? Math.min(Bu, Math.round(o2[0])) : 0, d2 = o2 ? Math.min(Bu, Math.round(o2[1])) : 0;
|
||
t2.emplaceBack(e2, r2, Math.round(32 * n2), Math.round(32 * i3), a2, s2, (f2 << 1) + (l2 ? 1 : 0), d2, 16 * u2, 16 * c2, 256 * h2, 256 * p2);
|
||
}
|
||
function $u(t2, e2, r2) {
|
||
t2.emplaceBack(e2.x, e2.y, r2), t2.emplaceBack(e2.x, e2.y, r2), t2.emplaceBack(e2.x, e2.y, r2), t2.emplaceBack(e2.x, e2.y, r2);
|
||
}
|
||
function Lu(t2) {
|
||
for (const e2 of t2.sections) if (Xn(e2.text)) return true;
|
||
return false;
|
||
}
|
||
class Du {
|
||
constructor(t2) {
|
||
this.layoutVertexArray = new xa(), this.indexArray = new Aa(), this.programConfigurations = t2, this.segments = new za(), this.dynamicLayoutVertexArray = new va(), this.opacityVertexArray = new ba(), this.hasVisibleVertices = false, this.placedSymbolArray = new ra();
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length;
|
||
}
|
||
upload(t2, e2, r2, n2) {
|
||
this.isEmpty() || (r2 && (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, kl.members), this.indexBuffer = t2.createIndexBuffer(this.indexArray, e2), this.dynamicLayoutVertexBuffer = t2.createVertexBuffer(this.dynamicLayoutVertexArray, Il.members, true), this.opacityVertexBuffer = t2.createVertexBuffer(this.opacityVertexArray, Fu, true), this.opacityVertexBuffer.itemSize = 1), (r2 || n2) && this.programConfigurations.upload(t2));
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());
|
||
}
|
||
}
|
||
$n("SymbolBuffers", Du);
|
||
class Ou {
|
||
constructor(t2, e2, r2) {
|
||
this.layoutVertexArray = new t2(), this.layoutAttributes = e2, this.indexArray = new r2(), this.segments = new za(), this.collisionVertexArray = new _a();
|
||
}
|
||
upload(t2) {
|
||
this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t2.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t2.createVertexBuffer(this.collisionVertexArray, zl.members, true);
|
||
}
|
||
destroy() {
|
||
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
|
||
}
|
||
}
|
||
$n("CollisionBuffers", Ou);
|
||
class Uu {
|
||
constructor(e2) {
|
||
this.collisionBoxArray = e2.collisionBoxArray, this.zoom = e2.zoom, this.overscaling = e2.overscaling, this.layers = e2.layers, this.layerIds = this.layers.map(((t2) => t2.id)), this.index = e2.index, this.pixelRatio = e2.pixelRatio, this.sourceLayerIndex = e2.sourceLayerIndex, this.hasPattern = false, this.hasRTLText = false, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = Ms([]), this.placementViewportMatrix = Ms([]);
|
||
const r2 = this.layers[0]._unevaluatedLayout._values;
|
||
this.textSizeData = Pu(this.zoom, r2["text-size"]), this.iconSizeData = Pu(this.zoom, r2["icon-size"]);
|
||
const n2 = this.layers[0].layout, i3 = n2.get("symbol-sort-key"), a2 = n2.get("symbol-z-order");
|
||
this.canOverlap = "never" !== Vu(n2, "text-overlap", "text-allow-overlap") || "never" !== Vu(n2, "icon-overlap", "icon-allow-overlap") || n2.get("text-ignore-placement") || n2.get("icon-ignore-placement"), this.sortFeaturesByKey = "viewport-y" !== a2 && !i3.isConstant(), this.sortFeaturesByY = ("viewport-y" === a2 || "auto" === a2 && !this.sortFeaturesByKey) && this.canOverlap, "point" === n2.get("symbol-placement") && (this.writingModes = n2.get("text-writing-mode").map(((e3) => t.ai[e3]))), this.stateDependentLayerIds = this.layers.filter(((t2) => t2.isStateDependent())).map(((t2) => t2.id)), this.sourceID = e2.sourceID;
|
||
}
|
||
createArrays() {
|
||
this.text = new Du(new Qa(this.layers, this.zoom, ((t2) => /^text/.test(t2)))), this.icon = new Du(new Qa(this.layers, this.zoom, ((t2) => /^icon/.test(t2)))), this.glyphOffsetArray = new aa(), this.lineVertexArray = new sa(), this.symbolInstances = new ia(), this.textAnchorOffsets = new la();
|
||
}
|
||
calculateGlyphDependencies(t2, e2, r2, n2, i3) {
|
||
for (let a2 = 0; a2 < t2.length; a2++) if (e2[t2.charCodeAt(a2)] = true, (r2 || n2) && i3) {
|
||
const r3 = Pl[t2.charAt(a2)];
|
||
r3 && (e2[r3.charCodeAt(0)] = true);
|
||
}
|
||
}
|
||
populate(e2, r2, n2) {
|
||
const i3 = this.layers[0], a2 = i3.layout, s2 = a2.get("text-font"), o2 = a2.get("text-field"), l2 = a2.get("icon-image"), u2 = ("constant" !== o2.value.kind || o2.value.value instanceof Qt && !o2.value.value.isEmpty() || o2.value.value.toString().length > 0) && ("constant" !== s2.value.kind || s2.value.value.length > 0), c2 = "constant" !== l2.value.kind || !!l2.value.value || Object.keys(l2.parameters).length > 0, h2 = a2.get("symbol-sort-key");
|
||
if (this.features = [], !u2 && !c2) return;
|
||
const p2 = r2.iconDependencies, f2 = r2.glyphDependencies, d2 = r2.availableImages, y2 = new li(this.zoom);
|
||
for (const { feature: r3, id: o3, index: l3, sourceLayerIndex: m2 } of e2) {
|
||
const e3 = i3._featureFilter.needGeometry, g2 = ss(r3, e3);
|
||
if (!i3._featureFilter.filter(y2, g2, n2)) continue;
|
||
let x2, v2;
|
||
if (e3 || (g2.geometry = as(r3)), u2) {
|
||
const t2 = i3.getValueAndResolveTokens("text-field", g2, n2, d2), e4 = Qt.factory(t2);
|
||
Lu(e4) && (this.hasRTLText = true), (!this.hasRTLText || "unavailable" === ai() || this.hasRTLText && oi.isParsed()) && (x2 = Bl(e4, i3, g2));
|
||
}
|
||
if (c2) {
|
||
const t2 = i3.getValueAndResolveTokens("icon-image", g2, n2, d2);
|
||
v2 = t2 instanceof ne ? t2 : ne.fromString(t2);
|
||
}
|
||
if (!x2 && !v2) continue;
|
||
const b2 = this.sortFeaturesByKey ? h2.evaluate(g2, {}, n2) : void 0;
|
||
if (this.features.push({ id: o3, text: x2, icon: v2, index: l3, sourceLayerIndex: m2, geometry: g2.geometry, properties: r3.properties, type: Eu[r3.type], sortKey: b2 }), v2 && (p2[v2.name] = true), x2) {
|
||
const e4 = s2.evaluate(g2, {}, n2).join(","), r4 = "viewport" !== a2.get("text-rotation-alignment") && "point" !== a2.get("symbol-placement");
|
||
this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(t.ai.vertical) >= 0;
|
||
for (const t2 of x2.sections) if (t2.image) p2[t2.image.name] = true;
|
||
else {
|
||
const n3 = qn(x2.toString()), i4 = t2.fontStack || e4, a3 = f2[i4] = f2[i4] || {};
|
||
this.calculateGlyphDependencies(t2.text, a3, r4, this.allowVerticalPlacement, n3);
|
||
}
|
||
}
|
||
}
|
||
"line" === a2.get("symbol-placement") && (this.features = (function(t2) {
|
||
const e3 = {}, r3 = {}, n3 = [];
|
||
let i4 = 0;
|
||
function a3(e4) {
|
||
n3.push(t2[e4]), i4++;
|
||
}
|
||
function s3(t3, e4, i5) {
|
||
const a4 = r3[t3];
|
||
return delete r3[t3], r3[e4] = a4, n3[a4].geometry[0].pop(), n3[a4].geometry[0] = n3[a4].geometry[0].concat(i5[0]), a4;
|
||
}
|
||
function o3(t3, r4, i5) {
|
||
const a4 = e3[r4];
|
||
return delete e3[r4], e3[t3] = a4, n3[a4].geometry[0].shift(), n3[a4].geometry[0] = i5[0].concat(n3[a4].geometry[0]), a4;
|
||
}
|
||
function l3(t3, e4, r4) {
|
||
const n4 = r4 ? e4[0][e4[0].length - 1] : e4[0][0];
|
||
return `${t3}:${n4.x}:${n4.y}`;
|
||
}
|
||
for (let u3 = 0; u3 < t2.length; u3++) {
|
||
const c3 = t2[u3], h3 = c3.geometry, p3 = c3.text ? c3.text.toString() : null;
|
||
if (!p3) {
|
||
a3(u3);
|
||
continue;
|
||
}
|
||
const f3 = l3(p3, h3), d3 = l3(p3, h3, true);
|
||
if (f3 in r3 && d3 in e3 && r3[f3] !== e3[d3]) {
|
||
const t3 = o3(f3, d3, h3), i5 = s3(f3, d3, n3[t3].geometry);
|
||
delete e3[f3], delete r3[d3], r3[l3(p3, n3[i5].geometry, true)] = i5, n3[t3].geometry = null;
|
||
} else f3 in r3 ? s3(f3, d3, h3) : d3 in e3 ? o3(f3, d3, h3) : (a3(u3), e3[f3] = i4 - 1, r3[d3] = i4 - 1);
|
||
}
|
||
return n3.filter(((t3) => t3.geometry));
|
||
})(this.features)), this.sortFeaturesByKey && this.features.sort(((t2, e3) => t2.sortKey - e3.sortKey));
|
||
}
|
||
update(t2, e2, r2) {
|
||
this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(t2, e2, this.layers, r2), this.icon.programConfigurations.updatePaintArrays(t2, e2, this.layers, r2));
|
||
}
|
||
isEmpty() {
|
||
return 0 === this.symbolInstances.length && !this.hasRTLText;
|
||
}
|
||
uploadPending() {
|
||
return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;
|
||
}
|
||
upload(t2) {
|
||
!this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(t2), this.iconCollisionBox.upload(t2)), this.text.upload(t2, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(t2, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = true;
|
||
}
|
||
destroyDebugData() {
|
||
this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();
|
||
}
|
||
destroy() {
|
||
this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();
|
||
}
|
||
addToLineVertexArray(t2, e2) {
|
||
const r2 = this.lineVertexArray.length;
|
||
if (void 0 !== t2.segment) {
|
||
let r3 = t2.dist(e2[t2.segment + 1]), n2 = t2.dist(e2[t2.segment]);
|
||
const i3 = {};
|
||
for (let n3 = t2.segment + 1; n3 < e2.length; n3++) i3[n3] = { x: e2[n3].x, y: e2[n3].y, tileUnitDistanceFromAnchor: r3 }, n3 < e2.length - 1 && (r3 += e2[n3 + 1].dist(e2[n3]));
|
||
for (let r4 = t2.segment || 0; r4 >= 0; r4--) i3[r4] = { x: e2[r4].x, y: e2[r4].y, tileUnitDistanceFromAnchor: n2 }, r4 > 0 && (n2 += e2[r4 - 1].dist(e2[r4]));
|
||
for (let t3 = 0; t3 < e2.length; t3++) {
|
||
const e3 = i3[t3];
|
||
this.lineVertexArray.emplaceBack(e3.x, e3.y, e3.tileUnitDistanceFromAnchor);
|
||
}
|
||
}
|
||
return { lineStartIndex: r2, lineLength: this.lineVertexArray.length - r2 };
|
||
}
|
||
addSymbols(e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2, p2) {
|
||
const f2 = e2.indexArray, d2 = e2.layoutVertexArray, y2 = e2.segments.prepareSegment(4 * r2.length, d2, f2, this.canOverlap ? s2.sortKey : void 0), m2 = this.glyphOffsetArray.length, g2 = y2.vertexLength, x2 = this.allowVerticalPlacement && o2 === t.ai.vertical ? Math.PI / 2 : 0, v2 = s2.text && s2.text.sections;
|
||
for (let t2 = 0; t2 < r2.length; t2++) {
|
||
const { tl: i4, tr: a3, bl: o3, br: u3, tex: c3, pixelOffsetTL: h3, pixelOffsetBR: m3, minFontScaleX: g3, minFontScaleY: b2, glyphOffset: w2, isSDF: _2, sectionIndex: A2 } = r2[t2], S2 = y2.vertexLength, k2 = w2[1];
|
||
Tu(d2, l2.x, l2.y, i4.x, k2 + i4.y, c3.x, c3.y, n2, _2, h3.x, h3.y, g3, b2), Tu(d2, l2.x, l2.y, a3.x, k2 + a3.y, c3.x + c3.w, c3.y, n2, _2, m3.x, h3.y, g3, b2), Tu(d2, l2.x, l2.y, o3.x, k2 + o3.y, c3.x, c3.y + c3.h, n2, _2, h3.x, m3.y, g3, b2), Tu(d2, l2.x, l2.y, u3.x, k2 + u3.y, c3.x + c3.w, c3.y + c3.h, n2, _2, m3.x, m3.y, g3, b2), $u(e2.dynamicLayoutVertexArray, l2, x2), f2.emplaceBack(S2, S2 + 1, S2 + 2), f2.emplaceBack(S2 + 1, S2 + 2, S2 + 3), y2.vertexLength += 4, y2.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(w2[0]), t2 !== r2.length - 1 && A2 === r2[t2 + 1].sectionIndex || e2.programConfigurations.populatePaintArrays(d2.length, s2, s2.index, {}, p2, v2 && v2[A2]);
|
||
}
|
||
e2.placedSymbolArray.emplaceBack(l2.x, l2.y, m2, this.glyphOffsetArray.length - m2, g2, u2, c2, l2.segment, n2 ? n2[0] : 0, n2 ? n2[1] : 0, i3[0], i3[1], o2, 0, false, 0, h2);
|
||
}
|
||
_addCollisionDebugVertex(t2, e2, r2, n2, i3, a2) {
|
||
return e2.emplaceBack(0, 0), t2.emplaceBack(r2.x, r2.y, n2, i3, Math.round(a2.x), Math.round(a2.y));
|
||
}
|
||
addCollisionDebugVertices(t2, e2, r2, n2, i3, s2, o2) {
|
||
const l2 = i3.segments.prepareSegment(4, i3.layoutVertexArray, i3.indexArray), u2 = l2.vertexLength, c2 = i3.layoutVertexArray, h2 = i3.collisionVertexArray, p2 = o2.anchorX, f2 = o2.anchorY;
|
||
this._addCollisionDebugVertex(c2, h2, s2, p2, f2, new a(t2, e2)), this._addCollisionDebugVertex(c2, h2, s2, p2, f2, new a(r2, e2)), this._addCollisionDebugVertex(c2, h2, s2, p2, f2, new a(r2, n2)), this._addCollisionDebugVertex(c2, h2, s2, p2, f2, new a(t2, n2)), l2.vertexLength += 4;
|
||
const d2 = i3.indexArray;
|
||
d2.emplaceBack(u2, u2 + 1), d2.emplaceBack(u2 + 1, u2 + 2), d2.emplaceBack(u2 + 2, u2 + 3), d2.emplaceBack(u2 + 3, u2), l2.primitiveLength += 4;
|
||
}
|
||
addDebugCollisionBoxes(t2, e2, r2, n2) {
|
||
for (let i3 = t2; i3 < e2; i3++) {
|
||
const t3 = this.collisionBoxArray.get(i3);
|
||
this.addCollisionDebugVertices(t3.x1, t3.y1, t3.x2, t3.y2, n2 ? this.textCollisionBox : this.iconCollisionBox, t3.anchorPoint, r2);
|
||
}
|
||
}
|
||
generateCollisionDebugBuffers() {
|
||
this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new Ou(wa, Ml.members, Sa), this.iconCollisionBox = new Ou(wa, Ml.members, Sa);
|
||
for (let t2 = 0; t2 < this.symbolInstances.length; t2++) {
|
||
const e2 = this.symbolInstances.get(t2);
|
||
this.addDebugCollisionBoxes(e2.textBoxStartIndex, e2.textBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.verticalTextBoxStartIndex, e2.verticalTextBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.iconBoxStartIndex, e2.iconBoxEndIndex, e2, false), this.addDebugCollisionBoxes(e2.verticalIconBoxStartIndex, e2.verticalIconBoxEndIndex, e2, false);
|
||
}
|
||
}
|
||
_deserializeCollisionBoxesForSymbol(t2, e2, r2, n2, i3, a2, s2, o2, l2) {
|
||
const u2 = {};
|
||
for (let n3 = e2; n3 < r2; n3++) {
|
||
const e3 = t2.get(n3);
|
||
u2.textBox = { x1: e3.x1, y1: e3.y1, x2: e3.x2, y2: e3.y2, anchorPointX: e3.anchorPointX, anchorPointY: e3.anchorPointY }, u2.textFeatureIndex = e3.featureIndex;
|
||
break;
|
||
}
|
||
for (let e3 = n2; e3 < i3; e3++) {
|
||
const r3 = t2.get(e3);
|
||
u2.verticalTextBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.verticalTextFeatureIndex = r3.featureIndex;
|
||
break;
|
||
}
|
||
for (let e3 = a2; e3 < s2; e3++) {
|
||
const r3 = t2.get(e3);
|
||
u2.iconBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.iconFeatureIndex = r3.featureIndex;
|
||
break;
|
||
}
|
||
for (let e3 = o2; e3 < l2; e3++) {
|
||
const r3 = t2.get(e3);
|
||
u2.verticalIconBox = { x1: r3.x1, y1: r3.y1, x2: r3.x2, y2: r3.y2, anchorPointX: r3.anchorPointX, anchorPointY: r3.anchorPointY }, u2.verticalIconFeatureIndex = r3.featureIndex;
|
||
break;
|
||
}
|
||
return u2;
|
||
}
|
||
deserializeCollisionBoxes(t2) {
|
||
this.collisionArrays = [];
|
||
for (let e2 = 0; e2 < this.symbolInstances.length; e2++) {
|
||
const r2 = this.symbolInstances.get(e2);
|
||
this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t2, r2.textBoxStartIndex, r2.textBoxEndIndex, r2.verticalTextBoxStartIndex, r2.verticalTextBoxEndIndex, r2.iconBoxStartIndex, r2.iconBoxEndIndex, r2.verticalIconBoxStartIndex, r2.verticalIconBoxEndIndex));
|
||
}
|
||
}
|
||
hasTextData() {
|
||
return this.text.segments.get().length > 0;
|
||
}
|
||
hasIconData() {
|
||
return this.icon.segments.get().length > 0;
|
||
}
|
||
hasDebugData() {
|
||
return this.textCollisionBox && this.iconCollisionBox;
|
||
}
|
||
hasTextCollisionBoxData() {
|
||
return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0;
|
||
}
|
||
hasIconCollisionBoxData() {
|
||
return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0;
|
||
}
|
||
addIndicesForPlacedSymbol(t2, e2) {
|
||
const r2 = t2.placedSymbolArray.get(e2), n2 = r2.vertexStartIndex + 4 * r2.numGlyphs;
|
||
for (let e3 = r2.vertexStartIndex; e3 < n2; e3 += 4) t2.indexArray.emplaceBack(e3, e3 + 1, e3 + 2), t2.indexArray.emplaceBack(e3 + 1, e3 + 2, e3 + 3);
|
||
}
|
||
getSortedSymbolIndexes(t2) {
|
||
if (this.sortedAngle === t2 && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes;
|
||
const e2 = Math.sin(t2), r2 = Math.cos(t2), n2 = [], i3 = [], a2 = [];
|
||
for (let t3 = 0; t3 < this.symbolInstances.length; ++t3) {
|
||
a2.push(t3);
|
||
const s2 = this.symbolInstances.get(t3);
|
||
n2.push(0 | Math.round(e2 * s2.anchorX + r2 * s2.anchorY)), i3.push(s2.featureIndex);
|
||
}
|
||
return a2.sort(((t3, e3) => n2[t3] - n2[e3] || i3[e3] - i3[t3])), a2;
|
||
}
|
||
addToSortKeyRanges(t2, e2) {
|
||
const r2 = this.sortKeyRanges[this.sortKeyRanges.length - 1];
|
||
r2 && r2.sortKey === e2 ? r2.symbolInstanceEnd = t2 + 1 : this.sortKeyRanges.push({ sortKey: e2, symbolInstanceStart: t2, symbolInstanceEnd: t2 + 1 });
|
||
}
|
||
sortFeatures(t2) {
|
||
if (this.sortFeaturesByY && this.sortedAngle !== t2 && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
|
||
this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t2), this.sortedAngle = t2, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];
|
||
for (const t3 of this.symbolInstanceIndexes) {
|
||
const e2 = this.symbolInstances.get(t3);
|
||
this.featureSortOrder.push(e2.featureIndex), [e2.rightJustifiedTextSymbolIndex, e2.centerJustifiedTextSymbolIndex, e2.leftJustifiedTextSymbolIndex].forEach(((t4, e3, r2) => {
|
||
t4 >= 0 && r2.indexOf(t4) === e3 && this.addIndicesForPlacedSymbol(this.text, t4);
|
||
})), e2.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, e2.verticalPlacedTextSymbolIndex), e2.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.placedIconSymbolIndex), e2.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.verticalPlacedIconSymbolIndex);
|
||
}
|
||
this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);
|
||
}
|
||
}
|
||
}
|
||
let Ru, qu;
|
||
$n("SymbolBucket", Uu, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), Uu.MAX_GLYPHS = 65535, Uu.addDynamicAttributes = $u;
|
||
var ju = { get paint() {
|
||
return qu = qu || new _i({ "icon-opacity": new xi(X.paint_symbol["icon-opacity"]), "icon-color": new xi(X.paint_symbol["icon-color"]), "icon-halo-color": new xi(X.paint_symbol["icon-halo-color"]), "icon-halo-width": new xi(X.paint_symbol["icon-halo-width"]), "icon-halo-blur": new xi(X.paint_symbol["icon-halo-blur"]), "icon-translate": new gi(X.paint_symbol["icon-translate"]), "icon-translate-anchor": new gi(X.paint_symbol["icon-translate-anchor"]), "text-opacity": new xi(X.paint_symbol["text-opacity"]), "text-color": new xi(X.paint_symbol["text-color"], { runtimeType: yt, getOverride: (t2) => t2.textColor, hasOverride: (t2) => !!t2.textColor }), "text-halo-color": new xi(X.paint_symbol["text-halo-color"]), "text-halo-width": new xi(X.paint_symbol["text-halo-width"]), "text-halo-blur": new xi(X.paint_symbol["text-halo-blur"]), "text-translate": new gi(X.paint_symbol["text-translate"]), "text-translate-anchor": new gi(X.paint_symbol["text-translate-anchor"]) });
|
||
}, get layout() {
|
||
return Ru = Ru || new _i({ "symbol-placement": new gi(X.layout_symbol["symbol-placement"]), "symbol-spacing": new gi(X.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new gi(X.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new xi(X.layout_symbol["symbol-sort-key"]), "symbol-z-order": new gi(X.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new gi(X.layout_symbol["icon-allow-overlap"]), "icon-overlap": new gi(X.layout_symbol["icon-overlap"]), "icon-ignore-placement": new gi(X.layout_symbol["icon-ignore-placement"]), "icon-optional": new gi(X.layout_symbol["icon-optional"]), "icon-rotation-alignment": new gi(X.layout_symbol["icon-rotation-alignment"]), "icon-size": new xi(X.layout_symbol["icon-size"]), "icon-text-fit": new gi(X.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new gi(X.layout_symbol["icon-text-fit-padding"]), "icon-image": new xi(X.layout_symbol["icon-image"]), "icon-rotate": new xi(X.layout_symbol["icon-rotate"]), "icon-padding": new xi(X.layout_symbol["icon-padding"]), "icon-keep-upright": new gi(X.layout_symbol["icon-keep-upright"]), "icon-offset": new xi(X.layout_symbol["icon-offset"]), "icon-anchor": new xi(X.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new gi(X.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new gi(X.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new gi(X.layout_symbol["text-rotation-alignment"]), "text-field": new xi(X.layout_symbol["text-field"]), "text-font": new xi(X.layout_symbol["text-font"]), "text-size": new xi(X.layout_symbol["text-size"]), "text-max-width": new xi(X.layout_symbol["text-max-width"]), "text-line-height": new gi(X.layout_symbol["text-line-height"]), "text-letter-spacing": new xi(X.layout_symbol["text-letter-spacing"]), "text-justify": new xi(X.layout_symbol["text-justify"]), "text-radial-offset": new xi(X.layout_symbol["text-radial-offset"]), "text-variable-anchor": new gi(X.layout_symbol["text-variable-anchor"]), "text-variable-anchor-offset": new xi(X.layout_symbol["text-variable-anchor-offset"]), "text-anchor": new xi(X.layout_symbol["text-anchor"]), "text-max-angle": new gi(X.layout_symbol["text-max-angle"]), "text-writing-mode": new gi(X.layout_symbol["text-writing-mode"]), "text-rotate": new xi(X.layout_symbol["text-rotate"]), "text-padding": new gi(X.layout_symbol["text-padding"]), "text-keep-upright": new gi(X.layout_symbol["text-keep-upright"]), "text-transform": new xi(X.layout_symbol["text-transform"]), "text-offset": new xi(X.layout_symbol["text-offset"]), "text-allow-overlap": new gi(X.layout_symbol["text-allow-overlap"]), "text-overlap": new gi(X.layout_symbol["text-overlap"]), "text-ignore-placement": new gi(X.layout_symbol["text-ignore-placement"]), "text-optional": new gi(X.layout_symbol["text-optional"]) });
|
||
} };
|
||
class Nu {
|
||
constructor(t2) {
|
||
if (void 0 === t2.property.overrides) throw new Error("overrides must be provided to instantiate FormatSectionOverride class");
|
||
this.type = t2.property.overrides ? t2.property.overrides.runtimeType : ht, this.defaultValue = t2;
|
||
}
|
||
evaluate(t2) {
|
||
if (t2.formattedSection) {
|
||
const e2 = this.defaultValue.property.overrides;
|
||
if (e2 && e2.hasOverride(t2.formattedSection)) return e2.getOverride(t2.formattedSection);
|
||
}
|
||
return t2.feature && t2.featureState ? this.defaultValue.evaluate(t2.feature, t2.featureState) : this.defaultValue.property.specification.default;
|
||
}
|
||
eachChild(t2) {
|
||
this.defaultValue.isConstant() || t2(this.defaultValue.value._styleExpression.expression);
|
||
}
|
||
outputDefined() {
|
||
return false;
|
||
}
|
||
serialize() {
|
||
return null;
|
||
}
|
||
}
|
||
$n("FormatSectionOverride", Nu, { omit: ["defaultValue"] });
|
||
class Zu extends Si {
|
||
constructor(t2) {
|
||
super(t2, ju);
|
||
}
|
||
recalculate(t2, e2) {
|
||
if (super.recalculate(t2, e2), "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"] = "map" === this.layout.get("text-rotation-alignment") ? "map" : "viewport"), "auto" === this.layout.get("icon-pitch-alignment") && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")), "point" === this.layout.get("symbol-placement")) {
|
||
const t3 = this.layout.get("text-writing-mode");
|
||
if (t3) {
|
||
const e3 = [];
|
||
for (const r2 of t3) e3.indexOf(r2) < 0 && e3.push(r2);
|
||
this.layout._values["text-writing-mode"] = e3;
|
||
} else this.layout._values["text-writing-mode"] = ["horizontal"];
|
||
}
|
||
this._setPaintOverrides();
|
||
}
|
||
getValueAndResolveTokens(t2, e2, r2, n2) {
|
||
const i3 = this.layout.get(t2).evaluate(e2, {}, r2, n2), a2 = this._unevaluatedLayout._values[t2];
|
||
return a2.isDataDriven() || Tr(a2.value) || !i3 ? i3 : (function(t3, e3) {
|
||
return e3.replace(/{([^{}]+)}/g, ((e4, r3) => t3 && r3 in t3 ? String(t3[r3]) : ""));
|
||
})(e2.properties, i3);
|
||
}
|
||
createBucket(t2) {
|
||
return new Uu(t2);
|
||
}
|
||
queryRadius() {
|
||
return 0;
|
||
}
|
||
queryIntersectsFeature() {
|
||
throw new Error("Should take a different path in FeatureIndex");
|
||
}
|
||
_setPaintOverrides() {
|
||
for (const t2 of ju.paint.overridableProperties) {
|
||
if (!Zu.hasPaintOverride(this.layout, t2)) continue;
|
||
const e2 = this.paint.get(t2), r2 = new Nu(e2), n2 = new Fr(r2, e2.property.specification);
|
||
let i3 = null;
|
||
i3 = "constant" === e2.value.kind || "source" === e2.value.kind ? new Lr("source", n2) : new Dr("composite", n2, e2.value.zoomStops), this.paint._values[t2] = new yi(e2.property, i3, e2.parameters);
|
||
}
|
||
}
|
||
_handleOverridablePaintPropertyUpdate(t2, e2, r2) {
|
||
return !(!this.layout || e2.isDataDriven() || r2.isDataDriven()) && Zu.hasPaintOverride(this.layout, t2);
|
||
}
|
||
static hasPaintOverride(t2, e2) {
|
||
const r2 = t2.get("text-field"), n2 = ju.paint.properties[e2];
|
||
let i3 = false;
|
||
const a2 = (t3) => {
|
||
for (const e3 of t3) if (n2.overrides && n2.overrides.hasOverride(e3)) return void (i3 = true);
|
||
};
|
||
if ("constant" === r2.value.kind && r2.value.value instanceof Qt) a2(r2.value.value.sections);
|
||
else if ("source" === r2.value.kind) {
|
||
const t3 = (e4) => {
|
||
i3 || (e4 instanceof le && se(e4.value) === vt ? a2(e4.value.sections) : e4 instanceof pr ? a2(e4.sections) : e4.eachChild(t3));
|
||
}, e3 = r2.value;
|
||
e3._styleExpression && t3(e3._styleExpression.expression);
|
||
}
|
||
return i3;
|
||
}
|
||
}
|
||
let Ku;
|
||
var Gu = { get paint() {
|
||
return Ku = Ku || new _i({ "background-color": new gi(X.paint_background["background-color"]), "background-pattern": new bi(X.paint_background["background-pattern"]), "background-opacity": new gi(X.paint_background["background-opacity"]) });
|
||
} };
|
||
class Ju extends Si {
|
||
constructor(t2) {
|
||
super(t2, Gu);
|
||
}
|
||
}
|
||
let Xu;
|
||
var Yu = { get paint() {
|
||
return Xu = Xu || new _i({ "raster-opacity": new gi(X.paint_raster["raster-opacity"]), "raster-hue-rotate": new gi(X.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new gi(X.paint_raster["raster-brightness-min"]), "raster-brightness-max": new gi(X.paint_raster["raster-brightness-max"]), "raster-saturation": new gi(X.paint_raster["raster-saturation"]), "raster-contrast": new gi(X.paint_raster["raster-contrast"]), "raster-resampling": new gi(X.paint_raster["raster-resampling"]), "raster-fade-duration": new gi(X.paint_raster["raster-fade-duration"]) });
|
||
} };
|
||
class Hu extends Si {
|
||
constructor(t2) {
|
||
super(t2, Yu);
|
||
}
|
||
}
|
||
class Wu extends Si {
|
||
constructor(t2) {
|
||
super(t2, {}), this.onAdd = (t3) => {
|
||
this.implementation.onAdd && this.implementation.onAdd(t3, t3.painter.context.gl);
|
||
}, this.onRemove = (t3) => {
|
||
this.implementation.onRemove && this.implementation.onRemove(t3, t3.painter.context.gl);
|
||
}, this.implementation = t2;
|
||
}
|
||
is3D() {
|
||
return "3d" === this.implementation.renderingMode;
|
||
}
|
||
hasOffscreenPass() {
|
||
return void 0 !== this.implementation.prerender;
|
||
}
|
||
recalculate() {
|
||
}
|
||
updateTransitions() {
|
||
}
|
||
hasTransition() {
|
||
return false;
|
||
}
|
||
serialize() {
|
||
throw new Error("Custom layers cannot be serialized");
|
||
}
|
||
}
|
||
class Qu {
|
||
constructor(t2) {
|
||
this._callback = t2, this._triggered = false, "undefined" != typeof MessageChannel && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {
|
||
this._triggered = false, this._callback();
|
||
});
|
||
}
|
||
trigger() {
|
||
this._triggered || (this._triggered = true, this._channel ? this._channel.port1.postMessage(true) : setTimeout((() => {
|
||
this._triggered = false, this._callback();
|
||
}), 0));
|
||
}
|
||
remove() {
|
||
delete this._channel, this._callback = () => {
|
||
};
|
||
}
|
||
}
|
||
const tc = 63710088e-1;
|
||
class ec {
|
||
constructor(t2, e2) {
|
||
if (isNaN(t2) || isNaN(e2)) throw new Error(`Invalid LngLat object: (${t2}, ${e2})`);
|
||
if (this.lng = +t2, this.lat = +e2, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
|
||
}
|
||
wrap() {
|
||
return new ec(m(this.lng, -180, 180), this.lat);
|
||
}
|
||
toArray() {
|
||
return [this.lng, this.lat];
|
||
}
|
||
toString() {
|
||
return `LngLat(${this.lng}, ${this.lat})`;
|
||
}
|
||
distanceTo(t2) {
|
||
const e2 = Math.PI / 180, r2 = this.lat * e2, n2 = t2.lat * e2, i3 = Math.sin(r2) * Math.sin(n2) + Math.cos(r2) * Math.cos(n2) * Math.cos((t2.lng - this.lng) * e2);
|
||
return tc * Math.acos(Math.min(i3, 1));
|
||
}
|
||
static convert(t2) {
|
||
if (t2 instanceof ec) return t2;
|
||
if (Array.isArray(t2) && (2 === t2.length || 3 === t2.length)) return new ec(Number(t2[0]), Number(t2[1]));
|
||
if (!Array.isArray(t2) && "object" == typeof t2 && null !== t2) return new ec(Number("lng" in t2 ? t2.lng : t2.lon), Number(t2.lat));
|
||
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]");
|
||
}
|
||
}
|
||
const rc = 2 * Math.PI * tc;
|
||
function nc(t2) {
|
||
return rc * Math.cos(t2 * Math.PI / 180);
|
||
}
|
||
function ic(t2) {
|
||
return (180 + t2) / 360;
|
||
}
|
||
function ac(t2) {
|
||
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t2 * Math.PI / 360))) / 360;
|
||
}
|
||
function sc(t2, e2) {
|
||
return t2 / nc(e2);
|
||
}
|
||
function oc(t2) {
|
||
return 360 * t2 - 180;
|
||
}
|
||
function lc(t2) {
|
||
return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t2) * Math.PI / 180)) - 90;
|
||
}
|
||
class uc {
|
||
constructor(t2, e2, r2 = 0) {
|
||
this.x = +t2, this.y = +e2, this.z = +r2;
|
||
}
|
||
static fromLngLat(t2, e2 = 0) {
|
||
const r2 = ec.convert(t2);
|
||
return new uc(ic(r2.lng), ac(r2.lat), sc(e2, r2.lat));
|
||
}
|
||
toLngLat() {
|
||
return new ec(oc(this.x), lc(this.y));
|
||
}
|
||
toAltitude() {
|
||
return this.z * nc(lc(this.y));
|
||
}
|
||
meterInMercatorCoordinateUnits() {
|
||
return 1 / rc * (t2 = lc(this.y), 1 / Math.cos(t2 * Math.PI / 180));
|
||
var t2;
|
||
}
|
||
}
|
||
function cc(t2, e2, r2) {
|
||
var n2 = 2 * Math.PI * 6378137 / 256 / Math.pow(2, r2);
|
||
return [t2 * n2 - 2 * Math.PI * 6378137 / 2, e2 * n2 - 2 * Math.PI * 6378137 / 2];
|
||
}
|
||
class hc {
|
||
constructor(t2, e2, r2) {
|
||
if (t2 < 0 || t2 > 25 || r2 < 0 || r2 >= Math.pow(2, t2) || e2 < 0 || e2 >= Math.pow(2, t2)) throw new Error(`x=${e2}, y=${r2}, z=${t2} outside of bounds. 0<=x<${Math.pow(2, t2)}, 0<=y<${Math.pow(2, t2)} 0<=z<=25 `);
|
||
this.z = t2, this.x = e2, this.y = r2, this.key = dc(0, t2, t2, e2, r2);
|
||
}
|
||
equals(t2) {
|
||
return this.z === t2.z && this.x === t2.x && this.y === t2.y;
|
||
}
|
||
url(t2, e2, r2) {
|
||
const n2 = (a2 = this.y, s2 = this.z, o2 = cc(256 * (i3 = this.x), 256 * (a2 = Math.pow(2, s2) - a2 - 1), s2), l2 = cc(256 * (i3 + 1), 256 * (a2 + 1), s2), o2[0] + "," + o2[1] + "," + l2[0] + "," + l2[1]);
|
||
var i3, a2, s2, o2, l2;
|
||
const u2 = (function(t3, e3, r3) {
|
||
let n3, i4 = "";
|
||
for (let a3 = t3; a3 > 0; a3--) n3 = 1 << a3 - 1, i4 += (e3 & n3 ? 1 : 0) + (r3 & n3 ? 2 : 0);
|
||
return i4;
|
||
})(this.z, this.x, this.y);
|
||
return t2[(this.x + this.y) % t2.length].replace(/{prefix}/g, (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" === r2 ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(/{ratio}/g, e2 > 1 ? "@2x" : "").replace(/{quadkey}/g, u2).replace(/{bbox-epsg-3857}/g, n2);
|
||
}
|
||
isChildOf(t2) {
|
||
const e2 = this.z - t2.z;
|
||
return e2 > 0 && t2.x === this.x >> e2 && t2.y === this.y >> e2;
|
||
}
|
||
getTilePoint(t2) {
|
||
const e2 = Math.pow(2, this.z);
|
||
return new a((t2.x * e2 - this.x) * rs, (t2.y * e2 - this.y) * rs);
|
||
}
|
||
toString() {
|
||
return `${this.z}/${this.x}/${this.y}`;
|
||
}
|
||
}
|
||
class pc {
|
||
constructor(t2, e2) {
|
||
this.wrap = t2, this.canonical = e2, this.key = dc(t2, e2.z, e2.z, e2.x, e2.y);
|
||
}
|
||
}
|
||
class fc {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
if (t2 < r2) throw new Error(`overscaledZ should be >= z; overscaledZ = ${t2}; z = ${r2}`);
|
||
this.overscaledZ = t2, this.wrap = e2, this.canonical = new hc(r2, +n2, +i3), this.key = dc(e2, t2, r2, n2, i3);
|
||
}
|
||
clone() {
|
||
return new fc(this.overscaledZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);
|
||
}
|
||
equals(t2) {
|
||
return this.overscaledZ === t2.overscaledZ && this.wrap === t2.wrap && this.canonical.equals(t2.canonical);
|
||
}
|
||
scaledTo(t2) {
|
||
if (t2 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t2}; overscaledZ = ${this.overscaledZ}`);
|
||
const e2 = this.canonical.z - t2;
|
||
return t2 > this.canonical.z ? new fc(t2, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new fc(t2, this.wrap, t2, this.canonical.x >> e2, this.canonical.y >> e2);
|
||
}
|
||
calculateScaledKey(t2, e2) {
|
||
if (t2 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t2}; overscaledZ = ${this.overscaledZ}`);
|
||
const r2 = this.canonical.z - t2;
|
||
return t2 > this.canonical.z ? dc(this.wrap * +e2, t2, this.canonical.z, this.canonical.x, this.canonical.y) : dc(this.wrap * +e2, t2, t2, this.canonical.x >> r2, this.canonical.y >> r2);
|
||
}
|
||
isChildOf(t2) {
|
||
if (t2.wrap !== this.wrap) return false;
|
||
const e2 = this.canonical.z - t2.canonical.z;
|
||
return 0 === t2.overscaledZ || t2.overscaledZ < this.overscaledZ && t2.canonical.x === this.canonical.x >> e2 && t2.canonical.y === this.canonical.y >> e2;
|
||
}
|
||
children(t2) {
|
||
if (this.overscaledZ >= t2) return [new fc(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];
|
||
const e2 = this.canonical.z + 1, r2 = 2 * this.canonical.x, n2 = 2 * this.canonical.y;
|
||
return [new fc(e2, this.wrap, e2, r2, n2), new fc(e2, this.wrap, e2, r2 + 1, n2), new fc(e2, this.wrap, e2, r2, n2 + 1), new fc(e2, this.wrap, e2, r2 + 1, n2 + 1)];
|
||
}
|
||
isLessThan(t2) {
|
||
return this.wrap < t2.wrap || !(this.wrap > t2.wrap) && (this.overscaledZ < t2.overscaledZ || !(this.overscaledZ > t2.overscaledZ) && (this.canonical.x < t2.canonical.x || !(this.canonical.x > t2.canonical.x) && this.canonical.y < t2.canonical.y));
|
||
}
|
||
wrapped() {
|
||
return new fc(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
|
||
}
|
||
unwrapTo(t2) {
|
||
return new fc(this.overscaledZ, t2, this.canonical.z, this.canonical.x, this.canonical.y);
|
||
}
|
||
overscaleFactor() {
|
||
return Math.pow(2, this.overscaledZ - this.canonical.z);
|
||
}
|
||
toUnwrapped() {
|
||
return new pc(this.wrap, this.canonical);
|
||
}
|
||
toString() {
|
||
return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;
|
||
}
|
||
getTilePoint(t2) {
|
||
return this.canonical.getTilePoint(new uc(t2.x - this.wrap, t2.y));
|
||
}
|
||
}
|
||
function dc(t2, e2, r2, n2, i3) {
|
||
(t2 *= 2) < 0 && (t2 = -1 * t2 - 1);
|
||
const a2 = 1 << r2;
|
||
return (a2 * a2 * t2 + a2 * i3 + n2).toString(36) + r2.toString(36) + e2.toString(36);
|
||
}
|
||
$n("CanonicalTileID", hc), $n("OverscaledTileID", fc, { omit: ["posMatrix"] });
|
||
class yc {
|
||
constructor(t2, e2, r2, n2 = 1, i3 = 1, a2 = 1, s2 = 0) {
|
||
if (this.uid = t2, e2.height !== e2.width) throw new RangeError("DEM tiles must be square");
|
||
if (r2 && !["mapbox", "terrarium", "custom"].includes(r2)) return void A(`"${r2}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);
|
||
this.stride = e2.height;
|
||
const o2 = this.dim = e2.height - 2;
|
||
switch (this.data = new Uint32Array(e2.data.buffer), r2) {
|
||
case "terrarium":
|
||
this.redFactor = 256, this.greenFactor = 1, this.blueFactor = 1 / 256, this.baseShift = 32768;
|
||
break;
|
||
case "custom":
|
||
this.redFactor = n2, this.greenFactor = i3, this.blueFactor = a2, this.baseShift = s2;
|
||
break;
|
||
default:
|
||
this.redFactor = 6553.6, this.greenFactor = 25.6, this.blueFactor = 0.1, this.baseShift = 1e4;
|
||
}
|
||
for (let t3 = 0; t3 < o2; t3++) this.data[this._idx(-1, t3)] = this.data[this._idx(0, t3)], this.data[this._idx(o2, t3)] = this.data[this._idx(o2 - 1, t3)], this.data[this._idx(t3, -1)] = this.data[this._idx(t3, 0)], this.data[this._idx(t3, o2)] = this.data[this._idx(t3, o2 - 1)];
|
||
this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(o2, -1)] = this.data[this._idx(o2 - 1, 0)], this.data[this._idx(-1, o2)] = this.data[this._idx(0, o2 - 1)], this.data[this._idx(o2, o2)] = this.data[this._idx(o2 - 1, o2 - 1)], this.min = Number.MAX_SAFE_INTEGER, this.max = Number.MIN_SAFE_INTEGER;
|
||
for (let t3 = 0; t3 < o2; t3++) for (let e3 = 0; e3 < o2; e3++) {
|
||
const r3 = this.get(t3, e3);
|
||
r3 > this.max && (this.max = r3), r3 < this.min && (this.min = r3);
|
||
}
|
||
}
|
||
get(t2, e2) {
|
||
const r2 = new Uint8Array(this.data.buffer), n2 = 4 * this._idx(t2, e2);
|
||
return this.unpack(r2[n2], r2[n2 + 1], r2[n2 + 2]);
|
||
}
|
||
getUnpackVector() {
|
||
return [this.redFactor, this.greenFactor, this.blueFactor, this.baseShift];
|
||
}
|
||
_idx(t2, e2) {
|
||
if (t2 < -1 || t2 >= this.dim + 1 || e2 < -1 || e2 >= this.dim + 1) throw new RangeError("out of range source coordinates for DEM data");
|
||
return (e2 + 1) * this.stride + (t2 + 1);
|
||
}
|
||
unpack(t2, e2, r2) {
|
||
return t2 * this.redFactor + e2 * this.greenFactor + r2 * this.blueFactor - this.baseShift;
|
||
}
|
||
getPixels() {
|
||
return new qs({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));
|
||
}
|
||
backfillBorder(t2, e2, r2) {
|
||
if (this.dim !== t2.dim) throw new Error("dem dimension mismatch");
|
||
let n2 = e2 * this.dim, i3 = e2 * this.dim + this.dim, a2 = r2 * this.dim, s2 = r2 * this.dim + this.dim;
|
||
switch (e2) {
|
||
case -1:
|
||
n2 = i3 - 1;
|
||
break;
|
||
case 1:
|
||
i3 = n2 + 1;
|
||
}
|
||
switch (r2) {
|
||
case -1:
|
||
a2 = s2 - 1;
|
||
break;
|
||
case 1:
|
||
s2 = a2 + 1;
|
||
}
|
||
const o2 = -e2 * this.dim, l2 = -r2 * this.dim;
|
||
for (let e3 = a2; e3 < s2; e3++) for (let r3 = n2; r3 < i3; r3++) this.data[this._idx(r3, e3)] = t2.data[this._idx(r3 + o2, e3 + l2)];
|
||
}
|
||
}
|
||
$n("DEMData", yc);
|
||
class mc {
|
||
constructor(t2) {
|
||
this._stringToNumber = {}, this._numberToString = [];
|
||
for (let e2 = 0; e2 < t2.length; e2++) {
|
||
const r2 = t2[e2];
|
||
this._stringToNumber[r2] = e2, this._numberToString[e2] = r2;
|
||
}
|
||
}
|
||
encode(t2) {
|
||
return this._stringToNumber[t2];
|
||
}
|
||
decode(t2) {
|
||
if (t2 >= this._numberToString.length) throw new Error(`Out of bounds. Index requested n=${t2} can't be >= this._numberToString.length ${this._numberToString.length}`);
|
||
return this._numberToString[t2];
|
||
}
|
||
}
|
||
class gc {
|
||
constructor(t2, e2, r2, n2, i3) {
|
||
this.type = "Feature", this._vectorTileFeature = t2, t2._z = e2, t2._x = r2, t2._y = n2, this.properties = t2.properties, this.id = i3;
|
||
}
|
||
get geometry() {
|
||
return void 0 === this._geometry && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry;
|
||
}
|
||
set geometry(t2) {
|
||
this._geometry = t2;
|
||
}
|
||
toJSON() {
|
||
const t2 = { geometry: this.geometry };
|
||
for (const e2 in this) "_geometry" !== e2 && "_vectorTileFeature" !== e2 && (t2[e2] = this[e2]);
|
||
return t2;
|
||
}
|
||
}
|
||
class xc {
|
||
constructor(t2, e2) {
|
||
this.tileID = t2, this.x = t2.canonical.x, this.y = t2.canonical.y, this.z = t2.canonical.z, this.grid = new Fn(rs, 16, 0), this.grid3D = new Fn(rs, 16, 0), this.featureIndexArray = new ca(), this.promoteId = e2;
|
||
}
|
||
insert(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = this.featureIndexArray.length;
|
||
this.featureIndexArray.emplaceBack(r2, n2, i3);
|
||
const o2 = a2 ? this.grid3D : this.grid;
|
||
for (let t3 = 0; t3 < e2.length; t3++) {
|
||
const r3 = e2[t3], n3 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
||
for (let t4 = 0; t4 < r3.length; t4++) {
|
||
const e3 = r3[t4];
|
||
n3[0] = Math.min(n3[0], e3.x), n3[1] = Math.min(n3[1], e3.y), n3[2] = Math.max(n3[2], e3.x), n3[3] = Math.max(n3[3], e3.y);
|
||
}
|
||
n3[0] < rs && n3[1] < rs && n3[2] >= 0 && n3[3] >= 0 && o2.insert(s2, n3[0], n3[1], n3[2], n3[3]);
|
||
}
|
||
}
|
||
loadVTLayers() {
|
||
return this.vtLayers || (this.vtLayers = new Ro.VectorTile(new eu(this.rawTileData)).layers, this.sourceLayerCoder = new mc(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers;
|
||
}
|
||
query(t2, e2, r2, n2) {
|
||
this.loadVTLayers();
|
||
const i3 = t2.params || {}, s2 = rs / t2.tileSize / t2.scale, o2 = Nr(i3.filter), l2 = t2.queryGeometry, u2 = t2.queryPadding * s2, c2 = bc(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p2 = bc(t2.cameraQueryGeometry), f2 = this.grid3D.query(p2.minX - u2, p2.minY - u2, p2.maxX + u2, p2.maxY + u2, ((e3, r3, n3, i4) => (function(t3, e4, r4, n4, i5) {
|
||
for (const a2 of t3) if (e4 <= a2.x && r4 <= a2.y && n4 >= a2.x && i5 >= a2.y) return true;
|
||
const s3 = [new a(e4, r4), new a(e4, i5), new a(n4, i5), new a(n4, r4)];
|
||
if (t3.length > 2) {
|
||
for (const e5 of s3) if (xs(t3, e5)) return true;
|
||
}
|
||
for (let e5 = 0; e5 < t3.length - 1; e5++) if (vs(t3[e5], t3[e5 + 1], s3)) return true;
|
||
return false;
|
||
})(t2.cameraQueryGeometry, e3 - u2, r3 - u2, n3 + u2, i4 + u2)));
|
||
for (const t3 of f2) h2.push(t3);
|
||
h2.sort(wc);
|
||
const d2 = {};
|
||
let y2;
|
||
for (let a2 = 0; a2 < h2.length; a2++) {
|
||
const u3 = h2[a2];
|
||
if (u3 === y2) continue;
|
||
y2 = u3;
|
||
const c3 = this.featureIndexArray.get(u3);
|
||
let p3 = null;
|
||
this.loadMatchingFeature(d2, c3.bucketIndex, c3.sourceLayerIndex, c3.featureIndex, o2, i3.layers, i3.availableImages, e2, r2, n2, ((e3, r3, n3) => (p3 || (p3 = as(e3)), r3.queryIntersectsFeature(l2, e3, n3, p3, this.z, t2.transform, s2, t2.pixelPosMatrix))));
|
||
}
|
||
return d2;
|
||
}
|
||
loadMatchingFeature(t2, e2, r2, n2, i3, a2, s2, o2, l2, u2, c2) {
|
||
const h2 = this.bucketLayerIDs[e2];
|
||
if (a2 && !(function(t3, e3) {
|
||
for (let r3 = 0; r3 < t3.length; r3++) if (e3.indexOf(t3[r3]) >= 0) return true;
|
||
return false;
|
||
})(a2, h2)) return;
|
||
const p2 = this.sourceLayerCoder.decode(r2), f2 = this.vtLayers[p2].feature(n2);
|
||
if (i3.needGeometry) {
|
||
const t3 = ss(f2, true);
|
||
if (!i3.filter(new li(this.tileID.overscaledZ), t3, this.tileID.canonical)) return;
|
||
} else if (!i3.filter(new li(this.tileID.overscaledZ), f2)) return;
|
||
const d2 = this.getId(f2, p2);
|
||
for (let e3 = 0; e3 < h2.length; e3++) {
|
||
const r3 = h2[e3];
|
||
if (a2 && a2.indexOf(r3) < 0) continue;
|
||
const i4 = o2[r3];
|
||
if (!i4) continue;
|
||
let p3 = {};
|
||
d2 && u2 && (p3 = u2.getState(i4.sourceLayer || "_geojsonTileLayer", d2));
|
||
const y2 = g({}, l2[r3]);
|
||
y2.paint = vc(y2.paint, i4.paint, f2, p3, s2), y2.layout = vc(y2.layout, i4.layout, f2, p3, s2);
|
||
const m2 = !c2 || c2(f2, i4, p3);
|
||
if (!m2) continue;
|
||
const x2 = new gc(f2, this.z, this.x, this.y, d2);
|
||
x2.layer = y2;
|
||
let v2 = t2[r3];
|
||
void 0 === v2 && (v2 = t2[r3] = []), v2.push({ featureIndex: n2, feature: x2, intersectionZ: m2 });
|
||
}
|
||
}
|
||
lookupSymbolFeatures(t2, e2, r2, n2, i3, a2, s2, o2) {
|
||
const l2 = {};
|
||
this.loadVTLayers();
|
||
const u2 = Nr(i3);
|
||
for (const i4 of t2) this.loadMatchingFeature(l2, r2, n2, i4, u2, a2, s2, o2, e2);
|
||
return l2;
|
||
}
|
||
hasLayer(t2) {
|
||
for (const e2 of this.bucketLayerIDs) for (const r2 of e2) if (t2 === r2) return true;
|
||
return false;
|
||
}
|
||
getId(t2, e2) {
|
||
let r2 = t2.id;
|
||
return this.promoteId && (r2 = t2.properties["string" == typeof this.promoteId ? this.promoteId : this.promoteId[e2]], "boolean" == typeof r2 && (r2 = Number(r2))), r2;
|
||
}
|
||
}
|
||
function vc(t2, e2, r2, n2, i3) {
|
||
return v(t2, ((t3, a2) => {
|
||
const s2 = e2 instanceof mi ? e2.get(a2) : null;
|
||
return s2 && s2.evaluate ? s2.evaluate(r2, n2, i3) : s2;
|
||
}));
|
||
}
|
||
function bc(t2) {
|
||
let e2 = 1 / 0, r2 = 1 / 0, n2 = -1 / 0, i3 = -1 / 0;
|
||
for (const a2 of t2) e2 = Math.min(e2, a2.x), r2 = Math.min(r2, a2.y), n2 = Math.max(n2, a2.x), i3 = Math.max(i3, a2.y);
|
||
return { minX: e2, minY: r2, maxX: n2, maxY: i3 };
|
||
}
|
||
function wc(t2, e2) {
|
||
return e2 - t2;
|
||
}
|
||
function _c(t2, e2, r2, n2, i3) {
|
||
const s2 = [];
|
||
for (let o2 = 0; o2 < t2.length; o2++) {
|
||
const l2 = t2[o2];
|
||
let u2;
|
||
for (let t3 = 0; t3 < l2.length - 1; t3++) {
|
||
let o3 = l2[t3], c2 = l2[t3 + 1];
|
||
o3.x < e2 && c2.x < e2 || (o3.x < e2 ? o3 = new a(e2, o3.y + (e2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round() : c2.x < e2 && (c2 = new a(e2, o3.y + (e2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round()), o3.y < r2 && c2.y < r2 || (o3.y < r2 ? o3 = new a(o3.x + (r2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), r2)._round() : c2.y < r2 && (c2 = new a(o3.x + (r2 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), r2)._round()), o3.x >= n2 && c2.x >= n2 || (o3.x >= n2 ? o3 = new a(n2, o3.y + (n2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round() : c2.x >= n2 && (c2 = new a(n2, o3.y + (n2 - o3.x) / (c2.x - o3.x) * (c2.y - o3.y))._round()), o3.y >= i3 && c2.y >= i3 || (o3.y >= i3 ? o3 = new a(o3.x + (i3 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), i3)._round() : c2.y >= i3 && (c2 = new a(o3.x + (i3 - o3.y) / (c2.y - o3.y) * (c2.x - o3.x), i3)._round()), u2 && o3.equals(u2[u2.length - 1]) || (u2 = [o3], s2.push(u2)), u2.push(c2)))));
|
||
}
|
||
}
|
||
return s2;
|
||
}
|
||
$n("FeatureIndex", xc, { omit: ["rawTileData", "sourceLayerCoder"] });
|
||
class Ac extends a {
|
||
constructor(t2, e2, r2, n2) {
|
||
super(t2, e2), this.angle = r2, void 0 !== n2 && (this.segment = n2);
|
||
}
|
||
clone() {
|
||
return new Ac(this.x, this.y, this.angle, this.segment);
|
||
}
|
||
}
|
||
function Sc(t2, e2, r2, n2, i3) {
|
||
if (void 0 === e2.segment || 0 === r2) return true;
|
||
let a2 = e2, s2 = e2.segment + 1, o2 = 0;
|
||
for (; o2 > -r2 / 2; ) {
|
||
if (s2--, s2 < 0) return false;
|
||
o2 -= t2[s2].dist(a2), a2 = t2[s2];
|
||
}
|
||
o2 += t2[s2].dist(t2[s2 + 1]), s2++;
|
||
const l2 = [];
|
||
let u2 = 0;
|
||
for (; o2 < r2 / 2; ) {
|
||
const e3 = t2[s2], r3 = t2[s2 + 1];
|
||
if (!r3) return false;
|
||
let a3 = t2[s2 - 1].angleTo(e3) - e3.angleTo(r3);
|
||
for (a3 = Math.abs((a3 + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l2.push({ distance: o2, angleDelta: a3 }), u2 += a3; o2 - l2[0].distance > n2; ) u2 -= l2.shift().angleDelta;
|
||
if (u2 > i3) return false;
|
||
s2++, o2 += e3.dist(r3);
|
||
}
|
||
return true;
|
||
}
|
||
function kc(t2) {
|
||
let e2 = 0;
|
||
for (let r2 = 0; r2 < t2.length - 1; r2++) e2 += t2[r2].dist(t2[r2 + 1]);
|
||
return e2;
|
||
}
|
||
function Ic(t2, e2, r2) {
|
||
return t2 ? 0.6 * e2 * r2 : 0;
|
||
}
|
||
function zc(t2, e2) {
|
||
return Math.max(t2 ? t2.right - t2.left : 0, e2 ? e2.right - e2.left : 0);
|
||
}
|
||
function Mc(t2, e2, r2, n2, i3, a2) {
|
||
const s2 = Ic(r2, i3, a2), o2 = zc(r2, n2) * a2;
|
||
let l2 = 0;
|
||
const u2 = kc(t2) / 2;
|
||
for (let r3 = 0; r3 < t2.length - 1; r3++) {
|
||
const n3 = t2[r3], i4 = t2[r3 + 1], a3 = n3.dist(i4);
|
||
if (l2 + a3 > u2) {
|
||
const c2 = (u2 - l2) / a3, h2 = Ze.number(n3.x, i4.x, c2), p2 = Ze.number(n3.y, i4.y, c2), f2 = new Ac(h2, p2, i4.angleTo(n3), r3);
|
||
return f2._round(), !s2 || Sc(t2, f2, o2, s2, e2) ? f2 : void 0;
|
||
}
|
||
l2 += a3;
|
||
}
|
||
}
|
||
function Cc(t2, e2, r2, n2, i3, a2, s2, o2, l2) {
|
||
const u2 = Ic(n2, a2, s2), c2 = zc(n2, i3), h2 = c2 * s2, p2 = 0 === t2[0].x || t2[0].x === l2 || 0 === t2[0].y || t2[0].y === l2;
|
||
return e2 - h2 < e2 / 4 && (e2 = h2 + e2 / 4), Bc(t2, p2 ? e2 / 2 * o2 % e2 : (c2 / 2 + 2 * a2) * s2 * o2 % e2, e2, u2, r2, h2, p2, false, l2);
|
||
}
|
||
function Bc(t2, e2, r2, n2, i3, a2, s2, o2, l2) {
|
||
const u2 = a2 / 2, c2 = kc(t2);
|
||
let h2 = 0, p2 = e2 - r2, f2 = [];
|
||
for (let e3 = 0; e3 < t2.length - 1; e3++) {
|
||
const s3 = t2[e3], o3 = t2[e3 + 1], d2 = s3.dist(o3), y2 = o3.angleTo(s3);
|
||
for (; p2 + r2 < h2 + d2; ) {
|
||
p2 += r2;
|
||
const m2 = (p2 - h2) / d2, g2 = Ze.number(s3.x, o3.x, m2), x2 = Ze.number(s3.y, o3.y, m2);
|
||
if (g2 >= 0 && g2 < l2 && x2 >= 0 && x2 < l2 && p2 - u2 >= 0 && p2 + u2 <= c2) {
|
||
const r3 = new Ac(g2, x2, y2, e3);
|
||
r3._round(), n2 && !Sc(t2, r3, a2, n2, i3) || f2.push(r3);
|
||
}
|
||
}
|
||
h2 += d2;
|
||
}
|
||
return o2 || f2.length || s2 || (f2 = Bc(t2, h2 / 2, r2, n2, i3, a2, s2, true, l2)), f2;
|
||
}
|
||
$n("Anchor", Ac);
|
||
const Pc = lu;
|
||
function Vc(t2, e2, r2, n2) {
|
||
const i3 = [], s2 = t2.image, o2 = s2.pixelRatio, l2 = s2.paddedRect.w - 2 * Pc, u2 = s2.paddedRect.h - 2 * Pc, c2 = t2.right - t2.left, h2 = t2.bottom - t2.top, p2 = s2.stretchX || [[0, l2]], f2 = s2.stretchY || [[0, u2]], d2 = (t3, e3) => t3 + e3[1] - e3[0], y2 = p2.reduce(d2, 0), m2 = f2.reduce(d2, 0), g2 = l2 - y2, x2 = u2 - m2;
|
||
let v2 = 0, b2 = y2, w2 = 0, _2 = m2, A2 = 0, S2 = g2, k2 = 0, I2 = x2;
|
||
if (s2.content && n2) {
|
||
const t3 = s2.content;
|
||
v2 = Ec(p2, 0, t3[0]), w2 = Ec(f2, 0, t3[1]), b2 = Ec(p2, t3[0], t3[2]), _2 = Ec(f2, t3[1], t3[3]), A2 = t3[0] - v2, k2 = t3[1] - w2, S2 = t3[2] - t3[0] - b2, I2 = t3[3] - t3[1] - _2;
|
||
}
|
||
const z2 = (n3, i4, l3, u3) => {
|
||
const p3 = Tc(n3.stretch - v2, b2, c2, t2.left), f3 = $c(n3.fixed - A2, S2, n3.stretch, y2), d3 = Tc(i4.stretch - w2, _2, h2, t2.top), g3 = $c(i4.fixed - k2, I2, i4.stretch, m2), x3 = Tc(l3.stretch - v2, b2, c2, t2.left), z3 = $c(l3.fixed - A2, S2, l3.stretch, y2), M2 = Tc(u3.stretch - w2, _2, h2, t2.top), C2 = $c(u3.fixed - k2, I2, u3.stretch, m2), B2 = new a(p3, d3), P2 = new a(x3, d3), V2 = new a(x3, M2), E2 = new a(p3, M2), F2 = new a(f3 / o2, g3 / o2), T2 = new a(z3 / o2, C2 / o2), $2 = e2 * Math.PI / 180;
|
||
if ($2) {
|
||
const t3 = Math.sin($2), e3 = Math.cos($2), r3 = [e3, -t3, t3, e3];
|
||
B2._matMult(r3), P2._matMult(r3), E2._matMult(r3), V2._matMult(r3);
|
||
}
|
||
const L2 = n3.stretch + n3.fixed, D2 = i4.stretch + i4.fixed;
|
||
return { tl: B2, tr: P2, bl: E2, br: V2, tex: { x: s2.paddedRect.x + Pc + L2, y: s2.paddedRect.y + Pc + D2, w: l3.stretch + l3.fixed - L2, h: u3.stretch + u3.fixed - D2 }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: F2, pixelOffsetBR: T2, minFontScaleX: S2 / o2 / c2, minFontScaleY: I2 / o2 / h2, isSDF: r2 };
|
||
};
|
||
if (n2 && (s2.stretchX || s2.stretchY)) {
|
||
const t3 = Fc(p2, g2, y2), e3 = Fc(f2, x2, m2);
|
||
for (let r3 = 0; r3 < t3.length - 1; r3++) {
|
||
const n3 = t3[r3], a2 = t3[r3 + 1];
|
||
for (let t4 = 0; t4 < e3.length - 1; t4++) i3.push(z2(n3, e3[t4], a2, e3[t4 + 1]));
|
||
}
|
||
} else i3.push(z2({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: l2 + 1 }, { fixed: 0, stretch: u2 + 1 }));
|
||
return i3;
|
||
}
|
||
function Ec(t2, e2, r2) {
|
||
let n2 = 0;
|
||
for (const i3 of t2) n2 += Math.max(e2, Math.min(r2, i3[1])) - Math.max(e2, Math.min(r2, i3[0]));
|
||
return n2;
|
||
}
|
||
function Fc(t2, e2, r2) {
|
||
const n2 = [{ fixed: -Pc, stretch: 0 }];
|
||
for (const [e3, r3] of t2) {
|
||
const t3 = n2[n2.length - 1];
|
||
n2.push({ fixed: e3 - t3.stretch, stretch: t3.stretch }), n2.push({ fixed: e3 - t3.stretch, stretch: t3.stretch + (r3 - e3) });
|
||
}
|
||
return n2.push({ fixed: e2 + Pc, stretch: r2 }), n2;
|
||
}
|
||
function Tc(t2, e2, r2, n2) {
|
||
return t2 / e2 * r2 + n2;
|
||
}
|
||
function $c(t2, e2, r2, n2) {
|
||
return t2 - e2 * r2 / n2;
|
||
}
|
||
class Lc {
|
||
constructor(t2, e2, r2, n2, i3, s2, o2, l2, u2, c2) {
|
||
if (this.boxStartIndex = t2.length, u2) {
|
||
let t3 = s2.top, e3 = s2.bottom;
|
||
const r3 = s2.collisionPadding;
|
||
r3 && (t3 -= r3[1], e3 += r3[3]);
|
||
let n3 = e3 - t3;
|
||
n3 > 0 && (n3 = Math.max(10, n3), this.circleDiameter = n3);
|
||
} else {
|
||
let u3 = s2.top * o2 - l2[0], h2 = s2.bottom * o2 + l2[2], p2 = s2.left * o2 - l2[3], f2 = s2.right * o2 + l2[1];
|
||
const d2 = s2.collisionPadding;
|
||
if (d2 && (p2 -= d2[0] * o2, u3 -= d2[1] * o2, f2 += d2[2] * o2, h2 += d2[3] * o2), c2) {
|
||
const t3 = new a(p2, u3), e3 = new a(f2, u3), r3 = new a(p2, h2), n3 = new a(f2, h2), i4 = c2 * Math.PI / 180;
|
||
t3._rotate(i4), e3._rotate(i4), r3._rotate(i4), n3._rotate(i4), p2 = Math.min(t3.x, e3.x, r3.x, n3.x), f2 = Math.max(t3.x, e3.x, r3.x, n3.x), u3 = Math.min(t3.y, e3.y, r3.y, n3.y), h2 = Math.max(t3.y, e3.y, r3.y, n3.y);
|
||
}
|
||
t2.emplaceBack(e2.x, e2.y, p2, u3, f2, h2, r2, n2, i3);
|
||
}
|
||
this.boxEndIndex = t2.length;
|
||
}
|
||
}
|
||
class Dc {
|
||
constructor(t2 = [], e2 = Oc) {
|
||
if (this.data = t2, this.length = this.data.length, this.compare = e2, this.length > 0) for (let t3 = (this.length >> 1) - 1; t3 >= 0; t3--) this._down(t3);
|
||
}
|
||
push(t2) {
|
||
this.data.push(t2), this.length++, this._up(this.length - 1);
|
||
}
|
||
pop() {
|
||
if (0 === this.length) return;
|
||
const t2 = this.data[0], e2 = this.data.pop();
|
||
return this.length--, this.length > 0 && (this.data[0] = e2, this._down(0)), t2;
|
||
}
|
||
peek() {
|
||
return this.data[0];
|
||
}
|
||
_up(t2) {
|
||
const { data: e2, compare: r2 } = this, n2 = e2[t2];
|
||
for (; t2 > 0; ) {
|
||
const i3 = t2 - 1 >> 1, a2 = e2[i3];
|
||
if (r2(n2, a2) >= 0) break;
|
||
e2[t2] = a2, t2 = i3;
|
||
}
|
||
e2[t2] = n2;
|
||
}
|
||
_down(t2) {
|
||
const { data: e2, compare: r2 } = this, n2 = this.length >> 1, i3 = e2[t2];
|
||
for (; t2 < n2; ) {
|
||
let n3 = 1 + (t2 << 1), a2 = e2[n3];
|
||
const s2 = n3 + 1;
|
||
if (s2 < this.length && r2(e2[s2], a2) < 0 && (n3 = s2, a2 = e2[s2]), r2(a2, i3) >= 0) break;
|
||
e2[t2] = a2, t2 = n3;
|
||
}
|
||
e2[t2] = i3;
|
||
}
|
||
}
|
||
function Oc(t2, e2) {
|
||
return t2 < e2 ? -1 : t2 > e2 ? 1 : 0;
|
||
}
|
||
function Uc(t2, e2 = 1, r2 = false) {
|
||
let n2 = 1 / 0, i3 = 1 / 0, s2 = -1 / 0, o2 = -1 / 0;
|
||
const l2 = t2[0];
|
||
for (let t3 = 0; t3 < l2.length; t3++) {
|
||
const e3 = l2[t3];
|
||
(!t3 || e3.x < n2) && (n2 = e3.x), (!t3 || e3.y < i3) && (i3 = e3.y), (!t3 || e3.x > s2) && (s2 = e3.x), (!t3 || e3.y > o2) && (o2 = e3.y);
|
||
}
|
||
const u2 = Math.min(s2 - n2, o2 - i3);
|
||
let c2 = u2 / 2;
|
||
const h2 = new Dc([], Rc);
|
||
if (0 === u2) return new a(n2, i3);
|
||
for (let e3 = n2; e3 < s2; e3 += u2) for (let r3 = i3; r3 < o2; r3 += u2) h2.push(new qc(e3 + c2, r3 + c2, c2, t2));
|
||
let p2 = (function(t3) {
|
||
let e3 = 0, r3 = 0, n3 = 0;
|
||
const i4 = t3[0];
|
||
for (let t4 = 0, a2 = i4.length, s3 = a2 - 1; t4 < a2; s3 = t4++) {
|
||
const a3 = i4[t4], o3 = i4[s3], l3 = a3.x * o3.y - o3.x * a3.y;
|
||
r3 += (a3.x + o3.x) * l3, n3 += (a3.y + o3.y) * l3, e3 += 3 * l3;
|
||
}
|
||
return new qc(r3 / e3, n3 / e3, 0, t3);
|
||
})(t2), f2 = h2.length;
|
||
for (; h2.length; ) {
|
||
const n3 = h2.pop();
|
||
(n3.d > p2.d || !p2.d) && (p2 = n3, r2 && console.log("found best %d after %d probes", Math.round(1e4 * n3.d) / 1e4, f2)), n3.max - p2.d <= e2 || (c2 = n3.h / 2, h2.push(new qc(n3.p.x - c2, n3.p.y - c2, c2, t2)), h2.push(new qc(n3.p.x + c2, n3.p.y - c2, c2, t2)), h2.push(new qc(n3.p.x - c2, n3.p.y + c2, c2, t2)), h2.push(new qc(n3.p.x + c2, n3.p.y + c2, c2, t2)), f2 += 4);
|
||
}
|
||
return r2 && (console.log(`num probes: ${f2}`), console.log(`best distance: ${p2.d}`)), p2.p;
|
||
}
|
||
function Rc(t2, e2) {
|
||
return e2.max - t2.max;
|
||
}
|
||
function qc(t2, e2, r2, n2) {
|
||
this.p = new a(t2, e2), this.h = r2, this.d = (function(t3, e3) {
|
||
let r3 = false, n3 = 1 / 0;
|
||
for (let i3 = 0; i3 < e3.length; i3++) {
|
||
const a2 = e3[i3];
|
||
for (let e4 = 0, i4 = a2.length, s2 = i4 - 1; e4 < i4; s2 = e4++) {
|
||
const i5 = a2[e4], o2 = a2[s2];
|
||
i5.y > t3.y != o2.y > t3.y && t3.x < (o2.x - i5.x) * (t3.y - i5.y) / (o2.y - i5.y) + i5.x && (r3 = !r3), n3 = Math.min(n3, ms(t3, i5, o2));
|
||
}
|
||
}
|
||
return (r3 ? 1 : -1) * Math.sqrt(n3);
|
||
})(this.p, n2), this.max = this.d + this.h * Math.SQRT2;
|
||
}
|
||
var jc;
|
||
t.aq = void 0, (jc = t.aq || (t.aq = {}))[jc.center = 1] = "center", jc[jc.left = 2] = "left", jc[jc.right = 3] = "right", jc[jc.top = 4] = "top", jc[jc.bottom = 5] = "bottom", jc[jc["top-left"] = 6] = "top-left", jc[jc["top-right"] = 7] = "top-right", jc[jc["bottom-left"] = 8] = "bottom-left", jc[jc["bottom-right"] = 9] = "bottom-right";
|
||
const Nc = 7, Zc = Number.POSITIVE_INFINITY;
|
||
function Kc(t2, e2) {
|
||
return e2[1] !== Zc ? (function(t3, e3, r2) {
|
||
let n2 = 0, i3 = 0;
|
||
switch (e3 = Math.abs(e3), r2 = Math.abs(r2), t3) {
|
||
case "top-right":
|
||
case "top-left":
|
||
case "top":
|
||
i3 = r2 - Nc;
|
||
break;
|
||
case "bottom-right":
|
||
case "bottom-left":
|
||
case "bottom":
|
||
i3 = -r2 + Nc;
|
||
}
|
||
switch (t3) {
|
||
case "top-right":
|
||
case "bottom-right":
|
||
case "right":
|
||
n2 = -e3;
|
||
break;
|
||
case "top-left":
|
||
case "bottom-left":
|
||
case "left":
|
||
n2 = e3;
|
||
}
|
||
return [n2, i3];
|
||
})(t2, e2[0], e2[1]) : (function(t3, e3) {
|
||
let r2 = 0, n2 = 0;
|
||
e3 < 0 && (e3 = 0);
|
||
const i3 = e3 / Math.SQRT2;
|
||
switch (t3) {
|
||
case "top-right":
|
||
case "top-left":
|
||
n2 = i3 - Nc;
|
||
break;
|
||
case "bottom-right":
|
||
case "bottom-left":
|
||
n2 = -i3 + Nc;
|
||
break;
|
||
case "bottom":
|
||
n2 = -e3 + Nc;
|
||
break;
|
||
case "top":
|
||
n2 = e3 - Nc;
|
||
}
|
||
switch (t3) {
|
||
case "top-right":
|
||
case "bottom-right":
|
||
r2 = -i3;
|
||
break;
|
||
case "top-left":
|
||
case "bottom-left":
|
||
r2 = i3;
|
||
break;
|
||
case "left":
|
||
r2 = e3;
|
||
break;
|
||
case "right":
|
||
r2 = -e3;
|
||
}
|
||
return [r2, n2];
|
||
})(t2, e2[0]);
|
||
}
|
||
function Gc(t2, e2, r2) {
|
||
var n2;
|
||
const i3 = t2.layout, a2 = null === (n2 = i3.get("text-variable-anchor-offset")) || void 0 === n2 ? void 0 : n2.evaluate(e2, {}, r2);
|
||
if (a2) {
|
||
const t3 = a2.values, e3 = [];
|
||
for (let r3 = 0; r3 < t3.length; r3 += 2) {
|
||
const n3 = e3[r3] = t3[r3], i4 = t3[r3 + 1].map(((t4) => t4 * Vl));
|
||
n3.startsWith("top") ? i4[1] -= Nc : n3.startsWith("bottom") && (i4[1] += Nc), e3[r3 + 1] = i4;
|
||
}
|
||
return new re(e3);
|
||
}
|
||
const s2 = i3.get("text-variable-anchor");
|
||
if (s2) {
|
||
let n3;
|
||
n3 = void 0 !== t2._unevaluatedLayout.getValue("text-radial-offset") ? [i3.get("text-radial-offset").evaluate(e2, {}, r2) * Vl, Zc] : i3.get("text-offset").evaluate(e2, {}, r2).map(((t3) => t3 * Vl));
|
||
const a3 = [];
|
||
for (const t3 of s2) a3.push(t3, Kc(t3, n3));
|
||
return new re(a3);
|
||
}
|
||
return null;
|
||
}
|
||
function Jc(t2) {
|
||
switch (t2) {
|
||
case "right":
|
||
case "top-right":
|
||
case "bottom-right":
|
||
return "right";
|
||
case "left":
|
||
case "top-left":
|
||
case "bottom-left":
|
||
return "left";
|
||
}
|
||
return "center";
|
||
}
|
||
function Xc(e2, r2, n2, i3, a2, s2, o2, l2, u2, c2, h2) {
|
||
let p2 = s2.textMaxSize.evaluate(r2, {});
|
||
void 0 === p2 && (p2 = o2);
|
||
const f2 = e2.layers[0].layout, d2 = f2.get("icon-offset").evaluate(r2, {}, h2), y2 = Hc(n2.horizontal), m2 = o2 / 24, g2 = e2.tilePixelRatio * m2, x2 = e2.tilePixelRatio * p2 / 24, v2 = e2.tilePixelRatio * l2, b2 = e2.tilePixelRatio * f2.get("symbol-spacing"), w2 = f2.get("text-padding") * e2.tilePixelRatio, _2 = (function(t2, e3, r3, n3 = 1) {
|
||
const i4 = t2.get("icon-padding").evaluate(e3, {}, r3), a3 = i4 && i4.values;
|
||
return [a3[0] * n3, a3[1] * n3, a3[2] * n3, a3[3] * n3];
|
||
})(f2, r2, h2, e2.tilePixelRatio), S2 = f2.get("text-max-angle") / 180 * Math.PI, k2 = "viewport" !== f2.get("text-rotation-alignment") && "point" !== f2.get("symbol-placement"), I2 = "map" === f2.get("icon-rotation-alignment") && "point" !== f2.get("symbol-placement"), z2 = f2.get("symbol-placement"), M2 = b2 / 2, C2 = f2.get("icon-text-fit");
|
||
let B2;
|
||
i3 && "none" !== C2 && (e2.allowVerticalPlacement && n2.vertical && (B2 = zu(i3, n2.vertical, C2, f2.get("icon-text-fit-padding"), d2, m2)), y2 && (i3 = zu(i3, y2, C2, f2.get("icon-text-fit-padding"), d2, m2)));
|
||
const P2 = (l3, p3) => {
|
||
p3.x < 0 || p3.x >= rs || p3.y < 0 || p3.y >= rs || (function(e3, r3, n3, i4, a3, s3, o3, l4, u3, c3, h3, p4, f3, d3, y3, m3, g3, x3, v3, b3, w3, _3, S3, k3, I3) {
|
||
const z3 = e3.addToLineVertexArray(r3, n3);
|
||
let M3, C3, B3, P3, V2 = 0, E2 = 0, F2 = 0, T2 = 0, $2 = -1, L2 = -1;
|
||
const D2 = {};
|
||
let O2 = $a("");
|
||
if (e3.allowVerticalPlacement && i4.vertical) {
|
||
const t2 = l4.layout.get("text-rotate").evaluate(w3, {}, k3) + 90;
|
||
B3 = new Lc(u3, r3, c3, h3, p4, i4.vertical, f3, d3, y3, t2), o3 && (P3 = new Lc(u3, r3, c3, h3, p4, o3, g3, x3, y3, t2));
|
||
}
|
||
if (a3) {
|
||
const n4 = l4.layout.get("icon-rotate").evaluate(w3, {}), i5 = "none" !== l4.layout.get("icon-text-fit"), s4 = Vc(a3, n4, S3, i5), f4 = o3 ? Vc(o3, n4, S3, i5) : void 0;
|
||
C3 = new Lc(u3, r3, c3, h3, p4, a3, g3, x3, false, n4), V2 = 4 * s4.length;
|
||
const d4 = e3.iconSizeData;
|
||
let y4 = null;
|
||
"source" === d4.kind ? (y4 = [Cu * l4.layout.get("icon-size").evaluate(w3, {})], y4[0] > Bu && A(`${e3.layerIds[0]}: Value for "icon-size" is >= ${Mu}. Reduce your "icon-size".`)) : "composite" === d4.kind && (y4 = [Cu * _3.compositeIconSizes[0].evaluate(w3, {}, k3), Cu * _3.compositeIconSizes[1].evaluate(w3, {}, k3)], (y4[0] > Bu || y4[1] > Bu) && A(`${e3.layerIds[0]}: Value for "icon-size" is >= ${Mu}. Reduce your "icon-size".`)), e3.addSymbols(e3.icon, s4, y4, b3, v3, w3, t.ai.none, r3, z3.lineStartIndex, z3.lineLength, -1, k3), $2 = e3.icon.placedSymbolArray.length - 1, f4 && (E2 = 4 * f4.length, e3.addSymbols(e3.icon, f4, y4, b3, v3, w3, t.ai.vertical, r3, z3.lineStartIndex, z3.lineLength, -1, k3), L2 = e3.icon.placedSymbolArray.length - 1);
|
||
}
|
||
const U2 = Object.keys(i4.horizontal);
|
||
for (const n4 of U2) {
|
||
const a4 = i4.horizontal[n4];
|
||
if (!M3) {
|
||
O2 = $a(a4.text);
|
||
const t2 = l4.layout.get("text-rotate").evaluate(w3, {}, k3);
|
||
M3 = new Lc(u3, r3, c3, h3, p4, a4, f3, d3, y3, t2);
|
||
}
|
||
const o4 = 1 === a4.positionedLines.length;
|
||
if (F2 += Yc(e3, r3, a4, s3, l4, y3, w3, m3, z3, i4.vertical ? t.ai.horizontal : t.ai.horizontalOnly, o4 ? U2 : [n4], D2, $2, _3, k3), o4) break;
|
||
}
|
||
i4.vertical && (T2 += Yc(e3, r3, i4.vertical, s3, l4, y3, w3, m3, z3, t.ai.vertical, ["vertical"], D2, L2, _3, k3));
|
||
const R2 = M3 ? M3.boxStartIndex : e3.collisionBoxArray.length, q2 = M3 ? M3.boxEndIndex : e3.collisionBoxArray.length, j2 = B3 ? B3.boxStartIndex : e3.collisionBoxArray.length, N2 = B3 ? B3.boxEndIndex : e3.collisionBoxArray.length, Z2 = C3 ? C3.boxStartIndex : e3.collisionBoxArray.length, K2 = C3 ? C3.boxEndIndex : e3.collisionBoxArray.length, G2 = P3 ? P3.boxStartIndex : e3.collisionBoxArray.length, J2 = P3 ? P3.boxEndIndex : e3.collisionBoxArray.length;
|
||
let X2 = -1;
|
||
const Y2 = (t2, e4) => t2 && t2.circleDiameter ? Math.max(t2.circleDiameter, e4) : e4;
|
||
X2 = Y2(M3, X2), X2 = Y2(B3, X2), X2 = Y2(C3, X2), X2 = Y2(P3, X2);
|
||
const H2 = X2 > -1 ? 1 : 0;
|
||
H2 && (X2 *= I3 / Vl), e3.glyphOffsetArray.length >= Uu.MAX_GLYPHS && A("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), void 0 !== w3.sortKey && e3.addToSortKeyRanges(e3.symbolInstances.length, w3.sortKey);
|
||
const W2 = Gc(l4, w3, k3), [Q2, tt2] = (function(e4, r4) {
|
||
const n4 = e4.length, i5 = null == r4 ? void 0 : r4.values;
|
||
if ((null == i5 ? void 0 : i5.length) > 0) for (let r5 = 0; r5 < i5.length; r5 += 2) {
|
||
const n5 = i5[r5 + 1];
|
||
e4.emplaceBack(t.aq[i5[r5]], n5[0], n5[1]);
|
||
}
|
||
return [n4, e4.length];
|
||
})(e3.textAnchorOffsets, W2);
|
||
e3.symbolInstances.emplaceBack(r3.x, r3.y, D2.right >= 0 ? D2.right : -1, D2.center >= 0 ? D2.center : -1, D2.left >= 0 ? D2.left : -1, D2.vertical || -1, $2, L2, O2, R2, q2, j2, N2, Z2, K2, G2, J2, c3, F2, T2, V2, E2, H2, 0, f3, X2, Q2, tt2);
|
||
})(e2, p3, l3, n2, i3, a2, B2, e2.layers[0], e2.collisionBoxArray, r2.index, r2.sourceLayerIndex, e2.index, g2, [w2, w2, w2, w2], k2, u2, v2, _2, I2, d2, r2, s2, c2, h2, o2);
|
||
};
|
||
if ("line" === z2) for (const t2 of _c(r2.geometry, 0, 0, rs, rs)) {
|
||
const r3 = Cc(t2, b2, S2, n2.vertical || y2, i3, 24, x2, e2.overscaling, rs);
|
||
for (const n3 of r3) y2 && Wc(e2, y2.text, M2, n3) || P2(t2, n3);
|
||
}
|
||
else if ("line-center" === z2) {
|
||
for (const t2 of r2.geometry) if (t2.length > 1) {
|
||
const e3 = Mc(t2, S2, n2.vertical || y2, i3, 24, x2);
|
||
e3 && P2(t2, e3);
|
||
}
|
||
} else if ("Polygon" === r2.type) for (const t2 of Co(r2.geometry, 0)) {
|
||
const e3 = Uc(t2, 16);
|
||
P2(t2[0], new Ac(e3.x, e3.y, 0));
|
||
}
|
||
else if ("LineString" === r2.type) for (const t2 of r2.geometry) P2(t2, new Ac(t2[0].x, t2[0].y, 0));
|
||
else if ("Point" === r2.type) for (const t2 of r2.geometry) for (const e3 of t2) P2([e3], new Ac(e3.x, e3.y, 0));
|
||
}
|
||
function Yc(t2, e2, r2, n2, i3, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2) {
|
||
const m2 = (function(t3, e3, r3, n3, i4, s3, o3, l3) {
|
||
const u3 = n3.layout.get("text-rotate").evaluate(s3, {}) * Math.PI / 180, c3 = [];
|
||
for (const t4 of e3.positionedLines) for (const n4 of t4.positionedGlyphs) {
|
||
if (!n4.rect) continue;
|
||
const s4 = n4.rect || {};
|
||
let h3 = su + 1, p3 = true, f3 = 1, d3 = 0;
|
||
const y3 = (i4 || l3) && n4.vertical, m3 = n4.metrics.advance * n4.scale / 2;
|
||
if (l3 && e3.verticalizable && (d3 = t4.lineOffset / 2 - (n4.imageName ? -(Vl - n4.metrics.width * n4.scale) / 2 : (n4.scale - 1) * Vl)), n4.imageName) {
|
||
const t5 = o3[n4.imageName];
|
||
p3 = t5.sdf, f3 = t5.pixelRatio, h3 = lu / f3;
|
||
}
|
||
const g3 = i4 ? [n4.x + m3, n4.y] : [0, 0];
|
||
let x3 = i4 ? [0, 0] : [n4.x + m3 + r3[0], n4.y + r3[1] - d3], v2 = [0, 0];
|
||
y3 && (v2 = x3, x3 = [0, 0]);
|
||
const b2 = n4.metrics.isDoubleResolution ? 2 : 1, w2 = (n4.metrics.left - h3) * n4.scale - m3 + x3[0], _2 = (-n4.metrics.top - h3) * n4.scale + x3[1], A2 = w2 + s4.w / b2 * n4.scale / f3, S2 = _2 + s4.h / b2 * n4.scale / f3, k2 = new a(w2, _2), I2 = new a(A2, _2), z2 = new a(w2, S2), M2 = new a(A2, S2);
|
||
if (y3) {
|
||
const t5 = new a(-m3, m3 - pu), e4 = -Math.PI / 2, r4 = Vl / 2 - m3, i5 = new a(5 - pu - r4, -(n4.imageName ? r4 : 0)), s5 = new a(...v2);
|
||
k2._rotateAround(e4, t5)._add(i5)._add(s5), I2._rotateAround(e4, t5)._add(i5)._add(s5), z2._rotateAround(e4, t5)._add(i5)._add(s5), M2._rotateAround(e4, t5)._add(i5)._add(s5);
|
||
}
|
||
if (u3) {
|
||
const t5 = Math.sin(u3), e4 = Math.cos(u3), r4 = [e4, -t5, t5, e4];
|
||
k2._matMult(r4), I2._matMult(r4), z2._matMult(r4), M2._matMult(r4);
|
||
}
|
||
const C2 = new a(0, 0), B2 = new a(0, 0);
|
||
c3.push({ tl: k2, tr: I2, bl: z2, br: M2, tex: s4, writingMode: e3.writingMode, glyphOffset: g3, sectionIndex: n4.sectionIndex, isSDF: p3, pixelOffsetTL: C2, pixelOffsetBR: B2, minFontScaleX: 0, minFontScaleY: 0 });
|
||
}
|
||
return c3;
|
||
})(0, r2, l2, i3, s2, o2, n2, t2.allowVerticalPlacement), g2 = t2.textSizeData;
|
||
let x2 = null;
|
||
"source" === g2.kind ? (x2 = [Cu * i3.layout.get("text-size").evaluate(o2, {})], x2[0] > Bu && A(`${t2.layerIds[0]}: Value for "text-size" is >= ${Mu}. Reduce your "text-size".`)) : "composite" === g2.kind && (x2 = [Cu * d2.compositeTextSizes[0].evaluate(o2, {}, y2), Cu * d2.compositeTextSizes[1].evaluate(o2, {}, y2)], (x2[0] > Bu || x2[1] > Bu) && A(`${t2.layerIds[0]}: Value for "text-size" is >= ${Mu}. Reduce your "text-size".`)), t2.addSymbols(t2.text, m2, x2, l2, s2, o2, c2, e2, u2.lineStartIndex, u2.lineLength, f2, y2);
|
||
for (const e3 of h2) p2[e3] = t2.text.placedSymbolArray.length - 1;
|
||
return 4 * m2.length;
|
||
}
|
||
function Hc(t2) {
|
||
for (const e2 in t2) return t2[e2];
|
||
return null;
|
||
}
|
||
function Wc(t2, e2, r2, n2) {
|
||
const i3 = t2.compareText;
|
||
if (e2 in i3) {
|
||
const t3 = i3[e2];
|
||
for (let e3 = t3.length - 1; e3 >= 0; e3--) if (n2.dist(t3[e3]) < r2) return true;
|
||
} else i3[e2] = [];
|
||
return i3[e2].push(n2), false;
|
||
}
|
||
const Qc = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
|
||
class th {
|
||
static from(t2) {
|
||
if (!(t2 instanceof ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer.");
|
||
const [e2, r2] = new Uint8Array(t2, 0, 2);
|
||
if (219 !== e2) throw new Error("Data does not appear to be in a KDBush format.");
|
||
const n2 = r2 >> 4;
|
||
if (1 !== n2) throw new Error(`Got v${n2} data when expected v1.`);
|
||
const i3 = Qc[15 & r2];
|
||
if (!i3) throw new Error("Unrecognized array type.");
|
||
const [a2] = new Uint16Array(t2, 2, 1), [s2] = new Uint32Array(t2, 4, 1);
|
||
return new th(s2, a2, i3, t2);
|
||
}
|
||
constructor(t2, e2 = 64, r2 = Float64Array, n2) {
|
||
if (isNaN(t2) || t2 < 0) throw new Error(`Unpexpected numItems value: ${t2}.`);
|
||
this.numItems = +t2, this.nodeSize = Math.min(Math.max(+e2, 2), 65535), this.ArrayType = r2, this.IndexArrayType = t2 < 65536 ? Uint16Array : Uint32Array;
|
||
const i3 = Qc.indexOf(this.ArrayType), a2 = 2 * t2 * this.ArrayType.BYTES_PER_ELEMENT, s2 = t2 * this.IndexArrayType.BYTES_PER_ELEMENT, o2 = (8 - s2 % 8) % 8;
|
||
if (i3 < 0) throw new Error(`Unexpected typed array class: ${r2}.`);
|
||
n2 && n2 instanceof ArrayBuffer ? (this.data = n2, this.ids = new this.IndexArrayType(this.data, 8, t2), this.coords = new this.ArrayType(this.data, 8 + s2 + o2, 2 * t2), this._pos = 2 * t2, this._finished = true) : (this.data = new ArrayBuffer(8 + a2 + s2 + o2), this.ids = new this.IndexArrayType(this.data, 8, t2), this.coords = new this.ArrayType(this.data, 8 + s2 + o2, 2 * t2), this._pos = 0, this._finished = false, new Uint8Array(this.data, 0, 2).set([219, 16 + i3]), new Uint16Array(this.data, 2, 1)[0] = e2, new Uint32Array(this.data, 4, 1)[0] = t2);
|
||
}
|
||
add(t2, e2) {
|
||
const r2 = this._pos >> 1;
|
||
return this.ids[r2] = r2, this.coords[this._pos++] = t2, this.coords[this._pos++] = e2, r2;
|
||
}
|
||
finish() {
|
||
const t2 = this._pos >> 1;
|
||
if (t2 !== this.numItems) throw new Error(`Added ${t2} items when expected ${this.numItems}.`);
|
||
return eh(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this;
|
||
}
|
||
range(t2, e2, r2, n2) {
|
||
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
||
const { ids: i3, coords: a2, nodeSize: s2 } = this, o2 = [0, i3.length - 1, 0], l2 = [];
|
||
for (; o2.length; ) {
|
||
const u2 = o2.pop() || 0, c2 = o2.pop() || 0, h2 = o2.pop() || 0;
|
||
if (c2 - h2 <= s2) {
|
||
for (let s3 = h2; s3 <= c2; s3++) {
|
||
const o3 = a2[2 * s3], u3 = a2[2 * s3 + 1];
|
||
o3 >= t2 && o3 <= r2 && u3 >= e2 && u3 <= n2 && l2.push(i3[s3]);
|
||
}
|
||
continue;
|
||
}
|
||
const p2 = h2 + c2 >> 1, f2 = a2[2 * p2], d2 = a2[2 * p2 + 1];
|
||
f2 >= t2 && f2 <= r2 && d2 >= e2 && d2 <= n2 && l2.push(i3[p2]), (0 === u2 ? t2 <= f2 : e2 <= d2) && (o2.push(h2), o2.push(p2 - 1), o2.push(1 - u2)), (0 === u2 ? r2 >= f2 : n2 >= d2) && (o2.push(p2 + 1), o2.push(c2), o2.push(1 - u2));
|
||
}
|
||
return l2;
|
||
}
|
||
within(t2, e2, r2) {
|
||
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
||
const { ids: n2, coords: i3, nodeSize: a2 } = this, s2 = [0, n2.length - 1, 0], o2 = [], l2 = r2 * r2;
|
||
for (; s2.length; ) {
|
||
const u2 = s2.pop() || 0, c2 = s2.pop() || 0, h2 = s2.pop() || 0;
|
||
if (c2 - h2 <= a2) {
|
||
for (let r3 = h2; r3 <= c2; r3++) ah(i3[2 * r3], i3[2 * r3 + 1], t2, e2) <= l2 && o2.push(n2[r3]);
|
||
continue;
|
||
}
|
||
const p2 = h2 + c2 >> 1, f2 = i3[2 * p2], d2 = i3[2 * p2 + 1];
|
||
ah(f2, d2, t2, e2) <= l2 && o2.push(n2[p2]), (0 === u2 ? t2 - r2 <= f2 : e2 - r2 <= d2) && (s2.push(h2), s2.push(p2 - 1), s2.push(1 - u2)), (0 === u2 ? t2 + r2 >= f2 : e2 + r2 >= d2) && (s2.push(p2 + 1), s2.push(c2), s2.push(1 - u2));
|
||
}
|
||
return o2;
|
||
}
|
||
}
|
||
function eh(t2, e2, r2, n2, i3, a2) {
|
||
if (i3 - n2 <= r2) return;
|
||
const s2 = n2 + i3 >> 1;
|
||
rh(t2, e2, s2, n2, i3, a2), eh(t2, e2, r2, n2, s2 - 1, 1 - a2), eh(t2, e2, r2, s2 + 1, i3, 1 - a2);
|
||
}
|
||
function rh(t2, e2, r2, n2, i3, a2) {
|
||
for (; i3 > n2; ) {
|
||
if (i3 - n2 > 600) {
|
||
const s3 = i3 - n2 + 1, o3 = r2 - n2 + 1, l3 = Math.log(s3), u2 = 0.5 * Math.exp(2 * l3 / 3), c2 = 0.5 * Math.sqrt(l3 * u2 * (s3 - u2) / s3) * (o3 - s3 / 2 < 0 ? -1 : 1);
|
||
rh(t2, e2, r2, Math.max(n2, Math.floor(r2 - o3 * u2 / s3 + c2)), Math.min(i3, Math.floor(r2 + (s3 - o3) * u2 / s3 + c2)), a2);
|
||
}
|
||
const s2 = e2[2 * r2 + a2];
|
||
let o2 = n2, l2 = i3;
|
||
for (nh(t2, e2, n2, r2), e2[2 * i3 + a2] > s2 && nh(t2, e2, n2, i3); o2 < l2; ) {
|
||
for (nh(t2, e2, o2, l2), o2++, l2--; e2[2 * o2 + a2] < s2; ) o2++;
|
||
for (; e2[2 * l2 + a2] > s2; ) l2--;
|
||
}
|
||
e2[2 * n2 + a2] === s2 ? nh(t2, e2, n2, l2) : (l2++, nh(t2, e2, l2, i3)), l2 <= r2 && (n2 = l2 + 1), r2 <= l2 && (i3 = l2 - 1);
|
||
}
|
||
}
|
||
function nh(t2, e2, r2, n2) {
|
||
ih(t2, r2, n2), ih(e2, 2 * r2, 2 * n2), ih(e2, 2 * r2 + 1, 2 * n2 + 1);
|
||
}
|
||
function ih(t2, e2, r2) {
|
||
const n2 = t2[e2];
|
||
t2[e2] = t2[r2], t2[r2] = n2;
|
||
}
|
||
function ah(t2, e2, r2, n2) {
|
||
const i3 = t2 - r2, a2 = e2 - n2;
|
||
return i3 * i3 + a2 * a2;
|
||
}
|
||
var sh;
|
||
t.bh = void 0, (sh = t.bh || (t.bh = {})).create = "create", sh.load = "load", sh.fullLoad = "fullLoad";
|
||
let oh = null, lh = [];
|
||
const uh = 1e3 / 60, ch = "loadTime", hh = "fullLoadTime", ph = { mark(t2) {
|
||
performance.mark(t2);
|
||
}, frame(t2) {
|
||
const e2 = t2;
|
||
null != oh && lh.push(e2 - oh), oh = e2;
|
||
}, clearMetrics() {
|
||
oh = null, lh = [], performance.clearMeasures(ch), performance.clearMeasures(hh);
|
||
for (const e2 in t.bh) performance.clearMarks(t.bh[e2]);
|
||
}, getPerformanceMetrics() {
|
||
performance.measure(ch, t.bh.create, t.bh.load), performance.measure(hh, t.bh.create, t.bh.fullLoad);
|
||
const e2 = performance.getEntriesByName(ch)[0].duration, r2 = performance.getEntriesByName(hh)[0].duration, n2 = lh.length, i3 = 1 / (lh.reduce(((t2, e3) => t2 + e3), 0) / n2 / 1e3), a2 = lh.filter(((t2) => t2 > uh)).reduce(((t2, e3) => t2 + (e3 - uh) / uh), 0);
|
||
return { loadTime: e2, fullLoadTime: r2, fps: i3, percentDroppedFrames: a2 / (n2 + a2) * 100, totalFrames: n2 };
|
||
} };
|
||
t.$ = function(t2, e2, r2) {
|
||
var n2, i3, a2, s2, o2, l2, u2, c2, h2, p2, f2, d2, y2 = r2[0], m2 = r2[1], g2 = r2[2];
|
||
return e2 === t2 ? (t2[12] = e2[0] * y2 + e2[4] * m2 + e2[8] * g2 + e2[12], t2[13] = e2[1] * y2 + e2[5] * m2 + e2[9] * g2 + e2[13], t2[14] = e2[2] * y2 + e2[6] * m2 + e2[10] * g2 + e2[14], t2[15] = e2[3] * y2 + e2[7] * m2 + e2[11] * g2 + e2[15]) : (i3 = e2[1], a2 = e2[2], s2 = e2[3], o2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], t2[0] = n2 = e2[0], t2[1] = i3, t2[2] = a2, t2[3] = s2, t2[4] = o2, t2[5] = l2, t2[6] = u2, t2[7] = c2, t2[8] = h2, t2[9] = p2, t2[10] = f2, t2[11] = d2, t2[12] = n2 * y2 + o2 * m2 + h2 * g2 + e2[12], t2[13] = i3 * y2 + l2 * m2 + p2 * g2 + e2[13], t2[14] = a2 * y2 + u2 * m2 + f2 * g2 + e2[14], t2[15] = s2 * y2 + c2 * m2 + d2 * g2 + e2[15]), t2;
|
||
}, t.A = zs, t.B = Ze, t.C = class {
|
||
constructor(t2, e2, r2) {
|
||
this.receive = (t3) => {
|
||
const e3 = t3.data, r3 = e3.id;
|
||
if (r3 && (!e3.targetMapId || this.mapId === e3.targetMapId)) if ("<cancel>" === e3.type) {
|
||
delete this.tasks[r3];
|
||
const t4 = this.cancelCallbacks[r3];
|
||
delete this.cancelCallbacks[r3], t4 && t4();
|
||
} else I() || e3.mustQueue ? (this.tasks[r3] = e3, this.taskQueue.push(r3), this.invoker.trigger()) : this.processTask(r3, e3);
|
||
}, this.process = () => {
|
||
if (!this.taskQueue.length) return;
|
||
const t3 = this.taskQueue.shift(), e3 = this.tasks[t3];
|
||
delete this.tasks[t3], this.taskQueue.length && this.invoker.trigger(), e3 && this.processTask(t3, e3);
|
||
}, this.target = t2, this.parent = e2, this.mapId = r2, this.callbacks = {}, this.tasks = {}, this.taskQueue = [], this.cancelCallbacks = {}, this.invoker = new Qu(this.process), this.target.addEventListener("message", this.receive, false), this.globalScope = I() ? t2 : window;
|
||
}
|
||
send(t2, e2, r2, n2, i3 = false) {
|
||
const a2 = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
|
||
r2 && (this.callbacks[a2] = r2);
|
||
const s2 = [], o2 = { id: a2, type: t2, hasCallback: !!r2, targetMapId: n2, mustQueue: i3, sourceMapId: this.mapId, data: Dn(e2, s2) };
|
||
return this.target.postMessage(o2, { transfer: s2 }), { cancel: () => {
|
||
r2 && delete this.callbacks[a2], this.target.postMessage({ id: a2, type: "<cancel>", targetMapId: n2, sourceMapId: this.mapId });
|
||
} };
|
||
}
|
||
processTask(t2, e2) {
|
||
if ("<response>" === e2.type) {
|
||
const r2 = this.callbacks[t2];
|
||
delete this.callbacks[t2], r2 && (e2.error ? r2(On(e2.error)) : r2(null, On(e2.data)));
|
||
} else {
|
||
let r2 = false;
|
||
const n2 = [], i3 = e2.hasCallback ? (e3, i4) => {
|
||
r2 = true, delete this.cancelCallbacks[t2];
|
||
const a3 = { id: t2, type: "<response>", sourceMapId: this.mapId, error: e3 ? Dn(e3) : null, data: Dn(i4, n2) };
|
||
this.target.postMessage(a3, { transfer: n2 });
|
||
} : (t3) => {
|
||
r2 = true;
|
||
};
|
||
let a2 = null;
|
||
const s2 = On(e2.data);
|
||
if (this.parent[e2.type]) a2 = this.parent[e2.type](e2.sourceMapId, s2, i3);
|
||
else if ("getWorkerSource" in this.parent) {
|
||
const t3 = e2.type.split(".");
|
||
a2 = this.parent.getWorkerSource(e2.sourceMapId, t3[0], s2.source)[t3[1]](s2, i3);
|
||
} else i3(new Error(`Could not find function ${e2.type}`));
|
||
!r2 && a2 && a2.cancel && (this.cancelCallbacks[t2] = a2.cancel);
|
||
}
|
||
}
|
||
remove() {
|
||
this.invoker.remove(), this.target.removeEventListener("message", this.receive, false);
|
||
}
|
||
}, t.D = gi, t.E = J, t.F = function(t2, e2) {
|
||
const r2 = {};
|
||
for (let n2 = 0; n2 < e2.length; n2++) {
|
||
const i3 = e2[n2];
|
||
i3 in t2 && (r2[i3] = t2[i3]);
|
||
}
|
||
return r2;
|
||
}, t.G = ic, t.H = ac, t.I = uu, t.J = h, t.K = p, t.L = ec, t.M = B, t.N = rs, t.O = fc, t.P = a, t.Q = Mi, t.R = qs, t.S = za, t.T = hi, t.U = uc, t.V = class extends Vi {
|
||
}, t.W = hc, t.X = function(t2, e2) {
|
||
const r2 = window.document.createElement("video");
|
||
r2.muted = true, r2.onloadstart = function() {
|
||
e2(null, r2);
|
||
};
|
||
for (let e3 = 0; e3 < t2.length; e3++) {
|
||
const n2 = window.document.createElement("source");
|
||
j(t2[e3]) || (r2.crossOrigin = "Anonymous"), n2.src = t2[e3], r2.appendChild(n2);
|
||
}
|
||
return { cancel: () => {
|
||
} };
|
||
}, t.Y = ot, t.Z = function() {
|
||
var t2 = new zs(16);
|
||
return zs != Float32Array && (t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0), t2[0] = 1, t2[5] = 1, t2[10] = 1, t2[15] = 1, t2;
|
||
}, t._ = e, t.a = M, t.a$ = class extends Hi {
|
||
}, t.a0 = function(t2, e2, r2) {
|
||
var n2 = r2[0], i3 = r2[1], a2 = r2[2];
|
||
return t2[0] = e2[0] * n2, t2[1] = e2[1] * n2, t2[2] = e2[2] * n2, t2[3] = e2[3] * n2, t2[4] = e2[4] * i3, t2[5] = e2[5] * i3, t2[6] = e2[6] * i3, t2[7] = e2[7] * i3, t2[8] = e2[8] * a2, t2[9] = e2[9] * a2, t2[10] = e2[10] * a2, t2[11] = e2[11] * a2, t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15], t2;
|
||
}, t.a1 = Cs, t.a2 = function() {
|
||
return x++;
|
||
}, t.a3 = ta, t.a4 = Uu, t.a5 = function() {
|
||
oi.isLoading() || oi.isLoaded() || "deferred" !== ai() || si();
|
||
}, t.a6 = Nr, t.a7 = ss, t.a8 = li, t.a9 = gc, t.aA = ri, t.aB = function(t2) {
|
||
t2 = t2.slice();
|
||
const e2 = /* @__PURE__ */ Object.create(null);
|
||
for (let r2 = 0; r2 < t2.length; r2++) e2[t2[r2].id] = t2[r2];
|
||
for (let r2 = 0; r2 < t2.length; r2++) "ref" in t2[r2] && (t2[r2] = H(t2[r2], e2[t2[r2].ref]));
|
||
return t2;
|
||
}, t.aC = function(t2) {
|
||
if ("custom" === t2.type) return new Wu(t2);
|
||
switch (t2.type) {
|
||
case "background":
|
||
return new Ju(t2);
|
||
case "circle":
|
||
return new Es(t2);
|
||
case "fill":
|
||
return new Lo(t2);
|
||
case "fill-extrusion":
|
||
return new ol(t2);
|
||
case "heatmap":
|
||
return new Ns(t2);
|
||
case "hillshade":
|
||
return new Gs(t2);
|
||
case "line":
|
||
return new Al(t2);
|
||
case "raster":
|
||
return new Hu(t2);
|
||
case "symbol":
|
||
return new Zu(t2);
|
||
}
|
||
}, t.aD = w, t.aE = function(t2, e2) {
|
||
if (!t2) return [{ command: Q.setStyle, args: [e2] }];
|
||
let r2 = [];
|
||
try {
|
||
if (!W(t2.version, e2.version)) return [{ command: Q.setStyle, args: [e2] }];
|
||
W(t2.center, e2.center) || r2.push({ command: Q.setCenter, args: [e2.center] }), W(t2.zoom, e2.zoom) || r2.push({ command: Q.setZoom, args: [e2.zoom] }), W(t2.bearing, e2.bearing) || r2.push({ command: Q.setBearing, args: [e2.bearing] }), W(t2.pitch, e2.pitch) || r2.push({ command: Q.setPitch, args: [e2.pitch] }), W(t2.sprite, e2.sprite) || r2.push({ command: Q.setSprite, args: [e2.sprite] }), W(t2.glyphs, e2.glyphs) || r2.push({ command: Q.setGlyphs, args: [e2.glyphs] }), W(t2.transition, e2.transition) || r2.push({ command: Q.setTransition, args: [e2.transition] }), W(t2.light, e2.light) || r2.push({ command: Q.setLight, args: [e2.light] });
|
||
const n2 = {}, i3 = [];
|
||
!(function(t3, e3, r3, n3) {
|
||
let i4;
|
||
for (i4 in e3 = e3 || {}, t3 = t3 || {}) Object.prototype.hasOwnProperty.call(t3, i4) && (Object.prototype.hasOwnProperty.call(e3, i4) || et(i4, r3, n3));
|
||
for (i4 in e3) Object.prototype.hasOwnProperty.call(e3, i4) && (Object.prototype.hasOwnProperty.call(t3, i4) ? W(t3[i4], e3[i4]) || ("geojson" === t3[i4].type && "geojson" === e3[i4].type && nt(t3, e3, i4) ? r3.push({ command: Q.setGeoJSONSourceData, args: [i4, e3[i4].data] }) : rt(i4, e3, r3, n3)) : tt(i4, e3, r3));
|
||
})(t2.sources, e2.sources, i3, n2);
|
||
const a2 = [];
|
||
t2.layers && t2.layers.forEach(((t3) => {
|
||
n2[t3.source] ? r2.push({ command: Q.removeLayer, args: [t3.id] }) : a2.push(t3);
|
||
})), r2 = r2.concat(i3), (function(t3, e3, r3) {
|
||
e3 = e3 || [];
|
||
const n3 = (t3 = t3 || []).map(at), i4 = e3.map(at), a3 = t3.reduce(st, {}), s2 = e3.reduce(st, {}), o2 = n3.slice(), l2 = /* @__PURE__ */ Object.create(null);
|
||
let u2, c2, h2, p2, f2, d2, y2;
|
||
for (u2 = 0, c2 = 0; u2 < n3.length; u2++) h2 = n3[u2], Object.prototype.hasOwnProperty.call(s2, h2) ? c2++ : (r3.push({ command: Q.removeLayer, args: [h2] }), o2.splice(o2.indexOf(h2, c2), 1));
|
||
for (u2 = 0, c2 = 0; u2 < i4.length; u2++) h2 = i4[i4.length - 1 - u2], o2[o2.length - 1 - u2] !== h2 && (Object.prototype.hasOwnProperty.call(a3, h2) ? (r3.push({ command: Q.removeLayer, args: [h2] }), o2.splice(o2.lastIndexOf(h2, o2.length - c2), 1)) : c2++, d2 = o2[o2.length - u2], r3.push({ command: Q.addLayer, args: [s2[h2], d2] }), o2.splice(o2.length - u2, 0, h2), l2[h2] = true);
|
||
for (u2 = 0; u2 < i4.length; u2++) if (h2 = i4[u2], p2 = a3[h2], f2 = s2[h2], !l2[h2] && !W(p2, f2)) if (W(p2.source, f2.source) && W(p2["source-layer"], f2["source-layer"]) && W(p2.type, f2.type)) {
|
||
for (y2 in it(p2.layout, f2.layout, r3, h2, null, Q.setLayoutProperty), it(p2.paint, f2.paint, r3, h2, null, Q.setPaintProperty), W(p2.filter, f2.filter) || r3.push({ command: Q.setFilter, args: [h2, f2.filter] }), W(p2.minzoom, f2.minzoom) && W(p2.maxzoom, f2.maxzoom) || r3.push({ command: Q.setLayerZoomRange, args: [h2, f2.minzoom, f2.maxzoom] }), p2) Object.prototype.hasOwnProperty.call(p2, y2) && "layout" !== y2 && "paint" !== y2 && "filter" !== y2 && "metadata" !== y2 && "minzoom" !== y2 && "maxzoom" !== y2 && (0 === y2.indexOf("paint.") ? it(p2[y2], f2[y2], r3, h2, y2.slice(6), Q.setPaintProperty) : W(p2[y2], f2[y2]) || r3.push({ command: Q.setLayerProperty, args: [h2, y2, f2[y2]] }));
|
||
for (y2 in f2) Object.prototype.hasOwnProperty.call(f2, y2) && !Object.prototype.hasOwnProperty.call(p2, y2) && "layout" !== y2 && "paint" !== y2 && "filter" !== y2 && "metadata" !== y2 && "minzoom" !== y2 && "maxzoom" !== y2 && (0 === y2.indexOf("paint.") ? it(p2[y2], f2[y2], r3, h2, y2.slice(6), Q.setPaintProperty) : W(p2[y2], f2[y2]) || r3.push({ command: Q.setLayerProperty, args: [h2, y2, f2[y2]] }));
|
||
} else r3.push({ command: Q.removeLayer, args: [h2] }), d2 = o2[o2.lastIndexOf(h2) + 1], r3.push({ command: Q.addLayer, args: [f2, d2] });
|
||
})(a2, e2.layers, r2);
|
||
} catch (t3) {
|
||
console.warn("Unable to compute style diff:", t3), r2 = [{ command: Q.setStyle, args: [e2] }];
|
||
}
|
||
return r2;
|
||
}, t.aF = function(t2) {
|
||
const e2 = [], r2 = t2.id;
|
||
return void 0 === r2 && e2.push({ message: `layers.${r2}: missing required property "id"` }), void 0 === t2.render && e2.push({ message: `layers.${r2}: missing required method "render"` }), t2.renderingMode && "2d" !== t2.renderingMode && "3d" !== t2.renderingMode && e2.push({ message: `layers.${r2}: property "renderingMode" must be either "2d" or "3d"` }), e2;
|
||
}, t.aG = function t2(e2, r2) {
|
||
if (Array.isArray(e2)) {
|
||
if (!Array.isArray(r2) || e2.length !== r2.length) return false;
|
||
for (let n2 = 0; n2 < e2.length; n2++) if (!t2(e2[n2], r2[n2])) return false;
|
||
return true;
|
||
}
|
||
if ("object" == typeof e2 && null !== e2 && null !== r2) {
|
||
if ("object" != typeof r2) return false;
|
||
if (Object.keys(e2).length !== Object.keys(r2).length) return false;
|
||
for (const n2 in e2) if (!t2(e2[n2], r2[n2])) return false;
|
||
return true;
|
||
}
|
||
return e2 === r2;
|
||
}, t.aH = v, t.aI = b, t.aJ = ii, t.aK = function(t2) {
|
||
return t2({ pluginStatus: ti, pluginURL: ei }), ii.on("pluginStateChange", t2), t2;
|
||
}, t.aL = class extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = 0;
|
||
}
|
||
set(t2) {
|
||
this.current !== t2 && (this.current = t2, this.gl.uniform1i(this.location, t2));
|
||
}
|
||
}, t.aM = qa, t.aN = class extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = Za;
|
||
}
|
||
set(t2) {
|
||
if (t2[12] !== this.current[12] || t2[0] !== this.current[0]) return this.current = t2, void this.gl.uniformMatrix4fv(this.location, false, t2);
|
||
for (let e2 = 1; e2 < 16; e2++) if (t2[e2] !== this.current[e2]) {
|
||
this.current = t2, this.gl.uniformMatrix4fv(this.location, false, t2);
|
||
break;
|
||
}
|
||
}
|
||
}, t.aO = ja, t.aP = class extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = [0, 0, 0];
|
||
}
|
||
set(t2) {
|
||
t2[0] === this.current[0] && t2[1] === this.current[1] && t2[2] === this.current[2] || (this.current = t2, this.gl.uniform3f(this.location, t2[0], t2[1], t2[2]));
|
||
}
|
||
}, t.aQ = class extends Ra {
|
||
constructor(t2, e2) {
|
||
super(t2, e2), this.current = [0, 0];
|
||
}
|
||
set(t2) {
|
||
t2[0] === this.current[0] && t2[1] === this.current[1] || (this.current = t2, this.gl.uniform2f(this.location, t2[0], t2[1]));
|
||
}
|
||
}, t.aR = Na, t.aS = function(t2, e2, r2, n2, i3, a2, s2) {
|
||
var o2 = 1 / (e2 - r2), l2 = 1 / (n2 - i3), u2 = 1 / (a2 - s2);
|
||
return t2[0] = -2 * o2, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = -2 * l2, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = 2 * u2, t2[11] = 0, t2[12] = (e2 + r2) * o2, t2[13] = (i3 + n2) * l2, t2[14] = (s2 + a2) * u2, t2[15] = 1, t2;
|
||
}, t.aT = Yt, t.aU = Ps, t.aV = class extends qi {
|
||
}, t.aW = Cl, t.aX = class extends Ni {
|
||
}, t.aY = function(t2) {
|
||
return t2 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t2) / Math.LN2));
|
||
}, t.aZ = js, t.a_ = ha, t.aa = function(t2) {
|
||
const e2 = {};
|
||
if (t2.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, ((t3, r2, n2, i3) => {
|
||
const a2 = n2 || i3;
|
||
return e2[r2] = !a2 || a2.toLowerCase(), "";
|
||
})), e2["max-age"]) {
|
||
const t3 = parseInt(e2["max-age"], 10);
|
||
isNaN(t3) ? delete e2["max-age"] : e2["max-age"] = t3;
|
||
}
|
||
return e2;
|
||
}, t.ab = function(t2, e2) {
|
||
const r2 = [];
|
||
for (const n2 in t2) n2 in e2 || r2.push(n2);
|
||
return r2;
|
||
}, t.ac = function(t2) {
|
||
if (null == z) {
|
||
const e2 = t2.navigator ? t2.navigator.userAgent : null;
|
||
z = !!t2.safari || !(!e2 || !(/\b(iPad|iPhone|iPod)\b/.test(e2) || e2.match("Safari") && !e2.match("Chrome")));
|
||
}
|
||
return z;
|
||
}, t.ad = y, t.ae = function(t2, e2, r2) {
|
||
var n2 = Math.sin(r2), i3 = Math.cos(r2), a2 = e2[0], s2 = e2[1], o2 = e2[2], l2 = e2[3], u2 = e2[4], c2 = e2[5], h2 = e2[6], p2 = e2[7];
|
||
return e2 !== t2 && (t2[8] = e2[8], t2[9] = e2[9], t2[10] = e2[10], t2[11] = e2[11], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15]), t2[0] = a2 * i3 + u2 * n2, t2[1] = s2 * i3 + c2 * n2, t2[2] = o2 * i3 + h2 * n2, t2[3] = l2 * i3 + p2 * n2, t2[4] = u2 * i3 - a2 * n2, t2[5] = c2 * i3 - s2 * n2, t2[6] = h2 * i3 - o2 * n2, t2[7] = p2 * i3 - l2 * n2, t2;
|
||
}, t.af = function(t2) {
|
||
var e2 = new zs(16);
|
||
return e2[0] = t2[0], e2[1] = t2[1], e2[2] = t2[2], e2[3] = t2[3], e2[4] = t2[4], e2[5] = t2[5], e2[6] = t2[6], e2[7] = t2[7], e2[8] = t2[8], e2[9] = t2[9], e2[10] = t2[10], e2[11] = t2[11], e2[12] = t2[12], e2[13] = t2[13], e2[14] = t2[14], e2[15] = t2[15], e2;
|
||
}, t.ag = Vs, t.ah = function(t2, e2) {
|
||
let r2 = 0, n2 = 0;
|
||
if ("constant" === t2.kind) n2 = t2.layoutSize;
|
||
else if ("source" !== t2.kind) {
|
||
const { interpolationType: i3, minZoom: a2, maxZoom: s2 } = t2, o2 = i3 ? y(Ke.interpolationFactor(i3, e2, a2, s2), 0, 1) : 0;
|
||
"camera" === t2.kind ? n2 = Ze.number(t2.minSize, t2.maxSize, o2) : r2 = o2;
|
||
}
|
||
return { uSizeT: r2, uSize: n2 };
|
||
}, t.aj = function(t2, { uSize: e2, uSizeT: r2 }, { lowerSize: n2, upperSize: i3 }) {
|
||
return "source" === t2.kind ? n2 / Cu : "composite" === t2.kind ? Ze.number(n2 / Cu, i3 / Cu, r2) : e2;
|
||
}, t.ak = $u, t.al = function(t2, e2, r2, n2) {
|
||
const i3 = e2.y - t2.y, s2 = e2.x - t2.x, o2 = n2.y - r2.y, l2 = n2.x - r2.x, u2 = o2 * s2 - l2 * i3;
|
||
if (0 === u2) return null;
|
||
const c2 = (l2 * (t2.y - r2.y) - o2 * (t2.x - r2.x)) / u2;
|
||
return new a(t2.x + c2 * s2, t2.y + c2 * i3);
|
||
}, t.am = _c, t.an = us, t.ao = Ms, t.ap = Vl, t.ar = Vu, t.as = function(t2, e2) {
|
||
var r2 = e2[0], n2 = e2[1], i3 = e2[2], a2 = e2[3], s2 = e2[4], o2 = e2[5], l2 = e2[6], u2 = e2[7], c2 = e2[8], h2 = e2[9], p2 = e2[10], f2 = e2[11], d2 = e2[12], y2 = e2[13], m2 = e2[14], g2 = e2[15], x2 = r2 * o2 - n2 * s2, v2 = r2 * l2 - i3 * s2, b2 = r2 * u2 - a2 * s2, w2 = n2 * l2 - i3 * o2, _2 = n2 * u2 - a2 * o2, A2 = i3 * u2 - a2 * l2, S2 = c2 * y2 - h2 * d2, k2 = c2 * m2 - p2 * d2, I2 = c2 * g2 - f2 * d2, z2 = h2 * m2 - p2 * y2, M2 = h2 * g2 - f2 * y2, C2 = p2 * g2 - f2 * m2, B2 = x2 * C2 - v2 * M2 + b2 * z2 + w2 * I2 - _2 * k2 + A2 * S2;
|
||
return B2 ? (t2[0] = (o2 * C2 - l2 * M2 + u2 * z2) * (B2 = 1 / B2), t2[1] = (i3 * M2 - n2 * C2 - a2 * z2) * B2, t2[2] = (y2 * A2 - m2 * _2 + g2 * w2) * B2, t2[3] = (p2 * _2 - h2 * A2 - f2 * w2) * B2, t2[4] = (l2 * I2 - s2 * C2 - u2 * k2) * B2, t2[5] = (r2 * C2 - i3 * I2 + a2 * k2) * B2, t2[6] = (m2 * b2 - d2 * A2 - g2 * v2) * B2, t2[7] = (c2 * A2 - p2 * b2 + f2 * v2) * B2, t2[8] = (s2 * M2 - o2 * I2 + u2 * S2) * B2, t2[9] = (n2 * I2 - r2 * M2 - a2 * S2) * B2, t2[10] = (d2 * _2 - y2 * b2 + g2 * x2) * B2, t2[11] = (h2 * b2 - c2 * _2 - f2 * x2) * B2, t2[12] = (o2 * k2 - s2 * z2 - l2 * S2) * B2, t2[13] = (r2 * z2 - n2 * k2 + i3 * S2) * B2, t2[14] = (y2 * v2 - d2 * w2 - m2 * x2) * B2, t2[15] = (c2 * w2 - h2 * v2 + p2 * x2) * B2, t2) : null;
|
||
}, t.at = Jc, t.au = Su, t.av = th, t.aw = function() {
|
||
const t2 = {}, e2 = X.$version;
|
||
for (const r2 in X.$root) {
|
||
const n2 = X.$root[r2];
|
||
if (n2.required) {
|
||
let i3 = null;
|
||
i3 = "version" === r2 ? e2 : "array" === n2.type ? [] : {}, null != i3 && (t2[r2] = i3);
|
||
}
|
||
}
|
||
return t2;
|
||
}, t.ax = Q, t.ay = Un, t.az = D, t.b = function(t2, e2) {
|
||
const r2 = new Blob([new Uint8Array(t2)], { type: "image/png" });
|
||
createImageBitmap(r2).then(((t3) => {
|
||
e2(null, t3);
|
||
})).catch(((t3) => {
|
||
e2(new Error(`Could not load image because of ${t3.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));
|
||
}));
|
||
}, t.b0 = Aa, t.b1 = function(t2, e2) {
|
||
var r2 = t2[0], n2 = t2[1], i3 = t2[2], a2 = t2[3], s2 = t2[4], o2 = t2[5], l2 = t2[6], u2 = t2[7], c2 = t2[8], h2 = t2[9], p2 = t2[10], f2 = t2[11], d2 = t2[12], y2 = t2[13], m2 = t2[14], g2 = t2[15], x2 = e2[0], v2 = e2[1], b2 = e2[2], w2 = e2[3], _2 = e2[4], A2 = e2[5], S2 = e2[6], k2 = e2[7], I2 = e2[8], z2 = e2[9], M2 = e2[10], C2 = e2[11], B2 = e2[12], P2 = e2[13], V2 = e2[14], E2 = e2[15];
|
||
return Math.abs(r2 - x2) <= Is * Math.max(1, Math.abs(r2), Math.abs(x2)) && Math.abs(n2 - v2) <= Is * Math.max(1, Math.abs(n2), Math.abs(v2)) && Math.abs(i3 - b2) <= Is * Math.max(1, Math.abs(i3), Math.abs(b2)) && Math.abs(a2 - w2) <= Is * Math.max(1, Math.abs(a2), Math.abs(w2)) && Math.abs(s2 - _2) <= Is * Math.max(1, Math.abs(s2), Math.abs(_2)) && Math.abs(o2 - A2) <= Is * Math.max(1, Math.abs(o2), Math.abs(A2)) && Math.abs(l2 - S2) <= Is * Math.max(1, Math.abs(l2), Math.abs(S2)) && Math.abs(u2 - k2) <= Is * Math.max(1, Math.abs(u2), Math.abs(k2)) && Math.abs(c2 - I2) <= Is * Math.max(1, Math.abs(c2), Math.abs(I2)) && Math.abs(h2 - z2) <= Is * Math.max(1, Math.abs(h2), Math.abs(z2)) && Math.abs(p2 - M2) <= Is * Math.max(1, Math.abs(p2), Math.abs(M2)) && Math.abs(f2 - C2) <= Is * Math.max(1, Math.abs(f2), Math.abs(C2)) && Math.abs(d2 - B2) <= Is * Math.max(1, Math.abs(d2), Math.abs(B2)) && Math.abs(y2 - P2) <= Is * Math.max(1, Math.abs(y2), Math.abs(P2)) && Math.abs(m2 - V2) <= Is * Math.max(1, Math.abs(m2), Math.abs(V2)) && Math.abs(g2 - E2) <= Is * Math.max(1, Math.abs(g2), Math.abs(E2));
|
||
}, t.b2 = function(t2, e2) {
|
||
return t2[0] = e2[0], t2[1] = e2[1], t2[2] = e2[2], t2[3] = e2[3], t2[4] = e2[4], t2[5] = e2[5], t2[6] = e2[6], t2[7] = e2[7], t2[8] = e2[8], t2[9] = e2[9], t2[10] = e2[10], t2[11] = e2[11], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15], t2;
|
||
}, t.b3 = function(t2, e2, r2) {
|
||
return t2[0] = e2[0] * r2[0], t2[1] = e2[1] * r2[1], t2[2] = e2[2] * r2[2], t2[3] = e2[3] * r2[3], t2;
|
||
}, t.b4 = function(t2, e2) {
|
||
return t2[0] * e2[0] + t2[1] * e2[1] + t2[2] * e2[2] + t2[3] * e2[3];
|
||
}, t.b5 = m, t.b6 = pc, t.b7 = sc, t.b8 = function(t2, e2, r2, n2, i3) {
|
||
var a2, s2 = 1 / Math.tan(e2 / 2);
|
||
return t2[0] = s2 / r2, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = s2, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[11] = -1, t2[12] = 0, t2[13] = 0, t2[15] = 0, null != i3 && i3 !== 1 / 0 ? (t2[10] = (i3 + n2) * (a2 = 1 / (n2 - i3)), t2[14] = 2 * i3 * n2 * a2) : (t2[10] = -1, t2[14] = -2 * n2), t2;
|
||
}, t.b9 = function(t2, e2, r2) {
|
||
var n2 = Math.sin(r2), i3 = Math.cos(r2), a2 = e2[4], s2 = e2[5], o2 = e2[6], l2 = e2[7], u2 = e2[8], c2 = e2[9], h2 = e2[10], p2 = e2[11];
|
||
return e2 !== t2 && (t2[0] = e2[0], t2[1] = e2[1], t2[2] = e2[2], t2[3] = e2[3], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15]), t2[4] = a2 * i3 + u2 * n2, t2[5] = s2 * i3 + c2 * n2, t2[6] = o2 * i3 + h2 * n2, t2[7] = l2 * i3 + p2 * n2, t2[8] = u2 * i3 - a2 * n2, t2[9] = c2 * i3 - s2 * n2, t2[10] = h2 * i3 - o2 * n2, t2[11] = p2 * i3 - l2 * n2, t2;
|
||
}, t.bA = n, t.bB = El, t.bC = $r, t.bD = oi, t.ba = f, t.bb = d, t.bc = function(t2, e2) {
|
||
return t2[0] = e2[0], t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = e2[1], t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = e2[2], t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0, t2[15] = 1, t2;
|
||
}, t.bd = class extends Pi {
|
||
}, t.be = tc, t.bf = oc, t.bg = ph, t.bi = L, t.bj = function(t2, e2, r2 = false) {
|
||
if (ti === Yn || ti === Hn || ti === Wn) throw new Error("setRTLTextPlugin cannot be called multiple times.");
|
||
ei = T.resolveURL(t2), ti = Yn, Qn = e2, ni(), r2 || si();
|
||
}, t.bk = ai, t.bl = function(t2, e2) {
|
||
const r2 = {};
|
||
for (let n3 = 0; n3 < t2.length; n3++) {
|
||
const i3 = e2 && e2[t2[n3].id] || Qr(t2[n3]);
|
||
e2 && (e2[t2[n3].id] = i3);
|
||
let a2 = r2[i3];
|
||
a2 || (a2 = r2[i3] = []), a2.push(t2[n3]);
|
||
}
|
||
const n2 = [];
|
||
for (const t3 in r2) n2.push(r2[t3]);
|
||
return n2;
|
||
}, t.bm = $n, t.bn = mc, t.bo = xc, t.bp = cu, t.bq = function(e2) {
|
||
e2.bucket.createArrays(), e2.bucket.tilePixelRatio = rs / (512 * e2.bucket.overscaling), e2.bucket.compareText = {}, e2.bucket.iconsNeedLinear = false;
|
||
const r2 = e2.bucket.layers[0], n2 = r2.layout, i3 = r2._unevaluatedLayout._values, a2 = { layoutIconSize: i3["icon-size"].possiblyEvaluate(new li(e2.bucket.zoom + 1), e2.canonical), layoutTextSize: i3["text-size"].possiblyEvaluate(new li(e2.bucket.zoom + 1), e2.canonical), textMaxSize: i3["text-size"].possiblyEvaluate(new li(18)) };
|
||
if ("composite" === e2.bucket.textSizeData.kind) {
|
||
const { minZoom: t2, maxZoom: r3 } = e2.bucket.textSizeData;
|
||
a2.compositeTextSizes = [i3["text-size"].possiblyEvaluate(new li(t2), e2.canonical), i3["text-size"].possiblyEvaluate(new li(r3), e2.canonical)];
|
||
}
|
||
if ("composite" === e2.bucket.iconSizeData.kind) {
|
||
const { minZoom: t2, maxZoom: r3 } = e2.bucket.iconSizeData;
|
||
a2.compositeIconSizes = [i3["icon-size"].possiblyEvaluate(new li(t2), e2.canonical), i3["icon-size"].possiblyEvaluate(new li(r3), e2.canonical)];
|
||
}
|
||
const s2 = n2.get("text-line-height") * Vl, o2 = "viewport" !== n2.get("text-rotation-alignment") && "point" !== n2.get("symbol-placement"), l2 = n2.get("text-keep-upright"), u2 = n2.get("text-size");
|
||
for (const i4 of e2.bucket.features) {
|
||
const c2 = n2.get("text-font").evaluate(i4, {}, e2.canonical).join(","), h2 = u2.evaluate(i4, {}, e2.canonical), p2 = a2.layoutTextSize.evaluate(i4, {}, e2.canonical), f2 = a2.layoutIconSize.evaluate(i4, {}, e2.canonical), d2 = { horizontal: {}, vertical: void 0 }, y2 = i4.text;
|
||
let m2, g2 = [0, 0];
|
||
if (y2) {
|
||
const a3 = y2.toString(), u3 = n2.get("text-letter-spacing").evaluate(i4, {}, e2.canonical) * Vl, f3 = jn(a3) ? u3 : 0, m3 = n2.get("text-anchor").evaluate(i4, {}, e2.canonical), x3 = Gc(r2, i4, e2.canonical);
|
||
if (!x3) {
|
||
const t2 = n2.get("text-radial-offset").evaluate(i4, {}, e2.canonical);
|
||
g2 = t2 ? Kc(m3, [t2 * Vl, Zc]) : n2.get("text-offset").evaluate(i4, {}, e2.canonical).map(((t3) => t3 * Vl));
|
||
}
|
||
let v3 = o2 ? "center" : n2.get("text-justify").evaluate(i4, {}, e2.canonical);
|
||
const b2 = n2.get("symbol-placement"), w2 = "point" === b2 ? n2.get("text-max-width").evaluate(i4, {}, e2.canonical) * Vl : 0, _2 = () => {
|
||
e2.bucket.allowVerticalPlacement && qn(a3) && (d2.vertical = yu(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, w2, s2, m3, "left", f3, g2, t.ai.vertical, true, b2, p2, h2));
|
||
};
|
||
if (!o2 && x3) {
|
||
const r3 = /* @__PURE__ */ new Set();
|
||
if ("auto" === v3) for (let t2 = 0; t2 < x3.values.length; t2 += 2) r3.add(Jc(x3.values[t2]));
|
||
else r3.add(v3);
|
||
let n3 = false;
|
||
for (const i5 of r3) if (!d2.horizontal[i5]) if (n3) d2.horizontal[i5] = d2.horizontal[0];
|
||
else {
|
||
const r4 = yu(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, w2, s2, "center", i5, f3, g2, t.ai.horizontal, false, b2, p2, h2);
|
||
r4 && (d2.horizontal[i5] = r4, n3 = 1 === r4.positionedLines.length);
|
||
}
|
||
_2();
|
||
} else {
|
||
"auto" === v3 && (v3 = Jc(m3));
|
||
const r3 = yu(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, w2, s2, m3, v3, f3, g2, t.ai.horizontal, false, b2, p2, h2);
|
||
r3 && (d2.horizontal[v3] = r3), _2(), qn(a3) && o2 && l2 && (d2.vertical = yu(y2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, c2, w2, s2, m3, v3, f3, g2, t.ai.vertical, false, b2, p2, h2));
|
||
}
|
||
}
|
||
let x2 = false;
|
||
if (i4.icon && i4.icon.name) {
|
||
const t2 = e2.imageMap[i4.icon.name];
|
||
t2 && (m2 = Iu(e2.imagePositions[i4.icon.name], n2.get("icon-offset").evaluate(i4, {}, e2.canonical), n2.get("icon-anchor").evaluate(i4, {}, e2.canonical)), x2 = !!t2.sdf, void 0 === e2.bucket.sdfIcons ? e2.bucket.sdfIcons = x2 : e2.bucket.sdfIcons !== x2 && A("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (t2.pixelRatio !== e2.bucket.pixelRatio || 0 !== n2.get("icon-rotate").constantOr(1)) && (e2.bucket.iconsNeedLinear = true));
|
||
}
|
||
const v2 = Hc(d2.horizontal) || d2.vertical;
|
||
e2.bucket.iconsInText = !!v2 && v2.iconsInText, (v2 || m2) && Xc(e2.bucket, i4, d2, m2, e2.imageMap, a2, p2, f2, g2, x2, e2.canonical);
|
||
}
|
||
e2.showCollisionBoxes && e2.bucket.generateCollisionDebugBuffers();
|
||
}, t.br = gl, t.bs = Eo, t.bt = rl, t.bu = class {
|
||
constructor(t2) {
|
||
this._marks = { start: [t2.url, "start"].join("#"), end: [t2.url, "end"].join("#"), measure: t2.url.toString() }, performance.mark(this._marks.start);
|
||
}
|
||
finish() {
|
||
performance.mark(this._marks.end);
|
||
let t2 = performance.getEntriesByName(this._marks.measure);
|
||
return 0 === t2.length && (performance.measure(this._marks.measure, this._marks.start, this._marks.end), t2 = performance.getEntriesByName(this._marks.measure), performance.clearMarks(this._marks.start), performance.clearMarks(this._marks.end), performance.clearMeasures(this._marks.measure)), t2;
|
||
}
|
||
}, t.bv = eu, t.bw = Ro, t.bx = function(t2, r2, n2, i3, a2) {
|
||
return e(this, void 0, void 0, (function* () {
|
||
if (p()) try {
|
||
return yield B(t2, r2, n2, i3, a2);
|
||
} catch (t3) {
|
||
}
|
||
return (function(t3, e2, r3, n3, i4) {
|
||
const a3 = t3.width, s2 = t3.height;
|
||
P && V || (P = new OffscreenCanvas(a3, s2), V = P.getContext("2d", { willReadFrequently: true })), P.width = a3, P.height = s2, V.drawImage(t3, 0, 0, a3, s2);
|
||
const o2 = V.getImageData(e2, r3, n3, i4);
|
||
return V.clearRect(0, 0, a3, s2), o2.data;
|
||
})(t2, r2, n2, i3, a2);
|
||
}));
|
||
}, t.by = yc, t.bz = r, t.c = $, t.d = function(t2, e2) {
|
||
const r2 = new Image();
|
||
r2.onload = () => {
|
||
e2(null, r2), URL.revokeObjectURL(r2.src), r2.onload = null, window.requestAnimationFrame((() => {
|
||
r2.src = C;
|
||
}));
|
||
}, r2.onerror = () => e2(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 n2 = new Blob([new Uint8Array(t2)], { type: "image/png" });
|
||
r2.src = t2.byteLength ? URL.createObjectURL(n2) : C;
|
||
}, t.e = g, t.f = function(t2, e2) {
|
||
return R(g(t2, { type: "json" }), e2);
|
||
}, t.g = O, t.h = T, t.i = I, t.j = G, t.k = K, t.l = q, t.m = R, t.n = function(t2) {
|
||
return new eu(t2).readFields(nu, []);
|
||
}, t.o = function(t2, e2, r2) {
|
||
if (!t2.length) return r2(null, []);
|
||
let n2 = t2.length;
|
||
const i3 = new Array(t2.length);
|
||
let a2 = null;
|
||
t2.forEach(((t3, s2) => {
|
||
e2(t3, ((t4, e3) => {
|
||
t4 && (a2 = t4), i3[s2] = e3, 0 == --n2 && r2(a2, i3);
|
||
}));
|
||
}));
|
||
}, t.p = ou, t.q = Rs, t.r = _i, t.s = j, t.t = Bn, t.u = Rn, t.v = X, t.w = A, t.x = En, t.y = Cn, t.z = function([t2, e2, r2]) {
|
||
return e2 += 90, e2 *= Math.PI / 180, r2 *= Math.PI / 180, { x: t2 * Math.cos(e2) * Math.sin(r2), y: t2 * Math.sin(e2) * Math.sin(r2), z: t2 * Math.cos(r2) };
|
||
};
|
||
}));
|
||
define(["./shared"], (function(e) {
|
||
class t {
|
||
constructor(e2) {
|
||
this.keyCache = {}, e2 && this.replace(e2);
|
||
}
|
||
replace(e2) {
|
||
this._layerConfigs = {}, this._layers = {}, this.update(e2, []);
|
||
}
|
||
update(t2, i3) {
|
||
for (const i4 of t2) {
|
||
this._layerConfigs[i4.id] = i4;
|
||
const t3 = this._layers[i4.id] = e.aC(i4);
|
||
t3._featureFilter = e.a6(t3.filter), this.keyCache[i4.id] && delete this.keyCache[i4.id];
|
||
}
|
||
for (const e2 of i3) delete this.keyCache[e2], delete this._layerConfigs[e2], delete this._layers[e2];
|
||
this.familiesBySource = {};
|
||
const o2 = e.bl(Object.values(this._layerConfigs), this.keyCache);
|
||
for (const e2 of o2) {
|
||
const t3 = e2.map(((e3) => this._layers[e3.id])), i4 = t3[0];
|
||
if ("none" === i4.visibility) continue;
|
||
const o3 = i4.source || "";
|
||
let r2 = this.familiesBySource[o3];
|
||
r2 || (r2 = this.familiesBySource[o3] = {});
|
||
const s2 = i4.sourceLayer || "_geojsonTileLayer";
|
||
let n2 = r2[s2];
|
||
n2 || (n2 = r2[s2] = []), n2.push(t3);
|
||
}
|
||
}
|
||
}
|
||
class i2 {
|
||
constructor(t2) {
|
||
const i3 = {}, o2 = [];
|
||
for (const e2 in t2) {
|
||
const r3 = t2[e2], s3 = i3[e2] = {};
|
||
for (const e3 in r3) {
|
||
const t3 = r3[+e3];
|
||
if (!t3 || 0 === t3.bitmap.width || 0 === t3.bitmap.height) continue;
|
||
const i4 = { x: 0, y: 0, w: t3.bitmap.width + 2, h: t3.bitmap.height + 2 };
|
||
o2.push(i4), s3[e3] = { rect: i4, metrics: t3.metrics };
|
||
}
|
||
}
|
||
const { w: r2, h: s2 } = e.p(o2), n2 = new e.q({ width: r2 || 1, height: s2 || 1 });
|
||
for (const o3 in t2) {
|
||
const r3 = t2[o3];
|
||
for (const t3 in r3) {
|
||
const s3 = r3[+t3];
|
||
if (!s3 || 0 === s3.bitmap.width || 0 === s3.bitmap.height) continue;
|
||
const a2 = i3[o3][t3].rect;
|
||
e.q.copy(s3.bitmap, n2, { x: 0, y: 0 }, { x: a2.x + 1, y: a2.y + 1 }, s3.bitmap);
|
||
}
|
||
}
|
||
this.image = n2, this.positions = i3;
|
||
}
|
||
}
|
||
e.bm("GlyphAtlas", i2);
|
||
class o {
|
||
constructor(t2) {
|
||
this.tileID = new e.O(t2.tileID.overscaledZ, t2.tileID.wrap, t2.tileID.canonical.z, t2.tileID.canonical.x, t2.tileID.canonical.y), this.uid = t2.uid, this.zoom = t2.zoom, this.pixelRatio = t2.pixelRatio, this.tileSize = t2.tileSize, this.source = t2.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t2.showCollisionBoxes, this.collectResourceTiming = !!t2.collectResourceTiming, this.returnDependencies = !!t2.returnDependencies, this.promoteId = t2.promoteId, this.inFlightDependencies = [], this.dependencySentinel = -1;
|
||
}
|
||
parse(t2, o2, s2, n2, a2) {
|
||
this.status = "parsing", this.data = t2, this.collisionBoxArray = new e.a3();
|
||
const l2 = new e.bn(Object.keys(t2.layers).sort()), c2 = new e.bo(this.tileID, this.promoteId);
|
||
c2.bucketLayerIDs = [];
|
||
const h2 = {}, u2 = { featureIndex: c2, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: s2 }, d2 = o2.familiesBySource[this.source];
|
||
for (const i3 in d2) {
|
||
const o3 = t2.layers[i3];
|
||
if (!o3) continue;
|
||
1 === o3.version && e.w(`Vector tile source "${this.source}" layer "${i3}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
|
||
const n3 = l2.encode(i3), a3 = [];
|
||
for (let e2 = 0; e2 < o3.length; e2++) {
|
||
const t3 = o3.feature(e2), r2 = c2.getId(t3, i3);
|
||
a3.push({ feature: t3, id: r2, index: e2, sourceLayerIndex: n3 });
|
||
}
|
||
for (const t3 of d2[i3]) {
|
||
const i4 = t3[0];
|
||
i4.source !== this.source && e.w(`layer.source = ${i4.source} does not equal this.source = ${this.source}`), i4.minzoom && this.zoom < Math.floor(i4.minzoom) || i4.maxzoom && this.zoom >= i4.maxzoom || "none" !== i4.visibility && (r(t3, this.zoom, s2), (h2[i4.id] = i4.createBucket({ index: c2.bucketLayerIDs.length, layers: t3, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: n3, sourceID: this.source })).populate(a3, u2, this.tileID.canonical), c2.bucketLayerIDs.push(t3.map(((e2) => e2.id))));
|
||
}
|
||
}
|
||
let p2, f2, g2, m2;
|
||
const y2 = e.aH(u2.glyphDependencies, ((e2) => Object.keys(e2).map(Number)));
|
||
this.inFlightDependencies.forEach(((e2) => null == e2 ? void 0 : e2.cancel())), this.inFlightDependencies = [];
|
||
const v2 = ++this.dependencySentinel;
|
||
Object.keys(y2).length ? this.inFlightDependencies.push(n2.send("getGlyphs", { uid: this.uid, stacks: y2, source: this.source, tileID: this.tileID, type: "glyphs" }, ((e2, t3) => {
|
||
v2 === this.dependencySentinel && (p2 || (p2 = e2, f2 = t3, b2.call(this)));
|
||
}))) : f2 = {};
|
||
const w2 = Object.keys(u2.iconDependencies);
|
||
w2.length ? this.inFlightDependencies.push(n2.send("getImages", { icons: w2, source: this.source, tileID: this.tileID, type: "icons" }, ((e2, t3) => {
|
||
v2 === this.dependencySentinel && (p2 || (p2 = e2, g2 = t3, b2.call(this)));
|
||
}))) : g2 = {};
|
||
const x2 = Object.keys(u2.patternDependencies);
|
||
function b2() {
|
||
if (p2) return a2(p2);
|
||
if (f2 && g2 && m2) {
|
||
const t3 = new i2(f2), o3 = new e.bp(g2, m2);
|
||
for (const i3 in h2) {
|
||
const n3 = h2[i3];
|
||
n3 instanceof e.a4 ? (r(n3.layers, this.zoom, s2), e.bq({ bucket: n3, glyphMap: f2, glyphPositions: t3.positions, imageMap: g2, imagePositions: o3.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical })) : n3.hasPattern && (n3 instanceof e.br || n3 instanceof e.bs || n3 instanceof e.bt) && (r(n3.layers, this.zoom, s2), n3.addFeatures(u2, this.tileID.canonical, o3.patternPositions));
|
||
}
|
||
this.status = "done", a2(null, { buckets: Object.values(h2).filter(((e2) => !e2.isEmpty())), featureIndex: c2, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: t3.image, imageAtlas: o3, glyphMap: this.returnDependencies ? f2 : null, iconMap: this.returnDependencies ? g2 : null, glyphPositions: this.returnDependencies ? t3.positions : null });
|
||
}
|
||
}
|
||
x2.length ? this.inFlightDependencies.push(n2.send("getImages", { icons: x2, source: this.source, tileID: this.tileID, type: "patterns" }, ((e2, t3) => {
|
||
v2 === this.dependencySentinel && (p2 || (p2 = e2, m2 = t3, b2.call(this)));
|
||
}))) : m2 = {}, b2.call(this);
|
||
}
|
||
}
|
||
function r(t2, i3, o2) {
|
||
const r2 = new e.a8(i3);
|
||
for (const e2 of t2) e2.recalculate(r2, o2);
|
||
}
|
||
function s(t2, i3) {
|
||
const o2 = e.l(t2.request, ((o3, r2, s2, n2) => {
|
||
if (o3) i3(o3);
|
||
else if (r2) try {
|
||
const t3 = new e.bw.VectorTile(new e.bv(r2));
|
||
i3(null, { vectorTile: t3, rawData: r2, cacheControl: s2, expires: n2 });
|
||
} catch (e2) {
|
||
const o4 = new Uint8Array(r2);
|
||
let s3 = `Unable to parse the tile at ${t2.request.url}, `;
|
||
s3 += 31 === o4[0] && 139 === o4[1] ? "please make sure the data is not gzipped and that you have configured the relevant header in the server" : `got error: ${e2.messge}`, i3(new Error(s3));
|
||
}
|
||
}));
|
||
return () => {
|
||
o2.cancel(), i3();
|
||
};
|
||
}
|
||
class n {
|
||
constructor(e2, t2, i3, o2) {
|
||
this.actor = e2, this.layerIndex = t2, this.availableImages = i3, this.loadVectorData = o2 || s, this.fetching = {}, this.loading = {}, this.loaded = {};
|
||
}
|
||
loadTile(t2, i3) {
|
||
const r2 = t2.uid;
|
||
this.loading || (this.loading = {});
|
||
const s2 = !!(t2 && t2.request && t2.request.collectResourceTiming) && new e.bu(t2.request), n2 = this.loading[r2] = new o(t2);
|
||
n2.abort = this.loadVectorData(t2, ((t3, o2) => {
|
||
if (delete this.loading[r2], t3 || !o2) return n2.status = "done", this.loaded[r2] = n2, i3(t3);
|
||
const a2 = o2.rawData, l2 = {};
|
||
o2.expires && (l2.expires = o2.expires), o2.cacheControl && (l2.cacheControl = o2.cacheControl);
|
||
const c2 = {};
|
||
if (s2) {
|
||
const e2 = s2.finish();
|
||
e2 && (c2.resourceTiming = JSON.parse(JSON.stringify(e2)));
|
||
}
|
||
n2.vectorTile = o2.vectorTile, n2.parse(o2.vectorTile, this.layerIndex, this.availableImages, this.actor, ((t4, o3) => {
|
||
if (delete this.fetching[r2], t4 || !o3) return i3(t4);
|
||
i3(null, e.e({ rawTileData: a2.slice(0) }, o3, l2, c2));
|
||
})), this.loaded = this.loaded || {}, this.loaded[r2] = n2, this.fetching[r2] = { rawTileData: a2, cacheControl: l2, resourceTiming: c2 };
|
||
}));
|
||
}
|
||
reloadTile(t2, i3) {
|
||
const o2 = this.loaded, r2 = t2.uid;
|
||
if (o2 && o2[r2]) {
|
||
const s2 = o2[r2];
|
||
s2.showCollisionBoxes = t2.showCollisionBoxes, "parsing" === s2.status ? s2.parse(s2.vectorTile, this.layerIndex, this.availableImages, this.actor, ((t3, o3) => {
|
||
if (t3 || !o3) return i3(t3, o3);
|
||
let s3;
|
||
if (this.fetching[r2]) {
|
||
const { rawTileData: t4, cacheControl: i4, resourceTiming: n2 } = this.fetching[r2];
|
||
delete this.fetching[r2], s3 = e.e({ rawTileData: t4.slice(0) }, o3, i4, n2);
|
||
} else s3 = o3;
|
||
i3(null, s3);
|
||
})) : "done" === s2.status && (s2.vectorTile ? s2.parse(s2.vectorTile, this.layerIndex, this.availableImages, this.actor, i3) : i3());
|
||
}
|
||
}
|
||
abortTile(e2, t2) {
|
||
const i3 = this.loading, o2 = e2.uid;
|
||
i3 && i3[o2] && i3[o2].abort && (i3[o2].abort(), delete i3[o2]), t2();
|
||
}
|
||
removeTile(e2, t2) {
|
||
const i3 = this.loaded, o2 = e2.uid;
|
||
i3 && i3[o2] && delete i3[o2], t2();
|
||
}
|
||
}
|
||
class a {
|
||
constructor() {
|
||
this.loaded = {};
|
||
}
|
||
loadTile(t2, i3) {
|
||
return e._(this, void 0, void 0, (function* () {
|
||
const { uid: o2, encoding: r2, rawImageData: s2, redFactor: n2, greenFactor: a2, blueFactor: l2, baseShift: c2 } = t2, h2 = s2.width + 2, u2 = s2.height + 2, d2 = e.a(s2) ? new e.R({ width: h2, height: u2 }, yield e.bx(s2, -1, -1, h2, u2)) : s2, p2 = new e.by(o2, d2, r2, n2, a2, l2, c2);
|
||
this.loaded = this.loaded || {}, this.loaded[o2] = p2, i3(null, p2);
|
||
}));
|
||
}
|
||
removeTile(e2) {
|
||
const t2 = this.loaded, i3 = e2.uid;
|
||
t2 && t2[i3] && delete t2[i3];
|
||
}
|
||
}
|
||
function l(e2, t2) {
|
||
if (0 !== e2.length) {
|
||
c(e2[0], t2);
|
||
for (var i3 = 1; i3 < e2.length; i3++) c(e2[i3], !t2);
|
||
}
|
||
}
|
||
function c(e2, t2) {
|
||
for (var i3 = 0, o2 = 0, r2 = 0, s2 = e2.length, n2 = s2 - 1; r2 < s2; n2 = r2++) {
|
||
var a2 = (e2[r2][0] - e2[n2][0]) * (e2[n2][1] + e2[r2][1]), l2 = i3 + a2;
|
||
o2 += Math.abs(i3) >= Math.abs(a2) ? i3 - l2 + a2 : a2 - l2 + i3, i3 = l2;
|
||
}
|
||
i3 + o2 >= 0 != !!t2 && e2.reverse();
|
||
}
|
||
var h = e.bz((function e2(t2, i3) {
|
||
var o2, r2 = t2 && t2.type;
|
||
if ("FeatureCollection" === r2) for (o2 = 0; o2 < t2.features.length; o2++) e2(t2.features[o2], i3);
|
||
else if ("GeometryCollection" === r2) for (o2 = 0; o2 < t2.geometries.length; o2++) e2(t2.geometries[o2], i3);
|
||
else if ("Feature" === r2) e2(t2.geometry, i3);
|
||
else if ("Polygon" === r2) l(t2.coordinates, i3);
|
||
else if ("MultiPolygon" === r2) for (o2 = 0; o2 < t2.coordinates.length; o2++) l(t2.coordinates[o2], i3);
|
||
return t2;
|
||
}));
|
||
const u = e.bw.VectorTileFeature.prototype.toGeoJSON;
|
||
var d = { exports: {} }, p = e.bA, f = e.bw.VectorTileFeature, g = m;
|
||
function m(e2, t2) {
|
||
this.options = t2 || {}, this.features = e2, this.length = e2.length;
|
||
}
|
||
function y(e2, t2) {
|
||
this.id = "number" == typeof e2.id ? e2.id : void 0, this.type = e2.type, this.rawGeometry = 1 === e2.type ? [e2.geometry] : e2.geometry, this.properties = e2.tags, this.extent = t2 || 4096;
|
||
}
|
||
m.prototype.feature = function(e2) {
|
||
return new y(this.features[e2], this.options.extent);
|
||
}, y.prototype.loadGeometry = function() {
|
||
var e2 = this.rawGeometry;
|
||
this.geometry = [];
|
||
for (var t2 = 0; t2 < e2.length; t2++) {
|
||
for (var i3 = e2[t2], o2 = [], r2 = 0; r2 < i3.length; r2++) o2.push(new p(i3[r2][0], i3[r2][1]));
|
||
this.geometry.push(o2);
|
||
}
|
||
return this.geometry;
|
||
}, y.prototype.bbox = function() {
|
||
this.geometry || this.loadGeometry();
|
||
for (var e2 = this.geometry, t2 = 1 / 0, i3 = -1 / 0, o2 = 1 / 0, r2 = -1 / 0, s2 = 0; s2 < e2.length; s2++) for (var n2 = e2[s2], a2 = 0; a2 < n2.length; a2++) {
|
||
var l2 = n2[a2];
|
||
t2 = Math.min(t2, l2.x), i3 = Math.max(i3, l2.x), o2 = Math.min(o2, l2.y), r2 = Math.max(r2, l2.y);
|
||
}
|
||
return [t2, o2, i3, r2];
|
||
}, y.prototype.toGeoJSON = f.prototype.toGeoJSON;
|
||
var v = e.bB, w = g;
|
||
function x(e2) {
|
||
var t2 = new v();
|
||
return (function(e3, t3) {
|
||
for (var i3 in e3.layers) t3.writeMessage(3, b, e3.layers[i3]);
|
||
})(e2, t2), t2.finish();
|
||
}
|
||
function b(e2, t2) {
|
||
var i3;
|
||
t2.writeVarintField(15, e2.version || 1), t2.writeStringField(1, e2.name || ""), t2.writeVarintField(5, e2.extent || 4096);
|
||
var o2 = { keys: [], values: [], keycache: {}, valuecache: {} };
|
||
for (i3 = 0; i3 < e2.length; i3++) o2.feature = e2.feature(i3), t2.writeMessage(2, S, o2);
|
||
var r2 = o2.keys;
|
||
for (i3 = 0; i3 < r2.length; i3++) t2.writeStringField(3, r2[i3]);
|
||
var s2 = o2.values;
|
||
for (i3 = 0; i3 < s2.length; i3++) t2.writeMessage(4, _, s2[i3]);
|
||
}
|
||
function S(e2, t2) {
|
||
var i3 = e2.feature;
|
||
void 0 !== i3.id && t2.writeVarintField(1, i3.id), t2.writeMessage(2, M, e2), t2.writeVarintField(3, i3.type), t2.writeMessage(4, T, i3);
|
||
}
|
||
function M(e2, t2) {
|
||
var i3 = e2.feature, o2 = e2.keys, r2 = e2.values, s2 = e2.keycache, n2 = e2.valuecache;
|
||
for (var a2 in i3.properties) {
|
||
var l2 = i3.properties[a2], c2 = s2[a2];
|
||
if (null !== l2) {
|
||
void 0 === c2 && (o2.push(a2), s2[a2] = c2 = o2.length - 1), t2.writeVarint(c2);
|
||
var h2 = typeof l2;
|
||
"string" !== h2 && "boolean" !== h2 && "number" !== h2 && (l2 = JSON.stringify(l2));
|
||
var u2 = h2 + ":" + l2, d2 = n2[u2];
|
||
void 0 === d2 && (r2.push(l2), n2[u2] = d2 = r2.length - 1), t2.writeVarint(d2);
|
||
}
|
||
}
|
||
}
|
||
function I(e2, t2) {
|
||
return (t2 << 3) + (7 & e2);
|
||
}
|
||
function P(e2) {
|
||
return e2 << 1 ^ e2 >> 31;
|
||
}
|
||
function T(e2, t2) {
|
||
for (var i3 = e2.loadGeometry(), o2 = e2.type, r2 = 0, s2 = 0, n2 = i3.length, a2 = 0; a2 < n2; a2++) {
|
||
var l2 = i3[a2], c2 = 1;
|
||
1 === o2 && (c2 = l2.length), t2.writeVarint(I(1, c2));
|
||
for (var h2 = 3 === o2 ? l2.length - 1 : l2.length, u2 = 0; u2 < h2; u2++) {
|
||
1 === u2 && 1 !== o2 && t2.writeVarint(I(2, h2 - 1));
|
||
var d2 = l2[u2].x - r2, p2 = l2[u2].y - s2;
|
||
t2.writeVarint(P(d2)), t2.writeVarint(P(p2)), r2 += d2, s2 += p2;
|
||
}
|
||
3 === o2 && t2.writeVarint(I(7, 1));
|
||
}
|
||
}
|
||
function _(e2, t2) {
|
||
var i3 = typeof e2;
|
||
"string" === i3 ? t2.writeStringField(1, e2) : "boolean" === i3 ? t2.writeBooleanField(7, e2) : "number" === i3 && (e2 % 1 != 0 ? t2.writeDoubleField(3, e2) : e2 < 0 ? t2.writeSVarintField(6, e2) : t2.writeVarintField(5, e2));
|
||
}
|
||
d.exports = x, d.exports.fromVectorTileJs = x, d.exports.fromGeojsonVt = function(e2, t2) {
|
||
t2 = t2 || {};
|
||
var i3 = {};
|
||
for (var o2 in e2) i3[o2] = new w(e2[o2].features, t2), i3[o2].name = o2, i3[o2].version = t2.version, i3[o2].extent = t2.extent;
|
||
return x({ layers: i3 });
|
||
}, d.exports.GeoJSONWrapper = w;
|
||
var k = e.bz(d.exports);
|
||
const D = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: false, generateId: false, reduce: null, map: (e2) => e2 }, O = Math.fround || (C = new Float32Array(1), (e2) => (C[0] = +e2, C[0]));
|
||
var C;
|
||
const L = 3, F = 5, z = 6;
|
||
class N {
|
||
constructor(e2) {
|
||
this.options = Object.assign(Object.create(D), e2), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
||
}
|
||
load(e2) {
|
||
const { log: t2, minZoom: i3, maxZoom: o2 } = this.options;
|
||
t2 && console.time("total time");
|
||
const r2 = `prepare ${e2.length} points`;
|
||
t2 && console.time(r2), this.points = e2;
|
||
const s2 = [];
|
||
for (let t3 = 0; t3 < e2.length; t3++) {
|
||
const i4 = e2[t3];
|
||
if (!i4.geometry) continue;
|
||
const [o3, r3] = i4.geometry.coordinates, n3 = O(Z(o3)), a2 = O(G(r3));
|
||
s2.push(n3, a2, 1 / 0, t3, -1, 1), this.options.reduce && s2.push(0);
|
||
}
|
||
let n2 = this.trees[o2 + 1] = this._createTree(s2);
|
||
t2 && console.timeEnd(r2);
|
||
for (let e3 = o2; e3 >= i3; e3--) {
|
||
const i4 = +Date.now();
|
||
n2 = this.trees[e3] = this._createTree(this._cluster(n2, e3)), t2 && console.log("z%d: %d clusters in %dms", e3, n2.numItems, +Date.now() - i4);
|
||
}
|
||
return t2 && console.timeEnd("total time"), this;
|
||
}
|
||
getClusters(e2, t2) {
|
||
let i3 = ((e2[0] + 180) % 360 + 360) % 360 - 180;
|
||
const o2 = Math.max(-90, Math.min(90, e2[1]));
|
||
let r2 = 180 === e2[2] ? 180 : ((e2[2] + 180) % 360 + 360) % 360 - 180;
|
||
const s2 = Math.max(-90, Math.min(90, e2[3]));
|
||
if (e2[2] - e2[0] >= 360) i3 = -180, r2 = 180;
|
||
else if (i3 > r2) {
|
||
const e3 = this.getClusters([i3, o2, 180, s2], t2), n3 = this.getClusters([-180, o2, r2, s2], t2);
|
||
return e3.concat(n3);
|
||
}
|
||
const n2 = this.trees[this._limitZoom(t2)], a2 = n2.range(Z(i3), G(s2), Z(r2), G(o2)), l2 = n2.data, c2 = [];
|
||
for (const e3 of a2) {
|
||
const t3 = this.stride * e3;
|
||
c2.push(l2[t3 + F] > 1 ? E(l2, t3, this.clusterProps) : this.points[l2[t3 + L]]);
|
||
}
|
||
return c2;
|
||
}
|
||
getChildren(e2) {
|
||
const t2 = this._getOriginId(e2), i3 = this._getOriginZoom(e2), o2 = "No cluster with the specified id.", r2 = this.trees[i3];
|
||
if (!r2) throw new Error(o2);
|
||
const s2 = r2.data;
|
||
if (t2 * this.stride >= s2.length) throw new Error(o2);
|
||
const n2 = this.options.radius / (this.options.extent * Math.pow(2, i3 - 1)), a2 = r2.within(s2[t2 * this.stride], s2[t2 * this.stride + 1], n2), l2 = [];
|
||
for (const t3 of a2) {
|
||
const i4 = t3 * this.stride;
|
||
s2[i4 + 4] === e2 && l2.push(s2[i4 + F] > 1 ? E(s2, i4, this.clusterProps) : this.points[s2[i4 + L]]);
|
||
}
|
||
if (0 === l2.length) throw new Error(o2);
|
||
return l2;
|
||
}
|
||
getLeaves(e2, t2, i3) {
|
||
const o2 = [];
|
||
return this._appendLeaves(o2, e2, t2 = t2 || 10, i3 = i3 || 0, 0), o2;
|
||
}
|
||
getTile(e2, t2, i3) {
|
||
const o2 = this.trees[this._limitZoom(e2)], r2 = Math.pow(2, e2), { extent: s2, radius: n2 } = this.options, a2 = n2 / s2, l2 = (i3 - a2) / r2, c2 = (i3 + 1 + a2) / r2, h2 = { features: [] };
|
||
return this._addTileFeatures(o2.range((t2 - a2) / r2, l2, (t2 + 1 + a2) / r2, c2), o2.data, t2, i3, r2, h2), 0 === t2 && this._addTileFeatures(o2.range(1 - a2 / r2, l2, 1, c2), o2.data, r2, i3, r2, h2), t2 === r2 - 1 && this._addTileFeatures(o2.range(0, l2, a2 / r2, c2), o2.data, -1, i3, r2, h2), h2.features.length ? h2 : null;
|
||
}
|
||
getClusterExpansionZoom(e2) {
|
||
let t2 = this._getOriginZoom(e2) - 1;
|
||
for (; t2 <= this.options.maxZoom; ) {
|
||
const i3 = this.getChildren(e2);
|
||
if (t2++, 1 !== i3.length) break;
|
||
e2 = i3[0].properties.cluster_id;
|
||
}
|
||
return t2;
|
||
}
|
||
_appendLeaves(e2, t2, i3, o2, r2) {
|
||
const s2 = this.getChildren(t2);
|
||
for (const t3 of s2) {
|
||
const s3 = t3.properties;
|
||
if (s3 && s3.cluster ? r2 + s3.point_count <= o2 ? r2 += s3.point_count : r2 = this._appendLeaves(e2, s3.cluster_id, i3, o2, r2) : r2 < o2 ? r2++ : e2.push(t3), e2.length === i3) break;
|
||
}
|
||
return r2;
|
||
}
|
||
_createTree(t2) {
|
||
const i3 = new e.av(t2.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
||
for (let e2 = 0; e2 < t2.length; e2 += this.stride) i3.add(t2[e2], t2[e2 + 1]);
|
||
return i3.finish(), i3.data = t2, i3;
|
||
}
|
||
_addTileFeatures(e2, t2, i3, o2, r2, s2) {
|
||
for (const n2 of e2) {
|
||
const e3 = n2 * this.stride, a2 = t2[e3 + F] > 1;
|
||
let l2, c2, h2;
|
||
if (a2) l2 = j(t2, e3, this.clusterProps), c2 = t2[e3], h2 = t2[e3 + 1];
|
||
else {
|
||
const i4 = this.points[t2[e3 + L]];
|
||
l2 = i4.properties;
|
||
const [o3, r3] = i4.geometry.coordinates;
|
||
c2 = Z(o3), h2 = G(r3);
|
||
}
|
||
const u2 = { type: 1, geometry: [[Math.round(this.options.extent * (c2 * r2 - i3)), Math.round(this.options.extent * (h2 * r2 - o2))]], tags: l2 };
|
||
let d2;
|
||
d2 = a2 || this.options.generateId ? t2[e3 + L] : this.points[t2[e3 + L]].id, void 0 !== d2 && (u2.id = d2), s2.features.push(u2);
|
||
}
|
||
}
|
||
_limitZoom(e2) {
|
||
return Math.max(this.options.minZoom, Math.min(Math.floor(+e2), this.options.maxZoom + 1));
|
||
}
|
||
_cluster(e2, t2) {
|
||
const { radius: i3, extent: o2, reduce: r2, minPoints: s2 } = this.options, n2 = i3 / (o2 * Math.pow(2, t2)), a2 = e2.data, l2 = [], c2 = this.stride;
|
||
for (let i4 = 0; i4 < a2.length; i4 += c2) {
|
||
if (a2[i4 + 2] <= t2) continue;
|
||
a2[i4 + 2] = t2;
|
||
const o3 = a2[i4], h2 = a2[i4 + 1], u2 = e2.within(a2[i4], a2[i4 + 1], n2), d2 = a2[i4 + F];
|
||
let p2 = d2;
|
||
for (const e3 of u2) {
|
||
const i5 = e3 * c2;
|
||
a2[i5 + 2] > t2 && (p2 += a2[i5 + F]);
|
||
}
|
||
if (p2 > d2 && p2 >= s2) {
|
||
let e3, s3 = o3 * d2, n3 = h2 * d2, f2 = -1;
|
||
const g2 = ((i4 / c2 | 0) << 5) + (t2 + 1) + this.points.length;
|
||
for (const o4 of u2) {
|
||
const l3 = o4 * c2;
|
||
if (a2[l3 + 2] <= t2) continue;
|
||
a2[l3 + 2] = t2;
|
||
const h3 = a2[l3 + F];
|
||
s3 += a2[l3] * h3, n3 += a2[l3 + 1] * h3, a2[l3 + 4] = g2, r2 && (e3 || (e3 = this._map(a2, i4, true), f2 = this.clusterProps.length, this.clusterProps.push(e3)), r2(e3, this._map(a2, l3)));
|
||
}
|
||
a2[i4 + 4] = g2, l2.push(s3 / p2, n3 / p2, 1 / 0, g2, -1, p2), r2 && l2.push(f2);
|
||
} else {
|
||
for (let e3 = 0; e3 < c2; e3++) l2.push(a2[i4 + e3]);
|
||
if (p2 > 1) for (const e3 of u2) {
|
||
const i5 = e3 * c2;
|
||
if (!(a2[i5 + 2] <= t2)) {
|
||
a2[i5 + 2] = t2;
|
||
for (let e4 = 0; e4 < c2; e4++) l2.push(a2[i5 + e4]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return l2;
|
||
}
|
||
_getOriginId(e2) {
|
||
return e2 - this.points.length >> 5;
|
||
}
|
||
_getOriginZoom(e2) {
|
||
return (e2 - this.points.length) % 32;
|
||
}
|
||
_map(e2, t2, i3) {
|
||
if (e2[t2 + F] > 1) {
|
||
const o3 = this.clusterProps[e2[t2 + z]];
|
||
return i3 ? Object.assign({}, o3) : o3;
|
||
}
|
||
const o2 = this.points[e2[t2 + L]].properties, r2 = this.options.map(o2);
|
||
return i3 && r2 === o2 ? Object.assign({}, r2) : r2;
|
||
}
|
||
}
|
||
function E(e2, t2, i3) {
|
||
return { type: "Feature", id: e2[t2 + L], properties: j(e2, t2, i3), geometry: { type: "Point", coordinates: [(o2 = e2[t2], 360 * (o2 - 0.5)), J(e2[t2 + 1])] } };
|
||
var o2;
|
||
}
|
||
function j(e2, t2, i3) {
|
||
const o2 = e2[t2 + F], r2 = o2 >= 1e4 ? `${Math.round(o2 / 1e3)}k` : o2 >= 1e3 ? Math.round(o2 / 100) / 10 + "k" : o2, s2 = e2[t2 + z], n2 = -1 === s2 ? {} : Object.assign({}, i3[s2]);
|
||
return Object.assign(n2, { cluster: true, cluster_id: e2[t2 + L], point_count: o2, point_count_abbreviated: r2 });
|
||
}
|
||
function Z(e2) {
|
||
return e2 / 360 + 0.5;
|
||
}
|
||
function G(e2) {
|
||
const t2 = Math.sin(e2 * Math.PI / 180), i3 = 0.5 - 0.25 * Math.log((1 + t2) / (1 - t2)) / Math.PI;
|
||
return i3 < 0 ? 0 : i3 > 1 ? 1 : i3;
|
||
}
|
||
function J(e2) {
|
||
const t2 = (180 - 360 * e2) * Math.PI / 180;
|
||
return 360 * Math.atan(Math.exp(t2)) / Math.PI - 90;
|
||
}
|
||
function Y(e2, t2, i3, o2) {
|
||
for (var r2, s2 = o2, n2 = i3 - t2 >> 1, a2 = i3 - t2, l2 = e2[t2], c2 = e2[t2 + 1], h2 = e2[i3], u2 = e2[i3 + 1], d2 = t2 + 3; d2 < i3; d2 += 3) {
|
||
var p2 = A(e2[d2], e2[d2 + 1], l2, c2, h2, u2);
|
||
if (p2 > s2) r2 = d2, s2 = p2;
|
||
else if (p2 === s2) {
|
||
var f2 = Math.abs(d2 - n2);
|
||
f2 < a2 && (r2 = d2, a2 = f2);
|
||
}
|
||
}
|
||
s2 > o2 && (r2 - t2 > 3 && Y(e2, t2, r2, o2), e2[r2 + 2] = s2, i3 - r2 > 3 && Y(e2, r2, i3, o2));
|
||
}
|
||
function A(e2, t2, i3, o2, r2, s2) {
|
||
var n2 = r2 - i3, a2 = s2 - o2;
|
||
if (0 !== n2 || 0 !== a2) {
|
||
var l2 = ((e2 - i3) * n2 + (t2 - o2) * a2) / (n2 * n2 + a2 * a2);
|
||
l2 > 1 ? (i3 = r2, o2 = s2) : l2 > 0 && (i3 += n2 * l2, o2 += a2 * l2);
|
||
}
|
||
return (n2 = e2 - i3) * n2 + (a2 = t2 - o2) * a2;
|
||
}
|
||
function V(e2, t2, i3, o2) {
|
||
var r2 = { id: void 0 === e2 ? null : e2, type: t2, geometry: i3, tags: o2, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
|
||
return (function(e3) {
|
||
var t3 = e3.geometry, i4 = e3.type;
|
||
if ("Point" === i4 || "MultiPoint" === i4 || "LineString" === i4) B(e3, t3);
|
||
else if ("Polygon" === i4 || "MultiLineString" === i4) for (var o3 = 0; o3 < t3.length; o3++) B(e3, t3[o3]);
|
||
else if ("MultiPolygon" === i4) for (o3 = 0; o3 < t3.length; o3++) for (var r3 = 0; r3 < t3[o3].length; r3++) B(e3, t3[o3][r3]);
|
||
})(r2), r2;
|
||
}
|
||
function B(e2, t2) {
|
||
for (var i3 = 0; i3 < t2.length; i3 += 3) e2.minX = Math.min(e2.minX, t2[i3]), e2.minY = Math.min(e2.minY, t2[i3 + 1]), e2.maxX = Math.max(e2.maxX, t2[i3]), e2.maxY = Math.max(e2.maxY, t2[i3 + 1]);
|
||
}
|
||
function X(e2, t2, i3, o2) {
|
||
if (t2.geometry) {
|
||
var r2 = t2.geometry.coordinates, s2 = t2.geometry.type, n2 = Math.pow(i3.tolerance / ((1 << i3.maxZoom) * i3.extent), 2), a2 = [], l2 = t2.id;
|
||
if (i3.promoteId ? l2 = t2.properties[i3.promoteId] : i3.generateId && (l2 = o2 || 0), "Point" === s2) q(r2, a2);
|
||
else if ("MultiPoint" === s2) for (var c2 = 0; c2 < r2.length; c2++) q(r2[c2], a2);
|
||
else if ("LineString" === s2) R(r2, a2, n2, false);
|
||
else if ("MultiLineString" === s2) {
|
||
if (i3.lineMetrics) {
|
||
for (c2 = 0; c2 < r2.length; c2++) R(r2[c2], a2 = [], n2, false), e2.push(V(l2, "LineString", a2, t2.properties));
|
||
return;
|
||
}
|
||
W(r2, a2, n2, false);
|
||
} else if ("Polygon" === s2) W(r2, a2, n2, true);
|
||
else {
|
||
if ("MultiPolygon" !== s2) {
|
||
if ("GeometryCollection" === s2) {
|
||
for (c2 = 0; c2 < t2.geometry.geometries.length; c2++) X(e2, { id: l2, geometry: t2.geometry.geometries[c2], properties: t2.properties }, i3, o2);
|
||
return;
|
||
}
|
||
throw new Error("Input data is not a valid GeoJSON object.");
|
||
}
|
||
for (c2 = 0; c2 < r2.length; c2++) {
|
||
var h2 = [];
|
||
W(r2[c2], h2, n2, true), a2.push(h2);
|
||
}
|
||
}
|
||
e2.push(V(l2, s2, a2, t2.properties));
|
||
}
|
||
}
|
||
function q(e2, t2) {
|
||
t2.push($(e2[0])), t2.push(U(e2[1])), t2.push(0);
|
||
}
|
||
function R(e2, t2, i3, o2) {
|
||
for (var r2, s2, n2 = 0, a2 = 0; a2 < e2.length; a2++) {
|
||
var l2 = $(e2[a2][0]), c2 = U(e2[a2][1]);
|
||
t2.push(l2), t2.push(c2), t2.push(0), a2 > 0 && (n2 += o2 ? (r2 * c2 - l2 * s2) / 2 : Math.sqrt(Math.pow(l2 - r2, 2) + Math.pow(c2 - s2, 2))), r2 = l2, s2 = c2;
|
||
}
|
||
var h2 = t2.length - 3;
|
||
t2[2] = 1, Y(t2, 0, h2, i3), t2[h2 + 2] = 1, t2.size = Math.abs(n2), t2.start = 0, t2.end = t2.size;
|
||
}
|
||
function W(e2, t2, i3, o2) {
|
||
for (var r2 = 0; r2 < e2.length; r2++) {
|
||
var s2 = [];
|
||
R(e2[r2], s2, i3, o2), t2.push(s2);
|
||
}
|
||
}
|
||
function $(e2) {
|
||
return e2 / 360 + 0.5;
|
||
}
|
||
function U(e2) {
|
||
var t2 = Math.sin(e2 * Math.PI / 180), i3 = 0.5 - 0.25 * Math.log((1 + t2) / (1 - t2)) / Math.PI;
|
||
return i3 < 0 ? 0 : i3 > 1 ? 1 : i3;
|
||
}
|
||
function H(e2, t2, i3, o2, r2, s2, n2, a2) {
|
||
if (o2 /= t2, s2 >= (i3 /= t2) && n2 < o2) return e2;
|
||
if (n2 < i3 || s2 >= o2) return null;
|
||
for (var l2 = [], c2 = 0; c2 < e2.length; c2++) {
|
||
var h2 = e2[c2], u2 = h2.geometry, d2 = h2.type, p2 = 0 === r2 ? h2.minX : h2.minY, f2 = 0 === r2 ? h2.maxX : h2.maxY;
|
||
if (p2 >= i3 && f2 < o2) l2.push(h2);
|
||
else if (!(f2 < i3 || p2 >= o2)) {
|
||
var g2 = [];
|
||
if ("Point" === d2 || "MultiPoint" === d2) K(u2, g2, i3, o2, r2);
|
||
else if ("LineString" === d2) Q(u2, g2, i3, o2, r2, false, a2.lineMetrics);
|
||
else if ("MultiLineString" === d2) te(u2, g2, i3, o2, r2, false);
|
||
else if ("Polygon" === d2) te(u2, g2, i3, o2, r2, true);
|
||
else if ("MultiPolygon" === d2) for (var m2 = 0; m2 < u2.length; m2++) {
|
||
var y2 = [];
|
||
te(u2[m2], y2, i3, o2, r2, true), y2.length && g2.push(y2);
|
||
}
|
||
if (g2.length) {
|
||
if (a2.lineMetrics && "LineString" === d2) {
|
||
for (m2 = 0; m2 < g2.length; m2++) l2.push(V(h2.id, d2, g2[m2], h2.tags));
|
||
continue;
|
||
}
|
||
"LineString" !== d2 && "MultiLineString" !== d2 || (1 === g2.length ? (d2 = "LineString", g2 = g2[0]) : d2 = "MultiLineString"), "Point" !== d2 && "MultiPoint" !== d2 || (d2 = 3 === g2.length ? "Point" : "MultiPoint"), l2.push(V(h2.id, d2, g2, h2.tags));
|
||
}
|
||
}
|
||
}
|
||
return l2.length ? l2 : null;
|
||
}
|
||
function K(e2, t2, i3, o2, r2) {
|
||
for (var s2 = 0; s2 < e2.length; s2 += 3) {
|
||
var n2 = e2[s2 + r2];
|
||
n2 >= i3 && n2 <= o2 && (t2.push(e2[s2]), t2.push(e2[s2 + 1]), t2.push(e2[s2 + 2]));
|
||
}
|
||
}
|
||
function Q(e2, t2, i3, o2, r2, s2, n2) {
|
||
for (var a2, l2, c2 = ee(e2), h2 = 0 === r2 ? oe : re, u2 = e2.start, d2 = 0; d2 < e2.length - 3; d2 += 3) {
|
||
var p2 = e2[d2], f2 = e2[d2 + 1], g2 = e2[d2 + 2], m2 = e2[d2 + 3], y2 = e2[d2 + 4], v2 = 0 === r2 ? p2 : f2, w2 = 0 === r2 ? m2 : y2, x2 = false;
|
||
n2 && (a2 = Math.sqrt(Math.pow(p2 - m2, 2) + Math.pow(f2 - y2, 2))), v2 < i3 ? w2 > i3 && (l2 = h2(c2, p2, f2, m2, y2, i3), n2 && (c2.start = u2 + a2 * l2)) : v2 > o2 ? w2 < o2 && (l2 = h2(c2, p2, f2, m2, y2, o2), n2 && (c2.start = u2 + a2 * l2)) : ie(c2, p2, f2, g2), w2 < i3 && v2 >= i3 && (l2 = h2(c2, p2, f2, m2, y2, i3), x2 = true), w2 > o2 && v2 <= o2 && (l2 = h2(c2, p2, f2, m2, y2, o2), x2 = true), !s2 && x2 && (n2 && (c2.end = u2 + a2 * l2), t2.push(c2), c2 = ee(e2)), n2 && (u2 += a2);
|
||
}
|
||
var b2 = e2.length - 3;
|
||
p2 = e2[b2], f2 = e2[b2 + 1], g2 = e2[b2 + 2], (v2 = 0 === r2 ? p2 : f2) >= i3 && v2 <= o2 && ie(c2, p2, f2, g2), b2 = c2.length - 3, s2 && b2 >= 3 && (c2[b2] !== c2[0] || c2[b2 + 1] !== c2[1]) && ie(c2, c2[0], c2[1], c2[2]), c2.length && t2.push(c2);
|
||
}
|
||
function ee(e2) {
|
||
var t2 = [];
|
||
return t2.size = e2.size, t2.start = e2.start, t2.end = e2.end, t2;
|
||
}
|
||
function te(e2, t2, i3, o2, r2, s2) {
|
||
for (var n2 = 0; n2 < e2.length; n2++) Q(e2[n2], t2, i3, o2, r2, s2, false);
|
||
}
|
||
function ie(e2, t2, i3, o2) {
|
||
e2.push(t2), e2.push(i3), e2.push(o2);
|
||
}
|
||
function oe(e2, t2, i3, o2, r2, s2) {
|
||
var n2 = (s2 - t2) / (o2 - t2);
|
||
return e2.push(s2), e2.push(i3 + (r2 - i3) * n2), e2.push(1), n2;
|
||
}
|
||
function re(e2, t2, i3, o2, r2, s2) {
|
||
var n2 = (s2 - i3) / (r2 - i3);
|
||
return e2.push(t2 + (o2 - t2) * n2), e2.push(s2), e2.push(1), n2;
|
||
}
|
||
function se(e2, t2) {
|
||
for (var i3 = [], o2 = 0; o2 < e2.length; o2++) {
|
||
var r2, s2 = e2[o2], n2 = s2.type;
|
||
if ("Point" === n2 || "MultiPoint" === n2 || "LineString" === n2) r2 = ne(s2.geometry, t2);
|
||
else if ("MultiLineString" === n2 || "Polygon" === n2) {
|
||
r2 = [];
|
||
for (var a2 = 0; a2 < s2.geometry.length; a2++) r2.push(ne(s2.geometry[a2], t2));
|
||
} else if ("MultiPolygon" === n2) for (r2 = [], a2 = 0; a2 < s2.geometry.length; a2++) {
|
||
for (var l2 = [], c2 = 0; c2 < s2.geometry[a2].length; c2++) l2.push(ne(s2.geometry[a2][c2], t2));
|
||
r2.push(l2);
|
||
}
|
||
i3.push(V(s2.id, n2, r2, s2.tags));
|
||
}
|
||
return i3;
|
||
}
|
||
function ne(e2, t2) {
|
||
var i3 = [];
|
||
i3.size = e2.size, void 0 !== e2.start && (i3.start = e2.start, i3.end = e2.end);
|
||
for (var o2 = 0; o2 < e2.length; o2 += 3) i3.push(e2[o2] + t2, e2[o2 + 1], e2[o2 + 2]);
|
||
return i3;
|
||
}
|
||
function ae(e2, t2) {
|
||
if (e2.transformed) return e2;
|
||
var i3, o2, r2, s2 = 1 << e2.z, n2 = e2.x, a2 = e2.y;
|
||
for (i3 = 0; i3 < e2.features.length; i3++) {
|
||
var l2 = e2.features[i3], c2 = l2.geometry, h2 = l2.type;
|
||
if (l2.geometry = [], 1 === h2) for (o2 = 0; o2 < c2.length; o2 += 2) l2.geometry.push(le(c2[o2], c2[o2 + 1], t2, s2, n2, a2));
|
||
else for (o2 = 0; o2 < c2.length; o2++) {
|
||
var u2 = [];
|
||
for (r2 = 0; r2 < c2[o2].length; r2 += 2) u2.push(le(c2[o2][r2], c2[o2][r2 + 1], t2, s2, n2, a2));
|
||
l2.geometry.push(u2);
|
||
}
|
||
}
|
||
return e2.transformed = true, e2;
|
||
}
|
||
function le(e2, t2, i3, o2, r2, s2) {
|
||
return [Math.round(i3 * (e2 * o2 - r2)), Math.round(i3 * (t2 * o2 - s2))];
|
||
}
|
||
function ce(e2, t2, i3, o2, r2) {
|
||
for (var s2 = t2 === r2.maxZoom ? 0 : r2.tolerance / ((1 << t2) * r2.extent), n2 = { features: [], numPoints: 0, numSimplified: 0, numFeatures: 0, source: null, x: i3, y: o2, z: t2, transformed: false, minX: 2, minY: 1, maxX: -1, maxY: 0 }, a2 = 0; a2 < e2.length; a2++) {
|
||
n2.numFeatures++, he(n2, e2[a2], s2, r2);
|
||
var l2 = e2[a2].minX, c2 = e2[a2].minY, h2 = e2[a2].maxX, u2 = e2[a2].maxY;
|
||
l2 < n2.minX && (n2.minX = l2), c2 < n2.minY && (n2.minY = c2), h2 > n2.maxX && (n2.maxX = h2), u2 > n2.maxY && (n2.maxY = u2);
|
||
}
|
||
return n2;
|
||
}
|
||
function he(e2, t2, i3, o2) {
|
||
var r2 = t2.geometry, s2 = t2.type, n2 = [];
|
||
if ("Point" === s2 || "MultiPoint" === s2) for (var a2 = 0; a2 < r2.length; a2 += 3) n2.push(r2[a2]), n2.push(r2[a2 + 1]), e2.numPoints++, e2.numSimplified++;
|
||
else if ("LineString" === s2) ue(n2, r2, e2, i3, false, false);
|
||
else if ("MultiLineString" === s2 || "Polygon" === s2) for (a2 = 0; a2 < r2.length; a2++) ue(n2, r2[a2], e2, i3, "Polygon" === s2, 0 === a2);
|
||
else if ("MultiPolygon" === s2) for (var l2 = 0; l2 < r2.length; l2++) {
|
||
var c2 = r2[l2];
|
||
for (a2 = 0; a2 < c2.length; a2++) ue(n2, c2[a2], e2, i3, true, 0 === a2);
|
||
}
|
||
if (n2.length) {
|
||
var h2 = t2.tags || null;
|
||
if ("LineString" === s2 && o2.lineMetrics) {
|
||
for (var u2 in h2 = {}, t2.tags) h2[u2] = t2.tags[u2];
|
||
h2.mapbox_clip_start = r2.start / r2.size, h2.mapbox_clip_end = r2.end / r2.size;
|
||
}
|
||
var d2 = { geometry: n2, type: "Polygon" === s2 || "MultiPolygon" === s2 ? 3 : "LineString" === s2 || "MultiLineString" === s2 ? 2 : 1, tags: h2 };
|
||
null !== t2.id && (d2.id = t2.id), e2.features.push(d2);
|
||
}
|
||
}
|
||
function ue(e2, t2, i3, o2, r2, s2) {
|
||
var n2 = o2 * o2;
|
||
if (o2 > 0 && t2.size < (r2 ? n2 : o2)) i3.numPoints += t2.length / 3;
|
||
else {
|
||
for (var a2 = [], l2 = 0; l2 < t2.length; l2 += 3) (0 === o2 || t2[l2 + 2] > n2) && (i3.numSimplified++, a2.push(t2[l2]), a2.push(t2[l2 + 1])), i3.numPoints++;
|
||
r2 && (function(e3, t3) {
|
||
for (var i4 = 0, o3 = 0, r3 = e3.length, s3 = r3 - 2; o3 < r3; s3 = o3, o3 += 2) i4 += (e3[o3] - e3[s3]) * (e3[o3 + 1] + e3[s3 + 1]);
|
||
if (i4 > 0 === t3) for (o3 = 0, r3 = e3.length; o3 < r3 / 2; o3 += 2) {
|
||
var n3 = e3[o3], a3 = e3[o3 + 1];
|
||
e3[o3] = e3[r3 - 2 - o3], e3[o3 + 1] = e3[r3 - 1 - o3], e3[r3 - 2 - o3] = n3, e3[r3 - 1 - o3] = a3;
|
||
}
|
||
})(a2, s2), e2.push(a2);
|
||
}
|
||
}
|
||
function de(e2, t2) {
|
||
var i3 = (t2 = this.options = (function(e3, t3) {
|
||
for (var i4 in t3) e3[i4] = t3[i4];
|
||
return e3;
|
||
})(Object.create(this.options), t2)).debug;
|
||
if (i3 && console.time("preprocess data"), t2.maxZoom < 0 || t2.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range");
|
||
if (t2.promoteId && t2.generateId) throw new Error("promoteId and generateId cannot be used together.");
|
||
var o2 = (function(e3, t3) {
|
||
var i4 = [];
|
||
if ("FeatureCollection" === e3.type) for (var o3 = 0; o3 < e3.features.length; o3++) X(i4, e3.features[o3], t3, o3);
|
||
else X(i4, "Feature" === e3.type ? e3 : { geometry: e3 }, t3);
|
||
return i4;
|
||
})(e2, t2);
|
||
this.tiles = {}, this.tileCoords = [], i3 && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", t2.indexMaxZoom, t2.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), o2 = (function(e3, t3) {
|
||
var i4 = t3.buffer / t3.extent, o3 = e3, r2 = H(e3, 1, -1 - i4, i4, 0, -1, 2, t3), s2 = H(e3, 1, 1 - i4, 2 + i4, 0, -1, 2, t3);
|
||
return (r2 || s2) && (o3 = H(e3, 1, -i4, 1 + i4, 0, -1, 2, t3) || [], r2 && (o3 = se(r2, 1).concat(o3)), s2 && (o3 = o3.concat(se(s2, -1)))), o3;
|
||
})(o2, t2), o2.length && this.splitTile(o2, 0, 0, 0), i3 && (o2.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 pe(e2, t2, i3) {
|
||
return 32 * ((1 << e2) * i3 + t2) + e2;
|
||
}
|
||
function fe(e2, t2) {
|
||
return t2 ? e2.properties[t2] : e2.id;
|
||
}
|
||
function ge(e2, t2) {
|
||
if (null == e2) return true;
|
||
if ("Feature" === e2.type) return null != fe(e2, t2);
|
||
if ("FeatureCollection" === e2.type) {
|
||
const i3 = /* @__PURE__ */ new Set();
|
||
for (const o2 of e2.features) {
|
||
const e3 = fe(o2, t2);
|
||
if (null == e3) return false;
|
||
if (i3.has(e3)) return false;
|
||
i3.add(e3);
|
||
}
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function me(e2, t2) {
|
||
const i3 = /* @__PURE__ */ new Map();
|
||
if (null == e2) ;
|
||
else if ("Feature" === e2.type) i3.set(fe(e2, t2), e2);
|
||
else for (const o2 of e2.features) i3.set(fe(o2, t2), o2);
|
||
return i3;
|
||
}
|
||
de.prototype.options = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: false, promoteId: null, generateId: false, debug: 0 }, de.prototype.splitTile = function(e2, t2, i3, o2, r2, s2, n2) {
|
||
for (var a2 = [e2, t2, i3, o2], l2 = this.options, c2 = l2.debug; a2.length; ) {
|
||
o2 = a2.pop(), i3 = a2.pop(), t2 = a2.pop(), e2 = a2.pop();
|
||
var h2 = 1 << t2, u2 = pe(t2, i3, o2), d2 = this.tiles[u2];
|
||
if (!d2 && (c2 > 1 && console.time("creation"), d2 = this.tiles[u2] = ce(e2, t2, i3, o2, l2), this.tileCoords.push({ z: t2, x: i3, y: o2 }), c2)) {
|
||
c2 > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t2, i3, o2, d2.numFeatures, d2.numPoints, d2.numSimplified), console.timeEnd("creation"));
|
||
var p2 = "z" + t2;
|
||
this.stats[p2] = (this.stats[p2] || 0) + 1, this.total++;
|
||
}
|
||
if (d2.source = e2, r2) {
|
||
if (t2 === l2.maxZoom || t2 === r2) continue;
|
||
var f2 = 1 << r2 - t2;
|
||
if (i3 !== Math.floor(s2 / f2) || o2 !== Math.floor(n2 / f2)) continue;
|
||
} else if (t2 === l2.indexMaxZoom || d2.numPoints <= l2.indexMaxPoints) continue;
|
||
if (d2.source = null, 0 !== e2.length) {
|
||
c2 > 1 && console.time("clipping");
|
||
var g2, m2, y2, v2, w2, x2, b2 = 0.5 * l2.buffer / l2.extent, S2 = 0.5 - b2, M2 = 0.5 + b2, I2 = 1 + b2;
|
||
g2 = m2 = y2 = v2 = null, w2 = H(e2, h2, i3 - b2, i3 + M2, 0, d2.minX, d2.maxX, l2), x2 = H(e2, h2, i3 + S2, i3 + I2, 0, d2.minX, d2.maxX, l2), e2 = null, w2 && (g2 = H(w2, h2, o2 - b2, o2 + M2, 1, d2.minY, d2.maxY, l2), m2 = H(w2, h2, o2 + S2, o2 + I2, 1, d2.minY, d2.maxY, l2), w2 = null), x2 && (y2 = H(x2, h2, o2 - b2, o2 + M2, 1, d2.minY, d2.maxY, l2), v2 = H(x2, h2, o2 + S2, o2 + I2, 1, d2.minY, d2.maxY, l2), x2 = null), c2 > 1 && console.timeEnd("clipping"), a2.push(g2 || [], t2 + 1, 2 * i3, 2 * o2), a2.push(m2 || [], t2 + 1, 2 * i3, 2 * o2 + 1), a2.push(y2 || [], t2 + 1, 2 * i3 + 1, 2 * o2), a2.push(v2 || [], t2 + 1, 2 * i3 + 1, 2 * o2 + 1);
|
||
}
|
||
}
|
||
}, de.prototype.getTile = function(e2, t2, i3) {
|
||
var o2 = this.options, r2 = o2.extent, s2 = o2.debug;
|
||
if (e2 < 0 || e2 > 24) return null;
|
||
var n2 = 1 << e2, a2 = pe(e2, t2 = (t2 % n2 + n2) % n2, i3);
|
||
if (this.tiles[a2]) return ae(this.tiles[a2], r2);
|
||
s2 > 1 && console.log("drilling down to z%d-%d-%d", e2, t2, i3);
|
||
for (var l2, c2 = e2, h2 = t2, u2 = i3; !l2 && c2 > 0; ) c2--, h2 = Math.floor(h2 / 2), u2 = Math.floor(u2 / 2), l2 = this.tiles[pe(c2, h2, u2)];
|
||
return l2 && l2.source ? (s2 > 1 && console.log("found parent tile z%d-%d-%d", c2, h2, u2), s2 > 1 && console.time("drilling down"), this.splitTile(l2.source, c2, h2, u2, e2, t2, i3), s2 > 1 && console.timeEnd("drilling down"), this.tiles[a2] ? ae(this.tiles[a2], r2) : null) : null;
|
||
};
|
||
class ye extends n {
|
||
constructor(t2, i3, o2, r2) {
|
||
super(t2, i3, o2), this._dataUpdateable = /* @__PURE__ */ new Map(), this.loadGeoJSON = (t3, i4) => {
|
||
const { promoteId: o3 } = t3;
|
||
if (t3.request) return e.f(t3.request, ((e2, t4, r3, s2) => {
|
||
this._dataUpdateable = ge(t4, o3) ? me(t4, o3) : void 0, i4(e2, t4, r3, s2);
|
||
}));
|
||
if ("string" == typeof t3.data) try {
|
||
const e2 = JSON.parse(t3.data);
|
||
this._dataUpdateable = ge(e2, o3) ? me(e2, o3) : void 0, i4(null, e2);
|
||
} catch (e2) {
|
||
i4(new Error(`Input data given to '${t3.source}' is not a valid GeoJSON object.`));
|
||
}
|
||
else t3.dataDiff ? this._dataUpdateable ? ((function(e2, t4, i5) {
|
||
var o4, r3, s2, n2;
|
||
if (t4.removeAll && e2.clear(), t4.remove) for (const i6 of t4.remove) e2.delete(i6);
|
||
if (t4.add) for (const o5 of t4.add) {
|
||
const t5 = fe(o5, i5);
|
||
null != t5 && e2.set(t5, o5);
|
||
}
|
||
if (t4.update) for (const i6 of t4.update) {
|
||
let t5 = e2.get(i6.id);
|
||
if (null == t5) continue;
|
||
const a2 = !i6.removeAllProperties && ((null === (o4 = i6.removeProperties) || void 0 === o4 ? void 0 : o4.length) > 0 || (null === (r3 = i6.addOrUpdateProperties) || void 0 === r3 ? void 0 : r3.length) > 0);
|
||
if ((i6.newGeometry || i6.removeAllProperties || a2) && (t5 = Object.assign({}, t5), e2.set(i6.id, t5), a2 && (t5.properties = Object.assign({}, t5.properties))), i6.newGeometry && (t5.geometry = i6.newGeometry), i6.removeAllProperties) t5.properties = {};
|
||
else if ((null === (s2 = i6.removeProperties) || void 0 === s2 ? void 0 : s2.length) > 0) for (const e3 of i6.removeProperties) Object.prototype.hasOwnProperty.call(t5.properties, e3) && delete t5.properties[e3];
|
||
if ((null === (n2 = i6.addOrUpdateProperties) || void 0 === n2 ? void 0 : n2.length) > 0) for (const { key: e3, value: o5 } of i6.addOrUpdateProperties) t5.properties[e3] = o5;
|
||
}
|
||
})(this._dataUpdateable, t3.dataDiff, o3), i4(null, { type: "FeatureCollection", features: Array.from(this._dataUpdateable.values()) })) : i4(new Error(`Cannot update existing geojson data in ${t3.source}`)) : i4(new Error(`Input data given to '${t3.source}' is not a valid GeoJSON object.`));
|
||
return { cancel: () => {
|
||
} };
|
||
}, this.loadVectorData = this.loadGeoJSONTile, r2 && (this.loadGeoJSON = r2);
|
||
}
|
||
loadGeoJSONTile(t2, i3) {
|
||
const o2 = t2.tileID.canonical;
|
||
if (!this._geoJSONIndex) return i3(null, null);
|
||
const r2 = this._geoJSONIndex.getTile(o2.z, o2.x, o2.y);
|
||
if (!r2) return i3(null, null);
|
||
const s2 = new class {
|
||
constructor(t3) {
|
||
this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = e.N, this.length = t3.length, this._features = t3;
|
||
}
|
||
feature(t3) {
|
||
return new class {
|
||
constructor(t4) {
|
||
this._feature = t4, this.extent = e.N, this.type = t4.type, this.properties = t4.tags, "id" in t4 && !isNaN(t4.id) && (this.id = parseInt(t4.id, 10));
|
||
}
|
||
loadGeometry() {
|
||
if (1 === this._feature.type) {
|
||
const t4 = [];
|
||
for (const i4 of this._feature.geometry) t4.push([new e.P(i4[0], i4[1])]);
|
||
return t4;
|
||
}
|
||
{
|
||
const t4 = [];
|
||
for (const i4 of this._feature.geometry) {
|
||
const o3 = [];
|
||
for (const t5 of i4) o3.push(new e.P(t5[0], t5[1]));
|
||
t4.push(o3);
|
||
}
|
||
return t4;
|
||
}
|
||
}
|
||
toGeoJSON(e2, t4, i4) {
|
||
return u.call(this, e2, t4, i4);
|
||
}
|
||
}(this._features[t3]);
|
||
}
|
||
}(r2.features);
|
||
let n2 = k(s2);
|
||
0 === n2.byteOffset && n2.byteLength === n2.buffer.byteLength || (n2 = new Uint8Array(n2)), i3(null, { vectorTile: s2, rawData: n2.buffer });
|
||
}
|
||
loadData(t2, i3) {
|
||
var o2;
|
||
null === (o2 = this._pendingRequest) || void 0 === o2 || o2.cancel(), this._pendingCallback && this._pendingCallback(null, { abandoned: true });
|
||
const r2 = !!(t2 && t2.request && t2.request.collectResourceTiming) && new e.bu(t2.request);
|
||
this._pendingCallback = i3, this._pendingRequest = this.loadGeoJSON(t2, ((o3, s2) => {
|
||
if (delete this._pendingCallback, delete this._pendingRequest, o3 || !s2) return i3(o3);
|
||
if ("object" != typeof s2) return i3(new Error(`Input data given to '${t2.source}' is not a valid GeoJSON object.`));
|
||
{
|
||
h(s2, true);
|
||
try {
|
||
if (t2.filter) {
|
||
const i4 = e.bC(t2.filter, { type: "boolean", "property-type": "data-driven", overridable: false, transition: false });
|
||
if ("error" === i4.result) throw new Error(i4.value.map(((e2) => `${e2.key}: ${e2.message}`)).join(", "));
|
||
const o4 = s2.features.filter(((e2) => i4.value.evaluate({ zoom: 0 }, e2)));
|
||
s2 = { type: "FeatureCollection", features: o4 };
|
||
}
|
||
this._geoJSONIndex = t2.cluster ? new N((function({ superclusterOptions: t3, clusterProperties: i4 }) {
|
||
if (!i4 || !t3) return t3;
|
||
const o4 = {}, r3 = {}, s3 = { accumulated: null, zoom: 0 }, n3 = { properties: null }, a2 = Object.keys(i4);
|
||
for (const t4 of a2) {
|
||
const [s4, n4] = i4[t4], a3 = e.bC(n4), l2 = e.bC("string" == typeof s4 ? [s4, ["accumulated"], ["get", t4]] : s4);
|
||
o4[t4] = a3.value, r3[t4] = l2.value;
|
||
}
|
||
return t3.map = (e2) => {
|
||
n3.properties = e2;
|
||
const t4 = {};
|
||
for (const e3 of a2) t4[e3] = o4[e3].evaluate(s3, n3);
|
||
return t4;
|
||
}, t3.reduce = (e2, t4) => {
|
||
n3.properties = t4;
|
||
for (const t5 of a2) s3.accumulated = e2[t5], e2[t5] = r3[t5].evaluate(s3, n3);
|
||
}, t3;
|
||
})(t2)).load(s2.features) : (function(e2, t3) {
|
||
return new de(e2, t3);
|
||
})(s2, t2.geojsonVtOptions);
|
||
} catch (o4) {
|
||
return i3(o4);
|
||
}
|
||
this.loaded = {};
|
||
const n2 = {};
|
||
if (r2) {
|
||
const e2 = r2.finish();
|
||
e2 && (n2.resourceTiming = {}, n2.resourceTiming[t2.source] = JSON.parse(JSON.stringify(e2)));
|
||
}
|
||
i3(null, n2);
|
||
}
|
||
}));
|
||
}
|
||
reloadTile(e2, t2) {
|
||
const i3 = this.loaded;
|
||
return i3 && i3[e2.uid] ? super.reloadTile(e2, t2) : this.loadTile(e2, t2);
|
||
}
|
||
removeSource(e2, t2) {
|
||
this._pendingCallback && this._pendingCallback(null, { abandoned: true }), t2();
|
||
}
|
||
getClusterExpansionZoom(e2, t2) {
|
||
try {
|
||
t2(null, this._geoJSONIndex.getClusterExpansionZoom(e2.clusterId));
|
||
} catch (e3) {
|
||
t2(e3);
|
||
}
|
||
}
|
||
getClusterChildren(e2, t2) {
|
||
try {
|
||
t2(null, this._geoJSONIndex.getChildren(e2.clusterId));
|
||
} catch (e3) {
|
||
t2(e3);
|
||
}
|
||
}
|
||
getClusterLeaves(e2, t2) {
|
||
try {
|
||
t2(null, this._geoJSONIndex.getLeaves(e2.clusterId, e2.limit, e2.offset));
|
||
} catch (e3) {
|
||
t2(e3);
|
||
}
|
||
}
|
||
}
|
||
class ve {
|
||
constructor(t2) {
|
||
this.self = t2, this.actor = new e.C(t2, this), this.layerIndexes = {}, this.availableImages = {}, this.workerSourceTypes = { vector: n, geojson: ye }, this.workerSources = {}, this.demWorkerSources = {}, this.self.registerWorkerSource = (e2, t3) => {
|
||
if (this.workerSourceTypes[e2]) throw new Error(`Worker source with name "${e2}" already registered.`);
|
||
this.workerSourceTypes[e2] = t3;
|
||
}, this.self.registerRTLTextPlugin = (t3) => {
|
||
if (e.bD.isParsed()) throw new Error("RTL text plugin already registered.");
|
||
e.bD.applyArabicShaping = t3.applyArabicShaping, e.bD.processBidirectionalText = t3.processBidirectionalText, e.bD.processStyledBidirectionalText = t3.processStyledBidirectionalText;
|
||
};
|
||
}
|
||
setReferrer(e2, t2) {
|
||
this.referrer = t2;
|
||
}
|
||
setImages(e2, t2, i3) {
|
||
this.availableImages[e2] = t2;
|
||
for (const i4 in this.workerSources[e2]) {
|
||
const o2 = this.workerSources[e2][i4];
|
||
for (const e3 in o2) o2[e3].availableImages = t2;
|
||
}
|
||
i3();
|
||
}
|
||
setLayers(e2, t2, i3) {
|
||
this.getLayerIndex(e2).replace(t2), i3();
|
||
}
|
||
updateLayers(e2, t2, i3) {
|
||
this.getLayerIndex(e2).update(t2.layers, t2.removedIds), i3();
|
||
}
|
||
loadTile(e2, t2, i3) {
|
||
this.getWorkerSource(e2, t2.type, t2.source).loadTile(t2, i3);
|
||
}
|
||
loadDEMTile(e2, t2, i3) {
|
||
this.getDEMWorkerSource(e2, t2.source).loadTile(t2, i3);
|
||
}
|
||
reloadTile(e2, t2, i3) {
|
||
this.getWorkerSource(e2, t2.type, t2.source).reloadTile(t2, i3);
|
||
}
|
||
abortTile(e2, t2, i3) {
|
||
this.getWorkerSource(e2, t2.type, t2.source).abortTile(t2, i3);
|
||
}
|
||
removeTile(e2, t2, i3) {
|
||
this.getWorkerSource(e2, t2.type, t2.source).removeTile(t2, i3);
|
||
}
|
||
removeDEMTile(e2, t2) {
|
||
this.getDEMWorkerSource(e2, t2.source).removeTile(t2);
|
||
}
|
||
removeSource(e2, t2, i3) {
|
||
if (!this.workerSources[e2] || !this.workerSources[e2][t2.type] || !this.workerSources[e2][t2.type][t2.source]) return;
|
||
const o2 = this.workerSources[e2][t2.type][t2.source];
|
||
delete this.workerSources[e2][t2.type][t2.source], void 0 !== o2.removeSource ? o2.removeSource(t2, i3) : i3();
|
||
}
|
||
loadWorkerSource(e2, t2, i3) {
|
||
try {
|
||
this.self.importScripts(t2.url), i3();
|
||
} catch (e3) {
|
||
i3(e3.toString());
|
||
}
|
||
}
|
||
syncRTLPluginState(t2, i3, o2) {
|
||
try {
|
||
e.bD.setState(i3);
|
||
const t3 = e.bD.getPluginURL();
|
||
if (e.bD.isLoaded() && !e.bD.isParsed() && null != t3) {
|
||
this.self.importScripts(t3);
|
||
const i4 = e.bD.isParsed();
|
||
o2(i4 ? void 0 : new Error(`RTL Text Plugin failed to import scripts from ${t3}`), i4);
|
||
}
|
||
} catch (e2) {
|
||
o2(e2.toString());
|
||
}
|
||
}
|
||
getAvailableImages(e2) {
|
||
let t2 = this.availableImages[e2];
|
||
return t2 || (t2 = []), t2;
|
||
}
|
||
getLayerIndex(e2) {
|
||
let i3 = this.layerIndexes[e2];
|
||
return i3 || (i3 = this.layerIndexes[e2] = new t()), i3;
|
||
}
|
||
getWorkerSource(e2, t2, i3) {
|
||
return this.workerSources[e2] || (this.workerSources[e2] = {}), this.workerSources[e2][t2] || (this.workerSources[e2][t2] = {}), this.workerSources[e2][t2][i3] || (this.workerSources[e2][t2][i3] = new this.workerSourceTypes[t2]({ send: (t3, i4, o2) => {
|
||
this.actor.send(t3, i4, o2, e2);
|
||
} }, this.getLayerIndex(e2), this.getAvailableImages(e2))), this.workerSources[e2][t2][i3];
|
||
}
|
||
getDEMWorkerSource(e2, t2) {
|
||
return this.demWorkerSources[e2] || (this.demWorkerSources[e2] = {}), this.demWorkerSources[e2][t2] || (this.demWorkerSources[e2][t2] = new a()), this.demWorkerSources[e2][t2];
|
||
}
|
||
}
|
||
return e.i() && (self.worker = new ve(self)), ve;
|
||
}));
|
||
define(["./shared"], (function(t) {
|
||
var e = "3.6.2";
|
||
class i2 {
|
||
static testProp(t2) {
|
||
if (!i2.docStyle) return t2[0];
|
||
for (let e2 = 0; e2 < t2.length; e2++) if (t2[e2] in i2.docStyle) return t2[e2];
|
||
return t2[0];
|
||
}
|
||
static create(t2, e2, i3) {
|
||
const s2 = window.document.createElement(t2);
|
||
return void 0 !== e2 && (s2.className = e2), i3 && i3.appendChild(s2), s2;
|
||
}
|
||
static createNS(t2, e2) {
|
||
return window.document.createElementNS(t2, e2);
|
||
}
|
||
static disableDrag() {
|
||
i2.docStyle && i2.selectProp && (i2.userSelect = i2.docStyle[i2.selectProp], i2.docStyle[i2.selectProp] = "none");
|
||
}
|
||
static enableDrag() {
|
||
i2.docStyle && i2.selectProp && (i2.docStyle[i2.selectProp] = i2.userSelect);
|
||
}
|
||
static setTransform(t2, e2) {
|
||
t2.style[i2.transformProp] = e2;
|
||
}
|
||
static addEventListener(t2, e2, i3, s2 = {}) {
|
||
t2.addEventListener(e2, i3, "passive" in s2 ? s2 : s2.capture);
|
||
}
|
||
static removeEventListener(t2, e2, i3, s2 = {}) {
|
||
t2.removeEventListener(e2, i3, "passive" in s2 ? s2 : s2.capture);
|
||
}
|
||
static suppressClickInternal(t2) {
|
||
t2.preventDefault(), t2.stopPropagation(), window.removeEventListener("click", i2.suppressClickInternal, true);
|
||
}
|
||
static suppressClick() {
|
||
window.addEventListener("click", i2.suppressClickInternal, true), window.setTimeout((() => {
|
||
window.removeEventListener("click", i2.suppressClickInternal, true);
|
||
}), 0);
|
||
}
|
||
static mousePos(e2, i3) {
|
||
const s2 = e2.getBoundingClientRect();
|
||
return new t.P(i3.clientX - s2.left - e2.clientLeft, i3.clientY - s2.top - e2.clientTop);
|
||
}
|
||
static touchPos(e2, i3) {
|
||
const s2 = e2.getBoundingClientRect(), a2 = [];
|
||
for (let o2 = 0; o2 < i3.length; o2++) a2.push(new t.P(i3[o2].clientX - s2.left - e2.clientLeft, i3[o2].clientY - s2.top - e2.clientTop));
|
||
return a2;
|
||
}
|
||
static mouseButton(t2) {
|
||
return t2.button;
|
||
}
|
||
static remove(t2) {
|
||
t2.parentNode && t2.parentNode.removeChild(t2);
|
||
}
|
||
}
|
||
i2.docStyle = "undefined" != typeof window && window.document && window.document.documentElement.style, i2.selectProp = i2.testProp(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]), i2.transformProp = i2.testProp(["transform", "WebkitTransform"]);
|
||
const s = { supported: false, testSupport: function(t2) {
|
||
!r && o && (n ? l(t2) : a = t2);
|
||
} };
|
||
let a, o, r = false, n = false;
|
||
function l(t2) {
|
||
const e2 = t2.createTexture();
|
||
t2.bindTexture(t2.TEXTURE_2D, e2);
|
||
try {
|
||
if (t2.texImage2D(t2.TEXTURE_2D, 0, t2.RGBA, t2.RGBA, t2.UNSIGNED_BYTE, o), t2.isContextLost()) return;
|
||
s.supported = true;
|
||
} catch (t3) {
|
||
}
|
||
t2.deleteTexture(e2), r = true;
|
||
}
|
||
var h, c;
|
||
"undefined" != typeof document && (o = document.createElement("img"), o.onload = function() {
|
||
a && l(a), a = null, n = true;
|
||
}, o.onerror = function() {
|
||
r = true, a = null;
|
||
}, o.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="), (function(e2) {
|
||
let i3, a2, o2, r2;
|
||
e2.resetRequestQueue = () => {
|
||
i3 = [], a2 = 0, o2 = 0, r2 = {};
|
||
}, e2.addThrottleControl = (t2) => {
|
||
const e3 = o2++;
|
||
return r2[e3] = t2, e3;
|
||
}, e2.removeThrottleControl = (t2) => {
|
||
delete r2[t2], h2();
|
||
}, e2.getImage = (t2, e3, o3 = true) => {
|
||
s.supported && (t2.headers || (t2.headers = {}), t2.headers.accept = "image/webp,*/*");
|
||
const r3 = { requestParameters: t2, supportImageRefresh: o3, callback: e3, cancelled: false, completed: false, cancel: () => {
|
||
r3.completed || r3.cancelled || (r3.cancelled = true, r3.innerRequest && (r3.innerRequest.cancel(), a2--), h2());
|
||
} };
|
||
return i3.push(r3), h2(), r3;
|
||
};
|
||
const n2 = (e3) => {
|
||
const { requestParameters: i4, supportImageRefresh: s2, callback: a3 } = e3;
|
||
return t.e(i4, { type: "image" }), (false !== s2 || t.i() || t.g(i4.url) || i4.headers && !Object.keys(i4.headers).reduce(((t2, e4) => t2 && "accept" === e4), true) ? t.m : c2)(i4, ((t2, i5, s3, o3) => {
|
||
l2(e3, a3, t2, i5, s3, o3);
|
||
}));
|
||
}, l2 = (e3, i4, s2, o3, r3, n3) => {
|
||
s2 ? i4(s2) : o3 instanceof HTMLImageElement || t.a(o3) ? i4(null, o3) : o3 && ((e4, i5) => {
|
||
"function" == typeof createImageBitmap ? t.b(e4, i5) : t.d(e4, i5);
|
||
})(o3, ((t2, e4) => {
|
||
null != t2 ? i4(t2) : null != e4 && i4(null, e4, { cacheControl: r3, expires: n3 });
|
||
})), e3.cancelled || (e3.completed = true, a2--, h2());
|
||
}, h2 = () => {
|
||
const e3 = (() => {
|
||
const t2 = Object.keys(r2);
|
||
let e4 = false;
|
||
if (t2.length > 0) {
|
||
for (const i4 of t2) if (e4 = r2[i4](), e4) break;
|
||
}
|
||
return e4;
|
||
})() ? t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : t.c.MAX_PARALLEL_IMAGE_REQUESTS;
|
||
for (let t2 = a2; t2 < e3 && i3.length > 0; t2++) {
|
||
const e4 = i3.shift();
|
||
if (e4.cancelled) {
|
||
t2--;
|
||
continue;
|
||
}
|
||
const s2 = n2(e4);
|
||
a2++, e4.innerRequest = s2;
|
||
}
|
||
}, c2 = (e3, i4) => {
|
||
const s2 = new Image(), a3 = e3.url;
|
||
let o3 = false;
|
||
const r3 = e3.credentials;
|
||
return r3 && "include" === r3 ? s2.crossOrigin = "use-credentials" : (r3 && "same-origin" === r3 || !t.s(a3)) && (s2.crossOrigin = "anonymous"), s2.fetchPriority = "high", s2.onload = () => {
|
||
i4(null, s2), s2.onerror = s2.onload = null;
|
||
}, s2.onerror = () => {
|
||
o3 || i4(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.")), s2.onerror = s2.onload = null;
|
||
}, s2.src = a3, { cancel: () => {
|
||
o3 = true, s2.src = "";
|
||
} };
|
||
};
|
||
})(h || (h = {})), h.resetRequestQueue(), (function(t2) {
|
||
t2.Glyphs = "Glyphs", t2.Image = "Image", t2.Source = "Source", t2.SpriteImage = "SpriteImage", t2.SpriteJSON = "SpriteJSON", t2.Style = "Style", t2.Tile = "Tile", t2.Unknown = "Unknown";
|
||
})(c || (c = {}));
|
||
class u {
|
||
constructor(t2) {
|
||
this._transformRequestFn = t2;
|
||
}
|
||
transformRequest(t2, e2) {
|
||
return this._transformRequestFn && this._transformRequestFn(t2, e2) || { url: t2 };
|
||
}
|
||
normalizeSpriteURL(t2, e2, i3) {
|
||
const s2 = (function(t3) {
|
||
const e3 = t3.match(d);
|
||
if (!e3) throw new Error(`Unable to parse URL "${t3}"`);
|
||
return { protocol: e3[1], authority: e3[2], path: e3[3] || "/", params: e3[4] ? e3[4].split("&") : [] };
|
||
})(t2);
|
||
return s2.path += `${e2}${i3}`, (function(t3) {
|
||
const e3 = t3.params.length ? `?${t3.params.join("&")}` : "";
|
||
return `${t3.protocol}://${t3.authority}${t3.path}${e3}`;
|
||
})(s2);
|
||
}
|
||
setTransformRequest(t2) {
|
||
this._transformRequestFn = t2;
|
||
}
|
||
}
|
||
const d = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;
|
||
function _(e2) {
|
||
var i3 = new t.A(3);
|
||
return i3[0] = e2[0], i3[1] = e2[1], i3[2] = e2[2], i3;
|
||
}
|
||
var p, m = function(t2, e2, i3) {
|
||
return t2[0] = e2[0] - i3[0], t2[1] = e2[1] - i3[1], t2[2] = e2[2] - i3[2], t2;
|
||
};
|
||
p = new t.A(3), t.A != Float32Array && (p[0] = 0, p[1] = 0, p[2] = 0);
|
||
var f = function(t2) {
|
||
var e2 = t2[0], i3 = t2[1];
|
||
return e2 * e2 + i3 * i3;
|
||
};
|
||
function g(t2) {
|
||
const e2 = [];
|
||
if ("string" == typeof t2) e2.push({ id: "default", url: t2 });
|
||
else if (t2 && t2.length > 0) {
|
||
const i3 = [];
|
||
for (const { id: s2, url: a2 } of t2) {
|
||
const t3 = `${s2}${a2}`;
|
||
-1 === i3.indexOf(t3) && (i3.push(t3), e2.push({ id: s2, url: a2 }));
|
||
}
|
||
}
|
||
return e2;
|
||
}
|
||
function v(e2, i3, s2, a2, o2) {
|
||
if (a2) return void e2(a2);
|
||
if (o2 !== Object.values(i3).length || o2 !== Object.values(s2).length) return;
|
||
const r2 = {};
|
||
for (const e3 in i3) {
|
||
r2[e3] = {};
|
||
const a3 = t.h.getImageCanvasContext(s2[e3]), o3 = i3[e3];
|
||
for (const t2 in o3) {
|
||
const { width: i4, height: s3, x: n2, y: l2, sdf: h2, pixelRatio: c2, stretchX: u2, stretchY: d2, content: _2 } = o3[t2];
|
||
r2[e3][t2] = { data: null, pixelRatio: c2, sdf: h2, stretchX: u2, stretchY: d2, content: _2, spriteData: { width: i4, height: s3, x: n2, y: l2, context: a3 } };
|
||
}
|
||
}
|
||
e2(null, r2);
|
||
}
|
||
!(function() {
|
||
var e2 = new t.A(2);
|
||
t.A != Float32Array && (e2[0] = 0, e2[1] = 0);
|
||
})();
|
||
class x {
|
||
constructor(t2, e2, i3, s2) {
|
||
this.context = t2, this.format = i3, this.texture = t2.gl.createTexture(), this.update(e2, s2);
|
||
}
|
||
update(e2, i3, s2) {
|
||
const { width: a2, height: o2 } = e2, r2 = !(this.size && this.size[0] === a2 && this.size[1] === o2 || s2), { context: n2 } = this, { gl: l2 } = n2;
|
||
if (this.useMipmap = Boolean(i3 && i3.useMipmap), l2.bindTexture(l2.TEXTURE_2D, this.texture), n2.pixelStoreUnpackFlipY.set(false), n2.pixelStoreUnpack.set(1), n2.pixelStoreUnpackPremultiplyAlpha.set(this.format === l2.RGBA && (!i3 || false !== i3.premultiply)), r2) this.size = [a2, o2], e2 instanceof HTMLImageElement || e2 instanceof HTMLCanvasElement || e2 instanceof HTMLVideoElement || e2 instanceof ImageData || t.a(e2) ? l2.texImage2D(l2.TEXTURE_2D, 0, this.format, this.format, l2.UNSIGNED_BYTE, e2) : l2.texImage2D(l2.TEXTURE_2D, 0, this.format, a2, o2, 0, this.format, l2.UNSIGNED_BYTE, e2.data);
|
||
else {
|
||
const { x: i4, y: r3 } = s2 || { x: 0, y: 0 };
|
||
e2 instanceof HTMLImageElement || e2 instanceof HTMLCanvasElement || e2 instanceof HTMLVideoElement || e2 instanceof ImageData || t.a(e2) ? l2.texSubImage2D(l2.TEXTURE_2D, 0, i4, r3, l2.RGBA, l2.UNSIGNED_BYTE, e2) : l2.texSubImage2D(l2.TEXTURE_2D, 0, i4, r3, a2, o2, l2.RGBA, l2.UNSIGNED_BYTE, e2.data);
|
||
}
|
||
this.useMipmap && this.isSizePowerOfTwo() && l2.generateMipmap(l2.TEXTURE_2D);
|
||
}
|
||
bind(t2, e2, i3) {
|
||
const { context: s2 } = this, { gl: a2 } = s2;
|
||
a2.bindTexture(a2.TEXTURE_2D, this.texture), i3 !== a2.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (i3 = a2.LINEAR), t2 !== this.filter && (a2.texParameteri(a2.TEXTURE_2D, a2.TEXTURE_MAG_FILTER, t2), a2.texParameteri(a2.TEXTURE_2D, a2.TEXTURE_MIN_FILTER, i3 || t2), this.filter = t2), e2 !== this.wrap && (a2.texParameteri(a2.TEXTURE_2D, a2.TEXTURE_WRAP_S, e2), a2.texParameteri(a2.TEXTURE_2D, a2.TEXTURE_WRAP_T, e2), this.wrap = e2);
|
||
}
|
||
isSizePowerOfTwo() {
|
||
return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
|
||
}
|
||
destroy() {
|
||
const { gl: t2 } = this.context;
|
||
t2.deleteTexture(this.texture), this.texture = null;
|
||
}
|
||
}
|
||
function y(t2) {
|
||
const { userImage: e2 } = t2;
|
||
return !!(e2 && e2.render && e2.render()) && (t2.data.replace(new Uint8Array(e2.data.buffer)), true);
|
||
}
|
||
class b extends t.E {
|
||
constructor() {
|
||
super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = false, this.requestors = [], this.patterns = {}, this.atlasImage = new t.R({ width: 1, height: 1 }), this.dirty = true;
|
||
}
|
||
isLoaded() {
|
||
return this.loaded;
|
||
}
|
||
setLoaded(t2) {
|
||
if (this.loaded !== t2 && (this.loaded = t2, t2)) {
|
||
for (const { ids: t3, callback: e2 } of this.requestors) this._notify(t3, e2);
|
||
this.requestors = [];
|
||
}
|
||
}
|
||
getImage(e2) {
|
||
const i3 = this.images[e2];
|
||
if (i3 && !i3.data && i3.spriteData) {
|
||
const e3 = i3.spriteData;
|
||
i3.data = new t.R({ width: e3.width, height: e3.height }, e3.context.getImageData(e3.x, e3.y, e3.width, e3.height).data), i3.spriteData = null;
|
||
}
|
||
return i3;
|
||
}
|
||
addImage(t2, e2) {
|
||
if (this.images[t2]) throw new Error(`Image id ${t2} already exist, use updateImage instead`);
|
||
this._validate(t2, e2) && (this.images[t2] = e2);
|
||
}
|
||
_validate(e2, i3) {
|
||
let s2 = true;
|
||
const a2 = i3.data || i3.spriteData;
|
||
return this._validateStretch(i3.stretchX, a2 && a2.width) || (this.fire(new t.j(new Error(`Image "${e2}" has invalid "stretchX" value`))), s2 = false), this._validateStretch(i3.stretchY, a2 && a2.height) || (this.fire(new t.j(new Error(`Image "${e2}" has invalid "stretchY" value`))), s2 = false), this._validateContent(i3.content, i3) || (this.fire(new t.j(new Error(`Image "${e2}" has invalid "content" value`))), s2 = false), s2;
|
||
}
|
||
_validateStretch(t2, e2) {
|
||
if (!t2) return true;
|
||
let i3 = 0;
|
||
for (const s2 of t2) {
|
||
if (s2[0] < i3 || s2[1] < s2[0] || e2 < s2[1]) return false;
|
||
i3 = s2[1];
|
||
}
|
||
return true;
|
||
}
|
||
_validateContent(t2, e2) {
|
||
if (!t2) return true;
|
||
if (4 !== t2.length) return false;
|
||
const i3 = e2.spriteData, s2 = i3 && i3.width || e2.data.width, a2 = i3 && i3.height || e2.data.height;
|
||
return !(t2[0] < 0 || s2 < t2[0] || t2[1] < 0 || a2 < t2[1] || t2[2] < 0 || s2 < t2[2] || t2[3] < 0 || a2 < t2[3] || t2[2] < t2[0] || t2[3] < t2[1]);
|
||
}
|
||
updateImage(t2, e2, i3 = true) {
|
||
const s2 = this.getImage(t2);
|
||
if (i3 && (s2.data.width !== e2.data.width || s2.data.height !== e2.data.height)) throw new Error(`size mismatch between old image (${s2.data.width}x${s2.data.height}) and new image (${e2.data.width}x${e2.data.height}).`);
|
||
e2.version = s2.version + 1, this.images[t2] = e2, this.updatedImages[t2] = true;
|
||
}
|
||
removeImage(t2) {
|
||
const e2 = this.images[t2];
|
||
delete this.images[t2], delete this.patterns[t2], e2.userImage && e2.userImage.onRemove && e2.userImage.onRemove();
|
||
}
|
||
listImages() {
|
||
return Object.keys(this.images);
|
||
}
|
||
getImages(t2, e2) {
|
||
let i3 = true;
|
||
if (!this.isLoaded()) for (const e3 of t2) this.images[e3] || (i3 = false);
|
||
this.isLoaded() || i3 ? this._notify(t2, e2) : this.requestors.push({ ids: t2, callback: e2 });
|
||
}
|
||
_notify(e2, i3) {
|
||
const s2 = {};
|
||
for (const i4 of e2) {
|
||
let e3 = this.getImage(i4);
|
||
e3 || (this.fire(new t.k("styleimagemissing", { id: i4 })), e3 = this.getImage(i4)), e3 ? s2[i4] = { data: e3.data.clone(), pixelRatio: e3.pixelRatio, sdf: e3.sdf, version: e3.version, stretchX: e3.stretchX, stretchY: e3.stretchY, content: e3.content, hasRenderCallback: Boolean(e3.userImage && e3.userImage.render) } : t.w(`Image "${i4}" 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.`);
|
||
}
|
||
i3(null, s2);
|
||
}
|
||
getPixelSize() {
|
||
const { width: t2, height: e2 } = this.atlasImage;
|
||
return { width: t2, height: e2 };
|
||
}
|
||
getPattern(e2) {
|
||
const i3 = this.patterns[e2], s2 = this.getImage(e2);
|
||
if (!s2) return null;
|
||
if (i3 && i3.position.version === s2.version) return i3.position;
|
||
if (i3) i3.position.version = s2.version;
|
||
else {
|
||
const i4 = { w: s2.data.width + 2, h: s2.data.height + 2, x: 0, y: 0 }, a2 = new t.I(i4, s2);
|
||
this.patterns[e2] = { bin: i4, position: a2 };
|
||
}
|
||
return this._updatePatternAtlas(), this.patterns[e2].position;
|
||
}
|
||
bind(t2) {
|
||
const e2 = t2.gl;
|
||
this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = false) : this.atlasTexture = new x(t2, this.atlasImage, e2.RGBA), this.atlasTexture.bind(e2.LINEAR, e2.CLAMP_TO_EDGE);
|
||
}
|
||
_updatePatternAtlas() {
|
||
const e2 = [];
|
||
for (const t2 in this.patterns) e2.push(this.patterns[t2].bin);
|
||
const { w: i3, h: s2 } = t.p(e2), a2 = this.atlasImage;
|
||
a2.resize({ width: i3 || 1, height: s2 || 1 });
|
||
for (const e3 in this.patterns) {
|
||
const { bin: i4 } = this.patterns[e3], s3 = i4.x + 1, o2 = i4.y + 1, r2 = this.getImage(e3).data, n2 = r2.width, l2 = r2.height;
|
||
t.R.copy(r2, a2, { x: 0, y: 0 }, { x: s3, y: o2 }, { width: n2, height: l2 }), t.R.copy(r2, a2, { x: 0, y: l2 - 1 }, { x: s3, y: o2 - 1 }, { width: n2, height: 1 }), t.R.copy(r2, a2, { x: 0, y: 0 }, { x: s3, y: o2 + l2 }, { width: n2, height: 1 }), t.R.copy(r2, a2, { x: n2 - 1, y: 0 }, { x: s3 - 1, y: o2 }, { width: 1, height: l2 }), t.R.copy(r2, a2, { x: 0, y: 0 }, { x: s3 + n2, y: o2 }, { width: 1, height: l2 });
|
||
}
|
||
this.dirty = true;
|
||
}
|
||
beginFrame() {
|
||
this.callbackDispatchedThisFrame = {};
|
||
}
|
||
dispatchRenderCallbacks(e2) {
|
||
for (const i3 of e2) {
|
||
if (this.callbackDispatchedThisFrame[i3]) continue;
|
||
this.callbackDispatchedThisFrame[i3] = true;
|
||
const e3 = this.getImage(i3);
|
||
e3 || t.w(`Image with ID: "${i3}" was not found`), y(e3) && this.updateImage(i3, e3);
|
||
}
|
||
}
|
||
}
|
||
const w = 1e20;
|
||
function T(t2, e2, i3, s2, a2, o2, r2, n2, l2) {
|
||
for (let h2 = e2; h2 < e2 + s2; h2++) I(t2, i3 * o2 + h2, o2, a2, r2, n2, l2);
|
||
for (let h2 = i3; h2 < i3 + a2; h2++) I(t2, h2 * o2 + e2, 1, s2, r2, n2, l2);
|
||
}
|
||
function I(t2, e2, i3, s2, a2, o2, r2) {
|
||
o2[0] = 0, r2[0] = -w, r2[1] = w, a2[0] = t2[e2];
|
||
for (let n2 = 1, l2 = 0, h2 = 0; n2 < s2; n2++) {
|
||
a2[n2] = t2[e2 + n2 * i3];
|
||
const s3 = n2 * n2;
|
||
do {
|
||
const t3 = o2[l2];
|
||
h2 = (a2[n2] - a2[t3] + s3 - t3 * t3) / (n2 - t3) / 2;
|
||
} while (h2 <= r2[l2] && --l2 > -1);
|
||
l2++, o2[l2] = n2, r2[l2] = h2, r2[l2 + 1] = w;
|
||
}
|
||
for (let n2 = 0, l2 = 0; n2 < s2; n2++) {
|
||
for (; r2[l2 + 1] < n2; ) l2++;
|
||
const s3 = o2[l2], h2 = n2 - s3;
|
||
t2[e2 + n2 * i3] = a2[s3] + h2 * h2;
|
||
}
|
||
}
|
||
class E {
|
||
constructor(t2, e2) {
|
||
this.requestManager = t2, this.localIdeographFontFamily = e2, this.entries = {};
|
||
}
|
||
setURL(t2) {
|
||
this.url = t2;
|
||
}
|
||
getGlyphs(e2, i3) {
|
||
const s2 = [];
|
||
for (const t2 in e2) for (const i4 of e2[t2]) s2.push({ stack: t2, id: i4 });
|
||
t.o(s2, (({ stack: t2, id: e3 }, i4) => {
|
||
let s3 = this.entries[t2];
|
||
s3 || (s3 = this.entries[t2] = { glyphs: {}, requests: {}, ranges: {} });
|
||
let a2 = s3.glyphs[e3];
|
||
if (void 0 !== a2) return void i4(null, { stack: t2, id: e3, glyph: a2 });
|
||
if (a2 = this._tinySDF(s3, t2, e3), a2) return s3.glyphs[e3] = a2, void i4(null, { stack: t2, id: e3, glyph: a2 });
|
||
const o2 = Math.floor(e3 / 256);
|
||
if (256 * o2 > 65535) return void i4(new Error("glyphs > 65535 not supported"));
|
||
if (s3.ranges[o2]) return void i4(null, { stack: t2, id: e3, glyph: a2 });
|
||
if (!this.url) return void i4(new Error("glyphsUrl is not set"));
|
||
let r2 = s3.requests[o2];
|
||
r2 || (r2 = s3.requests[o2] = [], E.loadGlyphRange(t2, o2, this.url, this.requestManager, ((t3, e4) => {
|
||
if (e4) {
|
||
for (const t4 in e4) this._doesCharSupportLocalGlyph(+t4) || (s3.glyphs[+t4] = e4[+t4]);
|
||
s3.ranges[o2] = true;
|
||
}
|
||
for (const i5 of r2) i5(t3, e4);
|
||
delete s3.requests[o2];
|
||
}))), r2.push(((s4, a3) => {
|
||
s4 ? i4(s4) : a3 && i4(null, { stack: t2, id: e3, glyph: a3[e3] || null });
|
||
}));
|
||
}), ((t2, e3) => {
|
||
if (t2) i3(t2);
|
||
else if (e3) {
|
||
const t3 = {};
|
||
for (const { stack: i4, id: s3, glyph: a2 } of e3) (t3[i4] || (t3[i4] = {}))[s3] = a2 && { id: a2.id, bitmap: a2.bitmap.clone(), metrics: a2.metrics };
|
||
i3(null, t3);
|
||
}
|
||
}));
|
||
}
|
||
_doesCharSupportLocalGlyph(e2) {
|
||
return !!this.localIdeographFontFamily && (t.u["CJK Unified Ideographs"](e2) || t.u["Hangul Syllables"](e2) || t.u.Hiragana(e2) || t.u.Katakana(e2));
|
||
}
|
||
_tinySDF(e2, i3, s2) {
|
||
const a2 = this.localIdeographFontFamily;
|
||
if (!a2) return;
|
||
if (!this._doesCharSupportLocalGlyph(s2)) return;
|
||
let o2 = e2.tinySDF;
|
||
if (!o2) {
|
||
let t2 = "400";
|
||
/bold/i.test(i3) ? t2 = "900" : /medium/i.test(i3) ? t2 = "500" : /light/i.test(i3) && (t2 = "200"), o2 = e2.tinySDF = new E.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: a2, fontWeight: t2 });
|
||
}
|
||
const r2 = o2.draw(String.fromCharCode(s2));
|
||
return { id: s2, bitmap: new t.q({ width: r2.width || 60, height: r2.height || 60 }, r2.data), metrics: { width: r2.glyphWidth / 2 || 24, height: r2.glyphHeight / 2 || 24, left: r2.glyphLeft / 2 + 0.5 || 0, top: r2.glyphTop / 2 - 27.5 || -8, advance: r2.glyphAdvance / 2 || 24, isDoubleResolution: true } };
|
||
}
|
||
}
|
||
E.loadGlyphRange = function(e2, i3, s2, a2, o2) {
|
||
const r2 = 256 * i3, n2 = r2 + 255, l2 = a2.transformRequest(s2.replace("{fontstack}", e2).replace("{range}", `${r2}-${n2}`), c.Glyphs);
|
||
t.l(l2, ((e3, i4) => {
|
||
if (e3) o2(e3);
|
||
else if (i4) {
|
||
const e4 = {};
|
||
for (const s3 of t.n(i4)) e4[s3.id] = s3;
|
||
o2(null, e4);
|
||
}
|
||
}));
|
||
}, E.TinySDF = class {
|
||
constructor({ fontSize: t2 = 24, buffer: e2 = 3, radius: i3 = 8, cutoff: s2 = 0.25, fontFamily: a2 = "sans-serif", fontWeight: o2 = "normal", fontStyle: r2 = "normal" } = {}) {
|
||
this.buffer = e2, this.cutoff = s2, this.radius = i3;
|
||
const n2 = this.size = t2 + 4 * e2, l2 = this._createCanvas(n2), h2 = this.ctx = l2.getContext("2d", { willReadFrequently: true });
|
||
h2.font = `${r2} ${o2} ${t2}px ${a2}`, h2.textBaseline = "alphabetic", h2.textAlign = "left", h2.fillStyle = "black", this.gridOuter = new Float64Array(n2 * n2), this.gridInner = new Float64Array(n2 * n2), this.f = new Float64Array(n2), this.z = new Float64Array(n2 + 1), this.v = new Uint16Array(n2);
|
||
}
|
||
_createCanvas(t2) {
|
||
const e2 = document.createElement("canvas");
|
||
return e2.width = e2.height = t2, e2;
|
||
}
|
||
draw(t2) {
|
||
const { width: e2, actualBoundingBoxAscent: i3, actualBoundingBoxDescent: s2, actualBoundingBoxLeft: a2, actualBoundingBoxRight: o2 } = this.ctx.measureText(t2), r2 = Math.ceil(i3), n2 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(o2 - a2))), l2 = Math.min(this.size - this.buffer, r2 + Math.ceil(s2)), h2 = n2 + 2 * this.buffer, c2 = l2 + 2 * this.buffer, u2 = Math.max(h2 * c2, 0), d2 = new Uint8ClampedArray(u2), _2 = { data: d2, width: h2, height: c2, glyphWidth: n2, glyphHeight: l2, glyphTop: r2, glyphLeft: 0, glyphAdvance: e2 };
|
||
if (0 === n2 || 0 === l2) return _2;
|
||
const { ctx: p2, buffer: m2, gridInner: f2, gridOuter: g2 } = this;
|
||
p2.clearRect(m2, m2, n2, l2), p2.fillText(t2, m2, m2 + r2);
|
||
const v2 = p2.getImageData(m2, m2, n2, l2);
|
||
g2.fill(w, 0, u2), f2.fill(0, 0, u2);
|
||
for (let t3 = 0; t3 < l2; t3++) for (let e3 = 0; e3 < n2; e3++) {
|
||
const i4 = v2.data[4 * (t3 * n2 + e3) + 3] / 255;
|
||
if (0 === i4) continue;
|
||
const s3 = (t3 + m2) * h2 + e3 + m2;
|
||
if (1 === i4) g2[s3] = 0, f2[s3] = w;
|
||
else {
|
||
const t4 = 0.5 - i4;
|
||
g2[s3] = t4 > 0 ? t4 * t4 : 0, f2[s3] = t4 < 0 ? t4 * t4 : 0;
|
||
}
|
||
}
|
||
T(g2, 0, 0, h2, c2, h2, this.f, this.v, this.z), T(f2, m2, m2, n2, l2, h2, this.f, this.v, this.z);
|
||
for (let t3 = 0; t3 < u2; t3++) {
|
||
const e3 = Math.sqrt(g2[t3]) - Math.sqrt(f2[t3]);
|
||
d2[t3] = Math.round(255 - 255 * (e3 / this.radius + this.cutoff));
|
||
}
|
||
return _2;
|
||
}
|
||
};
|
||
class S {
|
||
constructor() {
|
||
this.specification = t.v.light.position;
|
||
}
|
||
possiblyEvaluate(e2, i3) {
|
||
return t.z(e2.expression.evaluate(i3));
|
||
}
|
||
interpolate(e2, i3, s2) {
|
||
return { x: t.B.number(e2.x, i3.x, s2), y: t.B.number(e2.y, i3.y, s2), z: t.B.number(e2.z, i3.z, s2) };
|
||
}
|
||
}
|
||
let C;
|
||
class P extends t.E {
|
||
constructor(e2) {
|
||
super(), C = C || new t.r({ anchor: new t.D(t.v.light.anchor), position: new S(), color: new t.D(t.v.light.color), intensity: new t.D(t.v.light.intensity) }), this._transitionable = new t.T(C), this.setLight(e2), this._transitioning = this._transitionable.untransitioned();
|
||
}
|
||
getLight() {
|
||
return this._transitionable.serialize();
|
||
}
|
||
setLight(e2, i3 = {}) {
|
||
if (!this._validate(t.t, e2, i3)) for (const t2 in e2) {
|
||
const i4 = e2[t2];
|
||
t2.endsWith("-transition") ? this._transitionable.setTransition(t2.slice(0, -11), i4) : this._transitionable.setValue(t2, i4);
|
||
}
|
||
}
|
||
updateTransitions(t2) {
|
||
this._transitioning = this._transitionable.transitioned(t2, this._transitioning);
|
||
}
|
||
hasTransition() {
|
||
return this._transitioning.hasTransition();
|
||
}
|
||
recalculate(t2) {
|
||
this.properties = this._transitioning.possiblyEvaluate(t2);
|
||
}
|
||
_validate(e2, i3, s2) {
|
||
return (!s2 || false !== s2.validate) && t.x(this, e2.call(t.y, t.e({ value: i3, style: { glyphs: true, sprite: true }, styleSpec: t.v })));
|
||
}
|
||
}
|
||
class D {
|
||
constructor(t2, e2) {
|
||
this.width = t2, this.height = e2, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};
|
||
}
|
||
getDash(t2, e2) {
|
||
const i3 = t2.join(",") + String(e2);
|
||
return this.dashEntry[i3] || (this.dashEntry[i3] = this.addDash(t2, e2)), this.dashEntry[i3];
|
||
}
|
||
getDashRanges(t2, e2, i3) {
|
||
const s2 = [];
|
||
let a2 = t2.length % 2 == 1 ? -t2[t2.length - 1] * i3 : 0, o2 = t2[0] * i3, r2 = true;
|
||
s2.push({ left: a2, right: o2, isDash: r2, zeroLength: 0 === t2[0] });
|
||
let n2 = t2[0];
|
||
for (let e3 = 1; e3 < t2.length; e3++) {
|
||
r2 = !r2;
|
||
const l2 = t2[e3];
|
||
a2 = n2 * i3, n2 += l2, o2 = n2 * i3, s2.push({ left: a2, right: o2, isDash: r2, zeroLength: 0 === l2 });
|
||
}
|
||
return s2;
|
||
}
|
||
addRoundDash(t2, e2, i3) {
|
||
const s2 = e2 / 2;
|
||
for (let e3 = -i3; e3 <= i3; e3++) {
|
||
const a2 = this.width * (this.nextRow + i3 + e3);
|
||
let o2 = 0, r2 = t2[o2];
|
||
for (let n2 = 0; n2 < this.width; n2++) {
|
||
n2 / r2.right > 1 && (r2 = t2[++o2]);
|
||
const l2 = Math.abs(n2 - r2.left), h2 = Math.abs(n2 - r2.right), c2 = Math.min(l2, h2);
|
||
let u2;
|
||
const d2 = e3 / i3 * (s2 + 1);
|
||
if (r2.isDash) {
|
||
const t3 = s2 - Math.abs(d2);
|
||
u2 = Math.sqrt(c2 * c2 + t3 * t3);
|
||
} else u2 = s2 - Math.sqrt(c2 * c2 + d2 * d2);
|
||
this.data[a2 + n2] = Math.max(0, Math.min(255, u2 + 128));
|
||
}
|
||
}
|
||
}
|
||
addRegularDash(t2) {
|
||
for (let e3 = t2.length - 1; e3 >= 0; --e3) {
|
||
const i4 = t2[e3], s3 = t2[e3 + 1];
|
||
i4.zeroLength ? t2.splice(e3, 1) : s3 && s3.isDash === i4.isDash && (s3.left = i4.left, t2.splice(e3, 1));
|
||
}
|
||
const e2 = t2[0], i3 = t2[t2.length - 1];
|
||
e2.isDash === i3.isDash && (e2.left = i3.left - this.width, i3.right = e2.right + this.width);
|
||
const s2 = this.width * this.nextRow;
|
||
let a2 = 0, o2 = t2[a2];
|
||
for (let e3 = 0; e3 < this.width; e3++) {
|
||
e3 / o2.right > 1 && (o2 = t2[++a2]);
|
||
const i4 = Math.abs(e3 - o2.left), r2 = Math.abs(e3 - o2.right), n2 = Math.min(i4, r2);
|
||
this.data[s2 + e3] = Math.max(0, Math.min(255, (o2.isDash ? n2 : -n2) + 128));
|
||
}
|
||
}
|
||
addDash(e2, i3) {
|
||
const s2 = i3 ? 7 : 0, a2 = 2 * s2 + 1;
|
||
if (this.nextRow + a2 > this.height) return t.w("LineAtlas out of space"), null;
|
||
let o2 = 0;
|
||
for (let t2 = 0; t2 < e2.length; t2++) o2 += e2[t2];
|
||
if (0 !== o2) {
|
||
const t2 = this.width / o2, a3 = this.getDashRanges(e2, this.width, t2);
|
||
i3 ? this.addRoundDash(a3, t2, s2) : this.addRegularDash(a3);
|
||
}
|
||
const r2 = { y: (this.nextRow + s2 + 0.5) / this.height, height: 2 * s2 / this.height, width: o2 };
|
||
return this.nextRow += a2, this.dirty = true, r2;
|
||
}
|
||
bind(t2) {
|
||
const e2 = t2.gl;
|
||
this.texture ? (e2.bindTexture(e2.TEXTURE_2D, this.texture), this.dirty && (this.dirty = false, e2.texSubImage2D(e2.TEXTURE_2D, 0, 0, 0, this.width, this.height, e2.ALPHA, e2.UNSIGNED_BYTE, this.data))) : (this.texture = e2.createTexture(), e2.bindTexture(e2.TEXTURE_2D, this.texture), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_S, e2.REPEAT), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_WRAP_T, e2.REPEAT), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MIN_FILTER, e2.LINEAR), e2.texParameteri(e2.TEXTURE_2D, e2.TEXTURE_MAG_FILTER, e2.LINEAR), e2.texImage2D(e2.TEXTURE_2D, 0, e2.ALPHA, this.width, this.height, 0, e2.ALPHA, e2.UNSIGNED_BYTE, this.data));
|
||
}
|
||
}
|
||
class M {
|
||
constructor(e2, i3, s2) {
|
||
this.workerPool = e2, this.actors = [], this.currentActor = 0, this.id = s2;
|
||
const a2 = this.workerPool.acquire(s2);
|
||
for (let e3 = 0; e3 < a2.length; e3++) {
|
||
const o2 = new t.C(a2[e3], i3, s2);
|
||
o2.name = `Worker ${e3}`, this.actors.push(o2);
|
||
}
|
||
if (!this.actors.length) throw new Error("No actors found");
|
||
}
|
||
broadcast(e2, i3, s2) {
|
||
t.o(this.actors, ((t2, s3) => {
|
||
t2.send(e2, i3, s3);
|
||
}), s2 = s2 || function() {
|
||
});
|
||
}
|
||
getActor() {
|
||
return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];
|
||
}
|
||
remove(t2 = true) {
|
||
this.actors.forEach(((t3) => {
|
||
t3.remove();
|
||
})), this.actors = [], t2 && this.workerPool.release(this.id);
|
||
}
|
||
}
|
||
function z(e2, i3, s2) {
|
||
const a2 = function(i4, a3) {
|
||
if (i4) return s2(i4);
|
||
if (a3) {
|
||
const i5 = t.F(t.e(a3, e2), ["tiles", "minzoom", "maxzoom", "attribution", "bounds", "scheme", "tileSize", "encoding"]);
|
||
a3.vector_layers && (i5.vectorLayers = a3.vector_layers, i5.vectorLayerIds = i5.vectorLayers.map(((t2) => t2.id))), s2(null, i5);
|
||
}
|
||
};
|
||
return e2.url ? t.f(i3.transformRequest(e2.url, c.Source), a2) : t.h.frame((() => a2(null, e2)));
|
||
}
|
||
class L {
|
||
constructor(t2, e2) {
|
||
t2 && (e2 ? this.setSouthWest(t2).setNorthEast(e2) : Array.isArray(t2) && (4 === t2.length ? this.setSouthWest([t2[0], t2[1]]).setNorthEast([t2[2], t2[3]]) : this.setSouthWest(t2[0]).setNorthEast(t2[1])));
|
||
}
|
||
setNorthEast(e2) {
|
||
return this._ne = e2 instanceof t.L ? new t.L(e2.lng, e2.lat) : t.L.convert(e2), this;
|
||
}
|
||
setSouthWest(e2) {
|
||
return this._sw = e2 instanceof t.L ? new t.L(e2.lng, e2.lat) : t.L.convert(e2), this;
|
||
}
|
||
extend(e2) {
|
||
const i3 = this._sw, s2 = this._ne;
|
||
let a2, o2;
|
||
if (e2 instanceof t.L) a2 = e2, o2 = e2;
|
||
else {
|
||
if (!(e2 instanceof L)) return Array.isArray(e2) ? 4 === e2.length || e2.every(Array.isArray) ? this.extend(L.convert(e2)) : this.extend(t.L.convert(e2)) : e2 && ("lng" in e2 || "lon" in e2) && "lat" in e2 ? this.extend(t.L.convert(e2)) : this;
|
||
if (a2 = e2._sw, o2 = e2._ne, !a2 || !o2) return this;
|
||
}
|
||
return i3 || s2 ? (i3.lng = Math.min(a2.lng, i3.lng), i3.lat = Math.min(a2.lat, i3.lat), s2.lng = Math.max(o2.lng, s2.lng), s2.lat = Math.max(o2.lat, s2.lat)) : (this._sw = new t.L(a2.lng, a2.lat), this._ne = new t.L(o2.lng, o2.lat)), this;
|
||
}
|
||
getCenter() {
|
||
return new t.L((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2);
|
||
}
|
||
getSouthWest() {
|
||
return this._sw;
|
||
}
|
||
getNorthEast() {
|
||
return this._ne;
|
||
}
|
||
getNorthWest() {
|
||
return new t.L(this.getWest(), this.getNorth());
|
||
}
|
||
getSouthEast() {
|
||
return new t.L(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(e2) {
|
||
const { lng: i3, lat: s2 } = t.L.convert(e2);
|
||
let a2 = this._sw.lng <= i3 && i3 <= this._ne.lng;
|
||
return this._sw.lng > this._ne.lng && (a2 = this._sw.lng >= i3 && i3 >= this._ne.lng), this._sw.lat <= s2 && s2 <= this._ne.lat && a2;
|
||
}
|
||
static convert(t2) {
|
||
return t2 instanceof L ? t2 : t2 ? new L(t2) : t2;
|
||
}
|
||
static fromLngLat(e2, i3 = 0) {
|
||
const s2 = 360 * i3 / 40075017, a2 = s2 / Math.cos(Math.PI / 180 * e2.lat);
|
||
return new L(new t.L(e2.lng - a2, e2.lat - s2), new t.L(e2.lng + a2, e2.lat + s2));
|
||
}
|
||
}
|
||
class A {
|
||
constructor(t2, e2, i3) {
|
||
this.bounds = L.convert(this.validateBounds(t2)), this.minzoom = e2 || 0, this.maxzoom = i3 || 24;
|
||
}
|
||
validateBounds(t2) {
|
||
return Array.isArray(t2) && 4 === t2.length ? [Math.max(-180, t2[0]), Math.max(-90, t2[1]), Math.min(180, t2[2]), Math.min(90, t2[3])] : [-180, -90, 180, 90];
|
||
}
|
||
contains(e2) {
|
||
const i3 = Math.pow(2, e2.z), s2 = Math.floor(t.G(this.bounds.getWest()) * i3), a2 = Math.floor(t.H(this.bounds.getNorth()) * i3), o2 = Math.ceil(t.G(this.bounds.getEast()) * i3), r2 = Math.ceil(t.H(this.bounds.getSouth()) * i3);
|
||
return e2.x >= s2 && e2.x < o2 && e2.y >= a2 && e2.y < r2;
|
||
}
|
||
}
|
||
class R extends t.E {
|
||
constructor(e2, i3, s2, a2) {
|
||
if (super(), this.load = () => {
|
||
this._loaded = false, this.fire(new t.k("dataloading", { dataType: "source" })), this._tileJSONRequest = z(this._options, this.map._requestManager, ((e3, i4) => {
|
||
this._tileJSONRequest = null, this._loaded = true, this.map.style.sourceCaches[this.id].clearTiles(), e3 ? this.fire(new t.j(e3)) : i4 && (t.e(this, i4), i4.bounds && (this.tileBounds = new A(i4.bounds, this.minzoom, this.maxzoom)), this.fire(new t.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new t.k("data", { dataType: "source", sourceDataType: "content" })));
|
||
}));
|
||
}, this.serialize = () => t.e({}, this._options), this.id = e2, this.dispatcher = s2, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = true, this.isTileClipped = true, this._loaded = false, t.e(this, t.F(i3, ["url", "scheme", "tileSize", "promoteId"])), this._options = t.e({ type: "vector" }, i3), this._collectResourceTiming = i3.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512");
|
||
this.setEventedParent(a2);
|
||
}
|
||
loaded() {
|
||
return this._loaded;
|
||
}
|
||
hasTile(t2) {
|
||
return !this.tileBounds || this.tileBounds.contains(t2.canonical);
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this.load();
|
||
}
|
||
setSourceProperty(t2) {
|
||
this._tileJSONRequest && this._tileJSONRequest.cancel(), t2(), this.load();
|
||
}
|
||
setTiles(t2) {
|
||
return this.setSourceProperty((() => {
|
||
this._options.tiles = t2;
|
||
})), this;
|
||
}
|
||
setUrl(t2) {
|
||
return this.setSourceProperty((() => {
|
||
this.url = t2, this._options.url = t2;
|
||
})), this;
|
||
}
|
||
onRemove() {
|
||
this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null);
|
||
}
|
||
loadTile(t2, e2) {
|
||
const i3 = t2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), s2 = { request: this.map._requestManager.transformRequest(i3, c.Tile), uid: t2.uid, tileID: t2.tileID, zoom: t2.tileID.overscaledZ, tileSize: this.tileSize * t2.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
|
||
function a2(i4, s3) {
|
||
return delete t2.request, t2.aborted ? e2(null) : i4 && 404 !== i4.status ? e2(i4) : (s3 && s3.resourceTiming && (t2.resourceTiming = s3.resourceTiming), this.map._refreshExpiredTiles && s3 && t2.setExpiryData(s3), t2.loadVectorData(s3, this.map.painter), e2(null), void (t2.reloadCallback && (this.loadTile(t2, t2.reloadCallback), t2.reloadCallback = null)));
|
||
}
|
||
s2.request.collectResourceTiming = this._collectResourceTiming, t2.actor && "expired" !== t2.state ? "loading" === t2.state ? t2.reloadCallback = e2 : t2.request = t2.actor.send("reloadTile", s2, a2.bind(this)) : (t2.actor = this.dispatcher.getActor(), t2.request = t2.actor.send("loadTile", s2, a2.bind(this)));
|
||
}
|
||
abortTile(t2) {
|
||
t2.request && (t2.request.cancel(), delete t2.request), t2.actor && t2.actor.send("abortTile", { uid: t2.uid, type: this.type, source: this.id }, void 0);
|
||
}
|
||
unloadTile(t2) {
|
||
t2.unloadVectorData(), t2.actor && t2.actor.send("removeTile", { uid: t2.uid, type: this.type, source: this.id }, void 0);
|
||
}
|
||
hasTransition() {
|
||
return false;
|
||
}
|
||
}
|
||
class k extends t.E {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(), this.id = e2, this.dispatcher = s2, this.setEventedParent(a2), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = true, this.scheme = "xyz", this.tileSize = 512, this._loaded = false, this._options = t.e({ type: "raster" }, i3), t.e(this, t.F(i3, ["url", "scheme", "tileSize"]));
|
||
}
|
||
load() {
|
||
this._loaded = false, this.fire(new t.k("dataloading", { dataType: "source" })), this._tileJSONRequest = z(this._options, this.map._requestManager, ((e2, i3) => {
|
||
this._tileJSONRequest = null, this._loaded = true, e2 ? this.fire(new t.j(e2)) : i3 && (t.e(this, i3), i3.bounds && (this.tileBounds = new A(i3.bounds, this.minzoom, this.maxzoom)), this.fire(new t.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new t.k("data", { dataType: "source", sourceDataType: "content" })));
|
||
}));
|
||
}
|
||
loaded() {
|
||
return this._loaded;
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this.load();
|
||
}
|
||
onRemove() {
|
||
this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null);
|
||
}
|
||
setSourceProperty(t2) {
|
||
this._tileJSONRequest && this._tileJSONRequest.cancel(), t2(), this.load();
|
||
}
|
||
setTiles(t2) {
|
||
return this.setSourceProperty((() => {
|
||
this._options.tiles = t2;
|
||
})), this;
|
||
}
|
||
serialize() {
|
||
return t.e({}, this._options);
|
||
}
|
||
hasTile(t2) {
|
||
return !this.tileBounds || this.tileBounds.contains(t2.canonical);
|
||
}
|
||
loadTile(t2, e2) {
|
||
const i3 = t2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
|
||
t2.request = h.getImage(this.map._requestManager.transformRequest(i3, c.Tile), ((i4, s2, a2) => {
|
||
if (delete t2.request, t2.aborted) t2.state = "unloaded", e2(null);
|
||
else if (i4) t2.state = "errored", e2(i4);
|
||
else if (s2) {
|
||
this.map._refreshExpiredTiles && a2 && t2.setExpiryData(a2);
|
||
const i5 = this.map.painter.context, o2 = i5.gl;
|
||
t2.texture = this.map.painter.getTileTexture(s2.width), t2.texture ? t2.texture.update(s2, { useMipmap: true }) : (t2.texture = new x(i5, s2, o2.RGBA, { useMipmap: true }), t2.texture.bind(o2.LINEAR, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), i5.extTextureFilterAnisotropic && o2.texParameterf(o2.TEXTURE_2D, i5.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, i5.extTextureFilterAnisotropicMax)), t2.state = "loaded", e2(null);
|
||
}
|
||
}), this.map._refreshExpiredTiles);
|
||
}
|
||
abortTile(t2, e2) {
|
||
t2.request && (t2.request.cancel(), delete t2.request), e2();
|
||
}
|
||
unloadTile(t2, e2) {
|
||
t2.texture && this.map.painter.saveTileTexture(t2.texture), e2();
|
||
}
|
||
hasTransition() {
|
||
return false;
|
||
}
|
||
}
|
||
class F extends k {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(e2, i3, s2, a2), this.type = "raster-dem", this.maxzoom = 22, this._options = t.e({ type: "raster-dem" }, i3), this.encoding = i3.encoding || "mapbox", this.redFactor = i3.redFactor, this.greenFactor = i3.greenFactor, this.blueFactor = i3.blueFactor, this.baseShift = i3.baseShift;
|
||
}
|
||
loadTile(e2, i3) {
|
||
const s2 = e2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), a2 = this.map._requestManager.transformRequest(s2, c.Tile);
|
||
function o2(t2, s3) {
|
||
t2 && (e2.state = "errored", i3(t2)), s3 && (e2.dem = s3, e2.needsHillshadePrepare = true, e2.needsTerrainPrepare = true, e2.state = "loaded", i3(null));
|
||
}
|
||
e2.neighboringTiles = this._getNeighboringTiles(e2.tileID), e2.request = h.getImage(a2, ((s3, a3, r2) => t._(this, void 0, void 0, (function* () {
|
||
if (delete e2.request, e2.aborted) e2.state = "unloaded", i3(null);
|
||
else if (s3) e2.state = "errored", i3(s3);
|
||
else if (a3) {
|
||
this.map._refreshExpiredTiles && e2.setExpiryData(r2);
|
||
const i4 = t.a(a3) && t.J() ? a3 : yield (function(e3) {
|
||
return t._(this, void 0, void 0, (function* () {
|
||
if ("undefined" != typeof VideoFrame && t.K()) {
|
||
const i5 = e3.width + 2, s5 = e3.height + 2;
|
||
try {
|
||
return new t.R({ width: i5, height: s5 }, yield t.M(e3, -1, -1, i5, s5));
|
||
} catch (t2) {
|
||
}
|
||
}
|
||
return t.h.getImageData(e3, 1);
|
||
}));
|
||
})(a3), s4 = { uid: e2.uid, coord: e2.tileID, source: this.id, rawImageData: i4, encoding: this.encoding, redFactor: this.redFactor, greenFactor: this.greenFactor, blueFactor: this.blueFactor, baseShift: this.baseShift };
|
||
e2.actor && "expired" !== e2.state || (e2.actor = this.dispatcher.getActor(), e2.actor.send("loadDEMTile", s4, o2));
|
||
}
|
||
}))), this.map._refreshExpiredTiles);
|
||
}
|
||
_getNeighboringTiles(e2) {
|
||
const i3 = e2.canonical, s2 = Math.pow(2, i3.z), a2 = (i3.x - 1 + s2) % s2, o2 = 0 === i3.x ? e2.wrap - 1 : e2.wrap, r2 = (i3.x + 1 + s2) % s2, n2 = i3.x + 1 === s2 ? e2.wrap + 1 : e2.wrap, l2 = {};
|
||
return l2[new t.O(e2.overscaledZ, o2, i3.z, a2, i3.y).key] = { backfilled: false }, l2[new t.O(e2.overscaledZ, n2, i3.z, r2, i3.y).key] = { backfilled: false }, i3.y > 0 && (l2[new t.O(e2.overscaledZ, o2, i3.z, a2, i3.y - 1).key] = { backfilled: false }, l2[new t.O(e2.overscaledZ, e2.wrap, i3.z, i3.x, i3.y - 1).key] = { backfilled: false }, l2[new t.O(e2.overscaledZ, n2, i3.z, r2, i3.y - 1).key] = { backfilled: false }), i3.y + 1 < s2 && (l2[new t.O(e2.overscaledZ, o2, i3.z, a2, i3.y + 1).key] = { backfilled: false }, l2[new t.O(e2.overscaledZ, e2.wrap, i3.z, i3.x, i3.y + 1).key] = { backfilled: false }, l2[new t.O(e2.overscaledZ, n2, i3.z, r2, i3.y + 1).key] = { backfilled: false }), l2;
|
||
}
|
||
unloadTile(t2) {
|
||
t2.demTexture && this.map.painter.saveTileTexture(t2.demTexture), t2.fbo && (t2.fbo.destroy(), delete t2.fbo), t2.dem && delete t2.dem, delete t2.neighboringTiles, t2.state = "unloaded", t2.actor && t2.actor.send("removeDEMTile", { uid: t2.uid, source: this.id });
|
||
}
|
||
}
|
||
class B extends t.E {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(), this.load = () => {
|
||
this._updateWorkerData();
|
||
}, this.serialize = () => t.e({}, this._options, { type: this.type, data: this._data }), this.id = e2, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = true, this.reparseOverscaled = true, this._removed = false, this._pendingLoads = 0, this.actor = s2.getActor(), this.setEventedParent(a2), this._data = i3.data, this._options = t.e({}, i3), this._collectResourceTiming = i3.collectResourceTiming, void 0 !== i3.maxzoom && (this.maxzoom = i3.maxzoom), i3.type && (this.type = i3.type), i3.attribution && (this.attribution = i3.attribution), this.promoteId = i3.promoteId;
|
||
const o2 = t.N / this.tileSize;
|
||
this.workerOptions = t.e({ source: this.id, cluster: i3.cluster || false, geojsonVtOptions: { buffer: (void 0 !== i3.buffer ? i3.buffer : 128) * o2, tolerance: (void 0 !== i3.tolerance ? i3.tolerance : 0.375) * o2, extent: t.N, maxZoom: this.maxzoom, lineMetrics: i3.lineMetrics || false, generateId: i3.generateId || false }, superclusterOptions: { maxZoom: void 0 !== i3.clusterMaxZoom ? i3.clusterMaxZoom : this.maxzoom - 1, minPoints: Math.max(2, i3.clusterMinPoints || 2), extent: t.N, radius: (i3.clusterRadius || 50) * o2, log: false, generateId: i3.generateId || false }, clusterProperties: i3.clusterProperties, filter: i3.filter }, i3.workerOptions), "string" == typeof this.promoteId && (this.workerOptions.promoteId = this.promoteId);
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this.load();
|
||
}
|
||
setData(t2) {
|
||
return this._data = t2, this._updateWorkerData(), this;
|
||
}
|
||
updateData(t2) {
|
||
return this._updateWorkerData(t2), this;
|
||
}
|
||
setClusterOptions(t2) {
|
||
return this.workerOptions.cluster = t2.cluster, t2 && (void 0 !== t2.clusterRadius && (this.workerOptions.superclusterOptions.radius = t2.clusterRadius), void 0 !== t2.clusterMaxZoom && (this.workerOptions.superclusterOptions.maxZoom = t2.clusterMaxZoom)), this._updateWorkerData(), this;
|
||
}
|
||
getClusterExpansionZoom(t2, e2) {
|
||
return this.actor.send("geojson.getClusterExpansionZoom", { clusterId: t2, source: this.id }, e2), this;
|
||
}
|
||
getClusterChildren(t2, e2) {
|
||
return this.actor.send("geojson.getClusterChildren", { clusterId: t2, source: this.id }, e2), this;
|
||
}
|
||
getClusterLeaves(t2, e2, i3, s2) {
|
||
return this.actor.send("geojson.getClusterLeaves", { source: this.id, clusterId: t2, limit: e2, offset: i3 }, s2), this;
|
||
}
|
||
_updateWorkerData(e2) {
|
||
const i3 = t.e({}, this.workerOptions);
|
||
e2 ? i3.dataDiff = e2 : "string" == typeof this._data ? (i3.request = this.map._requestManager.transformRequest(t.h.resolveURL(this._data), c.Source), i3.request.collectResourceTiming = this._collectResourceTiming) : i3.data = JSON.stringify(this._data), this._pendingLoads++, this.fire(new t.k("dataloading", { dataType: "source" })), this.actor.send(`${this.type}.loadData`, i3, ((e3, i4) => {
|
||
if (this._pendingLoads--, this._removed || i4 && i4.abandoned) return void this.fire(new t.k("dataabort", { dataType: "source" }));
|
||
let s2 = null;
|
||
if (i4 && i4.resourceTiming && i4.resourceTiming[this.id] && (s2 = i4.resourceTiming[this.id].slice(0)), e3) return void this.fire(new t.j(e3));
|
||
const a2 = { dataType: "source" };
|
||
this._collectResourceTiming && s2 && s2.length > 0 && t.e(a2, { resourceTiming: s2 }), this.fire(new t.k("data", Object.assign(Object.assign({}, a2), { sourceDataType: "metadata" }))), this.fire(new t.k("data", Object.assign(Object.assign({}, a2), { sourceDataType: "content" })));
|
||
}));
|
||
}
|
||
loaded() {
|
||
return 0 === this._pendingLoads;
|
||
}
|
||
loadTile(t2, e2) {
|
||
const i3 = t2.actor ? "reloadTile" : "loadTile";
|
||
t2.actor = this.actor;
|
||
const s2 = { type: this.type, uid: t2.uid, tileID: t2.tileID, zoom: t2.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
|
||
t2.request = this.actor.send(i3, s2, ((s3, a2) => (delete t2.request, t2.unloadVectorData(), t2.aborted ? e2(null) : s3 ? e2(s3) : (t2.loadVectorData(a2, this.map.painter, "reloadTile" === i3), e2(null)))));
|
||
}
|
||
abortTile(t2) {
|
||
t2.request && (t2.request.cancel(), delete t2.request), t2.aborted = true;
|
||
}
|
||
unloadTile(t2) {
|
||
t2.unloadVectorData(), this.actor.send("removeTile", { uid: t2.uid, type: this.type, source: this.id });
|
||
}
|
||
onRemove() {
|
||
this._removed = true, this.actor.send("removeSource", { type: this.type, source: this.id });
|
||
}
|
||
hasTransition() {
|
||
return false;
|
||
}
|
||
}
|
||
var O = t.Q([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]);
|
||
class N extends t.E {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(), this.load = (e3, i4) => {
|
||
this._loaded = false, this.fire(new t.k("dataloading", { dataType: "source" })), this.url = this.options.url, this._request = h.getImage(this.map._requestManager.transformRequest(this.url, c.Image), ((s3, a3) => {
|
||
this._request = null, this._loaded = true, s3 ? this.fire(new t.j(s3)) : a3 && (this.image = a3, e3 && (this.coordinates = e3), i4 && i4(), this._finishLoading());
|
||
}));
|
||
}, this.prepare = () => {
|
||
if (0 === Object.keys(this.tiles).length || !this.image) return;
|
||
const e3 = this.map.painter.context, i4 = e3.gl;
|
||
this.boundsBuffer || (this.boundsBuffer = e3.createVertexBuffer(this._boundsArray, O.members)), this.boundsSegments || (this.boundsSegments = t.S.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new x(e3, this.image, i4.RGBA), this.texture.bind(i4.LINEAR, i4.CLAMP_TO_EDGE));
|
||
let s3 = false;
|
||
for (const t2 in this.tiles) {
|
||
const e4 = this.tiles[t2];
|
||
"loaded" !== e4.state && (e4.state = "loaded", e4.texture = this.texture, s3 = true);
|
||
}
|
||
s3 && this.fire(new t.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
|
||
}, this.serialize = () => ({ type: "image", url: this.options.url, coordinates: this.coordinates }), this.id = e2, this.dispatcher = s2, this.coordinates = i3.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = false, this.setEventedParent(a2), this.options = i3;
|
||
}
|
||
loaded() {
|
||
return this._loaded;
|
||
}
|
||
updateImage(t2) {
|
||
return t2.url ? (this._request && (this._request.cancel(), this._request = null), this.options.url = t2.url, this.load(t2.coordinates, (() => {
|
||
this.texture = null;
|
||
})), this) : this;
|
||
}
|
||
_finishLoading() {
|
||
this.map && (this.setCoordinates(this.coordinates), this.fire(new t.k("data", { dataType: "source", sourceDataType: "metadata" })));
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this.load();
|
||
}
|
||
onRemove() {
|
||
this._request && (this._request.cancel(), this._request = null);
|
||
}
|
||
setCoordinates(e2) {
|
||
this.coordinates = e2;
|
||
const i3 = e2.map(t.U.fromLngLat);
|
||
this.tileID = (function(e3) {
|
||
let i4 = 1 / 0, s3 = 1 / 0, a2 = -1 / 0, o2 = -1 / 0;
|
||
for (const t2 of e3) i4 = Math.min(i4, t2.x), s3 = Math.min(s3, t2.y), a2 = Math.max(a2, t2.x), o2 = Math.max(o2, t2.y);
|
||
const r2 = Math.max(a2 - i4, o2 - s3), n2 = Math.max(0, Math.floor(-Math.log(r2) / Math.LN2)), l2 = Math.pow(2, n2);
|
||
return new t.W(n2, Math.floor((i4 + a2) / 2 * l2), Math.floor((s3 + o2) / 2 * l2));
|
||
})(i3), this.minzoom = this.maxzoom = this.tileID.z;
|
||
const s2 = i3.map(((t2) => this.tileID.getTilePoint(t2)._round()));
|
||
return this._boundsArray = new t.V(), this._boundsArray.emplaceBack(s2[0].x, s2[0].y, 0, 0), this._boundsArray.emplaceBack(s2[1].x, s2[1].y, t.N, 0), this._boundsArray.emplaceBack(s2[3].x, s2[3].y, 0, t.N), this._boundsArray.emplaceBack(s2[2].x, s2[2].y, t.N, t.N), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new t.k("data", { dataType: "source", sourceDataType: "content" })), this;
|
||
}
|
||
loadTile(t2, e2) {
|
||
this.tileID && this.tileID.equals(t2.tileID.canonical) ? (this.tiles[String(t2.tileID.wrap)] = t2, t2.buckets = {}, e2(null)) : (t2.state = "errored", e2(null));
|
||
}
|
||
hasTransition() {
|
||
return false;
|
||
}
|
||
}
|
||
class U extends N {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(e2, i3, s2, a2), this.load = () => {
|
||
this._loaded = false;
|
||
const e3 = this.options;
|
||
this.urls = [];
|
||
for (const t2 of e3.urls) this.urls.push(this.map._requestManager.transformRequest(t2, c.Source).url);
|
||
t.X(this.urls, ((e4, i4) => {
|
||
this._loaded = true, e4 ? this.fire(new t.j(e4)) : i4 && (this.video = i4, this.video.loop = true, this.video.addEventListener("playing", (() => {
|
||
this.map.triggerRepaint();
|
||
})), this.map && this.video.play(), this._finishLoading());
|
||
}));
|
||
}, this.prepare = () => {
|
||
if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) return;
|
||
const e3 = this.map.painter.context, i4 = e3.gl;
|
||
this.boundsBuffer || (this.boundsBuffer = e3.createVertexBuffer(this._boundsArray, O.members)), this.boundsSegments || (this.boundsSegments = t.S.simpleSegment(0, 0, 4, 2)), this.texture ? this.video.paused || (this.texture.bind(i4.LINEAR, i4.CLAMP_TO_EDGE), i4.texSubImage2D(i4.TEXTURE_2D, 0, 0, 0, i4.RGBA, i4.UNSIGNED_BYTE, this.video)) : (this.texture = new x(e3, this.video, i4.RGBA), this.texture.bind(i4.LINEAR, i4.CLAMP_TO_EDGE));
|
||
let s3 = false;
|
||
for (const t2 in this.tiles) {
|
||
const e4 = this.tiles[t2];
|
||
"loaded" !== e4.state && (e4.state = "loaded", e4.texture = this.texture, s3 = true);
|
||
}
|
||
s3 && this.fire(new t.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
|
||
}, this.serialize = () => ({ type: "video", urls: this.urls, coordinates: this.coordinates }), this.roundZoom = true, this.type = "video", this.options = i3;
|
||
}
|
||
pause() {
|
||
this.video && this.video.pause();
|
||
}
|
||
play() {
|
||
this.video && this.video.play();
|
||
}
|
||
seek(e2) {
|
||
if (this.video) {
|
||
const i3 = this.video.seekable;
|
||
e2 < i3.start(0) || e2 > i3.end(0) ? this.fire(new t.j(new t.Y(`sources.${this.id}`, null, `Playback for this video can be set only between the ${i3.start(0)} and ${i3.end(0)}-second mark.`))) : this.video.currentTime = e2;
|
||
}
|
||
}
|
||
getVideo() {
|
||
return this.video;
|
||
}
|
||
onAdd(t2) {
|
||
this.map || (this.map = t2, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));
|
||
}
|
||
hasTransition() {
|
||
return this.video && !this.video.paused;
|
||
}
|
||
}
|
||
class Z extends N {
|
||
constructor(e2, i3, s2, a2) {
|
||
super(e2, i3, s2, a2), this.load = () => {
|
||
this._loaded = true, 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 t.j(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
|
||
this._playing = true, this.map.triggerRepaint();
|
||
}, this.pause = function() {
|
||
this._playing && (this.prepare(), this._playing = false);
|
||
}, this._finishLoading());
|
||
}, this.prepare = () => {
|
||
let e3 = false;
|
||
if (this.canvas.width !== this.width && (this.width = this.canvas.width, e3 = true), this.canvas.height !== this.height && (this.height = this.canvas.height, e3 = true), this._hasInvalidDimensions()) return;
|
||
if (0 === Object.keys(this.tiles).length) return;
|
||
const i4 = this.map.painter.context, s3 = i4.gl;
|
||
this.boundsBuffer || (this.boundsBuffer = i4.createVertexBuffer(this._boundsArray, O.members)), this.boundsSegments || (this.boundsSegments = t.S.simpleSegment(0, 0, 4, 2)), this.texture ? (e3 || this._playing) && this.texture.update(this.canvas, { premultiply: true }) : this.texture = new x(i4, this.canvas, s3.RGBA, { premultiply: true });
|
||
let a3 = false;
|
||
for (const t2 in this.tiles) {
|
||
const e4 = this.tiles[t2];
|
||
"loaded" !== e4.state && (e4.state = "loaded", e4.texture = this.texture, a3 = true);
|
||
}
|
||
a3 && this.fire(new t.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
|
||
}, this.serialize = () => ({ type: "canvas", coordinates: this.coordinates }), i3.coordinates ? Array.isArray(i3.coordinates) && 4 === i3.coordinates.length && !i3.coordinates.some(((t2) => !Array.isArray(t2) || 2 !== t2.length || t2.some(((t3) => "number" != typeof t3)))) || this.fire(new t.j(new t.Y(`sources.${e2}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new t.j(new t.Y(`sources.${e2}`, null, 'missing required property "coordinates"'))), i3.animate && "boolean" != typeof i3.animate && this.fire(new t.j(new t.Y(`sources.${e2}`, null, 'optional "animate" property must be a boolean value'))), i3.canvas ? "string" == typeof i3.canvas || i3.canvas instanceof HTMLCanvasElement || this.fire(new t.j(new t.Y(`sources.${e2}`, null, '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new t.j(new t.Y(`sources.${e2}`, null, 'missing required property "canvas"'))), this.options = i3, this.animate = void 0 === i3.animate || i3.animate;
|
||
}
|
||
getCanvas() {
|
||
return this.canvas;
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this.load(), this.canvas && this.animate && this.play();
|
||
}
|
||
onRemove() {
|
||
this.pause();
|
||
}
|
||
hasTransition() {
|
||
return this._playing;
|
||
}
|
||
_hasInvalidDimensions() {
|
||
for (const t2 of [this.canvas.width, this.canvas.height]) if (isNaN(t2) || t2 <= 0) return true;
|
||
return false;
|
||
}
|
||
}
|
||
const G = {}, j = (t2) => {
|
||
switch (t2) {
|
||
case "geojson":
|
||
return B;
|
||
case "image":
|
||
return N;
|
||
case "raster":
|
||
return k;
|
||
case "raster-dem":
|
||
return F;
|
||
case "vector":
|
||
return R;
|
||
case "video":
|
||
return U;
|
||
case "canvas":
|
||
return Z;
|
||
}
|
||
return G[t2];
|
||
};
|
||
function V(e2, i3) {
|
||
const s2 = t.Z();
|
||
return t.$(s2, s2, [1, 1, 0]), t.a0(s2, s2, [0.5 * e2.width, 0.5 * e2.height, 1]), t.a1(s2, s2, e2.calculatePosMatrix(i3.toUnwrapped()));
|
||
}
|
||
function q(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = (function(t3, e3, i4) {
|
||
if (t3) for (const s3 of t3) {
|
||
const t4 = e3[s3];
|
||
if (t4 && t4.source === i4 && "fill-extrusion" === t4.type) return true;
|
||
}
|
||
else for (const t4 in e3) {
|
||
const s3 = e3[t4];
|
||
if (s3.source === i4 && "fill-extrusion" === s3.type) return true;
|
||
}
|
||
return false;
|
||
})(a2 && a2.layers, e2, t2.id), n2 = o2.maxPitchScaleFactor(), l2 = t2.tilesIn(s2, n2, r2);
|
||
l2.sort($);
|
||
const h2 = [];
|
||
for (const s3 of l2) h2.push({ wrappedTileID: s3.tileID.wrapped().key, queryResults: s3.tile.queryRenderedFeatures(e2, i3, t2._state, s3.queryGeometry, s3.cameraQueryGeometry, s3.scale, a2, o2, n2, V(t2.transform, s3.tileID)) });
|
||
const c2 = (function(t3) {
|
||
const e3 = {}, i4 = {};
|
||
for (const s3 of t3) {
|
||
const t4 = s3.queryResults, a3 = s3.wrappedTileID, o3 = i4[a3] = i4[a3] || {};
|
||
for (const i5 in t4) {
|
||
const s4 = t4[i5], a4 = o3[i5] = o3[i5] || {}, r3 = e3[i5] = e3[i5] || [];
|
||
for (const t5 of s4) a4[t5.featureIndex] || (a4[t5.featureIndex] = true, r3.push(t5));
|
||
}
|
||
}
|
||
return e3;
|
||
})(h2);
|
||
for (const e3 in c2) c2[e3].forEach(((e4) => {
|
||
const i4 = e4.feature, s3 = t2.getFeatureState(i4.layer["source-layer"], i4.id);
|
||
i4.source = i4.layer.source, i4.layer["source-layer"] && (i4.sourceLayer = i4.layer["source-layer"]), i4.state = s3;
|
||
}));
|
||
return c2;
|
||
}
|
||
function $(t2, e2) {
|
||
const i3 = t2.tileID, s2 = e2.tileID;
|
||
return i3.overscaledZ - s2.overscaledZ || i3.canonical.y - s2.canonical.y || i3.wrap - s2.wrap || i3.canonical.x - s2.canonical.x;
|
||
}
|
||
class W {
|
||
constructor(e2, i3) {
|
||
this.timeAdded = 0, this.fadeEndTime = 0, this.tileID = e2, this.uid = t.a2(), this.uses = 0, this.tileSize = i3, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = false, this.hasRTLText = false, this.dependencies = {}, this.rtt = [], this.rttCoords = {}, this.expiredRequestCount = 0, this.state = "loading";
|
||
}
|
||
registerFadeDuration(t2) {
|
||
const e2 = t2 + this.timeAdded;
|
||
e2 < this.fadeEndTime || (this.fadeEndTime = e2);
|
||
}
|
||
wasRequested() {
|
||
return "errored" === this.state || "loaded" === this.state || "reloading" === this.state;
|
||
}
|
||
clearTextures(t2) {
|
||
this.demTexture && t2.saveTileTexture(this.demTexture), this.demTexture = null;
|
||
}
|
||
loadVectorData(e2, i3, s2) {
|
||
if (this.hasData() && this.unloadVectorData(), this.state = "loaded", e2) {
|
||
e2.featureIndex && (this.latestFeatureIndex = e2.featureIndex, e2.rawTileData ? (this.latestRawTileData = e2.rawTileData, this.latestFeatureIndex.rawTileData = e2.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = e2.collisionBoxArray, this.buckets = (function(t2, e3) {
|
||
const i4 = {};
|
||
if (!e3) return i4;
|
||
for (const s3 of t2) {
|
||
const t3 = s3.layerIds.map(((t4) => e3.getLayer(t4))).filter(Boolean);
|
||
if (0 !== t3.length) {
|
||
s3.layers = t3, s3.stateDependentLayerIds && (s3.stateDependentLayers = s3.stateDependentLayerIds.map(((e4) => t3.filter(((t4) => t4.id === e4))[0])));
|
||
for (const e4 of t3) i4[e4.id] = s3;
|
||
}
|
||
}
|
||
return i4;
|
||
})(e2.buckets, i3.style), this.hasSymbolBuckets = false;
|
||
for (const e3 in this.buckets) {
|
||
const i4 = this.buckets[e3];
|
||
if (i4 instanceof t.a4) {
|
||
if (this.hasSymbolBuckets = true, !s2) break;
|
||
i4.justReloaded = true;
|
||
}
|
||
}
|
||
if (this.hasRTLText = false, this.hasSymbolBuckets) for (const e3 in this.buckets) {
|
||
const i4 = this.buckets[e3];
|
||
if (i4 instanceof t.a4 && i4.hasRTLText) {
|
||
this.hasRTLText = true, t.a5();
|
||
break;
|
||
}
|
||
}
|
||
this.queryPadding = 0;
|
||
for (const t2 in this.buckets) {
|
||
const e3 = this.buckets[t2];
|
||
this.queryPadding = Math.max(this.queryPadding, i3.style.getLayer(t2).queryRadius(e3));
|
||
}
|
||
e2.imageAtlas && (this.imageAtlas = e2.imageAtlas), e2.glyphAtlasImage && (this.glyphAtlasImage = e2.glyphAtlasImage);
|
||
} else this.collisionBoxArray = new t.a3();
|
||
}
|
||
unloadVectorData() {
|
||
for (const t2 in this.buckets) this.buckets[t2].destroy();
|
||
this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.imageAtlas && (this.imageAtlas = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.latestFeatureIndex = null, this.state = "unloaded";
|
||
}
|
||
getBucket(t2) {
|
||
return this.buckets[t2.id];
|
||
}
|
||
upload(t2) {
|
||
for (const e3 in this.buckets) {
|
||
const i3 = this.buckets[e3];
|
||
i3.uploadPending() && i3.upload(t2);
|
||
}
|
||
const e2 = t2.gl;
|
||
this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new x(t2, this.imageAtlas.image, e2.RGBA), this.imageAtlas.uploaded = true), this.glyphAtlasImage && (this.glyphAtlasTexture = new x(t2, this.glyphAtlasImage, e2.ALPHA), this.glyphAtlasImage = null);
|
||
}
|
||
prepare(t2) {
|
||
this.imageAtlas && this.imageAtlas.patchUpdatedImages(t2, this.imageAtlasTexture);
|
||
}
|
||
queryRenderedFeatures(t2, e2, i3, s2, a2, o2, r2, n2, l2, h2) {
|
||
return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: s2, cameraQueryGeometry: a2, scale: o2, tileSize: this.tileSize, pixelPosMatrix: h2, transform: n2, params: r2, queryPadding: this.queryPadding * l2 }, t2, e2, i3) : {};
|
||
}
|
||
querySourceFeatures(e2, i3) {
|
||
const s2 = this.latestFeatureIndex;
|
||
if (!s2 || !s2.rawTileData) return;
|
||
const a2 = s2.loadVTLayers(), o2 = i3 && i3.sourceLayer ? i3.sourceLayer : "", r2 = a2._geojsonTileLayer || a2[o2];
|
||
if (!r2) return;
|
||
const n2 = t.a6(i3 && i3.filter), { z: l2, x: h2, y: c2 } = this.tileID.canonical, u2 = { z: l2, x: h2, y: c2 };
|
||
for (let i4 = 0; i4 < r2.length; i4++) {
|
||
const a3 = r2.feature(i4);
|
||
if (n2.needGeometry) {
|
||
const e3 = t.a7(a3, true);
|
||
if (!n2.filter(new t.a8(this.tileID.overscaledZ), e3, this.tileID.canonical)) continue;
|
||
} else if (!n2.filter(new t.a8(this.tileID.overscaledZ), a3)) continue;
|
||
const d2 = s2.getId(a3, o2), _2 = new t.a9(a3, l2, h2, c2, d2);
|
||
_2.tile = u2, e2.push(_2);
|
||
}
|
||
}
|
||
hasData() {
|
||
return "loaded" === this.state || "reloading" === this.state || "expired" === this.state;
|
||
}
|
||
patternsLoaded() {
|
||
return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;
|
||
}
|
||
setExpiryData(e2) {
|
||
const i3 = this.expirationTime;
|
||
if (e2.cacheControl) {
|
||
const i4 = t.aa(e2.cacheControl);
|
||
i4["max-age"] && (this.expirationTime = Date.now() + 1e3 * i4["max-age"]);
|
||
} else e2.expires && (this.expirationTime = new Date(e2.expires).getTime());
|
||
if (this.expirationTime) {
|
||
const t2 = Date.now();
|
||
let e3 = false;
|
||
if (this.expirationTime > t2) e3 = false;
|
||
else if (i3) if (this.expirationTime < i3) e3 = true;
|
||
else {
|
||
const s2 = this.expirationTime - i3;
|
||
s2 ? this.expirationTime = t2 + Math.max(s2, 3e4) : e3 = true;
|
||
}
|
||
else e3 = true;
|
||
e3 ? (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 - (/* @__PURE__ */ new Date()).getTime(), Math.pow(2, 31) - 1);
|
||
}
|
||
setFeatureState(t2, e2) {
|
||
if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || 0 === Object.keys(t2).length) return;
|
||
const i3 = this.latestFeatureIndex.loadVTLayers();
|
||
for (const s2 in this.buckets) {
|
||
if (!e2.style.hasLayer(s2)) continue;
|
||
const a2 = this.buckets[s2], o2 = a2.layers[0].sourceLayer || "_geojsonTileLayer", r2 = i3[o2], n2 = t2[o2];
|
||
if (!r2 || !n2 || 0 === Object.keys(n2).length) continue;
|
||
a2.update(n2, r2, this.imageAtlas && this.imageAtlas.patternPositions || {});
|
||
const l2 = e2 && e2.style && e2.style.getLayer(s2);
|
||
l2 && (this.queryPadding = Math.max(this.queryPadding, l2.queryRadius(a2)));
|
||
}
|
||
}
|
||
holdingForFade() {
|
||
return void 0 !== this.symbolFadeHoldUntil;
|
||
}
|
||
symbolFadeFinished() {
|
||
return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < t.h.now();
|
||
}
|
||
clearFadeHold() {
|
||
this.symbolFadeHoldUntil = void 0;
|
||
}
|
||
setHoldDuration(e2) {
|
||
this.symbolFadeHoldUntil = t.h.now() + e2;
|
||
}
|
||
setDependencies(t2, e2) {
|
||
const i3 = {};
|
||
for (const t3 of e2) i3[t3] = true;
|
||
this.dependencies[t2] = i3;
|
||
}
|
||
hasDependency(t2, e2) {
|
||
for (const i3 of t2) {
|
||
const t3 = this.dependencies[i3];
|
||
if (t3) {
|
||
for (const i4 of e2) if (t3[i4]) return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
class H {
|
||
constructor(t2, e2) {
|
||
this.max = t2, this.onRemove = e2, this.reset();
|
||
}
|
||
reset() {
|
||
for (const t2 in this.data) for (const e2 of this.data[t2]) e2.timeout && clearTimeout(e2.timeout), this.onRemove(e2.value);
|
||
return this.data = {}, this.order = [], this;
|
||
}
|
||
add(t2, e2, i3) {
|
||
const s2 = t2.wrapped().key;
|
||
void 0 === this.data[s2] && (this.data[s2] = []);
|
||
const a2 = { value: e2, timeout: void 0 };
|
||
if (void 0 !== i3 && (a2.timeout = setTimeout((() => {
|
||
this.remove(t2, a2);
|
||
}), i3)), this.data[s2].push(a2), this.order.push(s2), this.order.length > this.max) {
|
||
const t3 = this._getAndRemoveByKey(this.order[0]);
|
||
t3 && this.onRemove(t3);
|
||
}
|
||
return this;
|
||
}
|
||
has(t2) {
|
||
return t2.wrapped().key in this.data;
|
||
}
|
||
getAndRemove(t2) {
|
||
return this.has(t2) ? this._getAndRemoveByKey(t2.wrapped().key) : null;
|
||
}
|
||
_getAndRemoveByKey(t2) {
|
||
const e2 = this.data[t2].shift();
|
||
return e2.timeout && clearTimeout(e2.timeout), 0 === this.data[t2].length && delete this.data[t2], this.order.splice(this.order.indexOf(t2), 1), e2.value;
|
||
}
|
||
getByKey(t2) {
|
||
const e2 = this.data[t2];
|
||
return e2 ? e2[0].value : null;
|
||
}
|
||
get(t2) {
|
||
return this.has(t2) ? this.data[t2.wrapped().key][0].value : null;
|
||
}
|
||
remove(t2, e2) {
|
||
if (!this.has(t2)) return this;
|
||
const i3 = t2.wrapped().key, s2 = void 0 === e2 ? 0 : this.data[i3].indexOf(e2), a2 = this.data[i3][s2];
|
||
return this.data[i3].splice(s2, 1), a2.timeout && clearTimeout(a2.timeout), 0 === this.data[i3].length && delete this.data[i3], this.onRemove(a2.value), this.order.splice(this.order.indexOf(i3), 1), this;
|
||
}
|
||
setMaxSize(t2) {
|
||
for (this.max = t2; this.order.length > this.max; ) {
|
||
const t3 = this._getAndRemoveByKey(this.order[0]);
|
||
t3 && this.onRemove(t3);
|
||
}
|
||
return this;
|
||
}
|
||
filter(t2) {
|
||
const e2 = [];
|
||
for (const i3 in this.data) for (const s2 of this.data[i3]) t2(s2.value) || e2.push(s2);
|
||
for (const t3 of e2) this.remove(t3.value.tileID, t3);
|
||
}
|
||
}
|
||
class X {
|
||
constructor() {
|
||
this.state = {}, this.stateChanges = {}, this.deletedStates = {};
|
||
}
|
||
updateState(e2, i3, s2) {
|
||
const a2 = String(i3);
|
||
if (this.stateChanges[e2] = this.stateChanges[e2] || {}, this.stateChanges[e2][a2] = this.stateChanges[e2][a2] || {}, t.e(this.stateChanges[e2][a2], s2), null === this.deletedStates[e2]) {
|
||
this.deletedStates[e2] = {};
|
||
for (const t2 in this.state[e2]) t2 !== a2 && (this.deletedStates[e2][t2] = null);
|
||
} else if (this.deletedStates[e2] && null === this.deletedStates[e2][a2]) {
|
||
this.deletedStates[e2][a2] = {};
|
||
for (const t2 in this.state[e2][a2]) s2[t2] || (this.deletedStates[e2][a2][t2] = null);
|
||
} else for (const t2 in s2) this.deletedStates[e2] && this.deletedStates[e2][a2] && null === this.deletedStates[e2][a2][t2] && delete this.deletedStates[e2][a2][t2];
|
||
}
|
||
removeFeatureState(t2, e2, i3) {
|
||
if (null === this.deletedStates[t2]) return;
|
||
const s2 = String(e2);
|
||
if (this.deletedStates[t2] = this.deletedStates[t2] || {}, i3 && void 0 !== e2) null !== this.deletedStates[t2][s2] && (this.deletedStates[t2][s2] = this.deletedStates[t2][s2] || {}, this.deletedStates[t2][s2][i3] = null);
|
||
else if (void 0 !== e2) if (this.stateChanges[t2] && this.stateChanges[t2][s2]) for (i3 in this.deletedStates[t2][s2] = {}, this.stateChanges[t2][s2]) this.deletedStates[t2][s2][i3] = null;
|
||
else this.deletedStates[t2][s2] = null;
|
||
else this.deletedStates[t2] = null;
|
||
}
|
||
getState(e2, i3) {
|
||
const s2 = String(i3), a2 = t.e({}, (this.state[e2] || {})[s2], (this.stateChanges[e2] || {})[s2]);
|
||
if (null === this.deletedStates[e2]) return {};
|
||
if (this.deletedStates[e2]) {
|
||
const t2 = this.deletedStates[e2][i3];
|
||
if (null === t2) return {};
|
||
for (const e3 in t2) delete a2[e3];
|
||
}
|
||
return a2;
|
||
}
|
||
initializeTileState(t2, e2) {
|
||
t2.setFeatureState(this.state, e2);
|
||
}
|
||
coalesceChanges(e2, i3) {
|
||
const s2 = {};
|
||
for (const e3 in this.stateChanges) {
|
||
this.state[e3] = this.state[e3] || {};
|
||
const i4 = {};
|
||
for (const s3 in this.stateChanges[e3]) this.state[e3][s3] || (this.state[e3][s3] = {}), t.e(this.state[e3][s3], this.stateChanges[e3][s3]), i4[s3] = this.state[e3][s3];
|
||
s2[e3] = i4;
|
||
}
|
||
for (const e3 in this.deletedStates) {
|
||
this.state[e3] = this.state[e3] || {};
|
||
const i4 = {};
|
||
if (null === this.deletedStates[e3]) for (const t2 in this.state[e3]) i4[t2] = {}, this.state[e3][t2] = {};
|
||
else for (const t2 in this.deletedStates[e3]) {
|
||
if (null === this.deletedStates[e3][t2]) this.state[e3][t2] = {};
|
||
else for (const i5 of Object.keys(this.deletedStates[e3][t2])) delete this.state[e3][t2][i5];
|
||
i4[t2] = this.state[e3][t2];
|
||
}
|
||
s2[e3] = s2[e3] || {}, t.e(s2[e3], i4);
|
||
}
|
||
if (this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(s2).length) for (const t2 in e2) e2[t2].setFeatureState(s2, i3);
|
||
}
|
||
}
|
||
class K extends t.E {
|
||
constructor(t2, e2, i3) {
|
||
super(), this.id = t2, this.dispatcher = i3, this.on("data", ((t3) => {
|
||
"source" === t3.dataType && "metadata" === t3.sourceDataType && (this._sourceLoaded = true), this._sourceLoaded && !this._paused && "source" === t3.dataType && "content" === t3.sourceDataType && (this.reload(), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = true);
|
||
})), this.on("dataloading", (() => {
|
||
this._sourceErrored = false;
|
||
})), this.on("error", (() => {
|
||
this._sourceErrored = this._source.loaded();
|
||
})), this._source = ((t3, e3, i4, s2) => {
|
||
const a2 = new (j(e3.type))(t3, e3, i4, s2);
|
||
if (a2.id !== t3) throw new Error(`Expected Source id to be ${t3} instead of ${a2.id}`);
|
||
return a2;
|
||
})(t2, e2, i3, this), this._tiles = {}, this._cache = new H(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new X(), this._didEmitContent = false, this._updated = false;
|
||
}
|
||
onAdd(t2) {
|
||
this.map = t2, this._maxTileCacheSize = t2 ? t2._maxTileCacheSize : null, this._maxTileCacheZoomLevels = t2 ? t2._maxTileCacheZoomLevels : null, this._source && this._source.onAdd && this._source.onAdd(t2);
|
||
}
|
||
onRemove(t2) {
|
||
this.clearTiles(), this._source && this._source.onRemove && this._source.onRemove(t2);
|
||
}
|
||
loaded() {
|
||
if (this._sourceErrored) return true;
|
||
if (!this._sourceLoaded) return false;
|
||
if (!this._source.loaded()) return false;
|
||
if (!(void 0 === this.used && void 0 === this.usedForTerrain || this.used || this.usedForTerrain)) return true;
|
||
if (!this._updated) return false;
|
||
for (const t2 in this._tiles) {
|
||
const e2 = this._tiles[t2];
|
||
if ("loaded" !== e2.state && "errored" !== e2.state) return false;
|
||
}
|
||
return true;
|
||
}
|
||
getSource() {
|
||
return this._source;
|
||
}
|
||
pause() {
|
||
this._paused = true;
|
||
}
|
||
resume() {
|
||
if (!this._paused) return;
|
||
const t2 = this._shouldReloadOnResume;
|
||
this._paused = false, this._shouldReloadOnResume = false, t2 && this.reload(), this.transform && this.update(this.transform, this.terrain);
|
||
}
|
||
_loadTile(t2, e2) {
|
||
return this._source.loadTile(t2, e2);
|
||
}
|
||
_unloadTile(t2) {
|
||
if (this._source.unloadTile) return this._source.unloadTile(t2, (() => {
|
||
}));
|
||
}
|
||
_abortTile(e2) {
|
||
this._source.abortTile && this._source.abortTile(e2, (() => {
|
||
})), this._source.fire(new t.k("dataabort", { tile: e2, coord: e2.tileID, dataType: "source" }));
|
||
}
|
||
serialize() {
|
||
return this._source.serialize();
|
||
}
|
||
prepare(t2) {
|
||
this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);
|
||
for (const e2 in this._tiles) {
|
||
const i3 = this._tiles[e2];
|
||
i3.upload(t2), i3.prepare(this.map.style.imageManager);
|
||
}
|
||
}
|
||
getIds() {
|
||
return Object.values(this._tiles).map(((t2) => t2.tileID)).sort(Q).map(((t2) => t2.key));
|
||
}
|
||
getRenderableIds(e2) {
|
||
const i3 = [];
|
||
for (const t2 in this._tiles) this._isIdRenderable(t2, e2) && i3.push(this._tiles[t2]);
|
||
return e2 ? i3.sort(((e3, i4) => {
|
||
const s2 = e3.tileID, a2 = i4.tileID, o2 = new t.P(s2.canonical.x, s2.canonical.y)._rotate(this.transform.angle), r2 = new t.P(a2.canonical.x, a2.canonical.y)._rotate(this.transform.angle);
|
||
return s2.overscaledZ - a2.overscaledZ || r2.y - o2.y || r2.x - o2.x;
|
||
})).map(((t2) => t2.tileID.key)) : i3.map(((t2) => t2.tileID)).sort(Q).map(((t2) => t2.key));
|
||
}
|
||
hasRenderableParent(t2) {
|
||
const e2 = this.findLoadedParent(t2, 0);
|
||
return !!e2 && this._isIdRenderable(e2.tileID.key);
|
||
}
|
||
_isIdRenderable(t2, e2) {
|
||
return this._tiles[t2] && this._tiles[t2].hasData() && !this._coveredTiles[t2] && (e2 || !this._tiles[t2].holdingForFade());
|
||
}
|
||
reload() {
|
||
if (this._paused) this._shouldReloadOnResume = true;
|
||
else {
|
||
this._cache.reset();
|
||
for (const t2 in this._tiles) "errored" !== this._tiles[t2].state && this._reloadTile(t2, "reloading");
|
||
}
|
||
}
|
||
_reloadTile(t2, e2) {
|
||
const i3 = this._tiles[t2];
|
||
i3 && ("loading" !== i3.state && (i3.state = e2), this._loadTile(i3, this._tileLoaded.bind(this, i3, t2, e2)));
|
||
}
|
||
_tileLoaded(e2, i3, s2, a2) {
|
||
if (a2) return e2.state = "errored", void (404 !== a2.status ? this._source.fire(new t.j(a2, { tile: e2 })) : this.update(this.transform, this.terrain));
|
||
e2.timeAdded = t.h.now(), "expired" === s2 && (e2.refreshedUponExpiration = true), this._setTileReloadTimer(i3, e2), "raster-dem" === this.getSource().type && e2.dem && this._backfillDEM(e2), this._state.initializeTileState(e2, this.map ? this.map.painter : null), e2.aborted || this._source.fire(new t.k("data", { dataType: "source", tile: e2, coord: e2.tileID }));
|
||
}
|
||
_backfillDEM(t2) {
|
||
const e2 = this.getRenderableIds();
|
||
for (let s2 = 0; s2 < e2.length; s2++) {
|
||
const a2 = e2[s2];
|
||
if (t2.neighboringTiles && t2.neighboringTiles[a2]) {
|
||
const e3 = this.getTileByID(a2);
|
||
i3(t2, e3), i3(e3, t2);
|
||
}
|
||
}
|
||
function i3(t3, e3) {
|
||
t3.needsHillshadePrepare = true, t3.needsTerrainPrepare = true;
|
||
let i4 = e3.tileID.canonical.x - t3.tileID.canonical.x;
|
||
const s2 = e3.tileID.canonical.y - t3.tileID.canonical.y, a2 = Math.pow(2, t3.tileID.canonical.z), o2 = e3.tileID.key;
|
||
0 === i4 && 0 === s2 || Math.abs(s2) > 1 || (Math.abs(i4) > 1 && (1 === Math.abs(i4 + a2) ? i4 += a2 : 1 === Math.abs(i4 - a2) && (i4 -= a2)), e3.dem && t3.dem && (t3.dem.backfillBorder(e3.dem, i4, s2), t3.neighboringTiles && t3.neighboringTiles[o2] && (t3.neighboringTiles[o2].backfilled = true)));
|
||
}
|
||
}
|
||
getTile(t2) {
|
||
return this.getTileByID(t2.key);
|
||
}
|
||
getTileByID(t2) {
|
||
return this._tiles[t2];
|
||
}
|
||
_retainLoadedChildren(t2, e2, i3, s2) {
|
||
for (const a2 in this._tiles) {
|
||
let o2 = this._tiles[a2];
|
||
if (s2[a2] || !o2.hasData() || o2.tileID.overscaledZ <= e2 || o2.tileID.overscaledZ > i3) continue;
|
||
let r2 = o2.tileID;
|
||
for (; o2 && o2.tileID.overscaledZ > e2 + 1; ) {
|
||
const t3 = o2.tileID.scaledTo(o2.tileID.overscaledZ - 1);
|
||
o2 = this._tiles[t3.key], o2 && o2.hasData() && (r2 = t3);
|
||
}
|
||
let n2 = r2;
|
||
for (; n2.overscaledZ > e2; ) if (n2 = n2.scaledTo(n2.overscaledZ - 1), t2[n2.key]) {
|
||
s2[r2.key] = r2;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
findLoadedParent(t2, e2) {
|
||
if (t2.key in this._loadedParentTiles) {
|
||
const i3 = this._loadedParentTiles[t2.key];
|
||
return i3 && i3.tileID.overscaledZ >= e2 ? i3 : null;
|
||
}
|
||
for (let i3 = t2.overscaledZ - 1; i3 >= e2; i3--) {
|
||
const e3 = t2.scaledTo(i3), s2 = this._getLoadedTile(e3);
|
||
if (s2) return s2;
|
||
}
|
||
}
|
||
_getLoadedTile(t2) {
|
||
const e2 = this._tiles[t2.key];
|
||
return e2 && e2.hasData() ? e2 : this._cache.getByKey(t2.wrapped().key);
|
||
}
|
||
updateCacheSize(e2) {
|
||
const i3 = Math.ceil(e2.width / this._source.tileSize) + 1, s2 = Math.ceil(e2.height / this._source.tileSize) + 1, a2 = Math.floor(i3 * s2 * (null === this._maxTileCacheZoomLevels ? t.c.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels)), o2 = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, a2) : a2;
|
||
this._cache.setMaxSize(o2);
|
||
}
|
||
handleWrapJump(t2) {
|
||
const e2 = Math.round((t2 - (void 0 === this._prevLng ? t2 : this._prevLng)) / 360);
|
||
if (this._prevLng = t2, e2) {
|
||
const t3 = {};
|
||
for (const i3 in this._tiles) {
|
||
const s2 = this._tiles[i3];
|
||
s2.tileID = s2.tileID.unwrapTo(s2.tileID.wrap + e2), t3[s2.tileID.key] = s2;
|
||
}
|
||
this._tiles = t3;
|
||
for (const t4 in this._timers) clearTimeout(this._timers[t4]), delete this._timers[t4];
|
||
for (const t4 in this._tiles) this._setTileReloadTimer(t4, this._tiles[t4]);
|
||
}
|
||
}
|
||
update(e2, i3) {
|
||
if (this.transform = e2, this.terrain = i3, !this._sourceLoaded || this._paused) return;
|
||
let s2;
|
||
this.updateCacheSize(e2), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used || this.usedForTerrain ? this._source.tileID ? s2 = e2.getVisibleUnwrappedCoordinates(this._source.tileID).map(((e3) => new t.O(e3.canonical.z, e3.wrap, e3.canonical.z, e3.canonical.x, e3.canonical.y))) : (s2 = e2.coveringTiles({ tileSize: this.usedForTerrain ? this.tileSize : this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: !this.usedForTerrain && this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled, terrain: i3 }), this._source.hasTile && (s2 = s2.filter(((t2) => this._source.hasTile(t2))))) : s2 = [];
|
||
const a2 = e2.coveringZoomLevel(this._source), o2 = Math.max(a2 - K.maxOverzooming, this._source.minzoom), r2 = Math.max(a2 + K.maxUnderzooming, this._source.minzoom);
|
||
if (this.usedForTerrain) {
|
||
const t2 = {};
|
||
for (const e3 of s2) if (e3.canonical.z > this._source.minzoom) {
|
||
const i4 = e3.scaledTo(e3.canonical.z - 1);
|
||
t2[i4.key] = i4;
|
||
const s3 = e3.scaledTo(Math.max(this._source.minzoom, Math.min(e3.canonical.z, 5)));
|
||
t2[s3.key] = s3;
|
||
}
|
||
s2 = s2.concat(Object.values(t2));
|
||
}
|
||
const n2 = 0 === s2.length && !this._updated && this._didEmitContent;
|
||
this._updated = true, n2 && this.fire(new t.k("data", { sourceDataType: "idle", dataType: "source", sourceId: this.id }));
|
||
const l2 = this._updateRetainedTiles(s2, a2);
|
||
if (Y(this._source.type)) {
|
||
const e3 = {}, n3 = {}, h3 = Object.keys(l2), c2 = t.h.now();
|
||
for (const t2 of h3) {
|
||
const i4 = l2[t2], s3 = this._tiles[t2];
|
||
if (!s3 || 0 !== s3.fadeEndTime && s3.fadeEndTime <= c2) continue;
|
||
const a3 = this.findLoadedParent(i4, o2);
|
||
a3 && (this._addTile(a3.tileID), e3[a3.tileID.key] = a3.tileID), n3[t2] = i4;
|
||
}
|
||
this._retainLoadedChildren(n3, a2, r2, l2);
|
||
for (const t2 in e3) l2[t2] || (this._coveredTiles[t2] = true, l2[t2] = e3[t2]);
|
||
if (i3) {
|
||
const t2 = {}, e4 = {};
|
||
for (const i4 of s2) this._tiles[i4.key].hasData() ? t2[i4.key] = i4 : e4[i4.key] = i4;
|
||
for (const i4 in e4) {
|
||
const s3 = e4[i4].children(this._source.maxzoom);
|
||
this._tiles[s3[0].key] && this._tiles[s3[1].key] && this._tiles[s3[2].key] && this._tiles[s3[3].key] && (t2[s3[0].key] = l2[s3[0].key] = s3[0], t2[s3[1].key] = l2[s3[1].key] = s3[1], t2[s3[2].key] = l2[s3[2].key] = s3[2], t2[s3[3].key] = l2[s3[3].key] = s3[3], delete e4[i4]);
|
||
}
|
||
for (const i4 in e4) {
|
||
const s3 = this.findLoadedParent(e4[i4], this._source.minzoom);
|
||
if (s3) {
|
||
t2[s3.tileID.key] = l2[s3.tileID.key] = s3.tileID;
|
||
for (const e5 in t2) t2[e5].isChildOf(s3.tileID) && delete t2[e5];
|
||
}
|
||
}
|
||
for (const e5 in this._tiles) t2[e5] || (this._coveredTiles[e5] = true);
|
||
}
|
||
}
|
||
for (const t2 in l2) this._tiles[t2].clearFadeHold();
|
||
const h2 = t.ab(this._tiles, l2);
|
||
for (const t2 of h2) {
|
||
const e3 = this._tiles[t2];
|
||
e3.hasSymbolBuckets && !e3.holdingForFade() ? e3.setHoldDuration(this.map._fadeDuration) : e3.hasSymbolBuckets && !e3.symbolFadeFinished() || this._removeTile(t2);
|
||
}
|
||
this._updateLoadedParentTileCache();
|
||
}
|
||
releaseSymbolFadeTiles() {
|
||
for (const t2 in this._tiles) this._tiles[t2].holdingForFade() && this._removeTile(t2);
|
||
}
|
||
_updateRetainedTiles(t2, e2) {
|
||
const i3 = {}, s2 = {}, a2 = Math.max(e2 - K.maxOverzooming, this._source.minzoom), o2 = Math.max(e2 + K.maxUnderzooming, this._source.minzoom), r2 = {};
|
||
for (const s3 of t2) {
|
||
const t3 = this._addTile(s3);
|
||
i3[s3.key] = s3, t3.hasData() || e2 < this._source.maxzoom && (r2[s3.key] = s3);
|
||
}
|
||
this._retainLoadedChildren(r2, e2, o2, i3);
|
||
for (const o3 of t2) {
|
||
let t3 = this._tiles[o3.key];
|
||
if (t3.hasData()) continue;
|
||
if (e2 + 1 > this._source.maxzoom) {
|
||
const t4 = o3.children(this._source.maxzoom)[0], e3 = this.getTile(t4);
|
||
if (e3 && e3.hasData()) {
|
||
i3[t4.key] = t4;
|
||
continue;
|
||
}
|
||
} else {
|
||
const t4 = o3.children(this._source.maxzoom);
|
||
if (i3[t4[0].key] && i3[t4[1].key] && i3[t4[2].key] && i3[t4[3].key]) continue;
|
||
}
|
||
let r3 = t3.wasRequested();
|
||
for (let e3 = o3.overscaledZ - 1; e3 >= a2; --e3) {
|
||
const a3 = o3.scaledTo(e3);
|
||
if (s2[a3.key]) break;
|
||
if (s2[a3.key] = true, t3 = this.getTile(a3), !t3 && r3 && (t3 = this._addTile(a3)), t3) {
|
||
const e4 = t3.hasData();
|
||
if ((r3 || e4) && (i3[a3.key] = a3), r3 = t3.wasRequested(), e4) break;
|
||
}
|
||
}
|
||
}
|
||
return i3;
|
||
}
|
||
_updateLoadedParentTileCache() {
|
||
this._loadedParentTiles = {};
|
||
for (const t2 in this._tiles) {
|
||
const e2 = [];
|
||
let i3, s2 = this._tiles[t2].tileID;
|
||
for (; s2.overscaledZ > 0; ) {
|
||
if (s2.key in this._loadedParentTiles) {
|
||
i3 = this._loadedParentTiles[s2.key];
|
||
break;
|
||
}
|
||
e2.push(s2.key);
|
||
const t3 = s2.scaledTo(s2.overscaledZ - 1);
|
||
if (i3 = this._getLoadedTile(t3), i3) break;
|
||
s2 = t3;
|
||
}
|
||
for (const t3 of e2) this._loadedParentTiles[t3] = i3;
|
||
}
|
||
}
|
||
_addTile(e2) {
|
||
let i3 = this._tiles[e2.key];
|
||
if (i3) return i3;
|
||
i3 = this._cache.getAndRemove(e2), i3 && (this._setTileReloadTimer(e2.key, i3), i3.tileID = e2, this._state.initializeTileState(i3, this.map ? this.map.painter : null), this._cacheTimers[e2.key] && (clearTimeout(this._cacheTimers[e2.key]), delete this._cacheTimers[e2.key], this._setTileReloadTimer(e2.key, i3)));
|
||
const s2 = i3;
|
||
return i3 || (i3 = new W(e2, this._source.tileSize * e2.overscaleFactor()), this._loadTile(i3, this._tileLoaded.bind(this, i3, e2.key, i3.state))), i3.uses++, this._tiles[e2.key] = i3, s2 || this._source.fire(new t.k("dataloading", { tile: i3, coord: i3.tileID, dataType: "source" })), i3;
|
||
}
|
||
_setTileReloadTimer(t2, e2) {
|
||
t2 in this._timers && (clearTimeout(this._timers[t2]), delete this._timers[t2]);
|
||
const i3 = e2.getExpiryTimeout();
|
||
i3 && (this._timers[t2] = setTimeout((() => {
|
||
this._reloadTile(t2, "expired"), delete this._timers[t2];
|
||
}), i3));
|
||
}
|
||
_removeTile(t2) {
|
||
const e2 = this._tiles[t2];
|
||
e2 && (e2.uses--, delete this._tiles[t2], this._timers[t2] && (clearTimeout(this._timers[t2]), delete this._timers[t2]), e2.uses > 0 || (e2.hasData() && "reloading" !== e2.state ? this._cache.add(e2.tileID, e2, e2.getExpiryTimeout()) : (e2.aborted = true, this._abortTile(e2), this._unloadTile(e2))));
|
||
}
|
||
clearTiles() {
|
||
this._shouldReloadOnResume = false, this._paused = false;
|
||
for (const t2 in this._tiles) this._removeTile(t2);
|
||
this._cache.reset();
|
||
}
|
||
tilesIn(e2, i3, s2) {
|
||
const a2 = [], o2 = this.transform;
|
||
if (!o2) return a2;
|
||
const r2 = s2 ? o2.getCameraQueryGeometry(e2) : e2, n2 = e2.map(((t2) => o2.pointCoordinate(t2, this.terrain))), l2 = r2.map(((t2) => o2.pointCoordinate(t2, this.terrain))), h2 = this.getIds();
|
||
let c2 = 1 / 0, u2 = 1 / 0, d2 = -1 / 0, _2 = -1 / 0;
|
||
for (const t2 of l2) c2 = Math.min(c2, t2.x), u2 = Math.min(u2, t2.y), d2 = Math.max(d2, t2.x), _2 = Math.max(_2, t2.y);
|
||
for (let e3 = 0; e3 < h2.length; e3++) {
|
||
const s3 = this._tiles[h2[e3]];
|
||
if (s3.holdingForFade()) continue;
|
||
const r3 = s3.tileID, p2 = Math.pow(2, o2.zoom - s3.tileID.overscaledZ), m2 = i3 * s3.queryPadding * t.N / s3.tileSize / p2, f2 = [r3.getTilePoint(new t.U(c2, u2)), r3.getTilePoint(new t.U(d2, _2))];
|
||
if (f2[0].x - m2 < t.N && f2[0].y - m2 < t.N && f2[1].x + m2 >= 0 && f2[1].y + m2 >= 0) {
|
||
const t2 = n2.map(((t3) => r3.getTilePoint(t3))), e4 = l2.map(((t3) => r3.getTilePoint(t3)));
|
||
a2.push({ tile: s3, tileID: r3, queryGeometry: t2, cameraQueryGeometry: e4, scale: p2 });
|
||
}
|
||
}
|
||
return a2;
|
||
}
|
||
getVisibleCoordinates(t2) {
|
||
const e2 = this.getRenderableIds(t2).map(((t3) => this._tiles[t3].tileID));
|
||
for (const t3 of e2) t3.posMatrix = this.transform.calculatePosMatrix(t3.toUnwrapped());
|
||
return e2;
|
||
}
|
||
hasTransition() {
|
||
if (this._source.hasTransition()) return true;
|
||
if (Y(this._source.type)) {
|
||
const e2 = t.h.now();
|
||
for (const t2 in this._tiles) if (this._tiles[t2].fadeEndTime >= e2) return true;
|
||
}
|
||
return false;
|
||
}
|
||
setFeatureState(t2, e2, i3) {
|
||
this._state.updateState(t2 = t2 || "_geojsonTileLayer", e2, i3);
|
||
}
|
||
removeFeatureState(t2, e2, i3) {
|
||
this._state.removeFeatureState(t2 = t2 || "_geojsonTileLayer", e2, i3);
|
||
}
|
||
getFeatureState(t2, e2) {
|
||
return this._state.getState(t2 = t2 || "_geojsonTileLayer", e2);
|
||
}
|
||
setDependencies(t2, e2, i3) {
|
||
const s2 = this._tiles[t2];
|
||
s2 && s2.setDependencies(e2, i3);
|
||
}
|
||
reloadTilesForDependencies(t2, e2) {
|
||
for (const i3 in this._tiles) this._tiles[i3].hasDependency(t2, e2) && this._reloadTile(i3, "reloading");
|
||
this._cache.filter(((i3) => !i3.hasDependency(t2, e2)));
|
||
}
|
||
}
|
||
function Q(t2, e2) {
|
||
const i3 = Math.abs(2 * t2.wrap) - +(t2.wrap < 0), s2 = Math.abs(2 * e2.wrap) - +(e2.wrap < 0);
|
||
return t2.overscaledZ - e2.overscaledZ || s2 - i3 || e2.canonical.y - t2.canonical.y || e2.canonical.x - t2.canonical.x;
|
||
}
|
||
function Y(t2) {
|
||
return "raster" === t2 || "image" === t2 || "video" === t2;
|
||
}
|
||
K.maxOverzooming = 10, K.maxUnderzooming = 3;
|
||
const J = "mapboxgl_preloaded_worker_pool";
|
||
class tt {
|
||
constructor() {
|
||
this.active = {};
|
||
}
|
||
acquire(e2) {
|
||
if (!this.workers) for (this.workers = []; this.workers.length < tt.workerCount; ) this.workers.push(new Worker(t.c.WORKER_URL));
|
||
return this.active[e2] = true, this.workers.slice();
|
||
}
|
||
release(t2) {
|
||
delete this.active[t2], 0 === this.numActive() && (this.workers.forEach(((t3) => {
|
||
t3.terminate();
|
||
})), this.workers = null);
|
||
}
|
||
isPreloaded() {
|
||
return !!this.active[J];
|
||
}
|
||
numActive() {
|
||
return Object.keys(this.active).length;
|
||
}
|
||
}
|
||
const et = Math.floor(t.h.hardwareConcurrency / 2);
|
||
let it;
|
||
function st() {
|
||
return it || (it = new tt()), it;
|
||
}
|
||
tt.workerCount = t.ac(globalThis) ? Math.max(Math.min(et, 3), 1) : 1;
|
||
class at {
|
||
constructor(t2, e2) {
|
||
this.reset(t2, e2);
|
||
}
|
||
reset(t2, e2) {
|
||
this.points = t2 || [], this._distances = [0];
|
||
for (let t3 = 1; t3 < this.points.length; t3++) this._distances[t3] = this._distances[t3 - 1] + this.points[t3].dist(this.points[t3 - 1]);
|
||
this.length = this._distances[this._distances.length - 1], this.padding = Math.min(e2 || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;
|
||
}
|
||
lerp(e2) {
|
||
if (1 === this.points.length) return this.points[0];
|
||
e2 = t.ad(e2, 0, 1);
|
||
let i3 = 1, s2 = this._distances[i3];
|
||
const a2 = e2 * this.paddedLength + this.padding;
|
||
for (; s2 < a2 && i3 < this._distances.length; ) s2 = this._distances[++i3];
|
||
const o2 = i3 - 1, r2 = this._distances[o2], n2 = s2 - r2, l2 = n2 > 0 ? (a2 - r2) / n2 : 0;
|
||
return this.points[o2].mult(1 - l2).add(this.points[i3].mult(l2));
|
||
}
|
||
}
|
||
function ot(t2, e2) {
|
||
let i3 = true;
|
||
return "always" === t2 || "never" !== t2 && "never" !== e2 || (i3 = false), i3;
|
||
}
|
||
class rt {
|
||
constructor(t2, e2, i3) {
|
||
const s2 = this.boxCells = [], a2 = this.circleCells = [];
|
||
this.xCellCount = Math.ceil(t2 / i3), this.yCellCount = Math.ceil(e2 / i3);
|
||
for (let t3 = 0; t3 < this.xCellCount * this.yCellCount; t3++) s2.push([]), a2.push([]);
|
||
this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = t2, this.height = e2, this.xScale = this.xCellCount / t2, this.yScale = this.yCellCount / e2, this.boxUid = 0, this.circleUid = 0;
|
||
}
|
||
keysLength() {
|
||
return this.boxKeys.length + this.circleKeys.length;
|
||
}
|
||
insert(t2, e2, i3, s2, a2) {
|
||
this._forEachCell(e2, i3, s2, a2, this._insertBoxCell, this.boxUid++), this.boxKeys.push(t2), this.bboxes.push(e2), this.bboxes.push(i3), this.bboxes.push(s2), this.bboxes.push(a2);
|
||
}
|
||
insertCircle(t2, e2, i3, s2) {
|
||
this._forEachCell(e2 - s2, i3 - s2, e2 + s2, i3 + s2, this._insertCircleCell, this.circleUid++), this.circleKeys.push(t2), this.circles.push(e2), this.circles.push(i3), this.circles.push(s2);
|
||
}
|
||
_insertBoxCell(t2, e2, i3, s2, a2, o2) {
|
||
this.boxCells[a2].push(o2);
|
||
}
|
||
_insertCircleCell(t2, e2, i3, s2, a2, o2) {
|
||
this.circleCells[a2].push(o2);
|
||
}
|
||
_query(t2, e2, i3, s2, a2, o2, r2) {
|
||
if (i3 < 0 || t2 > this.width || s2 < 0 || e2 > this.height) return [];
|
||
const n2 = [];
|
||
if (t2 <= 0 && e2 <= 0 && this.width <= i3 && this.height <= s2) {
|
||
if (a2) return [{ key: null, x1: t2, y1: e2, x2: i3, y2: s2 }];
|
||
for (let t3 = 0; t3 < this.boxKeys.length; t3++) n2.push({ key: this.boxKeys[t3], x1: this.bboxes[4 * t3], y1: this.bboxes[4 * t3 + 1], x2: this.bboxes[4 * t3 + 2], y2: this.bboxes[4 * t3 + 3] });
|
||
for (let t3 = 0; t3 < this.circleKeys.length; t3++) {
|
||
const e3 = this.circles[3 * t3], i4 = this.circles[3 * t3 + 1], s3 = this.circles[3 * t3 + 2];
|
||
n2.push({ key: this.circleKeys[t3], x1: e3 - s3, y1: i4 - s3, x2: e3 + s3, y2: i4 + s3 });
|
||
}
|
||
} else this._forEachCell(t2, e2, i3, s2, this._queryCell, n2, { hitTest: a2, overlapMode: o2, seenUids: { box: {}, circle: {} } }, r2);
|
||
return n2;
|
||
}
|
||
query(t2, e2, i3, s2) {
|
||
return this._query(t2, e2, i3, s2, false, null);
|
||
}
|
||
hitTest(t2, e2, i3, s2, a2, o2) {
|
||
return this._query(t2, e2, i3, s2, true, a2, o2).length > 0;
|
||
}
|
||
hitTestCircle(t2, e2, i3, s2, a2) {
|
||
const o2 = t2 - i3, r2 = t2 + i3, n2 = e2 - i3, l2 = e2 + i3;
|
||
if (r2 < 0 || o2 > this.width || l2 < 0 || n2 > this.height) return false;
|
||
const h2 = [];
|
||
return this._forEachCell(o2, n2, r2, l2, this._queryCellCircle, h2, { hitTest: true, overlapMode: s2, circle: { x: t2, y: e2, radius: i3 }, seenUids: { box: {}, circle: {} } }, a2), h2.length > 0;
|
||
}
|
||
_queryCell(t2, e2, i3, s2, a2, o2, r2, n2) {
|
||
const { seenUids: l2, hitTest: h2, overlapMode: c2 } = r2, u2 = this.boxCells[a2];
|
||
if (null !== u2) {
|
||
const a3 = this.bboxes;
|
||
for (const r3 of u2) if (!l2.box[r3]) {
|
||
l2.box[r3] = true;
|
||
const u3 = 4 * r3, d3 = this.boxKeys[r3];
|
||
if (t2 <= a3[u3 + 2] && e2 <= a3[u3 + 3] && i3 >= a3[u3 + 0] && s2 >= a3[u3 + 1] && (!n2 || n2(d3)) && (!h2 || !ot(c2, d3.overlapMode)) && (o2.push({ key: d3, x1: a3[u3], y1: a3[u3 + 1], x2: a3[u3 + 2], y2: a3[u3 + 3] }), h2)) return true;
|
||
}
|
||
}
|
||
const d2 = this.circleCells[a2];
|
||
if (null !== d2) {
|
||
const a3 = this.circles;
|
||
for (const r3 of d2) if (!l2.circle[r3]) {
|
||
l2.circle[r3] = true;
|
||
const u3 = 3 * r3, d3 = this.circleKeys[r3];
|
||
if (this._circleAndRectCollide(a3[u3], a3[u3 + 1], a3[u3 + 2], t2, e2, i3, s2) && (!n2 || n2(d3)) && (!h2 || !ot(c2, d3.overlapMode))) {
|
||
const t3 = a3[u3], e3 = a3[u3 + 1], i4 = a3[u3 + 2];
|
||
if (o2.push({ key: d3, x1: t3 - i4, y1: e3 - i4, x2: t3 + i4, y2: e3 + i4 }), h2) return true;
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
_queryCellCircle(t2, e2, i3, s2, a2, o2, r2, n2) {
|
||
const { circle: l2, seenUids: h2, overlapMode: c2 } = r2, u2 = this.boxCells[a2];
|
||
if (null !== u2) {
|
||
const t3 = this.bboxes;
|
||
for (const e3 of u2) if (!h2.box[e3]) {
|
||
h2.box[e3] = true;
|
||
const i4 = 4 * e3, s3 = this.boxKeys[e3];
|
||
if (this._circleAndRectCollide(l2.x, l2.y, l2.radius, t3[i4 + 0], t3[i4 + 1], t3[i4 + 2], t3[i4 + 3]) && (!n2 || n2(s3)) && !ot(c2, s3.overlapMode)) return o2.push(true), true;
|
||
}
|
||
}
|
||
const d2 = this.circleCells[a2];
|
||
if (null !== d2) {
|
||
const t3 = this.circles;
|
||
for (const e3 of d2) if (!h2.circle[e3]) {
|
||
h2.circle[e3] = true;
|
||
const i4 = 3 * e3, s3 = this.circleKeys[e3];
|
||
if (this._circlesCollide(t3[i4], t3[i4 + 1], t3[i4 + 2], l2.x, l2.y, l2.radius) && (!n2 || n2(s3)) && !ot(c2, s3.overlapMode)) return o2.push(true), true;
|
||
}
|
||
}
|
||
}
|
||
_forEachCell(t2, e2, i3, s2, a2, o2, r2, n2) {
|
||
const l2 = this._convertToXCellCoord(t2), h2 = this._convertToYCellCoord(e2), c2 = this._convertToXCellCoord(i3), u2 = this._convertToYCellCoord(s2);
|
||
for (let d2 = l2; d2 <= c2; d2++) for (let l3 = h2; l3 <= u2; l3++) if (a2.call(this, t2, e2, i3, s2, this.xCellCount * l3 + d2, o2, r2, n2)) return;
|
||
}
|
||
_convertToXCellCoord(t2) {
|
||
return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(t2 * this.xScale)));
|
||
}
|
||
_convertToYCellCoord(t2) {
|
||
return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(t2 * this.yScale)));
|
||
}
|
||
_circlesCollide(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = s2 - t2, n2 = a2 - e2, l2 = i3 + o2;
|
||
return l2 * l2 > r2 * r2 + n2 * n2;
|
||
}
|
||
_circleAndRectCollide(t2, e2, i3, s2, a2, o2, r2) {
|
||
const n2 = (o2 - s2) / 2, l2 = Math.abs(t2 - (s2 + n2));
|
||
if (l2 > n2 + i3) return false;
|
||
const h2 = (r2 - a2) / 2, c2 = Math.abs(e2 - (a2 + h2));
|
||
if (c2 > h2 + i3) return false;
|
||
if (l2 <= n2 || c2 <= h2) return true;
|
||
const u2 = l2 - n2, d2 = c2 - h2;
|
||
return u2 * u2 + d2 * d2 <= i3 * i3;
|
||
}
|
||
}
|
||
function nt(e2, i3, s2, a2, o2) {
|
||
const r2 = t.Z();
|
||
return i3 ? (t.a0(r2, r2, [1 / o2, 1 / o2, 1]), s2 || t.ae(r2, r2, a2.angle)) : t.a1(r2, a2.labelPlaneMatrix, e2), r2;
|
||
}
|
||
function lt(e2, i3, s2, a2, o2) {
|
||
if (i3) {
|
||
const i4 = t.af(e2);
|
||
return t.a0(i4, i4, [o2, o2, 1]), s2 || t.ae(i4, i4, -a2.angle), i4;
|
||
}
|
||
return a2.glCoordMatrix;
|
||
}
|
||
function ht(e2, i3, s2) {
|
||
let a2;
|
||
s2 ? (a2 = [e2.x, e2.y, s2(e2.x, e2.y), 1], t.ag(a2, a2, i3)) : (a2 = [e2.x, e2.y, 0, 1], Tt(a2, a2, i3));
|
||
const o2 = a2[3];
|
||
return { point: new t.P(a2[0] / o2, a2[1] / o2), signedDistanceFromCamera: o2 };
|
||
}
|
||
function ct(t2, e2) {
|
||
return 0.5 + t2 / e2 * 0.5;
|
||
}
|
||
function ut(t2, e2) {
|
||
const i3 = t2[0] / t2[3], s2 = t2[1] / t2[3];
|
||
return i3 >= -e2[0] && i3 <= e2[0] && s2 >= -e2[1] && s2 <= e2[1];
|
||
}
|
||
function dt(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2) {
|
||
const u2 = a2 ? e2.textSizeData : e2.iconSizeData, d2 = t.ah(u2, s2.transform.zoom), _2 = [256 / s2.width * 2 + 1, 256 / s2.height * 2 + 1], p2 = a2 ? e2.text.dynamicLayoutVertexArray : e2.icon.dynamicLayoutVertexArray;
|
||
p2.clear();
|
||
const m2 = e2.lineVertexArray, f2 = a2 ? e2.text.placedSymbolArray : e2.icon.placedSymbolArray, g2 = s2.transform.width / s2.transform.height;
|
||
let v2 = false;
|
||
for (let a3 = 0; a3 < f2.length; a3++) {
|
||
const x2 = f2.get(a3);
|
||
if (x2.hidden || x2.writingMode === t.ai.vertical && !v2) {
|
||
wt(x2.numGlyphs, p2);
|
||
continue;
|
||
}
|
||
let y2;
|
||
if (v2 = false, c2 ? (y2 = [x2.anchorX, x2.anchorY, c2(x2.anchorX, x2.anchorY), 1], t.ag(y2, y2, i3)) : (y2 = [x2.anchorX, x2.anchorY, 0, 1], Tt(y2, y2, i3)), !ut(y2, _2)) {
|
||
wt(x2.numGlyphs, p2);
|
||
continue;
|
||
}
|
||
const b2 = ct(s2.transform.cameraToCenterDistance, y2[3]), w2 = t.aj(u2, d2, x2), T2 = n2 ? w2 / b2 : w2 * b2, I2 = new t.P(x2.anchorX, x2.anchorY), E2 = ht(I2, o2, c2).point, S2 = { projections: {}, offsets: {} }, C2 = mt(x2, T2, false, l2, i3, o2, r2, e2.glyphOffsetArray, m2, p2, E2, I2, S2, g2, h2, c2);
|
||
v2 = C2.useVertical, (C2.notEnoughRoom || v2 || C2.needsFlipping && mt(x2, T2, true, l2, i3, o2, r2, e2.glyphOffsetArray, m2, p2, E2, I2, S2, g2, h2, c2).notEnoughRoom) && wt(x2.numGlyphs, p2);
|
||
}
|
||
a2 ? e2.text.dynamicLayoutVertexBuffer.updateData(p2) : e2.icon.dynamicLayoutVertexBuffer.updateData(p2);
|
||
}
|
||
function _t(t2, e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2) {
|
||
const _2 = n2.glyphStartIndex + n2.numGlyphs, p2 = n2.lineStartIndex, m2 = n2.lineStartIndex + n2.lineLength, f2 = e2.getoffsetX(n2.glyphStartIndex), g2 = e2.getoffsetX(_2 - 1), v2 = yt(t2 * f2, i3, s2, a2, o2, r2, n2.segment, p2, m2, l2, h2, c2, u2, d2);
|
||
if (!v2) return null;
|
||
const x2 = yt(t2 * g2, i3, s2, a2, o2, r2, n2.segment, p2, m2, l2, h2, c2, u2, d2);
|
||
return x2 ? { first: v2, last: x2 } : null;
|
||
}
|
||
function pt(e2, i3, s2, a2) {
|
||
return e2 === t.ai.horizontal && Math.abs(s2.y - i3.y) > Math.abs(s2.x - i3.x) * a2 ? { useVertical: true } : (e2 === t.ai.vertical ? i3.y < s2.y : i3.x > s2.x) ? { needsFlipping: true } : null;
|
||
}
|
||
function mt(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2) {
|
||
const g2 = i3 / 24, v2 = e2.lineOffsetX * g2, x2 = e2.lineOffsetY * g2;
|
||
let y2;
|
||
if (e2.numGlyphs > 1) {
|
||
const t2 = e2.glyphStartIndex + e2.numGlyphs, i4 = e2.lineStartIndex, o3 = e2.lineStartIndex + e2.lineLength, c3 = _t(g2, l2, v2, x2, s2, u2, d2, e2, h2, r2, _2, m2, f2);
|
||
if (!c3) return { notEnoughRoom: true };
|
||
const b2 = ht(c3.first.point, n2, f2).point, w2 = ht(c3.last.point, n2, f2).point;
|
||
if (a2 && !s2) {
|
||
const t3 = pt(e2.writingMode, b2, w2, p2);
|
||
if (t3) return t3;
|
||
}
|
||
y2 = [c3.first];
|
||
for (let a3 = e2.glyphStartIndex + 1; a3 < t2 - 1; a3++) y2.push(yt(g2 * l2.getoffsetX(a3), v2, x2, s2, u2, d2, e2.segment, i4, o3, h2, r2, _2, m2, f2));
|
||
y2.push(c3.last);
|
||
} else {
|
||
if (a2 && !s2) {
|
||
const i5 = ht(d2, o2, f2).point, s3 = e2.lineStartIndex + e2.segment + 1, a3 = new t.P(h2.getx(s3), h2.gety(s3)), r3 = ht(a3, o2, f2), n3 = r3.signedDistanceFromCamera > 0 ? r3.point : ft(d2, a3, i5, 1, o2, f2), l3 = pt(e2.writingMode, i5, n3, p2);
|
||
if (l3) return l3;
|
||
}
|
||
const i4 = yt(g2 * l2.getoffsetX(e2.glyphStartIndex), v2, x2, s2, u2, d2, e2.segment, e2.lineStartIndex, e2.lineStartIndex + e2.lineLength, h2, r2, _2, m2, f2);
|
||
if (!i4) return { notEnoughRoom: true };
|
||
y2 = [i4];
|
||
}
|
||
for (const e3 of y2) t.ak(c2, e3.point, e3.angle);
|
||
return {};
|
||
}
|
||
function ft(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = ht(t2.add(t2.sub(e2)._unit()), a2, o2).point, n2 = i3.sub(r2);
|
||
return i3.add(n2._mult(s2 / n2.mag()));
|
||
}
|
||
function gt(e2, i3) {
|
||
const { projectionCache: s2, lineVertexArray: a2, labelPlaneMatrix: o2, tileAnchorPoint: r2, distanceFromAnchor: n2, getElevation: l2, previousVertex: h2, direction: c2, absOffsetX: u2 } = i3;
|
||
if (s2.projections[e2]) return s2.projections[e2];
|
||
const d2 = new t.P(a2.getx(e2), a2.gety(e2)), _2 = ht(d2, o2, l2);
|
||
if (_2.signedDistanceFromCamera > 0) return s2.projections[e2] = _2.point, _2.point;
|
||
const p2 = e2 - c2;
|
||
return ft(0 === n2 ? r2 : new t.P(a2.getx(p2), a2.gety(p2)), d2, h2, u2 - n2 + 1, o2, l2);
|
||
}
|
||
function vt(t2, e2, i3) {
|
||
return t2._unit()._perp()._mult(e2 * i3);
|
||
}
|
||
function xt(e2, i3, s2, a2, o2, r2, n2, l2) {
|
||
const { projectionCache: h2, direction: c2 } = l2;
|
||
if (h2.offsets[e2]) return h2.offsets[e2];
|
||
const u2 = s2.add(i3);
|
||
if (e2 + c2 < a2 || e2 + c2 >= o2) return h2.offsets[e2] = u2, u2;
|
||
const d2 = gt(e2 + c2, l2), _2 = vt(d2.sub(s2), n2, c2), p2 = s2.add(_2), m2 = d2.add(_2);
|
||
return h2.offsets[e2] = t.al(r2, u2, p2, m2) || u2, h2.offsets[e2];
|
||
}
|
||
function yt(t2, e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2, _2) {
|
||
const p2 = s2 ? t2 - e2 : t2 + e2;
|
||
let m2 = p2 > 0 ? 1 : -1, f2 = 0;
|
||
s2 && (m2 *= -1, f2 = Math.PI), m2 < 0 && (f2 += Math.PI);
|
||
let g2, v2, x2 = m2 > 0 ? n2 + r2 : n2 + r2 + 1, y2 = a2, b2 = a2, w2 = 0, T2 = 0;
|
||
const I2 = Math.abs(p2), E2 = [];
|
||
let S2;
|
||
for (; w2 + T2 <= I2; ) {
|
||
if (x2 += m2, x2 < n2 || x2 >= l2) return null;
|
||
w2 += T2, b2 = y2, v2 = g2;
|
||
const t3 = { projectionCache: u2, lineVertexArray: h2, labelPlaneMatrix: c2, tileAnchorPoint: o2, distanceFromAnchor: w2, getElevation: _2, previousVertex: b2, direction: m2, absOffsetX: I2 };
|
||
if (y2 = gt(x2, t3), 0 === i3) E2.push(b2), S2 = y2.sub(b2);
|
||
else {
|
||
let e3;
|
||
const s3 = y2.sub(b2);
|
||
e3 = 0 === s3.mag() ? vt(gt(x2 + m2, t3).sub(y2), i3, m2) : vt(s3, i3, m2), v2 || (v2 = b2.add(e3)), g2 = xt(x2, e3, y2, n2, l2, v2, i3, t3), E2.push(v2), S2 = g2.sub(v2);
|
||
}
|
||
T2 = S2.mag();
|
||
}
|
||
const C2 = S2._mult((I2 - w2) / T2)._add(v2 || b2), P2 = f2 + Math.atan2(y2.y - b2.y, y2.x - b2.x);
|
||
return E2.push(C2), { point: C2, angle: d2 ? P2 : 0, path: E2 };
|
||
}
|
||
const bt = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
|
||
function wt(t2, e2) {
|
||
for (let i3 = 0; i3 < t2; i3++) {
|
||
const t3 = e2.length;
|
||
e2.resize(t3 + 4), e2.float32.set(bt, 3 * t3);
|
||
}
|
||
}
|
||
function Tt(t2, e2, i3) {
|
||
const s2 = e2[0], a2 = e2[1];
|
||
return t2[0] = i3[0] * s2 + i3[4] * a2 + i3[12], t2[1] = i3[1] * s2 + i3[5] * a2 + i3[13], t2[3] = i3[3] * s2 + i3[7] * a2 + i3[15], t2;
|
||
}
|
||
const It = 100;
|
||
class Et {
|
||
constructor(t2, e2 = new rt(t2.width + 200, t2.height + 200, 25), i3 = new rt(t2.width + 200, t2.height + 200, 25)) {
|
||
this.transform = t2, this.grid = e2, this.ignoredGrid = i3, this.pitchfactor = Math.cos(t2._pitch) * t2.cameraToCenterDistance, this.screenRightBoundary = t2.width + It, this.screenBottomBoundary = t2.height + It, this.gridRightBoundary = t2.width + 200, this.gridBottomBoundary = t2.height + 200, this.perspectiveRatioCutoff = 0.6;
|
||
}
|
||
placeCollisionBox(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = this.projectAndGetPerspectiveRatio(s2, t2.anchorPointX, t2.anchorPointY, o2), n2 = i3 * r2.perspectiveRatio, l2 = t2.x1 * n2 + r2.point.x, h2 = t2.y1 * n2 + r2.point.y, c2 = t2.x2 * n2 + r2.point.x, u2 = t2.y2 * n2 + r2.point.y;
|
||
return !this.isInsideGrid(l2, h2, c2, u2) || "always" !== e2 && this.grid.hitTest(l2, h2, c2, u2, e2, a2) || r2.perspectiveRatio < this.perspectiveRatioCutoff ? { box: [], offscreen: false } : { box: [l2, h2, c2, u2], offscreen: this.isOffscreen(l2, h2, c2, u2) };
|
||
}
|
||
placeCollisionCircles(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2) {
|
||
const m2 = [], f2 = new t.P(i3.anchorX, i3.anchorY), g2 = ht(f2, r2, p2), v2 = ct(this.transform.cameraToCenterDistance, g2.signedDistanceFromCamera), x2 = (c2 ? o2 / v2 : o2 * v2) / t.ap, y2 = ht(f2, n2, p2).point, b2 = _t(x2, a2, i3.lineOffsetX * x2, i3.lineOffsetY * x2, false, y2, f2, i3, s2, n2, { projections: {}, offsets: {} }, false, p2);
|
||
let w2 = false, T2 = false, I2 = true;
|
||
if (b2) {
|
||
const i4 = 0.5 * d2 * v2 + _2, s3 = new t.P(-100, -100), a3 = new t.P(this.screenRightBoundary, this.screenBottomBoundary), o3 = new at(), r3 = b2.first, n3 = b2.last;
|
||
let c3 = [];
|
||
for (let t2 = r3.path.length - 1; t2 >= 1; t2--) c3.push(r3.path[t2]);
|
||
for (let t2 = 1; t2 < n3.path.length; t2++) c3.push(n3.path[t2]);
|
||
const f3 = 2.5 * i4;
|
||
if (l2) {
|
||
const t2 = c3.map(((t3) => ht(t3, l2, p2)));
|
||
c3 = t2.some(((t3) => t3.signedDistanceFromCamera <= 0)) ? [] : t2.map(((t3) => t3.point));
|
||
}
|
||
let g3 = [];
|
||
if (c3.length > 0) {
|
||
const e3 = c3[0].clone(), i5 = c3[0].clone();
|
||
for (let t2 = 1; t2 < c3.length; t2++) e3.x = Math.min(e3.x, c3[t2].x), e3.y = Math.min(e3.y, c3[t2].y), i5.x = Math.max(i5.x, c3[t2].x), i5.y = Math.max(i5.y, c3[t2].y);
|
||
g3 = e3.x >= s3.x && i5.x <= a3.x && e3.y >= s3.y && i5.y <= a3.y ? [c3] : i5.x < s3.x || e3.x > a3.x || i5.y < s3.y || e3.y > a3.y ? [] : t.am([c3], s3.x, s3.y, a3.x, a3.y);
|
||
}
|
||
for (const t2 of g3) {
|
||
o3.reset(t2, 0.25 * i4);
|
||
let s4 = 0;
|
||
s4 = o3.length <= 0.5 * i4 ? 1 : Math.ceil(o3.paddedLength / f3) + 1;
|
||
for (let t3 = 0; t3 < s4; t3++) {
|
||
const a4 = t3 / Math.max(s4 - 1, 1), r4 = o3.lerp(a4), n4 = r4.x + It, l3 = r4.y + It;
|
||
m2.push(n4, l3, i4, 0);
|
||
const c4 = n4 - i4, d3 = l3 - i4, _3 = n4 + i4, p3 = l3 + i4;
|
||
if (I2 = I2 && this.isOffscreen(c4, d3, _3, p3), T2 = T2 || this.isInsideGrid(c4, d3, _3, p3), "always" !== e2 && this.grid.hitTestCircle(n4, l3, i4, e2, u2) && (w2 = true, !h2)) return { circles: [], offscreen: false, collisionDetected: w2 };
|
||
}
|
||
}
|
||
}
|
||
return { circles: !h2 && w2 || !T2 || v2 < this.perspectiveRatioCutoff ? [] : m2, offscreen: I2, collisionDetected: w2 };
|
||
}
|
||
queryRenderedSymbols(e2) {
|
||
if (0 === e2.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {};
|
||
const i3 = [];
|
||
let s2 = 1 / 0, a2 = 1 / 0, o2 = -1 / 0, r2 = -1 / 0;
|
||
for (const n3 of e2) {
|
||
const e3 = new t.P(n3.x + It, n3.y + It);
|
||
s2 = Math.min(s2, e3.x), a2 = Math.min(a2, e3.y), o2 = Math.max(o2, e3.x), r2 = Math.max(r2, e3.y), i3.push(e3);
|
||
}
|
||
const n2 = this.grid.query(s2, a2, o2, r2).concat(this.ignoredGrid.query(s2, a2, o2, r2)), l2 = {}, h2 = {};
|
||
for (const e3 of n2) {
|
||
const s3 = e3.key;
|
||
if (void 0 === l2[s3.bucketInstanceId] && (l2[s3.bucketInstanceId] = {}), l2[s3.bucketInstanceId][s3.featureIndex]) continue;
|
||
const a3 = [new t.P(e3.x1, e3.y1), new t.P(e3.x2, e3.y1), new t.P(e3.x2, e3.y2), new t.P(e3.x1, e3.y2)];
|
||
t.an(i3, a3) && (l2[s3.bucketInstanceId][s3.featureIndex] = true, void 0 === h2[s3.bucketInstanceId] && (h2[s3.bucketInstanceId] = []), h2[s3.bucketInstanceId].push(s3.featureIndex));
|
||
}
|
||
return h2;
|
||
}
|
||
insertCollisionBox(t2, e2, i3, s2, a2, o2) {
|
||
(i3 ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: s2, featureIndex: a2, collisionGroupID: o2, overlapMode: e2 }, t2[0], t2[1], t2[2], t2[3]);
|
||
}
|
||
insertCollisionCircles(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = i3 ? this.ignoredGrid : this.grid, n2 = { bucketInstanceId: s2, featureIndex: a2, collisionGroupID: o2, overlapMode: e2 };
|
||
for (let e3 = 0; e3 < t2.length; e3 += 4) r2.insertCircle(n2, t2[e3], t2[e3 + 1], t2[e3 + 2]);
|
||
}
|
||
projectAndGetPerspectiveRatio(e2, i3, s2, a2) {
|
||
let o2;
|
||
return a2 ? (o2 = [i3, s2, a2(i3, s2), 1], t.ag(o2, o2, e2)) : (o2 = [i3, s2, 0, 1], Tt(o2, o2, e2)), { point: new t.P((o2[0] / o2[3] + 1) / 2 * this.transform.width + It, (-o2[1] / o2[3] + 1) / 2 * this.transform.height + It), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / o2[3] * 0.5 };
|
||
}
|
||
isOffscreen(t2, e2, i3, s2) {
|
||
return i3 < It || t2 >= this.screenRightBoundary || s2 < It || e2 > this.screenBottomBoundary;
|
||
}
|
||
isInsideGrid(t2, e2, i3, s2) {
|
||
return i3 >= 0 && t2 < this.gridRightBoundary && s2 >= 0 && e2 < this.gridBottomBoundary;
|
||
}
|
||
getViewportMatrix() {
|
||
const e2 = t.ao([]);
|
||
return t.$(e2, e2, [-100, -100, 0]), e2;
|
||
}
|
||
}
|
||
function St(e2, i3, s2) {
|
||
return i3 * (t.N / (e2.tileSize * Math.pow(2, s2 - e2.tileID.overscaledZ)));
|
||
}
|
||
class Ct {
|
||
constructor(t2, e2, i3, s2) {
|
||
this.opacity = t2 ? Math.max(0, Math.min(1, t2.opacity + (t2.placed ? e2 : -e2))) : s2 && i3 ? 1 : 0, this.placed = i3;
|
||
}
|
||
isHidden() {
|
||
return 0 === this.opacity && !this.placed;
|
||
}
|
||
}
|
||
class Pt {
|
||
constructor(t2, e2, i3, s2, a2) {
|
||
this.text = new Ct(t2 ? t2.text : null, e2, i3, a2), this.icon = new Ct(t2 ? t2.icon : null, e2, s2, a2);
|
||
}
|
||
isHidden() {
|
||
return this.text.isHidden() && this.icon.isHidden();
|
||
}
|
||
}
|
||
class Dt {
|
||
constructor(t2, e2, i3) {
|
||
this.text = t2, this.icon = e2, this.skipFade = i3;
|
||
}
|
||
}
|
||
class Mt {
|
||
constructor() {
|
||
this.invProjMatrix = t.Z(), this.viewportMatrix = t.Z(), this.circles = [];
|
||
}
|
||
}
|
||
class zt {
|
||
constructor(t2, e2, i3, s2, a2) {
|
||
this.bucketInstanceId = t2, this.featureIndex = e2, this.sourceLayerIndex = i3, this.bucketIndex = s2, this.tileID = a2;
|
||
}
|
||
}
|
||
class Lt {
|
||
constructor(t2) {
|
||
this.crossSourceCollisions = t2, this.maxGroupID = 0, this.collisionGroups = {};
|
||
}
|
||
get(t2) {
|
||
if (this.crossSourceCollisions) return { ID: 0, predicate: null };
|
||
if (!this.collisionGroups[t2]) {
|
||
const e2 = ++this.maxGroupID;
|
||
this.collisionGroups[t2] = { ID: e2, predicate: (t3) => t3.collisionGroupID === e2 };
|
||
}
|
||
return this.collisionGroups[t2];
|
||
}
|
||
}
|
||
function At(e2, i3, s2, a2, o2) {
|
||
const { horizontalAlign: r2, verticalAlign: n2 } = t.au(e2);
|
||
return new t.P(-(r2 - 0.5) * i3 + a2[0] * o2, -(n2 - 0.5) * s2 + a2[1] * o2);
|
||
}
|
||
function Rt(e2, i3, s2, a2, o2, r2) {
|
||
const { x1: n2, x2: l2, y1: h2, y2: c2, anchorPointX: u2, anchorPointY: d2 } = e2, _2 = new t.P(i3, s2);
|
||
return a2 && _2._rotate(o2 ? r2 : -r2), { x1: n2 + _2.x, y1: h2 + _2.y, x2: l2 + _2.x, y2: c2 + _2.y, anchorPointX: u2, anchorPointY: d2 };
|
||
}
|
||
class kt {
|
||
constructor(t2, e2, i3, s2, a2) {
|
||
this.transform = t2.clone(), this.terrain = e2, this.collisionIndex = new Et(this.transform), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = false, this.commitTime = 0, this.fadeDuration = i3, this.retainedQueryData = {}, this.collisionGroups = new Lt(s2), this.collisionCircleArrays = {}, this.prevPlacement = a2, a2 && (a2.prevPlacement = void 0), this.placedOrientations = {};
|
||
}
|
||
getBucketParts(e2, i3, s2, a2) {
|
||
const o2 = s2.getBucket(i3), r2 = s2.latestFeatureIndex;
|
||
if (!o2 || !r2 || i3.id !== o2.layerIds[0]) return;
|
||
const n2 = s2.collisionBoxArray, l2 = o2.layers[0].layout, h2 = Math.pow(2, this.transform.zoom - s2.tileID.overscaledZ), c2 = s2.tileSize / t.N, u2 = this.transform.calculatePosMatrix(s2.tileID.toUnwrapped()), d2 = "map" === l2.get("text-pitch-alignment"), _2 = "map" === l2.get("text-rotation-alignment"), p2 = St(s2, 1, this.transform.zoom), m2 = nt(u2, d2, _2, this.transform, p2);
|
||
let f2 = null;
|
||
if (d2) {
|
||
const e3 = lt(u2, d2, _2, this.transform, p2);
|
||
f2 = t.a1([], this.transform.labelPlaneMatrix, e3);
|
||
}
|
||
this.retainedQueryData[o2.bucketInstanceId] = new zt(o2.bucketInstanceId, r2, o2.sourceLayerIndex, o2.index, s2.tileID);
|
||
const g2 = { bucket: o2, layout: l2, posMatrix: u2, textLabelPlaneMatrix: m2, labelToScreenMatrix: f2, scale: h2, textPixelRatio: c2, holdingForFade: s2.holdingForFade(), collisionBoxArray: n2, partiallyEvaluatedTextSize: t.ah(o2.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(o2.sourceID) };
|
||
if (a2) for (const t2 of o2.sortKeyRanges) {
|
||
const { sortKey: i4, symbolInstanceStart: s3, symbolInstanceEnd: a3 } = t2;
|
||
e2.push({ sortKey: i4, symbolInstanceStart: s3, symbolInstanceEnd: a3, parameters: g2 });
|
||
}
|
||
else e2.push({ symbolInstanceStart: 0, symbolInstanceEnd: o2.symbolInstances.length, parameters: g2 });
|
||
}
|
||
attemptAnchorPlacement(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2) {
|
||
const g2 = t.aq[e2.textAnchor], v2 = [e2.textOffset0, e2.textOffset1], x2 = At(g2, s2, a2, v2, o2), y2 = this.collisionIndex.placeCollisionBox(Rt(i3, x2.x, x2.y, r2, n2, this.transform.angle), u2, l2, h2, c2.predicate, f2);
|
||
if ((!m2 || 0 !== this.collisionIndex.placeCollisionBox(Rt(m2, x2.x, x2.y, r2, n2, this.transform.angle), u2, l2, h2, c2.predicate, f2).box.length) && y2.box.length > 0) {
|
||
let t2;
|
||
if (this.prevPlacement && this.prevPlacement.variableOffsets[d2.crossTileID] && this.prevPlacement.placements[d2.crossTileID] && this.prevPlacement.placements[d2.crossTileID].text && (t2 = this.prevPlacement.variableOffsets[d2.crossTileID].anchor), 0 === d2.crossTileID) throw new Error("symbolInstance.crossTileID can't be 0");
|
||
return this.variableOffsets[d2.crossTileID] = { textOffset: v2, width: s2, height: a2, anchor: g2, textBoxScale: o2, prevAnchor: t2 }, this.markUsedJustification(_2, g2, d2, p2), _2.allowVerticalPlacement && (this.markUsedOrientation(_2, p2, d2), this.placedOrientations[d2.crossTileID] = p2), { shift: x2, placedGlyphBoxes: y2 };
|
||
}
|
||
}
|
||
placeLayerBucketPart(e2, i3, s2) {
|
||
const { bucket: a2, layout: o2, posMatrix: r2, textLabelPlaneMatrix: n2, labelToScreenMatrix: l2, textPixelRatio: h2, holdingForFade: c2, collisionBoxArray: u2, partiallyEvaluatedTextSize: d2, collisionGroup: _2 } = e2.parameters, p2 = o2.get("text-optional"), m2 = o2.get("icon-optional"), f2 = t.ar(o2, "text-overlap", "text-allow-overlap"), g2 = "always" === f2, v2 = t.ar(o2, "icon-overlap", "icon-allow-overlap"), x2 = "always" === v2, y2 = "map" === o2.get("text-rotation-alignment"), b2 = "map" === o2.get("text-pitch-alignment"), w2 = "none" !== o2.get("icon-text-fit"), T2 = "viewport-y" === o2.get("symbol-z-order"), I2 = g2 && (x2 || !a2.hasIconData() || m2), E2 = x2 && (g2 || !a2.hasTextData() || p2);
|
||
!a2.collisionArrays && u2 && a2.deserializeCollisionBoxes(u2);
|
||
const S2 = this.retainedQueryData[a2.bucketInstanceId].tileID, C2 = this.terrain ? (t2, e3) => this.terrain.getElevation(S2, t2, e3) : null, P2 = (e3, u3) => {
|
||
var x3, T3;
|
||
if (i3[e3.crossTileID]) return;
|
||
if (c2) return void (this.placements[e3.crossTileID] = new Dt(false, false, false));
|
||
let S3 = false, P3 = false, D2 = true, M2 = null, z2 = { box: null, offscreen: null }, L2 = { box: null }, A2 = null, R2 = null, k2 = null, F2 = 0, B2 = 0, O2 = 0;
|
||
u3.textFeatureIndex ? F2 = u3.textFeatureIndex : e3.useRuntimeCollisionCircles && (F2 = e3.featureIndex), u3.verticalTextFeatureIndex && (B2 = u3.verticalTextFeatureIndex);
|
||
const N2 = u3.textBox;
|
||
if (N2) {
|
||
const i4 = (i5) => {
|
||
let s4 = t.ai.horizontal;
|
||
if (a2.allowVerticalPlacement && !i5 && this.prevPlacement) {
|
||
const t2 = this.prevPlacement.placedOrientations[e3.crossTileID];
|
||
t2 && (this.placedOrientations[e3.crossTileID] = t2, s4 = t2, this.markUsedOrientation(a2, s4, e3));
|
||
}
|
||
return s4;
|
||
}, s3 = (i5, s4) => {
|
||
if (a2.allowVerticalPlacement && e3.numVerticalGlyphVertices > 0 && u3.verticalTextBox) {
|
||
for (const e4 of a2.writingModes) if (e4 === t.ai.vertical ? (z2 = s4(), L2 = z2) : z2 = i5(), z2 && z2.box && z2.box.length) break;
|
||
} else z2 = i5();
|
||
}, o3 = e3.textAnchorOffsetStartIndex, n3 = e3.textAnchorOffsetEndIndex;
|
||
if (n3 === o3) {
|
||
const o4 = (t2, i5) => {
|
||
const s4 = this.collisionIndex.placeCollisionBox(t2, f2, h2, r2, _2.predicate, C2);
|
||
return s4 && s4.box && s4.box.length && (this.markUsedOrientation(a2, i5, e3), this.placedOrientations[e3.crossTileID] = i5), s4;
|
||
};
|
||
s3((() => o4(N2, t.ai.horizontal)), (() => {
|
||
const i5 = u3.verticalTextBox;
|
||
return a2.allowVerticalPlacement && e3.numVerticalGlyphVertices > 0 && i5 ? o4(i5, t.ai.vertical) : { box: null, offscreen: null };
|
||
})), i4(z2 && z2.box && z2.box.length);
|
||
} else {
|
||
let l3 = t.aq[null === (T3 = null === (x3 = this.prevPlacement) || void 0 === x3 ? void 0 : x3.variableOffsets[e3.crossTileID]) || void 0 === T3 ? void 0 : T3.anchor];
|
||
const c3 = (t2, i5, s4) => {
|
||
const c4 = t2.x2 - t2.x1, u4 = t2.y2 - t2.y1, d4 = e3.textBoxScale, p3 = w2 && "never" === v2 ? i5 : null;
|
||
let m3 = { box: [], offscreen: false }, g3 = "never" === f2 ? 1 : 2, x4 = "never";
|
||
l3 && g3++;
|
||
for (let i6 = 0; i6 < g3; i6++) {
|
||
for (let i7 = o3; i7 < n3; i7++) {
|
||
const o4 = a2.textAnchorOffsets.get(i7);
|
||
if (l3 && o4.textAnchor !== l3) continue;
|
||
const n4 = this.attemptAnchorPlacement(o4, t2, c4, u4, d4, y2, b2, h2, r2, _2, x4, e3, a2, s4, p3, C2);
|
||
if (n4 && (m3 = n4.placedGlyphBoxes, m3 && m3.box && m3.box.length)) return S3 = true, M2 = n4.shift, m3;
|
||
}
|
||
l3 ? l3 = null : x4 = f2;
|
||
}
|
||
return m3;
|
||
};
|
||
s3((() => c3(N2, u3.iconBox, t.ai.horizontal)), (() => {
|
||
const i5 = u3.verticalTextBox;
|
||
return a2.allowVerticalPlacement && !(z2 && z2.box && z2.box.length) && e3.numVerticalGlyphVertices > 0 && i5 ? c3(i5, u3.verticalIconBox, t.ai.vertical) : { box: null, offscreen: null };
|
||
})), z2 && (S3 = z2.box, D2 = z2.offscreen);
|
||
const d3 = i4(z2 && z2.box);
|
||
if (!S3 && this.prevPlacement) {
|
||
const t2 = this.prevPlacement.variableOffsets[e3.crossTileID];
|
||
t2 && (this.variableOffsets[e3.crossTileID] = t2, this.markUsedJustification(a2, t2.anchor, e3, d3));
|
||
}
|
||
}
|
||
}
|
||
if (A2 = z2, S3 = A2 && A2.box && A2.box.length > 0, D2 = A2 && A2.offscreen, e3.useRuntimeCollisionCircles) {
|
||
const i4 = a2.text.placedSymbolArray.get(e3.centerJustifiedTextSymbolIndex), h3 = t.aj(a2.textSizeData, d2, i4), c3 = o2.get("text-padding");
|
||
R2 = this.collisionIndex.placeCollisionCircles(f2, i4, a2.lineVertexArray, a2.glyphOffsetArray, h3, r2, n2, l2, s2, b2, _2.predicate, e3.collisionCircleDiameter, c3, C2), R2.circles.length && R2.collisionDetected && !s2 && t.w("Collisions detected, but collision boxes are not shown"), S3 = g2 || R2.circles.length > 0 && !R2.collisionDetected, D2 = D2 && R2.offscreen;
|
||
}
|
||
if (u3.iconFeatureIndex && (O2 = u3.iconFeatureIndex), u3.iconBox) {
|
||
const t2 = (t3) => {
|
||
const e4 = w2 && M2 ? Rt(t3, M2.x, M2.y, y2, b2, this.transform.angle) : t3;
|
||
return this.collisionIndex.placeCollisionBox(e4, v2, h2, r2, _2.predicate, C2);
|
||
};
|
||
L2 && L2.box && L2.box.length && u3.verticalIconBox ? (k2 = t2(u3.verticalIconBox), P3 = k2.box.length > 0) : (k2 = t2(u3.iconBox), P3 = k2.box.length > 0), D2 = D2 && k2.offscreen;
|
||
}
|
||
const U2 = p2 || 0 === e3.numHorizontalGlyphVertices && 0 === e3.numVerticalGlyphVertices, Z2 = m2 || 0 === e3.numIconVertices;
|
||
if (U2 || Z2 ? Z2 ? U2 || (P3 = P3 && S3) : S3 = P3 && S3 : P3 = S3 = P3 && S3, S3 && A2 && A2.box && this.collisionIndex.insertCollisionBox(A2.box, f2, o2.get("text-ignore-placement"), a2.bucketInstanceId, L2 && L2.box && B2 ? B2 : F2, _2.ID), P3 && k2 && this.collisionIndex.insertCollisionBox(k2.box, v2, o2.get("icon-ignore-placement"), a2.bucketInstanceId, O2, _2.ID), R2 && (S3 && this.collisionIndex.insertCollisionCircles(R2.circles, f2, o2.get("text-ignore-placement"), a2.bucketInstanceId, F2, _2.ID), s2)) {
|
||
const t2 = a2.bucketInstanceId;
|
||
let e4 = this.collisionCircleArrays[t2];
|
||
void 0 === e4 && (e4 = this.collisionCircleArrays[t2] = new Mt());
|
||
for (let t3 = 0; t3 < R2.circles.length; t3 += 4) e4.circles.push(R2.circles[t3 + 0]), e4.circles.push(R2.circles[t3 + 1]), e4.circles.push(R2.circles[t3 + 2]), e4.circles.push(R2.collisionDetected ? 1 : 0);
|
||
}
|
||
if (0 === e3.crossTileID) throw new Error("symbolInstance.crossTileID can't be 0");
|
||
if (0 === a2.bucketInstanceId) throw new Error("bucket.bucketInstanceId can't be 0");
|
||
this.placements[e3.crossTileID] = new Dt(S3 || I2, P3 || E2, D2 || a2.justReloaded), i3[e3.crossTileID] = true;
|
||
};
|
||
if (T2) {
|
||
if (0 !== e2.symbolInstanceStart) throw new Error("bucket.bucketInstanceId should be 0");
|
||
const t2 = a2.getSortedSymbolIndexes(this.transform.angle);
|
||
for (let e3 = t2.length - 1; e3 >= 0; --e3) {
|
||
const i4 = t2[e3];
|
||
P2(a2.symbolInstances.get(i4), a2.collisionArrays[i4]);
|
||
}
|
||
} else for (let t2 = e2.symbolInstanceStart; t2 < e2.symbolInstanceEnd; t2++) P2(a2.symbolInstances.get(t2), a2.collisionArrays[t2]);
|
||
if (s2 && a2.bucketInstanceId in this.collisionCircleArrays) {
|
||
const e3 = this.collisionCircleArrays[a2.bucketInstanceId];
|
||
t.as(e3.invProjMatrix, r2), e3.viewportMatrix = this.collisionIndex.getViewportMatrix();
|
||
}
|
||
a2.justReloaded = false;
|
||
}
|
||
markUsedJustification(e2, i3, s2, a2) {
|
||
let o2;
|
||
o2 = a2 === t.ai.vertical ? s2.verticalPlacedTextSymbolIndex : { left: s2.leftJustifiedTextSymbolIndex, center: s2.centerJustifiedTextSymbolIndex, right: s2.rightJustifiedTextSymbolIndex }[t.at(i3)];
|
||
const r2 = [s2.leftJustifiedTextSymbolIndex, s2.centerJustifiedTextSymbolIndex, s2.rightJustifiedTextSymbolIndex, s2.verticalPlacedTextSymbolIndex];
|
||
for (const t2 of r2) t2 >= 0 && (e2.text.placedSymbolArray.get(t2).crossTileID = o2 >= 0 && t2 !== o2 ? 0 : s2.crossTileID);
|
||
}
|
||
markUsedOrientation(e2, i3, s2) {
|
||
const a2 = i3 === t.ai.horizontal || i3 === t.ai.horizontalOnly ? i3 : 0, o2 = i3 === t.ai.vertical ? i3 : 0, r2 = [s2.leftJustifiedTextSymbolIndex, s2.centerJustifiedTextSymbolIndex, s2.rightJustifiedTextSymbolIndex];
|
||
for (const t2 of r2) e2.text.placedSymbolArray.get(t2).placedOrientation = a2;
|
||
s2.verticalPlacedTextSymbolIndex && (e2.text.placedSymbolArray.get(s2.verticalPlacedTextSymbolIndex).placedOrientation = o2);
|
||
}
|
||
commit(t2) {
|
||
this.commitTime = t2, this.zoomAtLastRecencyCheck = this.transform.zoom;
|
||
const e2 = this.prevPlacement;
|
||
let i3 = false;
|
||
this.prevZoomAdjustment = e2 ? e2.zoomAdjustment(this.transform.zoom) : 0;
|
||
const s2 = e2 ? e2.symbolFadeChange(t2) : 1, a2 = e2 ? e2.opacities : {}, o2 = e2 ? e2.variableOffsets : {}, r2 = e2 ? e2.placedOrientations : {};
|
||
for (const t3 in this.placements) {
|
||
const e3 = this.placements[t3], o3 = a2[t3];
|
||
o3 ? (this.opacities[t3] = new Pt(o3, s2, e3.text, e3.icon), i3 = i3 || e3.text !== o3.text.placed || e3.icon !== o3.icon.placed) : (this.opacities[t3] = new Pt(null, s2, e3.text, e3.icon, e3.skipFade), i3 = i3 || e3.text || e3.icon);
|
||
}
|
||
for (const t3 in a2) {
|
||
const e3 = a2[t3];
|
||
if (!this.opacities[t3]) {
|
||
const a3 = new Pt(e3, s2, false, false);
|
||
a3.isHidden() || (this.opacities[t3] = a3, i3 = i3 || e3.text.placed || e3.icon.placed);
|
||
}
|
||
}
|
||
for (const t3 in o2) this.variableOffsets[t3] || !this.opacities[t3] || this.opacities[t3].isHidden() || (this.variableOffsets[t3] = o2[t3]);
|
||
for (const t3 in r2) this.placedOrientations[t3] || !this.opacities[t3] || this.opacities[t3].isHidden() || (this.placedOrientations[t3] = r2[t3]);
|
||
if (e2 && void 0 === e2.lastPlacementChangeTime) throw new Error("Last placement time for previous placement is not defined");
|
||
i3 ? this.lastPlacementChangeTime = t2 : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = e2 ? e2.lastPlacementChangeTime : t2);
|
||
}
|
||
updateLayerOpacities(t2, e2) {
|
||
const i3 = {};
|
||
for (const s2 of e2) {
|
||
const e3 = s2.getBucket(t2);
|
||
e3 && s2.latestFeatureIndex && t2.id === e3.layerIds[0] && this.updateBucketOpacities(e3, i3, s2.collisionBoxArray);
|
||
}
|
||
}
|
||
updateBucketOpacities(e2, i3, s2) {
|
||
e2.hasTextData() && (e2.text.opacityVertexArray.clear(), e2.text.hasVisibleVertices = false), e2.hasIconData() && (e2.icon.opacityVertexArray.clear(), e2.icon.hasVisibleVertices = false), e2.hasIconCollisionBoxData() && e2.iconCollisionBox.collisionVertexArray.clear(), e2.hasTextCollisionBoxData() && e2.textCollisionBox.collisionVertexArray.clear();
|
||
const a2 = e2.layers[0], o2 = a2.layout, r2 = new Pt(null, 0, false, false, true), n2 = o2.get("text-allow-overlap"), l2 = o2.get("icon-allow-overlap"), h2 = a2._unevaluatedLayout.hasValue("text-variable-anchor") || a2._unevaluatedLayout.hasValue("text-variable-anchor-offset"), c2 = "map" === o2.get("text-rotation-alignment"), u2 = "map" === o2.get("text-pitch-alignment"), d2 = "none" !== o2.get("icon-text-fit"), _2 = new Pt(null, 0, n2 && (l2 || !e2.hasIconData() || o2.get("icon-optional")), l2 && (n2 || !e2.hasTextData() || o2.get("text-optional")), true);
|
||
!e2.collisionArrays && s2 && (e2.hasIconCollisionBoxData() || e2.hasTextCollisionBoxData()) && e2.deserializeCollisionBoxes(s2);
|
||
const p2 = (t2, e3, i4) => {
|
||
for (let s3 = 0; s3 < e3 / 4; s3++) t2.opacityVertexArray.emplaceBack(i4);
|
||
t2.hasVisibleVertices = t2.hasVisibleVertices || i4 !== qt;
|
||
};
|
||
for (let s3 = 0; s3 < e2.symbolInstances.length; s3++) {
|
||
const a3 = e2.symbolInstances.get(s3), { numHorizontalGlyphVertices: o3, numVerticalGlyphVertices: n3, crossTileID: l3 } = a3;
|
||
let m2 = this.opacities[l3];
|
||
i3[l3] ? m2 = r2 : m2 || (m2 = _2, this.opacities[l3] = m2), i3[l3] = true;
|
||
const f2 = a3.numIconVertices > 0, g2 = this.placedOrientations[a3.crossTileID], v2 = g2 === t.ai.vertical, x2 = g2 === t.ai.horizontal || g2 === t.ai.horizontalOnly;
|
||
if (o3 > 0 || n3 > 0) {
|
||
const t2 = Vt(m2.text);
|
||
p2(e2.text, o3, v2 ? qt : t2), p2(e2.text, n3, x2 ? qt : t2);
|
||
const i4 = m2.text.isHidden();
|
||
[a3.rightJustifiedTextSymbolIndex, a3.centerJustifiedTextSymbolIndex, a3.leftJustifiedTextSymbolIndex].forEach(((t3) => {
|
||
t3 >= 0 && (e2.text.placedSymbolArray.get(t3).hidden = i4 || v2 ? 1 : 0);
|
||
})), a3.verticalPlacedTextSymbolIndex >= 0 && (e2.text.placedSymbolArray.get(a3.verticalPlacedTextSymbolIndex).hidden = i4 || x2 ? 1 : 0);
|
||
const s4 = this.variableOffsets[a3.crossTileID];
|
||
s4 && this.markUsedJustification(e2, s4.anchor, a3, g2);
|
||
const r3 = this.placedOrientations[a3.crossTileID];
|
||
r3 && (this.markUsedJustification(e2, "left", a3, r3), this.markUsedOrientation(e2, r3, a3));
|
||
}
|
||
if (f2) {
|
||
const t2 = Vt(m2.icon), i4 = !(d2 && a3.verticalPlacedIconSymbolIndex && v2);
|
||
a3.placedIconSymbolIndex >= 0 && (p2(e2.icon, a3.numIconVertices, i4 ? t2 : qt), e2.icon.placedSymbolArray.get(a3.placedIconSymbolIndex).hidden = m2.icon.isHidden()), a3.verticalPlacedIconSymbolIndex >= 0 && (p2(e2.icon, a3.numVerticalIconVertices, i4 ? qt : t2), e2.icon.placedSymbolArray.get(a3.verticalPlacedIconSymbolIndex).hidden = m2.icon.isHidden());
|
||
}
|
||
if (e2.hasIconCollisionBoxData() || e2.hasTextCollisionBoxData()) {
|
||
const i4 = e2.collisionArrays[s3];
|
||
if (i4) {
|
||
let s4 = new t.P(0, 0);
|
||
if (i4.textBox || i4.verticalTextBox) {
|
||
let t2 = true;
|
||
if (h2) {
|
||
const e3 = this.variableOffsets[l3];
|
||
e3 ? (s4 = At(e3.anchor, e3.width, e3.height, e3.textOffset, e3.textBoxScale), c2 && s4._rotate(u2 ? this.transform.angle : -this.transform.angle)) : t2 = false;
|
||
}
|
||
i4.textBox && Ft(e2.textCollisionBox.collisionVertexArray, m2.text.placed, !t2 || v2, s4.x, s4.y), i4.verticalTextBox && Ft(e2.textCollisionBox.collisionVertexArray, m2.text.placed, !t2 || x2, s4.x, s4.y);
|
||
}
|
||
const a4 = Boolean(!x2 && i4.verticalIconBox);
|
||
i4.iconBox && Ft(e2.iconCollisionBox.collisionVertexArray, m2.icon.placed, a4, d2 ? s4.x : 0, d2 ? s4.y : 0), i4.verticalIconBox && Ft(e2.iconCollisionBox.collisionVertexArray, m2.icon.placed, !a4, d2 ? s4.x : 0, d2 ? s4.y : 0);
|
||
}
|
||
}
|
||
}
|
||
if (e2.sortFeatures(this.transform.angle), this.retainedQueryData[e2.bucketInstanceId] && (this.retainedQueryData[e2.bucketInstanceId].featureSortOrder = e2.featureSortOrder), e2.hasTextData() && e2.text.opacityVertexBuffer && e2.text.opacityVertexBuffer.updateData(e2.text.opacityVertexArray), e2.hasIconData() && e2.icon.opacityVertexBuffer && e2.icon.opacityVertexBuffer.updateData(e2.icon.opacityVertexArray), e2.hasIconCollisionBoxData() && e2.iconCollisionBox.collisionVertexBuffer && e2.iconCollisionBox.collisionVertexBuffer.updateData(e2.iconCollisionBox.collisionVertexArray), e2.hasTextCollisionBoxData() && e2.textCollisionBox.collisionVertexBuffer && e2.textCollisionBox.collisionVertexBuffer.updateData(e2.textCollisionBox.collisionVertexArray), e2.text.opacityVertexArray.length !== e2.text.layoutVertexArray.length / 4) throw new Error(`bucket.text.opacityVertexArray.length (= ${e2.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e2.text.layoutVertexArray.length}) / 4`);
|
||
if (e2.icon.opacityVertexArray.length !== e2.icon.layoutVertexArray.length / 4) throw new Error(`bucket.icon.opacityVertexArray.length (= ${e2.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e2.icon.layoutVertexArray.length}) / 4`);
|
||
if (e2.bucketInstanceId in this.collisionCircleArrays) {
|
||
const t2 = this.collisionCircleArrays[e2.bucketInstanceId];
|
||
e2.placementInvProjMatrix = t2.invProjMatrix, e2.placementViewportMatrix = t2.viewportMatrix, e2.collisionCircleArray = t2.circles, delete this.collisionCircleArrays[e2.bucketInstanceId];
|
||
}
|
||
}
|
||
symbolFadeChange(t2) {
|
||
return 0 === this.fadeDuration ? 1 : (t2 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;
|
||
}
|
||
zoomAdjustment(t2) {
|
||
return Math.max(0, (this.transform.zoom - t2) / 1.5);
|
||
}
|
||
hasTransitions(t2) {
|
||
return this.stale || t2 - this.lastPlacementChangeTime < this.fadeDuration;
|
||
}
|
||
stillRecent(t2, e2) {
|
||
const i3 = this.zoomAtLastRecencyCheck === e2 ? 1 - this.zoomAdjustment(e2) : 1;
|
||
return this.zoomAtLastRecencyCheck = e2, this.commitTime + this.fadeDuration * i3 > t2;
|
||
}
|
||
setStale() {
|
||
this.stale = true;
|
||
}
|
||
}
|
||
function Ft(t2, e2, i3, s2, a2) {
|
||
t2.emplaceBack(e2 ? 1 : 0, i3 ? 1 : 0, s2 || 0, a2 || 0), t2.emplaceBack(e2 ? 1 : 0, i3 ? 1 : 0, s2 || 0, a2 || 0), t2.emplaceBack(e2 ? 1 : 0, i3 ? 1 : 0, s2 || 0, a2 || 0), t2.emplaceBack(e2 ? 1 : 0, i3 ? 1 : 0, s2 || 0, a2 || 0);
|
||
}
|
||
const Bt = Math.pow(2, 25), Ot = Math.pow(2, 24), Nt = Math.pow(2, 17), Ut = Math.pow(2, 16), Zt = Math.pow(2, 9), Gt = Math.pow(2, 8), jt = Math.pow(2, 1);
|
||
function Vt(t2) {
|
||
if (0 === t2.opacity && !t2.placed) return 0;
|
||
if (1 === t2.opacity && t2.placed) return 4294967295;
|
||
const e2 = t2.placed ? 1 : 0, i3 = Math.floor(127 * t2.opacity);
|
||
return i3 * Bt + e2 * Ot + i3 * Nt + e2 * Ut + i3 * Zt + e2 * Gt + i3 * jt + e2;
|
||
}
|
||
const qt = 0;
|
||
class $t {
|
||
constructor(t2) {
|
||
this._sortAcrossTiles = "viewport-y" !== t2.layout.get("symbol-z-order") && !t2.layout.get("symbol-sort-key").isConstant(), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];
|
||
}
|
||
continuePlacement(t2, e2, i3, s2, a2) {
|
||
const o2 = this._bucketParts;
|
||
for (; this._currentTileIndex < t2.length; ) if (e2.getBucketParts(o2, s2, t2[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, a2()) return true;
|
||
for (this._sortAcrossTiles && (this._sortAcrossTiles = false, o2.sort(((t3, e3) => t3.sortKey - e3.sortKey))); this._currentPartIndex < o2.length; ) if (e2.placeLayerBucketPart(o2[this._currentPartIndex], this._seenCrossTileIDs, i3), this._currentPartIndex++, a2()) return true;
|
||
return false;
|
||
}
|
||
}
|
||
class Wt {
|
||
constructor(t2, e2, i3, s2, a2, o2, r2, n2) {
|
||
this.placement = new kt(t2, e2, o2, r2, n2), this._currentPlacementIndex = i3.length - 1, this._forceFullPlacement = s2, this._showCollisionBoxes = a2, this._done = false;
|
||
}
|
||
isDone() {
|
||
return this._done;
|
||
}
|
||
continuePlacement(e2, i3, s2) {
|
||
const a2 = t.h.now(), o2 = () => !this._forceFullPlacement && t.h.now() - a2 > 2;
|
||
for (; this._currentPlacementIndex >= 0; ) {
|
||
const t2 = i3[e2[this._currentPlacementIndex]], a3 = this.placement.collisionIndex.transform.zoom;
|
||
if ("symbol" === t2.type && (!t2.minzoom || t2.minzoom <= a3) && (!t2.maxzoom || t2.maxzoom > a3)) {
|
||
if (this._inProgressLayer || (this._inProgressLayer = new $t(t2)), this._inProgressLayer.continuePlacement(s2[t2.source], this.placement, this._showCollisionBoxes, t2, o2)) return;
|
||
delete this._inProgressLayer;
|
||
}
|
||
this._currentPlacementIndex--;
|
||
}
|
||
this._done = true;
|
||
}
|
||
commit(t2) {
|
||
return this.placement.commit(t2), this.placement;
|
||
}
|
||
}
|
||
const Ht = 512 / t.N / 2;
|
||
class Xt {
|
||
constructor(e2, i3, s2) {
|
||
this.tileID = e2, this.bucketInstanceId = s2, this._symbolsByKey = {};
|
||
const a2 = /* @__PURE__ */ new Map();
|
||
for (let t2 = 0; t2 < i3.length; t2++) {
|
||
const e3 = i3.get(t2), s3 = e3.key, o2 = a2.get(s3);
|
||
o2 ? o2.push(e3) : a2.set(s3, [e3]);
|
||
}
|
||
for (const [e3, i4] of a2) {
|
||
const s3 = { positions: i4.map(((t2) => ({ x: Math.floor(t2.anchorX * Ht), y: Math.floor(t2.anchorY * Ht) }))), crossTileIDs: i4.map(((t2) => t2.crossTileID)) };
|
||
if (s3.positions.length > 128) {
|
||
const e4 = new t.av(s3.positions.length, 16, Uint16Array);
|
||
for (const { x: t2, y: i5 } of s3.positions) e4.add(t2, i5);
|
||
e4.finish(), delete s3.positions, s3.index = e4;
|
||
}
|
||
this._symbolsByKey[e3] = s3;
|
||
}
|
||
}
|
||
getScaledCoordinates(e2, i3) {
|
||
const { x: s2, y: a2, z: o2 } = this.tileID.canonical, { x: r2, y: n2, z: l2 } = i3.canonical, h2 = Ht / Math.pow(2, l2 - o2), c2 = (n2 * t.N + e2.anchorY) * h2, u2 = a2 * t.N * Ht;
|
||
return { x: Math.floor((r2 * t.N + e2.anchorX) * h2 - s2 * t.N * Ht), y: Math.floor(c2 - u2) };
|
||
}
|
||
findMatches(t2, e2, i3) {
|
||
const s2 = this.tileID.canonical.z < e2.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - e2.canonical.z);
|
||
for (let a2 = 0; a2 < t2.length; a2++) {
|
||
const o2 = t2.get(a2);
|
||
if (o2.crossTileID) continue;
|
||
const r2 = this._symbolsByKey[o2.key];
|
||
if (!r2) continue;
|
||
const n2 = this.getScaledCoordinates(o2, e2);
|
||
if (r2.index) {
|
||
const t3 = r2.index.range(n2.x - s2, n2.y - s2, n2.x + s2, n2.y + s2).sort();
|
||
for (const e3 of t3) {
|
||
const t4 = r2.crossTileIDs[e3];
|
||
if (!i3[t4]) {
|
||
i3[t4] = true, o2.crossTileID = t4;
|
||
break;
|
||
}
|
||
}
|
||
} else if (r2.positions) for (let t3 = 0; t3 < r2.positions.length; t3++) {
|
||
const e3 = r2.positions[t3], a3 = r2.crossTileIDs[t3];
|
||
if (Math.abs(e3.x - n2.x) <= s2 && Math.abs(e3.y - n2.y) <= s2 && !i3[a3]) {
|
||
i3[a3] = true, o2.crossTileID = a3;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
getCrossTileIDsLists() {
|
||
return Object.values(this._symbolsByKey).map((({ crossTileIDs: t2 }) => t2));
|
||
}
|
||
}
|
||
class Kt {
|
||
constructor() {
|
||
this.maxCrossTileID = 0;
|
||
}
|
||
generate() {
|
||
return ++this.maxCrossTileID;
|
||
}
|
||
}
|
||
class Qt {
|
||
constructor() {
|
||
this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;
|
||
}
|
||
handleWrapJump(t2) {
|
||
const e2 = Math.round((t2 - this.lng) / 360);
|
||
if (0 !== e2) for (const t3 in this.indexes) {
|
||
const i3 = this.indexes[t3], s2 = {};
|
||
for (const t4 in i3) {
|
||
const a2 = i3[t4];
|
||
a2.tileID = a2.tileID.unwrapTo(a2.tileID.wrap + e2), s2[a2.tileID.key] = a2;
|
||
}
|
||
this.indexes[t3] = s2;
|
||
}
|
||
this.lng = t2;
|
||
}
|
||
addBucket(t2, e2, i3) {
|
||
if (this.indexes[t2.overscaledZ] && this.indexes[t2.overscaledZ][t2.key]) {
|
||
if (this.indexes[t2.overscaledZ][t2.key].bucketInstanceId === e2.bucketInstanceId) return false;
|
||
this.removeBucketCrossTileIDs(t2.overscaledZ, this.indexes[t2.overscaledZ][t2.key]);
|
||
}
|
||
for (let t3 = 0; t3 < e2.symbolInstances.length; t3++) e2.symbolInstances.get(t3).crossTileID = 0;
|
||
this.usedCrossTileIDs[t2.overscaledZ] || (this.usedCrossTileIDs[t2.overscaledZ] = {});
|
||
const s2 = this.usedCrossTileIDs[t2.overscaledZ];
|
||
for (const i4 in this.indexes) {
|
||
const a2 = this.indexes[i4];
|
||
if (Number(i4) > t2.overscaledZ) for (const i5 in a2) {
|
||
const o2 = a2[i5];
|
||
o2.tileID.isChildOf(t2) && o2.findMatches(e2.symbolInstances, t2, s2);
|
||
}
|
||
else {
|
||
const o2 = a2[t2.scaledTo(Number(i4)).key];
|
||
o2 && o2.findMatches(e2.symbolInstances, t2, s2);
|
||
}
|
||
}
|
||
for (let t3 = 0; t3 < e2.symbolInstances.length; t3++) {
|
||
const a2 = e2.symbolInstances.get(t3);
|
||
a2.crossTileID || (a2.crossTileID = i3.generate(), s2[a2.crossTileID] = true);
|
||
}
|
||
return void 0 === this.indexes[t2.overscaledZ] && (this.indexes[t2.overscaledZ] = {}), this.indexes[t2.overscaledZ][t2.key] = new Xt(t2, e2.symbolInstances, e2.bucketInstanceId), true;
|
||
}
|
||
removeBucketCrossTileIDs(t2, e2) {
|
||
for (const i3 of e2.getCrossTileIDsLists()) for (const e3 of i3) delete this.usedCrossTileIDs[t2][e3];
|
||
}
|
||
removeStaleBuckets(t2) {
|
||
let e2 = false;
|
||
for (const i3 in this.indexes) {
|
||
const s2 = this.indexes[i3];
|
||
for (const a2 in s2) t2[s2[a2].bucketInstanceId] || (this.removeBucketCrossTileIDs(i3, s2[a2]), delete s2[a2], e2 = true);
|
||
}
|
||
return e2;
|
||
}
|
||
}
|
||
class Yt {
|
||
constructor() {
|
||
this.layerIndexes = {}, this.crossTileIDs = new Kt(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
|
||
}
|
||
addLayer(t2, e2, i3) {
|
||
let s2 = this.layerIndexes[t2.id];
|
||
void 0 === s2 && (s2 = this.layerIndexes[t2.id] = new Qt());
|
||
let a2 = false;
|
||
const o2 = {};
|
||
s2.handleWrapJump(i3);
|
||
for (const i4 of e2) {
|
||
const e3 = i4.getBucket(t2);
|
||
e3 && t2.id === e3.layerIds[0] && (e3.bucketInstanceId || (e3.bucketInstanceId = ++this.maxBucketInstanceId), s2.addBucket(i4.tileID, e3, this.crossTileIDs) && (a2 = true), o2[e3.bucketInstanceId] = true);
|
||
}
|
||
return s2.removeStaleBuckets(o2) && (a2 = true), a2;
|
||
}
|
||
pruneUnusedLayers(t2) {
|
||
const e2 = {};
|
||
t2.forEach(((t3) => {
|
||
e2[t3] = true;
|
||
}));
|
||
for (const t3 in this.layerIndexes) e2[t3] || delete this.layerIndexes[t3];
|
||
}
|
||
}
|
||
const Jt = (e2, i3) => t.x(e2, i3 && i3.filter(((t2) => "source.canvas" !== t2.identifier))), te = t.F(t.ax, ["addLayer", "removeLayer", "setPaintProperty", "setLayoutProperty", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData", "setGlyphs", "setSprite"]), ee = t.F(t.ax, ["setCenter", "setZoom", "setBearing", "setPitch"]), ie = t.aw();
|
||
class se extends t.E {
|
||
constructor(e2, i3 = {}) {
|
||
super(), this.map = e2, this.dispatcher = new M(st(), this, e2._getMapId()), this.imageManager = new b(), this.imageManager.setEventedParent(this), this.glyphManager = new E(e2._requestManager, i3.localIdeographFontFamily), this.lineAtlas = new D(256, 512), this.crossTileSymbolIndex = new Yt(), this._spritesImagesIds = {}, this._layers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new t.ay(), this._loaded = false, this._availableImages = [], this._resetUpdates(), this.dispatcher.broadcast("setReferrer", t.az());
|
||
const s2 = this;
|
||
this._rtlTextPluginCallback = se.registerForPluginStateChange(((e3) => {
|
||
s2.dispatcher.broadcast("syncRTLPluginState", { pluginStatus: e3.pluginStatus, pluginURL: e3.pluginURL }, ((e4, i4) => {
|
||
if (t.aA(e4), i4 && i4.every(((t2) => t2))) for (const t2 in s2.sourceCaches) {
|
||
const e5 = s2.sourceCaches[t2].getSource().type;
|
||
"vector" !== e5 && "geojson" !== e5 || s2.sourceCaches[t2].reload();
|
||
}
|
||
}));
|
||
})), this.on("data", ((t2) => {
|
||
if ("source" !== t2.dataType || "metadata" !== t2.sourceDataType) return;
|
||
const e3 = this.sourceCaches[t2.sourceId];
|
||
if (!e3) return;
|
||
const i4 = e3.getSource();
|
||
if (i4 && i4.vectorLayerIds) for (const t3 in this._layers) {
|
||
const e4 = this._layers[t3];
|
||
e4.source === i4.id && this._validateLayer(e4);
|
||
}
|
||
}));
|
||
}
|
||
loadURL(e2, i3 = {}, s2) {
|
||
this.fire(new t.k("dataloading", { dataType: "style" })), i3.validate = "boolean" != typeof i3.validate || i3.validate;
|
||
const a2 = this.map._requestManager.transformRequest(e2, c.Style);
|
||
this._request = t.f(a2, ((e3, a3) => {
|
||
this._request = null, e3 ? this.fire(new t.j(e3)) : a3 && this._load(a3, i3, s2);
|
||
}));
|
||
}
|
||
loadJSON(e2, i3 = {}, s2) {
|
||
this.fire(new t.k("dataloading", { dataType: "style" })), this._request = t.h.frame((() => {
|
||
this._request = null, i3.validate = false !== i3.validate, this._load(e2, i3, s2);
|
||
}));
|
||
}
|
||
loadEmpty() {
|
||
this.fire(new t.k("dataloading", { dataType: "style" })), this._load(ie, { validate: false });
|
||
}
|
||
_load(e2, i3, s2) {
|
||
var a2;
|
||
const o2 = i3.transformStyle ? i3.transformStyle(s2, e2) : e2;
|
||
if (!i3.validate || !Jt(this, t.y(o2))) {
|
||
this._loaded = true, this.stylesheet = o2;
|
||
for (const t2 in o2.sources) this.addSource(t2, o2.sources[t2], { validate: false });
|
||
o2.sprite ? this._loadSprite(o2.sprite) : this.imageManager.setLoaded(true), this.glyphManager.setURL(o2.glyphs), this._createLayers(), this.light = new P(this.stylesheet.light), this.map.setTerrain(null !== (a2 = this.stylesheet.terrain) && void 0 !== a2 ? a2 : null), this.fire(new t.k("data", { dataType: "style" })), this.fire(new t.k("style.load"));
|
||
}
|
||
}
|
||
_createLayers() {
|
||
const e2 = t.aB(this.stylesheet.layers);
|
||
this.dispatcher.broadcast("setLayers", e2), this._order = e2.map(((t2) => t2.id)), this._layers = {}, this._serializedLayers = null;
|
||
for (const i3 of e2) {
|
||
const e3 = t.aC(i3);
|
||
e3.setEventedParent(this, { layer: { id: i3.id } }), this._layers[i3.id] = e3;
|
||
}
|
||
}
|
||
_loadSprite(e2, i3 = false, s2 = void 0) {
|
||
this.imageManager.setLoaded(false), this._spriteRequest = (function(e3, i4, s3, a2) {
|
||
const o2 = g(e3), r2 = o2.length, n2 = s3 > 1 ? "@2x" : "", l2 = {}, u2 = {}, d2 = {};
|
||
for (const { id: e4, url: s4 } of o2) {
|
||
const o3 = i4.transformRequest(i4.normalizeSpriteURL(s4, n2, ".json"), c.SpriteJSON), _2 = `${e4}_${o3.url}`;
|
||
l2[_2] = t.f(o3, ((t2, i5) => {
|
||
delete l2[_2], u2[e4] = i5, v(a2, u2, d2, t2, r2);
|
||
}));
|
||
const p2 = i4.transformRequest(i4.normalizeSpriteURL(s4, n2, ".png"), c.SpriteImage), m2 = `${e4}_${p2.url}`;
|
||
l2[m2] = h.getImage(p2, ((t2, i5) => {
|
||
delete l2[m2], d2[e4] = i5, v(a2, u2, d2, t2, r2);
|
||
}));
|
||
}
|
||
return { cancel() {
|
||
for (const t2 of Object.values(l2)) t2.cancel();
|
||
} };
|
||
})(e2, this.map._requestManager, this.map.getPixelRatio(), ((e3, a2) => {
|
||
if (this._spriteRequest = null, e3) this.fire(new t.j(e3));
|
||
else if (a2) for (const t2 in a2) {
|
||
this._spritesImagesIds[t2] = [];
|
||
const e4 = this._spritesImagesIds[t2] ? this._spritesImagesIds[t2].filter(((t3) => !(t3 in a2))) : [];
|
||
for (const t3 of e4) this.imageManager.removeImage(t3), this._changedImages[t3] = true;
|
||
for (const e5 in a2[t2]) {
|
||
const s3 = "default" === t2 ? e5 : `${t2}:${e5}`;
|
||
this._spritesImagesIds[t2].push(s3), s3 in this.imageManager.images ? this.imageManager.updateImage(s3, a2[t2][e5], false) : this.imageManager.addImage(s3, a2[t2][e5]), i3 && (this._changedImages[s3] = true);
|
||
}
|
||
}
|
||
this.imageManager.setLoaded(true), this._availableImages = this.imageManager.listImages(), i3 && (this._changed = true), this.dispatcher.broadcast("setImages", this._availableImages), this.fire(new t.k("data", { dataType: "style" })), s2 && s2(e3);
|
||
}));
|
||
}
|
||
_unloadSprite() {
|
||
for (const t2 of Object.values(this._spritesImagesIds).flat()) this.imageManager.removeImage(t2), this._changedImages[t2] = true;
|
||
this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast("setImages", this._availableImages), this.fire(new t.k("data", { dataType: "style" }));
|
||
}
|
||
_validateLayer(e2) {
|
||
const i3 = this.sourceCaches[e2.source];
|
||
if (!i3) return;
|
||
const s2 = e2.sourceLayer;
|
||
if (!s2) return;
|
||
const a2 = i3.getSource();
|
||
("geojson" === a2.type || a2.vectorLayerIds && -1 === a2.vectorLayerIds.indexOf(s2)) && this.fire(new t.j(new Error(`Source layer "${s2}" does not exist on source "${a2.id}" as specified by style layer "${e2.id}".`)));
|
||
}
|
||
loaded() {
|
||
if (!this._loaded) return false;
|
||
if (Object.keys(this._updatedSources).length) return false;
|
||
for (const t2 in this.sourceCaches) if (!this.sourceCaches[t2].loaded()) return false;
|
||
return !!this.imageManager.isLoaded();
|
||
}
|
||
_serializeByIds(t2) {
|
||
const e2 = this._serializedAllLayers();
|
||
if (!t2 || 0 === t2.length) return Object.values(e2);
|
||
const i3 = [];
|
||
for (const s2 of t2) e2[s2] && i3.push(e2[s2]);
|
||
return i3;
|
||
}
|
||
_serializedAllLayers() {
|
||
let t2 = this._serializedLayers;
|
||
if (t2) return t2;
|
||
t2 = this._serializedLayers = {};
|
||
const e2 = Object.keys(this._layers);
|
||
for (const i3 of e2) {
|
||
const e3 = this._layers[i3];
|
||
"custom" !== e3.type && (t2[i3] = e3.serialize());
|
||
}
|
||
return t2;
|
||
}
|
||
hasTransitions() {
|
||
if (this.light && this.light.hasTransition()) return true;
|
||
for (const t2 in this.sourceCaches) if (this.sourceCaches[t2].hasTransition()) return true;
|
||
for (const t2 in this._layers) if (this._layers[t2].hasTransition()) return true;
|
||
return false;
|
||
}
|
||
_checkLoaded() {
|
||
if (!this._loaded) throw new Error("Style is not done loading.");
|
||
}
|
||
update(e2) {
|
||
if (!this._loaded) return;
|
||
const i3 = this._changed;
|
||
if (this._changed) {
|
||
const t2 = Object.keys(this._updatedLayers), i4 = Object.keys(this._removedLayers);
|
||
(t2.length || i4.length) && this._updateWorkerLayers(t2, i4);
|
||
for (const t3 in this._updatedSources) {
|
||
const e3 = this._updatedSources[t3];
|
||
if ("reload" === e3) this._reloadSource(t3);
|
||
else {
|
||
if ("clear" !== e3) throw new Error(`Invalid action ${e3}`);
|
||
this._clearSource(t3);
|
||
}
|
||
}
|
||
this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();
|
||
for (const t3 in this._updatedPaintProps) this._layers[t3].updateTransitions(e2);
|
||
this.light.updateTransitions(e2), this._resetUpdates();
|
||
}
|
||
const s2 = {};
|
||
for (const t2 in this.sourceCaches) {
|
||
const e3 = this.sourceCaches[t2];
|
||
s2[t2] = e3.used, e3.used = false;
|
||
}
|
||
for (const t2 of this._order) {
|
||
const i4 = this._layers[t2];
|
||
i4.recalculate(e2, this._availableImages), !i4.isHidden(e2.zoom) && i4.source && (this.sourceCaches[i4.source].used = true);
|
||
}
|
||
for (const e3 in s2) {
|
||
const i4 = this.sourceCaches[e3];
|
||
s2[e3] !== i4.used && i4.fire(new t.k("data", { sourceDataType: "visibility", dataType: "source", sourceId: e3 }));
|
||
}
|
||
this.light.recalculate(e2), this.z = e2.zoom, i3 && this.fire(new t.k("data", { dataType: "style" }));
|
||
}
|
||
_updateTilesForChangedImages() {
|
||
const t2 = Object.keys(this._changedImages);
|
||
if (t2.length) {
|
||
for (const e2 in this.sourceCaches) this.sourceCaches[e2].reloadTilesForDependencies(["icons", "patterns"], t2);
|
||
this._changedImages = {};
|
||
}
|
||
}
|
||
_updateTilesForChangedGlyphs() {
|
||
if (this._glyphsDidChange) {
|
||
for (const t2 in this.sourceCaches) this.sourceCaches[t2].reloadTilesForDependencies(["glyphs"], [""]);
|
||
this._glyphsDidChange = false;
|
||
}
|
||
}
|
||
_updateWorkerLayers(t2, e2) {
|
||
this.dispatcher.broadcast("updateLayers", { layers: this._serializeByIds(t2), removedIds: e2 });
|
||
}
|
||
_resetUpdates() {
|
||
this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = false;
|
||
}
|
||
setState(e2, i3 = {}) {
|
||
this._checkLoaded();
|
||
const s2 = this.serialize();
|
||
if (e2 = i3.transformStyle ? i3.transformStyle(s2, e2) : e2, Jt(this, t.y(e2))) return false;
|
||
(e2 = t.aD(e2)).layers = t.aB(e2.layers);
|
||
const a2 = t.aE(s2, e2).filter(((t2) => !(t2.command in ee)));
|
||
if (0 === a2.length) return false;
|
||
const o2 = a2.filter(((t2) => !(t2.command in te)));
|
||
if (o2.length > 0) throw new Error(`Unimplemented: ${o2.map(((t2) => t2.command)).join(", ")}.`);
|
||
for (const t2 of a2) "setTransition" !== t2.command && this[t2.command].apply(this, t2.args);
|
||
return this.stylesheet = e2, this._serializedLayers = null, true;
|
||
}
|
||
addImage(e2, i3) {
|
||
if (this.getImage(e2)) return this.fire(new t.j(new Error(`An image named "${e2}" already exists.`)));
|
||
this.imageManager.addImage(e2, i3), this._afterImageUpdated(e2);
|
||
}
|
||
updateImage(t2, e2) {
|
||
this.imageManager.updateImage(t2, e2);
|
||
}
|
||
getImage(t2) {
|
||
return this.imageManager.getImage(t2);
|
||
}
|
||
removeImage(e2) {
|
||
if (!this.getImage(e2)) return this.fire(new t.j(new Error(`An image named "${e2}" does not exist.`)));
|
||
this.imageManager.removeImage(e2), this._afterImageUpdated(e2);
|
||
}
|
||
_afterImageUpdated(e2) {
|
||
this._availableImages = this.imageManager.listImages(), this._changedImages[e2] = true, this._changed = true, this.dispatcher.broadcast("setImages", this._availableImages), this.fire(new t.k("data", { dataType: "style" }));
|
||
}
|
||
listImages() {
|
||
return this._checkLoaded(), this.imageManager.listImages();
|
||
}
|
||
addSource(e2, i3, s2 = {}) {
|
||
if (this._checkLoaded(), void 0 !== this.sourceCaches[e2]) throw new Error(`Source "${e2}" already exists.`);
|
||
if (!i3.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i3).join(", ")}.`);
|
||
if (["vector", "raster", "geojson", "video", "image"].indexOf(i3.type) >= 0 && this._validate(t.y.source, `sources.${e2}`, i3, null, s2)) return;
|
||
this.map && this.map._collectResourceTiming && (i3.collectResourceTiming = true);
|
||
const a2 = this.sourceCaches[e2] = new K(e2, i3, this.dispatcher);
|
||
a2.style = this, a2.setEventedParent(this, (() => ({ isSourceLoaded: a2.loaded(), source: a2.serialize(), sourceId: e2 }))), a2.onAdd(this.map), this._changed = true;
|
||
}
|
||
removeSource(e2) {
|
||
if (this._checkLoaded(), void 0 === this.sourceCaches[e2]) throw new Error("There is no source with this ID");
|
||
for (const i4 in this._layers) if (this._layers[i4].source === e2) return this.fire(new t.j(new Error(`Source "${e2}" cannot be removed while layer "${i4}" is using it.`)));
|
||
const i3 = this.sourceCaches[e2];
|
||
delete this.sourceCaches[e2], delete this._updatedSources[e2], i3.fire(new t.k("data", { sourceDataType: "metadata", dataType: "source", sourceId: e2 })), i3.setEventedParent(null), i3.onRemove(this.map), this._changed = true;
|
||
}
|
||
setGeoJSONSourceData(t2, e2) {
|
||
if (this._checkLoaded(), void 0 === this.sourceCaches[t2]) throw new Error(`There is no source with this ID=${t2}`);
|
||
const i3 = this.sourceCaches[t2].getSource();
|
||
if ("geojson" !== i3.type) throw new Error(`geojsonSource.type is ${i3.type}, which is !== 'geojson`);
|
||
i3.setData(e2), this._changed = true;
|
||
}
|
||
getSource(t2) {
|
||
return this.sourceCaches[t2] && this.sourceCaches[t2].getSource();
|
||
}
|
||
addLayer(e2, i3, s2 = {}) {
|
||
this._checkLoaded();
|
||
const a2 = e2.id;
|
||
if (this.getLayer(a2)) return void this.fire(new t.j(new Error(`Layer "${a2}" already exists on this map.`)));
|
||
let o2;
|
||
if ("custom" === e2.type) {
|
||
if (Jt(this, t.aF(e2))) return;
|
||
o2 = t.aC(e2);
|
||
} else {
|
||
if ("source" in e2 && "object" == typeof e2.source && (this.addSource(a2, e2.source), e2 = t.aD(e2), e2 = t.e(e2, { source: a2 })), this._validate(t.y.layer, `layers.${a2}`, e2, { arrayIndex: -1 }, s2)) return;
|
||
o2 = t.aC(e2), this._validateLayer(o2), o2.setEventedParent(this, { layer: { id: a2 } });
|
||
}
|
||
const r2 = i3 ? this._order.indexOf(i3) : this._order.length;
|
||
if (i3 && -1 === r2) this.fire(new t.j(new Error(`Cannot add layer "${a2}" before non-existing layer "${i3}".`)));
|
||
else {
|
||
if (this._order.splice(r2, 0, a2), this._layerOrderChanged = true, this._layers[a2] = o2, this._removedLayers[a2] && o2.source && "custom" !== o2.type) {
|
||
const t2 = this._removedLayers[a2];
|
||
delete this._removedLayers[a2], t2.type !== o2.type ? this._updatedSources[o2.source] = "clear" : (this._updatedSources[o2.source] = "reload", this.sourceCaches[o2.source].pause());
|
||
}
|
||
this._updateLayer(o2), o2.onAdd && o2.onAdd(this.map);
|
||
}
|
||
}
|
||
moveLayer(e2, i3) {
|
||
if (this._checkLoaded(), this._changed = true, !this._layers[e2]) return void this.fire(new t.j(new Error(`The layer '${e2}' does not exist in the map's style and cannot be moved.`)));
|
||
if (e2 === i3) return;
|
||
const s2 = this._order.indexOf(e2);
|
||
this._order.splice(s2, 1);
|
||
const a2 = i3 ? this._order.indexOf(i3) : this._order.length;
|
||
i3 && -1 === a2 ? this.fire(new t.j(new Error(`Cannot move layer "${e2}" before non-existing layer "${i3}".`))) : (this._order.splice(a2, 0, e2), this._layerOrderChanged = true);
|
||
}
|
||
removeLayer(e2) {
|
||
this._checkLoaded();
|
||
const i3 = this._layers[e2];
|
||
if (!i3) return void this.fire(new t.j(new Error(`Cannot remove non-existing layer "${e2}".`)));
|
||
i3.setEventedParent(null);
|
||
const s2 = this._order.indexOf(e2);
|
||
this._order.splice(s2, 1), this._layerOrderChanged = true, this._changed = true, this._removedLayers[e2] = i3, delete this._layers[e2], this._serializedLayers && delete this._serializedLayers[e2], delete this._updatedLayers[e2], delete this._updatedPaintProps[e2], i3.onRemove && i3.onRemove(this.map);
|
||
}
|
||
getLayer(t2) {
|
||
return this._layers[t2];
|
||
}
|
||
getLayersOrder() {
|
||
return [...this._order];
|
||
}
|
||
hasLayer(t2) {
|
||
return t2 in this._layers;
|
||
}
|
||
setLayerZoomRange(e2, i3, s2) {
|
||
this._checkLoaded();
|
||
const a2 = this.getLayer(e2);
|
||
a2 ? a2.minzoom === i3 && a2.maxzoom === s2 || (null != i3 && (a2.minzoom = i3), null != s2 && (a2.maxzoom = s2), this._updateLayer(a2)) : this.fire(new t.j(new Error(`Cannot set the zoom range of non-existing layer "${e2}".`)));
|
||
}
|
||
setFilter(e2, i3, s2 = {}) {
|
||
this._checkLoaded();
|
||
const a2 = this.getLayer(e2);
|
||
if (a2) {
|
||
if (!t.aG(a2.filter, i3)) return null == i3 ? (a2.filter = void 0, void this._updateLayer(a2)) : void (this._validate(t.y.filter, `layers.${a2.id}.filter`, i3, null, s2) || (a2.filter = t.aD(i3), this._updateLayer(a2)));
|
||
} else this.fire(new t.j(new Error(`Cannot filter non-existing layer "${e2}".`)));
|
||
}
|
||
getFilter(e2) {
|
||
return t.aD(this.getLayer(e2).filter);
|
||
}
|
||
setLayoutProperty(e2, i3, s2, a2 = {}) {
|
||
this._checkLoaded();
|
||
const o2 = this.getLayer(e2);
|
||
o2 ? t.aG(o2.getLayoutProperty(i3), s2) || (o2.setLayoutProperty(i3, s2, a2), this._updateLayer(o2)) : this.fire(new t.j(new Error(`Cannot style non-existing layer "${e2}".`)));
|
||
}
|
||
getLayoutProperty(e2, i3) {
|
||
const s2 = this.getLayer(e2);
|
||
if (s2) return s2.getLayoutProperty(i3);
|
||
this.fire(new t.j(new Error(`Cannot get style of non-existing layer "${e2}".`)));
|
||
}
|
||
setPaintProperty(e2, i3, s2, a2 = {}) {
|
||
this._checkLoaded();
|
||
const o2 = this.getLayer(e2);
|
||
o2 ? t.aG(o2.getPaintProperty(i3), s2) || (o2.setPaintProperty(i3, s2, a2) && this._updateLayer(o2), this._changed = true, this._updatedPaintProps[e2] = true) : this.fire(new t.j(new Error(`Cannot style non-existing layer "${e2}".`)));
|
||
}
|
||
getPaintProperty(t2, e2) {
|
||
return this.getLayer(t2).getPaintProperty(e2);
|
||
}
|
||
setFeatureState(e2, i3) {
|
||
this._checkLoaded();
|
||
const s2 = e2.source, a2 = e2.sourceLayer, o2 = this.sourceCaches[s2];
|
||
if (void 0 === o2) return void this.fire(new t.j(new Error(`The source '${s2}' does not exist in the map's style.`)));
|
||
const r2 = o2.getSource().type;
|
||
"geojson" === r2 && a2 ? this.fire(new t.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : "vector" !== r2 || a2 ? (void 0 === e2.id && this.fire(new t.j(new Error("The feature id parameter must be provided."))), o2.setFeatureState(a2, e2.id, i3)) : this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
|
||
}
|
||
removeFeatureState(e2, i3) {
|
||
this._checkLoaded();
|
||
const s2 = e2.source, a2 = this.sourceCaches[s2];
|
||
if (void 0 === a2) return void this.fire(new t.j(new Error(`The source '${s2}' does not exist in the map's style.`)));
|
||
const o2 = a2.getSource().type, r2 = "vector" === o2 ? e2.sourceLayer : void 0;
|
||
"vector" !== o2 || r2 ? i3 && "string" != typeof e2.id && "number" != typeof e2.id ? this.fire(new t.j(new Error("A feature id is required to remove its specific state property."))) : a2.removeFeatureState(r2, e2.id, i3) : this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
|
||
}
|
||
getFeatureState(e2) {
|
||
this._checkLoaded();
|
||
const i3 = e2.source, s2 = e2.sourceLayer, a2 = this.sourceCaches[i3];
|
||
if (void 0 !== a2) return "vector" !== a2.getSource().type || s2 ? (void 0 === e2.id && this.fire(new t.j(new Error("The feature id parameter must be provided."))), a2.getFeatureState(s2, e2.id)) : void this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
|
||
this.fire(new t.j(new Error(`The source '${i3}' does not exist in the map's style.`)));
|
||
}
|
||
getTransition() {
|
||
return t.e({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);
|
||
}
|
||
serialize() {
|
||
if (!this._loaded) return;
|
||
const e2 = t.aH(this.sourceCaches, ((t2) => t2.serialize())), i3 = this._serializeByIds(this._order), s2 = this.map.getTerrain() || void 0, a2 = this.stylesheet;
|
||
return t.aI({ version: a2.version, name: a2.name, metadata: a2.metadata, light: a2.light, center: a2.center, zoom: a2.zoom, bearing: a2.bearing, pitch: a2.pitch, sprite: a2.sprite, glyphs: a2.glyphs, transition: a2.transition, sources: e2, layers: i3, terrain: s2 }, ((t2) => void 0 !== t2));
|
||
}
|
||
_updateLayer(t2) {
|
||
this._updatedLayers[t2.id] = true, t2.source && !this._updatedSources[t2.source] && "raster" !== this.sourceCaches[t2.source].getSource().type && (this._updatedSources[t2.source] = "reload", this.sourceCaches[t2.source].pause()), this._serializedLayers = null, this._changed = true;
|
||
}
|
||
_flattenAndSortRenderedFeatures(t2) {
|
||
const e2 = (t3) => "fill-extrusion" === this._layers[t3].type, i3 = {}, s2 = [];
|
||
for (let a3 = this._order.length - 1; a3 >= 0; a3--) {
|
||
const o2 = this._order[a3];
|
||
if (e2(o2)) {
|
||
i3[o2] = a3;
|
||
for (const e3 of t2) {
|
||
const t3 = e3[o2];
|
||
if (t3) for (const e4 of t3) s2.push(e4);
|
||
}
|
||
}
|
||
}
|
||
s2.sort(((t3, e3) => e3.intersectionZ - t3.intersectionZ));
|
||
const a2 = [];
|
||
for (let o2 = this._order.length - 1; o2 >= 0; o2--) {
|
||
const r2 = this._order[o2];
|
||
if (e2(r2)) for (let t3 = s2.length - 1; t3 >= 0; t3--) {
|
||
const e3 = s2[t3].feature;
|
||
if (i3[e3.layer.id] < o2) break;
|
||
a2.push(e3), s2.pop();
|
||
}
|
||
else for (const e3 of t2) {
|
||
const t3 = e3[r2];
|
||
if (t3) for (const e4 of t3) a2.push(e4.feature);
|
||
}
|
||
}
|
||
return a2;
|
||
}
|
||
queryRenderedFeatures(e2, i3, s2) {
|
||
i3 && i3.filter && this._validate(t.y.filter, "queryRenderedFeatures.filter", i3.filter, null, i3);
|
||
const a2 = {};
|
||
if (i3 && i3.layers) {
|
||
if (!Array.isArray(i3.layers)) return this.fire(new t.j(new Error("parameters.layers must be an Array."))), [];
|
||
for (const e3 of i3.layers) {
|
||
const i4 = this._layers[e3];
|
||
if (!i4) return this.fire(new t.j(new Error(`The layer '${e3}' does not exist in the map's style and cannot be queried for features.`))), [];
|
||
a2[i4.source] = true;
|
||
}
|
||
}
|
||
const o2 = [];
|
||
i3.availableImages = this._availableImages;
|
||
const r2 = this._serializedAllLayers();
|
||
for (const t2 in this.sourceCaches) i3.layers && !a2[t2] || o2.push(q(this.sourceCaches[t2], this._layers, r2, e2, i3, s2));
|
||
return this.placement && o2.push((function(t2, e3, i4, s3, a3, o3, r3) {
|
||
const n2 = {}, l2 = o3.queryRenderedSymbols(s3), h2 = [];
|
||
for (const t3 of Object.keys(l2).map(Number)) h2.push(r3[t3]);
|
||
h2.sort($);
|
||
for (const i5 of h2) {
|
||
const s4 = i5.featureIndex.lookupSymbolFeatures(l2[i5.bucketInstanceId], e3, i5.bucketIndex, i5.sourceLayerIndex, a3.filter, a3.layers, a3.availableImages, t2);
|
||
for (const t3 in s4) {
|
||
const e4 = n2[t3] = n2[t3] || [], a4 = s4[t3];
|
||
a4.sort(((t4, e5) => {
|
||
const s5 = i5.featureSortOrder;
|
||
if (s5) {
|
||
const i6 = s5.indexOf(t4.featureIndex);
|
||
return s5.indexOf(e5.featureIndex) - i6;
|
||
}
|
||
return e5.featureIndex - t4.featureIndex;
|
||
}));
|
||
for (const t4 of a4) e4.push(t4);
|
||
}
|
||
}
|
||
for (const e4 in n2) n2[e4].forEach(((s4) => {
|
||
const a4 = s4.feature, o4 = i4[t2[e4].source].getFeatureState(a4.layer["source-layer"], a4.id);
|
||
a4.source = a4.layer.source, a4.layer["source-layer"] && (a4.sourceLayer = a4.layer["source-layer"]), a4.state = o4;
|
||
}));
|
||
return n2;
|
||
})(this._layers, r2, this.sourceCaches, e2, i3, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(o2);
|
||
}
|
||
querySourceFeatures(e2, i3) {
|
||
i3 && i3.filter && this._validate(t.y.filter, "querySourceFeatures.filter", i3.filter, null, i3);
|
||
const s2 = this.sourceCaches[e2];
|
||
return s2 ? (function(t2, e3) {
|
||
const i4 = t2.getRenderableIds().map(((e4) => t2.getTileByID(e4))), s3 = [], a2 = {};
|
||
for (let t3 = 0; t3 < i4.length; t3++) {
|
||
const o2 = i4[t3], r2 = o2.tileID.canonical.key;
|
||
a2[r2] || (a2[r2] = true, o2.querySourceFeatures(s3, e3));
|
||
}
|
||
return s3;
|
||
})(s2, i3) : [];
|
||
}
|
||
addSourceType(t2, e2, i3) {
|
||
return j(t2) ? i3(new Error(`A source type called "${t2}" already exists.`)) : (((t3, e3) => {
|
||
G[t3] = e3;
|
||
})(t2, e2), e2.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", { name: t2, url: e2.workerSourceURL }, i3) : i3(null, null));
|
||
}
|
||
getLight() {
|
||
return this.light.getLight();
|
||
}
|
||
setLight(e2, i3 = {}) {
|
||
this._checkLoaded();
|
||
const s2 = this.light.getLight();
|
||
let a2 = false;
|
||
for (const i4 in e2) if (!t.aG(e2[i4], s2[i4])) {
|
||
a2 = true;
|
||
break;
|
||
}
|
||
if (!a2) return;
|
||
const o2 = { now: t.h.now(), transition: t.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
|
||
this.light.setLight(e2, i3), this.light.updateTransitions(o2);
|
||
}
|
||
_validate(e2, i3, s2, a2, o2 = {}) {
|
||
return (!o2 || false !== o2.validate) && Jt(this, e2.call(t.y, t.e({ key: i3, style: this.serialize(), value: s2, styleSpec: t.v }, a2)));
|
||
}
|
||
_remove(e2 = true) {
|
||
this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.cancel(), this._spriteRequest = null), t.aJ.off("pluginStateChange", this._rtlTextPluginCallback);
|
||
for (const t2 in this._layers) this._layers[t2].setEventedParent(null);
|
||
for (const t2 in this.sourceCaches) {
|
||
const e3 = this.sourceCaches[t2];
|
||
e3.setEventedParent(null), e3.onRemove(this.map);
|
||
}
|
||
this.imageManager.setEventedParent(null), this.setEventedParent(null), this.dispatcher.remove(e2);
|
||
}
|
||
_clearSource(t2) {
|
||
this.sourceCaches[t2].clearTiles();
|
||
}
|
||
_reloadSource(t2) {
|
||
this.sourceCaches[t2].resume(), this.sourceCaches[t2].reload();
|
||
}
|
||
_updateSources(t2) {
|
||
for (const e2 in this.sourceCaches) this.sourceCaches[e2].update(t2, this.map.terrain);
|
||
}
|
||
_generateCollisionBoxes() {
|
||
for (const t2 in this.sourceCaches) this._reloadSource(t2);
|
||
}
|
||
_updatePlacement(e2, i3, s2, a2, o2 = false) {
|
||
let r2 = false, n2 = false;
|
||
const l2 = {};
|
||
for (const t2 of this._order) {
|
||
const i4 = this._layers[t2];
|
||
if ("symbol" !== i4.type) continue;
|
||
if (!l2[i4.source]) {
|
||
const t3 = this.sourceCaches[i4.source];
|
||
l2[i4.source] = t3.getRenderableIds(true).map(((e3) => t3.getTileByID(e3))).sort(((t4, e3) => e3.tileID.overscaledZ - t4.tileID.overscaledZ || (t4.tileID.isLessThan(e3.tileID) ? -1 : 1)));
|
||
}
|
||
const s3 = this.crossTileSymbolIndex.addLayer(i4, l2[i4.source], e2.center.lng);
|
||
r2 = r2 || s3;
|
||
}
|
||
if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), ((o2 = o2 || this._layerOrderChanged || 0 === s2) || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(t.h.now(), e2.zoom)) && (this.pauseablePlacement = new Wt(e2, this.map.terrain, this._order, o2, i3, s2, a2, this.placement), this._layerOrderChanged = false), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, l2), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(t.h.now()), n2 = true), r2 && this.pauseablePlacement.placement.setStale()), n2 || r2) for (const t2 of this._order) {
|
||
const e3 = this._layers[t2];
|
||
"symbol" === e3.type && this.placement.updateLayerOpacities(e3, l2[e3.source]);
|
||
}
|
||
return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(t.h.now());
|
||
}
|
||
_releaseSymbolFadeTiles() {
|
||
for (const t2 in this.sourceCaches) this.sourceCaches[t2].releaseSymbolFadeTiles();
|
||
}
|
||
getImages(t2, e2, i3) {
|
||
this.imageManager.getImages(e2.icons, i3), this._updateTilesForChangedImages();
|
||
const s2 = this.sourceCaches[e2.source];
|
||
s2 && s2.setDependencies(e2.tileID.key, e2.type, e2.icons);
|
||
}
|
||
getGlyphs(t2, e2, i3) {
|
||
this.glyphManager.getGlyphs(e2.stacks, i3);
|
||
const s2 = this.sourceCaches[e2.source];
|
||
s2 && s2.setDependencies(e2.tileID.key, e2.type, [""]);
|
||
}
|
||
getResource(e2, i3, s2) {
|
||
return t.m(i3, s2);
|
||
}
|
||
getGlyphsUrl() {
|
||
return this.stylesheet.glyphs || null;
|
||
}
|
||
setGlyphs(e2, i3 = {}) {
|
||
this._checkLoaded(), e2 && this._validate(t.y.glyphs, "glyphs", e2, null, i3) || (this._glyphsDidChange = true, this.stylesheet.glyphs = e2, this.glyphManager.entries = {}, this.glyphManager.setURL(e2));
|
||
}
|
||
addSprite(e2, i3, s2 = {}, a2) {
|
||
this._checkLoaded();
|
||
const o2 = [{ id: e2, url: i3 }], r2 = [...g(this.stylesheet.sprite), ...o2];
|
||
this._validate(t.y.sprite, "sprite", r2, null, s2) || (this.stylesheet.sprite = r2, this._loadSprite(o2, true, a2));
|
||
}
|
||
removeSprite(e2) {
|
||
this._checkLoaded();
|
||
const i3 = g(this.stylesheet.sprite);
|
||
if (i3.find(((t2) => t2.id === e2))) {
|
||
if (this._spritesImagesIds[e2]) for (const t2 of this._spritesImagesIds[e2]) this.imageManager.removeImage(t2), this._changedImages[t2] = true;
|
||
i3.splice(i3.findIndex(((t2) => t2.id === e2)), 1), this.stylesheet.sprite = i3.length > 0 ? i3 : void 0, delete this._spritesImagesIds[e2], this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast("setImages", this._availableImages), this.fire(new t.k("data", { dataType: "style" }));
|
||
} else this.fire(new t.j(new Error(`Sprite "${e2}" doesn't exists on this map.`)));
|
||
}
|
||
getSprite() {
|
||
return g(this.stylesheet.sprite);
|
||
}
|
||
setSprite(e2, i3 = {}, s2) {
|
||
this._checkLoaded(), e2 && this._validate(t.y.sprite, "sprite", e2, null, i3) || (this.stylesheet.sprite = e2, e2 ? this._loadSprite(e2, true, s2) : (this._unloadSprite(), s2 && s2(null)));
|
||
}
|
||
}
|
||
se.registerForPluginStateChange = t.aK;
|
||
var ae = t.Q([{ name: "a_pos", type: "Int16", components: 2 }]), oe = "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";
|
||
const re = { prelude: ne("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n", "#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\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(unpack_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;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"), background: ne("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), backgroundPattern: ne("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"), circle: ne("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"), clippingMask: ne("void main() {gl_FragColor=vec4(1.0);}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), heatmap: ne("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying 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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"), heatmapTexture: ne("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"), collisionBox: ne("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}", "attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"), collisionCircle: ne("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}", "attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"), debug: ne("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}", "attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"), fill: ne("#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_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"), fillOutline: ne("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"), fillOutlinePattern: ne("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"), fillPattern: ne("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"), fillExtrusion: ne("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"), fillExtrusionPattern: ne("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"), hillshadePrepare: ne("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"), hillshade: ne("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"), line: ne("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"), lineGradient: ne("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"), linePattern: ne("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"), lineSDF: ne("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\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);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\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 floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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 floorwidth\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"), raster: ne("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"), symbolIcon: ne("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_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;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"), symbolSDF: ne("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat 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 inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"), symbolTextAndIcon: ne("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.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(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"), terrain: ne("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}", oe), terrainDepth: ne("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}", oe), terrainCoords: ne("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}", oe) };
|
||
function ne(t2, e2) {
|
||
const i3 = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, s2 = e2.match(/attribute ([\w]+) ([\w]+)/g), a2 = t2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), o2 = e2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), r2 = o2 ? o2.concat(a2) : a2, n2 = {};
|
||
return { fragmentSource: t2 = t2.replace(i3, ((t3, e3, i4, s3, a3) => (n2[a3] = true, "define" === e3 ? `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
varying ${i4} ${s3} ${a3};
|
||
#else
|
||
uniform ${i4} ${s3} u_${a3};
|
||
#endif
|
||
` : `
|
||
#ifdef HAS_UNIFORM_u_${a3}
|
||
${i4} ${s3} ${a3} = u_${a3};
|
||
#endif
|
||
`))), vertexSource: e2 = e2.replace(i3, ((t3, e3, i4, s3, a3) => {
|
||
const o3 = "float" === s3 ? "vec2" : "vec4", r3 = a3.match(/color/) ? "color" : o3;
|
||
return n2[a3] ? "define" === e3 ? `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
uniform lowp float u_${a3}_t;
|
||
attribute ${i4} ${o3} a_${a3};
|
||
varying ${i4} ${s3} ${a3};
|
||
#else
|
||
uniform ${i4} ${s3} u_${a3};
|
||
#endif
|
||
` : "vec4" === r3 ? `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
${a3} = a_${a3};
|
||
#else
|
||
${i4} ${s3} ${a3} = u_${a3};
|
||
#endif
|
||
` : `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
${a3} = unpack_mix_${r3}(a_${a3}, u_${a3}_t);
|
||
#else
|
||
${i4} ${s3} ${a3} = u_${a3};
|
||
#endif
|
||
` : "define" === e3 ? `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
uniform lowp float u_${a3}_t;
|
||
attribute ${i4} ${o3} a_${a3};
|
||
#else
|
||
uniform ${i4} ${s3} u_${a3};
|
||
#endif
|
||
` : "vec4" === r3 ? `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
${i4} ${s3} ${a3} = a_${a3};
|
||
#else
|
||
${i4} ${s3} ${a3} = u_${a3};
|
||
#endif
|
||
` : `
|
||
#ifndef HAS_UNIFORM_u_${a3}
|
||
${i4} ${s3} ${a3} = unpack_mix_${r3}(a_${a3}, u_${a3}_t);
|
||
#else
|
||
${i4} ${s3} ${a3} = u_${a3};
|
||
#endif
|
||
`;
|
||
})), staticAttributes: s2, staticUniforms: r2 };
|
||
}
|
||
class le {
|
||
constructor() {
|
||
this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;
|
||
}
|
||
bind(t2, e2, i3, s2, a2, o2, r2, n2, l2) {
|
||
this.context = t2;
|
||
let h2 = this.boundPaintVertexBuffers.length !== s2.length;
|
||
for (let t3 = 0; !h2 && t3 < s2.length; t3++) this.boundPaintVertexBuffers[t3] !== s2[t3] && (h2 = true);
|
||
!this.vao || this.boundProgram !== e2 || this.boundLayoutVertexBuffer !== i3 || h2 || this.boundIndexBuffer !== a2 || this.boundVertexOffset !== o2 || this.boundDynamicVertexBuffer !== r2 || this.boundDynamicVertexBuffer2 !== n2 || this.boundDynamicVertexBuffer3 !== l2 ? this.freshBind(e2, i3, s2, a2, o2, r2, n2, l2) : (t2.bindVertexArray.set(this.vao), r2 && r2.bind(), a2 && a2.dynamicDraw && a2.bind(), n2 && n2.bind(), l2 && l2.bind());
|
||
}
|
||
freshBind(t2, e2, i3, s2, a2, o2, r2, n2) {
|
||
const l2 = t2.numAttributes, h2 = this.context, c2 = h2.gl;
|
||
this.vao && this.destroy(), this.vao = h2.createVertexArray(), h2.bindVertexArray.set(this.vao), this.boundProgram = t2, this.boundLayoutVertexBuffer = e2, this.boundPaintVertexBuffers = i3, this.boundIndexBuffer = s2, this.boundVertexOffset = a2, this.boundDynamicVertexBuffer = o2, this.boundDynamicVertexBuffer2 = r2, this.boundDynamicVertexBuffer3 = n2, e2.enableAttributes(c2, t2);
|
||
for (const e3 of i3) e3.enableAttributes(c2, t2);
|
||
o2 && o2.enableAttributes(c2, t2), r2 && r2.enableAttributes(c2, t2), n2 && n2.enableAttributes(c2, t2), e2.bind(), e2.setVertexAttribPointers(c2, t2, a2);
|
||
for (const e3 of i3) e3.bind(), e3.setVertexAttribPointers(c2, t2, a2);
|
||
o2 && (o2.bind(), o2.setVertexAttribPointers(c2, t2, a2)), s2 && s2.bind(), r2 && (r2.bind(), r2.setVertexAttribPointers(c2, t2, a2)), n2 && (n2.bind(), n2.setVertexAttribPointers(c2, t2, a2)), h2.currentNumAttributes = l2;
|
||
}
|
||
destroy() {
|
||
this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);
|
||
}
|
||
}
|
||
function he(t2) {
|
||
const e2 = [];
|
||
for (let i3 = 0; i3 < t2.length; i3++) {
|
||
if (null === t2[i3]) continue;
|
||
const s2 = t2[i3].split(" ");
|
||
e2.push(s2.pop());
|
||
}
|
||
return e2;
|
||
}
|
||
class ce {
|
||
constructor(e2, i3, s2, a2, o2, r2) {
|
||
const n2 = e2.gl;
|
||
this.program = n2.createProgram();
|
||
const l2 = he(i3.staticAttributes), h2 = s2 ? s2.getBinderAttributes() : [], c2 = l2.concat(h2), u2 = re.prelude.staticUniforms ? he(re.prelude.staticUniforms) : [], d2 = i3.staticUniforms ? he(i3.staticUniforms) : [], _2 = s2 ? s2.getBinderUniforms() : [], p2 = u2.concat(d2).concat(_2), m2 = [];
|
||
for (const t2 of p2) m2.indexOf(t2) < 0 && m2.push(t2);
|
||
const f2 = s2 ? s2.defines() : [];
|
||
o2 && f2.push("#define OVERDRAW_INSPECTOR;"), r2 && f2.push("#define TERRAIN3D;");
|
||
const g2 = f2.concat(re.prelude.fragmentSource, i3.fragmentSource).join("\n"), v2 = f2.concat(re.prelude.vertexSource, i3.vertexSource).join("\n"), x2 = n2.createShader(n2.FRAGMENT_SHADER);
|
||
if (n2.isContextLost()) return void (this.failedToCreate = true);
|
||
if (n2.shaderSource(x2, g2), n2.compileShader(x2), !n2.getShaderParameter(x2, n2.COMPILE_STATUS)) throw new Error(`Could not compile fragment shader: ${n2.getShaderInfoLog(x2)}`);
|
||
n2.attachShader(this.program, x2);
|
||
const y2 = n2.createShader(n2.VERTEX_SHADER);
|
||
if (n2.isContextLost()) return void (this.failedToCreate = true);
|
||
if (n2.shaderSource(y2, v2), n2.compileShader(y2), !n2.getShaderParameter(y2, n2.COMPILE_STATUS)) throw new Error(`Could not compile vertex shader: ${n2.getShaderInfoLog(y2)}`);
|
||
n2.attachShader(this.program, y2), this.attributes = {};
|
||
const b2 = {};
|
||
this.numAttributes = c2.length;
|
||
for (let t2 = 0; t2 < this.numAttributes; t2++) c2[t2] && (n2.bindAttribLocation(this.program, t2, c2[t2]), this.attributes[c2[t2]] = t2);
|
||
if (n2.linkProgram(this.program), !n2.getProgramParameter(this.program, n2.LINK_STATUS)) throw new Error(`Program failed to link: ${n2.getProgramInfoLog(this.program)}`);
|
||
n2.deleteShader(y2), n2.deleteShader(x2);
|
||
for (let t2 = 0; t2 < m2.length; t2++) {
|
||
const e3 = m2[t2];
|
||
if (e3 && !b2[e3]) {
|
||
const t3 = n2.getUniformLocation(this.program, e3);
|
||
t3 && (b2[e3] = t3);
|
||
}
|
||
}
|
||
this.fixedUniforms = a2(e2, b2), this.terrainUniforms = ((e3, i4) => ({ u_depth: new t.aL(e3, i4.u_depth), u_terrain: new t.aL(e3, i4.u_terrain), u_terrain_dim: new t.aM(e3, i4.u_terrain_dim), u_terrain_matrix: new t.aN(e3, i4.u_terrain_matrix), u_terrain_unpack: new t.aO(e3, i4.u_terrain_unpack), u_terrain_exaggeration: new t.aM(e3, i4.u_terrain_exaggeration) }))(e2, b2), this.binderUniforms = s2 ? s2.getUniforms(e2, b2) : [];
|
||
}
|
||
draw(t2, e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2, _2, p2, m2, f2, g2) {
|
||
const v2 = t2.gl;
|
||
if (this.failedToCreate) return;
|
||
if (t2.program.set(this.program), t2.setDepthMode(i3), t2.setStencilMode(s2), t2.setColorMode(a2), t2.setCullFace(o2), n2) {
|
||
t2.activeTexture.set(v2.TEXTURE2), v2.bindTexture(v2.TEXTURE_2D, n2.depthTexture), t2.activeTexture.set(v2.TEXTURE3), v2.bindTexture(v2.TEXTURE_2D, n2.texture);
|
||
for (const t3 in this.terrainUniforms) this.terrainUniforms[t3].set(n2[t3]);
|
||
}
|
||
for (const t3 in this.fixedUniforms) this.fixedUniforms[t3].set(r2[t3]);
|
||
p2 && p2.setUniforms(t2, this.binderUniforms, d2, { zoom: _2 });
|
||
let x2 = 0;
|
||
switch (e2) {
|
||
case v2.LINES:
|
||
x2 = 2;
|
||
break;
|
||
case v2.TRIANGLES:
|
||
x2 = 3;
|
||
break;
|
||
case v2.LINE_STRIP:
|
||
x2 = 1;
|
||
}
|
||
for (const i4 of u2.get()) {
|
||
const s3 = i4.vaos || (i4.vaos = {});
|
||
(s3[l2] || (s3[l2] = new le())).bind(t2, this, h2, p2 ? p2.getPaintVertexBuffers() : [], c2, i4.vertexOffset, m2, f2, g2), v2.drawElements(e2, i4.primitiveLength * x2, v2.UNSIGNED_SHORT, i4.primitiveOffset * x2 * 2);
|
||
}
|
||
}
|
||
}
|
||
function ue(t2, e2, i3) {
|
||
const s2 = 1 / St(i3, 1, e2.transform.tileZoom), a2 = Math.pow(2, i3.tileID.overscaledZ), o2 = i3.tileSize * Math.pow(2, e2.transform.tileZoom) / a2, r2 = o2 * (i3.tileID.canonical.x + i3.tileID.wrap * a2), n2 = o2 * i3.tileID.canonical.y;
|
||
return { u_image: 0, u_texsize: i3.imageAtlasTexture.size, u_scale: [s2, t2.fromScale, t2.toScale], u_fade: t2.t, u_pixel_coord_upper: [r2 >> 16, n2 >> 16], u_pixel_coord_lower: [65535 & r2, 65535 & n2] };
|
||
}
|
||
const de = (e2, i3, s2, a2) => {
|
||
const o2 = i3.style.light, r2 = o2.properties.get("position"), n2 = [r2.x, r2.y, r2.z], l2 = (function() {
|
||
var e3 = new t.A(9);
|
||
return t.A != Float32Array && (e3[1] = 0, e3[2] = 0, e3[3] = 0, e3[5] = 0, e3[6] = 0, e3[7] = 0), e3[0] = 1, e3[4] = 1, e3[8] = 1, e3;
|
||
})();
|
||
"viewport" === o2.properties.get("anchor") && (function(t2, e3) {
|
||
var i4 = Math.sin(e3), s3 = Math.cos(e3);
|
||
t2[0] = s3, t2[1] = i4, t2[2] = 0, t2[3] = -i4, t2[4] = s3, t2[5] = 0, t2[6] = 0, t2[7] = 0, t2[8] = 1;
|
||
})(l2, -i3.transform.angle), (function(t2, e3, i4) {
|
||
var s3 = e3[0], a3 = e3[1], o3 = e3[2];
|
||
t2[0] = s3 * i4[0] + a3 * i4[3] + o3 * i4[6], t2[1] = s3 * i4[1] + a3 * i4[4] + o3 * i4[7], t2[2] = s3 * i4[2] + a3 * i4[5] + o3 * i4[8];
|
||
})(n2, n2, l2);
|
||
const h2 = o2.properties.get("color");
|
||
return { u_matrix: e2, u_lightpos: n2, u_lightintensity: o2.properties.get("intensity"), u_lightcolor: [h2.r, h2.g, h2.b], u_vertical_gradient: +s2, u_opacity: a2 };
|
||
}, _e = (e2, i3, s2, a2, o2, r2, n2) => t.e(de(e2, i3, s2, a2), ue(r2, i3, n2), { u_height_factor: -Math.pow(2, o2.overscaledZ) / n2.tileSize / 8 }), pe = (t2) => ({ u_matrix: t2 }), me = (e2, i3, s2, a2) => t.e(pe(e2), ue(s2, i3, a2)), fe = (t2, e2) => ({ u_matrix: t2, u_world: e2 }), ge = (e2, i3, s2, a2, o2) => t.e(me(e2, i3, s2, a2), { u_world: o2 }), ve = (t2, e2, i3, s2) => {
|
||
const a2 = t2.transform;
|
||
let o2, r2;
|
||
if ("map" === s2.paint.get("circle-pitch-alignment")) {
|
||
const t3 = St(i3, 1, a2.zoom);
|
||
o2 = true, r2 = [t3, t3];
|
||
} else o2 = false, r2 = a2.pixelsToGLUnits;
|
||
return { u_camera_to_center_distance: a2.cameraToCenterDistance, u_scale_with_map: +("map" === s2.paint.get("circle-pitch-scale")), u_matrix: t2.translatePosMatrix(e2.posMatrix, i3, s2.paint.get("circle-translate"), s2.paint.get("circle-translate-anchor")), u_pitch_with_map: +o2, u_device_pixel_ratio: t2.pixelRatio, u_extrude_scale: r2 };
|
||
}, xe = (t2, e2, i3) => {
|
||
const s2 = St(i3, 1, e2.zoom), a2 = Math.pow(2, e2.zoom - i3.tileID.overscaledZ), o2 = i3.tileID.overscaleFactor();
|
||
return { u_matrix: t2, u_camera_to_center_distance: e2.cameraToCenterDistance, u_pixels_to_tile_units: s2, u_extrude_scale: [e2.pixelsToGLUnits[0] / (s2 * a2), e2.pixelsToGLUnits[1] / (s2 * a2)], u_overscale_factor: o2 };
|
||
}, ye = (t2, e2, i3 = 1) => ({ u_matrix: t2, u_color: e2, u_overlay: 0, u_overlay_scale: i3 }), be = (t2) => ({ u_matrix: t2 }), we = (t2, e2, i3, s2) => ({ u_matrix: t2, u_extrude_scale: St(e2, 1, i3), u_intensity: s2 });
|
||
function Te(e2, i3) {
|
||
const s2 = Math.pow(2, i3.canonical.z), a2 = i3.canonical.y;
|
||
return [new t.U(0, a2 / s2).toLngLat().lat, new t.U(0, (a2 + 1) / s2).toLngLat().lat];
|
||
}
|
||
const Ie = (t2, e2, i3, s2) => {
|
||
const a2 = t2.transform;
|
||
return { u_matrix: De(t2, e2, i3, s2), u_ratio: 1 / St(e2, 1, a2.zoom), u_device_pixel_ratio: t2.pixelRatio, u_units_to_pixels: [1 / a2.pixelsToGLUnits[0], 1 / a2.pixelsToGLUnits[1]] };
|
||
}, Ee = (e2, i3, s2, a2, o2) => t.e(Ie(e2, i3, s2, o2), { u_image: 0, u_image_height: a2 }), Se = (t2, e2, i3, s2, a2) => {
|
||
const o2 = t2.transform, r2 = Pe(e2, o2);
|
||
return { u_matrix: De(t2, e2, i3, a2), u_texsize: e2.imageAtlasTexture.size, u_ratio: 1 / St(e2, 1, o2.zoom), u_device_pixel_ratio: t2.pixelRatio, u_image: 0, u_scale: [r2, s2.fromScale, s2.toScale], u_fade: s2.t, u_units_to_pixels: [1 / o2.pixelsToGLUnits[0], 1 / o2.pixelsToGLUnits[1]] };
|
||
}, Ce = (e2, i3, s2, a2, o2, r2) => {
|
||
const n2 = e2.lineAtlas, l2 = Pe(i3, e2.transform), h2 = "round" === s2.layout.get("line-cap"), c2 = n2.getDash(a2.from, h2), u2 = n2.getDash(a2.to, h2), d2 = c2.width * o2.fromScale, _2 = u2.width * o2.toScale;
|
||
return t.e(Ie(e2, i3, s2, r2), { u_patternscale_a: [l2 / d2, -c2.height / 2], u_patternscale_b: [l2 / _2, -u2.height / 2], u_sdfgamma: n2.width / (256 * Math.min(d2, _2) * e2.pixelRatio) / 2, u_image: 0, u_tex_y_a: c2.y, u_tex_y_b: u2.y, u_mix: o2.t });
|
||
};
|
||
function Pe(t2, e2) {
|
||
return 1 / St(t2, 1, e2.tileZoom);
|
||
}
|
||
function De(t2, e2, i3, s2) {
|
||
return t2.translatePosMatrix(s2 ? s2.posMatrix : e2.tileID.posMatrix, e2, i3.paint.get("line-translate"), i3.paint.get("line-translate-anchor"));
|
||
}
|
||
const Me = (t2, e2, i3, s2, a2) => {
|
||
return { u_matrix: t2, u_tl_parent: e2, u_scale_parent: i3, u_buffer_scale: 1, u_fade_t: s2.mix, u_opacity: s2.opacity * a2.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: a2.paint.get("raster-brightness-min"), u_brightness_high: a2.paint.get("raster-brightness-max"), u_saturation_factor: (r2 = a2.paint.get("raster-saturation"), r2 > 0 ? 1 - 1 / (1.001 - r2) : -r2), u_contrast_factor: (o2 = a2.paint.get("raster-contrast"), o2 > 0 ? 1 / (1 - o2) : 1 + o2), u_spin_weights: ze(a2.paint.get("raster-hue-rotate")) };
|
||
var o2, r2;
|
||
};
|
||
function ze(t2) {
|
||
t2 *= Math.PI / 180;
|
||
const e2 = Math.sin(t2), i3 = Math.cos(t2);
|
||
return [(2 * i3 + 1) / 3, (-Math.sqrt(3) * e2 - i3 + 1) / 3, (Math.sqrt(3) * e2 - i3 + 1) / 3];
|
||
}
|
||
const Le = (t2, e2, i3, s2, a2, o2, r2, n2, l2, h2) => {
|
||
const c2 = a2.transform;
|
||
return { u_is_size_zoom_constant: +("constant" === t2 || "source" === t2), u_is_size_feature_constant: +("constant" === t2 || "camera" === t2), u_size_t: e2 ? e2.uSizeT : 0, u_size: e2 ? e2.uSize : 0, u_camera_to_center_distance: c2.cameraToCenterDistance, u_pitch: c2.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +i3, u_aspect_ratio: c2.width / c2.height, u_fade_change: a2.options.fadeDuration ? a2.symbolFadeChange : 1, u_matrix: o2, u_label_plane_matrix: r2, u_coord_matrix: n2, u_is_text: +l2, u_pitch_with_map: +s2, u_texsize: h2, u_texture: 0 };
|
||
}, Ae = (e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2) => {
|
||
const d2 = o2.transform;
|
||
return t.e(Le(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2), { u_gamma_scale: a2 ? Math.cos(d2._pitch) * d2.cameraToCenterDistance : 1, u_device_pixel_ratio: o2.pixelRatio, u_is_halo: 1 });
|
||
}, Re = (e2, i3, s2, a2, o2, r2, n2, l2, h2, c2) => t.e(Ae(e2, i3, s2, a2, o2, r2, n2, l2, true, h2), { u_texsize_icon: c2, u_texture_icon: 1 }), ke = (t2, e2, i3) => ({ u_matrix: t2, u_opacity: e2, u_color: i3 }), Fe = (e2, i3, s2, a2, o2, r2) => t.e((function(t2, e3, i4, s3) {
|
||
const a3 = i4.imageManager.getPattern(t2.from.toString()), o3 = i4.imageManager.getPattern(t2.to.toString()), { width: r3, height: n2 } = i4.imageManager.getPixelSize(), l2 = Math.pow(2, s3.tileID.overscaledZ), h2 = s3.tileSize * Math.pow(2, i4.transform.tileZoom) / l2, c2 = h2 * (s3.tileID.canonical.x + s3.tileID.wrap * l2), u2 = h2 * s3.tileID.canonical.y;
|
||
return { u_image: 0, u_pattern_tl_a: a3.tl, u_pattern_br_a: a3.br, u_pattern_tl_b: o3.tl, u_pattern_br_b: o3.br, u_texsize: [r3, n2], u_mix: e3.t, u_pattern_size_a: a3.displaySize, u_pattern_size_b: o3.displaySize, u_scale_a: e3.fromScale, u_scale_b: e3.toScale, u_tile_units_to_pixels: 1 / St(s3, 1, i4.transform.tileZoom), u_pixel_coord_upper: [c2 >> 16, u2 >> 16], u_pixel_coord_lower: [65535 & c2, 65535 & u2] };
|
||
})(a2, r2, s2, o2), { u_matrix: e2, u_opacity: i3 }), Be = { fillExtrusion: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_lightpos: new t.aP(e2, i3.u_lightpos), u_lightintensity: new t.aM(e2, i3.u_lightintensity), u_lightcolor: new t.aP(e2, i3.u_lightcolor), u_vertical_gradient: new t.aM(e2, i3.u_vertical_gradient), u_opacity: new t.aM(e2, i3.u_opacity) }), fillExtrusionPattern: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_lightpos: new t.aP(e2, i3.u_lightpos), u_lightintensity: new t.aM(e2, i3.u_lightintensity), u_lightcolor: new t.aP(e2, i3.u_lightcolor), u_vertical_gradient: new t.aM(e2, i3.u_vertical_gradient), u_height_factor: new t.aM(e2, i3.u_height_factor), u_image: new t.aL(e2, i3.u_image), u_texsize: new t.aQ(e2, i3.u_texsize), u_pixel_coord_upper: new t.aQ(e2, i3.u_pixel_coord_upper), u_pixel_coord_lower: new t.aQ(e2, i3.u_pixel_coord_lower), u_scale: new t.aP(e2, i3.u_scale), u_fade: new t.aM(e2, i3.u_fade), u_opacity: new t.aM(e2, i3.u_opacity) }), fill: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix) }), fillPattern: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_image: new t.aL(e2, i3.u_image), u_texsize: new t.aQ(e2, i3.u_texsize), u_pixel_coord_upper: new t.aQ(e2, i3.u_pixel_coord_upper), u_pixel_coord_lower: new t.aQ(e2, i3.u_pixel_coord_lower), u_scale: new t.aP(e2, i3.u_scale), u_fade: new t.aM(e2, i3.u_fade) }), fillOutline: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_world: new t.aQ(e2, i3.u_world) }), fillOutlinePattern: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_world: new t.aQ(e2, i3.u_world), u_image: new t.aL(e2, i3.u_image), u_texsize: new t.aQ(e2, i3.u_texsize), u_pixel_coord_upper: new t.aQ(e2, i3.u_pixel_coord_upper), u_pixel_coord_lower: new t.aQ(e2, i3.u_pixel_coord_lower), u_scale: new t.aP(e2, i3.u_scale), u_fade: new t.aM(e2, i3.u_fade) }), circle: (e2, i3) => ({ u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_scale_with_map: new t.aL(e2, i3.u_scale_with_map), u_pitch_with_map: new t.aL(e2, i3.u_pitch_with_map), u_extrude_scale: new t.aQ(e2, i3.u_extrude_scale), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_matrix: new t.aN(e2, i3.u_matrix) }), collisionBox: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_pixels_to_tile_units: new t.aM(e2, i3.u_pixels_to_tile_units), u_extrude_scale: new t.aQ(e2, i3.u_extrude_scale), u_overscale_factor: new t.aM(e2, i3.u_overscale_factor) }), collisionCircle: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_inv_matrix: new t.aN(e2, i3.u_inv_matrix), u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_viewport_size: new t.aQ(e2, i3.u_viewport_size) }), debug: (e2, i3) => ({ u_color: new t.aR(e2, i3.u_color), u_matrix: new t.aN(e2, i3.u_matrix), u_overlay: new t.aL(e2, i3.u_overlay), u_overlay_scale: new t.aM(e2, i3.u_overlay_scale) }), clippingMask: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix) }), heatmap: (e2, i3) => ({ u_extrude_scale: new t.aM(e2, i3.u_extrude_scale), u_intensity: new t.aM(e2, i3.u_intensity), u_matrix: new t.aN(e2, i3.u_matrix) }), heatmapTexture: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_world: new t.aQ(e2, i3.u_world), u_image: new t.aL(e2, i3.u_image), u_color_ramp: new t.aL(e2, i3.u_color_ramp), u_opacity: new t.aM(e2, i3.u_opacity) }), hillshade: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_image: new t.aL(e2, i3.u_image), u_latrange: new t.aQ(e2, i3.u_latrange), u_light: new t.aQ(e2, i3.u_light), u_shadow: new t.aR(e2, i3.u_shadow), u_highlight: new t.aR(e2, i3.u_highlight), u_accent: new t.aR(e2, i3.u_accent) }), hillshadePrepare: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_image: new t.aL(e2, i3.u_image), u_dimension: new t.aQ(e2, i3.u_dimension), u_zoom: new t.aM(e2, i3.u_zoom), u_unpack: new t.aO(e2, i3.u_unpack) }), line: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_ratio: new t.aM(e2, i3.u_ratio), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_units_to_pixels: new t.aQ(e2, i3.u_units_to_pixels) }), lineGradient: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_ratio: new t.aM(e2, i3.u_ratio), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_units_to_pixels: new t.aQ(e2, i3.u_units_to_pixels), u_image: new t.aL(e2, i3.u_image), u_image_height: new t.aM(e2, i3.u_image_height) }), linePattern: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_texsize: new t.aQ(e2, i3.u_texsize), u_ratio: new t.aM(e2, i3.u_ratio), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_image: new t.aL(e2, i3.u_image), u_units_to_pixels: new t.aQ(e2, i3.u_units_to_pixels), u_scale: new t.aP(e2, i3.u_scale), u_fade: new t.aM(e2, i3.u_fade) }), lineSDF: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_ratio: new t.aM(e2, i3.u_ratio), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_units_to_pixels: new t.aQ(e2, i3.u_units_to_pixels), u_patternscale_a: new t.aQ(e2, i3.u_patternscale_a), u_patternscale_b: new t.aQ(e2, i3.u_patternscale_b), u_sdfgamma: new t.aM(e2, i3.u_sdfgamma), u_image: new t.aL(e2, i3.u_image), u_tex_y_a: new t.aM(e2, i3.u_tex_y_a), u_tex_y_b: new t.aM(e2, i3.u_tex_y_b), u_mix: new t.aM(e2, i3.u_mix) }), raster: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_tl_parent: new t.aQ(e2, i3.u_tl_parent), u_scale_parent: new t.aM(e2, i3.u_scale_parent), u_buffer_scale: new t.aM(e2, i3.u_buffer_scale), u_fade_t: new t.aM(e2, i3.u_fade_t), u_opacity: new t.aM(e2, i3.u_opacity), u_image0: new t.aL(e2, i3.u_image0), u_image1: new t.aL(e2, i3.u_image1), u_brightness_low: new t.aM(e2, i3.u_brightness_low), u_brightness_high: new t.aM(e2, i3.u_brightness_high), u_saturation_factor: new t.aM(e2, i3.u_saturation_factor), u_contrast_factor: new t.aM(e2, i3.u_contrast_factor), u_spin_weights: new t.aP(e2, i3.u_spin_weights) }), symbolIcon: (e2, i3) => ({ u_is_size_zoom_constant: new t.aL(e2, i3.u_is_size_zoom_constant), u_is_size_feature_constant: new t.aL(e2, i3.u_is_size_feature_constant), u_size_t: new t.aM(e2, i3.u_size_t), u_size: new t.aM(e2, i3.u_size), u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_pitch: new t.aM(e2, i3.u_pitch), u_rotate_symbol: new t.aL(e2, i3.u_rotate_symbol), u_aspect_ratio: new t.aM(e2, i3.u_aspect_ratio), u_fade_change: new t.aM(e2, i3.u_fade_change), u_matrix: new t.aN(e2, i3.u_matrix), u_label_plane_matrix: new t.aN(e2, i3.u_label_plane_matrix), u_coord_matrix: new t.aN(e2, i3.u_coord_matrix), u_is_text: new t.aL(e2, i3.u_is_text), u_pitch_with_map: new t.aL(e2, i3.u_pitch_with_map), u_texsize: new t.aQ(e2, i3.u_texsize), u_texture: new t.aL(e2, i3.u_texture) }), symbolSDF: (e2, i3) => ({ u_is_size_zoom_constant: new t.aL(e2, i3.u_is_size_zoom_constant), u_is_size_feature_constant: new t.aL(e2, i3.u_is_size_feature_constant), u_size_t: new t.aM(e2, i3.u_size_t), u_size: new t.aM(e2, i3.u_size), u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_pitch: new t.aM(e2, i3.u_pitch), u_rotate_symbol: new t.aL(e2, i3.u_rotate_symbol), u_aspect_ratio: new t.aM(e2, i3.u_aspect_ratio), u_fade_change: new t.aM(e2, i3.u_fade_change), u_matrix: new t.aN(e2, i3.u_matrix), u_label_plane_matrix: new t.aN(e2, i3.u_label_plane_matrix), u_coord_matrix: new t.aN(e2, i3.u_coord_matrix), u_is_text: new t.aL(e2, i3.u_is_text), u_pitch_with_map: new t.aL(e2, i3.u_pitch_with_map), u_texsize: new t.aQ(e2, i3.u_texsize), u_texture: new t.aL(e2, i3.u_texture), u_gamma_scale: new t.aM(e2, i3.u_gamma_scale), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_is_halo: new t.aL(e2, i3.u_is_halo) }), symbolTextAndIcon: (e2, i3) => ({ u_is_size_zoom_constant: new t.aL(e2, i3.u_is_size_zoom_constant), u_is_size_feature_constant: new t.aL(e2, i3.u_is_size_feature_constant), u_size_t: new t.aM(e2, i3.u_size_t), u_size: new t.aM(e2, i3.u_size), u_camera_to_center_distance: new t.aM(e2, i3.u_camera_to_center_distance), u_pitch: new t.aM(e2, i3.u_pitch), u_rotate_symbol: new t.aL(e2, i3.u_rotate_symbol), u_aspect_ratio: new t.aM(e2, i3.u_aspect_ratio), u_fade_change: new t.aM(e2, i3.u_fade_change), u_matrix: new t.aN(e2, i3.u_matrix), u_label_plane_matrix: new t.aN(e2, i3.u_label_plane_matrix), u_coord_matrix: new t.aN(e2, i3.u_coord_matrix), u_is_text: new t.aL(e2, i3.u_is_text), u_pitch_with_map: new t.aL(e2, i3.u_pitch_with_map), u_texsize: new t.aQ(e2, i3.u_texsize), u_texsize_icon: new t.aQ(e2, i3.u_texsize_icon), u_texture: new t.aL(e2, i3.u_texture), u_texture_icon: new t.aL(e2, i3.u_texture_icon), u_gamma_scale: new t.aM(e2, i3.u_gamma_scale), u_device_pixel_ratio: new t.aM(e2, i3.u_device_pixel_ratio), u_is_halo: new t.aL(e2, i3.u_is_halo) }), background: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_opacity: new t.aM(e2, i3.u_opacity), u_color: new t.aR(e2, i3.u_color) }), backgroundPattern: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_opacity: new t.aM(e2, i3.u_opacity), u_image: new t.aL(e2, i3.u_image), u_pattern_tl_a: new t.aQ(e2, i3.u_pattern_tl_a), u_pattern_br_a: new t.aQ(e2, i3.u_pattern_br_a), u_pattern_tl_b: new t.aQ(e2, i3.u_pattern_tl_b), u_pattern_br_b: new t.aQ(e2, i3.u_pattern_br_b), u_texsize: new t.aQ(e2, i3.u_texsize), u_mix: new t.aM(e2, i3.u_mix), u_pattern_size_a: new t.aQ(e2, i3.u_pattern_size_a), u_pattern_size_b: new t.aQ(e2, i3.u_pattern_size_b), u_scale_a: new t.aM(e2, i3.u_scale_a), u_scale_b: new t.aM(e2, i3.u_scale_b), u_pixel_coord_upper: new t.aQ(e2, i3.u_pixel_coord_upper), u_pixel_coord_lower: new t.aQ(e2, i3.u_pixel_coord_lower), u_tile_units_to_pixels: new t.aM(e2, i3.u_tile_units_to_pixels) }), terrain: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_texture: new t.aL(e2, i3.u_texture), u_ele_delta: new t.aM(e2, i3.u_ele_delta) }), terrainDepth: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_ele_delta: new t.aM(e2, i3.u_ele_delta) }), terrainCoords: (e2, i3) => ({ u_matrix: new t.aN(e2, i3.u_matrix), u_texture: new t.aL(e2, i3.u_texture), u_terrain_coords_id: new t.aM(e2, i3.u_terrain_coords_id), u_ele_delta: new t.aM(e2, i3.u_ele_delta) }) };
|
||
class Oe {
|
||
constructor(t2, e2, i3) {
|
||
this.context = t2;
|
||
const s2 = t2.gl;
|
||
this.buffer = s2.createBuffer(), this.dynamicDraw = Boolean(i3), this.context.unbindVAO(), t2.bindElementBuffer.set(this.buffer), s2.bufferData(s2.ELEMENT_ARRAY_BUFFER, e2.arrayBuffer, this.dynamicDraw ? s2.DYNAMIC_DRAW : s2.STATIC_DRAW), this.dynamicDraw || delete e2.arrayBuffer;
|
||
}
|
||
bind() {
|
||
this.context.bindElementBuffer.set(this.buffer);
|
||
}
|
||
updateData(t2) {
|
||
const e2 = this.context.gl;
|
||
if (!this.dynamicDraw) throw new Error("Attempted to update data while not in dynamic mode.");
|
||
this.context.unbindVAO(), this.bind(), e2.bufferSubData(e2.ELEMENT_ARRAY_BUFFER, 0, t2.arrayBuffer);
|
||
}
|
||
destroy() {
|
||
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
|
||
}
|
||
}
|
||
const Ne = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" };
|
||
class Ue {
|
||
constructor(t2, e2, i3, s2) {
|
||
this.length = e2.length, this.attributes = i3, this.itemSize = e2.bytesPerElement, this.dynamicDraw = s2, this.context = t2;
|
||
const a2 = t2.gl;
|
||
this.buffer = a2.createBuffer(), t2.bindVertexBuffer.set(this.buffer), a2.bufferData(a2.ARRAY_BUFFER, e2.arrayBuffer, this.dynamicDraw ? a2.DYNAMIC_DRAW : a2.STATIC_DRAW), this.dynamicDraw || delete e2.arrayBuffer;
|
||
}
|
||
bind() {
|
||
this.context.bindVertexBuffer.set(this.buffer);
|
||
}
|
||
updateData(t2) {
|
||
if (t2.length !== this.length) throw new Error(`Length of new data is ${t2.length}, which doesn't match current length of ${this.length}`);
|
||
const e2 = this.context.gl;
|
||
this.bind(), e2.bufferSubData(e2.ARRAY_BUFFER, 0, t2.arrayBuffer);
|
||
}
|
||
enableAttributes(t2, e2) {
|
||
for (let i3 = 0; i3 < this.attributes.length; i3++) {
|
||
const s2 = e2.attributes[this.attributes[i3].name];
|
||
void 0 !== s2 && t2.enableVertexAttribArray(s2);
|
||
}
|
||
}
|
||
setVertexAttribPointers(t2, e2, i3) {
|
||
for (let s2 = 0; s2 < this.attributes.length; s2++) {
|
||
const a2 = this.attributes[s2], o2 = e2.attributes[a2.name];
|
||
void 0 !== o2 && t2.vertexAttribPointer(o2, a2.components, t2[Ne[a2.type]], false, this.itemSize, a2.offset + this.itemSize * (i3 || 0));
|
||
}
|
||
}
|
||
destroy() {
|
||
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
|
||
}
|
||
}
|
||
const Ze = /* @__PURE__ */ new WeakMap();
|
||
function Ge(t2) {
|
||
var e2;
|
||
if (Ze.has(t2)) return Ze.get(t2);
|
||
{
|
||
const i3 = null === (e2 = t2.getParameter(t2.VERSION)) || void 0 === e2 ? void 0 : e2.startsWith("WebGL 2.0");
|
||
return Ze.set(t2, i3), i3;
|
||
}
|
||
}
|
||
class je {
|
||
constructor(t2) {
|
||
this.gl = t2.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false;
|
||
}
|
||
get() {
|
||
return this.current;
|
||
}
|
||
set(t2) {
|
||
}
|
||
getDefault() {
|
||
return this.default;
|
||
}
|
||
setDefault() {
|
||
this.set(this.default);
|
||
}
|
||
}
|
||
class Ve extends je {
|
||
getDefault() {
|
||
return t.aT.transparent;
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2.r !== e2.r || t2.g !== e2.g || t2.b !== e2.b || t2.a !== e2.a || this.dirty) && (this.gl.clearColor(t2.r, t2.g, t2.b, t2.a), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class qe extends je {
|
||
getDefault() {
|
||
return 1;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.clearDepth(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class $e extends je {
|
||
getDefault() {
|
||
return 0;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.clearStencil(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class We extends je {
|
||
getDefault() {
|
||
return [true, true, true, true];
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2[0] !== e2[0] || t2[1] !== e2[1] || t2[2] !== e2[2] || t2[3] !== e2[3] || this.dirty) && (this.gl.colorMask(t2[0], t2[1], t2[2], t2[3]), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class He extends je {
|
||
getDefault() {
|
||
return true;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.depthMask(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class Xe extends je {
|
||
getDefault() {
|
||
return 255;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.stencilMask(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class Ke extends je {
|
||
getDefault() {
|
||
return { func: this.gl.ALWAYS, ref: 0, mask: 255 };
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2.func !== e2.func || t2.ref !== e2.ref || t2.mask !== e2.mask || this.dirty) && (this.gl.stencilFunc(t2.func, t2.ref, t2.mask), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class Qe extends je {
|
||
getDefault() {
|
||
const t2 = this.gl;
|
||
return [t2.KEEP, t2.KEEP, t2.KEEP];
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2[0] !== e2[0] || t2[1] !== e2[1] || t2[2] !== e2[2] || this.dirty) && (this.gl.stencilOp(t2[0], t2[1], t2[2]), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class Ye extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
t2 ? e2.enable(e2.STENCIL_TEST) : e2.disable(e2.STENCIL_TEST), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class Je extends je {
|
||
getDefault() {
|
||
return [0, 1];
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2[0] !== e2[0] || t2[1] !== e2[1] || this.dirty) && (this.gl.depthRange(t2[0], t2[1]), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ti extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
t2 ? e2.enable(e2.DEPTH_TEST) : e2.disable(e2.DEPTH_TEST), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class ei extends je {
|
||
getDefault() {
|
||
return this.gl.LESS;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.depthFunc(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ii extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
t2 ? e2.enable(e2.BLEND) : e2.disable(e2.BLEND), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class si extends je {
|
||
getDefault() {
|
||
const t2 = this.gl;
|
||
return [t2.ONE, t2.ZERO];
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2[0] !== e2[0] || t2[1] !== e2[1] || this.dirty) && (this.gl.blendFunc(t2[0], t2[1]), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ai extends je {
|
||
getDefault() {
|
||
return t.aT.transparent;
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2.r !== e2.r || t2.g !== e2.g || t2.b !== e2.b || t2.a !== e2.a || this.dirty) && (this.gl.blendColor(t2.r, t2.g, t2.b, t2.a), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class oi extends je {
|
||
getDefault() {
|
||
return this.gl.FUNC_ADD;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.blendEquation(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ri extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
t2 ? e2.enable(e2.CULL_FACE) : e2.disable(e2.CULL_FACE), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class ni extends je {
|
||
getDefault() {
|
||
return this.gl.BACK;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.cullFace(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class li extends je {
|
||
getDefault() {
|
||
return this.gl.CCW;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.frontFace(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class hi extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.useProgram(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ci extends je {
|
||
getDefault() {
|
||
return this.gl.TEXTURE0;
|
||
}
|
||
set(t2) {
|
||
(t2 !== this.current || this.dirty) && (this.gl.activeTexture(t2), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class ui extends je {
|
||
getDefault() {
|
||
const t2 = this.gl;
|
||
return [0, 0, t2.drawingBufferWidth, t2.drawingBufferHeight];
|
||
}
|
||
set(t2) {
|
||
const e2 = this.current;
|
||
(t2[0] !== e2[0] || t2[1] !== e2[1] || t2[2] !== e2[2] || t2[3] !== e2[3] || this.dirty) && (this.gl.viewport(t2[0], t2[1], t2[2], t2[3]), this.current = t2, this.dirty = false);
|
||
}
|
||
}
|
||
class di extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.bindFramebuffer(e2.FRAMEBUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class _i extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.bindRenderbuffer(e2.RENDERBUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class pi extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.bindTexture(e2.TEXTURE_2D, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class mi extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.bindBuffer(e2.ARRAY_BUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class fi extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
const e2 = this.gl;
|
||
e2.bindBuffer(e2.ELEMENT_ARRAY_BUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class gi extends je {
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
set(t2) {
|
||
var e2;
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const i3 = this.gl;
|
||
Ge(i3) ? i3.bindVertexArray(t2) : null === (e2 = i3.getExtension("OES_vertex_array_object")) || void 0 === e2 || e2.bindVertexArrayOES(t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class vi extends je {
|
||
getDefault() {
|
||
return 4;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.pixelStorei(e2.UNPACK_ALIGNMENT, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class xi extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.pixelStorei(e2.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class yi extends je {
|
||
getDefault() {
|
||
return false;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
const e2 = this.gl;
|
||
e2.pixelStorei(e2.UNPACK_FLIP_Y_WEBGL, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class bi extends je {
|
||
constructor(t2, e2) {
|
||
super(t2), this.context = t2, this.parent = e2;
|
||
}
|
||
getDefault() {
|
||
return null;
|
||
}
|
||
}
|
||
class wi extends bi {
|
||
setDirty() {
|
||
this.dirty = true;
|
||
}
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
this.context.bindFramebuffer.set(this.parent);
|
||
const e2 = this.gl;
|
||
e2.framebufferTexture2D(e2.FRAMEBUFFER, e2.COLOR_ATTACHMENT0, e2.TEXTURE_2D, t2, 0), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class Ti extends bi {
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
this.context.bindFramebuffer.set(this.parent);
|
||
const e2 = this.gl;
|
||
e2.framebufferRenderbuffer(e2.FRAMEBUFFER, e2.DEPTH_ATTACHMENT, e2.RENDERBUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class Ii extends bi {
|
||
set(t2) {
|
||
if (t2 === this.current && !this.dirty) return;
|
||
this.context.bindFramebuffer.set(this.parent);
|
||
const e2 = this.gl;
|
||
e2.framebufferRenderbuffer(e2.FRAMEBUFFER, e2.DEPTH_STENCIL_ATTACHMENT, e2.RENDERBUFFER, t2), this.current = t2, this.dirty = false;
|
||
}
|
||
}
|
||
class Ei {
|
||
constructor(t2, e2, i3, s2, a2) {
|
||
this.context = t2, this.width = e2, this.height = i3;
|
||
const o2 = t2.gl, r2 = this.framebuffer = o2.createFramebuffer();
|
||
if (this.colorAttachment = new wi(t2, r2), s2) this.depthAttachment = a2 ? new Ii(t2, r2) : new Ti(t2, r2);
|
||
else if (a2) throw new Error("Stencil cannot be setted without depth");
|
||
if (o2.checkFramebufferStatus(o2.FRAMEBUFFER) !== o2.FRAMEBUFFER_COMPLETE) throw new Error("Framebuffer is not complete");
|
||
}
|
||
destroy() {
|
||
const t2 = this.context.gl, e2 = this.colorAttachment.get();
|
||
if (e2 && t2.deleteTexture(e2), this.depthAttachment) {
|
||
const e3 = this.depthAttachment.get();
|
||
e3 && t2.deleteRenderbuffer(e3);
|
||
}
|
||
t2.deleteFramebuffer(this.framebuffer);
|
||
}
|
||
}
|
||
class Si {
|
||
constructor(t2, e2, i3) {
|
||
this.blendFunction = t2, this.blendColor = e2, this.mask = i3;
|
||
}
|
||
}
|
||
Si.Replace = [1, 0], Si.disabled = new Si(Si.Replace, t.aT.transparent, [false, false, false, false]), Si.unblended = new Si(Si.Replace, t.aT.transparent, [true, true, true, true]), Si.alphaBlended = new Si([1, 771], t.aT.transparent, [true, true, true, true]);
|
||
class Ci {
|
||
constructor(t2) {
|
||
var e2, i3;
|
||
if (this.gl = t2, this.clearColor = new Ve(this), this.clearDepth = new qe(this), this.clearStencil = new $e(this), this.colorMask = new We(this), this.depthMask = new He(this), this.stencilMask = new Xe(this), this.stencilFunc = new Ke(this), this.stencilOp = new Qe(this), this.stencilTest = new Ye(this), this.depthRange = new Je(this), this.depthTest = new ti(this), this.depthFunc = new ei(this), this.blend = new ii(this), this.blendFunc = new si(this), this.blendColor = new ai(this), this.blendEquation = new oi(this), this.cullFace = new ri(this), this.cullFaceSide = new ni(this), this.frontFace = new li(this), this.program = new hi(this), this.activeTexture = new ci(this), this.viewport = new ui(this), this.bindFramebuffer = new di(this), this.bindRenderbuffer = new _i(this), this.bindTexture = new pi(this), this.bindVertexBuffer = new mi(this), this.bindElementBuffer = new fi(this), this.bindVertexArray = new gi(this), this.pixelStoreUnpack = new vi(this), this.pixelStoreUnpackPremultiplyAlpha = new xi(this), this.pixelStoreUnpackFlipY = new yi(this), this.extTextureFilterAnisotropic = t2.getExtension("EXT_texture_filter_anisotropic") || t2.getExtension("MOZ_EXT_texture_filter_anisotropic") || t2.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = t2.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.maxTextureSize = t2.getParameter(t2.MAX_TEXTURE_SIZE), Ge(t2)) {
|
||
this.HALF_FLOAT = t2.HALF_FLOAT;
|
||
const s2 = t2.getExtension("EXT_color_buffer_half_float");
|
||
this.RGBA16F = null !== (e2 = t2.RGBA16F) && void 0 !== e2 ? e2 : null == s2 ? void 0 : s2.RGBA16F_EXT, this.RGB16F = null !== (i3 = t2.RGB16F) && void 0 !== i3 ? i3 : null == s2 ? void 0 : s2.RGB16F_EXT, t2.getExtension("EXT_color_buffer_float");
|
||
} else {
|
||
t2.getExtension("EXT_color_buffer_half_float"), t2.getExtension("OES_texture_half_float_linear");
|
||
const e3 = t2.getExtension("OES_texture_half_float");
|
||
this.HALF_FLOAT = null == e3 ? void 0 : e3.HALF_FLOAT_OES;
|
||
}
|
||
}
|
||
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 = true, this.clearDepth.dirty = true, this.clearStencil.dirty = true, this.colorMask.dirty = true, this.depthMask.dirty = true, this.stencilMask.dirty = true, this.stencilFunc.dirty = true, this.stencilOp.dirty = true, this.stencilTest.dirty = true, this.depthRange.dirty = true, this.depthTest.dirty = true, this.depthFunc.dirty = true, this.blend.dirty = true, this.blendFunc.dirty = true, this.blendColor.dirty = true, this.blendEquation.dirty = true, this.cullFace.dirty = true, this.cullFaceSide.dirty = true, this.frontFace.dirty = true, this.program.dirty = true, this.activeTexture.dirty = true, this.viewport.dirty = true, this.bindFramebuffer.dirty = true, this.bindRenderbuffer.dirty = true, this.bindTexture.dirty = true, this.bindVertexBuffer.dirty = true, this.bindElementBuffer.dirty = true, this.bindVertexArray.dirty = true, this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true;
|
||
}
|
||
createIndexBuffer(t2, e2) {
|
||
return new Oe(this, t2, e2);
|
||
}
|
||
createVertexBuffer(t2, e2, i3) {
|
||
return new Ue(this, t2, e2, i3);
|
||
}
|
||
createRenderbuffer(t2, e2, i3) {
|
||
const s2 = this.gl, a2 = s2.createRenderbuffer();
|
||
return this.bindRenderbuffer.set(a2), s2.renderbufferStorage(s2.RENDERBUFFER, t2, e2, i3), this.bindRenderbuffer.set(null), a2;
|
||
}
|
||
createFramebuffer(t2, e2, i3, s2) {
|
||
return new Ei(this, t2, e2, i3, s2);
|
||
}
|
||
clear({ color: t2, depth: e2, stencil: i3 }) {
|
||
const s2 = this.gl;
|
||
let a2 = 0;
|
||
t2 && (a2 |= s2.COLOR_BUFFER_BIT, this.clearColor.set(t2), this.colorMask.set([true, true, true, true])), void 0 !== e2 && (a2 |= s2.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(e2), this.depthMask.set(true)), void 0 !== i3 && (a2 |= s2.STENCIL_BUFFER_BIT, this.clearStencil.set(i3), this.stencilMask.set(255)), s2.clear(a2);
|
||
}
|
||
setCullFace(t2) {
|
||
false === t2.enable ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(t2.mode), this.frontFace.set(t2.frontFace));
|
||
}
|
||
setDepthMode(t2) {
|
||
t2.func !== this.gl.ALWAYS || t2.mask ? (this.depthTest.set(true), this.depthFunc.set(t2.func), this.depthMask.set(t2.mask), this.depthRange.set(t2.range)) : this.depthTest.set(false);
|
||
}
|
||
setStencilMode(t2) {
|
||
t2.test.func !== this.gl.ALWAYS || t2.mask ? (this.stencilTest.set(true), this.stencilMask.set(t2.mask), this.stencilOp.set([t2.fail, t2.depthFail, t2.pass]), this.stencilFunc.set({ func: t2.test.func, ref: t2.ref, mask: t2.test.mask })) : this.stencilTest.set(false);
|
||
}
|
||
setColorMode(e2) {
|
||
t.aG(e2.blendFunction, Si.Replace) ? this.blend.set(false) : (this.blend.set(true), this.blendFunc.set(e2.blendFunction), this.blendColor.set(e2.blendColor)), this.colorMask.set(e2.mask);
|
||
}
|
||
createVertexArray() {
|
||
var t2;
|
||
return Ge(this.gl) ? this.gl.createVertexArray() : null === (t2 = this.gl.getExtension("OES_vertex_array_object")) || void 0 === t2 ? void 0 : t2.createVertexArrayOES();
|
||
}
|
||
deleteVertexArray(t2) {
|
||
var e2;
|
||
return Ge(this.gl) ? this.gl.deleteVertexArray(t2) : null === (e2 = this.gl.getExtension("OES_vertex_array_object")) || void 0 === e2 ? void 0 : e2.deleteVertexArrayOES(t2);
|
||
}
|
||
unbindVAO() {
|
||
this.bindVertexArray.set(null);
|
||
}
|
||
}
|
||
class Pi {
|
||
constructor(t2, e2, i3) {
|
||
this.func = t2, this.mask = e2, this.range = i3;
|
||
}
|
||
}
|
||
Pi.ReadOnly = false, Pi.ReadWrite = true, Pi.disabled = new Pi(519, Pi.ReadOnly, [0, 1]);
|
||
const Di = 7680;
|
||
class Mi {
|
||
constructor(t2, e2, i3, s2, a2, o2) {
|
||
this.test = t2, this.ref = e2, this.mask = i3, this.fail = s2, this.depthFail = a2, this.pass = o2;
|
||
}
|
||
}
|
||
Mi.disabled = new Mi({ func: 519, mask: 0 }, 0, 0, Di, Di, Di);
|
||
class zi {
|
||
constructor(t2, e2, i3) {
|
||
this.enable = t2, this.mode = e2, this.frontFace = i3;
|
||
}
|
||
}
|
||
let Li;
|
||
function Ai(e2, i3, s2, a2, o2, r2, n2) {
|
||
const l2 = e2.context, h2 = l2.gl, c2 = e2.useProgram("collisionBox"), u2 = [];
|
||
let d2 = 0, _2 = 0;
|
||
for (let p3 = 0; p3 < a2.length; p3++) {
|
||
const m3 = a2[p3], f3 = i3.getTile(m3), g3 = f3.getBucket(s2);
|
||
if (!g3) continue;
|
||
let v3 = m3.posMatrix;
|
||
0 === o2[0] && 0 === o2[1] || (v3 = e2.translatePosMatrix(m3.posMatrix, f3, o2, r2));
|
||
const x3 = n2 ? g3.textCollisionBox : g3.iconCollisionBox, y2 = g3.collisionCircleArray;
|
||
if (y2.length > 0) {
|
||
const i4 = t.Z(), s3 = v3;
|
||
t.aU(i4, g3.placementInvProjMatrix, e2.transform.glCoordMatrix), t.aU(i4, i4, g3.placementViewportMatrix), u2.push({ circleArray: y2, circleOffset: _2, transform: s3, invTransform: i4, coord: m3 }), d2 += y2.length / 4, _2 = d2;
|
||
}
|
||
x3 && c2.draw(l2, h2.LINES, Pi.disabled, Mi.disabled, e2.colorModeForRenderPass(), zi.disabled, xe(v3, e2.transform, f3), e2.style.map.terrain && e2.style.map.terrain.getTerrainData(m3), s2.id, x3.layoutVertexBuffer, x3.indexBuffer, x3.segments, null, e2.transform.zoom, null, null, x3.collisionVertexBuffer);
|
||
}
|
||
if (!n2 || !u2.length) return;
|
||
const p2 = e2.useProgram("collisionCircle"), m2 = new t.aV();
|
||
m2.resize(4 * d2), m2._trim();
|
||
let f2 = 0;
|
||
for (const t2 of u2) for (let e3 = 0; e3 < t2.circleArray.length / 4; e3++) {
|
||
const i4 = 4 * e3, s3 = t2.circleArray[i4 + 0], a3 = t2.circleArray[i4 + 1], o3 = t2.circleArray[i4 + 2], r3 = t2.circleArray[i4 + 3];
|
||
m2.emplace(f2++, s3, a3, o3, r3, 0), m2.emplace(f2++, s3, a3, o3, r3, 1), m2.emplace(f2++, s3, a3, o3, r3, 2), m2.emplace(f2++, s3, a3, o3, r3, 3);
|
||
}
|
||
(!Li || Li.length < 2 * d2) && (Li = (function(e3) {
|
||
const i4 = 2 * e3, s3 = new t.aX();
|
||
s3.resize(i4), s3._trim();
|
||
for (let t2 = 0; t2 < i4; t2++) {
|
||
const e4 = 6 * t2;
|
||
s3.uint16[e4 + 0] = 4 * t2 + 0, s3.uint16[e4 + 1] = 4 * t2 + 1, s3.uint16[e4 + 2] = 4 * t2 + 2, s3.uint16[e4 + 3] = 4 * t2 + 2, s3.uint16[e4 + 4] = 4 * t2 + 3, s3.uint16[e4 + 5] = 4 * t2 + 0;
|
||
}
|
||
return s3;
|
||
})(d2));
|
||
const g2 = l2.createIndexBuffer(Li, true), v2 = l2.createVertexBuffer(m2, t.aW.members, true);
|
||
for (const i4 of u2) {
|
||
const a3 = { u_matrix: i4.transform, u_inv_matrix: i4.invTransform, u_camera_to_center_distance: (x2 = e2.transform).cameraToCenterDistance, u_viewport_size: [x2.width, x2.height] };
|
||
p2.draw(l2, h2.TRIANGLES, Pi.disabled, Mi.disabled, e2.colorModeForRenderPass(), zi.disabled, a3, e2.style.map.terrain && e2.style.map.terrain.getTerrainData(i4.coord), s2.id, v2, g2, t.S.simpleSegment(0, 2 * i4.circleOffset, i4.circleArray.length, i4.circleArray.length / 2), null, e2.transform.zoom, null, null, null);
|
||
}
|
||
var x2;
|
||
v2.destroy(), g2.destroy();
|
||
}
|
||
zi.disabled = new zi(false, 1029, 2305), zi.backCCW = new zi(true, 1029, 2305);
|
||
const Ri = t.ao(new Float32Array(16));
|
||
function ki(e2, i3, s2, a2, o2, r2) {
|
||
const { horizontalAlign: n2, verticalAlign: l2 } = t.au(e2);
|
||
return new t.P((-(n2 - 0.5) * i3 / o2 + a2[0]) * r2, (-(l2 - 0.5) * s2 / o2 + a2[1]) * r2);
|
||
}
|
||
function Fi(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2) {
|
||
const d2 = e2.text.placedSymbolArray, _2 = e2.text.dynamicLayoutVertexArray, p2 = e2.icon.dynamicLayoutVertexArray, m2 = {};
|
||
_2.clear();
|
||
for (let p3 = 0; p3 < d2.length; p3++) {
|
||
const f2 = d2.get(p3), g2 = f2.hidden || !f2.crossTileID || e2.allowVerticalPlacement && !f2.placedOrientation ? null : a2[f2.crossTileID];
|
||
if (g2) {
|
||
const a3 = new t.P(f2.anchorX, f2.anchorY), d3 = ht(a3, s2 ? n2 : r2, u2), p4 = ct(o2.cameraToCenterDistance, d3.signedDistanceFromCamera);
|
||
let v2 = t.aj(e2.textSizeData, h2, f2) * p4 / t.ap;
|
||
s2 && (v2 *= e2.tilePixelRatio / l2);
|
||
const { width: x2, height: y2, anchor: b2, textOffset: w2, textBoxScale: T2 } = g2, I2 = ki(b2, x2, y2, w2, T2, v2), E2 = s2 ? ht(a3.add(I2), r2, u2).point : d3.point.add(i3 ? I2.rotate(-o2.angle) : I2), S2 = e2.allowVerticalPlacement && f2.placedOrientation === t.ai.vertical ? Math.PI / 2 : 0;
|
||
for (let e3 = 0; e3 < f2.numGlyphs; e3++) t.ak(_2, E2, S2);
|
||
c2 && f2.associatedIconIndex >= 0 && (m2[f2.associatedIconIndex] = { shiftedAnchor: E2, angle: S2 });
|
||
} else wt(f2.numGlyphs, _2);
|
||
}
|
||
if (c2) {
|
||
p2.clear();
|
||
const i4 = e2.icon.placedSymbolArray;
|
||
for (let e3 = 0; e3 < i4.length; e3++) {
|
||
const s3 = i4.get(e3);
|
||
if (s3.hidden) wt(s3.numGlyphs, p2);
|
||
else {
|
||
const i5 = m2[e3];
|
||
if (i5) for (let e4 = 0; e4 < s3.numGlyphs; e4++) t.ak(p2, i5.shiftedAnchor, i5.angle);
|
||
else wt(s3.numGlyphs, p2);
|
||
}
|
||
}
|
||
e2.icon.dynamicLayoutVertexBuffer.updateData(p2);
|
||
}
|
||
e2.text.dynamicLayoutVertexBuffer.updateData(_2);
|
||
}
|
||
function Bi(t2, e2, i3) {
|
||
return i3.iconsInText && e2 ? "symbolTextAndIcon" : t2 ? "symbolSDF" : "symbolIcon";
|
||
}
|
||
function Oi(e2, i3, s2, a2, o2, r2, n2, l2, h2, c2, u2, d2) {
|
||
const _2 = e2.context, p2 = _2.gl, m2 = e2.transform, f2 = "map" === l2, g2 = "map" === h2, v2 = "viewport" !== l2 && "point" !== s2.layout.get("symbol-placement"), x2 = f2 && !g2 && !v2, y2 = !s2.layout.get("symbol-sort-key").isConstant();
|
||
let b2 = false;
|
||
const w2 = e2.depthModeForSublayer(0, Pi.ReadOnly), T2 = s2._unevaluatedLayout.hasValue("text-variable-anchor") || s2._unevaluatedLayout.hasValue("text-variable-anchor-offset"), I2 = [];
|
||
for (const l3 of a2) {
|
||
const a3 = i3.getTile(l3), h3 = a3.getBucket(s2);
|
||
if (!h3) continue;
|
||
const u3 = o2 ? h3.text : h3.icon;
|
||
if (!u3 || !u3.segments.get().length || !u3.hasVisibleVertices) continue;
|
||
const d3 = u3.programConfigurations.get(s2.id), _3 = o2 || h3.sdfIcons, w3 = o2 ? h3.textSizeData : h3.iconSizeData, E2 = g2 || 0 !== m2.pitch, S2 = e2.useProgram(Bi(_3, o2, h3), d3), C2 = t.ah(w3, m2.zoom), P2 = e2.style.map.terrain && e2.style.map.terrain.getTerrainData(l3);
|
||
let D2, M2, z2, L2, A2 = [0, 0], R2 = null;
|
||
if (o2) M2 = a3.glyphAtlasTexture, z2 = p2.LINEAR, D2 = a3.glyphAtlasTexture.size, h3.iconsInText && (A2 = a3.imageAtlasTexture.size, R2 = a3.imageAtlasTexture, L2 = E2 || e2.options.rotating || e2.options.zooming || "composite" === w3.kind || "camera" === w3.kind ? p2.LINEAR : p2.NEAREST);
|
||
else {
|
||
const t2 = 1 !== s2.layout.get("icon-size").constantOr(0) || h3.iconsNeedLinear;
|
||
M2 = a3.imageAtlasTexture, z2 = _3 || e2.options.rotating || e2.options.zooming || t2 || E2 ? p2.LINEAR : p2.NEAREST, D2 = a3.imageAtlasTexture.size;
|
||
}
|
||
const k2 = St(a3, 1, e2.transform.zoom), F2 = nt(l3.posMatrix, g2, f2, e2.transform, k2), B2 = lt(l3.posMatrix, g2, f2, e2.transform, k2), O2 = T2 && h3.hasTextData(), N2 = "none" !== s2.layout.get("icon-text-fit") && O2 && h3.hasIconData();
|
||
if (v2) {
|
||
const t2 = e2.style.map.terrain ? (t3, i5) => e2.style.map.terrain.getElevation(l3, t3, i5) : null, i4 = "map" === s2.layout.get("text-rotation-alignment");
|
||
dt(h3, l3.posMatrix, e2, o2, F2, B2, g2, c2, i4, t2);
|
||
}
|
||
const U2 = e2.translatePosMatrix(l3.posMatrix, a3, r2, n2), Z2 = v2 || o2 && T2 || N2 ? Ri : F2, G2 = e2.translatePosMatrix(B2, a3, r2, n2, true), j2 = _3 && 0 !== s2.paint.get(o2 ? "text-halo-width" : "icon-halo-width").constantOr(1);
|
||
let V2;
|
||
V2 = _3 ? h3.iconsInText ? Re(w3.kind, C2, x2, g2, e2, U2, Z2, G2, D2, A2) : Ae(w3.kind, C2, x2, g2, e2, U2, Z2, G2, o2, D2) : Le(w3.kind, C2, x2, g2, e2, U2, Z2, G2, o2, D2);
|
||
const q2 = { program: S2, buffers: u3, uniformValues: V2, atlasTexture: M2, atlasTextureIcon: R2, atlasInterpolation: z2, atlasInterpolationIcon: L2, isSDF: _3, hasHalo: j2 };
|
||
if (y2 && h3.canOverlap) {
|
||
b2 = true;
|
||
const e3 = u3.segments.get();
|
||
for (const i4 of e3) I2.push({ segments: new t.S([i4]), sortKey: i4.sortKey, state: q2, terrainData: P2 });
|
||
} else I2.push({ segments: u3.segments, sortKey: 0, state: q2, terrainData: P2 });
|
||
}
|
||
b2 && I2.sort(((t2, e3) => t2.sortKey - e3.sortKey));
|
||
for (const t2 of I2) {
|
||
const i4 = t2.state;
|
||
if (_2.activeTexture.set(p2.TEXTURE0), i4.atlasTexture.bind(i4.atlasInterpolation, p2.CLAMP_TO_EDGE), i4.atlasTextureIcon && (_2.activeTexture.set(p2.TEXTURE1), i4.atlasTextureIcon && i4.atlasTextureIcon.bind(i4.atlasInterpolationIcon, p2.CLAMP_TO_EDGE)), i4.isSDF) {
|
||
const a3 = i4.uniformValues;
|
||
i4.hasHalo && (a3.u_is_halo = 1, Ni(i4.buffers, t2.segments, s2, e2, i4.program, w2, u2, d2, a3, t2.terrainData)), a3.u_is_halo = 0;
|
||
}
|
||
Ni(i4.buffers, t2.segments, s2, e2, i4.program, w2, u2, d2, i4.uniformValues, t2.terrainData);
|
||
}
|
||
}
|
||
function Ni(t2, e2, i3, s2, a2, o2, r2, n2, l2, h2) {
|
||
const c2 = s2.context;
|
||
a2.draw(c2, c2.gl.TRIANGLES, o2, r2, n2, zi.disabled, l2, h2, i3.id, t2.layoutVertexBuffer, t2.indexBuffer, e2, i3.paint, s2.transform.zoom, t2.programConfigurations.get(i3.id), t2.dynamicLayoutVertexBuffer, t2.opacityVertexBuffer);
|
||
}
|
||
function Ui(t2, e2, i3, s2, a2) {
|
||
if (!i3 || !s2 || !s2.imageAtlas) return;
|
||
const o2 = s2.imageAtlas.patternPositions;
|
||
let r2 = o2[i3.to.toString()], n2 = o2[i3.from.toString()];
|
||
if (!r2 && n2 && (r2 = n2), !n2 && r2 && (n2 = r2), !r2 || !n2) {
|
||
const t3 = a2.getPaintProperty(e2);
|
||
r2 = o2[t3], n2 = o2[t3];
|
||
}
|
||
r2 && n2 && t2.setConstantPatternPositions(r2, n2);
|
||
}
|
||
function Zi(t2, e2, i3, s2, a2, o2, r2) {
|
||
const n2 = t2.context.gl, l2 = "fill-pattern", h2 = i3.paint.get(l2), c2 = h2 && h2.constantOr(1), u2 = i3.getCrossfadeParameters();
|
||
let d2, _2, p2, m2, f2;
|
||
r2 ? (_2 = c2 && !i3.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", d2 = n2.LINES) : (_2 = c2 ? "fillPattern" : "fill", d2 = n2.TRIANGLES);
|
||
const g2 = h2.constantOr(null);
|
||
for (const h3 of s2) {
|
||
const s3 = e2.getTile(h3);
|
||
if (c2 && !s3.patternsLoaded()) continue;
|
||
const v2 = s3.getBucket(i3);
|
||
if (!v2) continue;
|
||
const x2 = v2.programConfigurations.get(i3.id), y2 = t2.useProgram(_2, x2), b2 = t2.style.map.terrain && t2.style.map.terrain.getTerrainData(h3);
|
||
c2 && (t2.context.activeTexture.set(n2.TEXTURE0), s3.imageAtlasTexture.bind(n2.LINEAR, n2.CLAMP_TO_EDGE), x2.updatePaintBuffers(u2)), Ui(x2, l2, g2, s3, i3);
|
||
const w2 = b2 ? h3 : null, T2 = t2.translatePosMatrix(w2 ? w2.posMatrix : h3.posMatrix, s3, i3.paint.get("fill-translate"), i3.paint.get("fill-translate-anchor"));
|
||
if (r2) {
|
||
m2 = v2.indexBuffer2, f2 = v2.segments2;
|
||
const e3 = [n2.drawingBufferWidth, n2.drawingBufferHeight];
|
||
p2 = "fillOutlinePattern" === _2 && c2 ? ge(T2, t2, u2, s3, e3) : fe(T2, e3);
|
||
} else m2 = v2.indexBuffer, f2 = v2.segments, p2 = c2 ? me(T2, t2, u2, s3) : pe(T2);
|
||
y2.draw(t2.context, d2, a2, t2.stencilModeForClipping(h3), o2, zi.disabled, p2, b2, i3.id, v2.layoutVertexBuffer, m2, f2, i3.paint, t2.transform.zoom, x2);
|
||
}
|
||
}
|
||
function Gi(t2, e2, i3, s2, a2, o2, r2) {
|
||
const n2 = t2.context, l2 = n2.gl, h2 = "fill-extrusion-pattern", c2 = i3.paint.get(h2), u2 = c2.constantOr(1), d2 = i3.getCrossfadeParameters(), _2 = i3.paint.get("fill-extrusion-opacity"), p2 = c2.constantOr(null);
|
||
for (const c3 of s2) {
|
||
const s3 = e2.getTile(c3), m2 = s3.getBucket(i3);
|
||
if (!m2) continue;
|
||
const f2 = t2.style.map.terrain && t2.style.map.terrain.getTerrainData(c3), g2 = m2.programConfigurations.get(i3.id), v2 = t2.useProgram(u2 ? "fillExtrusionPattern" : "fillExtrusion", g2);
|
||
u2 && (t2.context.activeTexture.set(l2.TEXTURE0), s3.imageAtlasTexture.bind(l2.LINEAR, l2.CLAMP_TO_EDGE), g2.updatePaintBuffers(d2)), Ui(g2, h2, p2, s3, i3);
|
||
const x2 = t2.translatePosMatrix(c3.posMatrix, s3, i3.paint.get("fill-extrusion-translate"), i3.paint.get("fill-extrusion-translate-anchor")), y2 = i3.paint.get("fill-extrusion-vertical-gradient"), b2 = u2 ? _e(x2, t2, y2, _2, c3, d2, s3) : de(x2, t2, y2, _2);
|
||
v2.draw(n2, n2.gl.TRIANGLES, a2, o2, r2, zi.backCCW, b2, f2, i3.id, m2.layoutVertexBuffer, m2.indexBuffer, m2.segments, i3.paint, t2.transform.zoom, g2, t2.style.map.terrain && m2.centroidVertexBuffer);
|
||
}
|
||
}
|
||
function ji(t2, e2, i3, s2, a2, o2, r2) {
|
||
const n2 = t2.context, l2 = n2.gl, h2 = i3.fbo;
|
||
if (!h2) return;
|
||
const c2 = t2.useProgram("hillshade"), u2 = t2.style.map.terrain && t2.style.map.terrain.getTerrainData(e2);
|
||
n2.activeTexture.set(l2.TEXTURE0), l2.bindTexture(l2.TEXTURE_2D, h2.colorAttachment.get()), c2.draw(n2, l2.TRIANGLES, a2, o2, r2, zi.disabled, ((t3, e3, i4, s3) => {
|
||
const a3 = i4.paint.get("hillshade-shadow-color"), o3 = i4.paint.get("hillshade-highlight-color"), r3 = i4.paint.get("hillshade-accent-color");
|
||
let n3 = i4.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
|
||
"viewport" === i4.paint.get("hillshade-illumination-anchor") && (n3 -= t3.transform.angle);
|
||
const l3 = !t3.options.moving;
|
||
return { u_matrix: s3 ? s3.posMatrix : t3.transform.calculatePosMatrix(e3.tileID.toUnwrapped(), l3), u_image: 0, u_latrange: Te(0, e3.tileID), u_light: [i4.paint.get("hillshade-exaggeration"), n3], u_shadow: a3, u_highlight: o3, u_accent: r3 };
|
||
})(t2, i3, s2, u2 ? e2 : null), u2, s2.id, t2.rasterBoundsBuffer, t2.quadTriangleIndexBuffer, t2.rasterBoundsSegments);
|
||
}
|
||
function Vi(e2, i3, s2, a2, o2, r2) {
|
||
const n2 = e2.context, l2 = n2.gl, h2 = i3.dem;
|
||
if (h2 && h2.data) {
|
||
const c2 = h2.dim, u2 = h2.stride, d2 = h2.getPixels();
|
||
if (n2.activeTexture.set(l2.TEXTURE1), n2.pixelStoreUnpackPremultiplyAlpha.set(false), i3.demTexture = i3.demTexture || e2.getTileTexture(u2), i3.demTexture) {
|
||
const t2 = i3.demTexture;
|
||
t2.update(d2, { premultiply: false }), t2.bind(l2.NEAREST, l2.CLAMP_TO_EDGE);
|
||
} else i3.demTexture = new x(n2, d2, l2.RGBA, { premultiply: false }), i3.demTexture.bind(l2.NEAREST, l2.CLAMP_TO_EDGE);
|
||
n2.activeTexture.set(l2.TEXTURE0);
|
||
let _2 = i3.fbo;
|
||
if (!_2) {
|
||
const t2 = new x(n2, { width: c2, height: c2, data: null }, l2.RGBA);
|
||
t2.bind(l2.LINEAR, l2.CLAMP_TO_EDGE), _2 = i3.fbo = n2.createFramebuffer(c2, c2, true, false), _2.colorAttachment.set(t2.texture);
|
||
}
|
||
n2.bindFramebuffer.set(_2.framebuffer), n2.viewport.set([0, 0, c2, c2]), e2.useProgram("hillshadePrepare").draw(n2, l2.TRIANGLES, a2, o2, r2, zi.disabled, ((e3, i4) => {
|
||
const s3 = i4.stride, a3 = t.Z();
|
||
return t.aS(a3, 0, t.N, -t.N, 0, 0, 1), t.$(a3, a3, [0, -t.N, 0]), { u_matrix: a3, u_image: 1, u_dimension: [s3, s3], u_zoom: e3.overscaledZ, u_unpack: i4.getUnpackVector() };
|
||
})(i3.tileID, h2), null, s2.id, e2.rasterBoundsBuffer, e2.quadTriangleIndexBuffer, e2.rasterBoundsSegments), i3.needsHillshadePrepare = false;
|
||
}
|
||
}
|
||
function qi(e2, i3, s2, a2, o2, r2) {
|
||
const n2 = a2.paint.get("raster-fade-duration");
|
||
if (!r2 && n2 > 0) {
|
||
const a3 = t.h.now(), r3 = (a3 - e2.timeAdded) / n2, l2 = i3 ? (a3 - i3.timeAdded) / n2 : -1, h2 = s2.getSource(), c2 = o2.coveringZoomLevel({ tileSize: h2.tileSize, roundZoom: h2.roundZoom }), u2 = !i3 || Math.abs(i3.tileID.overscaledZ - c2) > Math.abs(e2.tileID.overscaledZ - c2), d2 = u2 && e2.refreshedUponExpiration ? 1 : t.ad(u2 ? r3 : 1 - l2, 0, 1);
|
||
return e2.refreshedUponExpiration && r3 >= 1 && (e2.refreshedUponExpiration = false), i3 ? { opacity: 1, mix: 1 - d2 } : { opacity: d2, mix: 0 };
|
||
}
|
||
return { opacity: 1, mix: 0 };
|
||
}
|
||
const $i = new t.aT(1, 0, 0, 1), Wi = new t.aT(0, 1, 0, 1), Hi = new t.aT(0, 0, 1, 1), Xi = new t.aT(1, 0, 1, 1), Ki = new t.aT(0, 1, 1, 1);
|
||
function Qi(t2, e2, i3, s2) {
|
||
Ji(t2, 0, e2 + i3 / 2, t2.transform.width, i3, s2);
|
||
}
|
||
function Yi(t2, e2, i3, s2) {
|
||
Ji(t2, e2 - i3 / 2, 0, i3, t2.transform.height, s2);
|
||
}
|
||
function Ji(t2, e2, i3, s2, a2, o2) {
|
||
const r2 = t2.context, n2 = r2.gl;
|
||
n2.enable(n2.SCISSOR_TEST), n2.scissor(e2 * t2.pixelRatio, i3 * t2.pixelRatio, s2 * t2.pixelRatio, a2 * t2.pixelRatio), r2.clear({ color: o2 }), n2.disable(n2.SCISSOR_TEST);
|
||
}
|
||
function ts(e2, i3, s2) {
|
||
const a2 = e2.context, o2 = a2.gl, r2 = s2.posMatrix, n2 = e2.useProgram("debug"), l2 = Pi.disabled, h2 = Mi.disabled, c2 = e2.colorModeForRenderPass(), u2 = "$debug", d2 = e2.style.map.terrain && e2.style.map.terrain.getTerrainData(s2);
|
||
a2.activeTexture.set(o2.TEXTURE0);
|
||
const _2 = i3.getTileByID(s2.key).latestRawTileData, p2 = Math.floor((_2 && _2.byteLength || 0) / 1024), m2 = i3.getTile(s2).tileSize, f2 = 512 / Math.min(m2, 512) * (s2.overscaledZ / e2.transform.zoom) * 0.5;
|
||
let g2 = s2.canonical.toString();
|
||
s2.overscaledZ !== s2.canonical.z && (g2 += ` => ${s2.overscaledZ}`), (function(t2, e3) {
|
||
t2.initDebugOverlayCanvas();
|
||
const i4 = t2.debugOverlayCanvas, s3 = t2.context.gl, a3 = t2.debugOverlayCanvas.getContext("2d");
|
||
a3.clearRect(0, 0, i4.width, i4.height), a3.shadowColor = "white", a3.shadowBlur = 2, a3.lineWidth = 1.5, a3.strokeStyle = "white", a3.textBaseline = "top", a3.font = "bold 36px Open Sans, sans-serif", a3.fillText(e3, 5, 5), a3.strokeText(e3, 5, 5), t2.debugOverlayTexture.update(i4), t2.debugOverlayTexture.bind(s3.LINEAR, s3.CLAMP_TO_EDGE);
|
||
})(e2, `${g2} ${p2}kB`), n2.draw(a2, o2.TRIANGLES, l2, h2, Si.alphaBlended, zi.disabled, ye(r2, t.aT.transparent, f2), null, u2, e2.debugBuffer, e2.quadTriangleIndexBuffer, e2.debugSegments), n2.draw(a2, o2.LINE_STRIP, l2, h2, c2, zi.disabled, ye(r2, t.aT.red), d2, u2, e2.debugBuffer, e2.tileBorderIndexBuffer, e2.debugSegments);
|
||
}
|
||
function es(t2, e2, i3) {
|
||
const s2 = t2.context, a2 = s2.gl, o2 = t2.colorModeForRenderPass(), r2 = new Pi(a2.LEQUAL, Pi.ReadWrite, t2.depthRangeFor3D), n2 = t2.useProgram("terrain"), l2 = e2.getTerrainMesh();
|
||
s2.bindFramebuffer.set(null), s2.viewport.set([0, 0, t2.width, t2.height]);
|
||
for (const h2 of i3) {
|
||
const i4 = t2.renderToTexture.getTexture(h2), c2 = e2.getTerrainData(h2.tileID);
|
||
s2.activeTexture.set(a2.TEXTURE0), a2.bindTexture(a2.TEXTURE_2D, i4.texture);
|
||
const u2 = { u_matrix: t2.transform.calculatePosMatrix(h2.tileID.toUnwrapped()), u_texture: 0, u_ele_delta: e2.getMeshFrameDelta(t2.transform.zoom) };
|
||
n2.draw(s2, a2.TRIANGLES, r2, Mi.disabled, o2, zi.backCCW, u2, c2, "terrain", l2.vertexBuffer, l2.indexBuffer, l2.segments);
|
||
}
|
||
}
|
||
class is {
|
||
constructor(e2, i3) {
|
||
this.context = new Ci(e2), this.transform = i3, this._tileTextures = {}, this.terrainFacilitator = { dirty: true, matrix: t.Z(), renderTime: 0 }, this.setup(), this.numSublayers = K.maxUnderzooming + K.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new Yt();
|
||
}
|
||
resize(t2, e2, i3) {
|
||
if (this.width = Math.floor(t2 * i3), this.height = Math.floor(e2 * i3), this.pixelRatio = i3, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (const t3 of this.style._order) this.style._layers[t3].resize();
|
||
}
|
||
setup() {
|
||
const e2 = this.context, i3 = new t.a_();
|
||
i3.emplaceBack(0, 0), i3.emplaceBack(t.N, 0), i3.emplaceBack(0, t.N), i3.emplaceBack(t.N, t.N), this.tileExtentBuffer = e2.createVertexBuffer(i3, ae.members), this.tileExtentSegments = t.S.simpleSegment(0, 0, 4, 2);
|
||
const s2 = new t.a_();
|
||
s2.emplaceBack(0, 0), s2.emplaceBack(t.N, 0), s2.emplaceBack(0, t.N), s2.emplaceBack(t.N, t.N), this.debugBuffer = e2.createVertexBuffer(s2, ae.members), this.debugSegments = t.S.simpleSegment(0, 0, 4, 5);
|
||
const a2 = new t.V();
|
||
a2.emplaceBack(0, 0, 0, 0), a2.emplaceBack(t.N, 0, t.N, 0), a2.emplaceBack(0, t.N, 0, t.N), a2.emplaceBack(t.N, t.N, t.N, t.N), this.rasterBoundsBuffer = e2.createVertexBuffer(a2, O.members), this.rasterBoundsSegments = t.S.simpleSegment(0, 0, 4, 2);
|
||
const o2 = new t.a_();
|
||
o2.emplaceBack(0, 0), o2.emplaceBack(1, 0), o2.emplaceBack(0, 1), o2.emplaceBack(1, 1), this.viewportBuffer = e2.createVertexBuffer(o2, ae.members), this.viewportSegments = t.S.simpleSegment(0, 0, 4, 2);
|
||
const r2 = new t.a$();
|
||
r2.emplaceBack(0), r2.emplaceBack(1), r2.emplaceBack(3), r2.emplaceBack(2), r2.emplaceBack(0), this.tileBorderIndexBuffer = e2.createIndexBuffer(r2);
|
||
const n2 = new t.b0();
|
||
n2.emplaceBack(0, 1, 2), n2.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = e2.createIndexBuffer(n2);
|
||
const l2 = this.context.gl;
|
||
this.stencilClearMode = new Mi({ func: l2.ALWAYS, mask: 0 }, 0, 255, l2.ZERO, l2.ZERO, l2.ZERO);
|
||
}
|
||
clearStencil() {
|
||
const e2 = this.context, i3 = e2.gl;
|
||
this.nextStencilID = 1, this.currentStencilSource = void 0;
|
||
const s2 = t.Z();
|
||
t.aS(s2, 0, this.width, this.height, 0, 0, 1), t.a0(s2, s2, [i3.drawingBufferWidth, i3.drawingBufferHeight, 0]), this.useProgram("clippingMask").draw(e2, i3.TRIANGLES, Pi.disabled, this.stencilClearMode, Si.disabled, zi.disabled, be(s2), null, "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);
|
||
}
|
||
_renderTileClippingMasks(t2, e2) {
|
||
if (this.currentStencilSource === t2.source || !t2.isTileClipped() || !e2 || !e2.length) return;
|
||
this.currentStencilSource = t2.source;
|
||
const i3 = this.context, s2 = i3.gl;
|
||
this.nextStencilID + e2.length > 256 && this.clearStencil(), i3.setColorMode(Si.disabled), i3.setDepthMode(Pi.disabled);
|
||
const a2 = this.useProgram("clippingMask");
|
||
this._tileClippingMaskIDs = {};
|
||
for (const t3 of e2) {
|
||
const e3 = this._tileClippingMaskIDs[t3.key] = this.nextStencilID++, o2 = this.style.map.terrain && this.style.map.terrain.getTerrainData(t3);
|
||
a2.draw(i3, s2.TRIANGLES, Pi.disabled, new Mi({ func: s2.ALWAYS, mask: 0 }, e3, 255, s2.KEEP, s2.KEEP, s2.REPLACE), Si.disabled, zi.disabled, be(t3.posMatrix), o2, "$clipping", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);
|
||
}
|
||
}
|
||
stencilModeFor3D() {
|
||
this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();
|
||
const t2 = this.nextStencilID++, e2 = this.context.gl;
|
||
return new Mi({ func: e2.NOTEQUAL, mask: 255 }, t2, 255, e2.KEEP, e2.KEEP, e2.REPLACE);
|
||
}
|
||
stencilModeForClipping(t2) {
|
||
const e2 = this.context.gl;
|
||
return new Mi({ func: e2.EQUAL, mask: 255 }, this._tileClippingMaskIDs[t2.key], 0, e2.KEEP, e2.KEEP, e2.REPLACE);
|
||
}
|
||
stencilConfigForOverlap(t2) {
|
||
const e2 = this.context.gl, i3 = t2.sort(((t3, e3) => e3.overscaledZ - t3.overscaledZ)), s2 = i3[i3.length - 1].overscaledZ, a2 = i3[0].overscaledZ - s2 + 1;
|
||
if (a2 > 1) {
|
||
this.currentStencilSource = void 0, this.nextStencilID + a2 > 256 && this.clearStencil();
|
||
const t3 = {};
|
||
for (let i4 = 0; i4 < a2; i4++) t3[i4 + s2] = new Mi({ func: e2.GEQUAL, mask: 255 }, i4 + this.nextStencilID, 255, e2.KEEP, e2.KEEP, e2.REPLACE);
|
||
return this.nextStencilID += a2, [t3, i3];
|
||
}
|
||
return [{ [s2]: Mi.disabled }, i3];
|
||
}
|
||
colorModeForRenderPass() {
|
||
const e2 = this.context.gl;
|
||
if (this._showOverdrawInspector) {
|
||
const i3 = 1 / 8;
|
||
return new Si([e2.CONSTANT_COLOR, e2.ONE], new t.aT(i3, i3, i3, 0), [true, true, true, true]);
|
||
}
|
||
return "opaque" === this.renderPass ? Si.unblended : Si.alphaBlended;
|
||
}
|
||
depthModeForSublayer(t2, e2, i3) {
|
||
if (!this.opaquePassEnabledForLayer()) return Pi.disabled;
|
||
const s2 = 1 - ((1 + this.currentLayer) * this.numSublayers + t2) * this.depthEpsilon;
|
||
return new Pi(i3 || this.context.gl.LEQUAL, e2, [s2, s2]);
|
||
}
|
||
opaquePassEnabledForLayer() {
|
||
return this.currentLayer < this.opaquePassCutoff;
|
||
}
|
||
render(e2, i3) {
|
||
this.style = e2, this.options = i3, this.lineAtlas = e2.lineAtlas, this.imageManager = e2.imageManager, this.glyphManager = e2.glyphManager, this.symbolFadeChange = e2.placement.symbolFadeChange(t.h.now()), this.imageManager.beginFrame();
|
||
const s2 = this.style._order, a2 = this.style.sourceCaches, o2 = {}, r2 = {}, n2 = {};
|
||
for (const t2 in a2) {
|
||
const e3 = a2[t2];
|
||
e3.used && e3.prepare(this.context), o2[t2] = e3.getVisibleCoordinates(), r2[t2] = o2[t2].slice().reverse(), n2[t2] = e3.getVisibleCoordinates(true).reverse();
|
||
}
|
||
this.opaquePassCutoff = 1 / 0;
|
||
for (let t2 = 0; t2 < s2.length; t2++) if (this.style._layers[s2[t2]].is3D()) {
|
||
this.opaquePassCutoff = t2;
|
||
break;
|
||
}
|
||
if (this.renderToTexture) {
|
||
this.renderToTexture.prepareForRender(this.style, this.transform.zoom), this.opaquePassCutoff = 0;
|
||
const e3 = this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);
|
||
(this.terrainFacilitator.dirty || !t.b1(this.terrainFacilitator.matrix, this.transform.projMatrix) || e3.length) && (t.b2(this.terrainFacilitator.matrix, this.transform.projMatrix), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.dirty = false, (function(e4, i4) {
|
||
const s3 = e4.context, a3 = s3.gl, o3 = Si.unblended, r3 = new Pi(a3.LEQUAL, Pi.ReadWrite, [0, 1]), n3 = i4.getTerrainMesh(), l2 = i4.sourceCache.getRenderableTiles(), h2 = e4.useProgram("terrainDepth");
|
||
s3.bindFramebuffer.set(i4.getFramebuffer("depth").framebuffer), s3.viewport.set([0, 0, e4.width / devicePixelRatio, e4.height / devicePixelRatio]), s3.clear({ color: t.aT.transparent, depth: 1 });
|
||
for (const t2 of l2) {
|
||
const l3 = i4.getTerrainData(t2.tileID), c2 = { u_matrix: e4.transform.calculatePosMatrix(t2.tileID.toUnwrapped()), u_ele_delta: i4.getMeshFrameDelta(e4.transform.zoom) };
|
||
h2.draw(s3, a3.TRIANGLES, r3, Mi.disabled, o3, zi.backCCW, c2, l3, "terrain", n3.vertexBuffer, n3.indexBuffer, n3.segments);
|
||
}
|
||
s3.bindFramebuffer.set(null), s3.viewport.set([0, 0, e4.width, e4.height]);
|
||
})(this, this.style.map.terrain), (function(e4, i4) {
|
||
const s3 = e4.context, a3 = s3.gl, o3 = Si.unblended, r3 = new Pi(a3.LEQUAL, Pi.ReadWrite, [0, 1]), n3 = i4.getTerrainMesh(), l2 = i4.getCoordsTexture(), h2 = i4.sourceCache.getRenderableTiles(), c2 = e4.useProgram("terrainCoords");
|
||
s3.bindFramebuffer.set(i4.getFramebuffer("coords").framebuffer), s3.viewport.set([0, 0, e4.width / devicePixelRatio, e4.height / devicePixelRatio]), s3.clear({ color: t.aT.transparent, depth: 1 }), i4.coordsIndex = [];
|
||
for (const t2 of h2) {
|
||
const h3 = i4.getTerrainData(t2.tileID);
|
||
s3.activeTexture.set(a3.TEXTURE0), a3.bindTexture(a3.TEXTURE_2D, l2.texture);
|
||
const u2 = { u_matrix: e4.transform.calculatePosMatrix(t2.tileID.toUnwrapped()), u_terrain_coords_id: (255 - i4.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: i4.getMeshFrameDelta(e4.transform.zoom) };
|
||
c2.draw(s3, a3.TRIANGLES, r3, Mi.disabled, o3, zi.backCCW, u2, h3, "terrain", n3.vertexBuffer, n3.indexBuffer, n3.segments), i4.coordsIndex.push(t2.tileID.key);
|
||
}
|
||
s3.bindFramebuffer.set(null), s3.viewport.set([0, 0, e4.width, e4.height]);
|
||
})(this, this.style.map.terrain));
|
||
}
|
||
this.renderPass = "offscreen";
|
||
for (const t2 of s2) {
|
||
const e3 = this.style._layers[t2];
|
||
if (!e3.hasOffscreenPass() || e3.isHidden(this.transform.zoom)) continue;
|
||
const i4 = r2[e3.source];
|
||
("custom" === e3.type || i4.length) && this.renderLayer(this, a2[e3.source], e3, i4);
|
||
}
|
||
if (this.context.bindFramebuffer.set(null), this.context.clear({ color: i3.showOverdrawInspector ? t.aT.black : t.aT.transparent, depth: 1 }), this.clearStencil(), this._showOverdrawInspector = i3.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (e2._order.length + 2) * this.numSublayers * this.depthEpsilon], !this.renderToTexture) for (this.renderPass = "opaque", this.currentLayer = s2.length - 1; this.currentLayer >= 0; this.currentLayer--) {
|
||
const t2 = this.style._layers[s2[this.currentLayer]], e3 = a2[t2.source], i4 = o2[t2.source];
|
||
this._renderTileClippingMasks(t2, i4), this.renderLayer(this, e3, t2, i4);
|
||
}
|
||
for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < s2.length; this.currentLayer++) {
|
||
const t2 = this.style._layers[s2[this.currentLayer]], e3 = a2[t2.source];
|
||
if (this.renderToTexture && this.renderToTexture.renderLayer(t2)) continue;
|
||
const i4 = ("symbol" === t2.type ? n2 : r2)[t2.source];
|
||
this._renderTileClippingMasks(t2, o2[t2.source]), this.renderLayer(this, e3, t2, i4);
|
||
}
|
||
if (this.options.showTileBoundaries) {
|
||
const t2 = (function(t3, e3) {
|
||
let i4 = null;
|
||
const s3 = Object.values(t3._layers).flatMap(((i5) => i5.source && !i5.isHidden(e3) ? [t3.sourceCaches[i5.source]] : [])), a3 = s3.filter(((t4) => "vector" === t4.getSource().type)), o3 = s3.filter(((t4) => "vector" !== t4.getSource().type)), r3 = (t4) => {
|
||
(!i4 || i4.getSource().maxzoom < t4.getSource().maxzoom) && (i4 = t4);
|
||
};
|
||
return a3.forEach(((t4) => r3(t4))), i4 || o3.forEach(((t4) => r3(t4))), i4;
|
||
})(this.style, this.transform.zoom);
|
||
t2 && (function(t3, e3, i4) {
|
||
for (let s3 = 0; s3 < i4.length; s3++) ts(t3, e3, i4[s3]);
|
||
})(this, t2, t2.getVisibleCoordinates());
|
||
}
|
||
this.options.showPadding && (function(t2) {
|
||
const e3 = t2.transform.padding;
|
||
Qi(t2, t2.transform.height - (e3.top || 0), 3, $i), Qi(t2, e3.bottom || 0, 3, Wi), Yi(t2, e3.left || 0, 3, Hi), Yi(t2, t2.transform.width - (e3.right || 0), 3, Xi);
|
||
const i4 = t2.transform.centerPoint;
|
||
!(function(t3, e4, i5, s3) {
|
||
Ji(t3, e4 - 1, i5 - 10, 2, 20, s3), Ji(t3, e4 - 10, i5 - 1, 20, 2, s3);
|
||
})(t2, i4.x, t2.transform.height - i4.y, Ki);
|
||
})(this), this.context.setDefault();
|
||
}
|
||
renderLayer(e2, i3, s2, a2) {
|
||
if (!s2.isHidden(this.transform.zoom) && ("background" === s2.type || "custom" === s2.type || (a2 || []).length)) switch (this.id = s2.id, s2.type) {
|
||
case "symbol":
|
||
!(function(e3, i4, s3, a3, o2) {
|
||
if ("translucent" !== e3.renderPass) return;
|
||
const r2 = Mi.disabled, n2 = e3.colorModeForRenderPass();
|
||
(s3._unevaluatedLayout.hasValue("text-variable-anchor") || s3._unevaluatedLayout.hasValue("text-variable-anchor-offset")) && (function(e4, i5, s4, a4, o3, r3, n3) {
|
||
const l2 = i5.transform, h2 = "map" === o3, c2 = "map" === r3;
|
||
for (const o4 of e4) {
|
||
const e5 = a4.getTile(o4), r4 = e5.getBucket(s4);
|
||
if (!r4 || !r4.text || !r4.text.segments.get().length) continue;
|
||
const u2 = t.ah(r4.textSizeData, l2.zoom), d2 = St(e5, 1, i5.transform.zoom), _2 = nt(o4.posMatrix, c2, h2, i5.transform, d2), p2 = "none" !== s4.layout.get("icon-text-fit") && r4.hasIconData();
|
||
if (u2) {
|
||
const t2 = Math.pow(2, l2.zoom - e5.tileID.overscaledZ);
|
||
Fi(r4, h2, c2, n3, l2, _2, o4.posMatrix, t2, u2, p2, i5.style.map.terrain ? (t3, e6) => i5.style.map.terrain.getElevation(o4, t3, e6) : null);
|
||
}
|
||
}
|
||
})(a3, e3, s3, i4, s3.layout.get("text-rotation-alignment"), s3.layout.get("text-pitch-alignment"), o2), 0 !== s3.paint.get("icon-opacity").constantOr(1) && Oi(e3, i4, s3, a3, false, s3.paint.get("icon-translate"), s3.paint.get("icon-translate-anchor"), s3.layout.get("icon-rotation-alignment"), s3.layout.get("icon-pitch-alignment"), s3.layout.get("icon-keep-upright"), r2, n2), 0 !== s3.paint.get("text-opacity").constantOr(1) && Oi(e3, i4, s3, a3, true, s3.paint.get("text-translate"), s3.paint.get("text-translate-anchor"), s3.layout.get("text-rotation-alignment"), s3.layout.get("text-pitch-alignment"), s3.layout.get("text-keep-upright"), r2, n2), i4.map.showCollisionBoxes && (Ai(e3, i4, s3, a3, s3.paint.get("text-translate"), s3.paint.get("text-translate-anchor"), true), Ai(e3, i4, s3, a3, s3.paint.get("icon-translate"), s3.paint.get("icon-translate-anchor"), false));
|
||
})(e2, i3, s2, a2, this.style.placement.variableOffsets);
|
||
break;
|
||
case "circle":
|
||
!(function(e3, i4, s3, a3) {
|
||
if ("translucent" !== e3.renderPass) return;
|
||
const o2 = s3.paint.get("circle-opacity"), r2 = s3.paint.get("circle-stroke-width"), n2 = s3.paint.get("circle-stroke-opacity"), l2 = !s3.layout.get("circle-sort-key").isConstant();
|
||
if (0 === o2.constantOr(1) && (0 === r2.constantOr(1) || 0 === n2.constantOr(1))) return;
|
||
const h2 = e3.context, c2 = h2.gl, u2 = e3.depthModeForSublayer(0, Pi.ReadOnly), d2 = Mi.disabled, _2 = e3.colorModeForRenderPass(), p2 = [];
|
||
for (let o3 = 0; o3 < a3.length; o3++) {
|
||
const r3 = a3[o3], n3 = i4.getTile(r3), h3 = n3.getBucket(s3);
|
||
if (!h3) continue;
|
||
const c3 = h3.programConfigurations.get(s3.id), u3 = e3.useProgram("circle", c3), d3 = h3.layoutVertexBuffer, _3 = h3.indexBuffer, m2 = e3.style.map.terrain && e3.style.map.terrain.getTerrainData(r3), f2 = { programConfiguration: c3, program: u3, layoutVertexBuffer: d3, indexBuffer: _3, uniformValues: ve(e3, r3, n3, s3), terrainData: m2 };
|
||
if (l2) {
|
||
const e4 = h3.segments.get();
|
||
for (const i5 of e4) p2.push({ segments: new t.S([i5]), sortKey: i5.sortKey, state: f2 });
|
||
} else p2.push({ segments: h3.segments, sortKey: 0, state: f2 });
|
||
}
|
||
l2 && p2.sort(((t2, e4) => t2.sortKey - e4.sortKey));
|
||
for (const t2 of p2) {
|
||
const { programConfiguration: i5, program: a4, layoutVertexBuffer: o3, indexBuffer: r3, uniformValues: n3, terrainData: l3 } = t2.state;
|
||
a4.draw(h2, c2.TRIANGLES, u2, d2, _2, zi.disabled, n3, l3, s3.id, o3, r3, t2.segments, s3.paint, e3.transform.zoom, i5);
|
||
}
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "heatmap":
|
||
!(function(e3, i4, s3, a3) {
|
||
if (0 !== s3.paint.get("heatmap-opacity")) if ("offscreen" === e3.renderPass) {
|
||
const o2 = e3.context, r2 = o2.gl, n2 = Mi.disabled, l2 = new Si([r2.ONE, r2.ONE], t.aT.transparent, [true, true, true, true]);
|
||
!(function(t2, e4, i5) {
|
||
const s4 = t2.gl;
|
||
t2.activeTexture.set(s4.TEXTURE1), t2.viewport.set([0, 0, e4.width / 4, e4.height / 4]);
|
||
let a4 = i5.heatmapFbo;
|
||
if (a4) s4.bindTexture(s4.TEXTURE_2D, a4.colorAttachment.get()), t2.bindFramebuffer.set(a4.framebuffer);
|
||
else {
|
||
const o3 = s4.createTexture();
|
||
s4.bindTexture(s4.TEXTURE_2D, o3), s4.texParameteri(s4.TEXTURE_2D, s4.TEXTURE_WRAP_S, s4.CLAMP_TO_EDGE), s4.texParameteri(s4.TEXTURE_2D, s4.TEXTURE_WRAP_T, s4.CLAMP_TO_EDGE), s4.texParameteri(s4.TEXTURE_2D, s4.TEXTURE_MIN_FILTER, s4.LINEAR), s4.texParameteri(s4.TEXTURE_2D, s4.TEXTURE_MAG_FILTER, s4.LINEAR), a4 = i5.heatmapFbo = t2.createFramebuffer(e4.width / 4, e4.height / 4, false, false), (function(t3, e5, i6, s5) {
|
||
var a5, o4;
|
||
const r3 = t3.gl, n3 = null !== (a5 = t3.HALF_FLOAT) && void 0 !== a5 ? a5 : r3.UNSIGNED_BYTE, l3 = null !== (o4 = t3.RGBA16F) && void 0 !== o4 ? o4 : r3.RGBA;
|
||
r3.texImage2D(r3.TEXTURE_2D, 0, l3, e5.width / 4, e5.height / 4, 0, r3.RGBA, n3, null), s5.colorAttachment.set(i6);
|
||
})(t2, e4, o3, a4);
|
||
}
|
||
})(o2, e3, s3), o2.clear({ color: t.aT.transparent });
|
||
for (let t2 = 0; t2 < a3.length; t2++) {
|
||
const h2 = a3[t2];
|
||
if (i4.hasRenderableParent(h2)) continue;
|
||
const c2 = i4.getTile(h2), u2 = c2.getBucket(s3);
|
||
if (!u2) continue;
|
||
const d2 = u2.programConfigurations.get(s3.id), _2 = e3.useProgram("heatmap", d2), { zoom: p2 } = e3.transform;
|
||
_2.draw(o2, r2.TRIANGLES, Pi.disabled, n2, l2, zi.disabled, we(h2.posMatrix, c2, p2, s3.paint.get("heatmap-intensity")), null, s3.id, u2.layoutVertexBuffer, u2.indexBuffer, u2.segments, s3.paint, e3.transform.zoom, d2);
|
||
}
|
||
o2.viewport.set([0, 0, e3.width, e3.height]);
|
||
} else "translucent" === e3.renderPass && (e3.context.setColorMode(e3.colorModeForRenderPass()), (function(e4, i5) {
|
||
const s4 = e4.context, a4 = s4.gl, o2 = i5.heatmapFbo;
|
||
if (!o2) return;
|
||
s4.activeTexture.set(a4.TEXTURE0), a4.bindTexture(a4.TEXTURE_2D, o2.colorAttachment.get()), s4.activeTexture.set(a4.TEXTURE1);
|
||
let r2 = i5.colorRampTexture;
|
||
r2 || (r2 = i5.colorRampTexture = new x(s4, i5.colorRamp, a4.RGBA)), r2.bind(a4.LINEAR, a4.CLAMP_TO_EDGE), e4.useProgram("heatmapTexture").draw(s4, a4.TRIANGLES, Pi.disabled, Mi.disabled, e4.colorModeForRenderPass(), zi.disabled, ((e5, i6, s5, a5) => {
|
||
const o3 = t.Z();
|
||
t.aS(o3, 0, e5.width, e5.height, 0, 0, 1);
|
||
const r3 = e5.context.gl;
|
||
return { u_matrix: o3, u_world: [r3.drawingBufferWidth, r3.drawingBufferHeight], u_image: 0, u_color_ramp: 1, u_opacity: i6.paint.get("heatmap-opacity") };
|
||
})(e4, i5), null, i5.id, e4.viewportBuffer, e4.quadTriangleIndexBuffer, e4.viewportSegments, i5.paint, e4.transform.zoom);
|
||
})(e3, s3));
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "line":
|
||
!(function(e3, i4, s3, a3) {
|
||
if ("translucent" !== e3.renderPass) return;
|
||
const o2 = s3.paint.get("line-opacity"), r2 = s3.paint.get("line-width");
|
||
if (0 === o2.constantOr(1) || 0 === r2.constantOr(1)) return;
|
||
const n2 = e3.depthModeForSublayer(0, Pi.ReadOnly), l2 = e3.colorModeForRenderPass(), h2 = s3.paint.get("line-dasharray"), c2 = s3.paint.get("line-pattern"), u2 = c2.constantOr(1), d2 = s3.paint.get("line-gradient"), _2 = s3.getCrossfadeParameters(), p2 = u2 ? "linePattern" : h2 ? "lineSDF" : d2 ? "lineGradient" : "line", m2 = e3.context, f2 = m2.gl;
|
||
let g2 = true;
|
||
for (const o3 of a3) {
|
||
const a4 = i4.getTile(o3);
|
||
if (u2 && !a4.patternsLoaded()) continue;
|
||
const r3 = a4.getBucket(s3);
|
||
if (!r3) continue;
|
||
const v2 = r3.programConfigurations.get(s3.id), y2 = e3.context.program.get(), b2 = e3.useProgram(p2, v2), w2 = g2 || b2.program !== y2, T2 = e3.style.map.terrain && e3.style.map.terrain.getTerrainData(o3), I2 = c2.constantOr(null);
|
||
if (I2 && a4.imageAtlas) {
|
||
const t2 = a4.imageAtlas, e4 = t2.patternPositions[I2.to.toString()], i5 = t2.patternPositions[I2.from.toString()];
|
||
e4 && i5 && v2.setConstantPatternPositions(e4, i5);
|
||
}
|
||
const E2 = T2 ? o3 : null, S2 = u2 ? Se(e3, a4, s3, _2, E2) : h2 ? Ce(e3, a4, s3, h2, _2, E2) : d2 ? Ee(e3, a4, s3, r3.lineClipsArray.length, E2) : Ie(e3, a4, s3, E2);
|
||
if (u2) m2.activeTexture.set(f2.TEXTURE0), a4.imageAtlasTexture.bind(f2.LINEAR, f2.CLAMP_TO_EDGE), v2.updatePaintBuffers(_2);
|
||
else if (h2 && (w2 || e3.lineAtlas.dirty)) m2.activeTexture.set(f2.TEXTURE0), e3.lineAtlas.bind(m2);
|
||
else if (d2) {
|
||
const a5 = r3.gradients[s3.id];
|
||
let n3 = a5.texture;
|
||
if (s3.gradientVersion !== a5.version) {
|
||
let l3 = 256;
|
||
if (s3.stepInterpolant) {
|
||
const s4 = i4.getSource().maxzoom, a6 = o3.canonical.z === s4 ? Math.ceil(1 << e3.transform.maxZoom - o3.canonical.z) : 1;
|
||
l3 = t.ad(t.aY(r3.maxLineLength / t.N * 1024 * a6), 256, m2.maxTextureSize);
|
||
}
|
||
a5.gradient = t.aZ({ expression: s3.gradientExpression(), evaluationKey: "lineProgress", resolution: l3, image: a5.gradient || void 0, clips: r3.lineClipsArray }), a5.texture ? a5.texture.update(a5.gradient) : a5.texture = new x(m2, a5.gradient, f2.RGBA), a5.version = s3.gradientVersion, n3 = a5.texture;
|
||
}
|
||
m2.activeTexture.set(f2.TEXTURE0), n3.bind(s3.stepInterpolant ? f2.NEAREST : f2.LINEAR, f2.CLAMP_TO_EDGE);
|
||
}
|
||
b2.draw(m2, f2.TRIANGLES, n2, e3.stencilModeForClipping(o3), l2, zi.disabled, S2, T2, s3.id, r3.layoutVertexBuffer, r3.indexBuffer, r3.segments, s3.paint, e3.transform.zoom, v2, r3.layoutVertexBuffer2), g2 = false;
|
||
}
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "fill":
|
||
!(function(e3, i4, s3, a3) {
|
||
const o2 = s3.paint.get("fill-color"), r2 = s3.paint.get("fill-opacity");
|
||
if (0 === r2.constantOr(1)) return;
|
||
const n2 = e3.colorModeForRenderPass(), l2 = s3.paint.get("fill-pattern"), h2 = e3.opaquePassEnabledForLayer() && !l2.constantOr(1) && 1 === o2.constantOr(t.aT.transparent).a && 1 === r2.constantOr(0) ? "opaque" : "translucent";
|
||
if (e3.renderPass === h2) {
|
||
const t2 = e3.depthModeForSublayer(1, "opaque" === e3.renderPass ? Pi.ReadWrite : Pi.ReadOnly);
|
||
Zi(e3, i4, s3, a3, t2, n2, false);
|
||
}
|
||
if ("translucent" === e3.renderPass && s3.paint.get("fill-antialias")) {
|
||
const t2 = e3.depthModeForSublayer(s3.getPaintProperty("fill-outline-color") ? 2 : 0, Pi.ReadOnly);
|
||
Zi(e3, i4, s3, a3, t2, n2, true);
|
||
}
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "fill-extrusion":
|
||
!(function(t2, e3, i4, s3) {
|
||
const a3 = i4.paint.get("fill-extrusion-opacity");
|
||
if (0 !== a3 && "translucent" === t2.renderPass) {
|
||
const o2 = new Pi(t2.context.gl.LEQUAL, Pi.ReadWrite, t2.depthRangeFor3D);
|
||
if (1 !== a3 || i4.paint.get("fill-extrusion-pattern").constantOr(1)) Gi(t2, e3, i4, s3, o2, Mi.disabled, Si.disabled), Gi(t2, e3, i4, s3, o2, t2.stencilModeFor3D(), t2.colorModeForRenderPass());
|
||
else {
|
||
const a4 = t2.colorModeForRenderPass();
|
||
Gi(t2, e3, i4, s3, o2, Mi.disabled, a4);
|
||
}
|
||
}
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "hillshade":
|
||
!(function(t2, e3, i4, s3) {
|
||
if ("offscreen" !== t2.renderPass && "translucent" !== t2.renderPass) return;
|
||
const a3 = t2.context, o2 = t2.depthModeForSublayer(0, Pi.ReadOnly), r2 = t2.colorModeForRenderPass(), [n2, l2] = "translucent" === t2.renderPass ? t2.stencilConfigForOverlap(s3) : [{}, s3];
|
||
for (const s4 of l2) {
|
||
const a4 = e3.getTile(s4);
|
||
void 0 !== a4.needsHillshadePrepare && a4.needsHillshadePrepare && "offscreen" === t2.renderPass ? Vi(t2, a4, i4, o2, Mi.disabled, r2) : "translucent" === t2.renderPass && ji(t2, s4, a4, i4, o2, n2[s4.overscaledZ], r2);
|
||
}
|
||
a3.viewport.set([0, 0, t2.width, t2.height]);
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "raster":
|
||
!(function(t2, e3, i4, s3) {
|
||
if ("translucent" !== t2.renderPass) return;
|
||
if (0 === i4.paint.get("raster-opacity")) return;
|
||
if (!s3.length) return;
|
||
const a3 = t2.context, o2 = a3.gl, r2 = e3.getSource(), n2 = t2.useProgram("raster"), l2 = t2.colorModeForRenderPass(), [h2, c2] = r2 instanceof N ? [{}, s3] : t2.stencilConfigForOverlap(s3), u2 = c2[c2.length - 1].overscaledZ, d2 = !t2.options.moving;
|
||
for (const s4 of c2) {
|
||
const c3 = t2.depthModeForSublayer(s4.overscaledZ - u2, 1 === i4.paint.get("raster-opacity") ? Pi.ReadWrite : Pi.ReadOnly, o2.LESS), _2 = e3.getTile(s4);
|
||
_2.registerFadeDuration(i4.paint.get("raster-fade-duration"));
|
||
const p2 = e3.findLoadedParent(s4, 0), m2 = qi(_2, p2, e3, i4, t2.transform, t2.style.map.terrain);
|
||
let f2, g2;
|
||
const v2 = "nearest" === i4.paint.get("raster-resampling") ? o2.NEAREST : o2.LINEAR;
|
||
a3.activeTexture.set(o2.TEXTURE0), _2.texture.bind(v2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), a3.activeTexture.set(o2.TEXTURE1), p2 ? (p2.texture.bind(v2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST), f2 = Math.pow(2, p2.tileID.overscaledZ - _2.tileID.overscaledZ), g2 = [_2.tileID.canonical.x * f2 % 1, _2.tileID.canonical.y * f2 % 1]) : _2.texture.bind(v2, o2.CLAMP_TO_EDGE, o2.LINEAR_MIPMAP_NEAREST);
|
||
const x2 = t2.style.map.terrain && t2.style.map.terrain.getTerrainData(s4), y2 = x2 ? s4 : null, b2 = y2 ? y2.posMatrix : t2.transform.calculatePosMatrix(s4.toUnwrapped(), d2), w2 = Me(b2, g2 || [0, 0], f2 || 1, m2, i4);
|
||
r2 instanceof N ? n2.draw(a3, o2.TRIANGLES, c3, Mi.disabled, l2, zi.disabled, w2, x2, i4.id, r2.boundsBuffer, t2.quadTriangleIndexBuffer, r2.boundsSegments) : n2.draw(a3, o2.TRIANGLES, c3, h2[s4.overscaledZ], l2, zi.disabled, w2, x2, i4.id, t2.rasterBoundsBuffer, t2.quadTriangleIndexBuffer, t2.rasterBoundsSegments);
|
||
}
|
||
})(e2, i3, s2, a2);
|
||
break;
|
||
case "background":
|
||
!(function(t2, e3, i4, s3) {
|
||
const a3 = i4.paint.get("background-color"), o2 = i4.paint.get("background-opacity");
|
||
if (0 === o2) return;
|
||
const r2 = t2.context, n2 = r2.gl, l2 = t2.transform, h2 = l2.tileSize, c2 = i4.paint.get("background-pattern");
|
||
if (t2.isPatternMissing(c2)) return;
|
||
const u2 = !c2 && 1 === a3.a && 1 === o2 && t2.opaquePassEnabledForLayer() ? "opaque" : "translucent";
|
||
if (t2.renderPass !== u2) return;
|
||
const d2 = Mi.disabled, _2 = t2.depthModeForSublayer(0, "opaque" === u2 ? Pi.ReadWrite : Pi.ReadOnly), p2 = t2.colorModeForRenderPass(), m2 = t2.useProgram(c2 ? "backgroundPattern" : "background"), f2 = s3 || l2.coveringTiles({ tileSize: h2, terrain: t2.style.map.terrain });
|
||
c2 && (r2.activeTexture.set(n2.TEXTURE0), t2.imageManager.bind(t2.context));
|
||
const g2 = i4.getCrossfadeParameters();
|
||
for (const e4 of f2) {
|
||
const l3 = s3 ? e4.posMatrix : t2.transform.calculatePosMatrix(e4.toUnwrapped()), u3 = c2 ? Fe(l3, o2, t2, c2, { tileID: e4, tileSize: h2 }, g2) : ke(l3, o2, a3), f3 = t2.style.map.terrain && t2.style.map.terrain.getTerrainData(e4);
|
||
m2.draw(r2, n2.TRIANGLES, _2, d2, p2, zi.disabled, u3, f3, i4.id, t2.tileExtentBuffer, t2.quadTriangleIndexBuffer, t2.tileExtentSegments);
|
||
}
|
||
})(e2, 0, s2, a2);
|
||
break;
|
||
case "custom":
|
||
!(function(t2, e3, i4) {
|
||
const s3 = t2.context, a3 = i4.implementation;
|
||
if ("offscreen" === t2.renderPass) {
|
||
const e4 = a3.prerender;
|
||
e4 && (t2.setCustomLayerDefaults(), s3.setColorMode(t2.colorModeForRenderPass()), e4.call(a3, s3.gl, t2.transform.customLayerMatrix()), s3.setDirty(), t2.setBaseState());
|
||
} else if ("translucent" === t2.renderPass) {
|
||
t2.setCustomLayerDefaults(), s3.setColorMode(t2.colorModeForRenderPass()), s3.setStencilMode(Mi.disabled);
|
||
const e4 = "3d" === a3.renderingMode ? new Pi(t2.context.gl.LEQUAL, Pi.ReadWrite, t2.depthRangeFor3D) : t2.depthModeForSublayer(0, Pi.ReadOnly);
|
||
s3.setDepthMode(e4), a3.render(s3.gl, t2.transform.customLayerMatrix()), s3.setDirty(), t2.setBaseState(), s3.bindFramebuffer.set(null);
|
||
}
|
||
})(e2, 0, s2);
|
||
}
|
||
}
|
||
translatePosMatrix(e2, i3, s2, a2, o2) {
|
||
if (!s2[0] && !s2[1]) return e2;
|
||
const r2 = o2 ? "map" === a2 ? this.transform.angle : 0 : "viewport" === a2 ? -this.transform.angle : 0;
|
||
if (r2) {
|
||
const t2 = Math.sin(r2), e3 = Math.cos(r2);
|
||
s2 = [s2[0] * e3 - s2[1] * t2, s2[0] * t2 + s2[1] * e3];
|
||
}
|
||
const n2 = [o2 ? s2[0] : St(i3, s2[0], this.transform.zoom), o2 ? s2[1] : St(i3, s2[1], this.transform.zoom), 0], l2 = new Float32Array(16);
|
||
return t.$(l2, e2, n2), l2;
|
||
}
|
||
saveTileTexture(t2) {
|
||
const e2 = this._tileTextures[t2.size[0]];
|
||
e2 ? e2.push(t2) : this._tileTextures[t2.size[0]] = [t2];
|
||
}
|
||
getTileTexture(t2) {
|
||
const e2 = this._tileTextures[t2];
|
||
return e2 && e2.length > 0 ? e2.pop() : null;
|
||
}
|
||
isPatternMissing(t2) {
|
||
if (!t2) return false;
|
||
if (!t2.from || !t2.to) return true;
|
||
const e2 = this.imageManager.getPattern(t2.from.toString()), i3 = this.imageManager.getPattern(t2.to.toString());
|
||
return !e2 || !i3;
|
||
}
|
||
useProgram(t2, e2) {
|
||
this.cache = this.cache || {};
|
||
const i3 = t2 + (e2 ? e2.cacheKey : "") + (this._showOverdrawInspector ? "/overdraw" : "") + (this.style.map.terrain ? "/terrain" : "");
|
||
return this.cache[i3] || (this.cache[i3] = new ce(this.context, re[t2], e2, Be[t2], this._showOverdrawInspector, this.style.map.terrain)), this.cache[i3];
|
||
}
|
||
setCustomLayerDefaults() {
|
||
this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault();
|
||
}
|
||
setBaseState() {
|
||
const t2 = this.context.gl;
|
||
this.context.cullFace.set(false), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(t2.FUNC_ADD);
|
||
}
|
||
initDebugOverlayCanvas() {
|
||
null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new x(this.context, this.debugOverlayCanvas, this.context.gl.RGBA));
|
||
}
|
||
destroy() {
|
||
this.debugOverlayTexture && this.debugOverlayTexture.destroy();
|
||
}
|
||
overLimit() {
|
||
const { drawingBufferWidth: t2, drawingBufferHeight: e2 } = this.context.gl;
|
||
return this.width !== t2 || this.height !== e2;
|
||
}
|
||
}
|
||
class ss {
|
||
constructor(t2, e2) {
|
||
this.points = t2, this.planes = e2;
|
||
}
|
||
static fromInvProjectionMatrix(e2, i3, s2) {
|
||
const a2 = Math.pow(2, s2), o2 = [[-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(((s3) => {
|
||
const o3 = 1 / (s3 = t.ag([], s3, e2))[3] / i3 * a2;
|
||
return t.b3(s3, s3, [o3, o3, 1 / s3[3], o3]);
|
||
})), r2 = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map(((t2) => {
|
||
const e3 = (function(t3, e4) {
|
||
var i5 = e4[0], s4 = e4[1], a4 = e4[2], o3 = i5 * i5 + s4 * s4 + a4 * a4;
|
||
return o3 > 0 && (o3 = 1 / Math.sqrt(o3)), t3[0] = e4[0] * o3, t3[1] = e4[1] * o3, t3[2] = e4[2] * o3, t3;
|
||
})([], (function(t3, e4, i5) {
|
||
var s4 = e4[0], a4 = e4[1], o3 = e4[2], r3 = i5[0], n2 = i5[1], l2 = i5[2];
|
||
return t3[0] = a4 * l2 - o3 * n2, t3[1] = o3 * r3 - s4 * l2, t3[2] = s4 * n2 - a4 * r3, t3;
|
||
})([], m([], o2[t2[0]], o2[t2[1]]), m([], o2[t2[2]], o2[t2[1]]))), i4 = -((s3 = e3)[0] * (a3 = o2[t2[1]])[0] + s3[1] * a3[1] + s3[2] * a3[2]);
|
||
var s3, a3;
|
||
return e3.concat(i4);
|
||
}));
|
||
return new ss(o2, r2);
|
||
}
|
||
}
|
||
class as {
|
||
constructor(t2, e2) {
|
||
this.min = t2, this.max = e2, this.center = (function(t3, e3, i3) {
|
||
return t3[0] = 0.5 * e3[0], t3[1] = 0.5 * e3[1], t3[2] = 0.5 * e3[2], t3;
|
||
})([], (function(t3, e3, i3) {
|
||
return t3[0] = e3[0] + i3[0], t3[1] = e3[1] + i3[1], t3[2] = e3[2] + i3[2], t3;
|
||
})([], this.min, this.max));
|
||
}
|
||
quadrant(t2) {
|
||
const e2 = [t2 % 2 == 0, t2 < 2], i3 = _(this.min), s2 = _(this.max);
|
||
for (let t3 = 0; t3 < e2.length; t3++) i3[t3] = e2[t3] ? this.min[t3] : this.center[t3], s2[t3] = e2[t3] ? this.center[t3] : this.max[t3];
|
||
return s2[2] = this.max[2], new as(i3, s2);
|
||
}
|
||
distanceX(t2) {
|
||
return Math.max(Math.min(this.max[0], t2[0]), this.min[0]) - t2[0];
|
||
}
|
||
distanceY(t2) {
|
||
return Math.max(Math.min(this.max[1], t2[1]), this.min[1]) - t2[1];
|
||
}
|
||
intersects(e2) {
|
||
const i3 = [[this.min[0], this.min[1], this.min[2], 1], [this.max[0], this.min[1], this.min[2], 1], [this.max[0], this.max[1], this.min[2], 1], [this.min[0], this.max[1], this.min[2], 1], [this.min[0], this.min[1], this.max[2], 1], [this.max[0], this.min[1], this.max[2], 1], [this.max[0], this.max[1], this.max[2], 1], [this.min[0], this.max[1], this.max[2], 1]];
|
||
let s2 = true;
|
||
for (let a2 = 0; a2 < e2.planes.length; a2++) {
|
||
const o2 = e2.planes[a2];
|
||
let r2 = 0;
|
||
for (let e3 = 0; e3 < i3.length; e3++) t.b4(o2, i3[e3]) >= 0 && r2++;
|
||
if (0 === r2) return 0;
|
||
r2 !== i3.length && (s2 = false);
|
||
}
|
||
if (s2) return 2;
|
||
for (let t2 = 0; t2 < 3; t2++) {
|
||
let i4 = Number.MAX_VALUE, s3 = -Number.MAX_VALUE;
|
||
for (let a2 = 0; a2 < e2.points.length; a2++) {
|
||
const o2 = e2.points[a2][t2] - this.min[t2];
|
||
i4 = Math.min(i4, o2), s3 = Math.max(s3, o2);
|
||
}
|
||
if (s3 < 0 || i4 > this.max[t2] - this.min[t2]) return 0;
|
||
}
|
||
return 1;
|
||
}
|
||
}
|
||
class os {
|
||
constructor(t2 = 0, e2 = 0, i3 = 0, s2 = 0) {
|
||
if (isNaN(t2) || t2 < 0 || isNaN(e2) || e2 < 0 || isNaN(i3) || i3 < 0 || isNaN(s2) || s2 < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
|
||
this.top = t2, this.bottom = e2, this.left = i3, this.right = s2;
|
||
}
|
||
interpolate(e2, i3, s2) {
|
||
return null != i3.top && null != e2.top && (this.top = t.B.number(e2.top, i3.top, s2)), null != i3.bottom && null != e2.bottom && (this.bottom = t.B.number(e2.bottom, i3.bottom, s2)), null != i3.left && null != e2.left && (this.left = t.B.number(e2.left, i3.left, s2)), null != i3.right && null != e2.right && (this.right = t.B.number(e2.right, i3.right, s2)), this;
|
||
}
|
||
getCenter(e2, i3) {
|
||
const s2 = t.ad((this.left + e2 - this.right) / 2, 0, e2), a2 = t.ad((this.top + i3 - this.bottom) / 2, 0, i3);
|
||
return new t.P(s2, a2);
|
||
}
|
||
equals(t2) {
|
||
return this.top === t2.top && this.bottom === t2.bottom && this.left === t2.left && this.right === t2.right;
|
||
}
|
||
clone() {
|
||
return new os(this.top, this.bottom, this.left, this.right);
|
||
}
|
||
toJSON() {
|
||
return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };
|
||
}
|
||
}
|
||
class rs {
|
||
constructor(e2, i3, s2, a2, o2) {
|
||
this.tileSize = 512, this.maxValidLatitude = 85.051129, this._renderWorldCopies = void 0 === o2 || !!o2, this._minZoom = e2 || 0, this._maxZoom = i3 || 22, this._minPitch = null == s2 ? 0 : s2, this._maxPitch = null == a2 ? 60 : a2, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new t.L(0, 0), this._elevation = 0, this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._unmodified = true, this._edgeInsets = new os(), this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._minEleveationForCurrentTile = 0;
|
||
}
|
||
clone() {
|
||
const t2 = new rs(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
|
||
return t2.apply(this), t2;
|
||
}
|
||
apply(t2) {
|
||
this.tileSize = t2.tileSize, this.latRange = t2.latRange, this.width = t2.width, this.height = t2.height, this._center = t2._center, this._elevation = t2._elevation, this._minEleveationForCurrentTile = t2._minEleveationForCurrentTile, this.zoom = t2.zoom, this.angle = t2.angle, this._fov = t2._fov, this._pitch = t2._pitch, this._unmodified = t2._unmodified, this._edgeInsets = t2._edgeInsets.clone(), this._calcMatrices();
|
||
}
|
||
get minZoom() {
|
||
return this._minZoom;
|
||
}
|
||
set minZoom(t2) {
|
||
this._minZoom !== t2 && (this._minZoom = t2, this.zoom = Math.max(this.zoom, t2));
|
||
}
|
||
get maxZoom() {
|
||
return this._maxZoom;
|
||
}
|
||
set maxZoom(t2) {
|
||
this._maxZoom !== t2 && (this._maxZoom = t2, this.zoom = Math.min(this.zoom, t2));
|
||
}
|
||
get minPitch() {
|
||
return this._minPitch;
|
||
}
|
||
set minPitch(t2) {
|
||
this._minPitch !== t2 && (this._minPitch = t2, this.pitch = Math.max(this.pitch, t2));
|
||
}
|
||
get maxPitch() {
|
||
return this._maxPitch;
|
||
}
|
||
set maxPitch(t2) {
|
||
this._maxPitch !== t2 && (this._maxPitch = t2, this.pitch = Math.min(this.pitch, t2));
|
||
}
|
||
get renderWorldCopies() {
|
||
return this._renderWorldCopies;
|
||
}
|
||
set renderWorldCopies(t2) {
|
||
void 0 === t2 ? t2 = true : null === t2 && (t2 = false), this._renderWorldCopies = t2;
|
||
}
|
||
get worldSize() {
|
||
return this.tileSize * this.scale;
|
||
}
|
||
get centerOffset() {
|
||
return this.centerPoint._sub(this.size._div(2));
|
||
}
|
||
get size() {
|
||
return new t.P(this.width, this.height);
|
||
}
|
||
get bearing() {
|
||
return -this.angle / Math.PI * 180;
|
||
}
|
||
set bearing(e2) {
|
||
const i3 = -t.b5(e2, -180, 180) * Math.PI / 180;
|
||
this.angle !== i3 && (this._unmodified = false, this.angle = i3, this._calcMatrices(), this.rotationMatrix = (function() {
|
||
var e3 = new t.A(4);
|
||
return t.A != Float32Array && (e3[1] = 0, e3[2] = 0), e3[0] = 1, e3[3] = 1, e3;
|
||
})(), (function(t2, e3, i4) {
|
||
var s2 = e3[0], a2 = e3[1], o2 = e3[2], r2 = e3[3], n2 = Math.sin(i4), l2 = Math.cos(i4);
|
||
t2[0] = s2 * l2 + o2 * n2, t2[1] = a2 * l2 + r2 * n2, t2[2] = s2 * -n2 + o2 * l2, t2[3] = a2 * -n2 + r2 * l2;
|
||
})(this.rotationMatrix, this.rotationMatrix, this.angle));
|
||
}
|
||
get pitch() {
|
||
return this._pitch / Math.PI * 180;
|
||
}
|
||
set pitch(e2) {
|
||
const i3 = t.ad(e2, this.minPitch, this.maxPitch) / 180 * Math.PI;
|
||
this._pitch !== i3 && (this._unmodified = false, this._pitch = i3, this._calcMatrices());
|
||
}
|
||
get fov() {
|
||
return this._fov / Math.PI * 180;
|
||
}
|
||
set fov(t2) {
|
||
t2 = Math.max(0.01, Math.min(60, t2)), this._fov !== t2 && (this._unmodified = false, this._fov = t2 / 180 * Math.PI, this._calcMatrices());
|
||
}
|
||
get zoom() {
|
||
return this._zoom;
|
||
}
|
||
set zoom(t2) {
|
||
const e2 = Math.min(Math.max(t2, this.minZoom), this.maxZoom);
|
||
this._zoom !== e2 && (this._unmodified = false, this._zoom = e2, this.tileZoom = Math.max(0, Math.floor(e2)), this.scale = this.zoomScale(e2), this._constrain(), this._calcMatrices());
|
||
}
|
||
get center() {
|
||
return this._center;
|
||
}
|
||
set center(t2) {
|
||
t2.lat === this._center.lat && t2.lng === this._center.lng || (this._unmodified = false, this._center = t2, this._constrain(), this._calcMatrices());
|
||
}
|
||
get elevation() {
|
||
return this._elevation;
|
||
}
|
||
set elevation(t2) {
|
||
t2 !== this._elevation && (this._elevation = t2, this._constrain(), this._calcMatrices());
|
||
}
|
||
get padding() {
|
||
return this._edgeInsets.toJSON();
|
||
}
|
||
set padding(t2) {
|
||
this._edgeInsets.equals(t2) || (this._unmodified = false, this._edgeInsets.interpolate(this._edgeInsets, t2, 1), this._calcMatrices());
|
||
}
|
||
get centerPoint() {
|
||
return this._edgeInsets.getCenter(this.width, this.height);
|
||
}
|
||
isPaddingEqual(t2) {
|
||
return this._edgeInsets.equals(t2);
|
||
}
|
||
interpolatePadding(t2, e2, i3) {
|
||
this._unmodified = false, this._edgeInsets.interpolate(t2, e2, i3), this._constrain(), this._calcMatrices();
|
||
}
|
||
coveringZoomLevel(t2) {
|
||
const e2 = (t2.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / t2.tileSize));
|
||
return Math.max(0, e2);
|
||
}
|
||
getVisibleUnwrappedCoordinates(e2) {
|
||
const i3 = [new t.b6(0, e2)];
|
||
if (this._renderWorldCopies) {
|
||
const s2 = this.pointCoordinate(new t.P(0, 0)), a2 = this.pointCoordinate(new t.P(this.width, 0)), o2 = this.pointCoordinate(new t.P(this.width, this.height)), r2 = this.pointCoordinate(new t.P(0, this.height)), n2 = Math.floor(Math.min(s2.x, a2.x, o2.x, r2.x)), l2 = Math.floor(Math.max(s2.x, a2.x, o2.x, r2.x)), h2 = 1;
|
||
for (let s3 = n2 - h2; s3 <= l2 + h2; s3++) 0 !== s3 && i3.push(new t.b6(s3, e2));
|
||
}
|
||
return i3;
|
||
}
|
||
coveringTiles(e2) {
|
||
var i3, s2;
|
||
let a2 = this.coveringZoomLevel(e2);
|
||
const o2 = a2;
|
||
if (void 0 !== e2.minzoom && a2 < e2.minzoom) return [];
|
||
void 0 !== e2.maxzoom && a2 > e2.maxzoom && (a2 = e2.maxzoom);
|
||
const r2 = this.pointCoordinate(this.getCameraPoint()), n2 = t.U.fromLngLat(this.center), l2 = Math.pow(2, a2), h2 = [l2 * r2.x, l2 * r2.y, 0], c2 = [l2 * n2.x, l2 * n2.y, 0], u2 = ss.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, a2);
|
||
let d2 = e2.minzoom || 0;
|
||
!e2.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (d2 = a2);
|
||
const _2 = e2.terrain ? 2 / Math.min(this.tileSize, e2.tileSize) * this.tileSize : 3, p2 = (t2) => ({ aabb: new as([t2 * l2, 0, 0], [(t2 + 1) * l2, l2, 0]), zoom: 0, x: 0, y: 0, wrap: t2, fullyVisible: false }), m2 = [], g2 = [], v2 = a2, x2 = e2.reparseOverscaled ? o2 : a2;
|
||
if (this._renderWorldCopies) for (let t2 = 1; t2 <= 3; t2++) m2.push(p2(-t2)), m2.push(p2(t2));
|
||
for (m2.push(p2(0)); m2.length > 0; ) {
|
||
const a3 = m2.pop(), o3 = a3.x, r3 = a3.y;
|
||
let n3 = a3.fullyVisible;
|
||
if (!n3) {
|
||
const t2 = a3.aabb.intersects(u2);
|
||
if (0 === t2) continue;
|
||
n3 = 2 === t2;
|
||
}
|
||
const l3 = e2.terrain ? h2 : c2, p3 = a3.aabb.distanceX(l3), y2 = a3.aabb.distanceY(l3), b2 = Math.max(Math.abs(p3), Math.abs(y2));
|
||
if (a3.zoom === v2 || b2 > _2 + (1 << v2 - a3.zoom) - 2 && a3.zoom >= d2) {
|
||
const e3 = v2 - a3.zoom, i4 = h2[0] - 0.5 - (o3 << e3), s3 = h2[1] - 0.5 - (r3 << e3);
|
||
g2.push({ tileID: new t.O(a3.zoom === v2 ? x2 : a3.zoom, a3.wrap, a3.zoom, o3, r3), distanceSq: f([c2[0] - 0.5 - o3, c2[1] - 0.5 - r3]), tileDistanceToCamera: Math.sqrt(i4 * i4 + s3 * s3) });
|
||
} else for (let l4 = 0; l4 < 4; l4++) {
|
||
const h3 = (o3 << 1) + l4 % 2, c3 = (r3 << 1) + (l4 >> 1), u3 = a3.zoom + 1;
|
||
let d3 = a3.aabb.quadrant(l4);
|
||
if (e2.terrain) {
|
||
const o4 = new t.O(u3, a3.wrap, u3, h3, c3), r4 = e2.terrain.getMinMaxElevation(o4), n4 = null !== (i3 = r4.minElevation) && void 0 !== i3 ? i3 : this.elevation, l5 = null !== (s2 = r4.maxElevation) && void 0 !== s2 ? s2 : this.elevation;
|
||
d3 = new as([d3.min[0], d3.min[1], n4], [d3.max[0], d3.max[1], l5]);
|
||
}
|
||
m2.push({ aabb: d3, zoom: u3, x: h3, y: c3, wrap: a3.wrap, fullyVisible: n3 });
|
||
}
|
||
}
|
||
return g2.sort(((t2, e3) => t2.distanceSq - e3.distanceSq)).map(((t2) => t2.tileID));
|
||
}
|
||
resize(t2, e2) {
|
||
this.width = t2, this.height = e2, this.pixelsToGLUnits = [2 / t2, -2 / e2], this._constrain(), this._calcMatrices();
|
||
}
|
||
get unmodified() {
|
||
return this._unmodified;
|
||
}
|
||
zoomScale(t2) {
|
||
return Math.pow(2, t2);
|
||
}
|
||
scaleZoom(t2) {
|
||
return Math.log(t2) / Math.LN2;
|
||
}
|
||
project(e2) {
|
||
const i3 = t.ad(e2.lat, -this.maxValidLatitude, this.maxValidLatitude);
|
||
return new t.P(t.G(e2.lng) * this.worldSize, t.H(i3) * this.worldSize);
|
||
}
|
||
unproject(e2) {
|
||
return new t.U(e2.x / this.worldSize, e2.y / this.worldSize).toLngLat();
|
||
}
|
||
get point() {
|
||
return this.project(this.center);
|
||
}
|
||
getCameraPosition() {
|
||
return { lngLat: this.pointLocation(this.getCameraPoint()), altitude: Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter + this.elevation };
|
||
}
|
||
recalculateZoom(e2) {
|
||
const i3 = this.pointLocation(this.centerPoint, e2), s2 = e2.getElevationForLngLatZoom(i3, this.tileZoom);
|
||
if (!(this.elevation - s2)) return;
|
||
const a2 = this.getCameraPosition(), o2 = t.U.fromLngLat(a2.lngLat, a2.altitude), r2 = t.U.fromLngLat(i3, s2), n2 = o2.x - r2.x, l2 = o2.y - r2.y, h2 = o2.z - r2.z, c2 = Math.sqrt(n2 * n2 + l2 * l2 + h2 * h2), u2 = this.scaleZoom(this.cameraToCenterDistance / c2 / this.tileSize);
|
||
this._elevation = s2, this._center = i3, this.zoom = u2;
|
||
}
|
||
setLocationAtPoint(e2, i3) {
|
||
const s2 = this.pointCoordinate(i3), a2 = this.pointCoordinate(this.centerPoint), o2 = this.locationCoordinate(e2), r2 = new t.U(o2.x - (s2.x - a2.x), o2.y - (s2.y - a2.y));
|
||
this.center = this.coordinateLocation(r2), this._renderWorldCopies && (this.center = this.center.wrap());
|
||
}
|
||
locationPoint(t2, e2) {
|
||
return e2 ? this.coordinatePoint(this.locationCoordinate(t2), e2.getElevationForLngLatZoom(t2, this.tileZoom), this.pixelMatrix3D) : this.coordinatePoint(this.locationCoordinate(t2));
|
||
}
|
||
pointLocation(t2, e2) {
|
||
return this.coordinateLocation(this.pointCoordinate(t2, e2));
|
||
}
|
||
locationCoordinate(e2) {
|
||
return t.U.fromLngLat(e2);
|
||
}
|
||
coordinateLocation(t2) {
|
||
return t2 && t2.toLngLat();
|
||
}
|
||
pointCoordinate(e2, i3) {
|
||
if (i3) {
|
||
const t2 = i3.pointCoordinate(e2);
|
||
if (null != t2) return t2;
|
||
}
|
||
const s2 = [e2.x, e2.y, 0, 1], a2 = [e2.x, e2.y, 1, 1];
|
||
t.ag(s2, s2, this.pixelMatrixInverse), t.ag(a2, a2, this.pixelMatrixInverse);
|
||
const o2 = s2[3], r2 = a2[3], n2 = s2[1] / o2, l2 = a2[1] / r2, h2 = s2[2] / o2, c2 = a2[2] / r2, u2 = h2 === c2 ? 0 : (0 - h2) / (c2 - h2);
|
||
return new t.U(t.B.number(s2[0] / o2, a2[0] / r2, u2) / this.worldSize, t.B.number(n2, l2, u2) / this.worldSize);
|
||
}
|
||
coordinatePoint(e2, i3 = 0, s2 = this.pixelMatrix) {
|
||
const a2 = [e2.x * this.worldSize, e2.y * this.worldSize, i3, 1];
|
||
return t.ag(a2, a2, s2), new t.P(a2[0] / a2[3], a2[1] / a2[3]);
|
||
}
|
||
getBounds() {
|
||
const e2 = Math.max(0, this.height / 2 - this.getHorizon());
|
||
return new L().extend(this.pointLocation(new t.P(0, e2))).extend(this.pointLocation(new t.P(this.width, e2))).extend(this.pointLocation(new t.P(this.width, this.height))).extend(this.pointLocation(new t.P(0, this.height)));
|
||
}
|
||
getMaxBounds() {
|
||
return this.latRange && 2 === this.latRange.length && this.lngRange && 2 === this.lngRange.length ? new L([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]) : null;
|
||
}
|
||
getHorizon() {
|
||
return Math.tan(Math.PI / 2 - this._pitch) * this.cameraToCenterDistance * 0.85;
|
||
}
|
||
setMaxBounds(t2) {
|
||
t2 ? (this.lngRange = [t2.getWest(), t2.getEast()], this.latRange = [t2.getSouth(), t2.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-this.maxValidLatitude, this.maxValidLatitude]);
|
||
}
|
||
calculatePosMatrix(e2, i3 = false) {
|
||
const s2 = e2.key, a2 = i3 ? this._alignedPosMatrixCache : this._posMatrixCache;
|
||
if (a2[s2]) return a2[s2];
|
||
const o2 = e2.canonical, r2 = this.worldSize / this.zoomScale(o2.z), n2 = o2.x + Math.pow(2, o2.z) * e2.wrap, l2 = t.ao(new Float64Array(16));
|
||
return t.$(l2, l2, [n2 * r2, o2.y * r2, 0]), t.a0(l2, l2, [r2 / t.N, r2 / t.N, 1]), t.a1(l2, i3 ? this.alignedProjMatrix : this.projMatrix, l2), a2[s2] = new Float32Array(l2), a2[s2];
|
||
}
|
||
customLayerMatrix() {
|
||
return this.mercatorMatrix.slice();
|
||
}
|
||
_constrain() {
|
||
if (!this.center || !this.width || !this.height || this._constraining) return;
|
||
this._constraining = true;
|
||
let e2, i3, s2, a2, o2 = -90, r2 = 90, n2 = -180, l2 = 180;
|
||
const h2 = this.size, c2 = this._unmodified;
|
||
if (this.latRange) {
|
||
const i4 = this.latRange;
|
||
o2 = t.H(i4[1]) * this.worldSize, r2 = t.H(i4[0]) * this.worldSize, e2 = r2 - o2 < h2.y ? h2.y / (r2 - o2) : 0;
|
||
}
|
||
if (this.lngRange) {
|
||
const e3 = this.lngRange;
|
||
n2 = t.b5(t.G(e3[0]) * this.worldSize, 0, this.worldSize), l2 = t.b5(t.G(e3[1]) * this.worldSize, 0, this.worldSize), l2 < n2 && (l2 += this.worldSize), i3 = l2 - n2 < h2.x ? h2.x / (l2 - n2) : 0;
|
||
}
|
||
const u2 = this.point, d2 = Math.max(i3 || 0, e2 || 0);
|
||
if (d2) return this.center = this.unproject(new t.P(i3 ? (l2 + n2) / 2 : u2.x, e2 ? (r2 + o2) / 2 : u2.y)), this.zoom += this.scaleZoom(d2), this._unmodified = c2, void (this._constraining = false);
|
||
if (this.latRange) {
|
||
const t2 = u2.y, e3 = h2.y / 2;
|
||
t2 - e3 < o2 && (a2 = o2 + e3), t2 + e3 > r2 && (a2 = r2 - e3);
|
||
}
|
||
if (this.lngRange) {
|
||
const e3 = (n2 + l2) / 2, i4 = t.b5(u2.x, e3 - this.worldSize / 2, e3 + this.worldSize / 2), a3 = h2.x / 2;
|
||
i4 - a3 < n2 && (s2 = n2 + a3), i4 + a3 > l2 && (s2 = l2 - a3);
|
||
}
|
||
void 0 === s2 && void 0 === a2 || (this.center = this.unproject(new t.P(void 0 !== s2 ? s2 : u2.x, void 0 !== a2 ? a2 : u2.y)).wrap()), this._unmodified = c2, this._constraining = false;
|
||
}
|
||
_calcMatrices() {
|
||
if (!this.height) return;
|
||
const e2 = this.centerOffset, i3 = this.point.x, s2 = this.point.y;
|
||
this.cameraToCenterDistance = 0.5 / Math.tan(this._fov / 2) * this.height, this._pixelPerMeter = t.b7(1, this.center.lat) * this.worldSize;
|
||
let a2 = t.ao(new Float64Array(16));
|
||
t.a0(a2, a2, [this.width / 2, -this.height / 2, 1]), t.$(a2, a2, [1, -1, 0]), this.labelPlaneMatrix = a2, a2 = t.ao(new Float64Array(16)), t.a0(a2, a2, [1, -1, 1]), t.$(a2, a2, [-1, -1, 0]), t.a0(a2, a2, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = a2;
|
||
const o2 = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch), r2 = Math.min(this.elevation, this._minEleveationForCurrentTile), n2 = o2 - r2 * this._pixelPerMeter / Math.cos(this._pitch), l2 = r2 < 0 ? n2 : o2, h2 = Math.PI / 2 + this._pitch, c2 = this._fov * (0.5 + e2.y / this.height), u2 = Math.sin(c2) * l2 / Math.sin(t.ad(Math.PI - h2 - c2, 0.01, Math.PI - 0.01)), d2 = this.getHorizon(), _2 = 2 * Math.atan(d2 / this.cameraToCenterDistance) * (0.5 + e2.y / (2 * d2)), p2 = Math.sin(_2) * l2 / Math.sin(t.ad(Math.PI - h2 - _2, 0.01, Math.PI - 0.01)), m2 = Math.min(u2, p2), f2 = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * m2 + l2), g2 = this.height / 50;
|
||
a2 = new Float64Array(16), t.b8(a2, this._fov, this.width / this.height, g2, f2), a2[8] = 2 * -e2.x / this.width, a2[9] = 2 * e2.y / this.height, t.a0(a2, a2, [1, -1, 1]), t.$(a2, a2, [0, 0, -this.cameraToCenterDistance]), t.b9(a2, a2, this._pitch), t.ae(a2, a2, this.angle), t.$(a2, a2, [-i3, -s2, 0]), this.mercatorMatrix = t.a0([], a2, [this.worldSize, this.worldSize, this.worldSize]), t.a0(a2, a2, [1, 1, this._pixelPerMeter]), this.pixelMatrix = t.a1(new Float64Array(16), this.labelPlaneMatrix, a2), t.$(a2, a2, [0, 0, -this.elevation]), this.projMatrix = a2, this.invProjMatrix = t.as([], a2), this.pixelMatrix3D = t.a1(new Float64Array(16), this.labelPlaneMatrix, a2);
|
||
const v2 = this.width % 2 / 2, x2 = this.height % 2 / 2, y2 = Math.cos(this.angle), b2 = Math.sin(this.angle), w2 = i3 - Math.round(i3) + y2 * v2 + b2 * x2, T2 = s2 - Math.round(s2) + y2 * x2 + b2 * v2, I2 = new Float64Array(a2);
|
||
if (t.$(I2, I2, [w2 > 0.5 ? w2 - 1 : w2, T2 > 0.5 ? T2 - 1 : T2, 0]), this.alignedProjMatrix = I2, a2 = t.as(new Float64Array(16), this.pixelMatrix), !a2) throw new Error("failed to invert matrix");
|
||
this.pixelMatrixInverse = a2, this._posMatrixCache = {}, this._alignedPosMatrixCache = {};
|
||
}
|
||
maxPitchScaleFactor() {
|
||
if (!this.pixelMatrixInverse) return 1;
|
||
const e2 = this.pointCoordinate(new t.P(0, 0)), i3 = [e2.x * this.worldSize, e2.y * this.worldSize, 0, 1];
|
||
return t.ag(i3, i3, this.pixelMatrix)[3] / this.cameraToCenterDistance;
|
||
}
|
||
getCameraPoint() {
|
||
const e2 = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1);
|
||
return this.centerPoint.add(new t.P(0, e2));
|
||
}
|
||
getCameraQueryGeometry(e2) {
|
||
const i3 = this.getCameraPoint();
|
||
if (1 === e2.length) return [e2[0], i3];
|
||
{
|
||
let s2 = i3.x, a2 = i3.y, o2 = i3.x, r2 = i3.y;
|
||
for (const t2 of e2) s2 = Math.min(s2, t2.x), a2 = Math.min(a2, t2.y), o2 = Math.max(o2, t2.x), r2 = Math.max(r2, t2.y);
|
||
return [new t.P(s2, a2), new t.P(o2, a2), new t.P(o2, r2), new t.P(s2, r2), new t.P(s2, a2)];
|
||
}
|
||
}
|
||
}
|
||
function ns(t2, e2) {
|
||
let i3, s2 = false, a2 = null, o2 = null;
|
||
const r2 = () => {
|
||
a2 = null, s2 && (t2.apply(o2, i3), a2 = setTimeout(r2, e2), s2 = false);
|
||
};
|
||
return (...t3) => (s2 = true, o2 = this, i3 = t3, a2 || r2(), a2);
|
||
}
|
||
class ls {
|
||
constructor(t2) {
|
||
this._getCurrentHash = () => {
|
||
const t3 = window.location.hash.replace("#", "");
|
||
if (this._hashName) {
|
||
let e2;
|
||
return t3.split("&").map(((t4) => t4.split("="))).forEach(((t4) => {
|
||
t4[0] === this._hashName && (e2 = t4);
|
||
})), (e2 && e2[1] || "").split("/");
|
||
}
|
||
return t3.split("/");
|
||
}, this._onHashChange = () => {
|
||
const t3 = this._getCurrentHash();
|
||
if (t3.length >= 3 && !t3.some(((t4) => isNaN(t4)))) {
|
||
const e2 = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(t3[3] || 0) : this._map.getBearing();
|
||
return this._map.jumpTo({ center: [+t3[2], +t3[1]], zoom: +t3[0], bearing: e2, pitch: +(t3[4] || 0) }), true;
|
||
}
|
||
return false;
|
||
}, this._updateHashUnthrottled = () => {
|
||
const t3 = window.location.href.replace(/(#.+)?$/, this.getHashString());
|
||
try {
|
||
window.history.replaceState(window.history.state, null, t3);
|
||
} catch (t4) {
|
||
}
|
||
}, this._updateHash = ns(this._updateHashUnthrottled, 300), this._hashName = t2 && encodeURIComponent(t2);
|
||
}
|
||
addTo(t2) {
|
||
return this._map = t2, addEventListener("hashchange", this._onHashChange, false), this._map.on("moveend", this._updateHash), this;
|
||
}
|
||
remove() {
|
||
return removeEventListener("hashchange", this._onHashChange, false), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), delete this._map, this;
|
||
}
|
||
getHashString(t2) {
|
||
const e2 = this._map.getCenter(), i3 = Math.round(100 * this._map.getZoom()) / 100, s2 = Math.ceil((i3 * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), a2 = Math.pow(10, s2), o2 = Math.round(e2.lng * a2) / a2, r2 = Math.round(e2.lat * a2) / a2, n2 = this._map.getBearing(), l2 = this._map.getPitch();
|
||
let h2 = "";
|
||
if (h2 += t2 ? `/${o2}/${r2}/${i3}` : `${i3}/${r2}/${o2}`, (n2 || l2) && (h2 += "/" + Math.round(10 * n2) / 10), l2 && (h2 += `/${Math.round(l2)}`), this._hashName) {
|
||
const t3 = this._hashName;
|
||
let e3 = false;
|
||
const i4 = window.location.hash.slice(1).split("&").map(((i5) => {
|
||
const s3 = i5.split("=")[0];
|
||
return s3 === t3 ? (e3 = true, `${s3}=${h2}`) : i5;
|
||
})).filter(((t4) => t4));
|
||
return e3 || i4.push(`${t3}=${h2}`), `#${i4.join("&")}`;
|
||
}
|
||
return `#${h2}`;
|
||
}
|
||
}
|
||
const hs = { linearity: 0.3, easing: t.ba(0, 0, 0.3, 1) }, cs = t.e({ deceleration: 2500, maxSpeed: 1400 }, hs), us = t.e({ deceleration: 20, maxSpeed: 1400 }, hs), ds = t.e({ deceleration: 1e3, maxSpeed: 360 }, hs), _s = t.e({ deceleration: 1e3, maxSpeed: 90 }, hs);
|
||
class ps {
|
||
constructor(t2) {
|
||
this._map = t2, this.clear();
|
||
}
|
||
clear() {
|
||
this._inertiaBuffer = [];
|
||
}
|
||
record(e2) {
|
||
this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: t.h.now(), settings: e2 });
|
||
}
|
||
_drainInertiaBuffer() {
|
||
const e2 = this._inertiaBuffer, i3 = t.h.now();
|
||
for (; e2.length > 0 && i3 - e2[0].time > 160; ) e2.shift();
|
||
}
|
||
_onMoveEnd(e2) {
|
||
if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return;
|
||
const i3 = { zoom: 0, bearing: 0, pitch: 0, pan: new t.P(0, 0), pinchAround: void 0, around: void 0 };
|
||
for (const { settings: t2 } of this._inertiaBuffer) i3.zoom += t2.zoomDelta || 0, i3.bearing += t2.bearingDelta || 0, i3.pitch += t2.pitchDelta || 0, t2.panDelta && i3.pan._add(t2.panDelta), t2.around && (i3.around = t2.around), t2.pinchAround && (i3.pinchAround = t2.pinchAround);
|
||
const s2 = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, a2 = {};
|
||
if (i3.pan.mag()) {
|
||
const o2 = fs(i3.pan.mag(), s2, t.e({}, cs, e2 || {}));
|
||
a2.offset = i3.pan.mult(o2.amount / i3.pan.mag()), a2.center = this._map.transform.center, ms(a2, o2);
|
||
}
|
||
if (i3.zoom) {
|
||
const t2 = fs(i3.zoom, s2, us);
|
||
a2.zoom = this._map.transform.zoom + t2.amount, ms(a2, t2);
|
||
}
|
||
if (i3.bearing) {
|
||
const e3 = fs(i3.bearing, s2, ds);
|
||
a2.bearing = this._map.transform.bearing + t.ad(e3.amount, -179, 179), ms(a2, e3);
|
||
}
|
||
if (i3.pitch) {
|
||
const t2 = fs(i3.pitch, s2, _s);
|
||
a2.pitch = this._map.transform.pitch + t2.amount, ms(a2, t2);
|
||
}
|
||
if (a2.zoom || a2.bearing) {
|
||
const t2 = void 0 === i3.pinchAround ? i3.around : i3.pinchAround;
|
||
a2.around = t2 ? this._map.unproject(t2) : this._map.getCenter();
|
||
}
|
||
return this.clear(), t.e(a2, { noMoveStart: true });
|
||
}
|
||
}
|
||
function ms(t2, e2) {
|
||
(!t2.duration || t2.duration < e2.duration) && (t2.duration = e2.duration, t2.easing = e2.easing);
|
||
}
|
||
function fs(e2, i3, s2) {
|
||
const { maxSpeed: a2, linearity: o2, deceleration: r2 } = s2, n2 = t.ad(e2 * o2 / (i3 / 1e3), -a2, a2), l2 = Math.abs(n2) / (r2 * o2);
|
||
return { easing: s2.easing, duration: 1e3 * l2, amount: n2 * (l2 / 2) };
|
||
}
|
||
class gs extends t.k {
|
||
preventDefault() {
|
||
this._defaultPrevented = true;
|
||
}
|
||
get defaultPrevented() {
|
||
return this._defaultPrevented;
|
||
}
|
||
constructor(e2, s2, a2, o2 = {}) {
|
||
const r2 = i2.mousePos(s2.getCanvasContainer(), a2), n2 = s2.unproject(r2);
|
||
super(e2, t.e({ point: r2, lngLat: n2, originalEvent: a2 }, o2)), this._defaultPrevented = false, this.target = s2;
|
||
}
|
||
}
|
||
class vs extends t.k {
|
||
preventDefault() {
|
||
this._defaultPrevented = true;
|
||
}
|
||
get defaultPrevented() {
|
||
return this._defaultPrevented;
|
||
}
|
||
constructor(e2, s2, a2) {
|
||
const o2 = "touchend" === e2 ? a2.changedTouches : a2.touches, r2 = i2.touchPos(s2.getCanvasContainer(), o2), n2 = r2.map(((t2) => s2.unproject(t2))), l2 = r2.reduce(((t2, e3, i3, s3) => t2.add(e3.div(s3.length))), new t.P(0, 0));
|
||
super(e2, { points: r2, point: l2, lngLats: n2, lngLat: s2.unproject(l2), originalEvent: a2 }), this._defaultPrevented = false;
|
||
}
|
||
}
|
||
class xs extends t.k {
|
||
preventDefault() {
|
||
this._defaultPrevented = true;
|
||
}
|
||
get defaultPrevented() {
|
||
return this._defaultPrevented;
|
||
}
|
||
constructor(t2, e2, i3) {
|
||
super(t2, { originalEvent: i3 }), this._defaultPrevented = false;
|
||
}
|
||
}
|
||
class ys {
|
||
constructor(t2, e2) {
|
||
this._map = t2, this._clickTolerance = e2.clickTolerance;
|
||
}
|
||
reset() {
|
||
delete this._mousedownPos;
|
||
}
|
||
wheel(t2) {
|
||
return this._firePreventable(new xs(t2.type, this._map, t2));
|
||
}
|
||
mousedown(t2, e2) {
|
||
return this._mousedownPos = e2, this._firePreventable(new gs(t2.type, this._map, t2));
|
||
}
|
||
mouseup(t2) {
|
||
this._map.fire(new gs(t2.type, this._map, t2));
|
||
}
|
||
click(t2, e2) {
|
||
this._mousedownPos && this._mousedownPos.dist(e2) >= this._clickTolerance || this._map.fire(new gs(t2.type, this._map, t2));
|
||
}
|
||
dblclick(t2) {
|
||
return this._firePreventable(new gs(t2.type, this._map, t2));
|
||
}
|
||
mouseover(t2) {
|
||
this._map.fire(new gs(t2.type, this._map, t2));
|
||
}
|
||
mouseout(t2) {
|
||
this._map.fire(new gs(t2.type, this._map, t2));
|
||
}
|
||
touchstart(t2) {
|
||
return this._firePreventable(new vs(t2.type, this._map, t2));
|
||
}
|
||
touchmove(t2) {
|
||
this._map.fire(new vs(t2.type, this._map, t2));
|
||
}
|
||
touchend(t2) {
|
||
this._map.fire(new vs(t2.type, this._map, t2));
|
||
}
|
||
touchcancel(t2) {
|
||
this._map.fire(new vs(t2.type, this._map, t2));
|
||
}
|
||
_firePreventable(t2) {
|
||
if (this._map.fire(t2), t2.defaultPrevented) return {};
|
||
}
|
||
isEnabled() {
|
||
return true;
|
||
}
|
||
isActive() {
|
||
return false;
|
||
}
|
||
enable() {
|
||
}
|
||
disable() {
|
||
}
|
||
}
|
||
class bs {
|
||
constructor(t2) {
|
||
this._map = t2;
|
||
}
|
||
reset() {
|
||
this._delayContextMenu = false, this._ignoreContextMenu = true, delete this._contextMenuEvent;
|
||
}
|
||
mousemove(t2) {
|
||
this._map.fire(new gs(t2.type, this._map, t2));
|
||
}
|
||
mousedown() {
|
||
this._delayContextMenu = true, this._ignoreContextMenu = false;
|
||
}
|
||
mouseup() {
|
||
this._delayContextMenu = false, this._contextMenuEvent && (this._map.fire(new gs("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);
|
||
}
|
||
contextmenu(t2) {
|
||
this._delayContextMenu ? this._contextMenuEvent = t2 : this._ignoreContextMenu || this._map.fire(new gs(t2.type, this._map, t2)), this._map.listens("contextmenu") && t2.preventDefault();
|
||
}
|
||
isEnabled() {
|
||
return true;
|
||
}
|
||
isActive() {
|
||
return false;
|
||
}
|
||
enable() {
|
||
}
|
||
disable() {
|
||
}
|
||
}
|
||
class ws {
|
||
constructor(t2) {
|
||
this._map = t2;
|
||
}
|
||
get transform() {
|
||
return this._map._requestedCameraState || this._map.transform;
|
||
}
|
||
get center() {
|
||
return { lng: this.transform.center.lng, lat: this.transform.center.lat };
|
||
}
|
||
get zoom() {
|
||
return this.transform.zoom;
|
||
}
|
||
get pitch() {
|
||
return this.transform.pitch;
|
||
}
|
||
get bearing() {
|
||
return this.transform.bearing;
|
||
}
|
||
unproject(e2) {
|
||
return this.transform.pointLocation(t.P.convert(e2), this._map.terrain);
|
||
}
|
||
}
|
||
class Ts {
|
||
constructor(t2, e2) {
|
||
this._map = t2, this._tr = new ws(t2), this._el = t2.getCanvasContainer(), this._container = t2.getContainer(), this._clickTolerance = e2.clickTolerance || 1;
|
||
}
|
||
isEnabled() {
|
||
return !!this._enabled;
|
||
}
|
||
isActive() {
|
||
return !!this._active;
|
||
}
|
||
enable() {
|
||
this.isEnabled() || (this._enabled = true);
|
||
}
|
||
disable() {
|
||
this.isEnabled() && (this._enabled = false);
|
||
}
|
||
mousedown(t2, e2) {
|
||
this.isEnabled() && t2.shiftKey && 0 === t2.button && (i2.disableDrag(), this._startPos = this._lastPos = e2, this._active = true);
|
||
}
|
||
mousemoveWindow(t2, e2) {
|
||
if (!this._active) return;
|
||
const s2 = e2;
|
||
if (this._lastPos.equals(s2) || !this._box && s2.dist(this._startPos) < this._clickTolerance) return;
|
||
const a2 = this._startPos;
|
||
this._lastPos = s2, this._box || (this._box = i2.create("div", "maplibregl-boxzoom", this._container), this._container.classList.add("maplibregl-crosshair"), this._fireEvent("boxzoomstart", t2));
|
||
const o2 = Math.min(a2.x, s2.x), r2 = Math.max(a2.x, s2.x), n2 = Math.min(a2.y, s2.y), l2 = Math.max(a2.y, s2.y);
|
||
i2.setTransform(this._box, `translate(${o2}px,${n2}px)`), this._box.style.width = r2 - o2 + "px", this._box.style.height = l2 - n2 + "px";
|
||
}
|
||
mouseupWindow(e2, s2) {
|
||
if (!this._active) return;
|
||
if (0 !== e2.button) return;
|
||
const a2 = this._startPos, o2 = s2;
|
||
if (this.reset(), i2.suppressClick(), a2.x !== o2.x || a2.y !== o2.y) return this._map.fire(new t.k("boxzoomend", { originalEvent: e2 })), { cameraAnimation: (t2) => t2.fitScreenCoordinates(a2, o2, this._tr.bearing, { linear: true }) };
|
||
this._fireEvent("boxzoomcancel", e2);
|
||
}
|
||
keydown(t2) {
|
||
this._active && 27 === t2.keyCode && (this.reset(), this._fireEvent("boxzoomcancel", t2));
|
||
}
|
||
reset() {
|
||
this._active = false, this._container.classList.remove("maplibregl-crosshair"), this._box && (i2.remove(this._box), this._box = null), i2.enableDrag(), delete this._startPos, delete this._lastPos;
|
||
}
|
||
_fireEvent(e2, i3) {
|
||
return this._map.fire(new t.k(e2, { originalEvent: i3 }));
|
||
}
|
||
}
|
||
function Is(t2, e2) {
|
||
if (t2.length !== e2.length) throw new Error(`The number of touches and points are not equal - touches ${t2.length}, points ${e2.length}`);
|
||
const i3 = {};
|
||
for (let s2 = 0; s2 < t2.length; s2++) i3[t2[s2].identifier] = e2[s2];
|
||
return i3;
|
||
}
|
||
class Es {
|
||
constructor(t2) {
|
||
this.reset(), this.numTouches = t2.numTouches;
|
||
}
|
||
reset() {
|
||
delete this.centroid, delete this.startTime, delete this.touches, this.aborted = false;
|
||
}
|
||
touchstart(e2, i3, s2) {
|
||
(this.centroid || s2.length > this.numTouches) && (this.aborted = true), this.aborted || (void 0 === this.startTime && (this.startTime = e2.timeStamp), s2.length === this.numTouches && (this.centroid = (function(e3) {
|
||
const i4 = new t.P(0, 0);
|
||
for (const t2 of e3) i4._add(t2);
|
||
return i4.div(e3.length);
|
||
})(i3), this.touches = Is(s2, i3)));
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
if (this.aborted || !this.centroid) return;
|
||
const s2 = Is(i3, e2);
|
||
for (const t3 in this.touches) {
|
||
const e3 = s2[t3];
|
||
(!e3 || e3.dist(this.touches[t3]) > 30) && (this.aborted = true);
|
||
}
|
||
}
|
||
touchend(t2, e2, i3) {
|
||
if ((!this.centroid || t2.timeStamp - this.startTime > 500) && (this.aborted = true), 0 === i3.length) {
|
||
const t3 = !this.aborted && this.centroid;
|
||
if (this.reset(), t3) return t3;
|
||
}
|
||
}
|
||
}
|
||
class Ss {
|
||
constructor(t2) {
|
||
this.singleTap = new Es(t2), this.numTaps = t2.numTaps, this.reset();
|
||
}
|
||
reset() {
|
||
this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
this.singleTap.touchstart(t2, e2, i3);
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
this.singleTap.touchmove(t2, e2, i3);
|
||
}
|
||
touchend(t2, e2, i3) {
|
||
const s2 = this.singleTap.touchend(t2, e2, i3);
|
||
if (s2) {
|
||
const e3 = t2.timeStamp - this.lastTime < 500, i4 = !this.lastTap || this.lastTap.dist(s2) < 30;
|
||
if (e3 && i4 || this.reset(), this.count++, this.lastTime = t2.timeStamp, this.lastTap = s2, this.count === this.numTaps) return this.reset(), s2;
|
||
}
|
||
}
|
||
}
|
||
class Cs {
|
||
constructor(t2) {
|
||
this._tr = new ws(t2), this._zoomIn = new Ss({ numTouches: 1, numTaps: 2 }), this._zoomOut = new Ss({ numTouches: 2, numTaps: 1 }), this.reset();
|
||
}
|
||
reset() {
|
||
this._active = false, this._zoomIn.reset(), this._zoomOut.reset();
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
this._zoomIn.touchstart(t2, e2, i3), this._zoomOut.touchstart(t2, e2, i3);
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
this._zoomIn.touchmove(t2, e2, i3), this._zoomOut.touchmove(t2, e2, i3);
|
||
}
|
||
touchend(t2, e2, i3) {
|
||
const s2 = this._zoomIn.touchend(t2, e2, i3), a2 = this._zoomOut.touchend(t2, e2, i3), o2 = this._tr;
|
||
return s2 ? (this._active = true, t2.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (e3) => e3.easeTo({ duration: 300, zoom: o2.zoom + 1, around: o2.unproject(s2) }, { originalEvent: t2 }) }) : a2 ? (this._active = true, t2.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (e3) => e3.easeTo({ duration: 300, zoom: o2.zoom - 1, around: o2.unproject(a2) }, { originalEvent: t2 }) }) : void 0;
|
||
}
|
||
touchcancel() {
|
||
this.reset();
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
}
|
||
class Ps {
|
||
constructor(t2) {
|
||
this._enabled = !!t2.enable, this._moveStateManager = t2.moveStateManager, this._clickTolerance = t2.clickTolerance || 1, this._moveFunction = t2.move, this._activateOnStart = !!t2.activateOnStart, t2.assignEvents(this), this.reset();
|
||
}
|
||
reset(t2) {
|
||
this._active = false, this._moved = false, delete this._lastPoint, this._moveStateManager.endMove(t2);
|
||
}
|
||
_move(...t2) {
|
||
const e2 = this._moveFunction(...t2);
|
||
if (e2.bearingDelta || e2.pitchDelta || e2.around || e2.panDelta) return this._active = true, e2;
|
||
}
|
||
dragStart(t2, e2) {
|
||
this.isEnabled() && !this._lastPoint && this._moveStateManager.isValidStartEvent(t2) && (this._moveStateManager.startMove(t2), this._lastPoint = e2.length ? e2[0] : e2, this._activateOnStart && this._lastPoint && (this._active = true));
|
||
}
|
||
dragMove(t2, e2) {
|
||
if (!this.isEnabled()) return;
|
||
const i3 = this._lastPoint;
|
||
if (!i3) return;
|
||
if (t2.preventDefault(), !this._moveStateManager.isValidMoveEvent(t2)) return void this.reset(t2);
|
||
const s2 = e2.length ? e2[0] : e2;
|
||
return !this._moved && s2.dist(i3) < this._clickTolerance ? void 0 : (this._moved = true, this._lastPoint = s2, this._move(i3, s2));
|
||
}
|
||
dragEnd(t2) {
|
||
this.isEnabled() && this._lastPoint && this._moveStateManager.isValidEndEvent(t2) && (this._moved && i2.suppressClick(), this.reset(t2));
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
getClickTolerance() {
|
||
return this._clickTolerance;
|
||
}
|
||
}
|
||
const Ds = { 0: 1, 2: 2 };
|
||
class Ms {
|
||
constructor(t2) {
|
||
this._correctEvent = t2.checkCorrectEvent;
|
||
}
|
||
startMove(t2) {
|
||
const e2 = i2.mouseButton(t2);
|
||
this._eventButton = e2;
|
||
}
|
||
endMove(t2) {
|
||
delete this._eventButton;
|
||
}
|
||
isValidStartEvent(t2) {
|
||
return this._correctEvent(t2);
|
||
}
|
||
isValidMoveEvent(t2) {
|
||
return !(function(t3, e2) {
|
||
const i3 = Ds[e2];
|
||
return void 0 === t3.buttons || (t3.buttons & i3) !== i3;
|
||
})(t2, this._eventButton);
|
||
}
|
||
isValidEndEvent(t2) {
|
||
return i2.mouseButton(t2) === this._eventButton;
|
||
}
|
||
}
|
||
class zs {
|
||
constructor() {
|
||
this._firstTouch = void 0;
|
||
}
|
||
_isOneFingerTouch(t2) {
|
||
return 1 === t2.targetTouches.length;
|
||
}
|
||
_isSameTouchEvent(t2) {
|
||
return t2.targetTouches[0].identifier === this._firstTouch;
|
||
}
|
||
startMove(t2) {
|
||
this._firstTouch = t2.targetTouches[0].identifier;
|
||
}
|
||
endMove(t2) {
|
||
delete this._firstTouch;
|
||
}
|
||
isValidStartEvent(t2) {
|
||
return this._isOneFingerTouch(t2);
|
||
}
|
||
isValidMoveEvent(t2) {
|
||
return this._isOneFingerTouch(t2) && this._isSameTouchEvent(t2);
|
||
}
|
||
isValidEndEvent(t2) {
|
||
return this._isOneFingerTouch(t2) && this._isSameTouchEvent(t2);
|
||
}
|
||
}
|
||
const Ls = (t2) => {
|
||
t2.mousedown = t2.dragStart, t2.mousemoveWindow = t2.dragMove, t2.mouseup = t2.dragEnd, t2.contextmenu = function(t3) {
|
||
t3.preventDefault();
|
||
};
|
||
}, As = ({ enable: t2, clickTolerance: e2, bearingDegreesPerPixelMoved: s2 = 0.8 }) => {
|
||
const a2 = new Ms({ checkCorrectEvent: (t3) => 0 === i2.mouseButton(t3) && t3.ctrlKey || 2 === i2.mouseButton(t3) });
|
||
return new Ps({ clickTolerance: e2, move: (t3, e3) => ({ bearingDelta: (e3.x - t3.x) * s2 }), moveStateManager: a2, enable: t2, assignEvents: Ls });
|
||
}, Rs = ({ enable: t2, clickTolerance: e2, pitchDegreesPerPixelMoved: s2 = -0.5 }) => {
|
||
const a2 = new Ms({ checkCorrectEvent: (t3) => 0 === i2.mouseButton(t3) && t3.ctrlKey || 2 === i2.mouseButton(t3) });
|
||
return new Ps({ clickTolerance: e2, move: (t3, e3) => ({ pitchDelta: (e3.y - t3.y) * s2 }), moveStateManager: a2, enable: t2, assignEvents: Ls });
|
||
};
|
||
class ks {
|
||
constructor(t2, e2) {
|
||
this._minTouches = t2.cooperativeGestures ? 2 : 1, this._clickTolerance = t2.clickTolerance || 1, this._map = e2, this.reset();
|
||
}
|
||
reset() {
|
||
this._active = false, this._touches = {}, this._sum = new t.P(0, 0), setTimeout((() => {
|
||
this._cancelCooperativeMessage = false;
|
||
}), 200);
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
return this._calculateTransform(t2, e2, i3);
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
if (this._map._cooperativeGestures && (2 === this._minTouches && i3.length < 2 && !this._cancelCooperativeMessage ? this._map._onCooperativeGesture(t2, false, i3.length) : this._cancelCooperativeMessage || (this._cancelCooperativeMessage = true)), this._active && !(i3.length < this._minTouches)) return t2.preventDefault(), this._calculateTransform(t2, e2, i3);
|
||
}
|
||
touchend(t2, e2, i3) {
|
||
this._calculateTransform(t2, e2, i3), this._active && i3.length < this._minTouches && this.reset();
|
||
}
|
||
touchcancel() {
|
||
this.reset();
|
||
}
|
||
_calculateTransform(e2, i3, s2) {
|
||
s2.length > 0 && (this._active = true);
|
||
const a2 = Is(s2, i3), o2 = new t.P(0, 0), r2 = new t.P(0, 0);
|
||
let n2 = 0;
|
||
for (const t2 in a2) {
|
||
const e3 = a2[t2], i4 = this._touches[t2];
|
||
i4 && (o2._add(e3), r2._add(e3.sub(i4)), n2++, a2[t2] = e3);
|
||
}
|
||
if (this._touches = a2, n2 < this._minTouches || !r2.mag()) return;
|
||
const l2 = r2.div(n2);
|
||
return this._sum._add(l2), this._sum.mag() < this._clickTolerance ? void 0 : { around: o2.div(n2), panDelta: l2 };
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
}
|
||
class Fs {
|
||
constructor() {
|
||
this.reset();
|
||
}
|
||
reset() {
|
||
this._active = false, delete this._firstTwoTouches;
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
this._firstTwoTouches || i3.length < 2 || (this._firstTwoTouches = [i3[0].identifier, i3[1].identifier], this._start([e2[0], e2[1]]));
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
if (!this._firstTwoTouches) return;
|
||
t2.preventDefault();
|
||
const [s2, a2] = this._firstTwoTouches, o2 = Bs(i3, e2, s2), r2 = Bs(i3, e2, a2);
|
||
if (!o2 || !r2) return;
|
||
const n2 = this._aroundCenter ? null : o2.add(r2).div(2);
|
||
return this._move([o2, r2], n2, t2);
|
||
}
|
||
touchend(t2, e2, s2) {
|
||
if (!this._firstTwoTouches) return;
|
||
const [a2, o2] = this._firstTwoTouches, r2 = Bs(s2, e2, a2), n2 = Bs(s2, e2, o2);
|
||
r2 && n2 || (this._active && i2.suppressClick(), this.reset());
|
||
}
|
||
touchcancel() {
|
||
this.reset();
|
||
}
|
||
enable(t2) {
|
||
this._enabled = true, this._aroundCenter = !!t2 && "center" === t2.around;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
}
|
||
function Bs(t2, e2, i3) {
|
||
for (let s2 = 0; s2 < t2.length; s2++) if (t2[s2].identifier === i3) return e2[s2];
|
||
}
|
||
function Os(t2, e2) {
|
||
return Math.log(t2 / e2) / Math.LN2;
|
||
}
|
||
class Ns extends Fs {
|
||
reset() {
|
||
super.reset(), delete this._distance, delete this._startDistance;
|
||
}
|
||
_start(t2) {
|
||
this._startDistance = this._distance = t2[0].dist(t2[1]);
|
||
}
|
||
_move(t2, e2) {
|
||
const i3 = this._distance;
|
||
if (this._distance = t2[0].dist(t2[1]), this._active || !(Math.abs(Os(this._distance, this._startDistance)) < 0.1)) return this._active = true, { zoomDelta: Os(this._distance, i3), pinchAround: e2 };
|
||
}
|
||
}
|
||
function Us(t2, e2) {
|
||
return 180 * t2.angleWith(e2) / Math.PI;
|
||
}
|
||
class Zs extends Fs {
|
||
reset() {
|
||
super.reset(), delete this._minDiameter, delete this._startVector, delete this._vector;
|
||
}
|
||
_start(t2) {
|
||
this._startVector = this._vector = t2[0].sub(t2[1]), this._minDiameter = t2[0].dist(t2[1]);
|
||
}
|
||
_move(t2, e2) {
|
||
const i3 = this._vector;
|
||
if (this._vector = t2[0].sub(t2[1]), this._active || !this._isBelowThreshold(this._vector)) return this._active = true, { bearingDelta: Us(this._vector, i3), pinchAround: e2 };
|
||
}
|
||
_isBelowThreshold(t2) {
|
||
this._minDiameter = Math.min(this._minDiameter, t2.mag());
|
||
const e2 = 25 / (Math.PI * this._minDiameter) * 360, i3 = Us(t2, this._startVector);
|
||
return Math.abs(i3) < e2;
|
||
}
|
||
}
|
||
function Gs(t2) {
|
||
return Math.abs(t2.y) > Math.abs(t2.x);
|
||
}
|
||
class js extends Fs {
|
||
constructor(t2) {
|
||
super(), this._map = t2;
|
||
}
|
||
reset() {
|
||
super.reset(), this._valid = void 0, delete this._firstMove, delete this._lastPoints;
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
super.touchstart(t2, e2, i3), this._currentTouchCount = i3.length;
|
||
}
|
||
_start(t2) {
|
||
this._lastPoints = t2, Gs(t2[0].sub(t2[1])) && (this._valid = false);
|
||
}
|
||
_move(t2, e2, i3) {
|
||
if (this._map._cooperativeGestures && this._currentTouchCount < 3) return;
|
||
const s2 = t2[0].sub(this._lastPoints[0]), a2 = t2[1].sub(this._lastPoints[1]);
|
||
return this._valid = this.gestureBeginsVertically(s2, a2, i3.timeStamp), this._valid ? (this._lastPoints = t2, this._active = true, { pitchDelta: (s2.y + a2.y) / 2 * -0.5 }) : void 0;
|
||
}
|
||
gestureBeginsVertically(t2, e2, i3) {
|
||
if (void 0 !== this._valid) return this._valid;
|
||
const s2 = t2.mag() >= 2, a2 = e2.mag() >= 2;
|
||
if (!s2 && !a2) return;
|
||
if (!s2 || !a2) return void 0 === this._firstMove && (this._firstMove = i3), i3 - this._firstMove < 100 && void 0;
|
||
const o2 = t2.y > 0 == e2.y > 0;
|
||
return Gs(t2) && Gs(e2) && o2;
|
||
}
|
||
}
|
||
const Vs = { panStep: 100, bearingStep: 15, pitchStep: 10 };
|
||
class qs {
|
||
constructor(t2) {
|
||
this._tr = new ws(t2);
|
||
const e2 = Vs;
|
||
this._panStep = e2.panStep, this._bearingStep = e2.bearingStep, this._pitchStep = e2.pitchStep, this._rotationDisabled = false;
|
||
}
|
||
reset() {
|
||
this._active = false;
|
||
}
|
||
keydown(t2) {
|
||
if (t2.altKey || t2.ctrlKey || t2.metaKey) return;
|
||
let e2 = 0, i3 = 0, s2 = 0, a2 = 0, o2 = 0;
|
||
switch (t2.keyCode) {
|
||
case 61:
|
||
case 107:
|
||
case 171:
|
||
case 187:
|
||
e2 = 1;
|
||
break;
|
||
case 189:
|
||
case 109:
|
||
case 173:
|
||
e2 = -1;
|
||
break;
|
||
case 37:
|
||
t2.shiftKey ? i3 = -1 : (t2.preventDefault(), a2 = -1);
|
||
break;
|
||
case 39:
|
||
t2.shiftKey ? i3 = 1 : (t2.preventDefault(), a2 = 1);
|
||
break;
|
||
case 38:
|
||
t2.shiftKey ? s2 = 1 : (t2.preventDefault(), o2 = -1);
|
||
break;
|
||
case 40:
|
||
t2.shiftKey ? s2 = -1 : (t2.preventDefault(), o2 = 1);
|
||
break;
|
||
default:
|
||
return;
|
||
}
|
||
return this._rotationDisabled && (i3 = 0, s2 = 0), { cameraAnimation: (r2) => {
|
||
const n2 = this._tr;
|
||
r2.easeTo({ duration: 300, easeId: "keyboardHandler", easing: $s, zoom: e2 ? Math.round(n2.zoom) + e2 * (t2.shiftKey ? 2 : 1) : n2.zoom, bearing: n2.bearing + i3 * this._bearingStep, pitch: n2.pitch + s2 * this._pitchStep, offset: [-a2 * this._panStep, -o2 * this._panStep], center: n2.center }, { originalEvent: t2 });
|
||
} };
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
disableRotation() {
|
||
this._rotationDisabled = true;
|
||
}
|
||
enableRotation() {
|
||
this._rotationDisabled = false;
|
||
}
|
||
}
|
||
function $s(t2) {
|
||
return t2 * (2 - t2);
|
||
}
|
||
const Ws = 4.000244140625;
|
||
class Hs {
|
||
constructor(t2, e2) {
|
||
this._onTimeout = (t3) => {
|
||
this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(t3);
|
||
}, this._map = t2, this._tr = new ws(t2), this._el = t2.getCanvasContainer(), this._triggerRenderFrame = e2, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = 0.0022222222222222222;
|
||
}
|
||
setZoomRate(t2) {
|
||
this._defaultZoomRate = t2;
|
||
}
|
||
setWheelZoomRate(t2) {
|
||
this._wheelZoomRate = t2;
|
||
}
|
||
isEnabled() {
|
||
return !!this._enabled;
|
||
}
|
||
isActive() {
|
||
return !!this._active || void 0 !== this._finishTimeout;
|
||
}
|
||
isZooming() {
|
||
return !!this._zooming;
|
||
}
|
||
enable(t2) {
|
||
this.isEnabled() || (this._enabled = true, this._aroundCenter = !!t2 && "center" === t2.around);
|
||
}
|
||
disable() {
|
||
this.isEnabled() && (this._enabled = false);
|
||
}
|
||
wheel(e2) {
|
||
if (!this.isEnabled()) return;
|
||
if (this._map._cooperativeGestures) {
|
||
if (!e2[this._map._metaKey]) return;
|
||
e2.preventDefault();
|
||
}
|
||
let i3 = e2.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * e2.deltaY : e2.deltaY;
|
||
const s2 = t.h.now(), a2 = s2 - (this._lastWheelEventTime || 0);
|
||
this._lastWheelEventTime = s2, 0 !== i3 && i3 % Ws == 0 ? this._type = "wheel" : 0 !== i3 && Math.abs(i3) < 4 ? this._type = "trackpad" : a2 > 400 ? (this._type = null, this._lastValue = i3, this._timeout = setTimeout(this._onTimeout, 40, e2)) : this._type || (this._type = Math.abs(a2 * i3) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, i3 += this._lastValue)), e2.shiftKey && i3 && (i3 /= 4), this._type && (this._lastWheelEvent = e2, this._delta -= i3, this._active || this._start(e2)), e2.preventDefault();
|
||
}
|
||
_start(e2) {
|
||
if (!this._delta) return;
|
||
this._frameId && (this._frameId = null), this._active = true, this.isZooming() || (this._zooming = true), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
|
||
const s2 = i2.mousePos(this._el, e2), a2 = this._tr;
|
||
this._around = t.L.convert(this._aroundCenter ? a2.center : a2.unproject(s2)), this._aroundPoint = a2.transform.locationPoint(this._around), this._frameId || (this._frameId = true, this._triggerRenderFrame());
|
||
}
|
||
renderFrame() {
|
||
if (!this._frameId) return;
|
||
if (this._frameId = null, !this.isActive()) return;
|
||
const e2 = this._tr.transform;
|
||
if (0 !== this._delta) {
|
||
const t2 = "wheel" === this._type && Math.abs(this._delta) > Ws ? this._wheelZoomRate : this._defaultZoomRate;
|
||
let i4 = 2 / (1 + Math.exp(-Math.abs(this._delta * t2)));
|
||
this._delta < 0 && 0 !== i4 && (i4 = 1 / i4);
|
||
const s3 = "number" == typeof this._targetZoom ? e2.zoomScale(this._targetZoom) : e2.scale;
|
||
this._targetZoom = Math.min(e2.maxZoom, Math.max(e2.minZoom, e2.scaleZoom(s3 * i4))), "wheel" === this._type && (this._startZoom = e2.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;
|
||
}
|
||
const i3 = "number" == typeof this._targetZoom ? this._targetZoom : e2.zoom, s2 = this._startZoom, a2 = this._easing;
|
||
let o2, r2 = false;
|
||
if ("wheel" === this._type && s2 && a2) {
|
||
const e3 = Math.min((t.h.now() - this._lastWheelEventTime) / 200, 1), n2 = a2(e3);
|
||
o2 = t.B.number(s2, i3, n2), e3 < 1 ? this._frameId || (this._frameId = true) : r2 = true;
|
||
} else o2 = i3, r2 = true;
|
||
return this._active = true, r2 && (this._active = false, this._finishTimeout = setTimeout((() => {
|
||
this._zooming = false, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;
|
||
}), 200)), { noInertia: true, needsRenderFrame: !r2, zoomDelta: o2 - e2.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
|
||
}
|
||
_smoothOutEasing(e2) {
|
||
let i3 = t.bb;
|
||
if (this._prevEase) {
|
||
const e3 = this._prevEase, s2 = (t.h.now() - e3.start) / e3.duration, a2 = e3.easing(s2 + 0.01) - e3.easing(s2), o2 = 0.27 / Math.sqrt(a2 * a2 + 1e-4) * 0.01, r2 = Math.sqrt(0.0729 - o2 * o2);
|
||
i3 = t.ba(o2, r2, 0.25, 1);
|
||
}
|
||
return this._prevEase = { start: t.h.now(), duration: e2, easing: i3 }, i3;
|
||
}
|
||
reset() {
|
||
this._active = false, this._zooming = false, delete this._targetZoom, this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
|
||
}
|
||
}
|
||
class Xs {
|
||
constructor(t2, e2) {
|
||
this._clickZoom = t2, this._tapZoom = e2;
|
||
}
|
||
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 Ks {
|
||
constructor(t2) {
|
||
this._tr = new ws(t2), this.reset();
|
||
}
|
||
reset() {
|
||
this._active = false;
|
||
}
|
||
dblclick(t2, e2) {
|
||
return t2.preventDefault(), { cameraAnimation: (i3) => {
|
||
i3.easeTo({ duration: 300, zoom: this._tr.zoom + (t2.shiftKey ? -1 : 1), around: this._tr.unproject(e2) }, { originalEvent: t2 });
|
||
} };
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
}
|
||
class Qs {
|
||
constructor() {
|
||
this._tap = new Ss({ numTouches: 1, numTaps: 1 }), this.reset();
|
||
}
|
||
reset() {
|
||
this._active = false, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();
|
||
}
|
||
touchstart(t2, e2, i3) {
|
||
if (!this._swipePoint) if (this._tapTime) {
|
||
const s2 = e2[0], a2 = t2.timeStamp - this._tapTime < 500, o2 = this._tapPoint.dist(s2) < 30;
|
||
a2 && o2 ? i3.length > 0 && (this._swipePoint = s2, this._swipeTouch = i3[0].identifier) : this.reset();
|
||
} else this._tap.touchstart(t2, e2, i3);
|
||
}
|
||
touchmove(t2, e2, i3) {
|
||
if (this._tapTime) {
|
||
if (this._swipePoint) {
|
||
if (i3[0].identifier !== this._swipeTouch) return;
|
||
const s2 = e2[0], a2 = s2.y - this._swipePoint.y;
|
||
return this._swipePoint = s2, t2.preventDefault(), this._active = true, { zoomDelta: a2 / 128 };
|
||
}
|
||
} else this._tap.touchmove(t2, e2, i3);
|
||
}
|
||
touchend(t2, e2, i3) {
|
||
if (this._tapTime) this._swipePoint && 0 === i3.length && this.reset();
|
||
else {
|
||
const s2 = this._tap.touchend(t2, e2, i3);
|
||
s2 && (this._tapTime = t2.timeStamp, this._tapPoint = s2);
|
||
}
|
||
}
|
||
touchcancel() {
|
||
this.reset();
|
||
}
|
||
enable() {
|
||
this._enabled = true;
|
||
}
|
||
disable() {
|
||
this._enabled = false, this.reset();
|
||
}
|
||
isEnabled() {
|
||
return this._enabled;
|
||
}
|
||
isActive() {
|
||
return this._active;
|
||
}
|
||
}
|
||
class Ys {
|
||
constructor(t2, e2, i3) {
|
||
this._el = t2, this._mousePan = e2, this._touchPan = i3;
|
||
}
|
||
enable(t2) {
|
||
this._inertiaOptions = t2 || {}, this._mousePan.enable(), this._touchPan.enable(), this._el.classList.add("maplibregl-touch-drag-pan");
|
||
}
|
||
disable() {
|
||
this._mousePan.disable(), this._touchPan.disable(), this._el.classList.remove("maplibregl-touch-drag-pan");
|
||
}
|
||
isEnabled() {
|
||
return this._mousePan.isEnabled() && this._touchPan.isEnabled();
|
||
}
|
||
isActive() {
|
||
return this._mousePan.isActive() || this._touchPan.isActive();
|
||
}
|
||
}
|
||
class Js {
|
||
constructor(t2, e2, i3) {
|
||
this._pitchWithRotate = t2.pitchWithRotate, this._mouseRotate = e2, this._mousePitch = i3;
|
||
}
|
||
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 ta {
|
||
constructor(t2, e2, i3, s2) {
|
||
this._el = t2, this._touchZoom = e2, this._touchRotate = i3, this._tapDragZoom = s2, this._rotationDisabled = false, this._enabled = true;
|
||
}
|
||
enable(t2) {
|
||
this._touchZoom.enable(t2), this._rotationDisabled || this._touchRotate.enable(t2), this._tapDragZoom.enable(), this._el.classList.add("maplibregl-touch-zoom-rotate");
|
||
}
|
||
disable() {
|
||
this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove("maplibregl-touch-zoom-rotate");
|
||
}
|
||
isEnabled() {
|
||
return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();
|
||
}
|
||
isActive() {
|
||
return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();
|
||
}
|
||
disableRotation() {
|
||
this._rotationDisabled = true, this._touchRotate.disable();
|
||
}
|
||
enableRotation() {
|
||
this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable();
|
||
}
|
||
}
|
||
const ea = (t2) => t2.zoom || t2.drag || t2.pitch || t2.rotate;
|
||
class ia extends t.k {
|
||
}
|
||
function sa(t2) {
|
||
return t2.panDelta && t2.panDelta.mag() || t2.zoomDelta || t2.bearingDelta || t2.pitchDelta;
|
||
}
|
||
class aa {
|
||
constructor(t2, e2) {
|
||
this.handleWindowEvent = (t3) => {
|
||
this.handleEvent(t3, `${t3.type}Window`);
|
||
}, this.handleEvent = (t3, e3) => {
|
||
if ("blur" === t3.type) return void this.stop(true);
|
||
this._updatingCamera = true;
|
||
const s3 = "renderFrame" === t3.type ? void 0 : t3, a2 = { needsRenderFrame: false }, o2 = {}, r2 = {}, n2 = t3.touches, l2 = n2 ? this._getMapTouches(n2) : void 0, h2 = l2 ? i2.touchPos(this._el, l2) : i2.mousePos(this._el, t3);
|
||
for (const { handlerName: i3, handler: n3, allowed: c3 } of this._handlers) {
|
||
if (!n3.isEnabled()) continue;
|
||
let u3;
|
||
this._blockedByActive(r2, c3, i3) ? n3.reset() : n3[e3 || t3.type] && (u3 = n3[e3 || t3.type](t3, h2, l2), this.mergeHandlerResult(a2, o2, u3, i3, s3), u3 && u3.needsRenderFrame && this._triggerRenderFrame()), (u3 || n3.isActive()) && (r2[i3] = n3);
|
||
}
|
||
const c2 = {};
|
||
for (const t4 in this._previousActiveHandlers) r2[t4] || (c2[t4] = s3);
|
||
this._previousActiveHandlers = r2, (Object.keys(c2).length || sa(a2)) && (this._changes.push([a2, o2, c2]), this._triggerRenderFrame()), (Object.keys(r2).length || sa(a2)) && this._map._stop(true), this._updatingCamera = false;
|
||
const { cameraAnimation: u2 } = a2;
|
||
u2 && (this._inertia.clear(), this._fireEvents({}, {}, true), this._changes = [], u2(this._map));
|
||
}, this._map = t2, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new ps(t2), this._bearingSnap = e2.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(e2);
|
||
const s2 = this._el;
|
||
this._listeners = [[s2, "touchstart", { passive: true }], [s2, "touchmove", { passive: false }], [s2, "touchend", void 0], [s2, "touchcancel", void 0], [s2, "mousedown", void 0], [s2, "mousemove", void 0], [s2, "mouseup", void 0], [document, "mousemove", { capture: true }], [document, "mouseup", void 0], [s2, "mouseover", void 0], [s2, "mouseout", void 0], [s2, "dblclick", void 0], [s2, "click", void 0], [s2, "keydown", { capture: false }], [s2, "keyup", void 0], [s2, "wheel", { passive: false }], [s2, "contextmenu", void 0], [window, "blur", void 0]];
|
||
for (const [t3, e3, s3] of this._listeners) i2.addEventListener(t3, e3, t3 === document ? this.handleWindowEvent : this.handleEvent, s3);
|
||
}
|
||
destroy() {
|
||
for (const [t2, e2, s2] of this._listeners) i2.removeEventListener(t2, e2, t2 === document ? this.handleWindowEvent : this.handleEvent, s2);
|
||
}
|
||
_addDefaultHandlers(t2) {
|
||
const e2 = this._map, s2 = e2.getCanvasContainer();
|
||
this._add("mapEvent", new ys(e2, t2));
|
||
const a2 = e2.boxZoom = new Ts(e2, t2);
|
||
this._add("boxZoom", a2), t2.interactive && t2.boxZoom && a2.enable();
|
||
const o2 = new Cs(e2), r2 = new Ks(e2);
|
||
e2.doubleClickZoom = new Xs(r2, o2), this._add("tapZoom", o2), this._add("clickZoom", r2), t2.interactive && t2.doubleClickZoom && e2.doubleClickZoom.enable();
|
||
const n2 = new Qs();
|
||
this._add("tapDragZoom", n2);
|
||
const l2 = e2.touchPitch = new js(e2);
|
||
this._add("touchPitch", l2), t2.interactive && t2.touchPitch && e2.touchPitch.enable(t2.touchPitch);
|
||
const h2 = As(t2), c2 = Rs(t2);
|
||
e2.dragRotate = new Js(t2, h2, c2), this._add("mouseRotate", h2, ["mousePitch"]), this._add("mousePitch", c2, ["mouseRotate"]), t2.interactive && t2.dragRotate && e2.dragRotate.enable();
|
||
const u2 = (({ enable: t3, clickTolerance: e3 }) => {
|
||
const s3 = new Ms({ checkCorrectEvent: (t4) => 0 === i2.mouseButton(t4) && !t4.ctrlKey });
|
||
return new Ps({ clickTolerance: e3, move: (t4, e4) => ({ around: e4, panDelta: e4.sub(t4) }), activateOnStart: true, moveStateManager: s3, enable: t3, assignEvents: Ls });
|
||
})(t2), d2 = new ks(t2, e2);
|
||
e2.dragPan = new Ys(s2, u2, d2), this._add("mousePan", u2), this._add("touchPan", d2, ["touchZoom", "touchRotate"]), t2.interactive && t2.dragPan && e2.dragPan.enable(t2.dragPan);
|
||
const _2 = new Zs(), p2 = new Ns();
|
||
e2.touchZoomRotate = new ta(s2, p2, _2, n2), this._add("touchRotate", _2, ["touchPan", "touchZoom"]), this._add("touchZoom", p2, ["touchPan", "touchRotate"]), t2.interactive && t2.touchZoomRotate && e2.touchZoomRotate.enable(t2.touchZoomRotate);
|
||
const m2 = e2.scrollZoom = new Hs(e2, (() => this._triggerRenderFrame()));
|
||
this._add("scrollZoom", m2, ["mousePan"]), t2.interactive && t2.scrollZoom && e2.scrollZoom.enable(t2.scrollZoom);
|
||
const f2 = e2.keyboard = new qs(e2);
|
||
this._add("keyboard", f2), t2.interactive && t2.keyboard && e2.keyboard.enable(), this._add("blockableMapEvent", new bs(e2));
|
||
}
|
||
_add(t2, e2, i3) {
|
||
this._handlers.push({ handlerName: t2, handler: e2, allowed: i3 }), this._handlersById[t2] = e2;
|
||
}
|
||
stop(t2) {
|
||
if (!this._updatingCamera) {
|
||
for (const { handler: t3 } of this._handlers) t3.reset();
|
||
this._inertia.clear(), this._fireEvents({}, {}, t2), this._changes = [];
|
||
}
|
||
}
|
||
isActive() {
|
||
for (const { handler: t2 } of this._handlers) if (t2.isActive()) return true;
|
||
return false;
|
||
}
|
||
isZooming() {
|
||
return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
|
||
}
|
||
isRotating() {
|
||
return !!this._eventsInProgress.rotate;
|
||
}
|
||
isMoving() {
|
||
return Boolean(ea(this._eventsInProgress)) || this.isZooming();
|
||
}
|
||
_blockedByActive(t2, e2, i3) {
|
||
for (const s2 in t2) if (s2 !== i3 && (!e2 || e2.indexOf(s2) < 0)) return true;
|
||
return false;
|
||
}
|
||
_getMapTouches(t2) {
|
||
const e2 = [];
|
||
for (const i3 of t2) this._el.contains(i3.target) && e2.push(i3);
|
||
return e2;
|
||
}
|
||
mergeHandlerResult(e2, i3, s2, a2, o2) {
|
||
if (!s2) return;
|
||
t.e(e2, s2);
|
||
const r2 = { handlerName: a2, originalEvent: s2.originalEvent || o2 };
|
||
void 0 !== s2.zoomDelta && (i3.zoom = r2), void 0 !== s2.panDelta && (i3.drag = r2), void 0 !== s2.pitchDelta && (i3.pitch = r2), void 0 !== s2.bearingDelta && (i3.rotate = r2);
|
||
}
|
||
_applyChanges() {
|
||
const e2 = {}, i3 = {}, s2 = {};
|
||
for (const [a2, o2, r2] of this._changes) a2.panDelta && (e2.panDelta = (e2.panDelta || new t.P(0, 0))._add(a2.panDelta)), a2.zoomDelta && (e2.zoomDelta = (e2.zoomDelta || 0) + a2.zoomDelta), a2.bearingDelta && (e2.bearingDelta = (e2.bearingDelta || 0) + a2.bearingDelta), a2.pitchDelta && (e2.pitchDelta = (e2.pitchDelta || 0) + a2.pitchDelta), void 0 !== a2.around && (e2.around = a2.around), void 0 !== a2.pinchAround && (e2.pinchAround = a2.pinchAround), a2.noInertia && (e2.noInertia = a2.noInertia), t.e(i3, o2), t.e(s2, r2);
|
||
this._updateMapTransform(e2, i3, s2), this._changes = [];
|
||
}
|
||
_updateMapTransform(t2, e2, i3) {
|
||
const s2 = this._map, a2 = s2._getTransformForUpdate(), o2 = s2.terrain;
|
||
if (!(sa(t2) || o2 && this._terrainMovement)) return this._fireEvents(e2, i3, true);
|
||
let { panDelta: r2, zoomDelta: n2, bearingDelta: l2, pitchDelta: h2, around: c2, pinchAround: u2 } = t2;
|
||
void 0 !== u2 && (c2 = u2), s2._stop(true), c2 = c2 || s2.transform.centerPoint;
|
||
const d2 = a2.pointLocation(r2 ? c2.sub(r2) : c2);
|
||
l2 && (a2.bearing += l2), h2 && (a2.pitch += h2), n2 && (a2.zoom += n2), o2 ? this._terrainMovement || !e2.drag && !e2.zoom ? e2.drag && this._terrainMovement ? a2.center = a2.pointLocation(a2.centerPoint.sub(r2)) : a2.setLocationAtPoint(d2, c2) : (this._terrainMovement = true, this._map._elevationFreeze = true, a2.setLocationAtPoint(d2, c2), this._map.once("moveend", (() => {
|
||
this._map._elevationFreeze = false, this._terrainMovement = false, a2.recalculateZoom(s2.terrain);
|
||
}))) : a2.setLocationAtPoint(d2, c2), s2._applyUpdatedTransform(a2), this._map._update(), t2.noInertia || this._inertia.record(t2), this._fireEvents(e2, i3, true);
|
||
}
|
||
_fireEvents(e2, i3, s2) {
|
||
const a2 = ea(this._eventsInProgress), o2 = ea(e2), r2 = {};
|
||
for (const t2 in e2) {
|
||
const { originalEvent: i4 } = e2[t2];
|
||
this._eventsInProgress[t2] || (r2[`${t2}start`] = i4), this._eventsInProgress[t2] = e2[t2];
|
||
}
|
||
!a2 && o2 && this._fireEvent("movestart", o2.originalEvent);
|
||
for (const t2 in r2) this._fireEvent(t2, r2[t2]);
|
||
o2 && this._fireEvent("move", o2.originalEvent);
|
||
for (const t2 in e2) {
|
||
const { originalEvent: i4 } = e2[t2];
|
||
this._fireEvent(t2, i4);
|
||
}
|
||
const n2 = {};
|
||
let l2;
|
||
for (const t2 in this._eventsInProgress) {
|
||
const { handlerName: e3, originalEvent: s3 } = this._eventsInProgress[t2];
|
||
this._handlersById[e3].isActive() || (delete this._eventsInProgress[t2], l2 = i3[e3] || s3, n2[`${t2}end`] = l2);
|
||
}
|
||
for (const t2 in n2) this._fireEvent(t2, n2[t2]);
|
||
const h2 = ea(this._eventsInProgress);
|
||
if (s2 && (a2 || o2) && !h2) {
|
||
this._updatingCamera = true;
|
||
const e3 = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i4 = (t2) => 0 !== t2 && -this._bearingSnap < t2 && t2 < this._bearingSnap;
|
||
!e3 || !e3.essential && t.h.prefersReducedMotion ? (this._map.fire(new t.k("moveend", { originalEvent: l2 })), i4(this._map.getBearing()) && this._map.resetNorth()) : (i4(e3.bearing || this._map.getBearing()) && (e3.bearing = 0), e3.freezeElevation = true, this._map.easeTo(e3, { originalEvent: l2 })), this._updatingCamera = false;
|
||
}
|
||
}
|
||
_fireEvent(e2, i3) {
|
||
this._map.fire(new t.k(e2, i3 ? { originalEvent: i3 } : {}));
|
||
}
|
||
_requestFrame() {
|
||
return this._map.triggerRepaint(), this._map._renderTaskQueue.add(((t2) => {
|
||
delete this._frameId, this.handleEvent(new ia("renderFrame", { timeStamp: t2 })), this._applyChanges();
|
||
}));
|
||
}
|
||
_triggerRenderFrame() {
|
||
void 0 === this._frameId && (this._frameId = this._requestFrame());
|
||
}
|
||
}
|
||
class oa extends t.E {
|
||
constructor(e2, i3) {
|
||
super(), this._renderFrameCallback = () => {
|
||
const e3 = Math.min((t.h.now() - this._easeStart) / this._easeOptions.duration, 1);
|
||
this._onEaseFrame(this._easeOptions.easing(e3)), e3 < 1 && this._easeFrameId ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();
|
||
}, this._moving = false, this._zooming = false, this.transform = e2, this._bearingSnap = i3.bearingSnap, this.on("moveend", (() => {
|
||
delete this._requestedCameraState;
|
||
}));
|
||
}
|
||
getCenter() {
|
||
return new t.L(this.transform.center.lng, this.transform.center.lat);
|
||
}
|
||
setCenter(t2, e2) {
|
||
return this.jumpTo({ center: t2 }, e2);
|
||
}
|
||
panBy(e2, i3, s2) {
|
||
return e2 = t.P.convert(e2).mult(-1), this.panTo(this.transform.center, t.e({ offset: e2 }, i3), s2);
|
||
}
|
||
panTo(e2, i3, s2) {
|
||
return this.easeTo(t.e({ center: e2 }, i3), s2);
|
||
}
|
||
getZoom() {
|
||
return this.transform.zoom;
|
||
}
|
||
setZoom(t2, e2) {
|
||
return this.jumpTo({ zoom: t2 }, e2), this;
|
||
}
|
||
zoomTo(e2, i3, s2) {
|
||
return this.easeTo(t.e({ zoom: e2 }, i3), s2);
|
||
}
|
||
zoomIn(t2, e2) {
|
||
return this.zoomTo(this.getZoom() + 1, t2, e2), this;
|
||
}
|
||
zoomOut(t2, e2) {
|
||
return this.zoomTo(this.getZoom() - 1, t2, e2), this;
|
||
}
|
||
getBearing() {
|
||
return this.transform.bearing;
|
||
}
|
||
setBearing(t2, e2) {
|
||
return this.jumpTo({ bearing: t2 }, e2), this;
|
||
}
|
||
getPadding() {
|
||
return this.transform.padding;
|
||
}
|
||
setPadding(t2, e2) {
|
||
return this.jumpTo({ padding: t2 }, e2), this;
|
||
}
|
||
rotateTo(e2, i3, s2) {
|
||
return this.easeTo(t.e({ bearing: e2 }, i3), s2);
|
||
}
|
||
resetNorth(e2, i3) {
|
||
return this.rotateTo(0, t.e({ duration: 1e3 }, e2), i3), this;
|
||
}
|
||
resetNorthPitch(e2, i3) {
|
||
return this.easeTo(t.e({ bearing: 0, pitch: 0, duration: 1e3 }, e2), i3), this;
|
||
}
|
||
snapToNorth(t2, e2) {
|
||
return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(t2, e2) : this;
|
||
}
|
||
getPitch() {
|
||
return this.transform.pitch;
|
||
}
|
||
setPitch(t2, e2) {
|
||
return this.jumpTo({ pitch: t2 }, e2), this;
|
||
}
|
||
cameraForBounds(t2, e2) {
|
||
t2 = L.convert(t2);
|
||
const i3 = e2 && e2.bearing || 0;
|
||
return this._cameraForBoxAndBearing(t2.getNorthWest(), t2.getSouthEast(), i3, e2);
|
||
}
|
||
_cameraForBoxAndBearing(e2, i3, s2, a2) {
|
||
const o2 = { top: 0, bottom: 0, right: 0, left: 0 };
|
||
if ("number" == typeof (a2 = t.e({ padding: o2, offset: [0, 0], maxZoom: this.transform.maxZoom }, a2)).padding) {
|
||
const t2 = a2.padding;
|
||
a2.padding = { top: t2, bottom: t2, right: t2, left: t2 };
|
||
}
|
||
a2.padding = t.e(o2, a2.padding);
|
||
const r2 = this.transform, n2 = r2.padding, l2 = r2.project(t.L.convert(e2)), h2 = r2.project(t.L.convert(i3)), c2 = l2.rotate(-s2 * Math.PI / 180), u2 = h2.rotate(-s2 * Math.PI / 180), d2 = new t.P(Math.max(c2.x, u2.x), Math.max(c2.y, u2.y)), _2 = new t.P(Math.min(c2.x, u2.x), Math.min(c2.y, u2.y)), p2 = d2.sub(_2), m2 = (r2.width - (n2.left + n2.right + a2.padding.left + a2.padding.right)) / p2.x, f2 = (r2.height - (n2.top + n2.bottom + a2.padding.top + a2.padding.bottom)) / p2.y;
|
||
if (f2 < 0 || m2 < 0) return void t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
|
||
const g2 = Math.min(r2.scaleZoom(r2.scale * Math.min(m2, f2)), a2.maxZoom), v2 = t.P.convert(a2.offset), x2 = new t.P((a2.padding.left - a2.padding.right) / 2, (a2.padding.top - a2.padding.bottom) / 2).rotate(s2 * Math.PI / 180), y2 = v2.add(x2).mult(r2.scale / r2.zoomScale(g2));
|
||
return { center: r2.unproject(l2.add(h2).div(2).sub(y2)), zoom: g2, bearing: s2 };
|
||
}
|
||
fitBounds(t2, e2, i3) {
|
||
return this._fitInternal(this.cameraForBounds(t2, e2), e2, i3);
|
||
}
|
||
fitScreenCoordinates(e2, i3, s2, a2, o2) {
|
||
return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.P.convert(e2)), this.transform.pointLocation(t.P.convert(i3)), s2, a2), a2, o2);
|
||
}
|
||
_fitInternal(e2, i3, s2) {
|
||
return e2 ? (delete (i3 = t.e(e2, i3)).padding, i3.linear ? this.easeTo(i3, s2) : this.flyTo(i3, s2)) : this;
|
||
}
|
||
jumpTo(e2, i3) {
|
||
this.stop();
|
||
const s2 = this._getTransformForUpdate();
|
||
let a2 = false, o2 = false, r2 = false;
|
||
return "zoom" in e2 && s2.zoom !== +e2.zoom && (a2 = true, s2.zoom = +e2.zoom), void 0 !== e2.center && (s2.center = t.L.convert(e2.center)), "bearing" in e2 && s2.bearing !== +e2.bearing && (o2 = true, s2.bearing = +e2.bearing), "pitch" in e2 && s2.pitch !== +e2.pitch && (r2 = true, s2.pitch = +e2.pitch), null == e2.padding || s2.isPaddingEqual(e2.padding) || (s2.padding = e2.padding), this._applyUpdatedTransform(s2), this.fire(new t.k("movestart", i3)).fire(new t.k("move", i3)), a2 && this.fire(new t.k("zoomstart", i3)).fire(new t.k("zoom", i3)).fire(new t.k("zoomend", i3)), o2 && this.fire(new t.k("rotatestart", i3)).fire(new t.k("rotate", i3)).fire(new t.k("rotateend", i3)), r2 && this.fire(new t.k("pitchstart", i3)).fire(new t.k("pitch", i3)).fire(new t.k("pitchend", i3)), this.fire(new t.k("moveend", i3));
|
||
}
|
||
calculateCameraOptionsFromTo(e2, i3, s2, a2 = 0) {
|
||
const o2 = t.U.fromLngLat(e2, i3), r2 = t.U.fromLngLat(s2, a2), n2 = r2.x - o2.x, l2 = r2.y - o2.y, h2 = r2.z - o2.z, c2 = Math.hypot(n2, l2, h2);
|
||
if (0 === c2) throw new Error("Can't calculate camera options with same From and To");
|
||
const u2 = Math.hypot(n2, l2), d2 = this.transform.scaleZoom(this.transform.cameraToCenterDistance / c2 / this.transform.tileSize), _2 = 180 * Math.atan2(n2, -l2) / Math.PI;
|
||
let p2 = 180 * Math.acos(u2 / c2) / Math.PI;
|
||
return p2 = h2 < 0 ? 90 - p2 : 90 + p2, { center: r2.toLngLat(), zoom: d2, pitch: p2, bearing: _2 };
|
||
}
|
||
easeTo(e2, i3) {
|
||
this._stop(false, e2.easeId), (false === (e2 = t.e({ offset: [0, 0], duration: 500, easing: t.bb }, e2)).animate || !e2.essential && t.h.prefersReducedMotion) && (e2.duration = 0);
|
||
const s2 = this._getTransformForUpdate(), a2 = this.getZoom(), o2 = this.getBearing(), r2 = this.getPitch(), n2 = this.getPadding(), l2 = "zoom" in e2 ? +e2.zoom : a2, h2 = "bearing" in e2 ? this._normalizeBearing(e2.bearing, o2) : o2, c2 = "pitch" in e2 ? +e2.pitch : r2, u2 = "padding" in e2 ? e2.padding : s2.padding, d2 = t.P.convert(e2.offset);
|
||
let _2 = s2.centerPoint.add(d2);
|
||
const p2 = s2.pointLocation(_2), m2 = t.L.convert(e2.center || p2);
|
||
this._normalizeCenter(m2);
|
||
const f2 = s2.project(p2), g2 = s2.project(m2).sub(f2), v2 = s2.zoomScale(l2 - a2);
|
||
let x2, y2;
|
||
e2.around && (x2 = t.L.convert(e2.around), y2 = s2.locationPoint(x2));
|
||
const b2 = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };
|
||
return this._zooming = this._zooming || l2 !== a2, this._rotating = this._rotating || o2 !== h2, this._pitching = this._pitching || c2 !== r2, this._padding = !s2.isPaddingEqual(u2), this._easeId = e2.easeId, this._prepareEase(i3, e2.noMoveStart, b2), this.terrain && this._prepareElevation(m2), this._ease(((p3) => {
|
||
if (this._zooming && (s2.zoom = t.B.number(a2, l2, p3)), this._rotating && (s2.bearing = t.B.number(o2, h2, p3)), this._pitching && (s2.pitch = t.B.number(r2, c2, p3)), this._padding && (s2.interpolatePadding(n2, u2, p3), _2 = s2.centerPoint.add(d2)), this.terrain && !e2.freezeElevation && this._updateElevation(p3), x2) s2.setLocationAtPoint(x2, y2);
|
||
else {
|
||
const t2 = s2.zoomScale(s2.zoom - a2), e3 = l2 > a2 ? Math.min(2, v2) : Math.max(0.5, v2), i4 = Math.pow(e3, 1 - p3), o3 = s2.unproject(f2.add(g2.mult(p3 * i4)).mult(t2));
|
||
s2.setLocationAtPoint(s2.renderWorldCopies ? o3.wrap() : o3, _2);
|
||
}
|
||
this._applyUpdatedTransform(s2), this._fireMoveEvents(i3);
|
||
}), ((t2) => {
|
||
this.terrain && this._finalizeElevation(), this._afterEase(i3, t2);
|
||
}), e2), this;
|
||
}
|
||
_prepareEase(e2, i3, s2 = {}) {
|
||
this._moving = true, i3 || s2.moving || this.fire(new t.k("movestart", e2)), this._zooming && !s2.zooming && this.fire(new t.k("zoomstart", e2)), this._rotating && !s2.rotating && this.fire(new t.k("rotatestart", e2)), this._pitching && !s2.pitching && this.fire(new t.k("pitchstart", e2));
|
||
}
|
||
_prepareElevation(t2) {
|
||
this._elevationCenter = t2, this._elevationStart = this.transform.elevation, this._elevationTarget = this.terrain.getElevationForLngLatZoom(t2, this.transform.tileZoom), this._elevationFreeze = true;
|
||
}
|
||
_updateElevation(e2) {
|
||
this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
|
||
const i3 = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
|
||
if (e2 < 1 && i3 !== this._elevationTarget) {
|
||
const t2 = this._elevationTarget - this._elevationStart;
|
||
this._elevationStart += e2 * (t2 - (i3 - (t2 * e2 + this._elevationStart)) / (1 - e2)), this._elevationTarget = i3;
|
||
}
|
||
this.transform.elevation = t.B.number(this._elevationStart, this._elevationTarget, e2);
|
||
}
|
||
_finalizeElevation() {
|
||
this._elevationFreeze = false, this.transform.recalculateZoom(this.terrain);
|
||
}
|
||
_getTransformForUpdate() {
|
||
return this.transformCameraUpdate ? (this._requestedCameraState || (this._requestedCameraState = this.transform.clone()), this._requestedCameraState) : this.transform;
|
||
}
|
||
_applyUpdatedTransform(t2) {
|
||
if (!this.transformCameraUpdate) return;
|
||
const e2 = t2.clone(), { center: i3, zoom: s2, pitch: a2, bearing: o2, elevation: r2 } = this.transformCameraUpdate(e2);
|
||
i3 && (e2.center = i3), void 0 !== s2 && (e2.zoom = s2), void 0 !== a2 && (e2.pitch = a2), void 0 !== o2 && (e2.bearing = o2), void 0 !== r2 && (e2.elevation = r2), this.transform.apply(e2);
|
||
}
|
||
_fireMoveEvents(e2) {
|
||
this.fire(new t.k("move", e2)), this._zooming && this.fire(new t.k("zoom", e2)), this._rotating && this.fire(new t.k("rotate", e2)), this._pitching && this.fire(new t.k("pitch", e2));
|
||
}
|
||
_afterEase(e2, i3) {
|
||
if (this._easeId && i3 && this._easeId === i3) return;
|
||
delete this._easeId;
|
||
const s2 = this._zooming, a2 = this._rotating, o2 = this._pitching;
|
||
this._moving = false, this._zooming = false, this._rotating = false, this._pitching = false, this._padding = false, s2 && this.fire(new t.k("zoomend", e2)), a2 && this.fire(new t.k("rotateend", e2)), o2 && this.fire(new t.k("pitchend", e2)), this.fire(new t.k("moveend", e2));
|
||
}
|
||
flyTo(e2, i3) {
|
||
if (!e2.essential && t.h.prefersReducedMotion) {
|
||
const s3 = t.F(e2, ["center", "zoom", "bearing", "pitch", "around"]);
|
||
return this.jumpTo(s3, i3);
|
||
}
|
||
this.stop(), e2 = t.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: t.bb }, e2);
|
||
const s2 = this._getTransformForUpdate(), a2 = this.getZoom(), o2 = this.getBearing(), r2 = this.getPitch(), n2 = this.getPadding(), l2 = "zoom" in e2 ? t.ad(+e2.zoom, s2.minZoom, s2.maxZoom) : a2, h2 = "bearing" in e2 ? this._normalizeBearing(e2.bearing, o2) : o2, c2 = "pitch" in e2 ? +e2.pitch : r2, u2 = "padding" in e2 ? e2.padding : s2.padding, d2 = s2.zoomScale(l2 - a2), _2 = t.P.convert(e2.offset);
|
||
let p2 = s2.centerPoint.add(_2);
|
||
const m2 = s2.pointLocation(p2), f2 = t.L.convert(e2.center || m2);
|
||
this._normalizeCenter(f2);
|
||
const g2 = s2.project(m2), v2 = s2.project(f2).sub(g2);
|
||
let x2 = e2.curve;
|
||
const y2 = Math.max(s2.width, s2.height), b2 = y2 / d2, w2 = v2.mag();
|
||
if ("minZoom" in e2) {
|
||
const i4 = t.ad(Math.min(e2.minZoom, a2, l2), s2.minZoom, s2.maxZoom), o3 = y2 / s2.zoomScale(i4 - a2);
|
||
x2 = Math.sqrt(o3 / w2 * 2);
|
||
}
|
||
const T2 = x2 * x2;
|
||
function I2(t2) {
|
||
const e3 = (b2 * b2 - y2 * y2 + (t2 ? -1 : 1) * T2 * T2 * w2 * w2) / (2 * (t2 ? b2 : y2) * T2 * w2);
|
||
return Math.log(Math.sqrt(e3 * e3 + 1) - e3);
|
||
}
|
||
function E2(t2) {
|
||
return (Math.exp(t2) - Math.exp(-t2)) / 2;
|
||
}
|
||
function S2(t2) {
|
||
return (Math.exp(t2) + Math.exp(-t2)) / 2;
|
||
}
|
||
const C2 = I2(false);
|
||
let P2 = function(t2) {
|
||
return S2(C2) / S2(C2 + x2 * t2);
|
||
}, D2 = function(t2) {
|
||
return y2 * ((S2(C2) * (E2(e3 = C2 + x2 * t2) / S2(e3)) - E2(C2)) / T2) / w2;
|
||
var e3;
|
||
}, M2 = (I2(true) - C2) / x2;
|
||
if (Math.abs(w2) < 1e-6 || !isFinite(M2)) {
|
||
if (Math.abs(y2 - b2) < 1e-6) return this.easeTo(e2, i3);
|
||
const t2 = b2 < y2 ? -1 : 1;
|
||
M2 = Math.abs(Math.log(b2 / y2)) / x2, D2 = function() {
|
||
return 0;
|
||
}, P2 = function(e3) {
|
||
return Math.exp(t2 * x2 * e3);
|
||
};
|
||
}
|
||
return e2.duration = "duration" in e2 ? +e2.duration : 1e3 * M2 / ("screenSpeed" in e2 ? +e2.screenSpeed / x2 : +e2.speed), e2.maxDuration && e2.duration > e2.maxDuration && (e2.duration = 0), this._zooming = true, this._rotating = o2 !== h2, this._pitching = c2 !== r2, this._padding = !s2.isPaddingEqual(u2), this._prepareEase(i3, false), this.terrain && this._prepareElevation(f2), this._ease(((d3) => {
|
||
const m3 = d3 * M2, x3 = 1 / P2(m3);
|
||
s2.zoom = 1 === d3 ? l2 : a2 + s2.scaleZoom(x3), this._rotating && (s2.bearing = t.B.number(o2, h2, d3)), this._pitching && (s2.pitch = t.B.number(r2, c2, d3)), this._padding && (s2.interpolatePadding(n2, u2, d3), p2 = s2.centerPoint.add(_2)), this.terrain && !e2.freezeElevation && this._updateElevation(d3);
|
||
const y3 = 1 === d3 ? f2 : s2.unproject(g2.add(v2.mult(D2(m3))).mult(x3));
|
||
s2.setLocationAtPoint(s2.renderWorldCopies ? y3.wrap() : y3, p2), this._applyUpdatedTransform(s2), this._fireMoveEvents(i3);
|
||
}), (() => {
|
||
this.terrain && this._finalizeElevation(), this._afterEase(i3);
|
||
}), e2), this;
|
||
}
|
||
isEasing() {
|
||
return !!this._easeFrameId;
|
||
}
|
||
stop() {
|
||
return this._stop();
|
||
}
|
||
_stop(t2, e2) {
|
||
if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {
|
||
const t3 = this._onEaseEnd;
|
||
delete this._onEaseEnd, t3.call(this, e2);
|
||
}
|
||
if (!t2) {
|
||
const t3 = this.handlers;
|
||
t3 && t3.stop(false);
|
||
}
|
||
return this;
|
||
}
|
||
_ease(e2, i3, s2) {
|
||
false === s2.animate || 0 === s2.duration ? (e2(1), i3()) : (this._easeStart = t.h.now(), this._easeOptions = s2, this._onEaseFrame = e2, this._onEaseEnd = i3, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));
|
||
}
|
||
_normalizeBearing(e2, i3) {
|
||
e2 = t.b5(e2, -180, 180);
|
||
const s2 = Math.abs(e2 - i3);
|
||
return Math.abs(e2 - 360 - i3) < s2 && (e2 -= 360), Math.abs(e2 + 360 - i3) < s2 && (e2 += 360), e2;
|
||
}
|
||
_normalizeCenter(t2) {
|
||
const e2 = this.transform;
|
||
if (!e2.renderWorldCopies || e2.lngRange) return;
|
||
const i3 = t2.lng - e2.center.lng;
|
||
t2.lng += i3 > 180 ? -360 : i3 < -180 ? 360 : 0;
|
||
}
|
||
queryTerrainElevation(e2) {
|
||
return this.terrain ? this.terrain.getElevationForLngLatZoom(t.L.convert(e2), this.transform.tileZoom) - this.transform.elevation : null;
|
||
}
|
||
}
|
||
class ra {
|
||
constructor(t2 = {}) {
|
||
this._toggleAttribution = () => {
|
||
this._container.classList.contains("maplibregl-compact") && (this._container.classList.contains("maplibregl-compact-show") ? (this._container.setAttribute("open", ""), this._container.classList.remove("maplibregl-compact-show")) : (this._container.classList.add("maplibregl-compact-show"), this._container.removeAttribute("open")));
|
||
}, this._updateData = (t3) => {
|
||
!t3 || "metadata" !== t3.sourceDataType && "visibility" !== t3.sourceDataType && "style" !== t3.dataType && "terrain" !== t3.type || this._updateAttributions();
|
||
}, this._updateCompact = () => {
|
||
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false === this._compact ? this._container.setAttribute("open", "") : this._container.classList.contains("maplibregl-compact") || this._container.classList.contains("maplibregl-attrib-empty") || (this._container.setAttribute("open", ""), this._container.classList.add("maplibregl-compact", "maplibregl-compact-show")) : (this._container.setAttribute("open", ""), this._container.classList.contains("maplibregl-compact") && this._container.classList.remove("maplibregl-compact", "maplibregl-compact-show"));
|
||
}, this._updateCompactMinimize = () => {
|
||
this._container.classList.contains("maplibregl-compact") && this._container.classList.contains("maplibregl-compact-show") && this._container.classList.remove("maplibregl-compact-show");
|
||
}, this.options = t2;
|
||
}
|
||
getDefaultPosition() {
|
||
return "bottom-right";
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this._compact = this.options && this.options.compact, this._container = i2.create("details", "maplibregl-ctrl maplibregl-ctrl-attrib"), this._compactButton = i2.create("summary", "maplibregl-ctrl-attrib-button", this._container), this._compactButton.addEventListener("click", this._toggleAttribution), this._setElementTitle(this._compactButton, "ToggleAttribution"), this._innerContainer = i2.create("div", "maplibregl-ctrl-attrib-inner", this._container), this._updateAttributions(), this._updateCompact(), this._map.on("styledata", this._updateData), this._map.on("sourcedata", this._updateData), this._map.on("terrain", this._updateData), this._map.on("resize", this._updateCompact), this._map.on("drag", this._updateCompactMinimize), this._container;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._container), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("terrain", this._updateData), this._map.off("resize", this._updateCompact), this._map.off("drag", this._updateCompactMinimize), this._map = void 0, this._compact = void 0, this._attribHTML = void 0;
|
||
}
|
||
_setElementTitle(t2, e2) {
|
||
const i3 = this._map._getUIString(`AttributionControl.${e2}`);
|
||
t2.title = i3, t2.setAttribute("aria-label", i3);
|
||
}
|
||
_updateAttributions() {
|
||
if (!this._map.style) return;
|
||
let t2 = [];
|
||
if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? t2 = t2.concat(this.options.customAttribution.map(((t3) => "string" != typeof t3 ? "" : t3))) : "string" == typeof this.options.customAttribution && t2.push(this.options.customAttribution)), this._map.style.stylesheet) {
|
||
const t3 = this._map.style.stylesheet;
|
||
this.styleOwner = t3.owner, this.styleId = t3.id;
|
||
}
|
||
const e2 = this._map.style.sourceCaches;
|
||
for (const i4 in e2) {
|
||
const s2 = e2[i4];
|
||
if (s2.used || s2.usedForTerrain) {
|
||
const e3 = s2.getSource();
|
||
e3.attribution && t2.indexOf(e3.attribution) < 0 && t2.push(e3.attribution);
|
||
}
|
||
}
|
||
t2 = t2.filter(((t3) => String(t3).trim())), t2.sort(((t3, e3) => t3.length - e3.length)), t2 = t2.filter(((e3, i4) => {
|
||
for (let s2 = i4 + 1; s2 < t2.length; s2++) if (t2[s2].indexOf(e3) >= 0) return false;
|
||
return true;
|
||
}));
|
||
const i3 = t2.join(" | ");
|
||
i3 !== this._attribHTML && (this._attribHTML = i3, t2.length ? (this._innerContainer.innerHTML = i3, this._container.classList.remove("maplibregl-attrib-empty")) : this._container.classList.add("maplibregl-attrib-empty"), this._updateCompact(), this._editLink = null);
|
||
}
|
||
}
|
||
class na {
|
||
constructor(t2 = {}) {
|
||
this._updateCompact = () => {
|
||
const t3 = this._container.children;
|
||
if (t3.length) {
|
||
const e2 = t3[0];
|
||
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false !== this._compact && e2.classList.add("maplibregl-compact") : e2.classList.remove("maplibregl-compact");
|
||
}
|
||
}, this.options = t2;
|
||
}
|
||
getDefaultPosition() {
|
||
return "bottom-left";
|
||
}
|
||
onAdd(t2) {
|
||
this._map = t2, this._compact = this.options && this.options.compact, this._container = i2.create("div", "maplibregl-ctrl");
|
||
const e2 = i2.create("a", "maplibregl-ctrl-logo");
|
||
return e2.target = "_blank", e2.rel = "noopener nofollow", e2.href = "https://maplibre.org/", e2.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), e2.setAttribute("rel", "noopener nofollow"), this._container.appendChild(e2), this._container.style.display = "block", this._map.on("resize", this._updateCompact), this._updateCompact(), this._container;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._container), this._map.off("resize", this._updateCompact), this._map = void 0, this._compact = void 0;
|
||
}
|
||
}
|
||
class la {
|
||
constructor() {
|
||
this._queue = [], this._id = 0, this._cleared = false, this._currentlyRunning = false;
|
||
}
|
||
add(t2) {
|
||
const e2 = ++this._id;
|
||
return this._queue.push({ callback: t2, id: e2, cancelled: false }), e2;
|
||
}
|
||
remove(t2) {
|
||
const e2 = this._currentlyRunning, i3 = e2 ? this._queue.concat(e2) : this._queue;
|
||
for (const e3 of i3) if (e3.id === t2) return void (e3.cancelled = true);
|
||
}
|
||
run(t2 = 0) {
|
||
if (this._currentlyRunning) throw new Error("Attempting to run(), but is already running.");
|
||
const e2 = this._currentlyRunning = this._queue;
|
||
this._queue = [];
|
||
for (const i3 of e2) if (!i3.cancelled && (i3.callback(t2), this._cleared)) break;
|
||
this._cleared = false, this._currentlyRunning = false;
|
||
}
|
||
clear() {
|
||
this._currentlyRunning && (this._cleared = true), this._queue = [];
|
||
}
|
||
}
|
||
const ha = { "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", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "ScaleControl.Feet": "ft", "ScaleControl.Meters": "m", "ScaleControl.Kilometers": "km", "ScaleControl.Miles": "mi", "ScaleControl.NauticalMiles": "nm", "TerrainControl.enableTerrain": "Enable terrain", "TerrainControl.disableTerrain": "Disable terrain" };
|
||
var ca = t.Q([{ name: "a_pos3d", type: "Int16", components: 3 }]);
|
||
class ua extends t.E {
|
||
constructor(t2) {
|
||
super(), this.sourceCache = t2, this._tiles = {}, this._renderableTilesKeys = [], this._sourceTileCache = {}, this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.deltaZoom = 1, t2.usedForTerrain = true, t2.tileSize = this.tileSize * 2 ** this.deltaZoom;
|
||
}
|
||
destruct() {
|
||
this.sourceCache.usedForTerrain = false, this.sourceCache.tileSize = null;
|
||
}
|
||
update(e2, i3) {
|
||
this.sourceCache.update(e2, i3), this._renderableTilesKeys = [];
|
||
const s2 = {};
|
||
for (const a2 of e2.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: false, terrain: i3 })) s2[a2.key] = true, this._renderableTilesKeys.push(a2.key), this._tiles[a2.key] || (a2.posMatrix = new Float64Array(16), t.aS(a2.posMatrix, 0, t.N, 0, t.N, 0, 1), this._tiles[a2.key] = new W(a2, this.tileSize));
|
||
for (const t2 in this._tiles) s2[t2] || delete this._tiles[t2];
|
||
}
|
||
freeRtt(t2) {
|
||
for (const e2 in this._tiles) {
|
||
const i3 = this._tiles[e2];
|
||
(!t2 || i3.tileID.equals(t2) || i3.tileID.isChildOf(t2) || t2.isChildOf(i3.tileID)) && (i3.rtt = []);
|
||
}
|
||
}
|
||
getRenderableTiles() {
|
||
return this._renderableTilesKeys.map(((t2) => this.getTileByID(t2)));
|
||
}
|
||
getTileByID(t2) {
|
||
return this._tiles[t2];
|
||
}
|
||
getTerrainCoords(e2) {
|
||
const i3 = {};
|
||
for (const s2 of this._renderableTilesKeys) {
|
||
const a2 = this._tiles[s2].tileID;
|
||
if (a2.canonical.equals(e2.canonical)) {
|
||
const a3 = e2.clone();
|
||
a3.posMatrix = new Float64Array(16), t.aS(a3.posMatrix, 0, t.N, 0, t.N, 0, 1), i3[s2] = a3;
|
||
} else if (a2.canonical.isChildOf(e2.canonical)) {
|
||
const o2 = e2.clone();
|
||
o2.posMatrix = new Float64Array(16);
|
||
const r2 = a2.canonical.z - e2.canonical.z, n2 = a2.canonical.x - (a2.canonical.x >> r2 << r2), l2 = a2.canonical.y - (a2.canonical.y >> r2 << r2), h2 = t.N >> r2;
|
||
t.aS(o2.posMatrix, 0, h2, 0, h2, 0, 1), t.$(o2.posMatrix, o2.posMatrix, [-n2 * h2, -l2 * h2, 0]), i3[s2] = o2;
|
||
} else if (e2.canonical.isChildOf(a2.canonical)) {
|
||
const o2 = e2.clone();
|
||
o2.posMatrix = new Float64Array(16);
|
||
const r2 = e2.canonical.z - a2.canonical.z, n2 = e2.canonical.x - (e2.canonical.x >> r2 << r2), l2 = e2.canonical.y - (e2.canonical.y >> r2 << r2), h2 = t.N >> r2;
|
||
t.aS(o2.posMatrix, 0, t.N, 0, t.N, 0, 1), t.$(o2.posMatrix, o2.posMatrix, [n2 * h2, l2 * h2, 0]), t.a0(o2.posMatrix, o2.posMatrix, [1 / 2 ** r2, 1 / 2 ** r2, 0]), i3[s2] = o2;
|
||
}
|
||
}
|
||
return i3;
|
||
}
|
||
getSourceTile(t2, e2) {
|
||
const i3 = this.sourceCache._source;
|
||
let s2 = t2.overscaledZ - this.deltaZoom;
|
||
if (s2 > i3.maxzoom && (s2 = i3.maxzoom), s2 < i3.minzoom) return null;
|
||
this._sourceTileCache[t2.key] || (this._sourceTileCache[t2.key] = t2.scaledTo(s2).key);
|
||
let a2 = this.sourceCache.getTileByID(this._sourceTileCache[t2.key]);
|
||
if ((!a2 || !a2.dem) && e2) for (; s2 >= i3.minzoom && (!a2 || !a2.dem); ) a2 = this.sourceCache.getTileByID(t2.scaledTo(s2--).key);
|
||
return a2;
|
||
}
|
||
tilesAfterTime(t2 = Date.now()) {
|
||
return Object.values(this._tiles).filter(((e2) => e2.timeAdded >= t2));
|
||
}
|
||
}
|
||
class da {
|
||
constructor(t2, e2, i3) {
|
||
this.painter = t2, this.sourceCache = new ua(e2), this.options = i3, this.exaggeration = "number" == typeof i3.exaggeration ? i3.exaggeration : 1, this.qualityFactor = 2, this.meshSize = 128, this._demMatrixCache = {}, this.coordsIndex = [], this._coordsTextureSize = 1024;
|
||
}
|
||
getDEMElevation(e2, i3, s2, a2 = t.N) {
|
||
var o2;
|
||
if (!(i3 >= 0 && i3 < a2 && s2 >= 0 && s2 < a2)) return 0;
|
||
const r2 = this.getTerrainData(e2), n2 = null === (o2 = r2.tile) || void 0 === o2 ? void 0 : o2.dem;
|
||
if (!n2) return 0;
|
||
const l2 = (function(t2, e3, i4) {
|
||
var s3 = e3[0], a3 = e3[1];
|
||
return t2[0] = i4[0] * s3 + i4[4] * a3 + i4[12], t2[1] = i4[1] * s3 + i4[5] * a3 + i4[13], t2;
|
||
})([], [i3 / a2 * t.N, s2 / a2 * t.N], r2.u_terrain_matrix), h2 = [l2[0] * n2.dim, l2[1] * n2.dim], c2 = Math.floor(h2[0]), u2 = Math.floor(h2[1]), d2 = h2[0] - c2, _2 = h2[1] - u2;
|
||
return n2.get(c2, u2) * (1 - d2) * (1 - _2) + n2.get(c2 + 1, u2) * d2 * (1 - _2) + n2.get(c2, u2 + 1) * (1 - d2) * _2 + n2.get(c2 + 1, u2 + 1) * d2 * _2;
|
||
}
|
||
getElevationForLngLatZoom(e2, i3) {
|
||
const { tileID: s2, mercatorX: a2, mercatorY: o2 } = this._getOverscaledTileIDFromLngLatZoom(e2, i3);
|
||
return this.getElevation(s2, a2 % t.N, o2 % t.N, t.N);
|
||
}
|
||
getElevation(e2, i3, s2, a2 = t.N) {
|
||
return this.getDEMElevation(e2, i3, s2, a2) * this.exaggeration;
|
||
}
|
||
getTerrainData(e2) {
|
||
if (!this._emptyDemTexture) {
|
||
const e3 = this.painter.context, i4 = new t.R({ width: 1, height: 1 }, new Uint8Array(4));
|
||
this._emptyDepthTexture = new x(e3, i4, e3.gl.RGBA, { premultiply: false }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new x(e3, new t.R({ width: 1, height: 1 }), e3.gl.RGBA, { premultiply: false }), this._emptyDemTexture.bind(e3.gl.NEAREST, e3.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = t.ao([]);
|
||
}
|
||
const i3 = this.sourceCache.getSourceTile(e2, true);
|
||
if (i3 && i3.dem && (!i3.demTexture || i3.needsTerrainPrepare)) {
|
||
const t2 = this.painter.context;
|
||
i3.demTexture = this.painter.getTileTexture(i3.dem.stride), i3.demTexture ? i3.demTexture.update(i3.dem.getPixels(), { premultiply: false }) : i3.demTexture = new x(t2, i3.dem.getPixels(), t2.gl.RGBA, { premultiply: false }), i3.demTexture.bind(t2.gl.NEAREST, t2.gl.CLAMP_TO_EDGE), i3.needsTerrainPrepare = false;
|
||
}
|
||
const s2 = i3 && i3 + i3.tileID.key + e2.key;
|
||
if (s2 && !this._demMatrixCache[s2]) {
|
||
const s3 = this.sourceCache.sourceCache._source.maxzoom;
|
||
let a2 = e2.canonical.z - i3.tileID.canonical.z;
|
||
e2.overscaledZ > e2.canonical.z && (e2.canonical.z >= s3 ? a2 = e2.canonical.z - s3 : t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));
|
||
const o2 = e2.canonical.x - (e2.canonical.x >> a2 << a2), r2 = e2.canonical.y - (e2.canonical.y >> a2 << a2), n2 = t.bc(new Float64Array(16), [1 / (t.N << a2), 1 / (t.N << a2), 0]);
|
||
t.$(n2, n2, [o2 * t.N, r2 * t.N, 0]), this._demMatrixCache[e2.key] = { matrix: n2, coord: e2 };
|
||
}
|
||
return { u_depth: 2, u_terrain: 3, u_terrain_dim: i3 && i3.dem && i3.dem.dim || 1, u_terrain_matrix: s2 ? this._demMatrixCache[e2.key].matrix : this._emptyDemMatrix, u_terrain_unpack: i3 && i3.dem && i3.dem.getUnpackVector() || this._emptyDemUnpack, u_terrain_exaggeration: this.exaggeration, texture: (i3 && i3.demTexture || this._emptyDemTexture).texture, depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture, tile: i3 };
|
||
}
|
||
getFramebuffer(t2) {
|
||
const e2 = this.painter, i3 = e2.width / devicePixelRatio, s2 = e2.height / devicePixelRatio;
|
||
return !this._fbo || this._fbo.width === i3 && this._fbo.height === s2 || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new x(e2.context, { width: i3, height: s2, data: null }, e2.context.gl.RGBA, { premultiply: false }), this._fboCoordsTexture.bind(e2.context.gl.NEAREST, e2.context.gl.CLAMP_TO_EDGE)), this._fboDepthTexture || (this._fboDepthTexture = new x(e2.context, { width: i3, height: s2, data: null }, e2.context.gl.RGBA, { premultiply: false }), this._fboDepthTexture.bind(e2.context.gl.NEAREST, e2.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = e2.context.createFramebuffer(i3, s2, true, false), this._fbo.depthAttachment.set(e2.context.createRenderbuffer(e2.context.gl.DEPTH_COMPONENT16, i3, s2))), this._fbo.colorAttachment.set("coords" === t2 ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture), this._fbo;
|
||
}
|
||
getCoordsTexture() {
|
||
const e2 = this.painter.context;
|
||
if (this._coordsTexture) return this._coordsTexture;
|
||
const i3 = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);
|
||
for (let t2 = 0, e3 = 0; t2 < this._coordsTextureSize; t2++) for (let s3 = 0; s3 < this._coordsTextureSize; s3++, e3 += 4) i3[e3 + 0] = 255 & s3, i3[e3 + 1] = 255 & t2, i3[e3 + 2] = s3 >> 8 << 4 | t2 >> 8, i3[e3 + 3] = 0;
|
||
const s2 = new t.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(i3.buffer)), a2 = new x(e2, s2, e2.gl.RGBA, { premultiply: false });
|
||
return a2.bind(e2.gl.NEAREST, e2.gl.CLAMP_TO_EDGE), this._coordsTexture = a2, a2;
|
||
}
|
||
pointCoordinate(e2) {
|
||
const i3 = new Uint8Array(4), s2 = this.painter.context, a2 = s2.gl;
|
||
s2.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer), a2.readPixels(e2.x, this.painter.height / devicePixelRatio - e2.y - 1, 1, 1, a2.RGBA, a2.UNSIGNED_BYTE, i3), s2.bindFramebuffer.set(null);
|
||
const o2 = i3[0] + (i3[2] >> 4 << 8), r2 = i3[1] + ((15 & i3[2]) << 8), n2 = this.coordsIndex[255 - i3[3]], l2 = n2 && this.sourceCache.getTileByID(n2);
|
||
if (!l2) return null;
|
||
const h2 = this._coordsTextureSize, c2 = (1 << l2.tileID.canonical.z) * h2;
|
||
return new t.U(this._allowMercatorOverflow(e2, (l2.tileID.canonical.x * h2 + o2) / c2), (l2.tileID.canonical.y * h2 + r2) / c2, this.getElevation(l2.tileID, o2, r2, h2));
|
||
}
|
||
getTerrainMesh() {
|
||
if (this._mesh) return this._mesh;
|
||
const e2 = this.painter.context, i3 = new t.bd(), s2 = new t.b0(), a2 = this.meshSize, o2 = t.N / a2, r2 = a2 * a2;
|
||
for (let t2 = 0; t2 <= a2; t2++) for (let e3 = 0; e3 <= a2; e3++) i3.emplaceBack(e3 * o2, t2 * o2, 0);
|
||
for (let t2 = 0; t2 < r2; t2 += a2 + 1) for (let e3 = 0; e3 < a2; e3++) s2.emplaceBack(e3 + t2, a2 + e3 + t2 + 1, a2 + e3 + t2 + 2), s2.emplaceBack(e3 + t2, a2 + e3 + t2 + 2, e3 + t2 + 1);
|
||
const n2 = i3.length, l2 = n2 + 2 * (a2 + 1);
|
||
for (const e3 of [0, 1]) for (let s3 = 0; s3 <= a2; s3++) for (const a3 of [0, 1]) i3.emplaceBack(s3 * o2, e3 * t.N, a3);
|
||
for (let t2 = 0; t2 < 2 * a2; t2 += 2) s2.emplaceBack(l2 + t2, l2 + t2 + 1, l2 + t2 + 3), s2.emplaceBack(l2 + t2, l2 + t2 + 3, l2 + t2 + 2), s2.emplaceBack(n2 + t2, n2 + t2 + 3, n2 + t2 + 1), s2.emplaceBack(n2 + t2, n2 + t2 + 2, n2 + t2 + 3);
|
||
const h2 = i3.length, c2 = h2 + 2 * (a2 + 1);
|
||
for (const e3 of [0, 1]) for (let s3 = 0; s3 <= a2; s3++) for (const a3 of [0, 1]) i3.emplaceBack(e3 * t.N, s3 * o2, a3);
|
||
for (let t2 = 0; t2 < 2 * a2; t2 += 2) s2.emplaceBack(h2 + t2, h2 + t2 + 1, h2 + t2 + 3), s2.emplaceBack(h2 + t2, h2 + t2 + 3, h2 + t2 + 2), s2.emplaceBack(c2 + t2, c2 + t2 + 3, c2 + t2 + 1), s2.emplaceBack(c2 + t2, c2 + t2 + 2, c2 + t2 + 3);
|
||
return this._mesh = { indexBuffer: e2.createIndexBuffer(s2), vertexBuffer: e2.createVertexBuffer(i3, ca.members), segments: t.S.simpleSegment(0, 0, i3.length, s2.length) }, this._mesh;
|
||
}
|
||
getMeshFrameDelta(e2) {
|
||
return 2 * Math.PI * t.be / Math.pow(2, e2) / 5;
|
||
}
|
||
getMinTileElevationForLngLatZoom(t2, e2) {
|
||
var i3;
|
||
const { tileID: s2 } = this._getOverscaledTileIDFromLngLatZoom(t2, e2);
|
||
return null !== (i3 = this.getMinMaxElevation(s2).minElevation) && void 0 !== i3 ? i3 : 0;
|
||
}
|
||
getMinMaxElevation(t2) {
|
||
const e2 = this.getTerrainData(t2).tile, i3 = { minElevation: null, maxElevation: null };
|
||
return e2 && e2.dem && (i3.minElevation = e2.dem.min * this.exaggeration, i3.maxElevation = e2.dem.max * this.exaggeration), i3;
|
||
}
|
||
_getOverscaledTileIDFromLngLatZoom(e2, i3) {
|
||
const s2 = t.U.fromLngLat(e2.wrap()), a2 = (1 << i3) * t.N, o2 = s2.x * a2, r2 = s2.y * a2, n2 = Math.floor(o2 / t.N), l2 = Math.floor(r2 / t.N);
|
||
return { tileID: new t.O(i3, 0, i3, n2, l2), mercatorX: o2, mercatorY: r2 };
|
||
}
|
||
_allowMercatorOverflow(e2, i3) {
|
||
const s2 = e2.x < this.painter.width / 2;
|
||
let a2 = t.bf(i3);
|
||
const o2 = this.painter.transform.center.lng;
|
||
return s2 && Math.sign(a2) > 0 && Math.sign(o2) < 0 || !s2 && Math.sign(a2) < 0 && Math.sign(o2) > 0 ? (a2 = 360 * Math.sign(o2) + a2, t.G(a2)) : i3;
|
||
}
|
||
}
|
||
class _a {
|
||
constructor(t2, e2, i3) {
|
||
this._context = t2, this._size = e2, this._tileSize = i3, this._objects = [], this._recentlyUsed = [], this._stamp = 0;
|
||
}
|
||
destruct() {
|
||
for (const t2 of this._objects) t2.texture.destroy(), t2.fbo.destroy();
|
||
}
|
||
_createObject(t2) {
|
||
const e2 = this._context.createFramebuffer(this._tileSize, this._tileSize, true, true), i3 = new x(this._context, { width: this._tileSize, height: this._tileSize, data: null }, this._context.gl.RGBA);
|
||
return i3.bind(this._context.gl.LINEAR, this._context.gl.CLAMP_TO_EDGE), e2.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL, this._tileSize, this._tileSize)), e2.colorAttachment.set(i3.texture), { id: t2, fbo: e2, texture: i3, stamp: -1, inUse: false };
|
||
}
|
||
getObjectForId(t2) {
|
||
return this._objects[t2];
|
||
}
|
||
useObject(t2) {
|
||
t2.inUse = true, this._recentlyUsed = this._recentlyUsed.filter(((e2) => t2.id !== e2)), this._recentlyUsed.push(t2.id);
|
||
}
|
||
stampObject(t2) {
|
||
t2.stamp = ++this._stamp;
|
||
}
|
||
getOrCreateFreeObject() {
|
||
for (const t3 of this._recentlyUsed) if (!this._objects[t3].inUse) return this._objects[t3];
|
||
if (this._objects.length >= this._size) throw new Error("No free RenderPool available, call freeAllObjects() required!");
|
||
const t2 = this._createObject(this._objects.length);
|
||
return this._objects.push(t2), t2;
|
||
}
|
||
freeObject(t2) {
|
||
t2.inUse = false;
|
||
}
|
||
freeAllObjects() {
|
||
for (const t2 of this._objects) this.freeObject(t2);
|
||
}
|
||
isFull() {
|
||
return !(this._objects.length < this._size) && false === this._objects.some(((t2) => !t2.inUse));
|
||
}
|
||
}
|
||
const pa = { background: true, fill: true, line: true, raster: true, hillshade: true };
|
||
class ma {
|
||
constructor(t2, e2) {
|
||
this.painter = t2, this.terrain = e2, this.pool = new _a(t2.context, 30, e2.sourceCache.tileSize * e2.qualityFactor);
|
||
}
|
||
destruct() {
|
||
this.pool.destruct();
|
||
}
|
||
getTexture(t2) {
|
||
return this.pool.getObjectForId(t2.rtt[this._stacks.length - 1].id).texture;
|
||
}
|
||
prepareForRender(t2, e2) {
|
||
this._stacks = [], this._prevType = null, this._rttTiles = [], this._renderableTiles = this.terrain.sourceCache.getRenderableTiles(), this._renderableLayerIds = t2._order.filter(((i3) => !t2._layers[i3].isHidden(e2))), this._coordsDescendingInv = {};
|
||
for (const e3 in t2.sourceCaches) {
|
||
this._coordsDescendingInv[e3] = {};
|
||
const i3 = t2.sourceCaches[e3].getVisibleCoordinates();
|
||
for (const t3 of i3) {
|
||
const i4 = this.terrain.sourceCache.getTerrainCoords(t3);
|
||
for (const t4 in i4) this._coordsDescendingInv[e3][t4] || (this._coordsDescendingInv[e3][t4] = []), this._coordsDescendingInv[e3][t4].push(i4[t4]);
|
||
}
|
||
}
|
||
this._coordsDescendingInvStr = {};
|
||
for (const e3 of t2._order) {
|
||
const i3 = t2._layers[e3], s2 = i3.source;
|
||
if (pa[i3.type] && !this._coordsDescendingInvStr[s2]) {
|
||
this._coordsDescendingInvStr[s2] = {};
|
||
for (const t3 in this._coordsDescendingInv[s2]) this._coordsDescendingInvStr[s2][t3] = this._coordsDescendingInv[s2][t3].map(((t4) => t4.key)).sort().join();
|
||
}
|
||
}
|
||
for (const t3 of this._renderableTiles) for (const e3 in this._coordsDescendingInvStr) {
|
||
const i3 = this._coordsDescendingInvStr[e3][t3.tileID.key];
|
||
i3 && i3 !== t3.rttCoords[e3] && (t3.rtt = []);
|
||
}
|
||
}
|
||
renderLayer(e2) {
|
||
if (e2.isHidden(this.painter.transform.zoom)) return false;
|
||
const i3 = e2.type, s2 = this.painter, a2 = this._renderableLayerIds[this._renderableLayerIds.length - 1] === e2.id;
|
||
if (pa[i3] && (this._prevType && pa[this._prevType] || this._stacks.push([]), this._prevType = i3, this._stacks[this._stacks.length - 1].push(e2.id), !a2)) return true;
|
||
if (pa[this._prevType] || pa[i3] && a2) {
|
||
this._prevType = i3;
|
||
const e3 = this._stacks.length - 1, a3 = this._stacks[e3] || [];
|
||
for (const i4 of this._renderableTiles) {
|
||
if (this.pool.isFull() && (es(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects()), this._rttTiles.push(i4), i4.rtt[e3]) {
|
||
const t2 = this.pool.getObjectForId(i4.rtt[e3].id);
|
||
if (t2.stamp === i4.rtt[e3].stamp) {
|
||
this.pool.useObject(t2);
|
||
continue;
|
||
}
|
||
}
|
||
const o2 = this.pool.getOrCreateFreeObject();
|
||
this.pool.useObject(o2), this.pool.stampObject(o2), i4.rtt[e3] = { id: o2.id, stamp: o2.stamp }, s2.context.bindFramebuffer.set(o2.fbo.framebuffer), s2.context.clear({ color: t.aT.transparent, stencil: 0 }), s2.currentStencilSource = void 0;
|
||
for (let t2 = 0; t2 < a3.length; t2++) {
|
||
const e4 = s2.style._layers[a3[t2]], r2 = e4.source ? this._coordsDescendingInv[e4.source][i4.tileID.key] : [i4.tileID];
|
||
s2.context.viewport.set([0, 0, o2.fbo.width, o2.fbo.height]), s2._renderTileClippingMasks(e4, r2), s2.renderLayer(s2, s2.style.sourceCaches[e4.source], e4, r2), e4.source && (i4.rttCoords[e4.source] = this._coordsDescendingInvStr[e4.source][i4.tileID.key]);
|
||
}
|
||
}
|
||
return es(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects(), pa[i3];
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
const fa = e, ga = { center: [0, 0], zoom: 0, bearing: 0, pitch: 0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, interactive: true, scrollZoom: true, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, cooperativeGestures: void 0, bearingSnap: 7, clickTolerance: 3, pitchWithRotate: true, hash: false, attributionControl: true, maplibreLogo: false, failIfMajorPerformanceCaveat: false, preserveDrawingBuffer: false, trackResize: true, renderWorldCopies: true, refreshExpiredTiles: true, maxTileCacheSize: null, maxTileCacheZoomLevels: t.c.MAX_TILE_CACHE_ZOOM_LEVELS, localIdeographFontFamily: "sans-serif", transformRequest: null, transformCameraUpdate: null, fadeDuration: 300, crossSourceCollisions: true, validateStyle: true, maxCanvasSize: [4096, 4096] }, va = (t2) => {
|
||
t2.touchstart = t2.dragStart, t2.touchmoveWindow = t2.dragMove, t2.touchend = t2.dragEnd;
|
||
}, xa = { showCompass: true, showZoom: true, visualizePitch: false };
|
||
class ya {
|
||
constructor(e2, s2, a2 = false) {
|
||
this.mousedown = (e3) => {
|
||
this.startMouse(t.e({}, e3, { ctrlKey: true, preventDefault: () => e3.preventDefault() }), i2.mousePos(this.element, e3)), i2.addEventListener(window, "mousemove", this.mousemove), i2.addEventListener(window, "mouseup", this.mouseup);
|
||
}, this.mousemove = (t2) => {
|
||
this.moveMouse(t2, i2.mousePos(this.element, t2));
|
||
}, this.mouseup = (t2) => {
|
||
this.mouseRotate.dragEnd(t2), this.mousePitch && this.mousePitch.dragEnd(t2), this.offTemp();
|
||
}, this.touchstart = (t2) => {
|
||
1 !== t2.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = i2.touchPos(this.element, t2.targetTouches)[0], this.startTouch(t2, this._startPos), i2.addEventListener(window, "touchmove", this.touchmove, { passive: false }), i2.addEventListener(window, "touchend", this.touchend));
|
||
}, this.touchmove = (t2) => {
|
||
1 !== t2.targetTouches.length ? this.reset() : (this._lastPos = i2.touchPos(this.element, t2.targetTouches)[0], this.moveTouch(t2, this._lastPos));
|
||
}, this.touchend = (t2) => {
|
||
0 === t2.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), delete this._startPos, delete this._lastPos, this.offTemp();
|
||
}, this.reset = () => {
|
||
this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), this.touchRotate.reset(), this.touchPitch && this.touchPitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp();
|
||
}, this._clickTolerance = 10;
|
||
const o2 = e2.dragRotate._mouseRotate.getClickTolerance(), r2 = e2.dragRotate._mousePitch.getClickTolerance();
|
||
this.element = s2, this.mouseRotate = As({ clickTolerance: o2, enable: true }), this.touchRotate = (({ enable: t2, clickTolerance: e3, bearingDegreesPerPixelMoved: i3 = 0.8 }) => {
|
||
const s3 = new zs();
|
||
return new Ps({ clickTolerance: e3, move: (t3, e4) => ({ bearingDelta: (e4.x - t3.x) * i3 }), moveStateManager: s3, enable: t2, assignEvents: va });
|
||
})({ clickTolerance: o2, enable: true }), this.map = e2, a2 && (this.mousePitch = Rs({ clickTolerance: r2, enable: true }), this.touchPitch = (({ enable: t2, clickTolerance: e3, pitchDegreesPerPixelMoved: i3 = -0.5 }) => {
|
||
const s3 = new zs();
|
||
return new Ps({ clickTolerance: e3, move: (t3, e4) => ({ pitchDelta: (e4.y - t3.y) * i3 }), moveStateManager: s3, enable: t2, assignEvents: va });
|
||
})({ clickTolerance: r2, enable: true })), i2.addEventListener(s2, "mousedown", this.mousedown), i2.addEventListener(s2, "touchstart", this.touchstart, { passive: false }), i2.addEventListener(s2, "touchcancel", this.reset);
|
||
}
|
||
startMouse(t2, e2) {
|
||
this.mouseRotate.dragStart(t2, e2), this.mousePitch && this.mousePitch.dragStart(t2, e2), i2.disableDrag();
|
||
}
|
||
startTouch(t2, e2) {
|
||
this.touchRotate.dragStart(t2, e2), this.touchPitch && this.touchPitch.dragStart(t2, e2), i2.disableDrag();
|
||
}
|
||
moveMouse(t2, e2) {
|
||
const i3 = this.map, { bearingDelta: s2 } = this.mouseRotate.dragMove(t2, e2) || {};
|
||
if (s2 && i3.setBearing(i3.getBearing() + s2), this.mousePitch) {
|
||
const { pitchDelta: s3 } = this.mousePitch.dragMove(t2, e2) || {};
|
||
s3 && i3.setPitch(i3.getPitch() + s3);
|
||
}
|
||
}
|
||
moveTouch(t2, e2) {
|
||
const i3 = this.map, { bearingDelta: s2 } = this.touchRotate.dragMove(t2, e2) || {};
|
||
if (s2 && i3.setBearing(i3.getBearing() + s2), this.touchPitch) {
|
||
const { pitchDelta: s3 } = this.touchPitch.dragMove(t2, e2) || {};
|
||
s3 && i3.setPitch(i3.getPitch() + s3);
|
||
}
|
||
}
|
||
off() {
|
||
const t2 = this.element;
|
||
i2.removeEventListener(t2, "mousedown", this.mousedown), i2.removeEventListener(t2, "touchstart", this.touchstart, { passive: false }), i2.removeEventListener(window, "touchmove", this.touchmove, { passive: false }), i2.removeEventListener(window, "touchend", this.touchend), i2.removeEventListener(t2, "touchcancel", this.reset), this.offTemp();
|
||
}
|
||
offTemp() {
|
||
i2.enableDrag(), i2.removeEventListener(window, "mousemove", this.mousemove), i2.removeEventListener(window, "mouseup", this.mouseup), i2.removeEventListener(window, "touchmove", this.touchmove, { passive: false }), i2.removeEventListener(window, "touchend", this.touchend);
|
||
}
|
||
}
|
||
let ba;
|
||
function wa(e2, i3, s2) {
|
||
if (e2 = new t.L(e2.lng, e2.lat), i3) {
|
||
const a2 = new t.L(e2.lng - 360, e2.lat), o2 = new t.L(e2.lng + 360, e2.lat), r2 = s2.locationPoint(e2).distSqr(i3);
|
||
s2.locationPoint(a2).distSqr(i3) < r2 ? e2 = a2 : s2.locationPoint(o2).distSqr(i3) < r2 && (e2 = o2);
|
||
}
|
||
for (; Math.abs(e2.lng - s2.center.lng) > 180; ) {
|
||
const t2 = s2.locationPoint(e2);
|
||
if (t2.x >= 0 && t2.y >= 0 && t2.x <= s2.width && t2.y <= s2.height) break;
|
||
e2.lng > s2.center.lng ? e2.lng -= 360 : e2.lng += 360;
|
||
}
|
||
return e2;
|
||
}
|
||
const Ta = { 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%)" };
|
||
function Ia(t2, e2, i3) {
|
||
const s2 = t2.classList;
|
||
for (const t3 in Ta) s2.remove(`maplibregl-${i3}-anchor-${t3}`);
|
||
s2.add(`maplibregl-${i3}-anchor-${e2}`);
|
||
}
|
||
class Ea extends t.E {
|
||
constructor(e2) {
|
||
if (super(), this._onKeyPress = (t2) => {
|
||
const e3 = t2.code, i3 = t2.charCode || t2.keyCode;
|
||
"Space" !== e3 && "Enter" !== e3 && 32 !== i3 && 13 !== i3 || this.togglePopup();
|
||
}, this._onMapClick = (t2) => {
|
||
const e3 = t2.originalEvent.target, i3 = this._element;
|
||
this._popup && (e3 === i3 || i3.contains(e3)) && this.togglePopup();
|
||
}, this._update = (t2) => {
|
||
if (!this._map) return;
|
||
const e3 = this._map.loaded() && !this._map.isMoving();
|
||
("terrain" === (null == t2 ? void 0 : t2.type) || "render" === (null == t2 ? void 0 : t2.type) && !e3) && this._map.once("render", this._update), this._map.transform.renderWorldCopies && (this._lngLat = wa(this._lngLat, this._pos, this._map.transform)), this._pos = this._map.project(this._lngLat)._add(this._offset);
|
||
let s2 = "";
|
||
"viewport" === this._rotationAlignment || "auto" === this._rotationAlignment ? s2 = `rotateZ(${this._rotation}deg)` : "map" === this._rotationAlignment && (s2 = `rotateZ(${this._rotation - this._map.getBearing()}deg)`);
|
||
let a2 = "";
|
||
"viewport" === this._pitchAlignment || "auto" === this._pitchAlignment ? a2 = "rotateX(0deg)" : "map" === this._pitchAlignment && (a2 = `rotateX(${this._map.getPitch()}deg)`), t2 && "moveend" !== t2.type || (this._pos = this._pos.round()), i2.setTransform(this._element, `${Ta[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a2} ${s2}`), this._map.terrain && !this._opacityTimeout && (this._opacityTimeout = setTimeout((() => {
|
||
const t3 = this._map.unproject(this._pos), e4 = 40075016686e-3 * Math.abs(Math.cos(this._lngLat.lat * Math.PI / 180)) / Math.pow(2, this._map.transform.tileZoom + 8);
|
||
this._element.style.opacity = t3.distanceTo(this._lngLat) > 20 * e4 ? "0.2" : "1.0", this._opacityTimeout = null;
|
||
}), 100));
|
||
}, this._onMove = (e3) => {
|
||
if (!this._isDragging) {
|
||
const t2 = this._clickTolerance || this._map._clickTolerance;
|
||
this._isDragging = e3.point.dist(this._pointerdownPos) >= t2;
|
||
}
|
||
this._isDragging && (this._pos = e3.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new t.k("dragstart"))), this.fire(new t.k("drag")));
|
||
}, this._onUp = () => {
|
||
this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = false, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), "active" === this._state && this.fire(new t.k("dragend")), this._state = "inactive";
|
||
}, this._addDragHandler = (t2) => {
|
||
this._element.contains(t2.originalEvent.target) && (t2.preventDefault(), this._positionDelta = t2.point.sub(this._pos).add(this._offset), this._pointerdownPos = t2.point, this._state = "pending", this._map.on("mousemove", this._onMove), this._map.on("touchmove", this._onMove), this._map.once("mouseup", this._onUp), this._map.once("touchend", this._onUp));
|
||
}, this._anchor = e2 && e2.anchor || "center", this._color = e2 && e2.color || "#3FB1CE", this._scale = e2 && e2.scale || 1, this._draggable = e2 && e2.draggable || false, this._clickTolerance = e2 && e2.clickTolerance || 0, this._isDragging = false, this._state = "inactive", this._rotation = e2 && e2.rotation || 0, this._rotationAlignment = e2 && e2.rotationAlignment || "auto", this._pitchAlignment = e2 && e2.pitchAlignment && "auto" !== e2.pitchAlignment ? e2.pitchAlignment : this._rotationAlignment, e2 && e2.element) this._element = e2.element, this._offset = t.P.convert(e2 && e2.offset || [0, 0]);
|
||
else {
|
||
this._defaultMarker = true, this._element = i2.create("div"), this._element.setAttribute("aria-label", "Map marker");
|
||
const s2 = i2.createNS("http://www.w3.org/2000/svg", "svg"), a2 = 41, o2 = 27;
|
||
s2.setAttributeNS(null, "display", "block"), s2.setAttributeNS(null, "height", `${a2}px`), s2.setAttributeNS(null, "width", `${o2}px`), s2.setAttributeNS(null, "viewBox", `0 0 ${o2} ${a2}`);
|
||
const r2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
r2.setAttributeNS(null, "stroke", "none"), r2.setAttributeNS(null, "stroke-width", "1"), r2.setAttributeNS(null, "fill", "none"), r2.setAttributeNS(null, "fill-rule", "evenodd");
|
||
const n2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
n2.setAttributeNS(null, "fill-rule", "nonzero");
|
||
const l2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
l2.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), l2.setAttributeNS(null, "fill", "#000000");
|
||
const h2 = [{ rx: "10.5", ry: "5.25002273" }, { rx: "10.5", ry: "5.25002273" }, { rx: "9.5", ry: "4.77275007" }, { rx: "8.5", ry: "4.29549936" }, { rx: "7.5", ry: "3.81822308" }, { rx: "6.5", ry: "3.34094679" }, { rx: "5.5", ry: "2.86367051" }, { rx: "4.5", ry: "2.38636864" }];
|
||
for (const t2 of h2) {
|
||
const e3 = i2.createNS("http://www.w3.org/2000/svg", "ellipse");
|
||
e3.setAttributeNS(null, "opacity", "0.04"), e3.setAttributeNS(null, "cx", "10.5"), e3.setAttributeNS(null, "cy", "5.80029008"), e3.setAttributeNS(null, "rx", t2.rx), e3.setAttributeNS(null, "ry", t2.ry), l2.appendChild(e3);
|
||
}
|
||
const c2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
c2.setAttributeNS(null, "fill", this._color);
|
||
const u2 = i2.createNS("http://www.w3.org/2000/svg", "path");
|
||
u2.setAttributeNS(null, "d", "M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"), c2.appendChild(u2);
|
||
const d2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
d2.setAttributeNS(null, "opacity", "0.25"), d2.setAttributeNS(null, "fill", "#000000");
|
||
const _2 = i2.createNS("http://www.w3.org/2000/svg", "path");
|
||
_2.setAttributeNS(null, "d", "M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"), d2.appendChild(_2);
|
||
const p2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
p2.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), p2.setAttributeNS(null, "fill", "#FFFFFF");
|
||
const m2 = i2.createNS("http://www.w3.org/2000/svg", "g");
|
||
m2.setAttributeNS(null, "transform", "translate(8.0, 8.0)");
|
||
const f2 = i2.createNS("http://www.w3.org/2000/svg", "circle");
|
||
f2.setAttributeNS(null, "fill", "#000000"), f2.setAttributeNS(null, "opacity", "0.25"), f2.setAttributeNS(null, "cx", "5.5"), f2.setAttributeNS(null, "cy", "5.5"), f2.setAttributeNS(null, "r", "5.4999962");
|
||
const g2 = i2.createNS("http://www.w3.org/2000/svg", "circle");
|
||
g2.setAttributeNS(null, "fill", "#FFFFFF"), g2.setAttributeNS(null, "cx", "5.5"), g2.setAttributeNS(null, "cy", "5.5"), g2.setAttributeNS(null, "r", "5.4999962"), m2.appendChild(f2), m2.appendChild(g2), n2.appendChild(l2), n2.appendChild(c2), n2.appendChild(d2), n2.appendChild(p2), n2.appendChild(m2), s2.appendChild(n2), s2.setAttributeNS(null, "height", a2 * this._scale + "px"), s2.setAttributeNS(null, "width", o2 * this._scale + "px"), this._element.appendChild(s2), this._offset = t.P.convert(e2 && e2.offset || [0, -14]);
|
||
}
|
||
if (this._element.classList.add("maplibregl-marker"), this._element.addEventListener("dragstart", ((t2) => {
|
||
t2.preventDefault();
|
||
})), this._element.addEventListener("mousedown", ((t2) => {
|
||
t2.preventDefault();
|
||
})), Ia(this._element, this._anchor, "marker"), e2 && e2.className) for (const t2 of e2.className.split(" ")) this._element.classList.add(t2);
|
||
this._popup = null;
|
||
}
|
||
addTo(t2) {
|
||
return this.remove(), this._map = t2, t2.getCanvasContainer().appendChild(this._element), t2.on("move", this._update), t2.on("moveend", this._update), t2.on("terrain", this._update), this.setDraggable(this._draggable), this._update(), this._map.on("click", this._onMapClick), this;
|
||
}
|
||
remove() {
|
||
return this._opacityTimeout && (clearTimeout(this._opacityTimeout), delete this._opacityTimeout), this._map && (this._map.off("click", this._onMapClick), this._map.off("move", this._update), this._map.off("moveend", this._update), this._map.off("mousedown", this._addDragHandler), this._map.off("touchstart", this._addDragHandler), this._map.off("mouseup", this._onUp), this._map.off("touchend", this._onUp), this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), delete this._map), i2.remove(this._element), this._popup && this._popup.remove(), this;
|
||
}
|
||
getLngLat() {
|
||
return this._lngLat;
|
||
}
|
||
setLngLat(e2) {
|
||
return this._lngLat = t.L.convert(e2), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;
|
||
}
|
||
getElement() {
|
||
return this._element;
|
||
}
|
||
setPopup(t2) {
|
||
if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), t2) {
|
||
if (!("offset" in t2.options)) {
|
||
const e2 = 38.1, i3 = 13.5, s2 = Math.abs(i3) / Math.SQRT2;
|
||
t2.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -e2], "bottom-left": [s2, -1 * (e2 - i3 + s2)], "bottom-right": [-s2, -1 * (e2 - i3 + s2)], left: [i3, -1 * (e2 - i3)], right: [-i3, -1 * (e2 - i3)] } : this._offset;
|
||
}
|
||
this._popup = t2, this._lngLat && this._popup.setLngLat(this._lngLat), this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress);
|
||
}
|
||
return this;
|
||
}
|
||
getPopup() {
|
||
return this._popup;
|
||
}
|
||
togglePopup() {
|
||
const t2 = this._popup;
|
||
return t2 ? (t2.isOpen() ? t2.remove() : t2.addTo(this._map), this) : this;
|
||
}
|
||
getOffset() {
|
||
return this._offset;
|
||
}
|
||
setOffset(e2) {
|
||
return this._offset = t.P.convert(e2), this._update(), this;
|
||
}
|
||
addClassName(t2) {
|
||
this._element.classList.add(t2);
|
||
}
|
||
removeClassName(t2) {
|
||
this._element.classList.remove(t2);
|
||
}
|
||
toggleClassName(t2) {
|
||
return this._element.classList.toggle(t2);
|
||
}
|
||
setDraggable(t2) {
|
||
return this._draggable = !!t2, this._map && (t2 ? (this._map.on("mousedown", this._addDragHandler), this._map.on("touchstart", this._addDragHandler)) : (this._map.off("mousedown", this._addDragHandler), this._map.off("touchstart", this._addDragHandler))), this;
|
||
}
|
||
isDraggable() {
|
||
return this._draggable;
|
||
}
|
||
setRotation(t2) {
|
||
return this._rotation = t2 || 0, this._update(), this;
|
||
}
|
||
getRotation() {
|
||
return this._rotation;
|
||
}
|
||
setRotationAlignment(t2) {
|
||
return this._rotationAlignment = t2 || "auto", this._update(), this;
|
||
}
|
||
getRotationAlignment() {
|
||
return this._rotationAlignment;
|
||
}
|
||
setPitchAlignment(t2) {
|
||
return this._pitchAlignment = t2 && "auto" !== t2 ? t2 : this._rotationAlignment, this._update(), this;
|
||
}
|
||
getPitchAlignment() {
|
||
return this._pitchAlignment;
|
||
}
|
||
}
|
||
const Sa = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true };
|
||
let Ca = 0, Pa = false;
|
||
const Da = { maxWidth: 100, unit: "metric" };
|
||
function Ma(t2, e2, i3) {
|
||
const s2 = i3 && i3.maxWidth || 100, a2 = t2._container.clientHeight / 2, o2 = t2.unproject([0, a2]), r2 = t2.unproject([s2, a2]), n2 = o2.distanceTo(r2);
|
||
if (i3 && "imperial" === i3.unit) {
|
||
const i4 = 3.2808 * n2;
|
||
i4 > 5280 ? za(e2, s2, i4 / 5280, t2._getUIString("ScaleControl.Miles")) : za(e2, s2, i4, t2._getUIString("ScaleControl.Feet"));
|
||
} else i3 && "nautical" === i3.unit ? za(e2, s2, n2 / 1852, t2._getUIString("ScaleControl.NauticalMiles")) : n2 >= 1e3 ? za(e2, s2, n2 / 1e3, t2._getUIString("ScaleControl.Kilometers")) : za(e2, s2, n2, t2._getUIString("ScaleControl.Meters"));
|
||
}
|
||
function za(t2, e2, i3, s2) {
|
||
const a2 = (function(t3) {
|
||
const e3 = Math.pow(10, `${Math.floor(t3)}`.length - 1);
|
||
let i4 = t3 / e3;
|
||
return i4 = i4 >= 10 ? 10 : i4 >= 5 ? 5 : i4 >= 3 ? 3 : i4 >= 2 ? 2 : i4 >= 1 ? 1 : (function(t4) {
|
||
const e4 = Math.pow(10, Math.ceil(-Math.log(t4) / Math.LN10));
|
||
return Math.round(t4 * e4) / e4;
|
||
})(i4), e3 * i4;
|
||
})(i3);
|
||
t2.style.width = e2 * (a2 / i3) + "px", t2.innerHTML = `${a2} ${s2}`;
|
||
}
|
||
const La = { closeButton: true, closeOnClick: true, focusAfterOpen: true, className: "", maxWidth: "240px" }, Aa = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
|
||
function Ra(e2) {
|
||
if (e2) {
|
||
if ("number" == typeof e2) {
|
||
const i3 = Math.round(Math.abs(e2) / Math.SQRT2);
|
||
return { center: new t.P(0, 0), top: new t.P(0, e2), "top-left": new t.P(i3, i3), "top-right": new t.P(-i3, i3), bottom: new t.P(0, -e2), "bottom-left": new t.P(i3, -i3), "bottom-right": new t.P(-i3, -i3), left: new t.P(e2, 0), right: new t.P(-e2, 0) };
|
||
}
|
||
if (e2 instanceof t.P || Array.isArray(e2)) {
|
||
const i3 = t.P.convert(e2);
|
||
return { center: i3, top: i3, "top-left": i3, "top-right": i3, bottom: i3, "bottom-left": i3, "bottom-right": i3, left: i3, right: i3 };
|
||
}
|
||
return { center: t.P.convert(e2.center || [0, 0]), top: t.P.convert(e2.top || [0, 0]), "top-left": t.P.convert(e2["top-left"] || [0, 0]), "top-right": t.P.convert(e2["top-right"] || [0, 0]), bottom: t.P.convert(e2.bottom || [0, 0]), "bottom-left": t.P.convert(e2["bottom-left"] || [0, 0]), "bottom-right": t.P.convert(e2["bottom-right"] || [0, 0]), left: t.P.convert(e2.left || [0, 0]), right: t.P.convert(e2.right || [0, 0]) };
|
||
}
|
||
return Ra(new t.P(0, 0));
|
||
}
|
||
const ka = { extend: (e2, ...i3) => t.e(e2, ...i3), run(t2) {
|
||
t2();
|
||
}, logToElement(t2, e2 = false, i3 = "log") {
|
||
const s2 = window.document.getElementById(i3);
|
||
s2 && (e2 && (s2.innerHTML = ""), s2.innerHTML += `<br>${t2}`);
|
||
} }, Fa = e;
|
||
class Ba {
|
||
static get version() {
|
||
return Fa;
|
||
}
|
||
static get workerCount() {
|
||
return tt.workerCount;
|
||
}
|
||
static set workerCount(t2) {
|
||
tt.workerCount = t2;
|
||
}
|
||
static get maxParallelImageRequests() {
|
||
return t.c.MAX_PARALLEL_IMAGE_REQUESTS;
|
||
}
|
||
static set maxParallelImageRequests(e2) {
|
||
t.c.MAX_PARALLEL_IMAGE_REQUESTS = e2;
|
||
}
|
||
static get workerUrl() {
|
||
return t.c.WORKER_URL;
|
||
}
|
||
static set workerUrl(e2) {
|
||
t.c.WORKER_URL = e2;
|
||
}
|
||
static addProtocol(e2, i3) {
|
||
t.c.REGISTERED_PROTOCOLS[e2] = i3;
|
||
}
|
||
static removeProtocol(e2) {
|
||
delete t.c.REGISTERED_PROTOCOLS[e2];
|
||
}
|
||
}
|
||
return Ba.Map = class extends oa {
|
||
constructor(e2) {
|
||
if (t.bg.mark(t.bh.create), null != (e2 = t.e({}, ga, e2)).minZoom && null != e2.maxZoom && e2.minZoom > e2.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom");
|
||
if (null != e2.minPitch && null != e2.maxPitch && e2.minPitch > e2.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch");
|
||
if (null != e2.minPitch && e2.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0");
|
||
if (null != e2.maxPitch && e2.maxPitch > 85) throw new Error("maxPitch must be less than or equal to 85");
|
||
if (super(new rs(e2.minZoom, e2.maxZoom, e2.minPitch, e2.maxPitch, e2.renderWorldCopies), { bearingSnap: e2.bearingSnap }), this._cooperativeGesturesOnWheel = (t2) => {
|
||
this._onCooperativeGesture(t2, t2[this._metaKey], 1);
|
||
}, this._contextLost = (e3) => {
|
||
e3.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.fire(new t.k("webglcontextlost", { originalEvent: e3 }));
|
||
}, this._contextRestored = (e3) => {
|
||
this._setupPainter(), this.resize(), this._update(), this.fire(new t.k("webglcontextrestored", { originalEvent: e3 }));
|
||
}, this._onMapScroll = (t2) => {
|
||
if (t2.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, false;
|
||
}, this._onWindowOnline = () => {
|
||
this._update();
|
||
}, this._interactive = e2.interactive, this._cooperativeGestures = e2.cooperativeGestures, this._metaKey = 0 === navigator.platform.indexOf("Mac") ? "metaKey" : "ctrlKey", this._maxTileCacheSize = e2.maxTileCacheSize, this._maxTileCacheZoomLevels = e2.maxTileCacheZoomLevels, this._failIfMajorPerformanceCaveat = e2.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = e2.preserveDrawingBuffer, this._antialias = e2.antialias, this._trackResize = e2.trackResize, this._bearingSnap = e2.bearingSnap, this._refreshExpiredTiles = e2.refreshExpiredTiles, this._fadeDuration = e2.fadeDuration, this._crossSourceCollisions = e2.crossSourceCollisions, this._crossFadingFactor = 1, this._collectResourceTiming = e2.collectResourceTiming, this._renderTaskQueue = new la(), this._controls = [], this._mapId = t.a2(), this._locale = t.e({}, ha, e2.locale), this._clickTolerance = e2.clickTolerance, this._overridePixelRatio = e2.pixelRatio, this._maxCanvasSize = e2.maxCanvasSize, this.transformCameraUpdate = e2.transformCameraUpdate, this._imageQueueHandle = h.addThrottleControl((() => this.isMoving())), this._requestManager = new u(e2.transformRequest), "string" == typeof e2.container) {
|
||
if (this._container = document.getElementById(e2.container), !this._container) throw new Error(`Container '${e2.container}' not found.`);
|
||
} else {
|
||
if (!(e2.container instanceof HTMLElement)) throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
||
this._container = e2.container;
|
||
}
|
||
if (e2.maxBounds && this.setMaxBounds(e2.maxBounds), this._setupContainer(), this._setupPainter(), this.on("move", (() => this._update(false))), this.on("moveend", (() => this._update(false))), this.on("zoom", (() => this._update(true))), this.on("terrain", (() => {
|
||
this.painter.terrainFacilitator.dirty = true, this._update(true);
|
||
})), this.once("idle", (() => {
|
||
this._idleTriggered = true;
|
||
})), "undefined" != typeof window) {
|
||
addEventListener("online", this._onWindowOnline, false);
|
||
let t2 = false;
|
||
const e3 = ns(((t3) => {
|
||
this._trackResize && !this._removed && this.resize(t3)._update();
|
||
}), 50);
|
||
this._resizeObserver = new ResizeObserver(((i3) => {
|
||
t2 ? e3(i3) : t2 = true;
|
||
})), this._resizeObserver.observe(this._container);
|
||
}
|
||
this.handlers = new aa(this, e2), this._cooperativeGestures && this._setupCooperativeGestures(), this._hash = e2.hash && new ls("string" == typeof e2.hash && e2.hash || void 0).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: e2.center, zoom: e2.zoom, bearing: e2.bearing, pitch: e2.pitch }), e2.bounds && (this.resize(), this.fitBounds(e2.bounds, t.e({}, e2.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = e2.localIdeographFontFamily, this._validateStyle = e2.validateStyle, e2.style && this.setStyle(e2.style, { localIdeographFontFamily: e2.localIdeographFontFamily }), e2.attributionControl && this.addControl(new ra({ customAttribution: e2.customAttribution })), e2.maplibreLogo && this.addControl(new na(), e2.logoPosition), this.on("style.load", (() => {
|
||
this.transform.unmodified && this.jumpTo(this.style.stylesheet);
|
||
})), this.on("data", ((e3) => {
|
||
this._update("style" === e3.dataType), this.fire(new t.k(`${e3.dataType}data`, e3));
|
||
})), this.on("dataloading", ((e3) => {
|
||
this.fire(new t.k(`${e3.dataType}dataloading`, e3));
|
||
})), this.on("dataabort", ((e3) => {
|
||
this.fire(new t.k("sourcedataabort", e3));
|
||
}));
|
||
}
|
||
_getMapId() {
|
||
return this._mapId;
|
||
}
|
||
addControl(e2, i3) {
|
||
if (void 0 === i3 && (i3 = e2.getDefaultPosition ? e2.getDefaultPosition() : "top-right"), !e2 || !e2.onAdd) return this.fire(new t.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
|
||
const s2 = e2.onAdd(this);
|
||
this._controls.push(e2);
|
||
const a2 = this._controlPositions[i3];
|
||
return -1 !== i3.indexOf("bottom") ? a2.insertBefore(s2, a2.firstChild) : a2.appendChild(s2), this;
|
||
}
|
||
removeControl(e2) {
|
||
if (!e2 || !e2.onRemove) return this.fire(new t.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
|
||
const i3 = this._controls.indexOf(e2);
|
||
return i3 > -1 && this._controls.splice(i3, 1), e2.onRemove(this), this;
|
||
}
|
||
hasControl(t2) {
|
||
return this._controls.indexOf(t2) > -1;
|
||
}
|
||
calculateCameraOptionsFromTo(t2, e2, i3, s2) {
|
||
return null == s2 && this.terrain && (s2 = this.terrain.getElevationForLngLatZoom(i3, this.transform.tileZoom)), super.calculateCameraOptionsFromTo(t2, e2, i3, s2);
|
||
}
|
||
resize(e2) {
|
||
var i3;
|
||
const s2 = this._containerDimensions(), a2 = s2[0], o2 = s2[1], r2 = this._getClampedPixelRatio(a2, o2);
|
||
if (this._resizeCanvas(a2, o2, r2), this.painter.resize(a2, o2, r2), this.painter.overLimit()) {
|
||
const t2 = this.painter.context.gl;
|
||
this._maxCanvasSize = [t2.drawingBufferWidth, t2.drawingBufferHeight];
|
||
const e3 = this._getClampedPixelRatio(a2, o2);
|
||
this._resizeCanvas(a2, o2, e3), this.painter.resize(a2, o2, e3);
|
||
}
|
||
this.transform.resize(a2, o2), null === (i3 = this._requestedCameraState) || void 0 === i3 || i3.resize(a2, o2);
|
||
const n2 = !this._moving;
|
||
return n2 && (this.stop(), this.fire(new t.k("movestart", e2)).fire(new t.k("move", e2))), this.fire(new t.k("resize", e2)), n2 && this.fire(new t.k("moveend", e2)), this;
|
||
}
|
||
_getClampedPixelRatio(t2, e2) {
|
||
const { 0: i3, 1: s2 } = this._maxCanvasSize, a2 = this.getPixelRatio(), o2 = t2 * a2, r2 = e2 * a2;
|
||
return Math.min(o2 > i3 ? i3 / o2 : 1, r2 > s2 ? s2 / r2 : 1) * a2;
|
||
}
|
||
getPixelRatio() {
|
||
var t2;
|
||
return null !== (t2 = this._overridePixelRatio) && void 0 !== t2 ? t2 : devicePixelRatio;
|
||
}
|
||
setPixelRatio(t2) {
|
||
this._overridePixelRatio = t2, this.resize();
|
||
}
|
||
getBounds() {
|
||
return this.transform.getBounds();
|
||
}
|
||
getMaxBounds() {
|
||
return this.transform.getMaxBounds();
|
||
}
|
||
setMaxBounds(t2) {
|
||
return this.transform.setMaxBounds(L.convert(t2)), this._update();
|
||
}
|
||
setMinZoom(t2) {
|
||
if ((t2 = null == t2 ? -2 : t2) >= -2 && t2 <= this.transform.maxZoom) return this.transform.minZoom = t2, this._update(), this.getZoom() < t2 && this.setZoom(t2), this;
|
||
throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
|
||
}
|
||
getMinZoom() {
|
||
return this.transform.minZoom;
|
||
}
|
||
setMaxZoom(t2) {
|
||
if ((t2 = null == t2 ? 22 : t2) >= this.transform.minZoom) return this.transform.maxZoom = t2, this._update(), this.getZoom() > t2 && this.setZoom(t2), this;
|
||
throw new Error("maxZoom must be greater than the current minZoom");
|
||
}
|
||
getMaxZoom() {
|
||
return this.transform.maxZoom;
|
||
}
|
||
setMinPitch(t2) {
|
||
if ((t2 = null == t2 ? 0 : t2) < 0) throw new Error("minPitch must be greater than or equal to 0");
|
||
if (t2 >= 0 && t2 <= this.transform.maxPitch) return this.transform.minPitch = t2, this._update(), this.getPitch() < t2 && this.setPitch(t2), this;
|
||
throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
|
||
}
|
||
getMinPitch() {
|
||
return this.transform.minPitch;
|
||
}
|
||
setMaxPitch(t2) {
|
||
if ((t2 = null == t2 ? 60 : t2) > 85) throw new Error("maxPitch must be less than or equal to 85");
|
||
if (t2 >= this.transform.minPitch) return this.transform.maxPitch = t2, this._update(), this.getPitch() > t2 && this.setPitch(t2), this;
|
||
throw new Error("maxPitch must be greater than the current minPitch");
|
||
}
|
||
getMaxPitch() {
|
||
return this.transform.maxPitch;
|
||
}
|
||
getRenderWorldCopies() {
|
||
return this.transform.renderWorldCopies;
|
||
}
|
||
setRenderWorldCopies(t2) {
|
||
return this.transform.renderWorldCopies = t2, this._update();
|
||
}
|
||
getCooperativeGestures() {
|
||
return this._cooperativeGestures;
|
||
}
|
||
setCooperativeGestures(t2) {
|
||
return this._cooperativeGestures = t2, this._cooperativeGestures ? this._setupCooperativeGestures() : this._destroyCooperativeGestures(), this;
|
||
}
|
||
project(e2) {
|
||
return this.transform.locationPoint(t.L.convert(e2), this.style && this.terrain);
|
||
}
|
||
unproject(e2) {
|
||
return this.transform.pointLocation(t.P.convert(e2), this.terrain);
|
||
}
|
||
isMoving() {
|
||
var t2;
|
||
return this._moving || (null === (t2 = this.handlers) || void 0 === t2 ? void 0 : t2.isMoving());
|
||
}
|
||
isZooming() {
|
||
var t2;
|
||
return this._zooming || (null === (t2 = this.handlers) || void 0 === t2 ? void 0 : t2.isZooming());
|
||
}
|
||
isRotating() {
|
||
var t2;
|
||
return this._rotating || (null === (t2 = this.handlers) || void 0 === t2 ? void 0 : t2.isRotating());
|
||
}
|
||
_createDelegatedListener(t2, e2, i3) {
|
||
if ("mouseenter" === t2 || "mouseover" === t2) {
|
||
let s2 = false;
|
||
const a2 = (a3) => {
|
||
const o2 = this.getLayer(e2) ? this.queryRenderedFeatures(a3.point, { layers: [e2] }) : [];
|
||
o2.length ? s2 || (s2 = true, i3.call(this, new gs(t2, this, a3.originalEvent, { features: o2 }))) : s2 = false;
|
||
};
|
||
return { layer: e2, listener: i3, delegates: { mousemove: a2, mouseout: () => {
|
||
s2 = false;
|
||
} } };
|
||
}
|
||
if ("mouseleave" === t2 || "mouseout" === t2) {
|
||
let s2 = false;
|
||
const a2 = (a3) => {
|
||
(this.getLayer(e2) ? this.queryRenderedFeatures(a3.point, { layers: [e2] }) : []).length ? s2 = true : s2 && (s2 = false, i3.call(this, new gs(t2, this, a3.originalEvent)));
|
||
}, o2 = (e3) => {
|
||
s2 && (s2 = false, i3.call(this, new gs(t2, this, e3.originalEvent)));
|
||
};
|
||
return { layer: e2, listener: i3, delegates: { mousemove: a2, mouseout: o2 } };
|
||
}
|
||
{
|
||
const s2 = (t3) => {
|
||
const s3 = this.getLayer(e2) ? this.queryRenderedFeatures(t3.point, { layers: [e2] }) : [];
|
||
s3.length && (t3.features = s3, i3.call(this, t3), delete t3.features);
|
||
};
|
||
return { layer: e2, listener: i3, delegates: { [t2]: s2 } };
|
||
}
|
||
}
|
||
on(t2, e2, i3) {
|
||
if (void 0 === i3) return super.on(t2, e2);
|
||
const s2 = this._createDelegatedListener(t2, e2, i3);
|
||
this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[t2] = this._delegatedListeners[t2] || [], this._delegatedListeners[t2].push(s2);
|
||
for (const t3 in s2.delegates) this.on(t3, s2.delegates[t3]);
|
||
return this;
|
||
}
|
||
once(t2, e2, i3) {
|
||
if (void 0 === i3) return super.once(t2, e2);
|
||
const s2 = this._createDelegatedListener(t2, e2, i3);
|
||
for (const t3 in s2.delegates) this.once(t3, s2.delegates[t3]);
|
||
return this;
|
||
}
|
||
off(t2, e2, i3) {
|
||
return void 0 === i3 ? super.off(t2, e2) : (this._delegatedListeners && this._delegatedListeners[t2] && ((s2) => {
|
||
const a2 = this._delegatedListeners[t2];
|
||
for (let t3 = 0; t3 < a2.length; t3++) {
|
||
const s3 = a2[t3];
|
||
if (s3.layer === e2 && s3.listener === i3) {
|
||
for (const t4 in s3.delegates) this.off(t4, s3.delegates[t4]);
|
||
return a2.splice(t3, 1), this;
|
||
}
|
||
}
|
||
})(), this);
|
||
}
|
||
queryRenderedFeatures(e2, i3) {
|
||
if (!this.style) return [];
|
||
let s2;
|
||
const a2 = e2 instanceof t.P || Array.isArray(e2), o2 = a2 ? e2 : [[0, 0], [this.transform.width, this.transform.height]];
|
||
if (i3 = i3 || (a2 ? {} : e2) || {}, o2 instanceof t.P || "number" == typeof o2[0]) s2 = [t.P.convert(o2)];
|
||
else {
|
||
const e3 = t.P.convert(o2[0]), i4 = t.P.convert(o2[1]);
|
||
s2 = [e3, new t.P(i4.x, e3.y), i4, new t.P(e3.x, i4.y), e3];
|
||
}
|
||
return this.style.queryRenderedFeatures(s2, i3, this.transform);
|
||
}
|
||
querySourceFeatures(t2, e2) {
|
||
return this.style.querySourceFeatures(t2, e2);
|
||
}
|
||
setStyle(e2, i3) {
|
||
return false !== (i3 = t.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, i3)).diff && i3.localIdeographFontFamily === this._localIdeographFontFamily && this.style && e2 ? (this._diffStyle(e2, i3), this) : (this._localIdeographFontFamily = i3.localIdeographFontFamily, this._updateStyle(e2, i3));
|
||
}
|
||
setTransformRequest(t2) {
|
||
return this._requestManager.setTransformRequest(t2), this;
|
||
}
|
||
_getUIString(t2) {
|
||
const e2 = this._locale[t2];
|
||
if (null == e2) throw new Error(`Missing UI string '${t2}'`);
|
||
return e2;
|
||
}
|
||
_updateStyle(t2, e2) {
|
||
if (e2.transformStyle && this.style && !this.style._loaded) return void this.style.once("style.load", (() => this._updateStyle(t2, e2)));
|
||
const i3 = this.style && e2.transformStyle ? this.style.serialize() : void 0;
|
||
return this.style && (this.style.setEventedParent(null), this.style._remove(!t2)), t2 ? (this.style = new se(this, e2 || {}), this.style.setEventedParent(this, { style: this.style }), "string" == typeof t2 ? this.style.loadURL(t2, e2, i3) : this.style.loadJSON(t2, e2, i3), this) : (delete this.style, this);
|
||
}
|
||
_lazyInitEmptyStyle() {
|
||
this.style || (this.style = new se(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());
|
||
}
|
||
_diffStyle(e2, i3) {
|
||
if ("string" == typeof e2) {
|
||
const s2 = this._requestManager.transformRequest(e2, c.Style);
|
||
t.f(s2, ((e3, s3) => {
|
||
e3 ? this.fire(new t.j(e3)) : s3 && this._updateDiff(s3, i3);
|
||
}));
|
||
} else "object" == typeof e2 && this._updateDiff(e2, i3);
|
||
}
|
||
_updateDiff(e2, i3) {
|
||
try {
|
||
this.style.setState(e2, i3) && this._update(true);
|
||
} catch (s2) {
|
||
t.w(`Unable to perform style diff: ${s2.message || s2.error || s2}. Rebuilding the style from scratch.`), this._updateStyle(e2, i3);
|
||
}
|
||
}
|
||
getStyle() {
|
||
if (this.style) return this.style.serialize();
|
||
}
|
||
isStyleLoaded() {
|
||
return this.style ? this.style.loaded() : t.w("There is no style added to the map.");
|
||
}
|
||
addSource(t2, e2) {
|
||
return this._lazyInitEmptyStyle(), this.style.addSource(t2, e2), this._update(true);
|
||
}
|
||
isSourceLoaded(e2) {
|
||
const i3 = this.style && this.style.sourceCaches[e2];
|
||
if (void 0 !== i3) return i3.loaded();
|
||
this.fire(new t.j(new Error(`There is no source with ID '${e2}'`)));
|
||
}
|
||
setTerrain(e2) {
|
||
if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off("data", this._terrainDataCallback), e2) {
|
||
const i3 = this.style.sourceCaches[e2.source];
|
||
if (!i3) throw new Error(`cannot load terrain, because there exists no source with ID: ${e2.source}`);
|
||
for (const i4 in this.style._layers) {
|
||
const s2 = this.style._layers[i4];
|
||
"hillshade" === s2.type && s2.source === e2.source && t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.");
|
||
}
|
||
this.terrain = new da(this.painter, i3, e2), this.painter.renderToTexture = new ma(this.painter, this.terrain), this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._terrainDataCallback = (t2) => {
|
||
"style" === t2.dataType ? this.terrain.sourceCache.freeRtt() : "source" === t2.dataType && t2.tile && (t2.sourceId !== e2.source || this._elevationFreeze || (this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom)), this.terrain.sourceCache.freeRtt(t2.tile.tileID));
|
||
}, this.style.on("data", this._terrainDataCallback);
|
||
} else this.terrain && this.terrain.sourceCache.destruct(), this.terrain = null, this.painter.renderToTexture && this.painter.renderToTexture.destruct(), this.painter.renderToTexture = null, this.transform._minEleveationForCurrentTile = 0, this.transform.elevation = 0;
|
||
return this.fire(new t.k("terrain", { terrain: e2 })), this;
|
||
}
|
||
getTerrain() {
|
||
var t2, e2;
|
||
return null !== (e2 = null === (t2 = this.terrain) || void 0 === t2 ? void 0 : t2.options) && void 0 !== e2 ? e2 : null;
|
||
}
|
||
areTilesLoaded() {
|
||
const t2 = this.style && this.style.sourceCaches;
|
||
for (const e2 in t2) {
|
||
const i3 = t2[e2]._tiles;
|
||
for (const t3 in i3) {
|
||
const e3 = i3[t3];
|
||
if ("loaded" !== e3.state && "errored" !== e3.state) return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
addSourceType(t2, e2, i3) {
|
||
return this._lazyInitEmptyStyle(), this.style.addSourceType(t2, e2, i3);
|
||
}
|
||
removeSource(t2) {
|
||
return this.style.removeSource(t2), this._update(true);
|
||
}
|
||
getSource(t2) {
|
||
return this.style.getSource(t2);
|
||
}
|
||
addImage(e2, i3, s2 = {}) {
|
||
const { pixelRatio: a2 = 1, sdf: o2 = false, stretchX: r2, stretchY: n2, content: l2 } = s2;
|
||
if (this._lazyInitEmptyStyle(), !(i3 instanceof HTMLImageElement || t.a(i3))) {
|
||
if (void 0 === i3.width || void 0 === i3.height) return this.fire(new t.j(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`")));
|
||
{
|
||
const { width: s3, height: h2, data: c2 } = i3, u2 = i3;
|
||
return this.style.addImage(e2, { data: new t.R({ width: s3, height: h2 }, new Uint8Array(c2)), pixelRatio: a2, stretchX: r2, stretchY: n2, content: l2, sdf: o2, version: 0, userImage: u2 }), u2.onAdd && u2.onAdd(this, e2), this;
|
||
}
|
||
}
|
||
{
|
||
const { width: s3, height: h2, data: c2 } = t.h.getImageData(i3);
|
||
this.style.addImage(e2, { data: new t.R({ width: s3, height: h2 }, c2), pixelRatio: a2, stretchX: r2, stretchY: n2, content: l2, sdf: o2, version: 0 });
|
||
}
|
||
}
|
||
updateImage(e2, i3) {
|
||
const s2 = this.style.getImage(e2);
|
||
if (!s2) return this.fire(new t.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
|
||
const a2 = i3 instanceof HTMLImageElement || t.a(i3) ? t.h.getImageData(i3) : i3, { width: o2, height: r2, data: n2 } = a2;
|
||
if (void 0 === o2 || void 0 === r2) return this.fire(new t.j(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 (o2 !== s2.data.width || r2 !== s2.data.height) return this.fire(new t.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));
|
||
const l2 = !(i3 instanceof HTMLImageElement || t.a(i3));
|
||
return s2.data.replace(n2, l2), this.style.updateImage(e2, s2), this;
|
||
}
|
||
getImage(t2) {
|
||
return this.style.getImage(t2);
|
||
}
|
||
hasImage(e2) {
|
||
return e2 ? !!this.style.getImage(e2) : (this.fire(new t.j(new Error("Missing required image id"))), false);
|
||
}
|
||
removeImage(t2) {
|
||
this.style.removeImage(t2);
|
||
}
|
||
loadImage(t2, e2) {
|
||
h.getImage(this._requestManager.transformRequest(t2, c.Image), e2);
|
||
}
|
||
listImages() {
|
||
return this.style.listImages();
|
||
}
|
||
addLayer(t2, e2) {
|
||
return this._lazyInitEmptyStyle(), this.style.addLayer(t2, e2), this._update(true);
|
||
}
|
||
moveLayer(t2, e2) {
|
||
return this.style.moveLayer(t2, e2), this._update(true);
|
||
}
|
||
removeLayer(t2) {
|
||
return this.style.removeLayer(t2), this._update(true);
|
||
}
|
||
getLayer(t2) {
|
||
return this.style.getLayer(t2);
|
||
}
|
||
getLayersOrder() {
|
||
return this.style.getLayersOrder();
|
||
}
|
||
setLayerZoomRange(t2, e2, i3) {
|
||
return this.style.setLayerZoomRange(t2, e2, i3), this._update(true);
|
||
}
|
||
setFilter(t2, e2, i3 = {}) {
|
||
return this.style.setFilter(t2, e2, i3), this._update(true);
|
||
}
|
||
getFilter(t2) {
|
||
return this.style.getFilter(t2);
|
||
}
|
||
setPaintProperty(t2, e2, i3, s2 = {}) {
|
||
return this.style.setPaintProperty(t2, e2, i3, s2), this._update(true);
|
||
}
|
||
getPaintProperty(t2, e2) {
|
||
return this.style.getPaintProperty(t2, e2);
|
||
}
|
||
setLayoutProperty(t2, e2, i3, s2 = {}) {
|
||
return this.style.setLayoutProperty(t2, e2, i3, s2), this._update(true);
|
||
}
|
||
getLayoutProperty(t2, e2) {
|
||
return this.style.getLayoutProperty(t2, e2);
|
||
}
|
||
setGlyphs(t2, e2 = {}) {
|
||
return this._lazyInitEmptyStyle(), this.style.setGlyphs(t2, e2), this._update(true);
|
||
}
|
||
getGlyphs() {
|
||
return this.style.getGlyphsUrl();
|
||
}
|
||
addSprite(t2, e2, i3 = {}) {
|
||
return this._lazyInitEmptyStyle(), this.style.addSprite(t2, e2, i3, ((t3) => {
|
||
t3 || this._update(true);
|
||
})), this;
|
||
}
|
||
removeSprite(t2) {
|
||
return this._lazyInitEmptyStyle(), this.style.removeSprite(t2), this._update(true);
|
||
}
|
||
getSprite() {
|
||
return this.style.getSprite();
|
||
}
|
||
setSprite(t2, e2 = {}) {
|
||
return this._lazyInitEmptyStyle(), this.style.setSprite(t2, e2, ((t3) => {
|
||
t3 || this._update(true);
|
||
})), this;
|
||
}
|
||
setLight(t2, e2 = {}) {
|
||
return this._lazyInitEmptyStyle(), this.style.setLight(t2, e2), this._update(true);
|
||
}
|
||
getLight() {
|
||
return this.style.getLight();
|
||
}
|
||
setFeatureState(t2, e2) {
|
||
return this.style.setFeatureState(t2, e2), this._update();
|
||
}
|
||
removeFeatureState(t2, e2) {
|
||
return this.style.removeFeatureState(t2, e2), this._update();
|
||
}
|
||
getFeatureState(t2) {
|
||
return this.style.getFeatureState(t2);
|
||
}
|
||
getContainer() {
|
||
return this._container;
|
||
}
|
||
getCanvasContainer() {
|
||
return this._canvasContainer;
|
||
}
|
||
getCanvas() {
|
||
return this._canvas;
|
||
}
|
||
_containerDimensions() {
|
||
let t2 = 0, e2 = 0;
|
||
return this._container && (t2 = this._container.clientWidth || 400, e2 = this._container.clientHeight || 300), [t2, e2];
|
||
}
|
||
_setupContainer() {
|
||
const t2 = this._container;
|
||
t2.classList.add("maplibregl-map");
|
||
const e2 = this._canvasContainer = i2.create("div", "maplibregl-canvas-container", t2);
|
||
this._interactive && e2.classList.add("maplibregl-interactive"), this._canvas = i2.create("canvas", "maplibregl-canvas", e2), this._canvas.addEventListener("webglcontextlost", this._contextLost, false), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.setAttribute("tabindex", "0"), this._canvas.setAttribute("aria-label", "Map"), this._canvas.setAttribute("role", "region");
|
||
const s2 = this._containerDimensions(), a2 = this._getClampedPixelRatio(s2[0], s2[1]);
|
||
this._resizeCanvas(s2[0], s2[1], a2);
|
||
const o2 = this._controlContainer = i2.create("div", "maplibregl-control-container", t2), r2 = this._controlPositions = {};
|
||
["top-left", "top-right", "bottom-left", "bottom-right"].forEach(((t3) => {
|
||
r2[t3] = i2.create("div", `maplibregl-ctrl-${t3} `, o2);
|
||
})), this._container.addEventListener("scroll", this._onMapScroll, false);
|
||
}
|
||
_setupCooperativeGestures() {
|
||
this._cooperativeGesturesScreen = i2.create("div", "maplibregl-cooperative-gesture-screen", this._container);
|
||
let t2 = "boolean" != typeof this._cooperativeGestures && this._cooperativeGestures.windowsHelpText ? this._cooperativeGestures.windowsHelpText : "Use Ctrl + scroll to zoom the map";
|
||
0 === navigator.platform.indexOf("Mac") && (t2 = "boolean" != typeof this._cooperativeGestures && this._cooperativeGestures.macHelpText ? this._cooperativeGestures.macHelpText : "Use ⌘ + scroll to zoom the map"), this._cooperativeGesturesScreen.innerHTML = `
|
||
<div class="maplibregl-desktop-message">${t2}</div>
|
||
<div class="maplibregl-mobile-message">${"boolean" != typeof this._cooperativeGestures && this._cooperativeGestures.mobileHelpText ? this._cooperativeGestures.mobileHelpText : "Use two fingers to move the map"}</div>
|
||
`, this._cooperativeGesturesScreen.setAttribute("aria-hidden", "true"), this._canvasContainer.addEventListener("wheel", this._cooperativeGesturesOnWheel, false), this._canvasContainer.classList.add("maplibregl-cooperative-gestures");
|
||
}
|
||
_destroyCooperativeGestures() {
|
||
i2.remove(this._cooperativeGesturesScreen), this._canvasContainer.removeEventListener("wheel", this._cooperativeGesturesOnWheel, false), this._canvasContainer.classList.remove("maplibregl-cooperative-gestures");
|
||
}
|
||
_resizeCanvas(t2, e2, i3) {
|
||
this._canvas.width = Math.floor(i3 * t2), this._canvas.height = Math.floor(i3 * e2), this._canvas.style.width = `${t2}px`, this._canvas.style.height = `${e2}px`;
|
||
}
|
||
_setupPainter() {
|
||
const t2 = { alpha: true, stencil: true, depth: true, failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || false };
|
||
let e2 = null;
|
||
this._canvas.addEventListener("webglcontextcreationerror", ((i4) => {
|
||
e2 = { requestedAttributes: t2 }, i4 && (e2.statusMessage = i4.statusMessage, e2.type = i4.type);
|
||
}), { once: true });
|
||
const i3 = this._canvas.getContext("webgl2", t2) || this._canvas.getContext("webgl", t2);
|
||
if (!i3) {
|
||
const t3 = "Failed to initialize WebGL";
|
||
throw e2 ? (e2.message = t3, new Error(JSON.stringify(e2))) : new Error(t3);
|
||
}
|
||
this.painter = new is(i3, this.transform), s.testSupport(i3);
|
||
}
|
||
_onCooperativeGesture(t2, e2, i3) {
|
||
return !e2 && i3 < 2 && (this._cooperativeGesturesScreen.classList.add("maplibregl-show"), setTimeout((() => {
|
||
this._cooperativeGesturesScreen.classList.remove("maplibregl-show");
|
||
}), 100)), false;
|
||
}
|
||
loaded() {
|
||
return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
|
||
}
|
||
_update(t2) {
|
||
return this.style && this.style._loaded ? (this._styleDirty = this._styleDirty || t2, this._sourcesDirty = true, this.triggerRepaint(), this) : this;
|
||
}
|
||
_requestRenderFrame(t2) {
|
||
return this._update(), this._renderTaskQueue.add(t2);
|
||
}
|
||
_cancelRenderFrame(t2) {
|
||
this._renderTaskQueue.remove(t2);
|
||
}
|
||
_render(e2) {
|
||
const i3 = this._idleTriggered ? this._fadeDuration : 0;
|
||
if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(e2), this._removed) return;
|
||
let s2 = false;
|
||
if (this.style && this._styleDirty) {
|
||
this._styleDirty = false;
|
||
const e3 = this.transform.zoom, a3 = t.h.now();
|
||
this.style.zoomHistory.update(e3, a3);
|
||
const o2 = new t.a8(e3, { now: a3, fadeDuration: i3, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), r2 = o2.crossFadingFactor();
|
||
1 === r2 && r2 === this._crossFadingFactor || (s2 = true, this._crossFadingFactor = r2), this.style.update(o2);
|
||
}
|
||
this.style && this._sourcesDirty && (this._sourcesDirty = false, this.style._updateSources(this.transform)), this.terrain ? (this.terrain.sourceCache.update(this.transform, this.terrain), this.transform._minEleveationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._elevationFreeze || (this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom))) : (this.transform._minEleveationForCurrentTile = 0, this.transform.elevation = 0), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, i3, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: i3, showPadding: this.showPadding }), this.fire(new t.k("render")), this.loaded() && !this._loaded && (this._loaded = true, t.bg.mark(t.bh.load), this.fire(new t.k("load"))), this.style && (this.style.hasTransitions() || s2) && (this._styleDirty = true), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles();
|
||
const a2 = this._sourcesDirty || this._styleDirty || this._placementDirty;
|
||
return a2 || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new t.k("idle")), !this._loaded || this._fullyLoaded || a2 || (this._fullyLoaded = true, t.bg.mark(t.bh.fullLoad)), this;
|
||
}
|
||
redraw() {
|
||
return this.style && (this._frame && (this._frame.cancel(), this._frame = null), this._render(0)), this;
|
||
}
|
||
remove() {
|
||
var e2;
|
||
this._hash && this._hash.remove();
|
||
for (const t2 of this._controls) t2.onRemove(this);
|
||
this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), "undefined" != typeof window && removeEventListener("online", this._onWindowOnline, false), h.removeThrottleControl(this._imageQueueHandle), null === (e2 = this._resizeObserver) || void 0 === e2 || e2.disconnect();
|
||
const s2 = this.painter.context.gl.getExtension("WEBGL_lose_context");
|
||
s2 && s2.loseContext(), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.removeEventListener("webglcontextlost", this._contextLost, false), i2.remove(this._canvasContainer), i2.remove(this._controlContainer), this._cooperativeGestures && this._destroyCooperativeGestures(), this._container.classList.remove("maplibregl-map"), t.bg.clearMetrics(), this._removed = true, this.fire(new t.k("remove"));
|
||
}
|
||
triggerRepaint() {
|
||
this.style && !this._frame && (this._frame = t.h.frame(((e2) => {
|
||
t.bg.frame(e2), this._frame = null, this._render(e2);
|
||
})));
|
||
}
|
||
get showTileBoundaries() {
|
||
return !!this._showTileBoundaries;
|
||
}
|
||
set showTileBoundaries(t2) {
|
||
this._showTileBoundaries !== t2 && (this._showTileBoundaries = t2, this._update());
|
||
}
|
||
get showPadding() {
|
||
return !!this._showPadding;
|
||
}
|
||
set showPadding(t2) {
|
||
this._showPadding !== t2 && (this._showPadding = t2, this._update());
|
||
}
|
||
get showCollisionBoxes() {
|
||
return !!this._showCollisionBoxes;
|
||
}
|
||
set showCollisionBoxes(t2) {
|
||
this._showCollisionBoxes !== t2 && (this._showCollisionBoxes = t2, t2 ? this.style._generateCollisionBoxes() : this._update());
|
||
}
|
||
get showOverdrawInspector() {
|
||
return !!this._showOverdrawInspector;
|
||
}
|
||
set showOverdrawInspector(t2) {
|
||
this._showOverdrawInspector !== t2 && (this._showOverdrawInspector = t2, this._update());
|
||
}
|
||
get repaint() {
|
||
return !!this._repaint;
|
||
}
|
||
set repaint(t2) {
|
||
this._repaint !== t2 && (this._repaint = t2, this.triggerRepaint());
|
||
}
|
||
get vertices() {
|
||
return !!this._vertices;
|
||
}
|
||
set vertices(t2) {
|
||
this._vertices = t2, this._update();
|
||
}
|
||
get version() {
|
||
return fa;
|
||
}
|
||
getCameraTargetElevation() {
|
||
return this.transform.elevation;
|
||
}
|
||
}, Ba.NavigationControl = class {
|
||
constructor(e2) {
|
||
this._updateZoomButtons = () => {
|
||
const t2 = this._map.getZoom(), e3 = t2 === this._map.getMaxZoom(), i3 = t2 === this._map.getMinZoom();
|
||
this._zoomInButton.disabled = e3, this._zoomOutButton.disabled = i3, this._zoomInButton.setAttribute("aria-disabled", e3.toString()), this._zoomOutButton.setAttribute("aria-disabled", i3.toString());
|
||
}, this._rotateCompassArrow = () => {
|
||
const t2 = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;
|
||
this._compassIcon.style.transform = t2;
|
||
}, this._setButtonTitle = (t2, e3) => {
|
||
const i3 = this._map._getUIString(`NavigationControl.${e3}`);
|
||
t2.title = i3, t2.setAttribute("aria-label", i3);
|
||
}, this.options = t.e({}, xa, e2), this._container = i2.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._container.addEventListener("contextmenu", ((t2) => t2.preventDefault())), this.options.showZoom && (this._zoomInButton = this._createButton("maplibregl-ctrl-zoom-in", ((t2) => this._map.zoomIn({}, { originalEvent: t2 }))), i2.create("span", "maplibregl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("maplibregl-ctrl-zoom-out", ((t2) => this._map.zoomOut({}, { originalEvent: t2 }))), i2.create("span", "maplibregl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (this._compass = this._createButton("maplibregl-ctrl-compass", ((t2) => {
|
||
this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: t2 }) : this._map.resetNorth({}, { originalEvent: t2 });
|
||
})), this._compassIcon = i2.create("span", "maplibregl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true"));
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), this._map.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && this._map.on("pitch", this._rotateCompassArrow), this._map.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new ya(this._map, this._compass, this.options.visualizePitch)), this._container;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._container), this.options.showZoom && this._map.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && this._map.off("pitch", this._rotateCompassArrow), this._map.off("rotate", this._rotateCompassArrow), this._handler.off(), delete this._handler), delete this._map;
|
||
}
|
||
_createButton(t2, e2) {
|
||
const s2 = i2.create("button", t2, this._container);
|
||
return s2.type = "button", s2.addEventListener("click", e2), s2;
|
||
}
|
||
}, Ba.GeolocateControl = class extends t.E {
|
||
constructor(e2) {
|
||
super(), this._onSuccess = (e3) => {
|
||
if (this._map) {
|
||
if (this._isOutOfMapMaxBounds(e3)) return this._setErrorState(), this.fire(new t.k("outofmaxbounds", e3)), this._updateMarker(), void this._finish();
|
||
if (this.options.trackUserLocation) switch (this._lastKnownPosition = e3, this._watchState) {
|
||
case "WAITING_ACTIVE":
|
||
case "ACTIVE_LOCK":
|
||
case "ACTIVE_ERROR":
|
||
this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
|
||
break;
|
||
case "BACKGROUND":
|
||
case "BACKGROUND_ERROR":
|
||
this._watchState = "BACKGROUND", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");
|
||
break;
|
||
default:
|
||
throw new Error(`Unexpected watchState ${this._watchState}`);
|
||
}
|
||
this.options.showUserLocation && "OFF" !== this._watchState && this._updateMarker(e3), this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(e3), this.options.showUserLocation && this._dotElement.classList.remove("maplibregl-user-location-dot-stale"), this.fire(new t.k("geolocate", e3)), this._finish();
|
||
}
|
||
}, this._updateCamera = (e3) => {
|
||
const i3 = new t.L(e3.coords.longitude, e3.coords.latitude), s2 = e3.coords.accuracy, a2 = this._map.getBearing(), o2 = t.e({ bearing: a2 }, this.options.fitBoundsOptions), r2 = L.fromLngLat(i3, s2);
|
||
this._map.fitBounds(r2, o2, { geolocateSource: true });
|
||
}, this._updateMarker = (e3) => {
|
||
if (e3) {
|
||
const i3 = new t.L(e3.coords.longitude, e3.coords.latitude);
|
||
this._accuracyCircleMarker.setLngLat(i3).addTo(this._map), this._userLocationDotMarker.setLngLat(i3).addTo(this._map), this._accuracy = e3.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
|
||
} else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove();
|
||
}, this._onZoom = () => {
|
||
this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
|
||
}, this._onError = (e3) => {
|
||
if (this._map) {
|
||
if (this.options.trackUserLocation) if (1 === e3.code) {
|
||
this._watchState = "OFF", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this._geolocateButton.disabled = true;
|
||
const t2 = this._map._getUIString("GeolocateControl.LocationNotAvailable");
|
||
this._geolocateButton.title = t2, this._geolocateButton.setAttribute("aria-label", t2), void 0 !== this._geolocationWatchID && this._clearWatch();
|
||
} else {
|
||
if (3 === e3.code && Pa) return;
|
||
this._setErrorState();
|
||
}
|
||
"OFF" !== this._watchState && this.options.showUserLocation && this._dotElement.classList.add("maplibregl-user-location-dot-stale"), this.fire(new t.k("error", e3)), this._finish();
|
||
}
|
||
}, this._finish = () => {
|
||
this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;
|
||
}, this._setupUI = (e3) => {
|
||
if (this._map) {
|
||
if (this._container.addEventListener("contextmenu", ((t2) => t2.preventDefault())), this._geolocateButton = i2.create("button", "maplibregl-ctrl-geolocate", this._container), i2.create("span", "maplibregl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", false === e3) {
|
||
t.w("Geolocation support is not available so the GeolocateControl will be disabled.");
|
||
const e4 = this._map._getUIString("GeolocateControl.LocationNotAvailable");
|
||
this._geolocateButton.disabled = true, this._geolocateButton.title = e4, this._geolocateButton.setAttribute("aria-label", e4);
|
||
} else {
|
||
const t2 = this._map._getUIString("GeolocateControl.FindMyLocation");
|
||
this._geolocateButton.title = t2, this._geolocateButton.setAttribute("aria-label", t2);
|
||
}
|
||
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = i2.create("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new Ea({ element: this._dotElement }), this._circleElement = i2.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Ea({ 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 = true, this.options.trackUserLocation && this._map.on("movestart", ((e4) => {
|
||
e4.geolocateSource || "ACTIVE_LOCK" !== this._watchState || e4.originalEvent && "resize" === e4.originalEvent.type || (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this.fire(new t.k("trackuserlocationend")));
|
||
}));
|
||
}
|
||
}, this.options = t.e({}, Sa, e2);
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this._container = i2.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), (function(t3, e2 = false) {
|
||
void 0 === ba || e2 ? void 0 !== window.navigator.permissions ? window.navigator.permissions.query({ name: "geolocation" }).then(((e3) => {
|
||
ba = "denied" !== e3.state, t3(ba);
|
||
})).catch((() => {
|
||
ba = !!window.navigator.geolocation, t3(ba);
|
||
})) : (ba = !!window.navigator.geolocation, t3(ba)) : t3(ba);
|
||
})(this._setupUI), this._container;
|
||
}
|
||
onRemove() {
|
||
void 0 !== this._geolocationWatchID && (window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), i2.remove(this._container), this._map.off("zoom", this._onZoom), this._map = void 0, Ca = 0, Pa = false;
|
||
}
|
||
_isOutOfMapMaxBounds(t2) {
|
||
const e2 = this._map.getMaxBounds(), i3 = t2.coords;
|
||
return e2 && (i3.longitude < e2.getWest() || i3.longitude > e2.getEast() || i3.latitude < e2.getSouth() || i3.latitude > e2.getNorth());
|
||
}
|
||
_setErrorState() {
|
||
switch (this._watchState) {
|
||
case "WAITING_ACTIVE":
|
||
this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");
|
||
break;
|
||
case "ACTIVE_LOCK":
|
||
this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");
|
||
break;
|
||
case "BACKGROUND":
|
||
this._watchState = "BACKGROUND_ERROR", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");
|
||
break;
|
||
case "ACTIVE_ERROR":
|
||
break;
|
||
default:
|
||
throw new Error(`Unexpected watchState ${this._watchState}`);
|
||
}
|
||
}
|
||
_updateCircleRadius() {
|
||
const t2 = this._map.getBounds(), e2 = t2.getSouthEast(), i3 = t2.getNorthEast(), s2 = e2.distanceTo(i3), a2 = Math.ceil(this._accuracy / (s2 / this._map._container.clientHeight) * 2);
|
||
this._circleElement.style.width = `${a2}px`, this._circleElement.style.height = `${a2}px`;
|
||
}
|
||
trigger() {
|
||
if (!this._setup) return t.w("Geolocate control triggered before added to a map"), false;
|
||
if (this.options.trackUserLocation) {
|
||
switch (this._watchState) {
|
||
case "OFF":
|
||
this._watchState = "WAITING_ACTIVE", this.fire(new t.k("trackuserlocationstart"));
|
||
break;
|
||
case "WAITING_ACTIVE":
|
||
case "ACTIVE_LOCK":
|
||
case "ACTIVE_ERROR":
|
||
case "BACKGROUND_ERROR":
|
||
Ca--, Pa = false, this._watchState = "OFF", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this.fire(new t.k("trackuserlocationend"));
|
||
break;
|
||
case "BACKGROUND":
|
||
this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new t.k("trackuserlocationstart"));
|
||
break;
|
||
default:
|
||
throw new Error(`Unexpected watchState ${this._watchState}`);
|
||
}
|
||
switch (this._watchState) {
|
||
case "WAITING_ACTIVE":
|
||
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
|
||
break;
|
||
case "ACTIVE_LOCK":
|
||
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
|
||
break;
|
||
case "OFF":
|
||
break;
|
||
default:
|
||
throw new Error(`Unexpected watchState ${this._watchState}`);
|
||
}
|
||
if ("OFF" === this._watchState && void 0 !== this._geolocationWatchID) this._clearWatch();
|
||
else if (void 0 === this._geolocationWatchID) {
|
||
let t2;
|
||
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), Ca++, Ca > 1 ? (t2 = { maximumAge: 6e5, timeout: 0 }, Pa = true) : (t2 = this.options.positionOptions, Pa = false), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, t2);
|
||
}
|
||
} else window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
|
||
return true;
|
||
}
|
||
_clearWatch() {
|
||
window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null);
|
||
}
|
||
}, Ba.AttributionControl = ra, Ba.LogoControl = na, Ba.ScaleControl = class {
|
||
constructor(e2) {
|
||
this._onMove = () => {
|
||
Ma(this._map, this._container, this.options);
|
||
}, this.setUnit = (t2) => {
|
||
this.options.unit = t2, Ma(this._map, this._container, this.options);
|
||
}, this.options = t.e({}, Da, e2);
|
||
}
|
||
getDefaultPosition() {
|
||
return "bottom-left";
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this._container = i2.create("div", "maplibregl-ctrl maplibregl-ctrl-scale", t2.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._container), this._map.off("move", this._onMove), this._map = void 0;
|
||
}
|
||
}, Ba.FullscreenControl = class extends t.E {
|
||
constructor(e2 = {}) {
|
||
super(), this._onFullscreenChange = () => {
|
||
(window.document.fullscreenElement || window.document.mozFullScreenElement || window.document.webkitFullscreenElement || window.document.msFullscreenElement) === this._container !== this._fullscreen && this._handleFullscreenChange();
|
||
}, this._onClickFullscreen = () => {
|
||
this._isFullscreen() ? this._exitFullscreen() : this._requestFullscreen();
|
||
}, this._fullscreen = false, e2 && e2.container && (e2.container instanceof HTMLElement ? this._container = e2.container : t.w("Full screen control 'container' must be a DOM element.")), "onfullscreenchange" in document ? this._fullscreenchange = "fullscreenchange" : "onmozfullscreenchange" in document ? this._fullscreenchange = "mozfullscreenchange" : "onwebkitfullscreenchange" in document ? this._fullscreenchange = "webkitfullscreenchange" : "onmsfullscreenchange" in document && (this._fullscreenchange = "MSFullscreenChange");
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this._container || (this._container = this._map.getContainer()), this._controlContainer = i2.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), this._controlContainer;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._controlContainer), this._map = null, window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);
|
||
}
|
||
_setupUI() {
|
||
const t2 = this._fullscreenButton = i2.create("button", "maplibregl-ctrl-fullscreen", this._controlContainer);
|
||
i2.create("span", "maplibregl-ctrl-icon", t2).setAttribute("aria-hidden", "true"), t2.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);
|
||
}
|
||
_updateTitle() {
|
||
const t2 = this._getTitle();
|
||
this._fullscreenButton.setAttribute("aria-label", t2), this._fullscreenButton.title = t2;
|
||
}
|
||
_getTitle() {
|
||
return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter");
|
||
}
|
||
_isFullscreen() {
|
||
return this._fullscreen;
|
||
}
|
||
_handleFullscreenChange() {
|
||
this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"), this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"), this._updateTitle(), this._fullscreen ? (this.fire(new t.k("fullscreenstart")), this._map._cooperativeGestures && (this._prevCooperativeGestures = this._map._cooperativeGestures, this._map.setCooperativeGestures())) : (this.fire(new t.k("fullscreenend")), this._prevCooperativeGestures && (this._map.setCooperativeGestures(this._prevCooperativeGestures), delete this._prevCooperativeGestures));
|
||
}
|
||
_exitFullscreen() {
|
||
window.document.exitFullscreen ? window.document.exitFullscreen() : window.document.mozCancelFullScreen ? window.document.mozCancelFullScreen() : window.document.msExitFullscreen ? window.document.msExitFullscreen() : window.document.webkitCancelFullScreen ? window.document.webkitCancelFullScreen() : this._togglePseudoFullScreen();
|
||
}
|
||
_requestFullscreen() {
|
||
this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.mozRequestFullScreen ? this._container.mozRequestFullScreen() : this._container.msRequestFullscreen ? this._container.msRequestFullscreen() : this._container.webkitRequestFullscreen ? this._container.webkitRequestFullscreen() : this._togglePseudoFullScreen();
|
||
}
|
||
_togglePseudoFullScreen() {
|
||
this._container.classList.toggle("maplibregl-pseudo-fullscreen"), this._handleFullscreenChange(), this._map.resize();
|
||
}
|
||
}, Ba.TerrainControl = class {
|
||
constructor(t2) {
|
||
this._toggleTerrain = () => {
|
||
this._map.getTerrain() ? this._map.setTerrain(null) : this._map.setTerrain(this.options), this._updateTerrainIcon();
|
||
}, this._updateTerrainIcon = () => {
|
||
this._terrainButton.classList.remove("maplibregl-ctrl-terrain"), this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"), this._map.terrain ? (this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"), this._terrainButton.title = this._map._getUIString("TerrainControl.disableTerrain")) : (this._terrainButton.classList.add("maplibregl-ctrl-terrain"), this._terrainButton.title = this._map._getUIString("TerrainControl.enableTerrain"));
|
||
}, this.options = t2;
|
||
}
|
||
onAdd(t2) {
|
||
return this._map = t2, this._container = i2.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._terrainButton = i2.create("button", "maplibregl-ctrl-terrain", this._container), i2.create("span", "maplibregl-ctrl-icon", this._terrainButton).setAttribute("aria-hidden", "true"), this._terrainButton.type = "button", this._terrainButton.addEventListener("click", this._toggleTerrain), this._updateTerrainIcon(), this._map.on("terrain", this._updateTerrainIcon), this._container;
|
||
}
|
||
onRemove() {
|
||
i2.remove(this._container), this._map.off("terrain", this._updateTerrainIcon), this._map = void 0;
|
||
}
|
||
}, Ba.Popup = class extends t.E {
|
||
constructor(e2) {
|
||
super(), this.remove = () => (this._content && i2.remove(this._content), this._container && (i2.remove(this._container), delete this._container), this._map && (this._map.off("move", this._update), this._map.off("move", this._onClose), this._map.off("click", this._onClose), this._map.off("remove", this.remove), this._map.off("mousemove", this._onMouseMove), this._map.off("mouseup", this._onMouseUp), this._map.off("drag", this._onDrag), delete this._map), this.fire(new t.k("close")), this), this._onMouseUp = (t2) => {
|
||
this._update(t2.point);
|
||
}, this._onMouseMove = (t2) => {
|
||
this._update(t2.point);
|
||
}, this._onDrag = (t2) => {
|
||
this._update(t2.point);
|
||
}, this._update = (t2) => {
|
||
if (!this._map || !this._lngLat && !this._trackPointer || !this._content) return;
|
||
if (!this._container) {
|
||
if (this._container = i2.create("div", "maplibregl-popup", this._map.getContainer()), this._tip = i2.create("div", "maplibregl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className) for (const t3 of this.options.className.split(" ")) this._container.classList.add(t3);
|
||
this._trackPointer && this._container.classList.add("maplibregl-popup-track-pointer");
|
||
}
|
||
if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._map.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = wa(this._lngLat, this._pos, this._map.transform)), this._trackPointer && !t2) return;
|
||
const e3 = this._pos = this._trackPointer && t2 ? t2 : this._map.project(this._lngLat);
|
||
let s2 = this.options.anchor;
|
||
const a2 = Ra(this.options.offset);
|
||
if (!s2) {
|
||
const t3 = this._container.offsetWidth, i3 = this._container.offsetHeight;
|
||
let o3;
|
||
o3 = e3.y + a2.bottom.y < i3 ? ["top"] : e3.y > this._map.transform.height - i3 ? ["bottom"] : [], e3.x < t3 / 2 ? o3.push("left") : e3.x > this._map.transform.width - t3 / 2 && o3.push("right"), s2 = 0 === o3.length ? "bottom" : o3.join("-");
|
||
}
|
||
const o2 = e3.add(a2[s2]).round();
|
||
i2.setTransform(this._container, `${Ta[s2]} translate(${o2.x}px,${o2.y}px)`), Ia(this._container, s2, "popup");
|
||
}, this._onClose = () => {
|
||
this.remove();
|
||
}, this.options = t.e(Object.create(La), e2);
|
||
}
|
||
addTo(e2) {
|
||
return this._map && this.remove(), this._map = e2, this.options.closeOnClick && this._map.on("click", this._onClose), this.options.closeOnMove && this._map.on("move", this._onClose), this._map.on("remove", this.remove), this._update(), this._focusFirstElement(), this._trackPointer ? (this._map.on("mousemove", this._onMouseMove), this._map.on("mouseup", this._onMouseUp), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.add("maplibregl-track-pointer")) : this._map.on("move", this._update), this.fire(new t.k("open")), this;
|
||
}
|
||
isOpen() {
|
||
return !!this._map;
|
||
}
|
||
getLngLat() {
|
||
return this._lngLat;
|
||
}
|
||
setLngLat(e2) {
|
||
return this._lngLat = t.L.convert(e2), this._pos = null, this._trackPointer = false, this._update(), this._map && (this._map.on("move", this._update), this._map.off("mousemove", this._onMouseMove), this._container && this._container.classList.remove("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.remove("maplibregl-track-pointer")), this;
|
||
}
|
||
trackPointer() {
|
||
return this._trackPointer = true, this._pos = null, this._update(), this._map && (this._map.off("move", this._update), this._map.on("mousemove", this._onMouseMove), this._map.on("drag", this._onDrag), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.add("maplibregl-track-pointer")), this;
|
||
}
|
||
getElement() {
|
||
return this._container;
|
||
}
|
||
setText(t2) {
|
||
return this.setDOMContent(document.createTextNode(t2));
|
||
}
|
||
setHTML(t2) {
|
||
const e2 = document.createDocumentFragment(), i3 = document.createElement("body");
|
||
let s2;
|
||
for (i3.innerHTML = t2; s2 = i3.firstChild, s2; ) e2.appendChild(s2);
|
||
return this.setDOMContent(e2);
|
||
}
|
||
getMaxWidth() {
|
||
var t2;
|
||
return null === (t2 = this._container) || void 0 === t2 ? void 0 : t2.style.maxWidth;
|
||
}
|
||
setMaxWidth(t2) {
|
||
return this.options.maxWidth = t2, this._update(), this;
|
||
}
|
||
setDOMContent(t2) {
|
||
if (this._content) for (; this._content.hasChildNodes(); ) this._content.firstChild && this._content.removeChild(this._content.firstChild);
|
||
else this._content = i2.create("div", "maplibregl-popup-content", this._container);
|
||
return this._content.appendChild(t2), this._createCloseButton(), this._update(), this._focusFirstElement(), this;
|
||
}
|
||
addClassName(t2) {
|
||
this._container && this._container.classList.add(t2);
|
||
}
|
||
removeClassName(t2) {
|
||
this._container && this._container.classList.remove(t2);
|
||
}
|
||
setOffset(t2) {
|
||
return this.options.offset = t2, this._update(), this;
|
||
}
|
||
toggleClassName(t2) {
|
||
if (this._container) return this._container.classList.toggle(t2);
|
||
}
|
||
_createCloseButton() {
|
||
this.options.closeButton && (this._closeButton = i2.create("button", "maplibregl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.setAttribute("aria-label", "Close popup"), this._closeButton.innerHTML = "×", this._closeButton.addEventListener("click", this._onClose));
|
||
}
|
||
_focusFirstElement() {
|
||
if (!this.options.focusAfterOpen || !this._container) return;
|
||
const t2 = this._container.querySelector(Aa);
|
||
t2 && t2.focus();
|
||
}
|
||
}, Ba.Marker = Ea, Ba.Style = se, Ba.LngLat = t.L, Ba.LngLatBounds = L, Ba.Point = t.P, Ba.MercatorCoordinate = t.U, Ba.Evented = t.E, Ba.AJAXError = t.bi, Ba.config = t.c, Ba.CanvasSource = Z, Ba.GeoJSONSource = B, Ba.ImageSource = N, Ba.RasterDEMTileSource = F, Ba.RasterTileSource = k, Ba.VectorTileSource = R, Ba.VideoSource = U, Ba.setRTLTextPlugin = t.bj, Ba.getRTLTextPluginStatus = t.bk, Ba.prewarm = function() {
|
||
st().acquire(J);
|
||
}, Ba.clearPrewarmedResources = function() {
|
||
const t2 = it;
|
||
t2 && (t2.isPreloaded() && 1 === t2.numActive() ? (t2.release(J), it = 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()"));
|
||
}, ka.extend(Ba, { isSafari: t.ac, getPerformanceMetrics: t.bg.getPerformanceMetrics }), Ba;
|
||
}));
|
||
var maplibregl$1 = maplibregl2;
|
||
return maplibregl$1;
|
||
}));
|
||
})(maplibreGl$1);
|
||
return maplibreGl$1.exports;
|
||
}
|
||
var maplibreGlExports = requireMaplibreGl();
|
||
const maplibregl = /* @__PURE__ */ getDefaultExportFromCjs(maplibreGlExports);
|
||
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
||
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
||
if (render) {
|
||
options.render = render;
|
||
options.staticRenderFns = staticRenderFns;
|
||
options._compiled = true;
|
||
}
|
||
if (scopeId) {
|
||
options._scopeId = "data-v-" + scopeId;
|
||
}
|
||
return {
|
||
exports: scriptExports,
|
||
options
|
||
};
|
||
}
|
||
const _sfc_main$3 = {
|
||
props: {
|
||
center: {
|
||
type: Object,
|
||
required: true
|
||
},
|
||
zoom: {
|
||
type: Number,
|
||
required: true
|
||
},
|
||
markers: {
|
||
type: Array,
|
||
default: () => []
|
||
},
|
||
selectedMarkerId: {
|
||
type: String,
|
||
default: null
|
||
}
|
||
},
|
||
setup(props, { emit }) {
|
||
const mapContainer = Vue.ref(null);
|
||
const map2 = Vue.ref(null);
|
||
const loading = Vue.ref(true);
|
||
const markerElements = Vue.ref(/* @__PURE__ */ new Map());
|
||
const isDragging = Vue.ref(false);
|
||
Vue.onMounted(async () => {
|
||
await Vue.nextTick();
|
||
initMap();
|
||
});
|
||
Vue.onBeforeUnmount(() => {
|
||
if (map2.value) {
|
||
map2.value.remove();
|
||
map2.value = null;
|
||
}
|
||
markerElements.value.clear();
|
||
});
|
||
Vue.watch(() => props.center, (newCenter) => {
|
||
if (map2.value && map2.value.loaded() && !isDragging.value) {
|
||
const currentCenter = map2.value.getCenter();
|
||
if (Math.abs(currentCenter.lat - newCenter.lat) > 1e-5 || Math.abs(currentCenter.lng - newCenter.lon) > 1e-5) {
|
||
map2.value.setCenter([newCenter.lon, newCenter.lat]);
|
||
}
|
||
}
|
||
}, { deep: true });
|
||
Vue.watch(() => props.zoom, (newZoom) => {
|
||
if (map2.value && map2.value.loaded()) {
|
||
const currentZoom = map2.value.getZoom();
|
||
if (Math.abs(currentZoom - newZoom) > 0.01) {
|
||
map2.value.setZoom(newZoom);
|
||
}
|
||
}
|
||
});
|
||
Vue.watch(() => props.markers, () => {
|
||
updateMarkers();
|
||
}, { deep: true });
|
||
Vue.watch(() => props.selectedMarkerId, (newId) => {
|
||
updateMarkerSelection(newId);
|
||
});
|
||
function initMap() {
|
||
if (!mapContainer.value) {
|
||
console.error("Map container not found");
|
||
return;
|
||
}
|
||
loading.value = true;
|
||
try {
|
||
map2.value = new maplibregl.Map({
|
||
container: mapContainer.value,
|
||
style: {
|
||
version: 8,
|
||
sources: {
|
||
osm: {
|
||
type: "raster",
|
||
tiles: [
|
||
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||
"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||
"https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||
],
|
||
tileSize: 256,
|
||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||
}
|
||
},
|
||
layers: [
|
||
{
|
||
id: "osm",
|
||
type: "raster",
|
||
source: "osm",
|
||
minzoom: 0,
|
||
maxzoom: 19
|
||
}
|
||
]
|
||
},
|
||
center: [props.center.lon, props.center.lat],
|
||
zoom: props.zoom
|
||
});
|
||
map2.value.on("load", () => {
|
||
loading.value = false;
|
||
updateMarkers();
|
||
});
|
||
map2.value.on("click", (e) => {
|
||
const target = e.originalEvent.target;
|
||
const isMarkerClick = target.closest(".custom-marker");
|
||
if (!isMarkerClick) {
|
||
const clickPos = {
|
||
lat: e.lngLat.lat,
|
||
lng: e.lngLat.lng
|
||
};
|
||
emit("map-click", clickPos);
|
||
}
|
||
});
|
||
} catch (error) {
|
||
console.error("Error initializing map:", error);
|
||
loading.value = false;
|
||
}
|
||
}
|
||
function updateMarkers() {
|
||
if (!map2.value || !map2.value.loaded()) {
|
||
return;
|
||
}
|
||
markerElements.value.forEach(({ marker }) => {
|
||
if (marker) {
|
||
marker.remove();
|
||
}
|
||
});
|
||
markerElements.value.clear();
|
||
if (props.markers && Array.isArray(props.markers)) {
|
||
props.markers.forEach((markerData, index) => {
|
||
addMarkerToMap(markerData, index);
|
||
});
|
||
}
|
||
}
|
||
function addMarkerToMap(markerData, index) {
|
||
if (!map2.value || !markerData || !markerData.position) {
|
||
return;
|
||
}
|
||
const el = document.createElement("div");
|
||
el.className = "custom-marker";
|
||
if (markerData.iconUrl) {
|
||
el.classList.add("custom-icon");
|
||
const img = document.createElement("img");
|
||
img.src = markerData.iconUrl;
|
||
img.className = "marker-icon-image";
|
||
const size = markerData.iconSize || 40;
|
||
img.style.width = `${size}px`;
|
||
img.style.height = `${size}px`;
|
||
if (props.selectedMarkerId === markerData.id) {
|
||
img.classList.add("selected");
|
||
}
|
||
el.appendChild(img);
|
||
} else {
|
||
const inner = document.createElement("div");
|
||
inner.className = "marker-inner";
|
||
if (props.selectedMarkerId === markerData.id) {
|
||
inner.classList.add("selected");
|
||
}
|
||
const numberEl = document.createElement("div");
|
||
numberEl.className = "marker-number";
|
||
numberEl.textContent = index + 1;
|
||
inner.appendChild(numberEl);
|
||
el.appendChild(inner);
|
||
}
|
||
try {
|
||
const coords = [markerData.position.lon, markerData.position.lat];
|
||
const marker = new maplibregl.Marker({
|
||
element: el,
|
||
draggable: true,
|
||
anchor: "bottom"
|
||
}).setLngLat(coords).addTo(map2.value);
|
||
marker.on("dragstart", () => {
|
||
isDragging.value = true;
|
||
});
|
||
marker.on("dragend", () => {
|
||
const lngLat = marker.getLngLat();
|
||
emit("marker-moved", {
|
||
markerId: markerData.id,
|
||
position: {
|
||
lat: lngLat.lat,
|
||
lng: lngLat.lng
|
||
}
|
||
});
|
||
setTimeout(() => {
|
||
isDragging.value = false;
|
||
}, 100);
|
||
});
|
||
el.addEventListener("click", (e) => {
|
||
e.stopPropagation();
|
||
emit("marker-click", markerData.id);
|
||
});
|
||
el.addEventListener("dblclick", (e) => {
|
||
e.stopPropagation();
|
||
emit("marker-dblclick", markerData.id);
|
||
});
|
||
markerElements.value.set(markerData.id, {
|
||
marker,
|
||
element: el
|
||
});
|
||
} catch (error) {
|
||
console.error("Error adding marker to map:", error);
|
||
}
|
||
}
|
||
function updateMarkerSelection(selectedId) {
|
||
markerElements.value.forEach(({ element }, markerId) => {
|
||
if (element) {
|
||
const inner = element.querySelector(".marker-inner");
|
||
if (inner) {
|
||
if (markerId === selectedId) {
|
||
inner.classList.add("selected");
|
||
} else {
|
||
inner.classList.remove("selected");
|
||
}
|
||
}
|
||
const img = element.querySelector(".marker-icon-image");
|
||
if (img) {
|
||
if (markerId === selectedId) {
|
||
img.classList.add("selected");
|
||
} else {
|
||
img.classList.remove("selected");
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
function getCurrentCenter() {
|
||
if (map2.value && map2.value.loaded()) {
|
||
const center = map2.value.getCenter();
|
||
return {
|
||
lat: center.lat,
|
||
lon: center.lng
|
||
};
|
||
}
|
||
return {
|
||
lat: props.center.lat,
|
||
lon: props.center.lon
|
||
};
|
||
}
|
||
function getCurrentZoom() {
|
||
if (map2.value && map2.value.loaded()) {
|
||
return map2.value.getZoom();
|
||
}
|
||
return props.zoom;
|
||
}
|
||
function centerOnPosition(lat, lon) {
|
||
if (map2.value && map2.value.loaded()) {
|
||
map2.value.flyTo({
|
||
center: [lon, lat],
|
||
zoom: map2.value.getZoom(),
|
||
duration: 1e3
|
||
});
|
||
}
|
||
}
|
||
return {
|
||
mapContainer,
|
||
loading,
|
||
getCurrentCenter,
|
||
getCurrentZoom,
|
||
centerOnPosition
|
||
};
|
||
}
|
||
};
|
||
var _sfc_render$3 = function render() {
|
||
var _vm = this, _c = _vm._self._c;
|
||
return _c("div", { staticClass: "map-preview" }, [_c("div", { ref: "mapContainer", staticClass: "map-container" }), _vm.loading ? _c("div", { staticClass: "map-loading" }, [_c("div", { staticClass: "spinner" }), _c("span", [_vm._v("Loading map...")])]) : _vm._e()]);
|
||
};
|
||
var _sfc_staticRenderFns$3 = [];
|
||
_sfc_render$3._withStripped = true;
|
||
var __component__$3 = /* @__PURE__ */ normalizeComponent(
|
||
_sfc_main$3,
|
||
_sfc_render$3,
|
||
_sfc_staticRenderFns$3,
|
||
false,
|
||
null,
|
||
null
|
||
);
|
||
__component__$3.options.__file = "/Users/adrienpayet/Documents/code/en-cours/geoproject/public/site/plugins/map-editor/src/components/map/MapPreview.vue";
|
||
const MapPreview = __component__$3.exports;
|
||
const NOMINATIM_API = {
|
||
BASE_URL: "https://nominatim.openstreetmap.org/search",
|
||
USER_AGENT: "GeoProject/1.0 (Kirby CMS Map Editor)",
|
||
RATE_LIMIT_MS: 1e3,
|
||
// 1 request per second
|
||
MIN_QUERY_LENGTH: 3,
|
||
MAX_RESULTS: 5,
|
||
DEFAULT_LANGUAGE: "fr"
|
||
};
|
||
const DEBOUNCE_DELAYS = {
|
||
GEOCODING: 500
|
||
};
|
||
async function geocode(query) {
|
||
if (!query || query.trim().length < NOMINATIM_API.MIN_QUERY_LENGTH) {
|
||
return [];
|
||
}
|
||
try {
|
||
const params = new URLSearchParams({
|
||
q: query.trim(),
|
||
format: "json",
|
||
addressdetails: "1",
|
||
limit: String(NOMINATIM_API.MAX_RESULTS),
|
||
"accept-language": NOMINATIM_API.DEFAULT_LANGUAGE
|
||
});
|
||
const response = await fetch(
|
||
`${NOMINATIM_API.BASE_URL}?${params.toString()}`,
|
||
{
|
||
headers: {
|
||
"User-Agent": NOMINATIM_API.USER_AGENT
|
||
}
|
||
}
|
||
);
|
||
if (!response.ok) {
|
||
throw new Error(`Nominatim API error: ${response.status}`);
|
||
}
|
||
const data = await response.json();
|
||
return data.map((result) => ({
|
||
id: result.place_id,
|
||
displayName: result.display_name,
|
||
lat: parseFloat(result.lat),
|
||
lon: parseFloat(result.lon),
|
||
type: result.type,
|
||
importance: result.importance,
|
||
boundingBox: result.boundingbox
|
||
}));
|
||
} catch (error) {
|
||
console.error("Geocoding error:", error);
|
||
throw error;
|
||
}
|
||
}
|
||
function debounce(func, wait = 500) {
|
||
let timeout;
|
||
return function executedFunction(...args) {
|
||
const later = () => {
|
||
clearTimeout(timeout);
|
||
func(...args);
|
||
};
|
||
clearTimeout(timeout);
|
||
timeout = setTimeout(later, wait);
|
||
};
|
||
}
|
||
const _sfc_main$2 = {
|
||
emits: ["select-location", "center-map"],
|
||
setup(props, { emit }) {
|
||
const searchInput = Vue.ref(null);
|
||
const searchQuery = Vue.ref("");
|
||
const results = Vue.ref([]);
|
||
const isLoading = Vue.ref(false);
|
||
const error = Vue.ref(null);
|
||
const showResults = Vue.ref(false);
|
||
const selectedIndex = Vue.ref(-1);
|
||
const debouncedSearch = debounce(async (query) => {
|
||
if (!query || query.trim().length < 3) {
|
||
results.value = [];
|
||
showResults.value = false;
|
||
isLoading.value = false;
|
||
return;
|
||
}
|
||
isLoading.value = true;
|
||
error.value = null;
|
||
try {
|
||
const data = await geocode(query);
|
||
results.value = data;
|
||
showResults.value = true;
|
||
selectedIndex.value = -1;
|
||
} catch (err) {
|
||
error.value = "Erreur lors de la recherche. Veuillez réessayer.";
|
||
results.value = [];
|
||
} finally {
|
||
isLoading.value = false;
|
||
}
|
||
}, DEBOUNCE_DELAYS.GEOCODING);
|
||
function handleInput() {
|
||
debouncedSearch(searchQuery.value);
|
||
}
|
||
function selectResult(result) {
|
||
emit("select-location", {
|
||
lat: result.lat,
|
||
lon: result.lon,
|
||
displayName: result.displayName
|
||
});
|
||
searchQuery.value = result.displayName;
|
||
showResults.value = false;
|
||
}
|
||
function selectFirstResult() {
|
||
if (results.value.length > 0) {
|
||
selectResult(results.value[0]);
|
||
}
|
||
}
|
||
function navigateResults(direction) {
|
||
if (!showResults.value || results.value.length === 0) {
|
||
return;
|
||
}
|
||
selectedIndex.value += direction;
|
||
if (selectedIndex.value < 0) {
|
||
selectedIndex.value = results.value.length - 1;
|
||
} else if (selectedIndex.value >= results.value.length) {
|
||
selectedIndex.value = 0;
|
||
}
|
||
}
|
||
function clearSearch() {
|
||
searchQuery.value = "";
|
||
results.value = [];
|
||
showResults.value = false;
|
||
error.value = null;
|
||
selectedIndex.value = -1;
|
||
}
|
||
function focus() {
|
||
if (searchInput.value) {
|
||
searchInput.value.focus();
|
||
}
|
||
}
|
||
function handleClickOutside(event) {
|
||
if (!event.target.closest(".geocode-search")) {
|
||
showResults.value = false;
|
||
}
|
||
}
|
||
Vue.watch(showResults, (newValue) => {
|
||
if (newValue) {
|
||
setTimeout(() => {
|
||
document.addEventListener("click", handleClickOutside);
|
||
}, 100);
|
||
} else {
|
||
document.removeEventListener("click", handleClickOutside);
|
||
}
|
||
});
|
||
return {
|
||
searchInput,
|
||
searchQuery,
|
||
results,
|
||
isLoading,
|
||
error,
|
||
showResults,
|
||
selectedIndex,
|
||
handleInput,
|
||
selectResult,
|
||
selectFirstResult,
|
||
navigateResults,
|
||
clearSearch,
|
||
focus
|
||
};
|
||
}
|
||
};
|
||
var _sfc_render$2 = function render() {
|
||
var _vm = this, _c = _vm._self._c;
|
||
return _c("div", { staticClass: "geocode-search" }, [_c("div", { staticClass: "search-input-wrapper" }, [_c("input", { directives: [{ name: "model", rawName: "v-model", value: _vm.searchQuery, expression: "searchQuery" }], ref: "searchInput", staticClass: "search-input", attrs: { "type": "text", "placeholder": "Rechercher une adresse..." }, domProps: { "value": _vm.searchQuery }, on: { "input": [function($event) {
|
||
if ($event.target.composing) return;
|
||
_vm.searchQuery = $event.target.value;
|
||
}, _vm.handleInput], "keydown": [function($event) {
|
||
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "escape", void 0, $event.key, void 0)) return null;
|
||
return _vm.clearSearch.apply(null, arguments);
|
||
}, function($event) {
|
||
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) return null;
|
||
$event.preventDefault();
|
||
return _vm.selectFirstResult.apply(null, arguments);
|
||
}, function($event) {
|
||
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "down", 40, $event.key, ["Down", "ArrowDown"])) return null;
|
||
$event.preventDefault();
|
||
return _vm.navigateResults(1);
|
||
}, function($event) {
|
||
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])) return null;
|
||
$event.preventDefault();
|
||
return _vm.navigateResults(-1);
|
||
}] } }), _vm.searchQuery ? _c("button", { staticClass: "clear-button", attrs: { "type": "button", "title": "Effacer" }, on: { "click": _vm.clearSearch } }, [_c("k-icon", { attrs: { "type": "cancel" } })], 1) : _vm._e(), _vm.isLoading ? _c("div", { staticClass: "search-spinner" }, [_c("div", { staticClass: "spinner-icon" })]) : _vm._e()]), _vm.showResults ? _c("div", { staticClass: "results-dropdown" }, [_vm.error ? _c("div", { staticClass: "error-message" }, [_c("k-icon", { attrs: { "type": "alert" } }), _c("span", [_vm._v(_vm._s(_vm.error))])], 1) : _vm.results.length === 0 && !_vm.isLoading ? _c("div", { staticClass: "no-results" }, [_vm._v(" Aucun résultat trouvé ")]) : _c("div", { staticClass: "results-list" }, _vm._l(_vm.results, function(result, index) {
|
||
return _c("div", { key: result.id, staticClass: "result-item", class: { active: index === _vm.selectedIndex }, on: { "click": function($event) {
|
||
return _vm.selectResult(result);
|
||
}, "mouseenter": function($event) {
|
||
_vm.selectedIndex = index;
|
||
} } }, [_c("div", { staticClass: "result-icon" }, [_c("k-icon", { attrs: { "type": "pin" } })], 1), _c("div", { staticClass: "result-content" }, [_c("div", { staticClass: "result-name" }, [_vm._v(_vm._s(result.displayName))]), _c("div", { staticClass: "result-coords" }, [_vm._v(" " + _vm._s(result.lat.toFixed(6)) + ", " + _vm._s(result.lon.toFixed(6)) + " ")])])]);
|
||
}), 0), _vm.results.length > 0 ? _c("div", { staticClass: "results-footer" }, [_c("small", [_vm._v("Powered by OpenStreetMap Nominatim")])]) : _vm._e()]) : _vm._e()]);
|
||
};
|
||
var _sfc_staticRenderFns$2 = [];
|
||
_sfc_render$2._withStripped = true;
|
||
var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
||
_sfc_main$2,
|
||
_sfc_render$2,
|
||
_sfc_staticRenderFns$2,
|
||
false,
|
||
null,
|
||
null
|
||
);
|
||
__component__$2.options.__file = "/Users/adrienpayet/Documents/code/en-cours/geoproject/public/site/plugins/map-editor/src/components/map/GeocodeSearch.vue";
|
||
const GeocodeSearch = __component__$2.exports;
|
||
const _sfc_main$1 = {
|
||
components: {
|
||
GeocodeSearch
|
||
},
|
||
props: {
|
||
markers: {
|
||
type: Array,
|
||
required: true
|
||
},
|
||
selectedMarkerId: {
|
||
type: String,
|
||
default: null
|
||
},
|
||
maxMarkers: {
|
||
type: Number,
|
||
default: 50
|
||
}
|
||
},
|
||
emits: [
|
||
"add-marker",
|
||
"select-marker",
|
||
"edit-marker",
|
||
"delete-marker",
|
||
"select-location"
|
||
],
|
||
setup(props) {
|
||
const canAddMarker = Vue.computed(
|
||
() => props.markers.length < props.maxMarkers
|
||
);
|
||
return {
|
||
canAddMarker
|
||
};
|
||
}
|
||
};
|
||
var _sfc_render$1 = function render() {
|
||
var _vm = this, _c = _vm._self._c;
|
||
return _c("aside", { staticClass: "k-map-markers-sidebar" }, [_c("header", { staticClass: "k-section-header" }, [_c("k-headline", [_vm._v(" Marqueurs "), _c("k-counter", [_vm._v(_vm._s(_vm.markers.length) + "/" + _vm._s(_vm.maxMarkers))])], 1), _c("k-button", { attrs: { "icon": "add", "size": "xs", "variant": "filled", "title": "Ajouter un marqueur", "disabled": !_vm.canAddMarker }, on: { "click": function($event) {
|
||
return _vm.$emit("add-marker");
|
||
} } }, [_vm._v(" Ajouter ")])], 1), _c("div", { staticClass: "k-map-markers-search" }, [_c("GeocodeSearch", { on: { "select-location": function($event) {
|
||
return _vm.$emit("select-location", $event);
|
||
} } })], 1), _c("div", { staticClass: "k-map-markers-list" }, [_vm._l(_vm.markers, function(marker, index) {
|
||
return _c("div", { key: marker.id, staticClass: "k-map-marker-item", class: { "is-selected": _vm.selectedMarkerId === marker.id }, on: { "click": function($event) {
|
||
return _vm.$emit("select-marker", marker.id);
|
||
} } }, [_c("span", { staticClass: "k-map-marker-icon" }, [_vm._v(" " + _vm._s(index + 1) + " ")]), _c("span", { staticClass: "k-map-marker-text" }, [_vm._v(" " + _vm._s(marker.title || `Marqueur ${index + 1}`) + " ")]), _c("span", { staticClass: "k-map-marker-options" }, [_c("k-button", { attrs: { "icon": "open", "size": "xs", "title": "Modifier le marqueur" }, on: { "click": function($event) {
|
||
$event.stopPropagation();
|
||
return _vm.$emit("edit-marker", marker.id);
|
||
} } }), _c("k-button", { attrs: { "icon": "trash", "size": "xs", "title": "Supprimer le marqueur" }, on: { "click": function($event) {
|
||
$event.stopPropagation();
|
||
return _vm.$emit("delete-marker", marker.id);
|
||
} } })], 1)]);
|
||
}), _vm.markers.length === 0 ? _c("div", { staticClass: "k-map-markers-empty" }, [_c("k-icon", { attrs: { "type": "map-pin" } }), _c("p", { staticClass: "k-map-markers-empty-text" }, [_vm._v("Aucun marqueur")]), _c("p", { staticClass: "k-map-markers-empty-info" }, [_vm._v(' Cliquez sur la carte ou sur "Ajouter" pour créer un marqueur ')])], 1) : _vm._e()], 2)]);
|
||
};
|
||
var _sfc_staticRenderFns$1 = [];
|
||
_sfc_render$1._withStripped = true;
|
||
var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
||
_sfc_main$1,
|
||
_sfc_render$1,
|
||
_sfc_staticRenderFns$1,
|
||
false,
|
||
null,
|
||
"fe272968"
|
||
);
|
||
__component__$1.options.__file = "/Users/adrienpayet/Documents/code/en-cours/geoproject/public/site/plugins/map-editor/src/components/map/MarkerList.vue";
|
||
const MarkerList = __component__$1.exports;
|
||
function useMarkersApi(pageId) {
|
||
const markers = Vue.ref([]);
|
||
const loading = Vue.ref(false);
|
||
const error = Vue.ref(null);
|
||
const getCsrfToken = () => {
|
||
if (window.panel && window.panel.csrf) {
|
||
return window.panel.csrf;
|
||
}
|
||
const meta = document.querySelector('meta[name="csrf"]');
|
||
if (meta && meta.content) {
|
||
return meta.content;
|
||
}
|
||
if (window.csrf) {
|
||
return window.csrf;
|
||
}
|
||
console.warn("CSRF token not found");
|
||
return "";
|
||
};
|
||
async function fetchMarkers() {
|
||
loading.value = true;
|
||
error.value = null;
|
||
try {
|
||
const response = await fetch(`/api/map-editor/pages/${pageId}/markers`, {
|
||
method: "GET",
|
||
headers: {
|
||
"Content-Type": "application/json"
|
||
}
|
||
});
|
||
const result = await response.json();
|
||
if (result.status === "error") {
|
||
throw new Error(result.message || "Failed to fetch markers");
|
||
}
|
||
markers.value = result.data.markers || [];
|
||
return markers.value;
|
||
} catch (err) {
|
||
error.value = err.message;
|
||
console.error("Error fetching markers:", err);
|
||
throw err;
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
async function createMarker(position) {
|
||
loading.value = true;
|
||
error.value = null;
|
||
try {
|
||
const response = await fetch(`/api/map-editor/pages/${pageId}/markers`, {
|
||
method: "POST",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
"X-CSRF": getCsrfToken()
|
||
},
|
||
body: JSON.stringify({ position })
|
||
});
|
||
const result = await response.json();
|
||
if (result.status === "error") {
|
||
throw new Error(result.message || "Failed to create marker");
|
||
}
|
||
const newMarker = result.data.marker;
|
||
markers.value.push(newMarker);
|
||
console.log(newMarker);
|
||
return newMarker;
|
||
} catch (err) {
|
||
error.value = err.message;
|
||
console.error("Error creating marker:", err);
|
||
throw err;
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
async function updateMarkerPosition(markerId, position) {
|
||
loading.value = true;
|
||
error.value = null;
|
||
try {
|
||
const response = await fetch(
|
||
`/api/map-editor/pages/${pageId}/markers/${markerId}`,
|
||
{
|
||
method: "PATCH",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
"X-CSRF": getCsrfToken()
|
||
},
|
||
body: JSON.stringify({ position })
|
||
}
|
||
);
|
||
const result = await response.json();
|
||
if (result.status === "error") {
|
||
throw new Error(result.message || "Failed to update marker position");
|
||
}
|
||
const index = markers.value.findIndex((m) => m.id === markerId);
|
||
if (index !== -1) {
|
||
markers.value[index] = result.data.marker;
|
||
}
|
||
return result.data.marker;
|
||
} catch (err) {
|
||
error.value = err.message;
|
||
console.error("Error updating marker position:", err);
|
||
throw err;
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
async function deleteMarker(markerId) {
|
||
loading.value = true;
|
||
error.value = null;
|
||
try {
|
||
const response = await fetch(
|
||
`/api/map-editor/pages/${pageId}/markers/${markerId}`,
|
||
{
|
||
method: "DELETE",
|
||
headers: {
|
||
"Content-Type": "application/json",
|
||
"X-CSRF": getCsrfToken()
|
||
}
|
||
}
|
||
);
|
||
const result = await response.json();
|
||
if (result.status === "error") {
|
||
throw new Error(result.message || "Failed to delete marker");
|
||
}
|
||
const index = markers.value.findIndex((m) => m.id === markerId);
|
||
if (index !== -1) {
|
||
markers.value.splice(index, 1);
|
||
}
|
||
return true;
|
||
} catch (err) {
|
||
error.value = err.message;
|
||
console.error("Error deleting marker:", err);
|
||
throw err;
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
return {
|
||
markers,
|
||
loading,
|
||
error,
|
||
fetchMarkers,
|
||
createMarker,
|
||
updateMarkerPosition,
|
||
deleteMarker
|
||
};
|
||
}
|
||
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
|
||
function isNothing(subject) {
|
||
return typeof subject === "undefined" || subject === null;
|
||
}
|
||
function isObject(subject) {
|
||
return typeof subject === "object" && subject !== null;
|
||
}
|
||
function toArray(sequence) {
|
||
if (Array.isArray(sequence)) return sequence;
|
||
else if (isNothing(sequence)) return [];
|
||
return [sequence];
|
||
}
|
||
function extend(target, source) {
|
||
var index, length, key, sourceKeys;
|
||
if (source) {
|
||
sourceKeys = Object.keys(source);
|
||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
||
key = sourceKeys[index];
|
||
target[key] = source[key];
|
||
}
|
||
}
|
||
return target;
|
||
}
|
||
function repeat(string, count) {
|
||
var result = "", cycle;
|
||
for (cycle = 0; cycle < count; cycle += 1) {
|
||
result += string;
|
||
}
|
||
return result;
|
||
}
|
||
function isNegativeZero(number) {
|
||
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
||
}
|
||
var isNothing_1 = isNothing;
|
||
var isObject_1 = isObject;
|
||
var toArray_1 = toArray;
|
||
var repeat_1 = repeat;
|
||
var isNegativeZero_1 = isNegativeZero;
|
||
var extend_1 = extend;
|
||
var common = {
|
||
isNothing: isNothing_1,
|
||
isObject: isObject_1,
|
||
toArray: toArray_1,
|
||
repeat: repeat_1,
|
||
isNegativeZero: isNegativeZero_1,
|
||
extend: extend_1
|
||
};
|
||
function formatError(exception2, compact) {
|
||
var where = "", message = exception2.reason || "(unknown reason)";
|
||
if (!exception2.mark) return message;
|
||
if (exception2.mark.name) {
|
||
where += 'in "' + exception2.mark.name + '" ';
|
||
}
|
||
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
||
if (!compact && exception2.mark.snippet) {
|
||
where += "\n\n" + exception2.mark.snippet;
|
||
}
|
||
return message + " " + where;
|
||
}
|
||
function YAMLException$1(reason, mark) {
|
||
Error.call(this);
|
||
this.name = "YAMLException";
|
||
this.reason = reason;
|
||
this.mark = mark;
|
||
this.message = formatError(this, false);
|
||
if (Error.captureStackTrace) {
|
||
Error.captureStackTrace(this, this.constructor);
|
||
} else {
|
||
this.stack = new Error().stack || "";
|
||
}
|
||
}
|
||
YAMLException$1.prototype = Object.create(Error.prototype);
|
||
YAMLException$1.prototype.constructor = YAMLException$1;
|
||
YAMLException$1.prototype.toString = function toString(compact) {
|
||
return this.name + ": " + formatError(this, compact);
|
||
};
|
||
var exception = YAMLException$1;
|
||
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
||
var head = "";
|
||
var tail = "";
|
||
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
||
if (position - lineStart > maxHalfLength) {
|
||
head = " ... ";
|
||
lineStart = position - maxHalfLength + head.length;
|
||
}
|
||
if (lineEnd - position > maxHalfLength) {
|
||
tail = " ...";
|
||
lineEnd = position + maxHalfLength - tail.length;
|
||
}
|
||
return {
|
||
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
||
pos: position - lineStart + head.length
|
||
// relative position
|
||
};
|
||
}
|
||
function padStart(string, max) {
|
||
return common.repeat(" ", max - string.length) + string;
|
||
}
|
||
function makeSnippet(mark, options) {
|
||
options = Object.create(options || null);
|
||
if (!mark.buffer) return null;
|
||
if (!options.maxLength) options.maxLength = 79;
|
||
if (typeof options.indent !== "number") options.indent = 1;
|
||
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
||
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
||
var re = /\r?\n|\r|\0/g;
|
||
var lineStarts = [0];
|
||
var lineEnds = [];
|
||
var match;
|
||
var foundLineNo = -1;
|
||
while (match = re.exec(mark.buffer)) {
|
||
lineEnds.push(match.index);
|
||
lineStarts.push(match.index + match[0].length);
|
||
if (mark.position <= match.index && foundLineNo < 0) {
|
||
foundLineNo = lineStarts.length - 2;
|
||
}
|
||
}
|
||
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
||
var result = "", i2, line;
|
||
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
||
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
||
for (i2 = 1; i2 <= options.linesBefore; i2++) {
|
||
if (foundLineNo - i2 < 0) break;
|
||
line = getLine(
|
||
mark.buffer,
|
||
lineStarts[foundLineNo - i2],
|
||
lineEnds[foundLineNo - i2],
|
||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]),
|
||
maxLineLength
|
||
);
|
||
result = common.repeat(" ", options.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
||
}
|
||
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
||
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
||
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
||
for (i2 = 1; i2 <= options.linesAfter; i2++) {
|
||
if (foundLineNo + i2 >= lineEnds.length) break;
|
||
line = getLine(
|
||
mark.buffer,
|
||
lineStarts[foundLineNo + i2],
|
||
lineEnds[foundLineNo + i2],
|
||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i2]),
|
||
maxLineLength
|
||
);
|
||
result += common.repeat(" ", options.indent) + padStart((mark.line + i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
||
}
|
||
return result.replace(/\n$/, "");
|
||
}
|
||
var snippet = makeSnippet;
|
||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||
"kind",
|
||
"multi",
|
||
"resolve",
|
||
"construct",
|
||
"instanceOf",
|
||
"predicate",
|
||
"represent",
|
||
"representName",
|
||
"defaultStyle",
|
||
"styleAliases"
|
||
];
|
||
var YAML_NODE_KINDS = [
|
||
"scalar",
|
||
"sequence",
|
||
"mapping"
|
||
];
|
||
function compileStyleAliases(map2) {
|
||
var result = {};
|
||
if (map2 !== null) {
|
||
Object.keys(map2).forEach(function(style) {
|
||
map2[style].forEach(function(alias) {
|
||
result[String(alias)] = style;
|
||
});
|
||
});
|
||
}
|
||
return result;
|
||
}
|
||
function Type$1(tag, options) {
|
||
options = options || {};
|
||
Object.keys(options).forEach(function(name) {
|
||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||
}
|
||
});
|
||
this.options = options;
|
||
this.tag = tag;
|
||
this.kind = options["kind"] || null;
|
||
this.resolve = options["resolve"] || function() {
|
||
return true;
|
||
};
|
||
this.construct = options["construct"] || function(data) {
|
||
return data;
|
||
};
|
||
this.instanceOf = options["instanceOf"] || null;
|
||
this.predicate = options["predicate"] || null;
|
||
this.represent = options["represent"] || null;
|
||
this.representName = options["representName"] || null;
|
||
this.defaultStyle = options["defaultStyle"] || null;
|
||
this.multi = options["multi"] || false;
|
||
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||
}
|
||
}
|
||
var type = Type$1;
|
||
function compileList(schema2, name) {
|
||
var result = [];
|
||
schema2[name].forEach(function(currentType) {
|
||
var newIndex = result.length;
|
||
result.forEach(function(previousType, previousIndex) {
|
||
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
||
newIndex = previousIndex;
|
||
}
|
||
});
|
||
result[newIndex] = currentType;
|
||
});
|
||
return result;
|
||
}
|
||
function compileMap() {
|
||
var result = {
|
||
scalar: {},
|
||
sequence: {},
|
||
mapping: {},
|
||
fallback: {},
|
||
multi: {
|
||
scalar: [],
|
||
sequence: [],
|
||
mapping: [],
|
||
fallback: []
|
||
}
|
||
}, index, length;
|
||
function collectType(type2) {
|
||
if (type2.multi) {
|
||
result.multi[type2.kind].push(type2);
|
||
result.multi["fallback"].push(type2);
|
||
} else {
|
||
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
||
}
|
||
}
|
||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||
arguments[index].forEach(collectType);
|
||
}
|
||
return result;
|
||
}
|
||
function Schema$1(definition) {
|
||
return this.extend(definition);
|
||
}
|
||
Schema$1.prototype.extend = function extend2(definition) {
|
||
var implicit = [];
|
||
var explicit = [];
|
||
if (definition instanceof type) {
|
||
explicit.push(definition);
|
||
} else if (Array.isArray(definition)) {
|
||
explicit = explicit.concat(definition);
|
||
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
||
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
||
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
||
} else {
|
||
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
||
}
|
||
implicit.forEach(function(type$1) {
|
||
if (!(type$1 instanceof type)) {
|
||
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
||
}
|
||
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
||
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
||
}
|
||
if (type$1.multi) {
|
||
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
||
}
|
||
});
|
||
explicit.forEach(function(type$1) {
|
||
if (!(type$1 instanceof type)) {
|
||
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
||
}
|
||
});
|
||
var result = Object.create(Schema$1.prototype);
|
||
result.implicit = (this.implicit || []).concat(implicit);
|
||
result.explicit = (this.explicit || []).concat(explicit);
|
||
result.compiledImplicit = compileList(result, "implicit");
|
||
result.compiledExplicit = compileList(result, "explicit");
|
||
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
||
return result;
|
||
};
|
||
var schema = Schema$1;
|
||
var str = new type("tag:yaml.org,2002:str", {
|
||
kind: "scalar",
|
||
construct: function(data) {
|
||
return data !== null ? data : "";
|
||
}
|
||
});
|
||
var seq = new type("tag:yaml.org,2002:seq", {
|
||
kind: "sequence",
|
||
construct: function(data) {
|
||
return data !== null ? data : [];
|
||
}
|
||
});
|
||
var map = new type("tag:yaml.org,2002:map", {
|
||
kind: "mapping",
|
||
construct: function(data) {
|
||
return data !== null ? data : {};
|
||
}
|
||
});
|
||
var failsafe = new schema({
|
||
explicit: [
|
||
str,
|
||
seq,
|
||
map
|
||
]
|
||
});
|
||
function resolveYamlNull(data) {
|
||
if (data === null) return true;
|
||
var max = data.length;
|
||
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
||
}
|
||
function constructYamlNull() {
|
||
return null;
|
||
}
|
||
function isNull(object) {
|
||
return object === null;
|
||
}
|
||
var _null = new type("tag:yaml.org,2002:null", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlNull,
|
||
construct: constructYamlNull,
|
||
predicate: isNull,
|
||
represent: {
|
||
canonical: function() {
|
||
return "~";
|
||
},
|
||
lowercase: function() {
|
||
return "null";
|
||
},
|
||
uppercase: function() {
|
||
return "NULL";
|
||
},
|
||
camelcase: function() {
|
||
return "Null";
|
||
},
|
||
empty: function() {
|
||
return "";
|
||
}
|
||
},
|
||
defaultStyle: "lowercase"
|
||
});
|
||
function resolveYamlBoolean(data) {
|
||
if (data === null) return false;
|
||
var max = data.length;
|
||
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
||
}
|
||
function constructYamlBoolean(data) {
|
||
return data === "true" || data === "True" || data === "TRUE";
|
||
}
|
||
function isBoolean(object) {
|
||
return Object.prototype.toString.call(object) === "[object Boolean]";
|
||
}
|
||
var bool = new type("tag:yaml.org,2002:bool", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlBoolean,
|
||
construct: constructYamlBoolean,
|
||
predicate: isBoolean,
|
||
represent: {
|
||
lowercase: function(object) {
|
||
return object ? "true" : "false";
|
||
},
|
||
uppercase: function(object) {
|
||
return object ? "TRUE" : "FALSE";
|
||
},
|
||
camelcase: function(object) {
|
||
return object ? "True" : "False";
|
||
}
|
||
},
|
||
defaultStyle: "lowercase"
|
||
});
|
||
function isHexCode(c) {
|
||
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
||
}
|
||
function isOctCode(c) {
|
||
return 48 <= c && c <= 55;
|
||
}
|
||
function isDecCode(c) {
|
||
return 48 <= c && c <= 57;
|
||
}
|
||
function resolveYamlInteger(data) {
|
||
if (data === null) return false;
|
||
var max = data.length, index = 0, hasDigits = false, ch;
|
||
if (!max) return false;
|
||
ch = data[index];
|
||
if (ch === "-" || ch === "+") {
|
||
ch = data[++index];
|
||
}
|
||
if (ch === "0") {
|
||
if (index + 1 === max) return true;
|
||
ch = data[++index];
|
||
if (ch === "b") {
|
||
index++;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (ch !== "0" && ch !== "1") return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
if (ch === "x") {
|
||
index++;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
if (ch === "o") {
|
||
index++;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== "_";
|
||
}
|
||
}
|
||
if (ch === "_") return false;
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === "_") continue;
|
||
if (!isDecCode(data.charCodeAt(index))) {
|
||
return false;
|
||
}
|
||
hasDigits = true;
|
||
}
|
||
if (!hasDigits || ch === "_") return false;
|
||
return true;
|
||
}
|
||
function constructYamlInteger(data) {
|
||
var value = data, sign = 1, ch;
|
||
if (value.indexOf("_") !== -1) {
|
||
value = value.replace(/_/g, "");
|
||
}
|
||
ch = value[0];
|
||
if (ch === "-" || ch === "+") {
|
||
if (ch === "-") sign = -1;
|
||
value = value.slice(1);
|
||
ch = value[0];
|
||
}
|
||
if (value === "0") return 0;
|
||
if (ch === "0") {
|
||
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
||
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
||
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
||
}
|
||
return sign * parseInt(value, 10);
|
||
}
|
||
function isInteger(object) {
|
||
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
||
}
|
||
var int = new type("tag:yaml.org,2002:int", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlInteger,
|
||
construct: constructYamlInteger,
|
||
predicate: isInteger,
|
||
represent: {
|
||
binary: function(obj) {
|
||
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
||
},
|
||
octal: function(obj) {
|
||
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
||
},
|
||
decimal: function(obj) {
|
||
return obj.toString(10);
|
||
},
|
||
/* eslint-disable max-len */
|
||
hexadecimal: function(obj) {
|
||
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
||
}
|
||
},
|
||
defaultStyle: "decimal",
|
||
styleAliases: {
|
||
binary: [2, "bin"],
|
||
octal: [8, "oct"],
|
||
decimal: [10, "dec"],
|
||
hexadecimal: [16, "hex"]
|
||
}
|
||
});
|
||
var YAML_FLOAT_PATTERN = new RegExp(
|
||
// 2.5e4, 2.5 and integers
|
||
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
||
);
|
||
function resolveYamlFloat(data) {
|
||
if (data === null) return false;
|
||
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
||
// Probably should update regexp & check speed
|
||
data[data.length - 1] === "_") {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlFloat(data) {
|
||
var value, sign;
|
||
value = data.replace(/_/g, "").toLowerCase();
|
||
sign = value[0] === "-" ? -1 : 1;
|
||
if ("+-".indexOf(value[0]) >= 0) {
|
||
value = value.slice(1);
|
||
}
|
||
if (value === ".inf") {
|
||
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
||
} else if (value === ".nan") {
|
||
return NaN;
|
||
}
|
||
return sign * parseFloat(value, 10);
|
||
}
|
||
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
||
function representYamlFloat(object, style) {
|
||
var res;
|
||
if (isNaN(object)) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return ".nan";
|
||
case "uppercase":
|
||
return ".NAN";
|
||
case "camelcase":
|
||
return ".NaN";
|
||
}
|
||
} else if (Number.POSITIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return ".inf";
|
||
case "uppercase":
|
||
return ".INF";
|
||
case "camelcase":
|
||
return ".Inf";
|
||
}
|
||
} else if (Number.NEGATIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case "lowercase":
|
||
return "-.inf";
|
||
case "uppercase":
|
||
return "-.INF";
|
||
case "camelcase":
|
||
return "-.Inf";
|
||
}
|
||
} else if (common.isNegativeZero(object)) {
|
||
return "-0.0";
|
||
}
|
||
res = object.toString(10);
|
||
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
||
}
|
||
function isFloat(object) {
|
||
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
||
}
|
||
var float = new type("tag:yaml.org,2002:float", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlFloat,
|
||
construct: constructYamlFloat,
|
||
predicate: isFloat,
|
||
represent: representYamlFloat,
|
||
defaultStyle: "lowercase"
|
||
});
|
||
var json = failsafe.extend({
|
||
implicit: [
|
||
_null,
|
||
bool,
|
||
int,
|
||
float
|
||
]
|
||
});
|
||
var core = json;
|
||
var YAML_DATE_REGEXP = new RegExp(
|
||
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
||
);
|
||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
||
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
||
);
|
||
function resolveYamlTimestamp(data) {
|
||
if (data === null) return false;
|
||
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
||
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
||
return false;
|
||
}
|
||
function constructYamlTimestamp(data) {
|
||
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
||
match = YAML_DATE_REGEXP.exec(data);
|
||
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
||
if (match === null) throw new Error("Date resolve error");
|
||
year = +match[1];
|
||
month = +match[2] - 1;
|
||
day = +match[3];
|
||
if (!match[4]) {
|
||
return new Date(Date.UTC(year, month, day));
|
||
}
|
||
hour = +match[4];
|
||
minute = +match[5];
|
||
second = +match[6];
|
||
if (match[7]) {
|
||
fraction = match[7].slice(0, 3);
|
||
while (fraction.length < 3) {
|
||
fraction += "0";
|
||
}
|
||
fraction = +fraction;
|
||
}
|
||
if (match[9]) {
|
||
tz_hour = +match[10];
|
||
tz_minute = +(match[11] || 0);
|
||
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
||
if (match[9] === "-") delta = -delta;
|
||
}
|
||
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
||
if (delta) date.setTime(date.getTime() - delta);
|
||
return date;
|
||
}
|
||
function representYamlTimestamp(object) {
|
||
return object.toISOString();
|
||
}
|
||
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlTimestamp,
|
||
construct: constructYamlTimestamp,
|
||
instanceOf: Date,
|
||
represent: representYamlTimestamp
|
||
});
|
||
function resolveYamlMerge(data) {
|
||
return data === "<<" || data === null;
|
||
}
|
||
var merge = new type("tag:yaml.org,2002:merge", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlMerge
|
||
});
|
||
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
||
function resolveYamlBinary(data) {
|
||
if (data === null) return false;
|
||
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
||
for (idx = 0; idx < max; idx++) {
|
||
code = map2.indexOf(data.charAt(idx));
|
||
if (code > 64) continue;
|
||
if (code < 0) return false;
|
||
bitlen += 6;
|
||
}
|
||
return bitlen % 8 === 0;
|
||
}
|
||
function constructYamlBinary(data) {
|
||
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
||
for (idx = 0; idx < max; idx++) {
|
||
if (idx % 4 === 0 && idx) {
|
||
result.push(bits >> 16 & 255);
|
||
result.push(bits >> 8 & 255);
|
||
result.push(bits & 255);
|
||
}
|
||
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
||
}
|
||
tailbits = max % 4 * 6;
|
||
if (tailbits === 0) {
|
||
result.push(bits >> 16 & 255);
|
||
result.push(bits >> 8 & 255);
|
||
result.push(bits & 255);
|
||
} else if (tailbits === 18) {
|
||
result.push(bits >> 10 & 255);
|
||
result.push(bits >> 2 & 255);
|
||
} else if (tailbits === 12) {
|
||
result.push(bits >> 4 & 255);
|
||
}
|
||
return new Uint8Array(result);
|
||
}
|
||
function representYamlBinary(object) {
|
||
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
||
for (idx = 0; idx < max; idx++) {
|
||
if (idx % 3 === 0 && idx) {
|
||
result += map2[bits >> 18 & 63];
|
||
result += map2[bits >> 12 & 63];
|
||
result += map2[bits >> 6 & 63];
|
||
result += map2[bits & 63];
|
||
}
|
||
bits = (bits << 8) + object[idx];
|
||
}
|
||
tail = max % 3;
|
||
if (tail === 0) {
|
||
result += map2[bits >> 18 & 63];
|
||
result += map2[bits >> 12 & 63];
|
||
result += map2[bits >> 6 & 63];
|
||
result += map2[bits & 63];
|
||
} else if (tail === 2) {
|
||
result += map2[bits >> 10 & 63];
|
||
result += map2[bits >> 4 & 63];
|
||
result += map2[bits << 2 & 63];
|
||
result += map2[64];
|
||
} else if (tail === 1) {
|
||
result += map2[bits >> 2 & 63];
|
||
result += map2[bits << 4 & 63];
|
||
result += map2[64];
|
||
result += map2[64];
|
||
}
|
||
return result;
|
||
}
|
||
function isBinary(obj) {
|
||
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
||
}
|
||
var binary = new type("tag:yaml.org,2002:binary", {
|
||
kind: "scalar",
|
||
resolve: resolveYamlBinary,
|
||
construct: constructYamlBinary,
|
||
predicate: isBinary,
|
||
represent: representYamlBinary
|
||
});
|
||
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
||
var _toString$2 = Object.prototype.toString;
|
||
function resolveYamlOmap(data) {
|
||
if (data === null) return true;
|
||
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
pairHasKey = false;
|
||
if (_toString$2.call(pair) !== "[object Object]") return false;
|
||
for (pairKey in pair) {
|
||
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
||
if (!pairHasKey) pairHasKey = true;
|
||
else return false;
|
||
}
|
||
}
|
||
if (!pairHasKey) return false;
|
||
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
||
else return false;
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlOmap(data) {
|
||
return data !== null ? data : [];
|
||
}
|
||
var omap = new type("tag:yaml.org,2002:omap", {
|
||
kind: "sequence",
|
||
resolve: resolveYamlOmap,
|
||
construct: constructYamlOmap
|
||
});
|
||
var _toString$1 = Object.prototype.toString;
|
||
function resolveYamlPairs(data) {
|
||
if (data === null) return true;
|
||
var index, length, pair, keys, result, object = data;
|
||
result = new Array(object.length);
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
if (_toString$1.call(pair) !== "[object Object]") return false;
|
||
keys = Object.keys(pair);
|
||
if (keys.length !== 1) return false;
|
||
result[index] = [keys[0], pair[keys[0]]];
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlPairs(data) {
|
||
if (data === null) return [];
|
||
var index, length, pair, keys, result, object = data;
|
||
result = new Array(object.length);
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
keys = Object.keys(pair);
|
||
result[index] = [keys[0], pair[keys[0]]];
|
||
}
|
||
return result;
|
||
}
|
||
var pairs = new type("tag:yaml.org,2002:pairs", {
|
||
kind: "sequence",
|
||
resolve: resolveYamlPairs,
|
||
construct: constructYamlPairs
|
||
});
|
||
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
||
function resolveYamlSet(data) {
|
||
if (data === null) return true;
|
||
var key, object = data;
|
||
for (key in object) {
|
||
if (_hasOwnProperty$2.call(object, key)) {
|
||
if (object[key] !== null) return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
function constructYamlSet(data) {
|
||
return data !== null ? data : {};
|
||
}
|
||
var set = new type("tag:yaml.org,2002:set", {
|
||
kind: "mapping",
|
||
resolve: resolveYamlSet,
|
||
construct: constructYamlSet
|
||
});
|
||
var _default = core.extend({
|
||
implicit: [
|
||
timestamp,
|
||
merge
|
||
],
|
||
explicit: [
|
||
binary,
|
||
omap,
|
||
pairs,
|
||
set
|
||
]
|
||
});
|
||
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
||
var CONTEXT_FLOW_IN = 1;
|
||
var CONTEXT_FLOW_OUT = 2;
|
||
var CONTEXT_BLOCK_IN = 3;
|
||
var CONTEXT_BLOCK_OUT = 4;
|
||
var CHOMPING_CLIP = 1;
|
||
var CHOMPING_STRIP = 2;
|
||
var CHOMPING_KEEP = 3;
|
||
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
||
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
||
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
||
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
||
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
||
function _class(obj) {
|
||
return Object.prototype.toString.call(obj);
|
||
}
|
||
function is_EOL(c) {
|
||
return c === 10 || c === 13;
|
||
}
|
||
function is_WHITE_SPACE(c) {
|
||
return c === 9 || c === 32;
|
||
}
|
||
function is_WS_OR_EOL(c) {
|
||
return c === 9 || c === 32 || c === 10 || c === 13;
|
||
}
|
||
function is_FLOW_INDICATOR(c) {
|
||
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
||
}
|
||
function fromHexCode(c) {
|
||
var lc;
|
||
if (48 <= c && c <= 57) {
|
||
return c - 48;
|
||
}
|
||
lc = c | 32;
|
||
if (97 <= lc && lc <= 102) {
|
||
return lc - 97 + 10;
|
||
}
|
||
return -1;
|
||
}
|
||
function escapedHexLen(c) {
|
||
if (c === 120) {
|
||
return 2;
|
||
}
|
||
if (c === 117) {
|
||
return 4;
|
||
}
|
||
if (c === 85) {
|
||
return 8;
|
||
}
|
||
return 0;
|
||
}
|
||
function fromDecimalCode(c) {
|
||
if (48 <= c && c <= 57) {
|
||
return c - 48;
|
||
}
|
||
return -1;
|
||
}
|
||
function simpleEscapeSequence(c) {
|
||
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "
" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
||
}
|
||
function charFromCodepoint(c) {
|
||
if (c <= 65535) {
|
||
return String.fromCharCode(c);
|
||
}
|
||
return String.fromCharCode(
|
||
(c - 65536 >> 10) + 55296,
|
||
(c - 65536 & 1023) + 56320
|
||
);
|
||
}
|
||
function setProperty(object, key, value) {
|
||
if (key === "__proto__") {
|
||
Object.defineProperty(object, key, {
|
||
configurable: true,
|
||
enumerable: true,
|
||
writable: true,
|
||
value
|
||
});
|
||
} else {
|
||
object[key] = value;
|
||
}
|
||
}
|
||
var simpleEscapeCheck = new Array(256);
|
||
var simpleEscapeMap = new Array(256);
|
||
for (var i = 0; i < 256; i++) {
|
||
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
||
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
||
}
|
||
function State$1(input, options) {
|
||
this.input = input;
|
||
this.filename = options["filename"] || null;
|
||
this.schema = options["schema"] || _default;
|
||
this.onWarning = options["onWarning"] || null;
|
||
this.legacy = options["legacy"] || false;
|
||
this.json = options["json"] || false;
|
||
this.listener = options["listener"] || null;
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.typeMap = this.schema.compiledTypeMap;
|
||
this.length = input.length;
|
||
this.position = 0;
|
||
this.line = 0;
|
||
this.lineStart = 0;
|
||
this.lineIndent = 0;
|
||
this.firstTabInLine = -1;
|
||
this.documents = [];
|
||
}
|
||
function generateError(state, message) {
|
||
var mark = {
|
||
name: state.filename,
|
||
buffer: state.input.slice(0, -1),
|
||
// omit trailing \0
|
||
position: state.position,
|
||
line: state.line,
|
||
column: state.position - state.lineStart
|
||
};
|
||
mark.snippet = snippet(mark);
|
||
return new exception(message, mark);
|
||
}
|
||
function throwError(state, message) {
|
||
throw generateError(state, message);
|
||
}
|
||
function throwWarning(state, message) {
|
||
if (state.onWarning) {
|
||
state.onWarning.call(null, generateError(state, message));
|
||
}
|
||
}
|
||
var directiveHandlers = {
|
||
YAML: function handleYamlDirective(state, name, args) {
|
||
var match, major, minor;
|
||
if (state.version !== null) {
|
||
throwError(state, "duplication of %YAML directive");
|
||
}
|
||
if (args.length !== 1) {
|
||
throwError(state, "YAML directive accepts exactly one argument");
|
||
}
|
||
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
||
if (match === null) {
|
||
throwError(state, "ill-formed argument of the YAML directive");
|
||
}
|
||
major = parseInt(match[1], 10);
|
||
minor = parseInt(match[2], 10);
|
||
if (major !== 1) {
|
||
throwError(state, "unacceptable YAML version of the document");
|
||
}
|
||
state.version = args[0];
|
||
state.checkLineBreaks = minor < 2;
|
||
if (minor !== 1 && minor !== 2) {
|
||
throwWarning(state, "unsupported YAML version of the document");
|
||
}
|
||
},
|
||
TAG: function handleTagDirective(state, name, args) {
|
||
var handle, prefix;
|
||
if (args.length !== 2) {
|
||
throwError(state, "TAG directive accepts exactly two arguments");
|
||
}
|
||
handle = args[0];
|
||
prefix = args[1];
|
||
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
||
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
||
}
|
||
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
||
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
||
}
|
||
if (!PATTERN_TAG_URI.test(prefix)) {
|
||
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
||
}
|
||
try {
|
||
prefix = decodeURIComponent(prefix);
|
||
} catch (err) {
|
||
throwError(state, "tag prefix is malformed: " + prefix);
|
||
}
|
||
state.tagMap[handle] = prefix;
|
||
}
|
||
};
|
||
function captureSegment(state, start, end, checkJson) {
|
||
var _position, _length, _character, _result;
|
||
if (start < end) {
|
||
_result = state.input.slice(start, end);
|
||
if (checkJson) {
|
||
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
||
_character = _result.charCodeAt(_position);
|
||
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
||
throwError(state, "expected valid JSON character");
|
||
}
|
||
}
|
||
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
||
throwError(state, "the stream contains non-printable characters");
|
||
}
|
||
state.result += _result;
|
||
}
|
||
}
|
||
function mergeMappings(state, destination, source, overridableKeys) {
|
||
var sourceKeys, key, index, quantity;
|
||
if (!common.isObject(source)) {
|
||
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
||
}
|
||
sourceKeys = Object.keys(source);
|
||
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
||
key = sourceKeys[index];
|
||
if (!_hasOwnProperty$1.call(destination, key)) {
|
||
setProperty(destination, key, source[key]);
|
||
overridableKeys[key] = true;
|
||
}
|
||
}
|
||
}
|
||
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
||
var index, quantity;
|
||
if (Array.isArray(keyNode)) {
|
||
keyNode = Array.prototype.slice.call(keyNode);
|
||
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
||
if (Array.isArray(keyNode[index])) {
|
||
throwError(state, "nested arrays are not supported inside keys");
|
||
}
|
||
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
||
keyNode[index] = "[object Object]";
|
||
}
|
||
}
|
||
}
|
||
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
||
keyNode = "[object Object]";
|
||
}
|
||
keyNode = String(keyNode);
|
||
if (_result === null) {
|
||
_result = {};
|
||
}
|
||
if (keyTag === "tag:yaml.org,2002:merge") {
|
||
if (Array.isArray(valueNode)) {
|
||
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
||
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
||
}
|
||
} else {
|
||
mergeMappings(state, _result, valueNode, overridableKeys);
|
||
}
|
||
} else {
|
||
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
||
state.line = startLine || state.line;
|
||
state.lineStart = startLineStart || state.lineStart;
|
||
state.position = startPos || state.position;
|
||
throwError(state, "duplicated mapping key");
|
||
}
|
||
setProperty(_result, keyNode, valueNode);
|
||
delete overridableKeys[keyNode];
|
||
}
|
||
return _result;
|
||
}
|
||
function readLineBreak(state) {
|
||
var ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 10) {
|
||
state.position++;
|
||
} else if (ch === 13) {
|
||
state.position++;
|
||
if (state.input.charCodeAt(state.position) === 10) {
|
||
state.position++;
|
||
}
|
||
} else {
|
||
throwError(state, "a line break is expected");
|
||
}
|
||
state.line += 1;
|
||
state.lineStart = state.position;
|
||
state.firstTabInLine = -1;
|
||
}
|
||
function skipSeparationSpace(state, allowComments, checkIndent) {
|
||
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
if (ch === 9 && state.firstTabInLine === -1) {
|
||
state.firstTabInLine = state.position;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (allowComments && ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
||
}
|
||
if (is_EOL(ch)) {
|
||
readLineBreak(state);
|
||
ch = state.input.charCodeAt(state.position);
|
||
lineBreaks++;
|
||
state.lineIndent = 0;
|
||
while (ch === 32) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
||
throwWarning(state, "deficient indentation");
|
||
}
|
||
return lineBreaks;
|
||
}
|
||
function testDocumentSeparator(state) {
|
||
var _position = state.position, ch;
|
||
ch = state.input.charCodeAt(_position);
|
||
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
||
_position += 3;
|
||
ch = state.input.charCodeAt(_position);
|
||
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function writeFoldedLines(state, count) {
|
||
if (count === 1) {
|
||
state.result += " ";
|
||
} else if (count > 1) {
|
||
state.result += common.repeat("\n", count - 1);
|
||
}
|
||
}
|
||
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
||
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
||
return false;
|
||
}
|
||
if (ch === 63 || ch === 45) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
return false;
|
||
}
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
while (ch !== 0) {
|
||
if (ch === 58) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
break;
|
||
}
|
||
} else if (ch === 35) {
|
||
preceding = state.input.charCodeAt(state.position - 1);
|
||
if (is_WS_OR_EOL(preceding)) {
|
||
break;
|
||
}
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
||
break;
|
||
} else if (is_EOL(ch)) {
|
||
_line = state.line;
|
||
_lineStart = state.lineStart;
|
||
_lineIndent = state.lineIndent;
|
||
skipSeparationSpace(state, false, -1);
|
||
if (state.lineIndent >= nodeIndent) {
|
||
hasPendingContent = true;
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
} else {
|
||
state.position = captureEnd;
|
||
state.line = _line;
|
||
state.lineStart = _lineStart;
|
||
state.lineIndent = _lineIndent;
|
||
break;
|
||
}
|
||
}
|
||
if (hasPendingContent) {
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
writeFoldedLines(state, state.line - _line);
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
}
|
||
if (!is_WHITE_SPACE(ch)) {
|
||
captureEnd = state.position + 1;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
if (state.result) {
|
||
return true;
|
||
}
|
||
state.kind = _kind;
|
||
state.result = _result;
|
||
return false;
|
||
}
|
||
function readSingleQuotedScalar(state, nodeIndent) {
|
||
var ch, captureStart, captureEnd;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 39) {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 39) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 39) {
|
||
captureStart = state.position;
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
} else {
|
||
return true;
|
||
}
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, "unexpected end of the document within a single quoted scalar");
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
||
}
|
||
function readDoubleQuotedScalar(state, nodeIndent) {
|
||
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 34) {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 34) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
state.position++;
|
||
return true;
|
||
} else if (ch === 92) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (is_EOL(ch)) {
|
||
skipSeparationSpace(state, false, nodeIndent);
|
||
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
||
state.result += simpleEscapeMap[ch];
|
||
state.position++;
|
||
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
||
hexLength = tmp;
|
||
hexResult = 0;
|
||
for (; hexLength > 0; hexLength--) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if ((tmp = fromHexCode(ch)) >= 0) {
|
||
hexResult = (hexResult << 4) + tmp;
|
||
} else {
|
||
throwError(state, "expected hexadecimal character");
|
||
}
|
||
}
|
||
state.result += charFromCodepoint(hexResult);
|
||
state.position++;
|
||
} else {
|
||
throwError(state, "unknown escape sequence");
|
||
}
|
||
captureStart = captureEnd = state.position;
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, "unexpected end of the document within a double quoted scalar");
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
||
}
|
||
function readFlowCollection(state, nodeIndent) {
|
||
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 91) {
|
||
terminator = 93;
|
||
isMapping = false;
|
||
_result = [];
|
||
} else if (ch === 123) {
|
||
terminator = 125;
|
||
isMapping = true;
|
||
_result = {};
|
||
} else {
|
||
return false;
|
||
}
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
while (ch !== 0) {
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === terminator) {
|
||
state.position++;
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = isMapping ? "mapping" : "sequence";
|
||
state.result = _result;
|
||
return true;
|
||
} else if (!readNext) {
|
||
throwError(state, "missed comma between flow collection entries");
|
||
} else if (ch === 44) {
|
||
throwError(state, "expected the node content, but found ','");
|
||
}
|
||
keyTag = keyNode = valueNode = null;
|
||
isPair = isExplicitPair = false;
|
||
if (ch === 63) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (is_WS_OR_EOL(following)) {
|
||
isPair = isExplicitPair = true;
|
||
state.position++;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
}
|
||
}
|
||
_line = state.line;
|
||
_lineStart = state.lineStart;
|
||
_pos = state.position;
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
||
isPair = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
valueNode = state.result;
|
||
}
|
||
if (isMapping) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
||
} else if (isPair) {
|
||
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
||
} else {
|
||
_result.push(keyNode);
|
||
}
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 44) {
|
||
readNext = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
readNext = false;
|
||
}
|
||
}
|
||
throwError(state, "unexpected end of the stream within a flow collection");
|
||
}
|
||
function readBlockScalar(state, nodeIndent) {
|
||
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch === 124) {
|
||
folding = false;
|
||
} else if (ch === 62) {
|
||
folding = true;
|
||
} else {
|
||
return false;
|
||
}
|
||
state.kind = "scalar";
|
||
state.result = "";
|
||
while (ch !== 0) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 43 || ch === 45) {
|
||
if (CHOMPING_CLIP === chomping) {
|
||
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
||
} else {
|
||
throwError(state, "repeat of a chomping mode identifier");
|
||
}
|
||
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
||
if (tmp === 0) {
|
||
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
||
} else if (!detectedIndent) {
|
||
textIndent = nodeIndent + tmp - 1;
|
||
detectedIndent = true;
|
||
} else {
|
||
throwError(state, "repeat of an indentation width identifier");
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
if (is_WHITE_SPACE(ch)) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (is_WHITE_SPACE(ch));
|
||
if (ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (!is_EOL(ch) && ch !== 0);
|
||
}
|
||
}
|
||
while (ch !== 0) {
|
||
readLineBreak(state);
|
||
state.lineIndent = 0;
|
||
ch = state.input.charCodeAt(state.position);
|
||
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (!detectedIndent && state.lineIndent > textIndent) {
|
||
textIndent = state.lineIndent;
|
||
}
|
||
if (is_EOL(ch)) {
|
||
emptyLines++;
|
||
continue;
|
||
}
|
||
if (state.lineIndent < textIndent) {
|
||
if (chomping === CHOMPING_KEEP) {
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
} else if (chomping === CHOMPING_CLIP) {
|
||
if (didReadContent) {
|
||
state.result += "\n";
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
if (folding) {
|
||
if (is_WHITE_SPACE(ch)) {
|
||
atMoreIndented = true;
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
} else if (atMoreIndented) {
|
||
atMoreIndented = false;
|
||
state.result += common.repeat("\n", emptyLines + 1);
|
||
} else if (emptyLines === 0) {
|
||
if (didReadContent) {
|
||
state.result += " ";
|
||
}
|
||
} else {
|
||
state.result += common.repeat("\n", emptyLines);
|
||
}
|
||
} else {
|
||
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
||
}
|
||
didReadContent = true;
|
||
detectedIndent = true;
|
||
emptyLines = 0;
|
||
captureStart = state.position;
|
||
while (!is_EOL(ch) && ch !== 0) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
captureSegment(state, captureStart, state.position, false);
|
||
}
|
||
return true;
|
||
}
|
||
function readBlockSequence(state, nodeIndent) {
|
||
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
||
if (state.firstTabInLine !== -1) return false;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
if (state.firstTabInLine !== -1) {
|
||
state.position = state.firstTabInLine;
|
||
throwError(state, "tab characters must not be used in indentation");
|
||
}
|
||
if (ch !== 45) {
|
||
break;
|
||
}
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
if (!is_WS_OR_EOL(following)) {
|
||
break;
|
||
}
|
||
detected = true;
|
||
state.position++;
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
if (state.lineIndent <= nodeIndent) {
|
||
_result.push(null);
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
}
|
||
}
|
||
_line = state.line;
|
||
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
||
_result.push(state.result);
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
||
throwError(state, "bad indentation of a sequence entry");
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = "sequence";
|
||
state.result = _result;
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function readBlockMapping(state, nodeIndent, flowIndent) {
|
||
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
||
if (state.firstTabInLine !== -1) return false;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (ch !== 0) {
|
||
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
||
state.position = state.firstTabInLine;
|
||
throwError(state, "tab characters must not be used in indentation");
|
||
}
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
_line = state.line;
|
||
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
||
if (ch === 63) {
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
detected = true;
|
||
atExplicitKey = true;
|
||
allowCompact = true;
|
||
} else if (atExplicitKey) {
|
||
atExplicitKey = false;
|
||
allowCompact = true;
|
||
} else {
|
||
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
||
}
|
||
state.position += 1;
|
||
ch = following;
|
||
} else {
|
||
_keyLine = state.line;
|
||
_keyLineStart = state.lineStart;
|
||
_keyPos = state.position;
|
||
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
||
break;
|
||
}
|
||
if (state.line === _line) {
|
||
ch = state.input.charCodeAt(state.position);
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (ch === 58) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (!is_WS_OR_EOL(ch)) {
|
||
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
||
}
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
detected = true;
|
||
atExplicitKey = false;
|
||
allowCompact = false;
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
} else if (detected) {
|
||
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true;
|
||
}
|
||
} else if (detected) {
|
||
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true;
|
||
}
|
||
}
|
||
if (state.line === _line || state.lineIndent > nodeIndent) {
|
||
if (atExplicitKey) {
|
||
_keyLine = state.line;
|
||
_keyLineStart = state.lineStart;
|
||
_keyPos = state.position;
|
||
}
|
||
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
||
if (atExplicitKey) {
|
||
keyNode = state.result;
|
||
} else {
|
||
valueNode = state.result;
|
||
}
|
||
}
|
||
if (!atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
}
|
||
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
||
throwError(state, "bad indentation of a mapping entry");
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
}
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = "mapping";
|
||
state.result = _result;
|
||
}
|
||
return detected;
|
||
}
|
||
function readTagProperty(state) {
|
||
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 33) return false;
|
||
if (state.tag !== null) {
|
||
throwError(state, "duplication of a tag property");
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
if (ch === 60) {
|
||
isVerbatim = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else if (ch === 33) {
|
||
isNamed = true;
|
||
tagHandle = "!!";
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
tagHandle = "!";
|
||
}
|
||
_position = state.position;
|
||
if (isVerbatim) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 0 && ch !== 62);
|
||
if (state.position < state.length) {
|
||
tagName = state.input.slice(_position, state.position);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
throwError(state, "unexpected end of the stream within a verbatim tag");
|
||
}
|
||
} else {
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
if (ch === 33) {
|
||
if (!isNamed) {
|
||
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
||
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
||
throwError(state, "named tag handle cannot contain such characters");
|
||
}
|
||
isNamed = true;
|
||
_position = state.position + 1;
|
||
} else {
|
||
throwError(state, "tag suffix cannot contain exclamation marks");
|
||
}
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
tagName = state.input.slice(_position, state.position);
|
||
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
||
throwError(state, "tag suffix cannot contain flow indicator characters");
|
||
}
|
||
}
|
||
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
||
throwError(state, "tag name cannot contain such characters: " + tagName);
|
||
}
|
||
try {
|
||
tagName = decodeURIComponent(tagName);
|
||
} catch (err) {
|
||
throwError(state, "tag name is malformed: " + tagName);
|
||
}
|
||
if (isVerbatim) {
|
||
state.tag = tagName;
|
||
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
||
state.tag = state.tagMap[tagHandle] + tagName;
|
||
} else if (tagHandle === "!") {
|
||
state.tag = "!" + tagName;
|
||
} else if (tagHandle === "!!") {
|
||
state.tag = "tag:yaml.org,2002:" + tagName;
|
||
} else {
|
||
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
||
}
|
||
return true;
|
||
}
|
||
function readAnchorProperty(state) {
|
||
var _position, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 38) return false;
|
||
if (state.anchor !== null) {
|
||
throwError(state, "duplication of an anchor property");
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (state.position === _position) {
|
||
throwError(state, "name of an anchor node must contain at least one character");
|
||
}
|
||
state.anchor = state.input.slice(_position, state.position);
|
||
return true;
|
||
}
|
||
function readAlias(state) {
|
||
var _position, alias, ch;
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (ch !== 42) return false;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (state.position === _position) {
|
||
throwError(state, "name of an alias node must contain at least one character");
|
||
}
|
||
alias = state.input.slice(_position, state.position);
|
||
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
||
throwError(state, 'unidentified alias "' + alias + '"');
|
||
}
|
||
state.result = state.anchorMap[alias];
|
||
skipSeparationSpace(state, true, -1);
|
||
return true;
|
||
}
|
||
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
||
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
||
if (state.listener !== null) {
|
||
state.listener("open", state);
|
||
}
|
||
state.tag = null;
|
||
state.anchor = null;
|
||
state.kind = null;
|
||
state.result = null;
|
||
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
||
if (allowToSeek) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
}
|
||
}
|
||
if (indentStatus === 1) {
|
||
while (readTagProperty(state) || readAnchorProperty(state)) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
allowBlockCollections = allowBlockStyles;
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
} else {
|
||
allowBlockCollections = false;
|
||
}
|
||
}
|
||
}
|
||
if (allowBlockCollections) {
|
||
allowBlockCollections = atNewLine || allowCompact;
|
||
}
|
||
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
||
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
||
flowIndent = parentIndent;
|
||
} else {
|
||
flowIndent = parentIndent + 1;
|
||
}
|
||
blockIndent = state.position - state.lineStart;
|
||
if (indentStatus === 1) {
|
||
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
||
hasContent = true;
|
||
} else {
|
||
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
||
hasContent = true;
|
||
} else if (readAlias(state)) {
|
||
hasContent = true;
|
||
if (state.tag !== null || state.anchor !== null) {
|
||
throwError(state, "alias node should not have any properties");
|
||
}
|
||
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
||
hasContent = true;
|
||
if (state.tag === null) {
|
||
state.tag = "?";
|
||
}
|
||
}
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
} else if (indentStatus === 0) {
|
||
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
||
}
|
||
}
|
||
if (state.tag === null) {
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
} else if (state.tag === "?") {
|
||
if (state.result !== null && state.kind !== "scalar") {
|
||
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
||
}
|
||
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
||
type2 = state.implicitTypes[typeIndex];
|
||
if (type2.resolve(state.result)) {
|
||
state.result = type2.construct(state.result);
|
||
state.tag = type2.tag;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
} else if (state.tag !== "!") {
|
||
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
||
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
||
} else {
|
||
type2 = null;
|
||
typeList = state.typeMap.multi[state.kind || "fallback"];
|
||
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
||
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
||
type2 = typeList[typeIndex];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (!type2) {
|
||
throwError(state, "unknown tag !<" + state.tag + ">");
|
||
}
|
||
if (state.result !== null && type2.kind !== state.kind) {
|
||
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
||
}
|
||
if (!type2.resolve(state.result, state.tag)) {
|
||
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
||
} else {
|
||
state.result = type2.construct(state.result, state.tag);
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
}
|
||
if (state.listener !== null) {
|
||
state.listener("close", state);
|
||
}
|
||
return state.tag !== null || state.anchor !== null || hasContent;
|
||
}
|
||
function readDocument(state) {
|
||
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
||
state.version = null;
|
||
state.checkLineBreaks = state.legacy;
|
||
state.tagMap = /* @__PURE__ */ Object.create(null);
|
||
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
if (state.lineIndent > 0 || ch !== 37) {
|
||
break;
|
||
}
|
||
hasDirectives = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
directiveName = state.input.slice(_position, state.position);
|
||
directiveArgs = [];
|
||
if (directiveName.length < 1) {
|
||
throwError(state, "directive name must not be less than one character in length");
|
||
}
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
if (ch === 35) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 0 && !is_EOL(ch));
|
||
break;
|
||
}
|
||
if (is_EOL(ch)) break;
|
||
_position = state.position;
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
directiveArgs.push(state.input.slice(_position, state.position));
|
||
}
|
||
if (ch !== 0) readLineBreak(state);
|
||
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
||
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
||
} else {
|
||
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
||
}
|
||
}
|
||
skipSeparationSpace(state, true, -1);
|
||
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
} else if (hasDirectives) {
|
||
throwError(state, "directives end mark is expected");
|
||
}
|
||
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
||
skipSeparationSpace(state, true, -1);
|
||
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
||
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
||
}
|
||
state.documents.push(state.result);
|
||
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
if (state.input.charCodeAt(state.position) === 46) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
}
|
||
return;
|
||
}
|
||
if (state.position < state.length - 1) {
|
||
throwError(state, "end of the stream or a document separator is expected");
|
||
} else {
|
||
return;
|
||
}
|
||
}
|
||
function loadDocuments(input, options) {
|
||
input = String(input);
|
||
options = options || {};
|
||
if (input.length !== 0) {
|
||
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
||
input += "\n";
|
||
}
|
||
if (input.charCodeAt(0) === 65279) {
|
||
input = input.slice(1);
|
||
}
|
||
}
|
||
var state = new State$1(input, options);
|
||
var nullpos = input.indexOf("\0");
|
||
if (nullpos !== -1) {
|
||
state.position = nullpos;
|
||
throwError(state, "null byte is not allowed in input");
|
||
}
|
||
state.input += "\0";
|
||
while (state.input.charCodeAt(state.position) === 32) {
|
||
state.lineIndent += 1;
|
||
state.position += 1;
|
||
}
|
||
while (state.position < state.length - 1) {
|
||
readDocument(state);
|
||
}
|
||
return state.documents;
|
||
}
|
||
function loadAll$1(input, iterator, options) {
|
||
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
||
options = iterator;
|
||
iterator = null;
|
||
}
|
||
var documents = loadDocuments(input, options);
|
||
if (typeof iterator !== "function") {
|
||
return documents;
|
||
}
|
||
for (var index = 0, length = documents.length; index < length; index += 1) {
|
||
iterator(documents[index]);
|
||
}
|
||
}
|
||
function load$1(input, options) {
|
||
var documents = loadDocuments(input, options);
|
||
if (documents.length === 0) {
|
||
return void 0;
|
||
} else if (documents.length === 1) {
|
||
return documents[0];
|
||
}
|
||
throw new exception("expected a single document in the stream, but found more");
|
||
}
|
||
var loadAll_1 = loadAll$1;
|
||
var load_1 = load$1;
|
||
var loader = {
|
||
loadAll: loadAll_1,
|
||
load: load_1
|
||
};
|
||
var _toString = Object.prototype.toString;
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var CHAR_BOM = 65279;
|
||
var CHAR_TAB = 9;
|
||
var CHAR_LINE_FEED = 10;
|
||
var CHAR_CARRIAGE_RETURN = 13;
|
||
var CHAR_SPACE = 32;
|
||
var CHAR_EXCLAMATION = 33;
|
||
var CHAR_DOUBLE_QUOTE = 34;
|
||
var CHAR_SHARP = 35;
|
||
var CHAR_PERCENT = 37;
|
||
var CHAR_AMPERSAND = 38;
|
||
var CHAR_SINGLE_QUOTE = 39;
|
||
var CHAR_ASTERISK = 42;
|
||
var CHAR_COMMA = 44;
|
||
var CHAR_MINUS = 45;
|
||
var CHAR_COLON = 58;
|
||
var CHAR_EQUALS = 61;
|
||
var CHAR_GREATER_THAN = 62;
|
||
var CHAR_QUESTION = 63;
|
||
var CHAR_COMMERCIAL_AT = 64;
|
||
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
||
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
||
var CHAR_GRAVE_ACCENT = 96;
|
||
var CHAR_LEFT_CURLY_BRACKET = 123;
|
||
var CHAR_VERTICAL_LINE = 124;
|
||
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
||
var ESCAPE_SEQUENCES = {};
|
||
ESCAPE_SEQUENCES[0] = "\\0";
|
||
ESCAPE_SEQUENCES[7] = "\\a";
|
||
ESCAPE_SEQUENCES[8] = "\\b";
|
||
ESCAPE_SEQUENCES[9] = "\\t";
|
||
ESCAPE_SEQUENCES[10] = "\\n";
|
||
ESCAPE_SEQUENCES[11] = "\\v";
|
||
ESCAPE_SEQUENCES[12] = "\\f";
|
||
ESCAPE_SEQUENCES[13] = "\\r";
|
||
ESCAPE_SEQUENCES[27] = "\\e";
|
||
ESCAPE_SEQUENCES[34] = '\\"';
|
||
ESCAPE_SEQUENCES[92] = "\\\\";
|
||
ESCAPE_SEQUENCES[133] = "\\N";
|
||
ESCAPE_SEQUENCES[160] = "\\_";
|
||
ESCAPE_SEQUENCES[8232] = "\\L";
|
||
ESCAPE_SEQUENCES[8233] = "\\P";
|
||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
||
"y",
|
||
"Y",
|
||
"yes",
|
||
"Yes",
|
||
"YES",
|
||
"on",
|
||
"On",
|
||
"ON",
|
||
"n",
|
||
"N",
|
||
"no",
|
||
"No",
|
||
"NO",
|
||
"off",
|
||
"Off",
|
||
"OFF"
|
||
];
|
||
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
||
function compileStyleMap(schema2, map2) {
|
||
var result, keys, index, length, tag, style, type2;
|
||
if (map2 === null) return {};
|
||
result = {};
|
||
keys = Object.keys(map2);
|
||
for (index = 0, length = keys.length; index < length; index += 1) {
|
||
tag = keys[index];
|
||
style = String(map2[tag]);
|
||
if (tag.slice(0, 2) === "!!") {
|
||
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
||
}
|
||
type2 = schema2.compiledTypeMap["fallback"][tag];
|
||
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
||
style = type2.styleAliases[style];
|
||
}
|
||
result[tag] = style;
|
||
}
|
||
return result;
|
||
}
|
||
function encodeHex(character) {
|
||
var string, handle, length;
|
||
string = character.toString(16).toUpperCase();
|
||
if (character <= 255) {
|
||
handle = "x";
|
||
length = 2;
|
||
} else if (character <= 65535) {
|
||
handle = "u";
|
||
length = 4;
|
||
} else if (character <= 4294967295) {
|
||
handle = "U";
|
||
length = 8;
|
||
} else {
|
||
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
||
}
|
||
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
||
}
|
||
var QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2;
|
||
function State(options) {
|
||
this.schema = options["schema"] || _default;
|
||
this.indent = Math.max(1, options["indent"] || 2);
|
||
this.noArrayIndent = options["noArrayIndent"] || false;
|
||
this.skipInvalid = options["skipInvalid"] || false;
|
||
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
||
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
||
this.sortKeys = options["sortKeys"] || false;
|
||
this.lineWidth = options["lineWidth"] || 80;
|
||
this.noRefs = options["noRefs"] || false;
|
||
this.noCompatMode = options["noCompatMode"] || false;
|
||
this.condenseFlow = options["condenseFlow"] || false;
|
||
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
||
this.forceQuotes = options["forceQuotes"] || false;
|
||
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.explicitTypes = this.schema.compiledExplicit;
|
||
this.tag = null;
|
||
this.result = "";
|
||
this.duplicates = [];
|
||
this.usedDuplicates = null;
|
||
}
|
||
function indentString(string, spaces) {
|
||
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
||
while (position < length) {
|
||
next = string.indexOf("\n", position);
|
||
if (next === -1) {
|
||
line = string.slice(position);
|
||
position = length;
|
||
} else {
|
||
line = string.slice(position, next + 1);
|
||
position = next + 1;
|
||
}
|
||
if (line.length && line !== "\n") result += ind;
|
||
result += line;
|
||
}
|
||
return result;
|
||
}
|
||
function generateNextLine(state, level) {
|
||
return "\n" + common.repeat(" ", state.indent * level);
|
||
}
|
||
function testImplicitResolving(state, str2) {
|
||
var index, length, type2;
|
||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
||
type2 = state.implicitTypes[index];
|
||
if (type2.resolve(str2)) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function isWhitespace(c) {
|
||
return c === CHAR_SPACE || c === CHAR_TAB;
|
||
}
|
||
function isPrintable(c) {
|
||
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
||
}
|
||
function isNsCharOrWhitespace(c) {
|
||
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
||
}
|
||
function isPlainSafe(c, prev, inblock) {
|
||
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
||
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
||
return (
|
||
// ns-plain-safe
|
||
(inblock ? (
|
||
// c = flow-in
|
||
cIsNsCharOrWhitespace
|
||
) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
|
||
);
|
||
}
|
||
function isPlainSafeFirst(c) {
|
||
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
||
}
|
||
function isPlainSafeLast(c) {
|
||
return !isWhitespace(c) && c !== CHAR_COLON;
|
||
}
|
||
function codePointAt(string, pos) {
|
||
var first = string.charCodeAt(pos), second;
|
||
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
||
second = string.charCodeAt(pos + 1);
|
||
if (second >= 56320 && second <= 57343) {
|
||
return (first - 55296) * 1024 + second - 56320 + 65536;
|
||
}
|
||
}
|
||
return first;
|
||
}
|
||
function needIndentIndicator(string) {
|
||
var leadingSpaceRe = /^\n* /;
|
||
return leadingSpaceRe.test(string);
|
||
}
|
||
var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5;
|
||
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
||
var i2;
|
||
var char = 0;
|
||
var prevChar = null;
|
||
var hasLineBreak = false;
|
||
var hasFoldableLine = false;
|
||
var shouldTrackWidth = lineWidth !== -1;
|
||
var previousLineBreak = -1;
|
||
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
||
if (singleLineOnly || forceQuotes) {
|
||
for (i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
||
char = codePointAt(string, i2);
|
||
if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||
prevChar = char;
|
||
}
|
||
} else {
|
||
for (i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
||
char = codePointAt(string, i2);
|
||
if (char === CHAR_LINE_FEED) {
|
||
hasLineBreak = true;
|
||
if (shouldTrackWidth) {
|
||
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
||
i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
||
previousLineBreak = i2;
|
||
}
|
||
} else if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||
prevChar = char;
|
||
}
|
||
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
||
}
|
||
if (!hasLineBreak && !hasFoldableLine) {
|
||
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
||
return STYLE_PLAIN;
|
||
}
|
||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||
}
|
||
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
if (!forceQuotes) {
|
||
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
||
}
|
||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||
}
|
||
function writeScalar(state, string, level, iskey, inblock) {
|
||
state.dump = (function() {
|
||
if (string.length === 0) {
|
||
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
||
}
|
||
if (!state.noCompatMode) {
|
||
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
||
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
||
}
|
||
}
|
||
var indent = state.indent * Math.max(1, level);
|
||
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
||
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
||
function testAmbiguity(string2) {
|
||
return testImplicitResolving(state, string2);
|
||
}
|
||
switch (chooseScalarStyle(
|
||
string,
|
||
singleLineOnly,
|
||
state.indent,
|
||
lineWidth,
|
||
testAmbiguity,
|
||
state.quotingType,
|
||
state.forceQuotes && !iskey,
|
||
inblock
|
||
)) {
|
||
case STYLE_PLAIN:
|
||
return string;
|
||
case STYLE_SINGLE:
|
||
return "'" + string.replace(/'/g, "''") + "'";
|
||
case STYLE_LITERAL:
|
||
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
||
case STYLE_FOLDED:
|
||
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
||
case STYLE_DOUBLE:
|
||
return '"' + escapeString(string) + '"';
|
||
default:
|
||
throw new exception("impossible error: invalid scalar style");
|
||
}
|
||
})();
|
||
}
|
||
function blockHeader(string, indentPerLevel) {
|
||
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
||
var clip = string[string.length - 1] === "\n";
|
||
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
||
var chomp = keep ? "+" : clip ? "" : "-";
|
||
return indentIndicator + chomp + "\n";
|
||
}
|
||
function dropEndingNewline(string) {
|
||
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
||
}
|
||
function foldString(string, width) {
|
||
var lineRe = /(\n+)([^\n]*)/g;
|
||
var result = (function() {
|
||
var nextLF = string.indexOf("\n");
|
||
nextLF = nextLF !== -1 ? nextLF : string.length;
|
||
lineRe.lastIndex = nextLF;
|
||
return foldLine(string.slice(0, nextLF), width);
|
||
})();
|
||
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
||
var moreIndented;
|
||
var match;
|
||
while (match = lineRe.exec(string)) {
|
||
var prefix = match[1], line = match[2];
|
||
moreIndented = line[0] === " ";
|
||
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
||
prevMoreIndented = moreIndented;
|
||
}
|
||
return result;
|
||
}
|
||
function foldLine(line, width) {
|
||
if (line === "" || line[0] === " ") return line;
|
||
var breakRe = / [^ ]/g;
|
||
var match;
|
||
var start = 0, end, curr = 0, next = 0;
|
||
var result = "";
|
||
while (match = breakRe.exec(line)) {
|
||
next = match.index;
|
||
if (next - start > width) {
|
||
end = curr > start ? curr : next;
|
||
result += "\n" + line.slice(start, end);
|
||
start = end + 1;
|
||
}
|
||
curr = next;
|
||
}
|
||
result += "\n";
|
||
if (line.length - start > width && curr > start) {
|
||
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
||
} else {
|
||
result += line.slice(start);
|
||
}
|
||
return result.slice(1);
|
||
}
|
||
function escapeString(string) {
|
||
var result = "";
|
||
var char = 0;
|
||
var escapeSeq;
|
||
for (var i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
||
char = codePointAt(string, i2);
|
||
escapeSeq = ESCAPE_SEQUENCES[char];
|
||
if (!escapeSeq && isPrintable(char)) {
|
||
result += string[i2];
|
||
if (char >= 65536) result += string[i2 + 1];
|
||
} else {
|
||
result += escapeSeq || encodeHex(char);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
function writeFlowSequence(state, level, object) {
|
||
var _result = "", _tag = state.tag, index, length, value;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
value = object[index];
|
||
if (state.replacer) {
|
||
value = state.replacer.call(object, String(index), value);
|
||
}
|
||
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
||
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = "[" + _result + "]";
|
||
}
|
||
function writeBlockSequence(state, level, object, compact) {
|
||
var _result = "", _tag = state.tag, index, length, value;
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
value = object[index];
|
||
if (state.replacer) {
|
||
value = state.replacer.call(object, String(index), value);
|
||
}
|
||
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
||
if (!compact || _result !== "") {
|
||
_result += generateNextLine(state, level);
|
||
}
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
_result += "-";
|
||
} else {
|
||
_result += "- ";
|
||
}
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = _result || "[]";
|
||
}
|
||
function writeFlowMapping(state, level, object) {
|
||
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
pairBuffer = "";
|
||
if (_result !== "") pairBuffer += ", ";
|
||
if (state.condenseFlow) pairBuffer += '"';
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
if (state.replacer) {
|
||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||
}
|
||
if (!writeNode(state, level, objectKey, false, false)) {
|
||
continue;
|
||
}
|
||
if (state.dump.length > 1024) pairBuffer += "? ";
|
||
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
||
if (!writeNode(state, level, objectValue, false, false)) {
|
||
continue;
|
||
}
|
||
pairBuffer += state.dump;
|
||
_result += pairBuffer;
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = "{" + _result + "}";
|
||
}
|
||
function writeBlockMapping(state, level, object, compact) {
|
||
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
||
if (state.sortKeys === true) {
|
||
objectKeyList.sort();
|
||
} else if (typeof state.sortKeys === "function") {
|
||
objectKeyList.sort(state.sortKeys);
|
||
} else if (state.sortKeys) {
|
||
throw new exception("sortKeys must be a boolean or a function");
|
||
}
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
pairBuffer = "";
|
||
if (!compact || _result !== "") {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
if (state.replacer) {
|
||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||
}
|
||
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
||
continue;
|
||
}
|
||
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
||
if (explicitPair) {
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += "?";
|
||
} else {
|
||
pairBuffer += "? ";
|
||
}
|
||
}
|
||
pairBuffer += state.dump;
|
||
if (explicitPair) {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
||
continue;
|
||
}
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += ":";
|
||
} else {
|
||
pairBuffer += ": ";
|
||
}
|
||
pairBuffer += state.dump;
|
||
_result += pairBuffer;
|
||
}
|
||
state.tag = _tag;
|
||
state.dump = _result || "{}";
|
||
}
|
||
function detectType(state, object, explicit) {
|
||
var _result, typeList, index, length, type2, style;
|
||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
||
type2 = typeList[index];
|
||
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
||
if (explicit) {
|
||
if (type2.multi && type2.representName) {
|
||
state.tag = type2.representName(object);
|
||
} else {
|
||
state.tag = type2.tag;
|
||
}
|
||
} else {
|
||
state.tag = "?";
|
||
}
|
||
if (type2.represent) {
|
||
style = state.styleMap[type2.tag] || type2.defaultStyle;
|
||
if (_toString.call(type2.represent) === "[object Function]") {
|
||
_result = type2.represent(object, style);
|
||
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
||
_result = type2.represent[style](object, style);
|
||
} else {
|
||
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
||
}
|
||
state.dump = _result;
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
||
state.tag = null;
|
||
state.dump = object;
|
||
if (!detectType(state, object, false)) {
|
||
detectType(state, object, true);
|
||
}
|
||
var type2 = _toString.call(state.dump);
|
||
var inblock = block;
|
||
var tagStr;
|
||
if (block) {
|
||
block = state.flowLevel < 0 || state.flowLevel > level;
|
||
}
|
||
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
||
if (objectOrArray) {
|
||
duplicateIndex = state.duplicates.indexOf(object);
|
||
duplicate = duplicateIndex !== -1;
|
||
}
|
||
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
||
compact = false;
|
||
}
|
||
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
||
state.dump = "*ref_" + duplicateIndex;
|
||
} else {
|
||
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
||
state.usedDuplicates[duplicateIndex] = true;
|
||
}
|
||
if (type2 === "[object Object]") {
|
||
if (block && Object.keys(state.dump).length !== 0) {
|
||
writeBlockMapping(state, level, state.dump, compact);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowMapping(state, level, state.dump);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
||
}
|
||
}
|
||
} else if (type2 === "[object Array]") {
|
||
if (block && state.dump.length !== 0) {
|
||
if (state.noArrayIndent && !isblockseq && level > 0) {
|
||
writeBlockSequence(state, level - 1, state.dump, compact);
|
||
} else {
|
||
writeBlockSequence(state, level, state.dump, compact);
|
||
}
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowSequence(state, level, state.dump);
|
||
if (duplicate) {
|
||
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
||
}
|
||
}
|
||
} else if (type2 === "[object String]") {
|
||
if (state.tag !== "?") {
|
||
writeScalar(state, state.dump, level, iskey, inblock);
|
||
}
|
||
} else if (type2 === "[object Undefined]") {
|
||
return false;
|
||
} else {
|
||
if (state.skipInvalid) return false;
|
||
throw new exception("unacceptable kind of an object to dump " + type2);
|
||
}
|
||
if (state.tag !== null && state.tag !== "?") {
|
||
tagStr = encodeURI(
|
||
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
||
).replace(/!/g, "%21");
|
||
if (state.tag[0] === "!") {
|
||
tagStr = "!" + tagStr;
|
||
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
||
tagStr = "!!" + tagStr.slice(18);
|
||
} else {
|
||
tagStr = "!<" + tagStr + ">";
|
||
}
|
||
state.dump = tagStr + " " + state.dump;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
function getDuplicateReferences(object, state) {
|
||
var objects = [], duplicatesIndexes = [], index, length;
|
||
inspectNode(object, objects, duplicatesIndexes);
|
||
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
||
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
||
}
|
||
state.usedDuplicates = new Array(length);
|
||
}
|
||
function inspectNode(object, objects, duplicatesIndexes) {
|
||
var objectKeyList, index, length;
|
||
if (object !== null && typeof object === "object") {
|
||
index = objects.indexOf(object);
|
||
if (index !== -1) {
|
||
if (duplicatesIndexes.indexOf(index) === -1) {
|
||
duplicatesIndexes.push(index);
|
||
}
|
||
} else {
|
||
objects.push(object);
|
||
if (Array.isArray(object)) {
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
inspectNode(object[index], objects, duplicatesIndexes);
|
||
}
|
||
} else {
|
||
objectKeyList = Object.keys(object);
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function dump$1(input, options) {
|
||
options = options || {};
|
||
var state = new State(options);
|
||
if (!state.noRefs) getDuplicateReferences(input, state);
|
||
var value = input;
|
||
if (state.replacer) {
|
||
value = state.replacer.call({ "": value }, "", value);
|
||
}
|
||
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
||
return "";
|
||
}
|
||
var dump_1 = dump$1;
|
||
var dumper = {
|
||
dump: dump_1
|
||
};
|
||
function renamed(from, to) {
|
||
return function() {
|
||
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
||
};
|
||
}
|
||
var Type = type;
|
||
var Schema = schema;
|
||
var FAILSAFE_SCHEMA = failsafe;
|
||
var JSON_SCHEMA = json;
|
||
var CORE_SCHEMA = core;
|
||
var DEFAULT_SCHEMA = _default;
|
||
var load = loader.load;
|
||
var loadAll = loader.loadAll;
|
||
var dump = dumper.dump;
|
||
var YAMLException = exception;
|
||
var types = {
|
||
binary,
|
||
float,
|
||
map,
|
||
null: _null,
|
||
pairs,
|
||
set,
|
||
timestamp,
|
||
bool,
|
||
int,
|
||
merge,
|
||
omap,
|
||
seq,
|
||
str
|
||
};
|
||
var safeLoad = renamed("safeLoad", "load");
|
||
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
||
var safeDump = renamed("safeDump", "dump");
|
||
var jsYaml = {
|
||
Type,
|
||
Schema,
|
||
FAILSAFE_SCHEMA,
|
||
JSON_SCHEMA,
|
||
CORE_SCHEMA,
|
||
DEFAULT_SCHEMA,
|
||
load,
|
||
loadAll,
|
||
dump,
|
||
YAMLException,
|
||
types,
|
||
safeLoad,
|
||
safeLoadAll,
|
||
safeDump
|
||
};
|
||
function useMapData(options = {}) {
|
||
const {
|
||
defaultCenter = { lat: 43.836699, lon: 4.360054 },
|
||
defaultZoom = 13,
|
||
onSave = () => {
|
||
}
|
||
} = options;
|
||
const center = Vue.ref({ ...defaultCenter });
|
||
const zoom = Vue.ref(defaultZoom);
|
||
const saveTimeout = Vue.ref(null);
|
||
Vue.onBeforeUnmount(() => {
|
||
if (saveTimeout.value) {
|
||
clearTimeout(saveTimeout.value);
|
||
}
|
||
});
|
||
function loadMapData(yamlString) {
|
||
if (!yamlString || yamlString.trim() === "") {
|
||
return null;
|
||
}
|
||
try {
|
||
const data = jsYaml.load(yamlString);
|
||
if (data) {
|
||
if (data.center) {
|
||
center.value = {
|
||
lat: data.center.lat,
|
||
lon: data.center.lon
|
||
};
|
||
}
|
||
if (data.zoom !== void 0) {
|
||
zoom.value = data.zoom;
|
||
}
|
||
return data;
|
||
}
|
||
} catch (error) {
|
||
console.error("Error loading map data:", error);
|
||
return null;
|
||
}
|
||
return null;
|
||
}
|
||
function saveMapData() {
|
||
const data = {
|
||
background: {
|
||
type: "osm"
|
||
},
|
||
center: {
|
||
lat: center.value.lat,
|
||
lon: center.value.lon
|
||
},
|
||
zoom: zoom.value
|
||
};
|
||
const yamlString = jsYaml.dump(data, {
|
||
indent: 2,
|
||
lineWidth: -1,
|
||
noRefs: true
|
||
});
|
||
onSave(yamlString);
|
||
return yamlString;
|
||
}
|
||
function debouncedSave(delay = 300) {
|
||
if (saveTimeout.value) {
|
||
clearTimeout(saveTimeout.value);
|
||
}
|
||
saveTimeout.value = setTimeout(() => {
|
||
saveMapData();
|
||
}, delay);
|
||
}
|
||
return {
|
||
// State
|
||
center,
|
||
zoom,
|
||
// Methods
|
||
loadMapData,
|
||
saveMapData,
|
||
debouncedSave
|
||
};
|
||
}
|
||
const _sfc_main = {
|
||
components: {
|
||
MapPreview,
|
||
MarkerList
|
||
},
|
||
props: {
|
||
value: String,
|
||
name: String,
|
||
label: String,
|
||
help: String,
|
||
disabled: Boolean,
|
||
defaultCenter: {
|
||
type: Array,
|
||
default: () => [43.836699, 4.360054]
|
||
},
|
||
defaultZoom: {
|
||
type: Number,
|
||
default: 13
|
||
},
|
||
maxMarkers: {
|
||
type: Number,
|
||
default: 50
|
||
},
|
||
mode: {
|
||
type: String,
|
||
default: "multi",
|
||
validator: (value) => ["multi", "single"].includes(value)
|
||
},
|
||
latitude: {
|
||
type: [Number, String],
|
||
default: null
|
||
},
|
||
longitude: {
|
||
type: [Number, String],
|
||
default: null
|
||
},
|
||
markerIconUrl: {
|
||
type: String,
|
||
default: null
|
||
},
|
||
markerIconSize: {
|
||
type: Number,
|
||
default: 40
|
||
}
|
||
},
|
||
setup(props, { emit }) {
|
||
const mapReady = Vue.ref(false);
|
||
const mapPreview = Vue.ref(null);
|
||
const selectedMarkerId = Vue.ref(null);
|
||
const isInitialLoad = Vue.ref(true);
|
||
const pageId = Vue.computed(() => {
|
||
var _a;
|
||
if (props.mode === "single") return null;
|
||
const urlMatch = window.location.pathname.match(/\/panel\/pages\/(.+)/);
|
||
if (urlMatch) {
|
||
return urlMatch[1].replace(/\+/g, "/");
|
||
}
|
||
const nameMatch = (_a = props.name) == null ? void 0 : _a.match(/pages\/([^/]+)/);
|
||
if (nameMatch) {
|
||
return nameMatch[1].replace(/\+/g, "/");
|
||
}
|
||
console.warn("Could not extract page ID, using default");
|
||
return "map/carte";
|
||
});
|
||
const markersApi = props.mode === "multi" ? useMarkersApi(pageId.value) : { markers: Vue.ref([]), loading: Vue.ref(false), error: Vue.ref(null) };
|
||
const { center, zoom, loadMapData, saveMapData, debouncedSave } = useMapData({
|
||
defaultCenter: {
|
||
lat: props.defaultCenter[0],
|
||
lon: props.defaultCenter[1]
|
||
},
|
||
defaultZoom: props.defaultZoom,
|
||
onSave: (yamlString) => emit("input", yamlString)
|
||
});
|
||
const markers = Vue.computed(() => {
|
||
if (props.mode === "single") {
|
||
const lat = singleLat.value;
|
||
const lon = singleLon.value;
|
||
if (!isNaN(lat) && !isNaN(lon) && lat !== null && lon !== null && lat !== 0 && lon !== 0) {
|
||
return [
|
||
{
|
||
id: "single-marker",
|
||
position: { lat, lon },
|
||
title: "Current position",
|
||
iconUrl: props.markerIconUrl,
|
||
iconSize: props.markerIconSize
|
||
}
|
||
];
|
||
}
|
||
return [];
|
||
}
|
||
return markersApi.markers.value;
|
||
});
|
||
const canAddMarker = Vue.computed(() => {
|
||
if (props.mode === "single") return false;
|
||
return markers.value.length < props.maxMarkers;
|
||
});
|
||
const singleLat = Vue.ref(null);
|
||
const singleLon = Vue.ref(null);
|
||
function getCoordinatesFromForm() {
|
||
const form = document.querySelector(".k-form");
|
||
if (!form) return { lat: null, lon: null };
|
||
const latInput = form.querySelector('input[name*="latitude"]');
|
||
const lonInput = form.querySelector('input[name*="longitude"]');
|
||
return {
|
||
lat: latInput ? parseFloat(latInput.value) : null,
|
||
lon: lonInput ? parseFloat(lonInput.value) : null
|
||
};
|
||
}
|
||
Vue.onMounted(async () => {
|
||
if (props.mode === "multi") {
|
||
try {
|
||
await markersApi.fetchMarkers();
|
||
} catch (error) {
|
||
console.error("Failed to load markers:", error);
|
||
}
|
||
} else if (props.mode === "single") {
|
||
const coords = getCoordinatesFromForm();
|
||
singleLat.value = coords.lat;
|
||
singleLon.value = coords.lon;
|
||
if (!isNaN(coords.lat) && !isNaN(coords.lon) && coords.lat !== 0 && coords.lon !== 0) {
|
||
center.value = { lat: coords.lat, lon: coords.lon };
|
||
}
|
||
const form = document.querySelector(".k-form");
|
||
if (form) {
|
||
form.addEventListener("input", (e) => {
|
||
if (e.target.name && (e.target.name.includes("latitude") || e.target.name.includes("longitude"))) {
|
||
const newCoords = getCoordinatesFromForm();
|
||
singleLat.value = newCoords.lat;
|
||
singleLon.value = newCoords.lon;
|
||
}
|
||
});
|
||
const latInput = form.querySelector('input[name*="latitude"]');
|
||
const lonInput = form.querySelector('input[name*="longitude"]');
|
||
if (latInput && lonInput) {
|
||
const observer = new MutationObserver(() => {
|
||
const newCoords = getCoordinatesFromForm();
|
||
if (newCoords.lat !== singleLat.value || newCoords.lon !== singleLon.value) {
|
||
singleLat.value = newCoords.lat;
|
||
singleLon.value = newCoords.lon;
|
||
}
|
||
});
|
||
observer.observe(latInput, {
|
||
attributes: true,
|
||
attributeFilter: ["value"]
|
||
});
|
||
observer.observe(lonInput, {
|
||
attributes: true,
|
||
attributeFilter: ["value"]
|
||
});
|
||
const pollInterval = setInterval(() => {
|
||
const newCoords = getCoordinatesFromForm();
|
||
if (newCoords.lat !== singleLat.value || newCoords.lon !== singleLon.value) {
|
||
singleLat.value = newCoords.lat;
|
||
singleLon.value = newCoords.lon;
|
||
}
|
||
}, 500);
|
||
Vue.onBeforeUnmount(() => {
|
||
observer.disconnect();
|
||
clearInterval(pollInterval);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
if (props.value && props.mode === "multi") {
|
||
loadMapData(props.value);
|
||
}
|
||
await Vue.nextTick();
|
||
mapReady.value = true;
|
||
await Vue.nextTick();
|
||
isInitialLoad.value = false;
|
||
});
|
||
Vue.watch(
|
||
[center, zoom],
|
||
() => {
|
||
if (props.mode === "multi" && !isInitialLoad.value) {
|
||
debouncedSave();
|
||
}
|
||
},
|
||
{ deep: true }
|
||
);
|
||
Vue.watch(
|
||
() => [singleLat.value, singleLon.value],
|
||
([lat, lon]) => {
|
||
if (props.mode === "single") {
|
||
if (!isNaN(lat) && !isNaN(lon) && lat !== null && lon !== null && lat !== 0 && lon !== 0) {
|
||
Vue.nextTick(() => {
|
||
if (mapPreview.value && mapPreview.value.centerOnPosition) {
|
||
mapPreview.value.centerOnPosition(lat, lon);
|
||
}
|
||
});
|
||
} else {
|
||
center.value = {
|
||
lat: props.defaultCenter[0],
|
||
lon: props.defaultCenter[1]
|
||
};
|
||
Vue.nextTick(() => {
|
||
if (mapPreview.value && mapPreview.value.centerOnPosition) {
|
||
mapPreview.value.centerOnPosition(
|
||
center.value.lat,
|
||
center.value.lon
|
||
);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
);
|
||
function getCurrentCenter() {
|
||
if (mapPreview.value && mapPreview.value.getCurrentCenter) {
|
||
return mapPreview.value.getCurrentCenter();
|
||
}
|
||
return { lat: center.value.lat, lon: center.value.lon };
|
||
}
|
||
async function handleAddMarker() {
|
||
if (!canAddMarker.value || props.mode === "single") {
|
||
return;
|
||
}
|
||
const currentCenter = getCurrentCenter();
|
||
const position = {
|
||
lat: currentCenter.lat,
|
||
lon: currentCenter.lon || currentCenter.lng
|
||
};
|
||
try {
|
||
await markersApi.createMarker(position);
|
||
} catch (error) {
|
||
console.error("Failed to create marker:", error);
|
||
}
|
||
}
|
||
async function handleMapClick(position) {
|
||
if (!canAddMarker.value || props.mode === "single") {
|
||
return;
|
||
}
|
||
try {
|
||
await markersApi.createMarker({ lat: position.lat, lon: position.lng });
|
||
} catch (error) {
|
||
console.error("Failed to create marker:", error);
|
||
}
|
||
}
|
||
function handleSelectMarker(markerId) {
|
||
selectedMarkerId.value = markerId;
|
||
const marker = markers.value.find((m) => m.id === markerId);
|
||
if (marker && mapPreview.value && mapPreview.value.centerOnPosition) {
|
||
mapPreview.value.centerOnPosition(
|
||
marker.position.lat,
|
||
marker.position.lon
|
||
);
|
||
}
|
||
}
|
||
async function handleMarkerMoved({ markerId, position }) {
|
||
if (props.mode === "single") {
|
||
const form = document.querySelector(".k-form");
|
||
if (form) {
|
||
const latInput = form.querySelector('input[name*="latitude"]');
|
||
const lonInput = form.querySelector('input[name*="longitude"]');
|
||
if (latInput && lonInput) {
|
||
latInput.value = position.lat;
|
||
lonInput.value = position.lng;
|
||
latInput.dispatchEvent(new Event("input", { bubbles: true }));
|
||
lonInput.dispatchEvent(new Event("input", { bubbles: true }));
|
||
singleLat.value = position.lat;
|
||
singleLon.value = position.lng;
|
||
}
|
||
}
|
||
} else {
|
||
try {
|
||
await markersApi.updateMarkerPosition(markerId, {
|
||
lat: position.lat,
|
||
lon: position.lng
|
||
});
|
||
} catch (error) {
|
||
console.error("Failed to update marker position:", error);
|
||
}
|
||
}
|
||
}
|
||
function editMarker(markerId) {
|
||
if (props.mode === "single") return;
|
||
const marker = markers.value.find((m) => m.id === markerId);
|
||
if (marker && marker.panelUrl) {
|
||
window.top.location.href = marker.panelUrl;
|
||
}
|
||
}
|
||
async function deleteMarker(markerId) {
|
||
if (props.mode === "single") return;
|
||
if (!confirm("Supprimer ce marqueur ?")) {
|
||
return;
|
||
}
|
||
try {
|
||
await markersApi.deleteMarker(markerId);
|
||
if (selectedMarkerId.value === markerId) {
|
||
selectedMarkerId.value = null;
|
||
}
|
||
} catch (error) {
|
||
console.error("Failed to delete marker:", error);
|
||
}
|
||
}
|
||
function handleLocationSelect(location) {
|
||
if (mapPreview.value && mapPreview.value.centerOnPosition) {
|
||
mapPreview.value.centerOnPosition(location.lat, location.lon);
|
||
}
|
||
}
|
||
function saveCurrentFraming() {
|
||
if (!mapPreview.value) return;
|
||
const currentCenter = mapPreview.value.getCurrentCenter ? mapPreview.value.getCurrentCenter() : { lat: center.value.lat, lon: center.value.lon };
|
||
const currentZoom = mapPreview.value.getCurrentZoom ? mapPreview.value.getCurrentZoom() : zoom.value;
|
||
center.value = {
|
||
lat: currentCenter.lat,
|
||
lon: currentCenter.lon
|
||
};
|
||
zoom.value = currentZoom;
|
||
saveMapData();
|
||
}
|
||
return {
|
||
// State
|
||
center,
|
||
zoom,
|
||
markers,
|
||
selectedMarkerId,
|
||
mapReady,
|
||
mapPreview,
|
||
canAddMarker,
|
||
loading: markersApi.loading,
|
||
error: markersApi.error,
|
||
// Methods
|
||
handleAddMarker,
|
||
handleMapClick,
|
||
handleSelectMarker,
|
||
handleMarkerMoved,
|
||
handleLocationSelect,
|
||
deleteMarker,
|
||
editMarker,
|
||
saveCurrentFraming
|
||
};
|
||
}
|
||
};
|
||
var _sfc_render = function render() {
|
||
var _vm = this, _c = _vm._self._c;
|
||
return _c("k-field", _vm._b({ staticClass: "k-map-editor-field" }, "k-field", _vm.$props, false), [_c("div", { staticClass: "map-editor-container" }, [_c("div", { staticClass: "map-content", class: { "single-mode": _vm.mode === "single" } }, [_vm.mode === "multi" ? _c("MarkerList", { attrs: { "markers": _vm.markers, "selected-marker-id": _vm.selectedMarkerId, "max-markers": _vm.maxMarkers }, on: { "add-marker": _vm.handleAddMarker, "select-marker": _vm.handleSelectMarker, "edit-marker": _vm.editMarker, "delete-marker": _vm.deleteMarker, "select-location": _vm.handleLocationSelect } }) : _vm._e(), _c("div", { staticClass: "map-preview-container" }, [_vm.mode === "multi" ? _c("button", { staticClass: "save-framing-button", attrs: { "type": "button", "title": "Utiliser le niveau de zoom et centrage actuel comme cadrage par défaut" }, on: { "click": _vm.saveCurrentFraming } }, [_vm._v(" Définir le cadrage ")]) : _vm._e(), _vm.mapReady ? _c("MapPreview", { ref: "mapPreview", attrs: { "center": _vm.center, "zoom": _vm.zoom, "markers": _vm.markers, "selected-marker-id": _vm.selectedMarkerId }, on: { "marker-moved": _vm.handleMarkerMoved, "map-click": _vm.handleMapClick, "marker-click": _vm.handleSelectMarker, "marker-dblclick": _vm.editMarker } }) : _vm._e()], 1)], 1)])]);
|
||
};
|
||
var _sfc_staticRenderFns = [];
|
||
_sfc_render._withStripped = true;
|
||
var __component__ = /* @__PURE__ */ normalizeComponent(
|
||
_sfc_main,
|
||
_sfc_render,
|
||
_sfc_staticRenderFns,
|
||
false,
|
||
null,
|
||
null
|
||
);
|
||
__component__.options.__file = "/Users/adrienpayet/Documents/code/en-cours/geoproject/public/site/plugins/map-editor/src/components/field/MapEditor.vue";
|
||
const MapEditor = __component__.exports;
|
||
window.panel.plugin("geoproject/map-editor", {
|
||
fields: {
|
||
"map-editor": MapEditor
|
||
}
|
||
});
|
||
})();
|