import { getCurrentScope as Gj, onScopeDispose as ZM, unref as vt, getCurrentInstance as G1, onMounted as W1, nextTick as i1, ref as Ie, readonly as $j, watch as on, defineComponent as mr, openBlock as ce, createElementBlock as Ye, createElementVNode as je, warn as het, watchEffect as Wj, onBeforeUnmount as Rs, inject as ln, computed as Kt, isRef as g2, shallowRef as OQ, onBeforeMount as det, provide as $1, mergeProps as el, renderSlot as Pr, toRef as X2, onUnmounted as pet, createBlock as Or, Transition as ad, withCtx as fe, withDirectives as Ti, normalizeClass as Be, normalizeStyle as M1, vShow as zo, Fragment as to, createVNode as Ce, reactive as u3, onActivated as Tet, onUpdated as fet, resolveDynamicComponent as Ss, createCommentVNode as Fr, cloneVNode as Qet, Text as Zj, Comment as met, Teleport as get, onDeactivated as yet, toDisplayString as fi, useSlots as hg, toRaw as Ch, withModifiers as m1, vModelCheckbox as CQ, createTextVNode as xn, toRefs as o0, vModelRadio as qj, h as _7, createSlots as Xj, resolveComponent as xs, resolveDirective as vet, toHandlerKey as _et, renderList as t3, withKeys as su, vModelText as bet, createApp as Let, pushScopeId as qM, popScopeId as XM, createStaticVNode as wet, hasInjectionContext as xet, markRaw as jo, effectScope as Eet, isReactive as KM } from "vue";
import { MapSvgIcon as Met, MapSvgSpriteColor as Het } from "@abi-software/svg-sprite";
import { Tooltip as Aet, TreeControls as Oet, DrawToolbar as Cet } from "@abi-software/map-utilities";
const o4 = (t, e, { checkForDefaultPrevented: r = !0 } = {}) => (i) => {
const o = t == null ? void 0 : t(i);
if (r === !1 || !o)
return e == null ? void 0 : e(i);
};
var ak;
const s1 = typeof window < "u", ket = (t) => typeof t == "string", Kj = () => {
}, ox = s1 && ((ak = window == null ? void 0 : window.navigator) == null ? void 0 : ak.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function YM(t) {
return typeof t == "function" ? t() : vt(t);
}
function Iet(t) {
return t;
}
function ld(t) {
return Gj() ? (ZM(t), !0) : !1;
}
function Pet(t, e = !0) {
G1() ? W1(t) : e ? t() : i1(t);
}
function lk(t, e, r = {}) {
const {
immediate: n = !0
} = r, i = Ie(!1);
let o = null;
function s() {
o && (clearTimeout(o), o = null);
}
function a() {
i.value = !1, s();
}
function u(...d) {
s(), i.value = !0, o = setTimeout(() => {
i.value = !1, o = null, t(...d);
}, YM(e));
}
return n && (i.value = !0, s1 && u()), ld(a), {
isPending: $j(i),
start: u,
stop: a
};
}
function T4(t) {
var e;
const r = YM(t);
return (e = r == null ? void 0 : r.$el) != null ? e : r;
}
const dg = s1 ? window : void 0;
function ea(...t) {
let e, r, n, i;
if (ket(t[0]) || Array.isArray(t[0]) ? ([r, n, i] = t, e = dg) : [e, r, n, i] = t, !e)
return Kj;
Array.isArray(r) || (r = [r]), Array.isArray(n) || (n = [n]);
const o = [], s = () => {
o.forEach((T) => T()), o.length = 0;
}, a = (T, f, Q, y) => (T.addEventListener(f, Q, y), () => T.removeEventListener(f, Q, y)), u = on(() => [T4(e), YM(i)], ([T, f]) => {
s(), T && o.push(...r.flatMap((Q) => n.map((y) => a(T, Q, y, f))));
}, { immediate: !0, flush: "post" }), d = () => {
u(), s();
};
return ld(d), d;
}
let ck = !1;
function Vet(t, e, r = {}) {
const { window: n = dg, ignore: i = [], capture: o = !0, detectIframe: s = !1 } = r;
if (!n)
return;
ox && !ck && (ck = !0, Array.from(n.document.body.children).forEach((Q) => Q.addEventListener("click", Kj)));
let a = !0;
const u = (Q) => i.some((y) => {
if (typeof y == "string")
return Array.from(n.document.querySelectorAll(y)).some((_) => _ === Q.target || Q.composedPath().includes(_));
{
const _ = T4(y);
return _ && (Q.target === _ || Q.composedPath().includes(_));
}
}), T = [
ea(n, "click", (Q) => {
const y = T4(t);
if (!(!y || y === Q.target || Q.composedPath().includes(y))) {
if (Q.detail === 0 && (a = !u(Q)), !a) {
a = !0;
return;
}
e(Q);
}
}, { passive: !0, capture: o }),
ea(n, "pointerdown", (Q) => {
const y = T4(t);
y && (a = !Q.composedPath().includes(y) && !u(Q));
}, { passive: !0 }),
s && ea(n, "blur", (Q) => {
var y;
const _ = T4(t);
((y = n.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !(_ != null && _.contains(n.document.activeElement)) && e(Q);
})
].filter(Boolean);
return () => T.forEach((Q) => Q());
}
function Yj(t, e = !1) {
const r = Ie(), n = () => r.value = !!t();
return n(), Pet(n, e), r;
}
const uk = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, hk = "__vueuse_ssr_handlers__";
uk[hk] = uk[hk] || {};
var dk = Object.getOwnPropertySymbols, Ret = Object.prototype.hasOwnProperty, Net = Object.prototype.propertyIsEnumerable, Det = (t, e) => {
var r = {};
for (var n in t)
Ret.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
if (t != null && dk)
for (var n of dk(t))
e.indexOf(n) < 0 && Net.call(t, n) && (r[n] = t[n]);
return r;
};
function F6(t, e, r = {}) {
const n = r, { window: i = dg } = n, o = Det(n, ["window"]);
let s;
const a = Yj(() => i && "ResizeObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = on(() => T4(t), (f) => {
u(), a.value && i && f && (s = new ResizeObserver(e), s.observe(f, o));
}, { immediate: !0, flush: "post" }), T = () => {
u(), d();
};
return ld(T), {
isSupported: a,
stop: T
};
}
var pk = Object.getOwnPropertySymbols, Fet = Object.prototype.hasOwnProperty, Bet = Object.prototype.propertyIsEnumerable, jet = (t, e) => {
var r = {};
for (var n in t)
Fet.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
if (t != null && pk)
for (var n of pk(t))
e.indexOf(n) < 0 && Bet.call(t, n) && (r[n] = t[n]);
return r;
};
function zet(t, e, r = {}) {
const n = r, { window: i = dg } = n, o = jet(n, ["window"]);
let s;
const a = Yj(() => i && "MutationObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = on(() => T4(t), (f) => {
u(), a.value && i && f && (s = new MutationObserver(e), s.observe(f, o));
}, { immediate: !0 }), T = () => {
u(), d();
};
return ld(T), {
isSupported: a,
stop: T
};
}
var Tk;
(function(t) {
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(Tk || (Tk = {}));
var Uet = Object.defineProperty, fk = Object.getOwnPropertySymbols, Get = Object.prototype.hasOwnProperty, $et = Object.prototype.propertyIsEnumerable, Qk = (t, e, r) => e in t ? Uet(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Wet = (t, e) => {
for (var r in e || (e = {}))
Get.call(e, r) && Qk(t, r, e[r]);
if (fk)
for (var r of fk(e))
$et.call(e, r) && Qk(t, r, e[r]);
return t;
};
const Zet = {
easeInSine: [0.12, 0, 0.39, 0],
easeOutSine: [0.61, 1, 0.88, 1],
easeInOutSine: [0.37, 0, 0.63, 1],
easeInQuad: [0.11, 0, 0.5, 0],
easeOutQuad: [0.5, 1, 0.89, 1],
easeInOutQuad: [0.45, 0, 0.55, 1],
easeInCubic: [0.32, 0, 0.67, 0],
easeOutCubic: [0.33, 1, 0.68, 1],
easeInOutCubic: [0.65, 0, 0.35, 1],
easeInQuart: [0.5, 0, 0.75, 0],
easeOutQuart: [0.25, 1, 0.5, 1],
easeInOutQuart: [0.76, 0, 0.24, 1],
easeInQuint: [0.64, 0, 0.78, 0],
easeOutQuint: [0.22, 1, 0.36, 1],
easeInOutQuint: [0.83, 0, 0.17, 1],
easeInExpo: [0.7, 0, 0.84, 0],
easeOutExpo: [0.16, 1, 0.3, 1],
easeInOutExpo: [0.87, 0, 0.13, 1],
easeInCirc: [0.55, 0, 1, 0.45],
easeOutCirc: [0, 0.55, 0.45, 1],
easeInOutCirc: [0.85, 0, 0.15, 1],
easeInBack: [0.36, 0, 0.66, -0.56],
easeOutBack: [0.34, 1.56, 0.64, 1],
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
Wet({
linear: Iet
}, Zet);
/**
* @vue/shared v3.4.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
process.env.NODE_ENV !== "production" && Object.freeze({});
process.env.NODE_ENV !== "production" && Object.freeze([]);
const O5 = () => {
}, qet = Object.prototype.hasOwnProperty, mk = (t, e) => qet.call(t, e), p2 = Array.isArray, Zo = (t) => typeof t == "function", sa = (t) => typeof t == "string", T2 = (t) => t !== null && typeof t == "object", Xet = Object.prototype.toString, Ket = (t) => Xet.call(t), cb = (t) => Ket(t).slice(8, -1), Jj = (t) => {
const e = /* @__PURE__ */ Object.create(null);
return (r) => e[r] || (e[r] = t(r));
}, Yet = /-(\w)/g, Jet = Jj((t) => t.replace(Yet, (e, r) => r ? r.toUpperCase() : "")), trt = /\B([A-Z])/g, ert = Jj(
(t) => t.replace(trt, "-$1").toLowerCase()
);
var tz = typeof global == "object" && global && global.Object === Object && global, rrt = typeof self == "object" && self && self.Object === Object && self, v3 = tz || rrt || Function("return this")(), h3 = v3.Symbol, ez = Object.prototype, nrt = ez.hasOwnProperty, irt = ez.toString, au = h3 ? h3.toStringTag : void 0;
function ort(t) {
var e = nrt.call(t, au), r = t[au];
try {
t[au] = void 0;
var n = !0;
} catch {
}
var i = irt.call(t);
return n && (e ? t[au] = r : delete t[au]), i;
}
var srt = Object.prototype, art = srt.toString;
function lrt(t) {
return art.call(t);
}
var crt = "[object Null]", urt = "[object Undefined]", gk = h3 ? h3.toStringTag : void 0;
function K8(t) {
return t == null ? t === void 0 ? urt : crt : gk && gk in Object(t) ? ort(t) : lrt(t);
}
function v8(t) {
return t != null && typeof t == "object";
}
var hrt = "[object Symbol]";
function pg(t) {
return typeof t == "symbol" || v8(t) && K8(t) == hrt;
}
function drt(t, e) {
for (var r = -1, n = t == null ? 0 : t.length, i = Array(n); ++r < n; )
i[r] = e(t[r], r, t);
return i;
}
var aa = Array.isArray, prt = 1 / 0, yk = h3 ? h3.prototype : void 0, vk = yk ? yk.toString : void 0;
function rz(t) {
if (typeof t == "string")
return t;
if (aa(t))
return drt(t, rz) + "";
if (pg(t))
return vk ? vk.call(t) : "";
var e = t + "";
return e == "0" && 1 / t == -prt ? "-0" : e;
}
var Trt = /\s/;
function frt(t) {
for (var e = t.length; e-- && Trt.test(t.charAt(e)); )
;
return e;
}
var Qrt = /^\s+/;
function mrt(t) {
return t && t.slice(0, frt(t) + 1).replace(Qrt, "");
}
function s0(t) {
var e = typeof t;
return t != null && (e == "object" || e == "function");
}
var _k = NaN, grt = /^[-+]0x[0-9a-f]+$/i, yrt = /^0b[01]+$/i, vrt = /^0o[0-7]+$/i, _rt = parseInt;
function bk(t) {
if (typeof t == "number")
return t;
if (pg(t))
return _k;
if (s0(t)) {
var e = typeof t.valueOf == "function" ? t.valueOf() : t;
t = s0(e) ? e + "" : e;
}
if (typeof t != "string")
return t === 0 ? t : +t;
t = mrt(t);
var r = yrt.test(t);
return r || vrt.test(t) ? _rt(t.slice(2), r ? 2 : 8) : grt.test(t) ? _k : +t;
}
function nz(t) {
return t;
}
var brt = "[object AsyncFunction]", Lrt = "[object Function]", wrt = "[object GeneratorFunction]", xrt = "[object Proxy]";
function iz(t) {
if (!s0(t))
return !1;
var e = K8(t);
return e == Lrt || e == wrt || e == brt || e == xrt;
}
var ub = v3["__core-js_shared__"], Lk = function() {
var t = /[^.]+$/.exec(ub && ub.keys && ub.keys.IE_PROTO || "");
return t ? "Symbol(src)_1." + t : "";
}();
function Ert(t) {
return !!Lk && Lk in t;
}
var Mrt = Function.prototype, Srt = Mrt.toString;
function rl(t) {
if (t != null) {
try {
return Srt.call(t);
} catch {
}
try {
return t + "";
} catch {
}
}
return "";
}
var Hrt = /[\\^$.*+?()[\]{}|]/g, Art = /^\[object .+?Constructor\]$/, Ort = Function.prototype, Crt = Object.prototype, krt = Ort.toString, Irt = Crt.hasOwnProperty, Prt = RegExp(
"^" + krt.call(Irt).replace(Hrt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Vrt(t) {
if (!s0(t) || Ert(t))
return !1;
var e = iz(t) ? Prt : Art;
return e.test(rl(t));
}
function Rrt(t, e) {
return t == null ? void 0 : t[e];
}
function nl(t, e) {
var r = Rrt(t, e);
return Vrt(r) ? r : void 0;
}
var sx = nl(v3, "WeakMap");
function Nrt(t, e, r) {
switch (r.length) {
case 0:
return t.call(e);
case 1:
return t.call(e, r[0]);
case 2:
return t.call(e, r[0], r[1]);
case 3:
return t.call(e, r[0], r[1], r[2]);
}
return t.apply(e, r);
}
var Drt = 800, Frt = 16, Brt = Date.now;
function jrt(t) {
var e = 0, r = 0;
return function() {
var n = Brt(), i = Frt - (n - r);
if (r = n, i > 0) {
if (++e >= Drt)
return arguments[0];
} else
e = 0;
return t.apply(void 0, arguments);
};
}
function zrt(t) {
return function() {
return t;
};
}
var kQ = function() {
try {
var t = nl(Object, "defineProperty");
return t({}, "", {}), t;
} catch {
}
}(), Urt = kQ ? function(t, e) {
return kQ(t, "toString", {
configurable: !0,
enumerable: !1,
value: zrt(e),
writable: !0
});
} : nz, Grt = jrt(Urt);
function $rt(t, e, r, n) {
t.length;
for (var i = r + 1; i--; )
if (e(t[i], i, t))
return i;
return -1;
}
var Wrt = 9007199254740991, Zrt = /^(?:0|[1-9]\d*)$/;
function JM(t, e) {
var r = typeof t;
return e = e ?? Wrt, !!e && (r == "number" || r != "symbol" && Zrt.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
function qrt(t, e, r) {
e == "__proto__" && kQ ? kQ(t, e, {
configurable: !0,
enumerable: !0,
value: r,
writable: !0
}) : t[e] = r;
}
function tS(t, e) {
return t === e || t !== t && e !== e;
}
var Xrt = Object.prototype, Krt = Xrt.hasOwnProperty;
function Yrt(t, e, r) {
var n = t[e];
(!(Krt.call(t, e) && tS(n, r)) || r === void 0 && !(e in t)) && qrt(t, e, r);
}
var wk = Math.max;
function Jrt(t, e, r) {
return e = wk(e === void 0 ? t.length - 1 : e, 0), function() {
for (var n = arguments, i = -1, o = wk(n.length - e, 0), s = Array(o); ++i < o; )
s[i] = n[e + i];
i = -1;
for (var a = Array(e + 1); ++i < e; )
a[i] = n[i];
return a[e] = r(s), Nrt(t, this, a);
};
}
var tnt = 9007199254740991;
function eS(t) {
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= tnt;
}
function ent(t) {
return t != null && eS(t.length) && !iz(t);
}
var rnt = Object.prototype;
function nnt(t) {
var e = t && t.constructor, r = typeof e == "function" && e.prototype || rnt;
return t === r;
}
function int(t, e) {
for (var r = -1, n = Array(t); ++r < t; )
n[r] = e(r);
return n;
}
var ont = "[object Arguments]";
function xk(t) {
return v8(t) && K8(t) == ont;
}
var oz = Object.prototype, snt = oz.hasOwnProperty, ant = oz.propertyIsEnumerable, rS = xk(/* @__PURE__ */ function() {
return arguments;
}()) ? xk : function(t) {
return v8(t) && snt.call(t, "callee") && !ant.call(t, "callee");
};
function lnt() {
return !1;
}
var sz = typeof exports == "object" && exports && !exports.nodeType && exports, Ek = sz && typeof module == "object" && module && !module.nodeType && module, cnt = Ek && Ek.exports === sz, Mk = cnt ? v3.Buffer : void 0, unt = Mk ? Mk.isBuffer : void 0, ax = unt || lnt, hnt = "[object Arguments]", dnt = "[object Array]", pnt = "[object Boolean]", Tnt = "[object Date]", fnt = "[object Error]", Qnt = "[object Function]", mnt = "[object Map]", gnt = "[object Number]", ynt = "[object Object]", vnt = "[object RegExp]", _nt = "[object Set]", bnt = "[object String]", Lnt = "[object WeakMap]", wnt = "[object ArrayBuffer]", xnt = "[object DataView]", Ent = "[object Float32Array]", Mnt = "[object Float64Array]", Snt = "[object Int8Array]", Hnt = "[object Int16Array]", Ant = "[object Int32Array]", Ont = "[object Uint8Array]", Cnt = "[object Uint8ClampedArray]", knt = "[object Uint16Array]", Int = "[object Uint32Array]", Mi = {};
Mi[Ent] = Mi[Mnt] = Mi[Snt] = Mi[Hnt] = Mi[Ant] = Mi[Ont] = Mi[Cnt] = Mi[knt] = Mi[Int] = !0;
Mi[hnt] = Mi[dnt] = Mi[wnt] = Mi[pnt] = Mi[xnt] = Mi[Tnt] = Mi[fnt] = Mi[Qnt] = Mi[mnt] = Mi[gnt] = Mi[ynt] = Mi[vnt] = Mi[_nt] = Mi[bnt] = Mi[Lnt] = !1;
function Pnt(t) {
return v8(t) && eS(t.length) && !!Mi[K8(t)];
}
function Vnt(t) {
return function(e) {
return t(e);
};
}
var az = typeof exports == "object" && exports && !exports.nodeType && exports, J9 = az && typeof module == "object" && module && !module.nodeType && module, Rnt = J9 && J9.exports === az, hb = Rnt && tz.process, Sk = function() {
try {
var t = J9 && J9.require && J9.require("util").types;
return t || hb && hb.binding && hb.binding("util");
} catch {
}
}(), Hk = Sk && Sk.isTypedArray, lz = Hk ? Vnt(Hk) : Pnt, Nnt = Object.prototype, Dnt = Nnt.hasOwnProperty;
function Fnt(t, e) {
var r = aa(t), n = !r && rS(t), i = !r && !n && ax(t), o = !r && !n && !i && lz(t), s = r || n || i || o, a = s ? int(t.length, String) : [], u = a.length;
for (var d in t)
Dnt.call(t, d) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
(d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
i && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
o && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
JM(d, u))) && a.push(d);
return a;
}
function Bnt(t, e) {
return function(r) {
return t(e(r));
};
}
var jnt = Bnt(Object.keys, Object), znt = Object.prototype, Unt = znt.hasOwnProperty;
function Gnt(t) {
if (!nnt(t))
return jnt(t);
var e = [];
for (var r in Object(t))
Unt.call(t, r) && r != "constructor" && e.push(r);
return e;
}
function cz(t) {
return ent(t) ? Fnt(t) : Gnt(t);
}
var $nt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Wnt = /^\w*$/;
function nS(t, e) {
if (aa(t))
return !1;
var r = typeof t;
return r == "number" || r == "symbol" || r == "boolean" || t == null || pg(t) ? !0 : Wnt.test(t) || !$nt.test(t) || e != null && t in Object(e);
}
var kh = nl(Object, "create");
function Znt() {
this.__data__ = kh ? kh(null) : {}, this.size = 0;
}
function qnt(t) {
var e = this.has(t) && delete this.__data__[t];
return this.size -= e ? 1 : 0, e;
}
var Xnt = "__lodash_hash_undefined__", Knt = Object.prototype, Ynt = Knt.hasOwnProperty;
function Jnt(t) {
var e = this.__data__;
if (kh) {
var r = e[t];
return r === Xnt ? void 0 : r;
}
return Ynt.call(e, t) ? e[t] : void 0;
}
var tit = Object.prototype, eit = tit.hasOwnProperty;
function rit(t) {
var e = this.__data__;
return kh ? e[t] !== void 0 : eit.call(e, t);
}
var nit = "__lodash_hash_undefined__";
function iit(t, e) {
var r = this.__data__;
return this.size += this.has(t) ? 0 : 1, r[t] = kh && e === void 0 ? nit : e, this;
}
function B5(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
B5.prototype.clear = Znt;
B5.prototype.delete = qnt;
B5.prototype.get = Jnt;
B5.prototype.has = rit;
B5.prototype.set = iit;
function oit() {
this.__data__ = [], this.size = 0;
}
function Tg(t, e) {
for (var r = t.length; r--; )
if (tS(t[r][0], e))
return r;
return -1;
}
var sit = Array.prototype, ait = sit.splice;
function lit(t) {
var e = this.__data__, r = Tg(e, t);
if (r < 0)
return !1;
var n = e.length - 1;
return r == n ? e.pop() : ait.call(e, r, 1), --this.size, !0;
}
function cit(t) {
var e = this.__data__, r = Tg(e, t);
return r < 0 ? void 0 : e[r][1];
}
function uit(t) {
return Tg(this.__data__, t) > -1;
}
function hit(t, e) {
var r = this.__data__, n = Tg(r, t);
return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
}
function O4(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
O4.prototype.clear = oit;
O4.prototype.delete = lit;
O4.prototype.get = cit;
O4.prototype.has = uit;
O4.prototype.set = hit;
var Ih = nl(v3, "Map");
function dit() {
this.size = 0, this.__data__ = {
hash: new B5(),
map: new (Ih || O4)(),
string: new B5()
};
}
function pit(t) {
var e = typeof t;
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
}
function fg(t, e) {
var r = t.__data__;
return pit(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
}
function Tit(t) {
var e = fg(this, t).delete(t);
return this.size -= e ? 1 : 0, e;
}
function fit(t) {
return fg(this, t).get(t);
}
function Qit(t) {
return fg(this, t).has(t);
}
function mit(t, e) {
var r = fg(this, t), n = r.size;
return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
}
function C4(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
C4.prototype.clear = dit;
C4.prototype.delete = Tit;
C4.prototype.get = fit;
C4.prototype.has = Qit;
C4.prototype.set = mit;
var git = "Expected a function";
function iS(t, e) {
if (typeof t != "function" || e != null && typeof e != "function")
throw new TypeError(git);
var r = function() {
var n = arguments, i = e ? e.apply(this, n) : n[0], o = r.cache;
if (o.has(i))
return o.get(i);
var s = t.apply(this, n);
return r.cache = o.set(i, s) || o, s;
};
return r.cache = new (iS.Cache || C4)(), r;
}
iS.Cache = C4;
var yit = 500;
function vit(t) {
var e = iS(t, function(n) {
return r.size === yit && r.clear(), n;
}), r = e.cache;
return e;
}
var _it = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, bit = /\\(\\)?/g, Lit = vit(function(t) {
var e = [];
return t.charCodeAt(0) === 46 && e.push(""), t.replace(_it, function(r, n, i, o) {
e.push(i ? o.replace(bit, "$1") : n || r);
}), e;
});
function wit(t) {
return t == null ? "" : rz(t);
}
function Qg(t, e) {
return aa(t) ? t : nS(t, e) ? [t] : Lit(wit(t));
}
var xit = 1 / 0;
function cd(t) {
if (typeof t == "string" || pg(t))
return t;
var e = t + "";
return e == "0" && 1 / t == -xit ? "-0" : e;
}
function oS(t, e) {
e = Qg(e, t);
for (var r = 0, n = e.length; t != null && r < n; )
t = t[cd(e[r++])];
return r && r == n ? t : void 0;
}
function p4(t, e, r) {
var n = t == null ? void 0 : oS(t, e);
return n === void 0 ? r : n;
}
function uz(t, e) {
for (var r = -1, n = e.length, i = t.length; ++r < n; )
t[i + r] = e[r];
return t;
}
var Ak = h3 ? h3.isConcatSpreadable : void 0;
function Eit(t) {
return aa(t) || rS(t) || !!(Ak && t && t[Ak]);
}
function Mit(t, e, r, n, i) {
var o = -1, s = t.length;
for (r || (r = Eit), i || (i = []); ++o < s; ) {
var a = t[o];
r(a) ? uz(i, a) : i[i.length] = a;
}
return i;
}
function Sit(t) {
var e = t == null ? 0 : t.length;
return e ? Mit(t) : [];
}
function Hit(t) {
return Grt(Jrt(t, void 0, Sit), t + "");
}
function $6() {
if (!arguments.length)
return [];
var t = arguments[0];
return aa(t) ? t : [t];
}
function Ait() {
this.__data__ = new O4(), this.size = 0;
}
function Oit(t) {
var e = this.__data__, r = e.delete(t);
return this.size = e.size, r;
}
function Cit(t) {
return this.__data__.get(t);
}
function kit(t) {
return this.__data__.has(t);
}
var Iit = 200;
function Pit(t, e) {
var r = this.__data__;
if (r instanceof O4) {
var n = r.__data__;
if (!Ih || n.length < Iit - 1)
return n.push([t, e]), this.size = ++r.size, this;
r = this.__data__ = new C4(n);
}
return r.set(t, e), this.size = r.size, this;
}
function y4(t) {
var e = this.__data__ = new O4(t);
this.size = e.size;
}
y4.prototype.clear = Ait;
y4.prototype.delete = Oit;
y4.prototype.get = Cit;
y4.prototype.has = kit;
y4.prototype.set = Pit;
function Vit(t, e) {
for (var r = -1, n = t == null ? 0 : t.length, i = 0, o = []; ++r < n; ) {
var s = t[r];
e(s, r, t) && (o[i++] = s);
}
return o;
}
function Rit() {
return [];
}
var Nit = Object.prototype, Dit = Nit.propertyIsEnumerable, Ok = Object.getOwnPropertySymbols, Fit = Ok ? function(t) {
return t == null ? [] : (t = Object(t), Vit(Ok(t), function(e) {
return Dit.call(t, e);
}));
} : Rit;
function Bit(t, e, r) {
var n = e(t);
return aa(t) ? n : uz(n, r(t));
}
function Ck(t) {
return Bit(t, cz, Fit);
}
var lx = nl(v3, "DataView"), cx = nl(v3, "Promise"), ux = nl(v3, "Set"), kk = "[object Map]", jit = "[object Object]", Ik = "[object Promise]", Pk = "[object Set]", Vk = "[object WeakMap]", Rk = "[object DataView]", zit = rl(lx), Uit = rl(Ih), Git = rl(cx), $it = rl(ux), Wit = rl(sx), B6 = K8;
(lx && B6(new lx(new ArrayBuffer(1))) != Rk || Ih && B6(new Ih()) != kk || cx && B6(cx.resolve()) != Ik || ux && B6(new ux()) != Pk || sx && B6(new sx()) != Vk) && (B6 = function(t) {
var e = K8(t), r = e == jit ? t.constructor : void 0, n = r ? rl(r) : "";
if (n)
switch (n) {
case zit:
return Rk;
case Uit:
return kk;
case Git:
return Ik;
case $it:
return Pk;
case Wit:
return Vk;
}
return e;
});
var Nk = v3.Uint8Array, Zit = "__lodash_hash_undefined__";
function qit(t) {
return this.__data__.set(t, Zit), this;
}
function Xit(t) {
return this.__data__.has(t);
}
function IQ(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.__data__ = new C4(); ++e < r; )
this.add(t[e]);
}
IQ.prototype.add = IQ.prototype.push = qit;
IQ.prototype.has = Xit;
function Kit(t, e) {
for (var r = -1, n = t == null ? 0 : t.length; ++r < n; )
if (e(t[r], r, t))
return !0;
return !1;
}
function Yit(t, e) {
return t.has(e);
}
var Jit = 1, t1t = 2;
function hz(t, e, r, n, i, o) {
var s = r & Jit, a = t.length, u = e.length;
if (a != u && !(s && u > a))
return !1;
var d = o.get(t), T = o.get(e);
if (d && T)
return d == e && T == t;
var f = -1, Q = !0, y = r & t1t ? new IQ() : void 0;
for (o.set(t, e), o.set(e, t); ++f < a; ) {
var _ = t[f], L = e[f];
if (n)
var E = s ? n(L, _, f, e, t, o) : n(_, L, f, t, e, o);
if (E !== void 0) {
if (E)
continue;
Q = !1;
break;
}
if (y) {
if (!Kit(e, function(x, O) {
if (!Yit(y, O) && (_ === x || i(_, x, r, n, o)))
return y.push(O);
})) {
Q = !1;
break;
}
} else if (!(_ === L || i(_, L, r, n, o))) {
Q = !1;
break;
}
}
return o.delete(t), o.delete(e), Q;
}
function e1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n, i) {
r[++e] = [i, n];
}), r;
}
function r1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n) {
r[++e] = n;
}), r;
}
var n1t = 1, i1t = 2, o1t = "[object Boolean]", s1t = "[object Date]", a1t = "[object Error]", l1t = "[object Map]", c1t = "[object Number]", u1t = "[object RegExp]", h1t = "[object Set]", d1t = "[object String]", p1t = "[object Symbol]", T1t = "[object ArrayBuffer]", f1t = "[object DataView]", Dk = h3 ? h3.prototype : void 0, db = Dk ? Dk.valueOf : void 0;
function Q1t(t, e, r, n, i, o, s) {
switch (r) {
case f1t:
if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
return !1;
t = t.buffer, e = e.buffer;
case T1t:
return !(t.byteLength != e.byteLength || !o(new Nk(t), new Nk(e)));
case o1t:
case s1t:
case c1t:
return tS(+t, +e);
case a1t:
return t.name == e.name && t.message == e.message;
case u1t:
case d1t:
return t == e + "";
case l1t:
var a = e1t;
case h1t:
var u = n & n1t;
if (a || (a = r1t), t.size != e.size && !u)
return !1;
var d = s.get(t);
if (d)
return d == e;
n |= i1t, s.set(t, e);
var T = hz(a(t), a(e), n, i, o, s);
return s.delete(t), T;
case p1t:
if (db)
return db.call(t) == db.call(e);
}
return !1;
}
var m1t = 1, g1t = Object.prototype, y1t = g1t.hasOwnProperty;
function v1t(t, e, r, n, i, o) {
var s = r & m1t, a = Ck(t), u = a.length, d = Ck(e), T = d.length;
if (u != T && !s)
return !1;
for (var f = u; f--; ) {
var Q = a[f];
if (!(s ? Q in e : y1t.call(e, Q)))
return !1;
}
var y = o.get(t), _ = o.get(e);
if (y && _)
return y == e && _ == t;
var L = !0;
o.set(t, e), o.set(e, t);
for (var E = s; ++f < u; ) {
Q = a[f];
var x = t[Q], O = e[Q];
if (n)
var k = s ? n(O, x, Q, e, t, o) : n(x, O, Q, t, e, o);
if (!(k === void 0 ? x === O || i(x, O, r, n, o) : k)) {
L = !1;
break;
}
E || (E = Q == "constructor");
}
if (L && !E) {
var R = t.constructor, F = e.constructor;
R != F && "constructor" in t && "constructor" in e && !(typeof R == "function" && R instanceof R && typeof F == "function" && F instanceof F) && (L = !1);
}
return o.delete(t), o.delete(e), L;
}
var _1t = 1, Fk = "[object Arguments]", Bk = "[object Array]", Up = "[object Object]", b1t = Object.prototype, jk = b1t.hasOwnProperty;
function L1t(t, e, r, n, i, o) {
var s = aa(t), a = aa(e), u = s ? Bk : B6(t), d = a ? Bk : B6(e);
u = u == Fk ? Up : u, d = d == Fk ? Up : d;
var T = u == Up, f = d == Up, Q = u == d;
if (Q && ax(t)) {
if (!ax(e))
return !1;
s = !0, T = !1;
}
if (Q && !T)
return o || (o = new y4()), s || lz(t) ? hz(t, e, r, n, i, o) : Q1t(t, e, u, r, n, i, o);
if (!(r & _1t)) {
var y = T && jk.call(t, "__wrapped__"), _ = f && jk.call(e, "__wrapped__");
if (y || _) {
var L = y ? t.value() : t, E = _ ? e.value() : e;
return o || (o = new y4()), i(L, E, r, n, o);
}
}
return Q ? (o || (o = new y4()), v1t(t, e, r, n, i, o)) : !1;
}
function mg(t, e, r, n, i) {
return t === e ? !0 : t == null || e == null || !v8(t) && !v8(e) ? t !== t && e !== e : L1t(t, e, r, n, mg, i);
}
var w1t = 1, x1t = 2;
function E1t(t, e, r, n) {
var i = r.length, o = i;
if (t == null)
return !o;
for (t = Object(t); i--; ) {
var s = r[i];
if (s[2] ? s[1] !== t[s[0]] : !(s[0] in t))
return !1;
}
for (; ++i < o; ) {
s = r[i];
var a = s[0], u = t[a], d = s[1];
if (s[2]) {
if (u === void 0 && !(a in t))
return !1;
} else {
var T = new y4(), f;
if (!(f === void 0 ? mg(d, u, w1t | x1t, n, T) : f))
return !1;
}
}
return !0;
}
function dz(t) {
return t === t && !s0(t);
}
function M1t(t) {
for (var e = cz(t), r = e.length; r--; ) {
var n = e[r], i = t[n];
e[r] = [n, i, dz(i)];
}
return e;
}
function pz(t, e) {
return function(r) {
return r == null ? !1 : r[t] === e && (e !== void 0 || t in Object(r));
};
}
function S1t(t) {
var e = M1t(t);
return e.length == 1 && e[0][2] ? pz(e[0][0], e[0][1]) : function(r) {
return r === t || E1t(r, t, e);
};
}
function H1t(t, e) {
return t != null && e in Object(t);
}
function A1t(t, e, r) {
e = Qg(e, t);
for (var n = -1, i = e.length, o = !1; ++n < i; ) {
var s = cd(e[n]);
if (!(o = t != null && r(t, s)))
break;
t = t[s];
}
return o || ++n != i ? o : (i = t == null ? 0 : t.length, !!i && eS(i) && JM(s, i) && (aa(t) || rS(t)));
}
function Tz(t, e) {
return t != null && A1t(t, e, H1t);
}
var O1t = 1, C1t = 2;
function k1t(t, e) {
return nS(t) && dz(e) ? pz(cd(t), e) : function(r) {
var n = p4(r, t);
return n === void 0 && n === e ? Tz(r, t) : mg(e, n, O1t | C1t);
};
}
function I1t(t) {
return function(e) {
return e == null ? void 0 : e[t];
};
}
function P1t(t) {
return function(e) {
return oS(e, t);
};
}
function V1t(t) {
return nS(t) ? I1t(cd(t)) : P1t(t);
}
function R1t(t) {
return typeof t == "function" ? t : t == null ? nz : typeof t == "object" ? aa(t) ? k1t(t[0], t[1]) : S1t(t) : V1t(t);
}
var pb = function() {
return v3.Date.now();
}, N1t = "Expected a function", D1t = Math.max, F1t = Math.min;
function B1t(t, e, r) {
var n, i, o, s, a, u, d = 0, T = !1, f = !1, Q = !0;
if (typeof t != "function")
throw new TypeError(N1t);
e = bk(e) || 0, s0(r) && (T = !!r.leading, f = "maxWait" in r, o = f ? D1t(bk(r.maxWait) || 0, e) : o, Q = "trailing" in r ? !!r.trailing : Q);
function y(U) {
var $ = n, et = i;
return n = i = void 0, d = U, s = t.apply(et, $), s;
}
function _(U) {
return d = U, a = setTimeout(x, e), T ? y(U) : s;
}
function L(U) {
var $ = U - u, et = U - d, nt = e - $;
return f ? F1t(nt, o - et) : nt;
}
function E(U) {
var $ = U - u, et = U - d;
return u === void 0 || $ >= e || $ < 0 || f && et >= o;
}
function x() {
var U = pb();
if (E(U))
return O(U);
a = setTimeout(x, L(U));
}
function O(U) {
return a = void 0, Q && n ? y(U) : (n = i = void 0, s);
}
function k() {
a !== void 0 && clearTimeout(a), d = 0, n = u = i = a = void 0;
}
function R() {
return a === void 0 ? s : O(pb());
}
function F() {
var U = pb(), $ = E(U);
if (n = arguments, i = this, u = U, $) {
if (a === void 0)
return _(u);
if (f)
return clearTimeout(a), a = setTimeout(x, e), y(u);
}
return a === void 0 && (a = setTimeout(x, e)), s;
}
return F.cancel = k, F.flush = R, F;
}
function j1t(t, e, r) {
var n = t == null ? 0 : t.length;
if (!n)
return -1;
var i = n - 1;
return $rt(t, R1t(e), i);
}
function hx(t) {
for (var e = -1, r = t == null ? 0 : t.length, n = {}; ++e < r; ) {
var i = t[e];
n[i[0]] = i[1];
}
return n;
}
function PQ(t, e) {
return mg(t, e);
}
function gg(t) {
return t == null;
}
function fz(t) {
return t === void 0;
}
function z1t(t, e, r, n) {
if (!s0(t))
return t;
e = Qg(e, t);
for (var i = -1, o = e.length, s = o - 1, a = t; a != null && ++i < o; ) {
var u = cd(e[i]), d = r;
if (u === "__proto__" || u === "constructor" || u === "prototype")
return t;
if (i != s) {
var T = a[u];
d = void 0, d === void 0 && (d = s0(T) ? T : JM(e[i + 1]) ? [] : {});
}
Yrt(a, u, d), a = a[u];
}
return t;
}
function U1t(t, e, r) {
for (var n = -1, i = e.length, o = {}; ++n < i; ) {
var s = e[n], a = oS(t, s);
r(a, s) && z1t(o, Qg(s, t), a);
}
return o;
}
function G1t(t, e) {
return U1t(t, e, function(r, n) {
return Tz(t, n);
});
}
var Qz = Hit(function(t, e) {
return t == null ? {} : G1t(t, e);
});
const Z6 = (t) => t === void 0, M4 = (t) => typeof t == "boolean", ro = (t) => typeof t == "number", C5 = (t) => typeof Element > "u" ? !1 : t instanceof Element, Ph = (t) => gg(t), $1t = (t) => sa(t) ? !Number.isNaN(Number(t)) : !1, W1t = (t = "") => t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), zk = (t) => Object.keys(t);
class mz extends Error {
constructor(e) {
super(e), this.name = "ElementPlusError";
}
}
function gz(t, e) {
throw new mz(`[${t}] ${e}`);
}
function y2(t, e) {
if (process.env.NODE_ENV !== "production") {
const r = sa(t) ? new mz(`[${t}] ${e}`) : t;
console.warn(r);
}
}
const Z1t = "utils/dom/style", yz = (t = "") => t.split(" ").filter((e) => !!e.trim()), Uk = (t, e) => {
if (!t || !e)
return !1;
if (e.includes(" "))
throw new Error("className should not contain space.");
return t.classList.contains(e);
}, dx = (t, e) => {
!t || !e.trim() || t.classList.add(...yz(e));
}, Vh = (t, e) => {
!t || !e.trim() || t.classList.remove(...yz(e));
}, b7 = (t, e) => {
var r;
if (!s1 || !t || !e)
return "";
let n = Jet(e);
n === "float" && (n = "cssFloat");
try {
const i = t.style[n];
if (i)
return i;
const o = (r = document.defaultView) == null ? void 0 : r.getComputedStyle(t, "");
return o ? o[n] : "";
} catch {
return t.style[n];
}
};
function j5(t, e = "px") {
if (!t)
return "";
if (ro(t) || $1t(t))
return `${t}${e}`;
if (sa(t))
return t;
y2(Z1t, "binding value must be a string or number");
}
let Gp;
const q1t = (t) => {
var e;
if (!s1)
return 0;
if (Gp !== void 0)
return Gp;
const r = document.createElement("div");
r.className = `${t}-scrollbar__wrap`, r.style.visibility = "hidden", r.style.width = "100px", r.style.position = "absolute", r.style.top = "-9999px", document.body.appendChild(r);
const n = r.offsetWidth;
r.style.overflow = "scroll";
const i = document.createElement("div");
i.style.width = "100%", r.appendChild(i);
const o = i.offsetWidth;
return (e = r.parentNode) == null || e.removeChild(r), Gp = n - o, Gp;
};
function X1t(t, e) {
if (!s1)
return;
if (!e) {
t.scrollTop = 0;
return;
}
const r = [];
let n = e.offsetParent;
for (; n !== null && t !== n && t.contains(n); )
r.push(n), n = n.offsetParent;
const i = e.offsetTop + r.reduce((u, d) => u + d.offsetTop, 0), o = i + e.offsetHeight, s = t.scrollTop, a = s + t.clientHeight;
i < s ? t.scrollTop = i : o > a && (t.scrollTop = o - t.clientHeight);
}
/*! Element Plus Icons Vue v2.3.1 */
var K1t = /* @__PURE__ */ mr({
name: "ArrowDown",
__name: "arrow-down",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
})
]));
}
}), sS = K1t, Y1t = /* @__PURE__ */ mr({
name: "ArrowLeft",
__name: "arrow-left",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
})
]));
}
}), vz = Y1t, J1t = /* @__PURE__ */ mr({
name: "CircleCheck",
__name: "circle-check",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
}),
je("path", {
fill: "currentColor",
d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
})
]));
}
}), tot = J1t, eot = /* @__PURE__ */ mr({
name: "CircleClose",
__name: "circle-close",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
}),
je("path", {
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
})
]));
}
}), _z = eot, rot = /* @__PURE__ */ mr({
name: "Close",
__name: "close",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
})
]));
}
}), px = rot, not = /* @__PURE__ */ mr({
name: "Loading",
__name: "loading",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
})
]));
}
}), bz = not, iot = /* @__PURE__ */ mr({
name: "WarningFilled",
__name: "warning-filled",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
})
]));
}
}), Lz = iot, oot = /* @__PURE__ */ mr({
name: "Warning",
__name: "warning",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
})
]));
}
}), wz = oot;
const xz = "__epPropKey", Gr = (t) => t, sot = (t) => T2(t) && !!t[xz], yg = (t, e) => {
if (!T2(t) || sot(t))
return t;
const { values: r, required: n, default: i, type: o, validator: s } = t, u = {
type: o,
required: !!n,
validator: r || s ? (d) => {
let T = !1, f = [];
if (r && (f = Array.from(r), mk(t, "default") && f.push(i), T || (T = f.includes(d))), s && (T || (T = s(d))), !T && f.length > 0) {
const Q = [...new Set(f)].map((y) => JSON.stringify(y)).join(", ");
het(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${Q}], got value ${JSON.stringify(d)}.`);
}
return T;
} : void 0,
[xz]: !0
};
return mk(t, "default") && (u.default = i), u;
}, Sn = (t) => hx(Object.entries(t).map(([e, r]) => [
e,
yg(r, e)
])), _8 = Gr([
String,
Object,
Function
]), aot = {
Close: px
}, lot = {
validating: bz,
success: tot,
error: _z
}, v2 = (t, e) => {
if (t.install = (r) => {
for (const n of [t, ...Object.values(e ?? {})])
r.component(n.name, n);
}, e)
for (const [r, n] of Object.entries(e))
t[r] = n;
return t;
}, cot = (t, e) => (t.install = (r) => {
r.directive(e, t);
}, t), il = (t) => (t.install = O5, t), uot = (...t) => (e) => {
t.forEach((r) => {
Zo(r) ? r(e) : r.value = e;
});
}, Rh = {
tab: "Tab",
enter: "Enter",
space: "Space",
left: "ArrowLeft",
up: "ArrowUp",
right: "ArrowRight",
down: "ArrowDown",
esc: "Escape",
delete: "Delete",
backspace: "Backspace",
numpadEnter: "NumpadEnter",
pageUp: "PageUp",
pageDown: "PageDown",
home: "Home",
end: "End"
}, Wo = "update:modelValue", aS = "change", Ez = ["", "default", "small", "large"];
var pf = /* @__PURE__ */ ((t) => (t[t.TEXT = 1] = "TEXT", t[t.CLASS = 2] = "CLASS", t[t.STYLE = 4] = "STYLE", t[t.PROPS = 8] = "PROPS", t[t.FULL_PROPS = 16] = "FULL_PROPS", t[t.HYDRATE_EVENTS = 32] = "HYDRATE_EVENTS", t[t.STABLE_FRAGMENT = 64] = "STABLE_FRAGMENT", t[t.KEYED_FRAGMENT = 128] = "KEYED_FRAGMENT", t[t.UNKEYED_FRAGMENT = 256] = "UNKEYED_FRAGMENT", t[t.NEED_PATCH = 512] = "NEED_PATCH", t[t.DYNAMIC_SLOTS = 1024] = "DYNAMIC_SLOTS", t[t.HOISTED = -1] = "HOISTED", t[t.BAIL = -2] = "BAIL", t))(pf || {});
const hot = (t) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(t), lu = (t) => t, u8 = ({ from: t, replacement: e, scope: r, version: n, ref: i, type: o = "API" }, s) => {
on(() => vt(s), (a) => {
a && y2(r, `[${o}] ${t} is about to be deprecated in version ${n}, please use ${e} instead.
For more detail, please visit: ${i}
`);
}, {
immediate: !0
});
}, dot = (t, e, r, n) => {
let i = {
offsetX: 0,
offsetY: 0
};
const o = (d) => {
const T = d.clientX, f = d.clientY, { offsetX: Q, offsetY: y } = i, _ = t.value.getBoundingClientRect(), L = _.left, E = _.top, x = _.width, O = _.height, k = document.documentElement.clientWidth, R = document.documentElement.clientHeight, F = -L + Q, U = -E + y, $ = k - L - x + Q, et = R - E - O + y, nt = (rt) => {
let gt = Q + rt.clientX - T, It = y + rt.clientY - f;
n != null && n.value || (gt = Math.min(Math.max(gt, F), $), It = Math.min(Math.max(It, U), et)), i = {
offsetX: gt,
offsetY: It
}, t.value && (t.value.style.transform = `translate(${j5(gt)}, ${j5(It)})`);
}, ct = () => {
document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", ct);
};
document.addEventListener("mousemove", nt), document.addEventListener("mouseup", ct);
}, s = () => {
e.value && t.value && e.value.addEventListener("mousedown", o);
}, a = () => {
e.value && t.value && e.value.removeEventListener("mousedown", o);
}, u = () => {
i = {
offsetX: 0,
offsetY: 0
}, t.value && (t.value.style.transform = "none");
};
return W1(() => {
Wj(() => {
r.value ? s() : a();
});
}), Rs(() => {
a();
}), {
resetPosition: u
};
};
var pot = {
name: "en",
el: {
breadcrumb: {
label: "Breadcrumb"
},
colorpicker: {
confirm: "OK",
clear: "Clear",
defaultLabel: "color picker",
description: "current color is {color}. press enter to select a new color.",
alphaLabel: "pick alpha value"
},
datepicker: {
now: "Now",
today: "Today",
cancel: "Cancel",
clear: "Clear",
confirm: "OK",
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
monthTablePrompt: "Use the arrow keys and enter to select the month",
yearTablePrompt: "Use the arrow keys and enter to select the year",
selectedDate: "Selected date",
selectDate: "Select date",
selectTime: "Select time",
startDate: "Start Date",
startTime: "Start Time",
endDate: "End Date",
endTime: "End Time",
prevYear: "Previous Year",
nextYear: "Next Year",
prevMonth: "Previous Month",
nextMonth: "Next Month",
year: "",
month1: "January",
month2: "February",
month3: "March",
month4: "April",
month5: "May",
month6: "June",
month7: "July",
month8: "August",
month9: "September",
month10: "October",
month11: "November",
month12: "December",
week: "week",
weeks: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
weeksFull: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
},
months: {
jan: "Jan",
feb: "Feb",
mar: "Mar",
apr: "Apr",
may: "May",
jun: "Jun",
jul: "Jul",
aug: "Aug",
sep: "Sep",
oct: "Oct",
nov: "Nov",
dec: "Dec"
}
},
inputNumber: {
decrease: "decrease number",
increase: "increase number"
},
select: {
loading: "Loading",
noMatch: "No matching data",
noData: "No data",
placeholder: "Select"
},
mention: {
loading: "Loading"
},
dropdown: {
toggleDropdown: "Toggle Dropdown"
},
cascader: {
noMatch: "No matching data",
loading: "Loading",
placeholder: "Select",
noData: "No data"
},
pagination: {
goto: "Go to",
pagesize: "/page",
total: "Total {total}",
pageClassifier: "",
page: "Page",
prev: "Go to previous page",
next: "Go to next page",
currentPage: "page {pager}",
prevPages: "Previous {pager} pages",
nextPages: "Next {pager} pages",
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
},
dialog: {
close: "Close this dialog"
},
drawer: {
close: "Close this dialog"
},
messagebox: {
title: "Message",
confirm: "OK",
cancel: "Cancel",
error: "Illegal input",
close: "Close this dialog"
},
upload: {
deleteTip: "press delete to remove",
delete: "Delete",
preview: "Preview",
continue: "Continue"
},
slider: {
defaultLabel: "slider between {min} and {max}",
defaultRangeStartLabel: "pick start value",
defaultRangeEndLabel: "pick end value"
},
table: {
emptyText: "No Data",
confirmFilter: "Confirm",
resetFilter: "Reset",
clearFilter: "All",
sumText: "Sum"
},
tour: {
next: "Next",
previous: "Previous",
finish: "Finish"
},
tree: {
emptyText: "No Data"
},
transfer: {
noMatch: "No matching data",
noData: "No data",
titles: ["List 1", "List 2"],
filterPlaceholder: "Enter keyword",
noCheckedFormat: "{total} items",
hasCheckedFormat: "{checked}/{total} checked"
},
image: {
error: "FAILED"
},
pageHeader: {
title: "Back"
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No"
},
carousel: {
leftArrow: "Carousel arrow left",
rightArrow: "Carousel arrow right",
indicator: "Carousel switch to index {index}"
}
}
};
const Tot = (t) => (e, r) => fot(e, r, vt(t)), fot = (t, e, r) => p4(r, t, t).replace(/\{(\w+)\}/g, (n, i) => {
var o;
return `${(o = e == null ? void 0 : e[i]) != null ? o : `{${i}}`}`;
}), Qot = (t) => {
const e = Kt(() => vt(t).name), r = g2(t) ? t : Ie(t);
return {
lang: e,
locale: r,
t: Tot(t)
};
}, Mz = Symbol("localeContextKey"), lS = (t) => {
const e = t || ln(Mz, Ie());
return Qot(Kt(() => e.value || pot));
}, th = "el", mot = "is-", U0 = (t, e, r, n, i) => {
let o = `${t}-${e}`;
return r && (o += `-${r}`), n && (o += `__${n}`), i && (o += `--${i}`), o;
}, Sz = Symbol("namespaceContextKey"), cS = (t) => {
const e = t || (G1() ? ln(Sz, Ie(th)) : Ie(th));
return Kt(() => vt(e) || th);
}, Bn = (t, e) => {
const r = cS(e);
return {
namespace: r,
b: (L = "") => U0(r.value, t, L, "", ""),
e: (L) => L ? U0(r.value, t, "", L, "") : "",
m: (L) => L ? U0(r.value, t, "", "", L) : "",
be: (L, E) => L && E ? U0(r.value, t, L, E, "") : "",
em: (L, E) => L && E ? U0(r.value, t, "", L, E) : "",
bm: (L, E) => L && E ? U0(r.value, t, L, "", E) : "",
bem: (L, E, x) => L && E && x ? U0(r.value, t, L, E, x) : "",
is: (L, ...E) => {
const x = E.length >= 1 ? E[0] : !0;
return L && x ? `${mot}${L}` : "";
},
cssVar: (L) => {
const E = {};
for (const x in L)
L[x] && (E[`--${r.value}-${x}`] = L[x]);
return E;
},
cssVarName: (L) => `--${r.value}-${L}`,
cssVarBlock: (L) => {
const E = {};
for (const x in L)
L[x] && (E[`--${r.value}-${t}-${x}`] = L[x]);
return E;
},
cssVarBlockName: (L) => `--${r.value}-${t}-${L}`
};
}, got = (t, e = {}) => {
g2(t) || gz("[useLockscreen]", "You need to pass a ref param to this function");
const r = e.ns || Bn("popup"), n = Kt(() => r.bm("parent", "hidden"));
if (!s1 || Uk(document.body, n.value))
return;
let i = 0, o = !1, s = "0";
const a = () => {
setTimeout(() => {
Vh(document == null ? void 0 : document.body, n.value), o && document && (document.body.style.width = s);
}, 200);
};
on(t, (u) => {
if (!u) {
a();
return;
}
o = !Uk(document.body, n.value), o && (s = document.body.style.width), i = q1t(r.namespace.value);
const d = document.documentElement.clientHeight < document.body.scrollHeight, T = b7(document.body, "overflowY");
i > 0 && (d || T === "scroll") && o && (document.body.style.width = `calc(100% - ${i}px)`), dx(document.body, n.value);
}), ZM(() => a());
}, yot = yg({
type: Gr(Boolean),
default: null
}), vot = yg({
type: Gr(Function)
}), _ot = (t) => {
const e = `update:${t}`, r = `onUpdate:${t}`, n = [e], i = {
[t]: yot,
[r]: vot
};
return {
useModelToggle: ({
indicator: s,
toggleReason: a,
shouldHideWhenRouteChanges: u,
shouldProceed: d,
onShow: T,
onHide: f
}) => {
const Q = G1(), { emit: y } = Q, _ = Q.props, L = Kt(() => Zo(_[r])), E = Kt(() => _[t] === null), x = ($) => {
s.value !== !0 && (s.value = !0, a && (a.value = $), Zo(T) && T($));
}, O = ($) => {
s.value !== !1 && (s.value = !1, a && (a.value = $), Zo(f) && f($));
}, k = ($) => {
if (_.disabled === !0 || Zo(d) && !d())
return;
const et = L.value && s1;
et && y(e, !0), (E.value || !et) && x($);
}, R = ($) => {
if (_.disabled === !0 || !s1)
return;
const et = L.value && s1;
et && y(e, !1), (E.value || !et) && O($);
}, F = ($) => {
M4($) && (_.disabled && $ ? L.value && y(e, !1) : s.value !== $ && ($ ? x() : O()));
}, U = () => {
s.value ? R() : k();
};
return on(() => _[t], F), u && Q.appContext.config.globalProperties.$route !== void 0 && on(() => ({
...Q.proxy.$route
}), () => {
u.value && s.value && R();
}), W1(() => {
F(_[t]);
}), {
hide: R,
show: k,
toggle: U,
hasUpdateHandler: L
};
},
useModelToggleProps: i,
useModelToggleEmits: n
};
}, Hz = (t) => {
const e = G1();
return Kt(() => {
var r, n;
return (n = (r = e == null ? void 0 : e.proxy) == null ? void 0 : r.$props) == null ? void 0 : n[t];
});
};
var Q2 = "top", ks = "bottom", Is = "right", m2 = "left", uS = "auto", ud = [Q2, ks, Is, m2], b8 = "start", Nh = "end", bot = "clippingParents", Az = "viewport", cu = "popper", Lot = "reference", Gk = ud.reduce(function(t, e) {
return t.concat([e + "-" + b8, e + "-" + Nh]);
}, []), vg = [].concat(ud, [uS]).reduce(function(t, e) {
return t.concat([e, e + "-" + b8, e + "-" + Nh]);
}, []), wot = "beforeRead", xot = "read", Eot = "afterRead", Mot = "beforeMain", Sot = "main", Hot = "afterMain", Aot = "beforeWrite", Oot = "write", Cot = "afterWrite", kot = [wot, xot, Eot, Mot, Sot, Hot, Aot, Oot, Cot];
function d3(t) {
return t ? (t.nodeName || "").toLowerCase() : null;
}
function ha(t) {
if (t == null) return window;
if (t.toString() !== "[object Window]") {
var e = t.ownerDocument;
return e && e.defaultView || window;
}
return t;
}
function L8(t) {
var e = ha(t).Element;
return t instanceof e || t instanceof Element;
}
function Hs(t) {
var e = ha(t).HTMLElement;
return t instanceof e || t instanceof HTMLElement;
}
function hS(t) {
if (typeof ShadowRoot > "u") return !1;
var e = ha(t).ShadowRoot;
return t instanceof e || t instanceof ShadowRoot;
}
function Iot(t) {
var e = t.state;
Object.keys(e.elements).forEach(function(r) {
var n = e.styles[r] || {}, i = e.attributes[r] || {}, o = e.elements[r];
!Hs(o) || !d3(o) || (Object.assign(o.style, n), Object.keys(i).forEach(function(s) {
var a = i[s];
a === !1 ? o.removeAttribute(s) : o.setAttribute(s, a === !0 ? "" : a);
}));
});
}
function Pot(t) {
var e = t.state, r = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
return Object.assign(e.elements.popper.style, r.popper), e.styles = r, e.elements.arrow && Object.assign(e.elements.arrow.style, r.arrow), function() {
Object.keys(e.elements).forEach(function(n) {
var i = e.elements[n], o = e.attributes[n] || {}, s = Object.keys(e.styles.hasOwnProperty(n) ? e.styles[n] : r[n]), a = s.reduce(function(u, d) {
return u[d] = "", u;
}, {});
!Hs(i) || !d3(i) || (Object.assign(i.style, a), Object.keys(o).forEach(function(u) {
i.removeAttribute(u);
}));
});
};
}
var Oz = { name: "applyStyles", enabled: !0, phase: "write", fn: Iot, effect: Pot, requires: ["computeStyles"] };
function o3(t) {
return t.split("-")[0];
}
var k5 = Math.max, VQ = Math.min, w8 = Math.round;
function x8(t, e) {
e === void 0 && (e = !1);
var r = t.getBoundingClientRect(), n = 1, i = 1;
if (Hs(t) && e) {
var o = t.offsetHeight, s = t.offsetWidth;
s > 0 && (n = w8(r.width) / s || 1), o > 0 && (i = w8(r.height) / o || 1);
}
return { width: r.width / n, height: r.height / i, top: r.top / i, right: r.right / n, bottom: r.bottom / i, left: r.left / n, x: r.left / n, y: r.top / i };
}
function dS(t) {
var e = x8(t), r = t.offsetWidth, n = t.offsetHeight;
return Math.abs(e.width - r) <= 1 && (r = e.width), Math.abs(e.height - n) <= 1 && (n = e.height), { x: t.offsetLeft, y: t.offsetTop, width: r, height: n };
}
function Cz(t, e) {
var r = e.getRootNode && e.getRootNode();
if (t.contains(e)) return !0;
if (r && hS(r)) {
var n = e;
do {
if (n && t.isSameNode(n)) return !0;
n = n.parentNode || n.host;
} while (n);
}
return !1;
}
function S4(t) {
return ha(t).getComputedStyle(t);
}
function Vot(t) {
return ["table", "td", "th"].indexOf(d3(t)) >= 0;
}
function h0(t) {
return ((L8(t) ? t.ownerDocument : t.document) || window.document).documentElement;
}
function _g(t) {
return d3(t) === "html" ? t : t.assignedSlot || t.parentNode || (hS(t) ? t.host : null) || h0(t);
}
function $k(t) {
return !Hs(t) || S4(t).position === "fixed" ? null : t.offsetParent;
}
function Rot(t) {
var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, r = navigator.userAgent.indexOf("Trident") !== -1;
if (r && Hs(t)) {
var n = S4(t);
if (n.position === "fixed") return null;
}
var i = _g(t);
for (hS(i) && (i = i.host); Hs(i) && ["html", "body"].indexOf(d3(i)) < 0; ) {
var o = S4(i);
if (o.transform !== "none" || o.perspective !== "none" || o.contain === "paint" || ["transform", "perspective"].indexOf(o.willChange) !== -1 || e && o.willChange === "filter" || e && o.filter && o.filter !== "none") return i;
i = i.parentNode;
}
return null;
}
function hd(t) {
for (var e = ha(t), r = $k(t); r && Vot(r) && S4(r).position === "static"; ) r = $k(r);
return r && (d3(r) === "html" || d3(r) === "body" && S4(r).position === "static") ? e : r || Rot(t) || e;
}
function pS(t) {
return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
}
function eh(t, e, r) {
return k5(t, VQ(e, r));
}
function Not(t, e, r) {
var n = eh(t, e, r);
return n > r ? r : n;
}
function kz() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function Iz(t) {
return Object.assign({}, kz(), t);
}
function Pz(t, e) {
return e.reduce(function(r, n) {
return r[n] = t, r;
}, {});
}
var Dot = function(t, e) {
return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, Iz(typeof t != "number" ? t : Pz(t, ud));
};
function Fot(t) {
var e, r = t.state, n = t.name, i = t.options, o = r.elements.arrow, s = r.modifiersData.popperOffsets, a = o3(r.placement), u = pS(a), d = [m2, Is].indexOf(a) >= 0, T = d ? "height" : "width";
if (!(!o || !s)) {
var f = Dot(i.padding, r), Q = dS(o), y = u === "y" ? Q2 : m2, _ = u === "y" ? ks : Is, L = r.rects.reference[T] + r.rects.reference[u] - s[u] - r.rects.popper[T], E = s[u] - r.rects.reference[u], x = hd(o), O = x ? u === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, k = L / 2 - E / 2, R = f[y], F = O - Q[T] - f[_], U = O / 2 - Q[T] / 2 + k, $ = eh(R, U, F), et = u;
r.modifiersData[n] = (e = {}, e[et] = $, e.centerOffset = $ - U, e);
}
}
function Bot(t) {
var e = t.state, r = t.options, n = r.element, i = n === void 0 ? "[data-popper-arrow]" : n;
i != null && (typeof i == "string" && (i = e.elements.popper.querySelector(i), !i) || !Cz(e.elements.popper, i) || (e.elements.arrow = i));
}
var jot = { name: "arrow", enabled: !0, phase: "main", fn: Fot, effect: Bot, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function E8(t) {
return t.split("-")[1];
}
var zot = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function Uot(t) {
var e = t.x, r = t.y, n = window, i = n.devicePixelRatio || 1;
return { x: w8(e * i) / i || 0, y: w8(r * i) / i || 0 };
}
function Wk(t) {
var e, r = t.popper, n = t.popperRect, i = t.placement, o = t.variation, s = t.offsets, a = t.position, u = t.gpuAcceleration, d = t.adaptive, T = t.roundOffsets, f = t.isFixed, Q = s.x, y = Q === void 0 ? 0 : Q, _ = s.y, L = _ === void 0 ? 0 : _, E = typeof T == "function" ? T({ x: y, y: L }) : { x: y, y: L };
y = E.x, L = E.y;
var x = s.hasOwnProperty("x"), O = s.hasOwnProperty("y"), k = m2, R = Q2, F = window;
if (d) {
var U = hd(r), $ = "clientHeight", et = "clientWidth";
if (U === ha(r) && (U = h0(r), S4(U).position !== "static" && a === "absolute" && ($ = "scrollHeight", et = "scrollWidth")), U = U, i === Q2 || (i === m2 || i === Is) && o === Nh) {
R = ks;
var nt = f && U === F && F.visualViewport ? F.visualViewport.height : U[$];
L -= nt - n.height, L *= u ? 1 : -1;
}
if (i === m2 || (i === Q2 || i === ks) && o === Nh) {
k = Is;
var ct = f && U === F && F.visualViewport ? F.visualViewport.width : U[et];
y -= ct - n.width, y *= u ? 1 : -1;
}
}
var rt = Object.assign({ position: a }, d && zot), gt = T === !0 ? Uot({ x: y, y: L }) : { x: y, y: L };
if (y = gt.x, L = gt.y, u) {
var It;
return Object.assign({}, rt, (It = {}, It[R] = O ? "0" : "", It[k] = x ? "0" : "", It.transform = (F.devicePixelRatio || 1) <= 1 ? "translate(" + y + "px, " + L + "px)" : "translate3d(" + y + "px, " + L + "px, 0)", It));
}
return Object.assign({}, rt, (e = {}, e[R] = O ? L + "px" : "", e[k] = x ? y + "px" : "", e.transform = "", e));
}
function Got(t) {
var e = t.state, r = t.options, n = r.gpuAcceleration, i = n === void 0 ? !0 : n, o = r.adaptive, s = o === void 0 ? !0 : o, a = r.roundOffsets, u = a === void 0 ? !0 : a, d = { placement: o3(e.placement), variation: E8(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: i, isFixed: e.options.strategy === "fixed" };
e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Wk(Object.assign({}, d, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: s, roundOffsets: u })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Wk(Object.assign({}, d, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: u })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var Vz = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: Got, data: {} }, $p = { passive: !0 };
function $ot(t) {
var e = t.state, r = t.instance, n = t.options, i = n.scroll, o = i === void 0 ? !0 : i, s = n.resize, a = s === void 0 ? !0 : s, u = ha(e.elements.popper), d = [].concat(e.scrollParents.reference, e.scrollParents.popper);
return o && d.forEach(function(T) {
T.addEventListener("scroll", r.update, $p);
}), a && u.addEventListener("resize", r.update, $p), function() {
o && d.forEach(function(T) {
T.removeEventListener("scroll", r.update, $p);
}), a && u.removeEventListener("resize", r.update, $p);
};
}
var Rz = { name: "eventListeners", enabled: !0, phase: "write", fn: function() {
}, effect: $ot, data: {} }, Wot = { left: "right", right: "left", bottom: "top", top: "bottom" };
function Tf(t) {
return t.replace(/left|right|bottom|top/g, function(e) {
return Wot[e];
});
}
var Zot = { start: "end", end: "start" };
function Zk(t) {
return t.replace(/start|end/g, function(e) {
return Zot[e];
});
}
function TS(t) {
var e = ha(t), r = e.pageXOffset, n = e.pageYOffset;
return { scrollLeft: r, scrollTop: n };
}
function fS(t) {
return x8(h0(t)).left + TS(t).scrollLeft;
}
function qot(t) {
var e = ha(t), r = h0(t), n = e.visualViewport, i = r.clientWidth, o = r.clientHeight, s = 0, a = 0;
return n && (i = n.width, o = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (s = n.offsetLeft, a = n.offsetTop)), { width: i, height: o, x: s + fS(t), y: a };
}
function Xot(t) {
var e, r = h0(t), n = TS(t), i = (e = t.ownerDocument) == null ? void 0 : e.body, o = k5(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = k5(r.scrollHeight, r.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), a = -n.scrollLeft + fS(t), u = -n.scrollTop;
return S4(i || r).direction === "rtl" && (a += k5(r.clientWidth, i ? i.clientWidth : 0) - o), { width: o, height: s, x: a, y: u };
}
function QS(t) {
var e = S4(t), r = e.overflow, n = e.overflowX, i = e.overflowY;
return /auto|scroll|overlay|hidden/.test(r + i + n);
}
function Nz(t) {
return ["html", "body", "#document"].indexOf(d3(t)) >= 0 ? t.ownerDocument.body : Hs(t) && QS(t) ? t : Nz(_g(t));
}
function rh(t, e) {
var r;
e === void 0 && (e = []);
var n = Nz(t), i = n === ((r = t.ownerDocument) == null ? void 0 : r.body), o = ha(n), s = i ? [o].concat(o.visualViewport || [], QS(n) ? n : []) : n, a = e.concat(s);
return i ? a : a.concat(rh(_g(s)));
}
function Tx(t) {
return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height });
}
function Kot(t) {
var e = x8(t);
return e.top = e.top + t.clientTop, e.left = e.left + t.clientLeft, e.bottom = e.top + t.clientHeight, e.right = e.left + t.clientWidth, e.width = t.clientWidth, e.height = t.clientHeight, e.x = e.left, e.y = e.top, e;
}
function qk(t, e) {
return e === Az ? Tx(qot(t)) : L8(e) ? Kot(e) : Tx(Xot(h0(t)));
}
function Yot(t) {
var e = rh(_g(t)), r = ["absolute", "fixed"].indexOf(S4(t).position) >= 0, n = r && Hs(t) ? hd(t) : t;
return L8(n) ? e.filter(function(i) {
return L8(i) && Cz(i, n) && d3(i) !== "body";
}) : [];
}
function Jot(t, e, r) {
var n = e === "clippingParents" ? Yot(t) : [].concat(e), i = [].concat(n, [r]), o = i[0], s = i.reduce(function(a, u) {
var d = qk(t, u);
return a.top = k5(d.top, a.top), a.right = VQ(d.right, a.right), a.bottom = VQ(d.bottom, a.bottom), a.left = k5(d.left, a.left), a;
}, qk(t, o));
return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
}
function Dz(t) {
var e = t.reference, r = t.element, n = t.placement, i = n ? o3(n) : null, o = n ? E8(n) : null, s = e.x + e.width / 2 - r.width / 2, a = e.y + e.height / 2 - r.height / 2, u;
switch (i) {
case Q2:
u = { x: s, y: e.y - r.height };
break;
case ks:
u = { x: s, y: e.y + e.height };
break;
case Is:
u = { x: e.x + e.width, y: a };
break;
case m2:
u = { x: e.x - r.width, y: a };
break;
default:
u = { x: e.x, y: e.y };
}
var d = i ? pS(i) : null;
if (d != null) {
var T = d === "y" ? "height" : "width";
switch (o) {
case b8:
u[d] = u[d] - (e[T] / 2 - r[T] / 2);
break;
case Nh:
u[d] = u[d] + (e[T] / 2 - r[T] / 2);
break;
}
}
return u;
}
function Dh(t, e) {
e === void 0 && (e = {});
var r = e, n = r.placement, i = n === void 0 ? t.placement : n, o = r.boundary, s = o === void 0 ? bot : o, a = r.rootBoundary, u = a === void 0 ? Az : a, d = r.elementContext, T = d === void 0 ? cu : d, f = r.altBoundary, Q = f === void 0 ? !1 : f, y = r.padding, _ = y === void 0 ? 0 : y, L = Iz(typeof _ != "number" ? _ : Pz(_, ud)), E = T === cu ? Lot : cu, x = t.rects.popper, O = t.elements[Q ? E : T], k = Jot(L8(O) ? O : O.contextElement || h0(t.elements.popper), s, u), R = x8(t.elements.reference), F = Dz({ reference: R, element: x, strategy: "absolute", placement: i }), U = Tx(Object.assign({}, x, F)), $ = T === cu ? U : R, et = { top: k.top - $.top + L.top, bottom: $.bottom - k.bottom + L.bottom, left: k.left - $.left + L.left, right: $.right - k.right + L.right }, nt = t.modifiersData.offset;
if (T === cu && nt) {
var ct = nt[i];
Object.keys(et).forEach(function(rt) {
var gt = [Is, ks].indexOf(rt) >= 0 ? 1 : -1, It = [Q2, ks].indexOf(rt) >= 0 ? "y" : "x";
et[rt] += ct[It] * gt;
});
}
return et;
}
function t2t(t, e) {
e === void 0 && (e = {});
var r = e, n = r.placement, i = r.boundary, o = r.rootBoundary, s = r.padding, a = r.flipVariations, u = r.allowedAutoPlacements, d = u === void 0 ? vg : u, T = E8(n), f = T ? a ? Gk : Gk.filter(function(_) {
return E8(_) === T;
}) : ud, Q = f.filter(function(_) {
return d.indexOf(_) >= 0;
});
Q.length === 0 && (Q = f);
var y = Q.reduce(function(_, L) {
return _[L] = Dh(t, { placement: L, boundary: i, rootBoundary: o, padding: s })[o3(L)], _;
}, {});
return Object.keys(y).sort(function(_, L) {
return y[_] - y[L];
});
}
function e2t(t) {
if (o3(t) === uS) return [];
var e = Tf(t);
return [Zk(t), e, Zk(e)];
}
function r2t(t) {
var e = t.state, r = t.options, n = t.name;
if (!e.modifiersData[n]._skip) {
for (var i = r.mainAxis, o = i === void 0 ? !0 : i, s = r.altAxis, a = s === void 0 ? !0 : s, u = r.fallbackPlacements, d = r.padding, T = r.boundary, f = r.rootBoundary, Q = r.altBoundary, y = r.flipVariations, _ = y === void 0 ? !0 : y, L = r.allowedAutoPlacements, E = e.options.placement, x = o3(E), O = x === E, k = u || (O || !_ ? [Tf(E)] : e2t(E)), R = [E].concat(k).reduce(function(er, Je) {
return er.concat(o3(Je) === uS ? t2t(e, { placement: Je, boundary: T, rootBoundary: f, padding: d, flipVariations: _, allowedAutoPlacements: L }) : Je);
}, []), F = e.rects.reference, U = e.rects.popper, $ = /* @__PURE__ */ new Map(), et = !0, nt = R[0], ct = 0; ct < R.length; ct++) {
var rt = R[ct], gt = o3(rt), It = E8(rt) === b8, Zt = [Q2, ks].indexOf(gt) >= 0, oe = Zt ? "width" : "height", re = Dh(e, { placement: rt, boundary: T, rootBoundary: f, altBoundary: Q, padding: d }), Ve = Zt ? It ? Is : m2 : It ? ks : Q2;
F[oe] > U[oe] && (Ve = Tf(Ve));
var yr = Tf(Ve), qr = [];
if (o && qr.push(re[gt] <= 0), a && qr.push(re[Ve] <= 0, re[yr] <= 0), qr.every(function(er) {
return er;
})) {
nt = rt, et = !1;
break;
}
$.set(rt, qr);
}
if (et) for (var ie = _ ? 3 : 1, Qe = function(er) {
var Je = R.find(function(Ne) {
var Gt = $.get(Ne);
if (Gt) return Gt.slice(0, er).every(function(te) {
return te;
});
});
if (Je) return nt = Je, "break";
}, Ke = ie; Ke > 0; Ke--) {
var He = Qe(Ke);
if (He === "break") break;
}
e.placement !== nt && (e.modifiersData[n]._skip = !0, e.placement = nt, e.reset = !0);
}
}
var n2t = { name: "flip", enabled: !0, phase: "main", fn: r2t, requiresIfExists: ["offset"], data: { _skip: !1 } };
function Xk(t, e, r) {
return r === void 0 && (r = { x: 0, y: 0 }), { top: t.top - e.height - r.y, right: t.right - e.width + r.x, bottom: t.bottom - e.height + r.y, left: t.left - e.width - r.x };
}
function Kk(t) {
return [Q2, Is, ks, m2].some(function(e) {
return t[e] >= 0;
});
}
function i2t(t) {
var e = t.state, r = t.name, n = e.rects.reference, i = e.rects.popper, o = e.modifiersData.preventOverflow, s = Dh(e, { elementContext: "reference" }), a = Dh(e, { altBoundary: !0 }), u = Xk(s, n), d = Xk(a, i, o), T = Kk(u), f = Kk(d);
e.modifiersData[r] = { referenceClippingOffsets: u, popperEscapeOffsets: d, isReferenceHidden: T, hasPopperEscaped: f }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": T, "data-popper-escaped": f });
}
var o2t = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: i2t };
function s2t(t, e, r) {
var n = o3(t), i = [m2, Q2].indexOf(n) >= 0 ? -1 : 1, o = typeof r == "function" ? r(Object.assign({}, e, { placement: t })) : r, s = o[0], a = o[1];
return s = s || 0, a = (a || 0) * i, [m2, Is].indexOf(n) >= 0 ? { x: a, y: s } : { x: s, y: a };
}
function a2t(t) {
var e = t.state, r = t.options, n = t.name, i = r.offset, o = i === void 0 ? [0, 0] : i, s = vg.reduce(function(T, f) {
return T[f] = s2t(f, e.rects, o), T;
}, {}), a = s[e.placement], u = a.x, d = a.y;
e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += u, e.modifiersData.popperOffsets.y += d), e.modifiersData[n] = s;
}
var l2t = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: a2t };
function c2t(t) {
var e = t.state, r = t.name;
e.modifiersData[r] = Dz({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var Fz = { name: "popperOffsets", enabled: !0, phase: "read", fn: c2t, data: {} };
function u2t(t) {
return t === "x" ? "y" : "x";
}
function h2t(t) {
var e = t.state, r = t.options, n = t.name, i = r.mainAxis, o = i === void 0 ? !0 : i, s = r.altAxis, a = s === void 0 ? !1 : s, u = r.boundary, d = r.rootBoundary, T = r.altBoundary, f = r.padding, Q = r.tether, y = Q === void 0 ? !0 : Q, _ = r.tetherOffset, L = _ === void 0 ? 0 : _, E = Dh(e, { boundary: u, rootBoundary: d, padding: f, altBoundary: T }), x = o3(e.placement), O = E8(e.placement), k = !O, R = pS(x), F = u2t(R), U = e.modifiersData.popperOffsets, $ = e.rects.reference, et = e.rects.popper, nt = typeof L == "function" ? L(Object.assign({}, e.rects, { placement: e.placement })) : L, ct = typeof nt == "number" ? { mainAxis: nt, altAxis: nt } : Object.assign({ mainAxis: 0, altAxis: 0 }, nt), rt = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, gt = { x: 0, y: 0 };
if (U) {
if (o) {
var It, Zt = R === "y" ? Q2 : m2, oe = R === "y" ? ks : Is, re = R === "y" ? "height" : "width", Ve = U[R], yr = Ve + E[Zt], qr = Ve - E[oe], ie = y ? -et[re] / 2 : 0, Qe = O === b8 ? $[re] : et[re], Ke = O === b8 ? -et[re] : -$[re], He = e.elements.arrow, er = y && He ? dS(He) : { width: 0, height: 0 }, Je = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : kz(), Ne = Je[Zt], Gt = Je[oe], te = eh(0, $[re], er[re]), me = k ? $[re] / 2 - ie - te - Ne - ct.mainAxis : Qe - te - Ne - ct.mainAxis, de = k ? -$[re] / 2 + ie + te + Gt + ct.mainAxis : Ke + te + Gt + ct.mainAxis, Ge = e.elements.arrow && hd(e.elements.arrow), Tr = Ge ? R === "y" ? Ge.clientTop || 0 : Ge.clientLeft || 0 : 0, qe = (It = rt == null ? void 0 : rt[R]) != null ? It : 0, $e = Ve + me - qe - Tr, ar = Ve + de - qe, Ct = eh(y ? VQ(yr, $e) : yr, Ve, y ? k5(qr, ar) : qr);
U[R] = Ct, gt[R] = Ct - Ve;
}
if (a) {
var en, Jr = R === "x" ? Q2 : m2, Hr = R === "x" ? ks : Is, Rr = U[F], dn = F === "y" ? "height" : "width", ji = Rr + E[Jr], Ji = Rr - E[Hr], ki = [Q2, m2].indexOf(x) !== -1, _i = (en = rt == null ? void 0 : rt[F]) != null ? en : 0, Ii = ki ? ji : Rr - $[dn] - et[dn] - _i + ct.altAxis, c1 = ki ? Rr + $[dn] + et[dn] - _i - ct.altAxis : Ji, ye = y && ki ? Not(Ii, Rr, c1) : eh(y ? Ii : ji, Rr, y ? c1 : Ji);
U[F] = ye, gt[F] = ye - Rr;
}
e.modifiersData[n] = gt;
}
}
var d2t = { name: "preventOverflow", enabled: !0, phase: "main", fn: h2t, requiresIfExists: ["offset"] };
function p2t(t) {
return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
}
function T2t(t) {
return t === ha(t) || !Hs(t) ? TS(t) : p2t(t);
}
function f2t(t) {
var e = t.getBoundingClientRect(), r = w8(e.width) / t.offsetWidth || 1, n = w8(e.height) / t.offsetHeight || 1;
return r !== 1 || n !== 1;
}
function Q2t(t, e, r) {
r === void 0 && (r = !1);
var n = Hs(e), i = Hs(e) && f2t(e), o = h0(e), s = x8(t, i), a = { scrollLeft: 0, scrollTop: 0 }, u = { x: 0, y: 0 };
return (n || !n && !r) && ((d3(e) !== "body" || QS(o)) && (a = T2t(e)), Hs(e) ? (u = x8(e, !0), u.x += e.clientLeft, u.y += e.clientTop) : o && (u.x = fS(o))), { x: s.left + a.scrollLeft - u.x, y: s.top + a.scrollTop - u.y, width: s.width, height: s.height };
}
function m2t(t) {
var e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), n = [];
t.forEach(function(o) {
e.set(o.name, o);
});
function i(o) {
r.add(o.name);
var s = [].concat(o.requires || [], o.requiresIfExists || []);
s.forEach(function(a) {
if (!r.has(a)) {
var u = e.get(a);
u && i(u);
}
}), n.push(o);
}
return t.forEach(function(o) {
r.has(o.name) || i(o);
}), n;
}
function g2t(t) {
var e = m2t(t);
return kot.reduce(function(r, n) {
return r.concat(e.filter(function(i) {
return i.phase === n;
}));
}, []);
}
function y2t(t) {
var e;
return function() {
return e || (e = new Promise(function(r) {
Promise.resolve().then(function() {
e = void 0, r(t());
});
})), e;
};
}
function v2t(t) {
var e = t.reduce(function(r, n) {
var i = r[n.name];
return r[n.name] = i ? Object.assign({}, i, n, { options: Object.assign({}, i.options, n.options), data: Object.assign({}, i.data, n.data) }) : n, r;
}, {});
return Object.keys(e).map(function(r) {
return e[r];
});
}
var Yk = { placement: "bottom", modifiers: [], strategy: "absolute" };
function Jk() {
for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++) e[r] = arguments[r];
return !e.some(function(n) {
return !(n && typeof n.getBoundingClientRect == "function");
});
}
function mS(t) {
t === void 0 && (t = {});
var e = t, r = e.defaultModifiers, n = r === void 0 ? [] : r, i = e.defaultOptions, o = i === void 0 ? Yk : i;
return function(s, a, u) {
u === void 0 && (u = o);
var d = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Yk, o), modifiersData: {}, elements: { reference: s, popper: a }, attributes: {}, styles: {} }, T = [], f = !1, Q = { state: d, setOptions: function(L) {
var E = typeof L == "function" ? L(d.options) : L;
_(), d.options = Object.assign({}, o, d.options, E), d.scrollParents = { reference: L8(s) ? rh(s) : s.contextElement ? rh(s.contextElement) : [], popper: rh(a) };
var x = g2t(v2t([].concat(n, d.options.modifiers)));
return d.orderedModifiers = x.filter(function(O) {
return O.enabled;
}), y(), Q.update();
}, forceUpdate: function() {
if (!f) {
var L = d.elements, E = L.reference, x = L.popper;
if (Jk(E, x)) {
d.rects = { reference: Q2t(E, hd(x), d.options.strategy === "fixed"), popper: dS(x) }, d.reset = !1, d.placement = d.options.placement, d.orderedModifiers.forEach(function(et) {
return d.modifiersData[et.name] = Object.assign({}, et.data);
});
for (var O = 0; O < d.orderedModifiers.length; O++) {
if (d.reset === !0) {
d.reset = !1, O = -1;
continue;
}
var k = d.orderedModifiers[O], R = k.fn, F = k.options, U = F === void 0 ? {} : F, $ = k.name;
typeof R == "function" && (d = R({ state: d, options: U, name: $, instance: Q }) || d);
}
}
}
}, update: y2t(function() {
return new Promise(function(L) {
Q.forceUpdate(), L(d);
});
}), destroy: function() {
_(), f = !0;
} };
if (!Jk(s, a)) return Q;
Q.setOptions(u).then(function(L) {
!f && u.onFirstUpdate && u.onFirstUpdate(L);
});
function y() {
d.orderedModifiers.forEach(function(L) {
var E = L.name, x = L.options, O = x === void 0 ? {} : x, k = L.effect;
if (typeof k == "function") {
var R = k({ state: d, name: E, instance: Q, options: O }), F = function() {
};
T.push(R || F);
}
});
}
function _() {
T.forEach(function(L) {
return L();
}), T = [];
}
return Q;
};
}
mS();
var _2t = [Rz, Fz, Vz, Oz];
mS({ defaultModifiers: _2t });
var b2t = [Rz, Fz, Vz, Oz, l2t, n2t, d2t, jot, o2t], L2t = mS({ defaultModifiers: b2t });
const w2t = (t, e, r = {}) => {
const n = {
name: "updateState",
enabled: !0,
phase: "write",
fn: ({ state: u }) => {
const d = x2t(u);
Object.assign(s.value, d);
},
requires: ["computeStyles"]
}, i = Kt(() => {
const { onFirstUpdate: u, placement: d, strategy: T, modifiers: f } = vt(r);
return {
onFirstUpdate: u,
placement: d || "bottom",
strategy: T || "absolute",
modifiers: [
...f || [],
n,
{ name: "applyStyles", enabled: !1 }
]
};
}), o = OQ(), s = Ie({
styles: {
popper: {
position: vt(i).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
}), a = () => {
o.value && (o.value.destroy(), o.value = void 0);
};
return on(i, (u) => {
const d = vt(o);
d && d.setOptions(u);
}, {
deep: !0
}), on([t, e], ([u, d]) => {
a(), !(!u || !d) && (o.value = L2t(u, d, vt(i)));
}), Rs(() => {
a();
}), {
state: Kt(() => {
var u;
return { ...((u = vt(o)) == null ? void 0 : u.state) || {} };
}),
styles: Kt(() => vt(s).styles),
attributes: Kt(() => vt(s).attributes),
update: () => {
var u;
return (u = vt(o)) == null ? void 0 : u.update();
},
forceUpdate: () => {
var u;
return (u = vt(o)) == null ? void 0 : u.forceUpdate();
},
instanceRef: Kt(() => vt(o))
};
};
function x2t(t) {
const e = Object.keys(t.elements), r = hx(e.map((i) => [i, t.styles[i] || {}])), n = hx(e.map((i) => [i, t.attributes[i]]));
return {
styles: r,
attributes: n
};
}
const Bz = (t) => {
if (!t)
return { onClick: O5, onMousedown: O5, onMouseup: O5 };
let e = !1, r = !1;
return { onClick: (s) => {
e && r && t(s), e = r = !1;
}, onMousedown: (s) => {
e = s.target === s.currentTarget;
}, onMouseup: (s) => {
r = s.target === s.currentTarget;
} };
};
function tI() {
let t;
const e = (n, i) => {
r(), t = window.setTimeout(n, i);
}, r = () => window.clearTimeout(t);
return ld(() => r()), {
registerTimeout: e,
cancelTimeout: r
};
}
const fx = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
}, E2t = Symbol("elIdInjection"), jz = () => G1() ? ln(E2t, fx) : fx, z5 = (t) => {
const e = jz();
!s1 && e === fx && y2("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
usage: app.provide(ID_INJECTION_KEY, {
prefix: number,
current: number,
})`);
const r = cS();
return Kt(() => vt(t) || `${r.value}-id-${e.prefix}-${e.current++}`);
};
let L7 = [];
const eI = (t) => {
const e = t;
e.key === Rh.esc && L7.forEach((r) => r(e));
}, M2t = (t) => {
W1(() => {
L7.length === 0 && document.addEventListener("keydown", eI), s1 && L7.push(t);
}), Rs(() => {
L7 = L7.filter((e) => e !== t), L7.length === 0 && s1 && document.removeEventListener("keydown", eI);
});
};
let rI;
const zz = () => {
const t = cS(), e = jz(), r = Kt(() => `${t.value}-popper-container-${e.prefix}`), n = Kt(() => `#${r.value}`);
return {
id: r,
selector: n
};
}, S2t = (t) => {
const e = document.createElement("div");
return e.id = t, document.body.appendChild(e), e;
}, H2t = () => {
const { id: t, selector: e } = zz();
return det(() => {
s1 && (process.env.NODE_ENV === "test" || !rI || !document.body.querySelector(e.value)) && (rI = S2t(t.value));
}), {
id: t,
selector: e
};
}, A2t = Sn({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
}), O2t = ({
showAfter: t,
hideAfter: e,
autoClose: r,
open: n,
close: i
}) => {
const { registerTimeout: o } = tI(), {
registerTimeout: s,
cancelTimeout: a
} = tI();
return {
onOpen: (T) => {
o(() => {
n(T);
const f = vt(r);
ro(f) && f > 0 && s(() => {
i(T);
}, f);
}, vt(t));
},
onClose: (T) => {
a(), o(() => {
i(T);
}, vt(e));
}
};
}, Uz = Symbol("elForwardRef"), C2t = (t) => {
$1(Uz, {
setForwardRef: (r) => {
t.value = r;
}
});
}, k2t = (t) => ({
mounted(e) {
t(e);
},
updated(e) {
t(e);
},
unmounted() {
t(null);
}
}), nI = {
current: 0
}, iI = Ie(0), Gz = 2e3, oI = Symbol("elZIndexContextKey"), $z = Symbol("zIndexContextKey"), gS = (t) => {
const e = G1() ? ln(oI, nI) : nI, r = t || (G1() ? ln($z, void 0) : void 0), n = Kt(() => {
const s = vt(r);
return ro(s) ? s : Gz;
}), i = Kt(() => n.value + iI.value), o = () => (e.current++, iI.value = e.current, i.value);
return !s1 && !ln(oI) && y2("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), {
initialZIndex: n,
currentZIndex: i,
nextZIndex: o
};
}, Y8 = yg({
type: String,
values: Ez,
required: !1
}), Wz = Symbol("size"), I2t = () => {
const t = ln(Wz, {});
return Kt(() => vt(t.size) || "");
};
function P2t(t, {
beforeFocus: e,
afterFocus: r,
beforeBlur: n,
afterBlur: i
} = {}) {
const o = G1(), { emit: s } = o, a = OQ(), u = Ie(!1), d = (Q) => {
Zo(e) && e(Q) || u.value || (u.value = !0, s("focus", Q), r == null || r());
}, T = (Q) => {
var y;
Zo(n) && n(Q) || Q.relatedTarget && ((y = a.value) != null && y.contains(Q.relatedTarget)) || (u.value = !1, s("blur", Q), i == null || i());
}, f = () => {
var Q, y;
(Q = a.value) != null && Q.contains(document.activeElement) && a.value !== document.activeElement || (y = t.value) == null || y.focus();
};
return on(a, (Q) => {
Q && Q.setAttribute("tabindex", "-1");
}), ea(a, "focus", d, !0), ea(a, "blur", T, !0), ea(a, "click", f, !0), process.env.NODE_ENV === "test" && W1(() => {
const Q = C5(t.value) ? t.value : document.querySelector("input,textarea");
Q && (ea(Q, "focus", d, !0), ea(Q, "blur", T, !0));
}), {
isFocused: u,
wrapperRef: a,
handleFocus: d,
handleBlur: T
};
}
function V2t({
afterComposition: t,
emit: e
}) {
const r = Ie(!1), n = (a) => {
e == null || e("compositionstart", a), r.value = !0;
}, i = (a) => {
var u;
e == null || e("compositionupdate", a);
const d = (u = a.target) == null ? void 0 : u.value, T = d[d.length - 1] || "";
r.value = !hot(T);
}, o = (a) => {
e == null || e("compositionend", a), r.value && (r.value = !1, i1(() => t(a)));
};
return {
isComposing: r,
handleComposition: (a) => {
a.type === "compositionend" ? o(a) : i(a);
},
handleCompositionStart: n,
handleCompositionUpdate: i,
handleCompositionEnd: o
};
}
const Zz = Symbol("emptyValuesContextKey"), R2t = "use-empty-values", N2t = ["", void 0, null], D2t = void 0, F2t = Sn({
emptyValues: Array,
valueOnClear: {
type: [String, Number, Boolean, Function],
default: void 0,
validator: (t) => Zo(t) ? !t() : !t
}
}), B2t = (t, e) => {
const r = G1() ? ln(Zz, Ie({})) : Ie({}), n = Kt(() => t.emptyValues || r.value.emptyValues || N2t), i = Kt(() => Zo(t.valueOnClear) ? t.valueOnClear() : t.valueOnClear !== void 0 ? t.valueOnClear : Zo(r.value.valueOnClear) ? r.value.valueOnClear() : r.value.valueOnClear !== void 0 ? r.value.valueOnClear : D2t), o = (s) => n.value.includes(s);
return n.value.includes(i.value) || y2(R2t, "value-on-clear should be a value of empty-values"), {
emptyValues: n,
valueOnClear: i,
isEmptyValue: o
};
}, j2t = Sn({
ariaLabel: String,
ariaOrientation: {
type: String,
values: ["horizontal", "vertical", "undefined"]
},
ariaControls: String
}), ol = (t) => Qz(j2t, t), qz = Symbol(), RQ = Ie();
function bg(t, e = void 0) {
const r = G1() ? ln(qz, RQ) : RQ;
return t ? Kt(() => {
var n, i;
return (i = (n = r.value) == null ? void 0 : n[t]) != null ? i : e;
}) : r;
}
function z2t(t, e) {
const r = bg(), n = Bn(t, Kt(() => {
var a;
return ((a = r.value) == null ? void 0 : a.namespace) || th;
})), i = lS(Kt(() => {
var a;
return (a = r.value) == null ? void 0 : a.locale;
})), o = gS(Kt(() => {
var a;
return ((a = r.value) == null ? void 0 : a.zIndex) || Gz;
})), s = Kt(() => {
var a;
return vt(e) || ((a = r.value) == null ? void 0 : a.size) || "";
});
return U2t(Kt(() => vt(r) || {})), {
ns: n,
locale: i,
zIndex: o,
size: s
};
}
const U2t = (t, e, r = !1) => {
var n;
const i = !!G1(), o = i ? bg() : void 0, s = (n = void 0) != null ? n : i ? $1 : void 0;
if (!s) {
y2("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
return;
}
const a = Kt(() => {
const u = vt(t);
return o != null && o.value ? G2t(o.value, u) : u;
});
return s(qz, a), s(Mz, Kt(() => a.value.locale)), s(Sz, Kt(() => a.value.namespace)), s($z, Kt(() => a.value.zIndex)), s(Wz, {
size: Kt(() => a.value.size || "")
}), s(Zz, Kt(() => ({
emptyValues: a.value.emptyValues,
valueOnClear: a.value.valueOnClear
}))), (r || !RQ.value) && (RQ.value = a.value), a;
}, G2t = (t, e) => {
const r = [.../* @__PURE__ */ new Set([...zk(t), ...zk(e)])], n = {};
for (const i of r)
n[i] = e[i] !== void 0 ? e[i] : t[i];
return n;
};
var Hn = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, i] of e)
r[n] = i;
return r;
};
const $2t = Sn({
size: {
type: Gr([Number, String])
},
color: {
type: String
}
}), W2t = mr({
name: "ElIcon",
inheritAttrs: !1
}), Z2t = /* @__PURE__ */ mr({
...W2t,
props: $2t,
setup(t) {
const e = t, r = Bn("icon"), n = Kt(() => {
const { size: i, color: o } = e;
return !i && !o ? {} : {
fontSize: Z6(i) ? void 0 : j5(i),
"--color": o
};
});
return (i, o) => (ce(), Ye("i", el({
class: vt(r).b(),
style: vt(n)
}, i.$attrs), [
Pr(i.$slots, "default")
], 16));
}
});
var q2t = /* @__PURE__ */ Hn(Z2t, [["__file", "icon.vue"]]);
const p3 = v2(q2t), yS = Symbol("formContextKey"), NQ = Symbol("formItemContextKey"), M8 = (t, e = {}) => {
const r = Ie(void 0), n = e.prop ? r : Hz("size"), i = e.global ? r : I2t(), o = e.form ? { size: void 0 } : ln(yS, void 0), s = e.formItem ? { size: void 0 } : ln(NQ, void 0);
return Kt(() => n.value || vt(t) || (s == null ? void 0 : s.size) || (o == null ? void 0 : o.size) || i.value || "");
}, Lg = (t) => {
const e = Hz("disabled"), r = ln(yS, void 0);
return Kt(() => e.value || vt(t) || (r == null ? void 0 : r.disabled) || !1);
}, J8 = () => {
const t = ln(yS, void 0), e = ln(NQ, void 0);
return {
form: t,
formItem: e
};
}, wg = (t, {
formItemContext: e,
disableIdGeneration: r,
disableIdManagement: n
}) => {
r || (r = Ie(!1)), n || (n = Ie(!1));
const i = Ie();
let o;
const s = Kt(() => {
var a;
return !!(!(t.label || t.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1);
});
return W1(() => {
o = on([X2(t, "id"), r], ([a, u]) => {
const d = a ?? (u ? void 0 : z5().value);
d !== i.value && (e != null && e.removeInputId && (i.value && e.removeInputId(i.value), !(n != null && n.value) && !u && d && e.addInputId(d)), i.value = d);
}, { immediate: !0 });
}), pet(() => {
o && o(), e != null && e.removeInputId && i.value && e.removeInputId(i.value);
}), {
isLabeledByFormItem: s,
inputId: i
};
}, ql = 4, X2t = {
vertical: {
offset: "offsetHeight",
scroll: "scrollTop",
scrollSize: "scrollHeight",
size: "height",
key: "vertical",
axis: "Y",
client: "clientY",
direction: "top"
},
horizontal: {
offset: "offsetWidth",
scroll: "scrollLeft",
scrollSize: "scrollWidth",
size: "width",
key: "horizontal",
axis: "X",
client: "clientX",
direction: "left"
}
}, K2t = ({
move: t,
size: e,
bar: r
}) => ({
[r.size]: e,
transform: `translate${r.axis}(${t}%)`
}), vS = Symbol("scrollbarContextKey"), Y2t = Sn({
vertical: Boolean,
size: String,
move: Number,
ratio: {
type: Number,
required: !0
},
always: Boolean
}), J2t = "Thumb", tst = /* @__PURE__ */ mr({
__name: "thumb",
props: Y2t,
setup(t) {
const e = t, r = ln(vS), n = Bn("scrollbar");
r || gz(J2t, "can not inject scrollbar context");
const i = Ie(), o = Ie(), s = Ie({}), a = Ie(!1);
let u = !1, d = !1, T = s1 ? document.onselectstart : null;
const f = Kt(() => X2t[e.vertical ? "vertical" : "horizontal"]), Q = Kt(() => K2t({
size: e.size,
move: e.move,
bar: f.value
})), y = Kt(() => i.value[f.value.offset] ** 2 / r.wrapElement[f.value.scrollSize] / e.ratio / o.value[f.value.offset]), _ = (U) => {
var $;
if (U.stopPropagation(), U.ctrlKey || [1, 2].includes(U.button))
return;
($ = window.getSelection()) == null || $.removeAllRanges(), E(U);
const et = U.currentTarget;
et && (s.value[f.value.axis] = et[f.value.offset] - (U[f.value.client] - et.getBoundingClientRect()[f.value.direction]));
}, L = (U) => {
if (!o.value || !i.value || !r.wrapElement)
return;
const $ = Math.abs(U.target.getBoundingClientRect()[f.value.direction] - U[f.value.client]), et = o.value[f.value.offset] / 2, nt = ($ - et) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = nt * r.wrapElement[f.value.scrollSize] / 100;
}, E = (U) => {
U.stopImmediatePropagation(), u = !0, document.addEventListener("mousemove", x), document.addEventListener("mouseup", O), T = document.onselectstart, document.onselectstart = () => !1;
}, x = (U) => {
if (!i.value || !o.value || u === !1)
return;
const $ = s.value[f.value.axis];
if (!$)
return;
const et = (i.value.getBoundingClientRect()[f.value.direction] - U[f.value.client]) * -1, nt = o.value[f.value.offset] - $, ct = (et - nt) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = ct * r.wrapElement[f.value.scrollSize] / 100;
}, O = () => {
u = !1, s.value[f.value.axis] = 0, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", O), F(), d && (a.value = !1);
}, k = () => {
d = !1, a.value = !!e.size;
}, R = () => {
d = !0, a.value = u;
};
Rs(() => {
F(), document.removeEventListener("mouseup", O);
});
const F = () => {
document.onselectstart !== T && (document.onselectstart = T);
};
return ea(X2(r, "scrollbarElement"), "mousemove", k), ea(X2(r, "scrollbarElement"), "mouseleave", R), (U, $) => (ce(), Or(ad, {
name: vt(n).b("fade"),
persisted: ""
}, {
default: fe(() => [
Ti(je("div", {
ref_key: "instance",
ref: i,
class: Be([vt(n).e("bar"), vt(n).is(vt(f).key)]),
onMousedown: L
}, [
je("div", {
ref_key: "thumb",
ref: o,
class: Be(vt(n).e("thumb")),
style: M1(vt(Q)),
onMousedown: _
}, null, 38)
], 34), [
[zo, U.always || a.value]
])
]),
_: 1
}, 8, ["name"]));
}
});
var sI = /* @__PURE__ */ Hn(tst, [["__file", "thumb.vue"]]);
const est = Sn({
always: {
type: Boolean,
default: !0
},
minSize: {
type: Number,
required: !0
}
}), rst = /* @__PURE__ */ mr({
__name: "bar",
props: est,
setup(t, { expose: e }) {
const r = t, n = ln(vS), i = Ie(0), o = Ie(0), s = Ie(""), a = Ie(""), u = Ie(1), d = Ie(1);
return e({
handleScroll: (Q) => {
if (Q) {
const y = Q.offsetHeight - ql, _ = Q.offsetWidth - ql;
o.value = Q.scrollTop * 100 / y * u.value, i.value = Q.scrollLeft * 100 / _ * d.value;
}
},
update: () => {
const Q = n == null ? void 0 : n.wrapElement;
if (!Q)
return;
const y = Q.offsetHeight - ql, _ = Q.offsetWidth - ql, L = y ** 2 / Q.scrollHeight, E = _ ** 2 / Q.scrollWidth, x = Math.max(L, r.minSize), O = Math.max(E, r.minSize);
u.value = L / (y - L) / (x / (y - x)), d.value = E / (_ - E) / (O / (_ - O)), a.value = x + ql < y ? `${x}px` : "", s.value = O + ql < _ ? `${O}px` : "";
}
}), (Q, y) => (ce(), Ye(to, null, [
Ce(sI, {
move: i.value,
ratio: d.value,
size: s.value,
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"]),
Ce(sI, {
move: o.value,
ratio: u.value,
size: a.value,
vertical: "",
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"])
], 64));
}
});
var nst = /* @__PURE__ */ Hn(rst, [["__file", "bar.vue"]]);
const ist = Sn({
height: {
type: [String, Number],
default: ""
},
maxHeight: {
type: [String, Number],
default: ""
},
native: {
type: Boolean,
default: !1
},
wrapStyle: {
type: Gr([String, Object, Array]),
default: ""
},
wrapClass: {
type: [String, Array],
default: ""
},
viewClass: {
type: [String, Array],
default: ""
},
viewStyle: {
type: [String, Array, Object],
default: ""
},
noresize: Boolean,
tag: {
type: String,
default: "div"
},
always: Boolean,
minSize: {
type: Number,
default: 20
},
tabindex: {
type: [String, Number],
default: void 0
},
id: String,
role: String,
...ol(["ariaLabel", "ariaOrientation"])
}), ost = {
scroll: ({
scrollTop: t,
scrollLeft: e
}) => [t, e].every(ro)
}, Qx = "ElScrollbar", sst = mr({
name: Qx
}), ast = /* @__PURE__ */ mr({
...sst,
props: ist,
emits: ost,
setup(t, { expose: e, emit: r }) {
const n = t, i = Bn("scrollbar");
let o, s, a = 0, u = 0;
const d = Ie(), T = Ie(), f = Ie(), Q = Ie(), y = Kt(() => {
const F = {};
return n.height && (F.height = j5(n.height)), n.maxHeight && (F.maxHeight = j5(n.maxHeight)), [n.wrapStyle, F];
}), _ = Kt(() => [
n.wrapClass,
i.e("wrap"),
{ [i.em("wrap", "hidden-default")]: !n.native }
]), L = Kt(() => [i.e("view"), n.viewClass]), E = () => {
var F;
T.value && ((F = Q.value) == null || F.handleScroll(T.value), a = T.value.scrollTop, u = T.value.scrollLeft, r("scroll", {
scrollTop: T.value.scrollTop,
scrollLeft: T.value.scrollLeft
}));
};
function x(F, U) {
T2(F) ? T.value.scrollTo(F) : ro(F) && ro(U) && T.value.scrollTo(F, U);
}
const O = (F) => {
if (!ro(F)) {
y2(Qx, "value must be a number");
return;
}
T.value.scrollTop = F;
}, k = (F) => {
if (!ro(F)) {
y2(Qx, "value must be a number");
return;
}
T.value.scrollLeft = F;
}, R = () => {
var F;
(F = Q.value) == null || F.update();
};
return on(() => n.noresize, (F) => {
F ? (o == null || o(), s == null || s()) : ({ stop: o } = F6(f, R), s = ea("resize", R));
}, { immediate: !0 }), on(() => [n.maxHeight, n.height], () => {
n.native || i1(() => {
var F;
R(), T.value && ((F = Q.value) == null || F.handleScroll(T.value));
});
}), $1(vS, u3({
scrollbarElement: d,
wrapElement: T
})), Tet(() => {
T.value && (T.value.scrollTop = a, T.value.scrollLeft = u);
}), W1(() => {
n.native || i1(() => {
R();
});
}), fet(() => R()), e({
wrapRef: T,
update: R,
scrollTo: x,
setScrollTop: O,
setScrollLeft: k,
handleScroll: E
}), (F, U) => (ce(), Ye("div", {
ref_key: "scrollbarRef",
ref: d,
class: Be(vt(i).b())
}, [
je("div", {
ref_key: "wrapRef",
ref: T,
class: Be(vt(_)),
style: M1(vt(y)),
tabindex: F.tabindex,
onScroll: E
}, [
(ce(), Or(Ss(F.tag), {
id: F.id,
ref_key: "resizeRef",
ref: f,
class: Be(vt(L)),
style: M1(F.viewStyle),
role: F.role,
"aria-label": F.ariaLabel,
"aria-orientation": F.ariaOrientation
}, {
default: fe(() => [
Pr(F.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
], 46, ["tabindex"]),
F.native ? Fr("v-if", !0) : (ce(), Or(nst, {
key: 0,
ref_key: "barRef",
ref: Q,
always: F.always,
"min-size": F.minSize
}, null, 8, ["always", "min-size"]))
], 2));
}
});
var lst = /* @__PURE__ */ Hn(ast, [["__file", "scrollbar.vue"]]);
const cst = v2(lst), _S = Symbol("popper"), Xz = Symbol("popperContent"), ust = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
], Kz = Sn({
role: {
type: String,
values: ust,
default: "tooltip"
}
}), hst = mr({
name: "ElPopper",
inheritAttrs: !1
}), dst = /* @__PURE__ */ mr({
...hst,
props: Kz,
setup(t, { expose: e }) {
const r = t, n = Ie(), i = Ie(), o = Ie(), s = Ie(), a = Kt(() => r.role), u = {
triggerRef: n,
popperInstanceRef: i,
contentRef: o,
referenceRef: s,
role: a
};
return e(u), $1(_S, u), (d, T) => Pr(d.$slots, "default");
}
});
var pst = /* @__PURE__ */ Hn(dst, [["__file", "popper.vue"]]);
const Yz = Sn({
arrowOffset: {
type: Number,
default: 5
}
}), Tst = mr({
name: "ElPopperArrow",
inheritAttrs: !1
}), fst = /* @__PURE__ */ mr({
...Tst,
props: Yz,
setup(t, { expose: e }) {
const r = t, n = Bn("popper"), { arrowOffset: i, arrowRef: o, arrowStyle: s } = ln(Xz, void 0);
return on(() => r.arrowOffset, (a) => {
i.value = a;
}), Rs(() => {
o.value = void 0;
}), e({
arrowRef: o
}), (a, u) => (ce(), Ye("span", {
ref_key: "arrowRef",
ref: o,
class: Be(vt(n).e("arrow")),
style: M1(vt(s)),
"data-popper-arrow": ""
}, null, 6));
}
});
var Qst = /* @__PURE__ */ Hn(fst, [["__file", "arrow.vue"]]);
const Tb = "ElOnlyChild", mst = mr({
name: Tb,
setup(t, {
slots: e,
attrs: r
}) {
var n;
const i = ln(Uz), o = k2t((n = i == null ? void 0 : i.setForwardRef) != null ? n : O5);
return () => {
var s;
const a = (s = e.default) == null ? void 0 : s.call(e, r);
if (!a)
return null;
if (a.length > 1)
return y2(Tb, "requires exact only one valid child."), null;
const u = Jz(a);
return u ? Ti(Qet(u, r), [[o]]) : (y2(Tb, "no valid child node found"), null);
};
}
});
function Jz(t) {
if (!t)
return null;
const e = t;
for (const r of e) {
if (T2(r))
switch (r.type) {
case met:
continue;
case Zj:
case "svg":
return aI(r);
case to:
return Jz(r.children);
default:
return r;
}
return aI(r);
}
return null;
}
function aI(t) {
const e = Bn("only-child");
return Ce("span", {
class: e.e("content")
}, [t]);
}
const tU = Sn({
virtualRef: {
type: Gr(Object)
},
virtualTriggering: Boolean,
onMouseenter: {
type: Gr(Function)
},
onMouseleave: {
type: Gr(Function)
},
onClick: {
type: Gr(Function)
},
onKeydown: {
type: Gr(Function)
},
onFocus: {
type: Gr(Function)
},
onBlur: {
type: Gr(Function)
},
onContextmenu: {
type: Gr(Function)
},
id: String,
open: Boolean
}), gst = mr({
name: "ElPopperTrigger",
inheritAttrs: !1
}), yst = /* @__PURE__ */ mr({
...gst,
props: tU,
setup(t, { expose: e }) {
const r = t, { role: n, triggerRef: i } = ln(_S, void 0);
C2t(i);
const o = Kt(() => a.value ? r.id : void 0), s = Kt(() => {
if (n && n.value === "tooltip")
return r.open && r.id ? r.id : void 0;
}), a = Kt(() => {
if (n && n.value !== "tooltip")
return n.value;
}), u = Kt(() => a.value ? `${r.open}` : void 0);
let d;
const T = [
"onMouseenter",
"onMouseleave",
"onClick",
"onKeydown",
"onFocus",
"onBlur",
"onContextmenu"
];
return W1(() => {
on(() => r.virtualRef, (f) => {
f && (i.value = T4(f));
}, {
immediate: !0
}), on(i, (f, Q) => {
d == null || d(), d = void 0, C5(f) && (T.forEach((y) => {
var _;
const L = r[y];
L && (f.addEventListener(y.slice(2).toLowerCase(), L), (_ = Q == null ? void 0 : Q.removeEventListener) == null || _.call(Q, y.slice(2).toLowerCase(), L));
}), d = on([o, s, a, u], (y) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((_, L) => {
gg(y[L]) ? f.removeAttribute(_) : f.setAttribute(_, y[L]);
});
}, { immediate: !0 })), C5(Q) && [
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((y) => Q.removeAttribute(y));
}, {
immediate: !0
});
}), Rs(() => {
if (d == null || d(), d = void 0, i.value && C5(i.value)) {
const f = i.value;
T.forEach((Q) => {
const y = r[Q];
y && f.removeEventListener(Q.slice(2).toLowerCase(), y);
}), i.value = void 0;
}
}), e({
triggerRef: i
}), (f, Q) => f.virtualTriggering ? Fr("v-if", !0) : (ce(), Or(vt(mst), el({ key: 0 }, f.$attrs, {
"aria-controls": vt(o),
"aria-describedby": vt(s),
"aria-expanded": vt(u),
"aria-haspopup": vt(a)
}), {
default: fe(() => [
Pr(f.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
}
});
var vst = /* @__PURE__ */ Hn(yst, [["__file", "trigger.vue"]]);
const fb = "focus-trap.focus-after-trapped", Qb = "focus-trap.focus-after-released", _st = "focus-trap.focusout-prevented", lI = {
cancelable: !0,
bubbles: !1
}, bst = {
cancelable: !0,
bubbles: !1
}, cI = "focusAfterTrapped", uI = "focusAfterReleased", eU = Symbol("elFocusTrap"), bS = Ie(), xg = Ie(0), LS = Ie(0);
let Wp = 0;
const rU = (t) => {
const e = [], r = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
acceptNode: (n) => {
const i = n.tagName === "INPUT" && n.type === "hidden";
return n.disabled || n.hidden || i ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 || n === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
for (; r.nextNode(); )
e.push(r.currentNode);
return e;
}, hI = (t, e) => {
for (const r of t)
if (!Lst(r, e))
return r;
}, Lst = (t, e) => {
if (process.env.NODE_ENV === "test")
return !1;
if (getComputedStyle(t).visibility === "hidden")
return !0;
for (; t; ) {
if (e && t === e)
return !1;
if (getComputedStyle(t).display === "none")
return !0;
t = t.parentElement;
}
return !1;
}, wst = (t) => {
const e = rU(t), r = hI(e, t), n = hI(e.reverse(), t);
return [r, n];
}, xst = (t) => t instanceof HTMLInputElement && "select" in t, S6 = (t, e) => {
if (t && t.focus) {
const r = document.activeElement;
t.focus({ preventScroll: !0 }), LS.value = window.performance.now(), t !== r && xst(t) && e && t.select();
}
};
function dI(t, e) {
const r = [...t], n = t.indexOf(e);
return n !== -1 && r.splice(n, 1), r;
}
const Est = () => {
let t = [];
return {
push: (n) => {
const i = t[0];
i && n !== i && i.pause(), t = dI(t, n), t.unshift(n);
},
remove: (n) => {
var i, o;
t = dI(t, n), (o = (i = t[0]) == null ? void 0 : i.resume) == null || o.call(i);
}
};
}, Mst = (t, e = !1) => {
const r = document.activeElement;
for (const n of t)
if (S6(n, e), document.activeElement !== r)
return;
}, pI = Est(), Sst = () => xg.value > LS.value, Zp = () => {
bS.value = "pointer", xg.value = window.performance.now();
}, TI = () => {
bS.value = "keyboard", xg.value = window.performance.now();
}, Hst = () => (W1(() => {
Wp === 0 && (document.addEventListener("mousedown", Zp), document.addEventListener("touchstart", Zp), document.addEventListener("keydown", TI)), Wp++;
}), Rs(() => {
Wp--, Wp <= 0 && (document.removeEventListener("mousedown", Zp), document.removeEventListener("touchstart", Zp), document.removeEventListener("keydown", TI));
}), {
focusReason: bS,
lastUserFocusTimestamp: xg,
lastAutomatedFocusTimestamp: LS
}), qp = (t) => new CustomEvent(_st, {
...bst,
detail: t
}), Ast = mr({
name: "ElFocusTrap",
inheritAttrs: !1,
props: {
loop: Boolean,
trapped: Boolean,
focusTrapEl: Object,
focusStartEl: {
type: [Object, String],
default: "first"
}
},
emits: [
cI,
uI,
"focusin",
"focusout",
"focusout-prevented",
"release-requested"
],
setup(t, { emit: e }) {
const r = Ie();
let n, i;
const { focusReason: o } = Hst();
M2t((_) => {
t.trapped && !s.paused && e("release-requested", _);
});
const s = {
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}, a = (_) => {
if (!t.loop && !t.trapped || s.paused)
return;
const { key: L, altKey: E, ctrlKey: x, metaKey: O, currentTarget: k, shiftKey: R } = _, { loop: F } = t, U = L === Rh.tab && !E && !x && !O, $ = document.activeElement;
if (U && $) {
const et = k, [nt, ct] = wst(et);
if (nt && ct) {
if (!R && $ === ct) {
const gt = qp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && S6(nt, !0));
} else if (R && [nt, et].includes($)) {
const gt = qp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && S6(ct, !0));
}
} else if ($ === et) {
const gt = qp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || _.preventDefault();
}
}
};
$1(eU, {
focusTrapRef: r,
onKeydown: a
}), on(() => t.focusTrapEl, (_) => {
_ && (r.value = _);
}, { immediate: !0 }), on([r], ([_], [L]) => {
_ && (_.addEventListener("keydown", a), _.addEventListener("focusin", T), _.addEventListener("focusout", f)), L && (L.removeEventListener("keydown", a), L.removeEventListener("focusin", T), L.removeEventListener("focusout", f));
});
const u = (_) => {
e(cI, _);
}, d = (_) => e(uI, _), T = (_) => {
const L = vt(r);
if (!L)
return;
const E = _.target, x = _.relatedTarget, O = E && L.contains(E);
t.trapped || x && L.contains(x) || (n = x), O && e("focusin", _), !s.paused && t.trapped && (O ? i = E : S6(i, !0));
}, f = (_) => {
const L = vt(r);
if (!(s.paused || !L))
if (t.trapped) {
const E = _.relatedTarget;
!gg(E) && !L.contains(E) && setTimeout(() => {
if (!s.paused && t.trapped) {
const x = qp({
focusReason: o.value
});
e("focusout-prevented", x), x.defaultPrevented || S6(i, !0);
}
}, 0);
} else {
const E = _.target;
E && L.contains(E) || e("focusout", _);
}
};
async function Q() {
await i1();
const _ = vt(r);
if (_) {
pI.push(s);
const L = _.contains(document.activeElement) ? n : document.activeElement;
if (n = L, !_.contains(L)) {
const x = new Event(fb, lI);
_.addEventListener(fb, u), _.dispatchEvent(x), x.defaultPrevented || i1(() => {
let O = t.focusStartEl;
sa(O) || (S6(O), document.activeElement !== O && (O = "first")), O === "first" && Mst(rU(_), !0), (document.activeElement === L || O === "container") && S6(_);
});
}
}
}
function y() {
const _ = vt(r);
if (_) {
_.removeEventListener(fb, u);
const L = new CustomEvent(Qb, {
...lI,
detail: {
focusReason: o.value
}
});
_.addEventListener(Qb, d), _.dispatchEvent(L), !L.defaultPrevented && (o.value == "keyboard" || !Sst() || _.contains(document.activeElement)) && S6(n ?? document.body), _.removeEventListener(Qb, d), pI.remove(s);
}
}
return W1(() => {
t.trapped && Q(), on(() => t.trapped, (_) => {
_ ? Q() : y();
});
}), Rs(() => {
t.trapped && y(), r.value && (r.value.removeEventListener("keydown", a), r.value.removeEventListener("focusin", T), r.value.removeEventListener("focusout", f), r.value = void 0);
}), {
onKeydown: a
};
}
});
function Ost(t, e, r, n, i, o) {
return Pr(t.$slots, "default", { handleKeydown: t.onKeydown });
}
var nU = /* @__PURE__ */ Hn(Ast, [["render", Ost], ["__file", "focus-trap.vue"]]);
const Cst = ["fixed", "absolute"], kst = Sn({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: Gr(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: !0
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: vg,
default: "bottom"
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
strategy: {
type: String,
values: Cst,
default: "absolute"
}
}), iU = Sn({
...kst,
id: String,
style: {
type: Gr([String, Array, Object])
},
className: {
type: Gr([String, Array, Object])
},
effect: {
type: Gr(String),
default: "dark"
},
visible: Boolean,
enterable: {
type: Boolean,
default: !0
},
pure: Boolean,
focusOnShow: {
type: Boolean,
default: !1
},
trapping: {
type: Boolean,
default: !1
},
popperClass: {
type: Gr([String, Array, Object])
},
popperStyle: {
type: Gr([String, Array, Object])
},
referenceEl: {
type: Gr(Object)
},
triggerTargetEl: {
type: Gr(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: !0
},
virtualTriggering: Boolean,
zIndex: Number,
...ol(["ariaLabel"])
}), Ist = {
mouseenter: (t) => t instanceof MouseEvent,
mouseleave: (t) => t instanceof MouseEvent,
focus: () => !0,
blur: () => !0,
close: () => !0
}, Pst = (t, e = []) => {
const { placement: r, strategy: n, popperOptions: i } = t, o = {
placement: r,
strategy: n,
...i,
modifiers: [...Rst(t), ...e]
};
return Nst(o, i == null ? void 0 : i.modifiers), o;
}, Vst = (t) => {
if (s1)
return T4(t);
};
function Rst(t) {
const { offset: e, gpuAcceleration: r, fallbackPlacements: n } = t;
return [
{
name: "offset",
options: {
offset: [0, e ?? 12]
}
},
{
name: "preventOverflow",
options: {
padding: {
top: 2,
bottom: 2,
left: 5,
right: 5
}
}
},
{
name: "flip",
options: {
padding: 5,
fallbackPlacements: n
}
},
{
name: "computeStyles",
options: {
gpuAcceleration: r
}
}
];
}
function Nst(t, e) {
e && (t.modifiers = [...t.modifiers, ...e ?? []]);
}
const Dst = 0, Fst = (t) => {
const { popperInstanceRef: e, contentRef: r, triggerRef: n, role: i } = ln(_S, void 0), o = Ie(), s = Ie(), a = Kt(() => ({
name: "eventListeners",
enabled: !!t.visible
})), u = Kt(() => {
var x;
const O = vt(o), k = (x = vt(s)) != null ? x : Dst;
return {
name: "arrow",
enabled: !fz(O),
options: {
element: O,
padding: k
}
};
}), d = Kt(() => ({
onFirstUpdate: () => {
_();
},
...Pst(t, [
vt(u),
vt(a)
])
})), T = Kt(() => Vst(t.referenceEl) || vt(n)), { attributes: f, state: Q, styles: y, update: _, forceUpdate: L, instanceRef: E } = w2t(T, r, d);
return on(E, (x) => e.value = x), W1(() => {
on(() => {
var x;
return (x = vt(T)) == null ? void 0 : x.getBoundingClientRect();
}, () => {
_();
});
}), {
attributes: f,
arrowRef: o,
contentRef: r,
instanceRef: E,
state: Q,
styles: y,
role: i,
forceUpdate: L,
update: _
};
}, Bst = (t, {
attributes: e,
styles: r,
role: n
}) => {
const { nextZIndex: i } = gS(), o = Bn("popper"), s = Kt(() => vt(e).popper), a = Ie(ro(t.zIndex) ? t.zIndex : i()), u = Kt(() => [
o.b(),
o.is("pure", t.pure),
o.is(t.effect),
t.popperClass
]), d = Kt(() => [
{ zIndex: vt(a) },
vt(r).popper,
t.popperStyle || {}
]), T = Kt(() => n.value === "dialog" ? "false" : void 0), f = Kt(() => vt(r).arrow || {});
return {
ariaModal: T,
arrowStyle: f,
contentAttrs: s,
contentClass: u,
contentStyle: d,
contentZIndex: a,
updateZIndex: () => {
a.value = ro(t.zIndex) ? t.zIndex : i();
}
};
}, jst = (t, e) => {
const r = Ie(!1), n = Ie();
return {
focusStartRef: n,
trapped: r,
onFocusAfterReleased: (d) => {
var T;
((T = d.detail) == null ? void 0 : T.focusReason) !== "pointer" && (n.value = "first", e("blur"));
},
onFocusAfterTrapped: () => {
e("focus");
},
onFocusInTrap: (d) => {
t.visible && !r.value && (d.target && (n.value = d.target), r.value = !0);
},
onFocusoutPrevented: (d) => {
t.trapping || (d.detail.focusReason === "pointer" && d.preventDefault(), r.value = !1);
},
onReleaseRequested: () => {
r.value = !1, e("close");
}
};
}, zst = mr({
name: "ElPopperContent"
}), Ust = /* @__PURE__ */ mr({
...zst,
props: iU,
emits: Ist,
setup(t, { expose: e, emit: r }) {
const n = t, {
focusStartRef: i,
trapped: o,
onFocusAfterReleased: s,
onFocusAfterTrapped: a,
onFocusInTrap: u,
onFocusoutPrevented: d,
onReleaseRequested: T
} = jst(n, r), { attributes: f, arrowRef: Q, contentRef: y, styles: _, instanceRef: L, role: E, update: x } = Fst(n), {
ariaModal: O,
arrowStyle: k,
contentAttrs: R,
contentClass: F,
contentStyle: U,
updateZIndex: $
} = Bst(n, {
styles: _,
attributes: f,
role: E
}), et = ln(NQ, void 0), nt = Ie();
$1(Xz, {
arrowStyle: k,
arrowRef: Q,
arrowOffset: nt
}), et && $1(NQ, {
...et,
addInputId: O5,
removeInputId: O5
});
let ct;
const rt = (It = !0) => {
x(), It && $();
}, gt = () => {
rt(!1), n.visible && n.focusOnShow ? o.value = !0 : n.visible === !1 && (o.value = !1);
};
return W1(() => {
on(() => n.triggerTargetEl, (It, Zt) => {
ct == null || ct(), ct = void 0;
const oe = vt(It || y.value), re = vt(Zt || y.value);
C5(oe) && (ct = on([E, () => n.ariaLabel, O, () => n.id], (Ve) => {
["role", "aria-label", "aria-modal", "id"].forEach((yr, qr) => {
gg(Ve[qr]) ? oe.removeAttribute(yr) : oe.setAttribute(yr, Ve[qr]);
});
}, { immediate: !0 })), re !== oe && C5(re) && ["role", "aria-label", "aria-modal", "id"].forEach((Ve) => {
re.removeAttribute(Ve);
});
}, { immediate: !0 }), on(() => n.visible, gt, { immediate: !0 });
}), Rs(() => {
ct == null || ct(), ct = void 0;
}), e({
popperContentRef: y,
popperInstanceRef: L,
updatePopper: rt,
contentStyle: U
}), (It, Zt) => (ce(), Ye("div", el({
ref_key: "contentRef",
ref: y
}, vt(R), {
style: vt(U),
class: vt(F),
tabindex: "-1",
onMouseenter: (oe) => It.$emit("mouseenter", oe),
onMouseleave: (oe) => It.$emit("mouseleave", oe)
}), [
Ce(vt(nU), {
trapped: vt(o),
"trap-on-focus-in": !0,
"focus-trap-el": vt(y),
"focus-start-el": vt(i),
onFocusAfterTrapped: vt(a),
onFocusAfterReleased: vt(s),
onFocusin: vt(u),
onFocusoutPrevented: vt(d),
onReleaseRequested: vt(T)
}, {
default: fe(() => [
Pr(It.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16, ["onMouseenter", "onMouseleave"]));
}
});
var Gst = /* @__PURE__ */ Hn(Ust, [["__file", "content.vue"]]);
const $st = v2(pst), wS = Symbol("elTooltip"), W2 = Sn({
...A2t,
...iU,
appendTo: {
type: Gr([String, Object])
},
content: {
type: String,
default: ""
},
rawContent: Boolean,
persistent: Boolean,
visible: {
type: Gr(Boolean),
default: null
},
transition: String,
teleported: {
type: Boolean,
default: !0
},
disabled: Boolean,
...ol(["ariaLabel"])
}), Fh = Sn({
...tU,
disabled: Boolean,
trigger: {
type: Gr([String, Array]),
default: "hover"
},
triggerKeys: {
type: Gr(Array),
default: () => [Rh.enter, Rh.space]
}
}), {
useModelToggleProps: Wst,
useModelToggleEmits: Zst,
useModelToggle: qst
} = _ot("visible"), Xst = Sn({
...Kz,
...Wst,
...W2,
...Fh,
...Yz,
showArrow: {
type: Boolean,
default: !0
}
}), Kst = [
...Zst,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
], Yst = (t, e) => p2(t) ? t.includes(e) : t === e, Xl = (t, e, r) => (n) => {
Yst(vt(t), e) && r(n);
}, Jst = mr({
name: "ElTooltipTrigger"
}), tat = /* @__PURE__ */ mr({
...Jst,
props: Fh,
setup(t, { expose: e }) {
const r = t, n = Bn("tooltip"), { controlled: i, id: o, open: s, onOpen: a, onClose: u, onToggle: d } = ln(wS, void 0), T = Ie(null), f = () => {
if (vt(i) || r.disabled)
return !0;
}, Q = X2(r, "trigger"), y = o4(f, Xl(Q, "hover", a)), _ = o4(f, Xl(Q, "hover", u)), L = o4(f, Xl(Q, "click", (R) => {
R.button === 0 && d(R);
})), E = o4(f, Xl(Q, "focus", a)), x = o4(f, Xl(Q, "focus", u)), O = o4(f, Xl(Q, "contextmenu", (R) => {
R.preventDefault(), d(R);
})), k = o4(f, (R) => {
const { code: F } = R;
r.triggerKeys.includes(F) && (R.preventDefault(), d(R));
});
return e({
triggerRef: T
}), (R, F) => (ce(), Or(vt(vst), {
id: vt(o),
"virtual-ref": R.virtualRef,
open: vt(s),
"virtual-triggering": R.virtualTriggering,
class: Be(vt(n).e("trigger")),
onBlur: vt(x),
onClick: vt(L),
onContextmenu: vt(O),
onFocus: vt(E),
onMouseenter: vt(y),
onMouseleave: vt(_),
onKeydown: vt(k)
}, {
default: fe(() => [
Pr(R.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
}
});
var eat = /* @__PURE__ */ Hn(tat, [["__file", "trigger.vue"]]);
const rat = Sn({
to: {
type: Gr([String, Object]),
required: !0
},
disabled: Boolean
}), nat = /* @__PURE__ */ mr({
__name: "teleport",
props: rat,
setup(t) {
return (e, r) => e.disabled ? Pr(e.$slots, "default", { key: 0 }) : (ce(), Or(get, {
key: 1,
to: e.to
}, [
Pr(e.$slots, "default")
], 8, ["to"]));
}
});
var iat = /* @__PURE__ */ Hn(nat, [["__file", "teleport.vue"]]);
const oU = v2(iat), oat = mr({
name: "ElTooltipContent",
inheritAttrs: !1
}), sat = /* @__PURE__ */ mr({
...oat,
props: W2,
setup(t, { expose: e }) {
const r = t, { selector: n } = zz(), i = Bn("tooltip"), o = Ie(null);
let s;
const {
controlled: a,
id: u,
open: d,
trigger: T,
onClose: f,
onOpen: Q,
onShow: y,
onHide: _,
onBeforeShow: L,
onBeforeHide: E
} = ln(wS, void 0), x = Kt(() => r.transition || `${i.namespace.value}-fade-in-linear`), O = Kt(() => process.env.NODE_ENV === "test" ? !0 : r.persistent);
Rs(() => {
s == null || s();
});
const k = Kt(() => vt(O) ? !0 : vt(d)), R = Kt(() => r.disabled ? !1 : vt(d)), F = Kt(() => r.appendTo || n.value), U = Kt(() => {
var re;
return (re = r.style) != null ? re : {};
}), $ = Ie(!0), et = () => {
_(), $.value = !0;
}, nt = () => {
if (vt(a))
return !0;
}, ct = o4(nt, () => {
r.enterable && vt(T) === "hover" && Q();
}), rt = o4(nt, () => {
vt(T) === "hover" && f();
}), gt = () => {
var re, Ve;
(Ve = (re = o.value) == null ? void 0 : re.updatePopper) == null || Ve.call(re), L == null || L();
}, It = () => {
E == null || E();
}, Zt = () => {
y(), s = Vet(Kt(() => {
var re;
return (re = o.value) == null ? void 0 : re.popperContentRef;
}), () => {
if (vt(a))
return;
vt(T) !== "hover" && f();
});
}, oe = () => {
r.virtualTriggering || f();
};
return on(() => vt(d), (re) => {
re ? $.value = !1 : s == null || s();
}, {
flush: "post"
}), on(() => r.content, () => {
var re, Ve;
(Ve = (re = o.value) == null ? void 0 : re.updatePopper) == null || Ve.call(re);
}), e({
contentRef: o
}), (re, Ve) => (ce(), Or(vt(oU), {
disabled: !re.teleported,
to: vt(F)
}, {
default: fe(() => [
Ce(ad, {
name: vt(x),
onAfterLeave: et,
onBeforeEnter: gt,
onAfterEnter: Zt,
onBeforeLeave: It
}, {
default: fe(() => [
vt(k) ? Ti((ce(), Or(vt(Gst), el({
key: 0,
id: vt(u),
ref_key: "contentRef",
ref: o
}, re.$attrs, {
"aria-label": re.ariaLabel,
"aria-hidden": $.value,
"boundaries-padding": re.boundariesPadding,
"fallback-placements": re.fallbackPlacements,
"gpu-acceleration": re.gpuAcceleration,
offset: re.offset,
placement: re.placement,
"popper-options": re.popperOptions,
strategy: re.strategy,
effect: re.effect,
enterable: re.enterable,
pure: re.pure,
"popper-class": re.popperClass,
"popper-style": [re.popperStyle, vt(U)],
"reference-el": re.referenceEl,
"trigger-target-el": re.triggerTargetEl,
visible: vt(R),
"z-index": re.zIndex,
onMouseenter: vt(ct),
onMouseleave: vt(rt),
onBlur: oe,
onClose: vt(f)
}), {
default: fe(() => [
Pr(re.$slots, "default")
]),
_: 3
}, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
[zo, vt(R)]
]) : Fr("v-if", !0)
]),
_: 3
}, 8, ["name"])
]),
_: 3
}, 8, ["disabled", "to"]));
}
});
var aat = /* @__PURE__ */ Hn(sat, [["__file", "content.vue"]]);
const lat = mr({
name: "ElTooltip"
}), cat = /* @__PURE__ */ mr({
...lat,
props: Xst,
emits: Kst,
setup(t, { expose: e, emit: r }) {
const n = t;
H2t();
const i = z5(), o = Ie(), s = Ie(), a = () => {
var x;
const O = vt(o);
O && ((x = O.popperInstanceRef) == null || x.update());
}, u = Ie(!1), d = Ie(), { show: T, hide: f, hasUpdateHandler: Q } = qst({
indicator: u,
toggleReason: d
}), { onOpen: y, onClose: _ } = O2t({
showAfter: X2(n, "showAfter"),
hideAfter: X2(n, "hideAfter"),
autoClose: X2(n, "autoClose"),
open: T,
close: f
}), L = Kt(() => M4(n.visible) && !Q.value);
$1(wS, {
controlled: L,
id: i,
open: $j(u),
trigger: X2(n, "trigger"),
onOpen: (x) => {
y(x);
},
onClose: (x) => {
_(x);
},
onToggle: (x) => {
vt(u) ? _(x) : y(x);
},
onShow: () => {
r("show", d.value);
},
onHide: () => {
r("hide", d.value);
},
onBeforeShow: () => {
r("before-show", d.value);
},
onBeforeHide: () => {
r("before-hide", d.value);
},
updatePopper: a
}), on(() => n.disabled, (x) => {
x && u.value && (u.value = !1);
});
const E = (x) => {
var O, k;
const R = (k = (O = s.value) == null ? void 0 : O.contentRef) == null ? void 0 : k.popperContentRef, F = (x == null ? void 0 : x.relatedTarget) || document.activeElement;
return R && R.contains(F);
};
return yet(() => u.value && f()), e({
popperRef: o,
contentRef: s,
isFocusInsideContent: E,
updatePopper: a,
onOpen: y,
onClose: _,
hide: f
}), (x, O) => (ce(), Or(vt($st), {
ref_key: "popperRef",
ref: o,
role: x.role
}, {
default: fe(() => [
Ce(eat, {
disabled: x.disabled,
trigger: x.trigger,
"trigger-keys": x.triggerKeys,
"virtual-ref": x.virtualRef,
"virtual-triggering": x.virtualTriggering
}, {
default: fe(() => [
x.$slots.default ? Pr(x.$slots, "default", { key: 0 }) : Fr("v-if", !0)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
Ce(aat, {
ref_key: "contentRef",
ref: s,
"aria-label": x.ariaLabel,
"boundaries-padding": x.boundariesPadding,
content: x.content,
disabled: x.disabled,
effect: x.effect,
enterable: x.enterable,
"fallback-placements": x.fallbackPlacements,
"hide-after": x.hideAfter,
"gpu-acceleration": x.gpuAcceleration,
offset: x.offset,
persistent: x.persistent,
"popper-class": x.popperClass,
"popper-style": x.popperStyle,
placement: x.placement,
"popper-options": x.popperOptions,
pure: x.pure,
"raw-content": x.rawContent,
"reference-el": x.referenceEl,
"trigger-target-el": x.triggerTargetEl,
"show-after": x.showAfter,
strategy: x.strategy,
teleported: x.teleported,
transition: x.transition,
"virtual-triggering": x.virtualTriggering,
"z-index": x.zIndex,
"append-to": x.appendTo
}, {
default: fe(() => [
Pr(x.$slots, "content", {}, () => [
x.rawContent ? (ce(), Ye("span", {
key: 0,
innerHTML: x.content
}, null, 8, ["innerHTML"])) : (ce(), Ye("span", { key: 1 }, fi(x.content), 1))
]),
x.showArrow ? (ce(), Or(vt(Qst), {
key: 0,
"arrow-offset": x.arrowOffset
}, null, 8, ["arrow-offset"])) : Fr("v-if", !0)
]),
_: 3
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
]),
_: 3
}, 8, ["role"]));
}
});
var uat = /* @__PURE__ */ Hn(cat, [["__file", "tooltip.vue"]]);
const sU = v2(uat), aU = Symbol("buttonGroupContextKey"), hat = (t, e) => {
u8({
from: "type.text",
replacement: "link",
version: "3.0.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
}, Kt(() => t.type === "text"));
const r = ln(aU, void 0), n = bg("button"), { form: i } = J8(), o = M8(Kt(() => r == null ? void 0 : r.size)), s = Lg(), a = Ie(), u = hg(), d = Kt(() => t.type || (r == null ? void 0 : r.type) || ""), T = Kt(() => {
var _, L, E;
return (E = (L = t.autoInsertSpace) != null ? L : (_ = n.value) == null ? void 0 : _.autoInsertSpace) != null ? E : !1;
}), f = Kt(() => t.tag === "button" ? {
ariaDisabled: s.value || t.loading,
disabled: s.value || t.loading,
autofocus: t.autofocus,
type: t.nativeType
} : {}), Q = Kt(() => {
var _;
const L = (_ = u.default) == null ? void 0 : _.call(u);
if (T.value && (L == null ? void 0 : L.length) === 1) {
const E = L[0];
if ((E == null ? void 0 : E.type) === Zj) {
const x = E.children;
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(x.trim());
}
}
return !1;
});
return {
_disabled: s,
_size: o,
_type: d,
_ref: a,
_props: f,
shouldAddSpace: Q,
handleClick: (_) => {
if (s.value || t.loading) {
_.stopPropagation();
return;
}
t.nativeType === "reset" && (i == null || i.resetFields()), e("click", _);
}
};
}, dat = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
], pat = ["button", "submit", "reset"], mx = Sn({
size: Y8,
disabled: Boolean,
type: {
type: String,
values: dat,
default: ""
},
icon: {
type: _8
},
nativeType: {
type: String,
values: pat,
default: "button"
},
loading: Boolean,
loadingIcon: {
type: _8,
default: () => bz
},
plain: Boolean,
text: Boolean,
link: Boolean,
bg: Boolean,
autofocus: Boolean,
round: Boolean,
circle: Boolean,
color: String,
dark: Boolean,
autoInsertSpace: {
type: Boolean,
default: void 0
},
tag: {
type: Gr([String, Object]),
default: "button"
}
}), Tat = {
click: (t) => t instanceof MouseEvent
};
function io(t, e) {
fat(t) && (t = "100%");
var r = Qat(t);
return t = e === 360 ? t : Math.min(e, Math.max(0, parseFloat(t))), r && (t = parseInt(String(t * e), 10) / 100), Math.abs(t - e) < 1e-6 ? 1 : (e === 360 ? t = (t < 0 ? t % e + e : t % e) / parseFloat(String(e)) : t = t % e / parseFloat(String(e)), t);
}
function Xp(t) {
return Math.min(1, Math.max(0, t));
}
function fat(t) {
return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1;
}
function Qat(t) {
return typeof t == "string" && t.indexOf("%") !== -1;
}
function lU(t) {
return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
}
function Kp(t) {
return t <= 1 ? "".concat(Number(t) * 100, "%") : t;
}
function E5(t) {
return t.length === 1 ? "0" + t : String(t);
}
function mat(t, e, r) {
return {
r: io(t, 255) * 255,
g: io(e, 255) * 255,
b: io(r, 255) * 255
};
}
function fI(t, e, r) {
t = io(t, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t, e, r), i = Math.min(t, e, r), o = 0, s = 0, a = (n + i) / 2;
if (n === i)
s = 0, o = 0;
else {
var u = n - i;
switch (s = a > 0.5 ? u / (2 - n - i) : u / (n + i), n) {
case t:
o = (e - r) / u + (e < r ? 6 : 0);
break;
case e:
o = (r - t) / u + 2;
break;
case r:
o = (t - e) / u + 4;
break;
}
o /= 6;
}
return { h: o, s, l: a };
}
function mb(t, e, r) {
return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * (6 * r) : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t;
}
function gat(t, e, r) {
var n, i, o;
if (t = io(t, 360), e = io(e, 100), r = io(r, 100), e === 0)
i = r, o = r, n = r;
else {
var s = r < 0.5 ? r * (1 + e) : r + e - r * e, a = 2 * r - s;
n = mb(a, s, t + 1 / 3), i = mb(a, s, t), o = mb(a, s, t - 1 / 3);
}
return { r: n * 255, g: i * 255, b: o * 255 };
}
function QI(t, e, r) {
t = io(t, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t, e, r), i = Math.min(t, e, r), o = 0, s = n, a = n - i, u = n === 0 ? 0 : a / n;
if (n === i)
o = 0;
else {
switch (n) {
case t:
o = (e - r) / a + (e < r ? 6 : 0);
break;
case e:
o = (r - t) / a + 2;
break;
case r:
o = (t - e) / a + 4;
break;
}
o /= 6;
}
return { h: o, s: u, v: s };
}
function yat(t, e, r) {
t = io(t, 360) * 6, e = io(e, 100), r = io(r, 100);
var n = Math.floor(t), i = t - n, o = r * (1 - e), s = r * (1 - i * e), a = r * (1 - (1 - i) * e), u = n % 6, d = [r, s, o, o, a, r][u], T = [a, r, r, s, o, o][u], f = [o, o, a, r, r, s][u];
return { r: d * 255, g: T * 255, b: f * 255 };
}
function mI(t, e, r, n) {
var i = [
E5(Math.round(t).toString(16)),
E5(Math.round(e).toString(16)),
E5(Math.round(r).toString(16))
];
return n && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) : i.join("");
}
function vat(t, e, r, n, i) {
var o = [
E5(Math.round(t).toString(16)),
E5(Math.round(e).toString(16)),
E5(Math.round(r).toString(16)),
E5(_at(n))
];
return i && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) && o[3].startsWith(o[3].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) + o[3].charAt(0) : o.join("");
}
function _at(t) {
return Math.round(parseFloat(t) * 255).toString(16);
}
function gI(t) {
return U2(t) / 255;
}
function U2(t) {
return parseInt(t, 16);
}
function bat(t) {
return {
r: t >> 16,
g: (t & 65280) >> 8,
b: t & 255
};
}
var gx = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function Lat(t) {
var e = { r: 0, g: 0, b: 0 }, r = 1, n = null, i = null, o = null, s = !1, a = !1;
return typeof t == "string" && (t = Eat(t)), typeof t == "object" && ($3(t.r) && $3(t.g) && $3(t.b) ? (e = mat(t.r, t.g, t.b), s = !0, a = String(t.r).substr(-1) === "%" ? "prgb" : "rgb") : $3(t.h) && $3(t.s) && $3(t.v) ? (n = Kp(t.s), i = Kp(t.v), e = yat(t.h, n, i), s = !0, a = "hsv") : $3(t.h) && $3(t.s) && $3(t.l) && (n = Kp(t.s), o = Kp(t.l), e = gat(t.h, n, o), s = !0, a = "hsl"), Object.prototype.hasOwnProperty.call(t, "a") && (r = t.a)), r = lU(r), {
ok: s,
format: t.format || a,
r: Math.min(255, Math.max(e.r, 0)),
g: Math.min(255, Math.max(e.g, 0)),
b: Math.min(255, Math.max(e.b, 0)),
a: r
};
}
var wat = "[-\\+]?\\d+%?", xat = "[-\\+]?\\d*\\.\\d+%?", q6 = "(?:".concat(xat, ")|(?:").concat(wat, ")"), gb = "[\\s|\\(]+(".concat(q6, ")[,|\\s]+(").concat(q6, ")[,|\\s]+(").concat(q6, ")\\s*\\)?"), yb = "[\\s|\\(]+(".concat(q6, ")[,|\\s]+(").concat(q6, ")[,|\\s]+(").concat(q6, ")[,|\\s]+(").concat(q6, ")\\s*\\)?"), Js = {
CSS_UNIT: new RegExp(q6),
rgb: new RegExp("rgb" + gb),
rgba: new RegExp("rgba" + yb),
hsl: new RegExp("hsl" + gb),
hsla: new RegExp("hsla" + yb),
hsv: new RegExp("hsv" + gb),
hsva: new RegExp("hsva" + yb),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function Eat(t) {
if (t = t.trim().toLowerCase(), t.length === 0)
return !1;
var e = !1;
if (gx[t])
t = gx[t], e = !0;
else if (t === "transparent")
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
var r = Js.rgb.exec(t);
return r ? { r: r[1], g: r[2], b: r[3] } : (r = Js.rgba.exec(t), r ? { r: r[1], g: r[2], b: r[3], a: r[4] } : (r = Js.hsl.exec(t), r ? { h: r[1], s: r[2], l: r[3] } : (r = Js.hsla.exec(t), r ? { h: r[1], s: r[2], l: r[3], a: r[4] } : (r = Js.hsv.exec(t), r ? { h: r[1], s: r[2], v: r[3] } : (r = Js.hsva.exec(t), r ? { h: r[1], s: r[2], v: r[3], a: r[4] } : (r = Js.hex8.exec(t), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
a: gI(r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex6.exec(t), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
format: e ? "name" : "hex"
} : (r = Js.hex4.exec(t), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
a: gI(r[4] + r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex3.exec(t), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
format: e ? "name" : "hex"
} : !1)))))))));
}
function $3(t) {
return !!Js.CSS_UNIT.exec(String(t));
}
var Mat = (
/** @class */
function() {
function t(e, r) {
e === void 0 && (e = ""), r === void 0 && (r = {});
var n;
if (e instanceof t)
return e;
typeof e == "number" && (e = bat(e)), this.originalInput = e;
var i = Lat(e);
this.originalInput = e, this.r = i.r, this.g = i.g, this.b = i.b, this.a = i.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (n = r.format) !== null && n !== void 0 ? n : i.format, this.gradientType = r.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = i.ok;
}
return t.prototype.isDark = function() {
return this.getBrightness() < 128;
}, t.prototype.isLight = function() {
return !this.isDark();
}, t.prototype.getBrightness = function() {
var e = this.toRgb();
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
}, t.prototype.getLuminance = function() {
var e = this.toRgb(), r, n, i, o = e.r / 255, s = e.g / 255, a = e.b / 255;
return o <= 0.03928 ? r = o / 12.92 : r = Math.pow((o + 0.055) / 1.055, 2.4), s <= 0.03928 ? n = s / 12.92 : n = Math.pow((s + 0.055) / 1.055, 2.4), a <= 0.03928 ? i = a / 12.92 : i = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * r + 0.7152 * n + 0.0722 * i;
}, t.prototype.getAlpha = function() {
return this.a;
}, t.prototype.setAlpha = function(e) {
return this.a = lU(e), this.roundA = Math.round(100 * this.a) / 100, this;
}, t.prototype.isMonochrome = function() {
var e = this.toHsl().s;
return e === 0;
}, t.prototype.toHsv = function() {
var e = QI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
}, t.prototype.toHsvString = function() {
var e = QI(this.r, this.g, this.b), r = Math.round(e.h * 360), n = Math.round(e.s * 100), i = Math.round(e.v * 100);
return this.a === 1 ? "hsv(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsva(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
}, t.prototype.toHsl = function() {
var e = fI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
}, t.prototype.toHslString = function() {
var e = fI(this.r, this.g, this.b), r = Math.round(e.h * 360), n = Math.round(e.s * 100), i = Math.round(e.l * 100);
return this.a === 1 ? "hsl(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsla(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
}, t.prototype.toHex = function(e) {
return e === void 0 && (e = !1), mI(this.r, this.g, this.b, e);
}, t.prototype.toHexString = function(e) {
return e === void 0 && (e = !1), "#" + this.toHex(e);
}, t.prototype.toHex8 = function(e) {
return e === void 0 && (e = !1), vat(this.r, this.g, this.b, this.a, e);
}, t.prototype.toHex8String = function(e) {
return e === void 0 && (e = !1), "#" + this.toHex8(e);
}, t.prototype.toHexShortString = function(e) {
return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
}, t.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
}, t.prototype.toRgbString = function() {
var e = Math.round(this.r), r = Math.round(this.g), n = Math.round(this.b);
return this.a === 1 ? "rgb(".concat(e, ", ").concat(r, ", ").concat(n, ")") : "rgba(".concat(e, ", ").concat(r, ", ").concat(n, ", ").concat(this.roundA, ")");
}, t.prototype.toPercentageRgb = function() {
var e = function(r) {
return "".concat(Math.round(io(r, 255) * 100), "%");
};
return {
r: e(this.r),
g: e(this.g),
b: e(this.b),
a: this.a
};
}, t.prototype.toPercentageRgbString = function() {
var e = function(r) {
return Math.round(io(r, 255) * 100);
};
return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")");
}, t.prototype.toName = function() {
if (this.a === 0)
return "transparent";
if (this.a < 1)
return !1;
for (var e = "#" + mI(this.r, this.g, this.b, !1), r = 0, n = Object.entries(gx); r < n.length; r++) {
var i = n[r], o = i[0], s = i[1];
if (e === s)
return o;
}
return !1;
}, t.prototype.toString = function(e) {
var r = !!e;
e = e ?? this.format;
var n = !1, i = this.a < 1 && this.a >= 0, o = !r && i && (e.startsWith("hex") || e === "name");
return o ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), n || this.toHexString());
}, t.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
}, t.prototype.clone = function() {
return new t(this.toString());
}, t.prototype.lighten = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l += e / 100, r.l = Xp(r.l), new t(r);
}, t.prototype.brighten = function(e) {
e === void 0 && (e = 10);
var r = this.toRgb();
return r.r = Math.max(0, Math.min(255, r.r - Math.round(255 * -(e / 100)))), r.g = Math.max(0, Math.min(255, r.g - Math.round(255 * -(e / 100)))), r.b = Math.max(0, Math.min(255, r.b - Math.round(255 * -(e / 100)))), new t(r);
}, t.prototype.darken = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l -= e / 100, r.l = Xp(r.l), new t(r);
}, t.prototype.tint = function(e) {
return e === void 0 && (e = 10), this.mix("white", e);
}, t.prototype.shade = function(e) {
return e === void 0 && (e = 10), this.mix("black", e);
}, t.prototype.desaturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s -= e / 100, r.s = Xp(r.s), new t(r);
}, t.prototype.saturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s += e / 100, r.s = Xp(r.s), new t(r);
}, t.prototype.greyscale = function() {
return this.desaturate(100);
}, t.prototype.spin = function(e) {
var r = this.toHsl(), n = (r.h + e) % 360;
return r.h = n < 0 ? 360 + n : n, new t(r);
}, t.prototype.mix = function(e, r) {
r === void 0 && (r = 50);
var n = this.toRgb(), i = new t(e).toRgb(), o = r / 100, s = {
r: (i.r - n.r) * o + n.r,
g: (i.g - n.g) * o + n.g,
b: (i.b - n.b) * o + n.b,
a: (i.a - n.a) * o + n.a
};
return new t(s);
}, t.prototype.analogous = function(e, r) {
e === void 0 && (e = 6), r === void 0 && (r = 30);
var n = this.toHsl(), i = 360 / r, o = [this];
for (n.h = (n.h - (i * e >> 1) + 720) % 360; --e; )
n.h = (n.h + i) % 360, o.push(new t(n));
return o;
}, t.prototype.complement = function() {
var e = this.toHsl();
return e.h = (e.h + 180) % 360, new t(e);
}, t.prototype.monochromatic = function(e) {
e === void 0 && (e = 6);
for (var r = this.toHsv(), n = r.h, i = r.s, o = r.v, s = [], a = 1 / e; e--; )
s.push(new t({ h: n, s: i, v: o })), o = (o + a) % 1;
return s;
}, t.prototype.splitcomplement = function() {
var e = this.toHsl(), r = e.h;
return [
this,
new t({ h: (r + 72) % 360, s: e.s, l: e.l }),
new t({ h: (r + 216) % 360, s: e.s, l: e.l })
];
}, t.prototype.onBackground = function(e) {
var r = this.toRgb(), n = new t(e).toRgb(), i = r.a + n.a * (1 - r.a);
return new t({
r: (r.r * r.a + n.r * n.a * (1 - r.a)) / i,
g: (r.g * r.a + n.g * n.a * (1 - r.a)) / i,
b: (r.b * r.a + n.b * n.a * (1 - r.a)) / i,
a: i
});
}, t.prototype.triad = function() {
return this.polyad(3);
}, t.prototype.tetrad = function() {
return this.polyad(4);
}, t.prototype.polyad = function(e) {
for (var r = this.toHsl(), n = r.h, i = [this], o = 360 / e, s = 1; s < e; s++)
i.push(new t({ h: (n + s * o) % 360, s: r.s, l: r.l }));
return i;
}, t.prototype.equals = function(e) {
return this.toRgbString() === new t(e).toRgbString();
}, t;
}()
);
function m6(t, e = 20) {
return t.mix("#141414", e).toString();
}
function Sat(t) {
const e = Lg(), r = Bn("button");
return Kt(() => {
let n = {}, i = t.color;
if (i) {
const o = i.match(/var\((.*?)\)/);
o && (i = window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1]));
const s = new Mat(i), a = t.dark ? s.tint(20).toString() : m6(s, 20);
if (t.plain)
n = r.cssVarBlock({
"bg-color": t.dark ? m6(s, 90) : s.tint(90).toString(),
"text-color": i,
"border-color": t.dark ? m6(s, 50) : s.tint(50).toString(),
"hover-text-color": `var(${r.cssVarName("color-white")})`,
"hover-bg-color": i,
"hover-border-color": i,
"active-bg-color": a,
"active-text-color": `var(${r.cssVarName("color-white")})`,
"active-border-color": a
}), e.value && (n[r.cssVarBlockName("disabled-bg-color")] = t.dark ? m6(s, 90) : s.tint(90).toString(), n[r.cssVarBlockName("disabled-text-color")] = t.dark ? m6(s, 50) : s.tint(50).toString(), n[r.cssVarBlockName("disabled-border-color")] = t.dark ? m6(s, 80) : s.tint(80).toString());
else {
const u = t.dark ? m6(s, 30) : s.tint(30).toString(), d = s.isDark() ? `var(${r.cssVarName("color-white")})` : `var(${r.cssVarName("color-black")})`;
if (n = r.cssVarBlock({
"bg-color": i,
"text-color": d,
"border-color": i,
"hover-bg-color": u,
"hover-text-color": d,
"hover-border-color": u,
"active-bg-color": a,
"active-border-color": a
}), e.value) {
const T = t.dark ? m6(s, 50) : s.tint(50).toString();
n[r.cssVarBlockName("disabled-bg-color")] = T, n[r.cssVarBlockName("disabled-text-color")] = t.dark ? "rgba(255, 255, 255, 0.5)" : `var(${r.cssVarName("color-white")})`, n[r.cssVarBlockName("disabled-border-color")] = T;
}
}
}
return n;
});
}
const Hat = mr({
name: "ElButton"
}), Aat = /* @__PURE__ */ mr({
...Hat,
props: mx,
emits: Tat,
setup(t, { expose: e, emit: r }) {
const n = t, i = Sat(n), o = Bn("button"), { _ref: s, _size: a, _type: u, _disabled: d, _props: T, shouldAddSpace: f, handleClick: Q } = hat(n, r), y = Kt(() => [
o.b(),
o.m(u.value),
o.m(a.value),
o.is("disabled", d.value),
o.is("loading", n.loading),
o.is("plain", n.plain),
o.is("round", n.round),
o.is("circle", n.circle),
o.is("text", n.text),
o.is("link", n.link),
o.is("has-bg", n.bg)
]);
return e({
ref: s,
size: a,
type: u,
disabled: d,
shouldAddSpace: f
}), (_, L) => (ce(), Or(Ss(_.tag), el({
ref_key: "_ref",
ref: s
}, vt(T), {
class: vt(y),
style: vt(i),
onClick: vt(Q)
}), {
default: fe(() => [
_.loading ? (ce(), Ye(to, { key: 0 }, [
_.$slots.loading ? Pr(_.$slots, "loading", { key: 0 }) : (ce(), Or(vt(p3), {
key: 1,
class: Be(vt(o).is("loading"))
}, {
default: fe(() => [
(ce(), Or(Ss(_.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : _.icon || _.$slots.icon ? (ce(), Or(vt(p3), { key: 1 }, {
default: fe(() => [
_.icon ? (ce(), Or(Ss(_.icon), { key: 0 })) : Pr(_.$slots, "icon", { key: 1 })
]),
_: 3
})) : Fr("v-if", !0),
_.$slots.default ? (ce(), Ye("span", {
key: 2,
class: Be({ [vt(o).em("text", "expand")]: vt(f) })
}, [
Pr(_.$slots, "default")
], 2)) : Fr("v-if", !0)
]),
_: 3
}, 16, ["class", "style", "onClick"]));
}
});
var Oat = /* @__PURE__ */ Hn(Aat, [["__file", "button.vue"]]);
const Cat = {
size: mx.size,
type: mx.type
}, kat = mr({
name: "ElButtonGroup"
}), Iat = /* @__PURE__ */ mr({
...kat,
props: Cat,
setup(t) {
const e = t;
$1(aU, u3({
size: X2(e, "size"),
type: X2(e, "type")
}));
const r = Bn("button");
return (n, i) => (ce(), Ye("div", {
class: Be(vt(r).b("group"))
}, [
Pr(n.$slots, "default")
], 2));
}
});
var cU = /* @__PURE__ */ Hn(Iat, [["__file", "button-group.vue"]]);
const uU = v2(Oat, {
ButtonGroup: cU
});
il(cU);
var Pat = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Vat(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
const H6 = /* @__PURE__ */ new Map();
if (s1) {
let t;
document.addEventListener("mousedown", (e) => t = e), document.addEventListener("mouseup", (e) => {
if (t) {
for (const r of H6.values())
for (const { documentHandler: n } of r)
n(e, t);
t = void 0;
}
});
}
function yI(t, e) {
let r = [];
return Array.isArray(e.arg) ? r = e.arg : C5(e.arg) && r.push(e.arg), function(n, i) {
const o = e.instance.popperRef, s = n.target, a = i == null ? void 0 : i.target, u = !e || !e.instance, d = !s || !a, T = t.contains(s) || t.contains(a), f = t === s, Q = r.length && r.some((_) => _ == null ? void 0 : _.contains(s)) || r.length && r.includes(a), y = o && (o.contains(s) || o.contains(a));
u || d || T || f || Q || y || e.value(n, i);
};
}
const Rat = {
beforeMount(t, e) {
H6.has(t) || H6.set(t, []), H6.get(t).push({
documentHandler: yI(t, e),
bindingFn: e.value
});
},
updated(t, e) {
H6.has(t) || H6.set(t, []);
const r = H6.get(t), n = r.findIndex((o) => o.bindingFn === e.oldValue), i = {
documentHandler: yI(t, e),
bindingFn: e.value
};
n >= 0 ? r.splice(n, 1, i) : r.push(i);
},
unmounted(t) {
H6.delete(t);
}
}, hU = {
modelValue: {
type: [Number, String, Boolean],
default: void 0
},
label: {
type: [String, Boolean, Number, Object],
default: void 0
},
value: {
type: [String, Boolean, Number, Object],
default: void 0
},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: {
type: String,
default: void 0
},
trueValue: {
type: [String, Number],
default: void 0
},
falseValue: {
type: [String, Number],
default: void 0
},
trueLabel: {
type: [String, Number],
default: void 0
},
falseLabel: {
type: [String, Number],
default: void 0
},
id: {
type: String,
default: void 0
},
border: Boolean,
size: Y8,
tabindex: [String, Number],
validateEvent: {
type: Boolean,
default: !0
},
...ol(["ariaControls"])
}, dU = {
[Wo]: (t) => sa(t) || ro(t) || M4(t),
change: (t) => sa(t) || ro(t) || M4(t)
}, tc = Symbol("checkboxGroupContextKey"), Nat = ({
model: t,
isChecked: e
}) => {
const r = ln(tc, void 0), n = Kt(() => {
var o, s;
const a = (o = r == null ? void 0 : r.max) == null ? void 0 : o.value, u = (s = r == null ? void 0 : r.min) == null ? void 0 : s.value;
return !Z6(a) && t.value.length >= a && !e.value || !Z6(u) && t.value.length <= u && e.value;
});
return {
isDisabled: Lg(Kt(() => (r == null ? void 0 : r.disabled.value) || n.value)),
isLimitDisabled: n
};
}, Dat = (t, {
model: e,
isLimitExceeded: r,
hasOwnLabel: n,
isDisabled: i,
isLabeledByFormItem: o
}) => {
const s = ln(tc, void 0), { formItem: a } = J8(), { emit: u } = G1();
function d(_) {
var L, E, x, O;
return [!0, t.trueValue, t.trueLabel].includes(_) ? (E = (L = t.trueValue) != null ? L : t.trueLabel) != null ? E : !0 : (O = (x = t.falseValue) != null ? x : t.falseLabel) != null ? O : !1;
}
function T(_, L) {
u("change", d(_), L);
}
function f(_) {
if (r.value)
return;
const L = _.target;
u("change", d(L.checked), _);
}
async function Q(_) {
r.value || !n.value && !i.value && o.value && (_.composedPath().some((x) => x.tagName === "LABEL") || (e.value = d([!1, t.falseValue, t.falseLabel].includes(e.value)), await i1(), T(e.value, _)));
}
const y = Kt(() => (s == null ? void 0 : s.validateEvent) || t.validateEvent);
return on(() => t.modelValue, () => {
y.value && (a == null || a.validate("change").catch((_) => y2(_)));
}), {
handleChange: f,
onClickRoot: Q
};
}, Fat = (t) => {
const e = Ie(!1), { emit: r } = G1(), n = ln(tc, void 0), i = Kt(() => Z6(n) === !1), o = Ie(!1), s = Kt({
get() {
var a, u;
return i.value ? (a = n == null ? void 0 : n.modelValue) == null ? void 0 : a.value : (u = t.modelValue) != null ? u : e.value;
},
set(a) {
var u, d;
i.value && p2(a) ? (o.value = ((u = n == null ? void 0 : n.max) == null ? void 0 : u.value) !== void 0 && a.length > (n == null ? void 0 : n.max.value) && a.length > s.value.length, o.value === !1 && ((d = n == null ? void 0 : n.changeEvent) == null || d.call(n, a))) : (r(Wo, a), e.value = a);
}
});
return {
model: s,
isGroup: i,
isLimitExceeded: o
};
}, Bat = (t, e, { model: r }) => {
const n = ln(tc, void 0), i = Ie(!1), o = Kt(() => Ph(t.value) ? t.label : t.value), s = Kt(() => {
const T = r.value;
return M4(T) ? T : p2(T) ? T2(o.value) ? T.map(Ch).some((f) => PQ(f, o.value)) : T.map(Ch).includes(o.value) : T != null ? T === t.trueValue || T === t.trueLabel : !!T;
}), a = M8(Kt(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
}), {
prop: !0
}), u = M8(Kt(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
})), d = Kt(() => !!e.default || !Ph(o.value));
return {
checkboxButtonSize: a,
isChecked: s,
isFocused: i,
checkboxSize: u,
hasOwnLabel: d,
actualValue: o
};
}, pU = (t, e) => {
const { formItem: r } = J8(), { model: n, isGroup: i, isLimitExceeded: o } = Fat(t), {
isFocused: s,
isChecked: a,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
actualValue: f
} = Bat(t, e, { model: n }), { isDisabled: Q } = Nat({ model: n, isChecked: a }), { inputId: y, isLabeledByFormItem: _ } = wg(t, {
formItemContext: r,
disableIdGeneration: T,
disableIdManagement: i
}), { handleChange: L, onClickRoot: E } = Dat(t, {
model: n,
isLimitExceeded: o,
hasOwnLabel: T,
isDisabled: Q,
isLabeledByFormItem: _
});
return (() => {
function O() {
var k, R;
p2(n.value) && !n.value.includes(f.value) ? n.value.push(f.value) : n.value = (R = (k = t.trueValue) != null ? k : t.trueLabel) != null ? R : !0;
}
t.checked && O();
})(), u8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => i.value && Ph(t.value))), u8({
from: "true-label",
replacement: "true-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => !!t.trueLabel)), u8({
from: "false-label",
replacement: "false-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => !!t.falseLabel)), {
inputId: y,
isLabeledByFormItem: _,
isChecked: a,
isDisabled: Q,
isFocused: s,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
model: n,
actualValue: f,
handleChange: L,
onClickRoot: E
};
}, jat = mr({
name: "ElCheckbox"
}), zat = /* @__PURE__ */ mr({
...jat,
props: hU,
emits: dU,
setup(t) {
const e = t, r = hg(), {
inputId: n,
isLabeledByFormItem: i,
isChecked: o,
isDisabled: s,
isFocused: a,
checkboxSize: u,
hasOwnLabel: d,
model: T,
actualValue: f,
handleChange: Q,
onClickRoot: y
} = pU(e, r), _ = Bn("checkbox"), L = Kt(() => [
_.b(),
_.m(u.value),
_.is("disabled", s.value),
_.is("bordered", e.border),
_.is("checked", o.value)
]), E = Kt(() => [
_.e("input"),
_.is("disabled", s.value),
_.is("checked", o.value),
_.is("indeterminate", e.indeterminate),
_.is("focus", a.value)
]);
return (x, O) => (ce(), Or(Ss(!vt(d) && vt(i) ? "span" : "label"), {
class: Be(vt(L)),
"aria-controls": x.indeterminate ? x.ariaControls : null,
onClick: vt(y)
}, {
default: fe(() => {
var k, R, F, U;
return [
je("span", {
class: Be(vt(E))
}, [
x.trueValue || x.falseValue || x.trueLabel || x.falseLabel ? Ti((ce(), Ye("input", {
key: 0,
id: vt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(vt(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
name: x.name,
tabindex: x.tabindex,
disabled: vt(s),
"true-value": (R = (k = x.trueValue) != null ? k : x.trueLabel) != null ? R : !0,
"false-value": (U = (F = x.falseValue) != null ? F : x.falseLabel) != null ? U : !1,
onChange: vt(Q),
onFocus: ($) => a.value = !0,
onBlur: ($) => a.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[CQ, vt(T)]
]) : Ti((ce(), Ye("input", {
key: 1,
id: vt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(vt(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
disabled: vt(s),
value: vt(f),
name: x.name,
tabindex: x.tabindex,
onChange: vt(Q),
onFocus: ($) => a.value = !0,
onBlur: ($) => a.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
[CQ, vt(T)]
]),
je("span", {
class: Be(vt(_).e("inner"))
}, null, 2)
], 2),
vt(d) ? (ce(), Ye("span", {
key: 0,
class: Be(vt(_).e("label"))
}, [
Pr(x.$slots, "default"),
x.$slots.default ? Fr("v-if", !0) : (ce(), Ye(to, { key: 0 }, [
xn(fi(x.label), 1)
], 64))
], 2)) : Fr("v-if", !0)
];
}),
_: 3
}, 8, ["class", "aria-controls", "onClick"]));
}
});
var Uat = /* @__PURE__ */ Hn(zat, [["__file", "checkbox.vue"]]);
const Gat = mr({
name: "ElCheckboxButton"
}), $at = /* @__PURE__ */ mr({
...Gat,
props: hU,
emits: dU,
setup(t) {
const e = t, r = hg(), {
isFocused: n,
isChecked: i,
isDisabled: o,
checkboxButtonSize: s,
model: a,
actualValue: u,
handleChange: d
} = pU(e, r), T = ln(tc, void 0), f = Bn("checkbox"), Q = Kt(() => {
var _, L, E, x;
const O = (L = (_ = T == null ? void 0 : T.fill) == null ? void 0 : _.value) != null ? L : "";
return {
backgroundColor: O,
borderColor: O,
color: (x = (E = T == null ? void 0 : T.textColor) == null ? void 0 : E.value) != null ? x : "",
boxShadow: O ? `-1px 0 0 0 ${O}` : void 0
};
}), y = Kt(() => [
f.b("button"),
f.bm("button", s.value),
f.is("disabled", o.value),
f.is("checked", i.value),
f.is("focus", n.value)
]);
return (_, L) => {
var E, x, O, k;
return ce(), Ye("label", {
class: Be(vt(y))
}, [
_.trueValue || _.falseValue || _.trueLabel || _.falseLabel ? Ti((ce(), Ye("input", {
key: 0,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(vt(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: vt(o),
"true-value": (x = (E = _.trueValue) != null ? E : _.trueLabel) != null ? x : !0,
"false-value": (k = (O = _.falseValue) != null ? O : _.falseLabel) != null ? k : !1,
onChange: vt(d),
onFocus: (R) => n.value = !0,
onBlur: (R) => n.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[CQ, vt(a)]
]) : Ti((ce(), Ye("input", {
key: 1,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(vt(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: vt(o),
value: vt(u),
onChange: vt(d),
onFocus: (R) => n.value = !0,
onBlur: (R) => n.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
[CQ, vt(a)]
]),
_.$slots.default || _.label ? (ce(), Ye("span", {
key: 2,
class: Be(vt(f).be("button", "inner")),
style: M1(vt(i) ? vt(Q) : void 0)
}, [
Pr(_.$slots, "default", {}, () => [
xn(fi(_.label), 1)
])
], 6)) : Fr("v-if", !0)
], 2);
};
}
});
var TU = /* @__PURE__ */ Hn($at, [["__file", "checkbox-button.vue"]]);
const Wat = Sn({
modelValue: {
type: Gr(Array),
default: () => []
},
disabled: Boolean,
min: Number,
max: Number,
size: Y8,
fill: String,
textColor: String,
tag: {
type: String,
default: "div"
},
validateEvent: {
type: Boolean,
default: !0
},
...ol(["ariaLabel"])
}), Zat = {
[Wo]: (t) => p2(t),
change: (t) => p2(t)
}, qat = mr({
name: "ElCheckboxGroup"
}), Xat = /* @__PURE__ */ mr({
...qat,
props: Wat,
emits: Zat,
setup(t, { emit: e }) {
const r = t, n = Bn("checkbox"), { formItem: i } = J8(), { inputId: o, isLabeledByFormItem: s } = wg(r, {
formItemContext: i
}), a = async (d) => {
e(Wo, d), await i1(), e("change", d);
}, u = Kt({
get() {
return r.modelValue;
},
set(d) {
a(d);
}
});
return $1(tc, {
...Qz(o0(r), [
"size",
"min",
"max",
"disabled",
"validateEvent",
"fill",
"textColor"
]),
modelValue: u,
changeEvent: a
}), on(() => r.modelValue, () => {
r.validateEvent && (i == null || i.validate("change").catch((d) => y2(d)));
}), (d, T) => {
var f;
return ce(), Or(Ss(d.tag), {
id: vt(o),
class: Be(vt(n).b("group")),
role: "group",
"aria-label": vt(s) ? void 0 : d.ariaLabel || "checkbox-group",
"aria-labelledby": vt(s) ? (f = vt(i)) == null ? void 0 : f.labelId : void 0
}, {
default: fe(() => [
Pr(d.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
};
}
});
var fU = /* @__PURE__ */ Hn(Xat, [["__file", "checkbox-group.vue"]]);
const QU = v2(Uat, {
CheckboxButton: TU,
CheckboxGroup: fU
});
il(TU);
const mU = il(fU), gU = Sn({
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
size: Y8,
disabled: Boolean,
label: {
type: [String, Number, Boolean],
default: void 0
},
value: {
type: [String, Number, Boolean],
default: void 0
},
name: {
type: String,
default: void 0
}
}), Kat = Sn({
...gU,
border: Boolean
}), yU = {
[Wo]: (t) => sa(t) || ro(t) || M4(t),
[aS]: (t) => sa(t) || ro(t) || M4(t)
}, vU = Symbol("radioGroupKey"), _U = (t, e) => {
const r = Ie(), n = ln(vU, void 0), i = Kt(() => !!n), o = Kt(() => Ph(t.value) ? t.label : t.value), s = Kt({
get() {
return i.value ? n.modelValue : t.modelValue;
},
set(f) {
i.value ? n.changeEvent(f) : e && e(Wo, f), r.value.checked = t.modelValue === o.value;
}
}), a = M8(Kt(() => n == null ? void 0 : n.size)), u = Lg(Kt(() => n == null ? void 0 : n.disabled)), d = Ie(!1), T = Kt(() => u.value || i.value && s.value !== o.value ? -1 : 0);
return u8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-radio",
ref: "https://element-plus.org/en-US/component/radio.html"
}, Kt(() => i.value && Ph(t.value))), {
radioRef: r,
isGroup: i,
radioGroup: n,
focus: d,
size: a,
disabled: u,
tabIndex: T,
modelValue: s,
actualValue: o
};
}, Yat = mr({
name: "ElRadio"
}), Jat = /* @__PURE__ */ mr({
...Yat,
props: Kat,
emits: yU,
setup(t, { emit: e }) {
const r = t, n = Bn("radio"), { radioRef: i, radioGroup: o, focus: s, size: a, disabled: u, modelValue: d, actualValue: T } = _U(r, e);
function f() {
i1(() => e("change", d.value));
}
return (Q, y) => {
var _;
return ce(), Ye("label", {
class: Be([
vt(n).b(),
vt(n).is("disabled", vt(u)),
vt(n).is("focus", vt(s)),
vt(n).is("bordered", Q.border),
vt(n).is("checked", vt(d) === vt(T)),
vt(n).m(vt(a))
])
}, [
je("span", {
class: Be([
vt(n).e("input"),
vt(n).is("disabled", vt(u)),
vt(n).is("checked", vt(d) === vt(T))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: i,
"onUpdate:modelValue": (L) => g2(d) ? d.value = L : null,
class: Be(vt(n).e("original")),
value: vt(T),
name: Q.name || ((_ = vt(o)) == null ? void 0 : _.name),
disabled: vt(u),
checked: vt(d) === vt(T),
type: "radio",
onFocus: (L) => s.value = !0,
onBlur: (L) => s.value = !1,
onChange: f,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
[qj, vt(d)]
]),
je("span", {
class: Be(vt(n).e("inner"))
}, null, 2)
], 2),
je("span", {
class: Be(vt(n).e("label")),
onKeydown: m1(() => {
}, ["stop"])
}, [
Pr(Q.$slots, "default", {}, () => [
xn(fi(Q.label), 1)
])
], 42, ["onKeydown"])
], 2);
};
}
});
var t3t = /* @__PURE__ */ Hn(Jat, [["__file", "radio.vue"]]);
const e3t = Sn({
...gU
}), r3t = mr({
name: "ElRadioButton"
}), n3t = /* @__PURE__ */ mr({
...r3t,
props: e3t,
setup(t) {
const e = t, r = Bn("radio"), { radioRef: n, focus: i, size: o, disabled: s, modelValue: a, radioGroup: u, actualValue: d } = _U(e), T = Kt(() => ({
backgroundColor: (u == null ? void 0 : u.fill) || "",
borderColor: (u == null ? void 0 : u.fill) || "",
boxShadow: u != null && u.fill ? `-1px 0 0 0 ${u.fill}` : "",
color: (u == null ? void 0 : u.textColor) || ""
}));
return (f, Q) => {
var y;
return ce(), Ye("label", {
class: Be([
vt(r).b("button"),
vt(r).is("active", vt(a) === vt(d)),
vt(r).is("disabled", vt(s)),
vt(r).is("focus", vt(i)),
vt(r).bm("button", vt(o))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: n,
"onUpdate:modelValue": (_) => g2(a) ? a.value = _ : null,
class: Be(vt(r).be("button", "original-radio")),
value: vt(d),
type: "radio",
name: f.name || ((y = vt(u)) == null ? void 0 : y.name),
disabled: vt(s),
onFocus: (_) => i.value = !0,
onBlur: (_) => i.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
[qj, vt(a)]
]),
je("span", {
class: Be(vt(r).be("button", "inner")),
style: M1(vt(a) === vt(d) ? vt(T) : {}),
onKeydown: m1(() => {
}, ["stop"])
}, [
Pr(f.$slots, "default", {}, () => [
xn(fi(f.label), 1)
])
], 46, ["onKeydown"])
], 2);
};
}
});
var bU = /* @__PURE__ */ Hn(n3t, [["__file", "radio-button.vue"]]);
const i3t = Sn({
id: {
type: String,
default: void 0
},
size: Y8,
disabled: Boolean,
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
fill: {
type: String,
default: ""
},
textColor: {
type: String,
default: ""
},
name: {
type: String,
default: void 0
},
validateEvent: {
type: Boolean,
default: !0
},
...ol(["ariaLabel"])
}), o3t = yU, s3t = mr({
name: "ElRadioGroup"
}), a3t = /* @__PURE__ */ mr({
...s3t,
props: i3t,
emits: o3t,
setup(t, { emit: e }) {
const r = t, n = Bn("radio"), i = z5(), o = Ie(), { formItem: s } = J8(), { inputId: a, isLabeledByFormItem: u } = wg(r, {
formItemContext: s
}), d = (f) => {
e(Wo, f), i1(() => e("change", f));
};
W1(() => {
const f = o.value.querySelectorAll("[type=radio]"), Q = f[0];
!Array.from(f).some((y) => y.checked) && Q && (Q.tabIndex = 0);
});
const T = Kt(() => r.name || i.value);
return $1(vU, u3({
...o0(r),
changeEvent: d,
name: T
})), on(() => r.modelValue, () => {
r.validateEvent && (s == null || s.validate("change").catch((f) => y2(f)));
}), (f, Q) => (ce(), Ye("div", {
id: vt(a),
ref_key: "radioGroupRef",
ref: o,
class: Be(vt(n).b("group")),
role: "radiogroup",
"aria-label": vt(u) ? void 0 : f.ariaLabel || "radio-group",
"aria-labelledby": vt(u) ? vt(s).labelId : void 0
}, [
Pr(f.$slots, "default")
], 10, ["id", "aria-label", "aria-labelledby"]));
}
});
var LU = /* @__PURE__ */ Hn(a3t, [["__file", "radio-group.vue"]]);
const wU = v2(t3t, {
RadioButton: bU,
RadioGroup: LU
}), xU = il(LU);
il(bU);
const yx = Sn({
type: {
type: String,
values: ["primary", "success", "info", "warning", "danger"],
default: "primary"
},
closable: Boolean,
disableTransitions: Boolean,
hit: Boolean,
color: String,
size: {
type: String,
values: Ez
},
effect: {
type: String,
values: ["dark", "light", "plain"],
default: "light"
},
round: Boolean
}), l3t = {
close: (t) => t instanceof MouseEvent,
click: (t) => t instanceof MouseEvent
}, c3t = mr({
name: "ElTag"
}), u3t = /* @__PURE__ */ mr({
...c3t,
props: yx,
emits: l3t,
setup(t, { emit: e }) {
const r = t, n = M8(), i = Bn("tag"), o = Kt(() => {
const { type: d, hit: T, effect: f, closable: Q, round: y } = r;
return [
i.b(),
i.is("closable", Q),
i.m(d || "primary"),
i.m(n.value),
i.m(f),
i.is("hit", T),
i.is("round", y)
];
}), s = (d) => {
e("close", d);
}, a = (d) => {
e("click", d);
}, u = (d) => {
d.component.subTree.component.bum = null;
};
return (d, T) => d.disableTransitions ? (ce(), Ye("span", {
key: 0,
class: Be(vt(o)),
style: M1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(vt(i).e("content"))
}, [
Pr(d.$slots, "default")
], 2),
d.closable ? (ce(), Or(vt(p3), {
key: 0,
class: Be(vt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Ce(vt(px))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0)
], 6)) : (ce(), Or(ad, {
key: 1,
name: `${vt(i).namespace.value}-zoom-in-center`,
appear: "",
onVnodeMounted: u
}, {
default: fe(() => [
je("span", {
class: Be(vt(o)),
style: M1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(vt(i).e("content"))
}, [
Pr(d.$slots, "default")
], 2),
d.closable ? (ce(), Or(vt(p3), {
key: 0,
class: Be(vt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Ce(vt(px))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0)
], 6)
]),
_: 3
}, 8, ["name"]));
}
});
var h3t = /* @__PURE__ */ Hn(u3t, [["__file", "tag.vue"]]);
const d3t = v2(h3t), EU = Symbol("rowContextKey"), p3t = [
"start",
"center",
"end",
"space-around",
"space-between",
"space-evenly"
], T3t = ["top", "middle", "bottom"], f3t = Sn({
tag: {
type: String,
default: "div"
},
gutter: {
type: Number,
default: 0
},
justify: {
type: String,
values: p3t,
default: "start"
},
align: {
type: String,
values: T3t
}
}), Q3t = mr({
name: "ElRow"
}), m3t = /* @__PURE__ */ mr({
...Q3t,
props: f3t,
setup(t) {
const e = t, r = Bn("row"), n = Kt(() => e.gutter);
$1(EU, {
gutter: n
});
const i = Kt(() => {
const s = {};
return e.gutter && (s.marginRight = s.marginLeft = `-${e.gutter / 2}px`), s;
}), o = Kt(() => [
r.b(),
r.is(`justify-${e.justify}`, e.justify !== "start"),
r.is(`align-${e.align}`, !!e.align)
]);
return (s, a) => (ce(), Or(Ss(s.tag), {
class: Be(vt(o)),
style: M1(vt(i))
}, {
default: fe(() => [
Pr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var g3t = /* @__PURE__ */ Hn(m3t, [["__file", "row.vue"]]);
const dd = v2(g3t), y3t = Sn({
tag: {
type: String,
default: "div"
},
span: {
type: Number,
default: 24
},
offset: {
type: Number,
default: 0
},
pull: {
type: Number,
default: 0
},
push: {
type: Number,
default: 0
},
xs: {
type: Gr([Number, Object]),
default: () => lu({})
},
sm: {
type: Gr([Number, Object]),
default: () => lu({})
},
md: {
type: Gr([Number, Object]),
default: () => lu({})
},
lg: {
type: Gr([Number, Object]),
default: () => lu({})
},
xl: {
type: Gr([Number, Object]),
default: () => lu({})
}
}), v3t = mr({
name: "ElCol"
}), _3t = /* @__PURE__ */ mr({
...v3t,
props: y3t,
setup(t) {
const e = t, { gutter: r } = ln(EU, { gutter: Kt(() => 0) }), n = Bn("col"), i = Kt(() => {
const s = {};
return r.value && (s.paddingLeft = s.paddingRight = `${r.value / 2}px`), s;
}), o = Kt(() => {
const s = [];
return ["span", "offset", "pull", "push"].forEach((d) => {
const T = e[d];
ro(T) && (d === "span" ? s.push(n.b(`${e[d]}`)) : T > 0 && s.push(n.b(`${d}-${e[d]}`)));
}), ["xs", "sm", "md", "lg", "xl"].forEach((d) => {
ro(e[d]) ? s.push(n.b(`${d}-${e[d]}`)) : T2(e[d]) && Object.entries(e[d]).forEach(([T, f]) => {
s.push(T !== "span" ? n.b(`${d}-${T}-${f}`) : n.b(`${d}-${f}`));
});
}), r.value && s.push(n.is("guttered")), [n.b(), s];
});
return (s, a) => (ce(), Or(Ss(s.tag), {
class: Be(vt(o)),
style: M1(vt(i))
}, {
default: fe(() => [
Pr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var b3t = /* @__PURE__ */ Hn(_3t, [["__file", "col.vue"]]);
const pd = v2(b3t), L3t = Sn({
mask: {
type: Boolean,
default: !0
},
customMaskEvent: Boolean,
overlayClass: {
type: Gr([
String,
Array,
Object
])
},
zIndex: {
type: Gr([String, Number])
}
}), w3t = {
click: (t) => t instanceof MouseEvent
}, x3t = "overlay";
var E3t = mr({
name: "ElOverlay",
props: L3t,
emits: w3t,
setup(t, { slots: e, emit: r }) {
const n = Bn(x3t), i = (u) => {
r("click", u);
}, { onClick: o, onMousedown: s, onMouseup: a } = Bz(t.customMaskEvent ? void 0 : i);
return () => t.mask ? Ce("div", {
class: [n.b(), t.overlayClass],
style: {
zIndex: t.zIndex
},
onClick: o,
onMousedown: s,
onMouseup: a
}, [Pr(e, "default")], pf.STYLE | pf.CLASS | pf.PROPS, ["onClick", "onMouseup", "onMousedown"]) : _7("div", {
class: t.overlayClass,
style: {
zIndex: t.zIndex,
position: "fixed",
top: "0px",
right: "0px",
bottom: "0px",
left: "0px"
}
}, [Pr(e, "default")]);
}
});
const M3t = E3t, MU = Symbol("dialogInjectionKey"), SU = Sn({
center: Boolean,
alignCenter: Boolean,
closeIcon: {
type: _8
},
draggable: Boolean,
overflow: Boolean,
fullscreen: Boolean,
showClose: {
type: Boolean,
default: !0
},
title: {
type: String,
default: ""
},
ariaLevel: {
type: String,
default: "2"
}
}), S3t = {
close: () => !0
}, H3t = mr({ name: "ElDialogContent" }), A3t = /* @__PURE__ */ mr({
...H3t,
props: SU,
emits: S3t,
setup(t, { expose: e }) {
const r = t, { t: n } = lS(), { Close: i } = aot, { dialogRef: o, headerRef: s, bodyId: a, ns: u, style: d } = ln(MU), { focusTrapRef: T } = ln(eU), f = Kt(() => [
u.b(),
u.is("fullscreen", r.fullscreen),
u.is("draggable", r.draggable),
u.is("align-center", r.alignCenter),
{ [u.m("center")]: r.center }
]), Q = uot(T, o), y = Kt(() => r.draggable), _ = Kt(() => r.overflow), { resetPosition: L } = dot(o, s, y, _);
return e({
resetPosition: L
}), (E, x) => (ce(), Ye("div", {
ref: vt(Q),
class: Be(vt(f)),
style: M1(vt(d)),
tabindex: "-1"
}, [
je("header", {
ref_key: "headerRef",
ref: s,
class: Be([vt(u).e("header"), { "show-close": E.showClose }])
}, [
Pr(E.$slots, "header", {}, () => [
je("span", {
role: "heading",
"aria-level": E.ariaLevel,
class: Be(vt(u).e("title"))
}, fi(E.title), 11, ["aria-level"])
]),
E.showClose ? (ce(), Ye("button", {
key: 0,
"aria-label": vt(n)("el.dialog.close"),
class: Be(vt(u).e("headerbtn")),
type: "button",
onClick: (O) => E.$emit("close")
}, [
Ce(vt(p3), {
class: Be(vt(u).e("close"))
}, {
default: fe(() => [
(ce(), Or(Ss(E.closeIcon || vt(i))))
]),
_: 1
}, 8, ["class"])
], 10, ["aria-label", "onClick"])) : Fr("v-if", !0)
], 2),
je("div", {
id: vt(a),
class: Be(vt(u).e("body"))
}, [
Pr(E.$slots, "default")
], 10, ["id"]),
E.$slots.footer ? (ce(), Ye("footer", {
key: 0,
class: Be(vt(u).e("footer"))
}, [
Pr(E.$slots, "footer")
], 2)) : Fr("v-if", !0)
], 6));
}
});
var O3t = /* @__PURE__ */ Hn(A3t, [["__file", "dialog-content.vue"]]);
const C3t = Sn({
...SU,
appendToBody: Boolean,
appendTo: {
type: Gr([String, Object]),
default: "body"
},
beforeClose: {
type: Gr(Function)
},
destroyOnClose: Boolean,
closeOnClickModal: {
type: Boolean,
default: !0
},
closeOnPressEscape: {
type: Boolean,
default: !0
},
lockScroll: {
type: Boolean,
default: !0
},
modal: {
type: Boolean,
default: !0
},
openDelay: {
type: Number,
default: 0
},
closeDelay: {
type: Number,
default: 0
},
top: {
type: String
},
modelValue: Boolean,
modalClass: String,
width: {
type: [String, Number]
},
zIndex: {
type: Number
},
trapFocus: Boolean,
headerAriaLevel: {
type: String,
default: "2"
}
}), k3t = {
open: () => !0,
opened: () => !0,
close: () => !0,
closed: () => !0,
[Wo]: (t) => M4(t),
openAutoFocus: () => !0,
closeAutoFocus: () => !0
}, I3t = (t, e) => {
var r;
const i = G1().emit, { nextZIndex: o } = gS();
let s = "";
const a = z5(), u = z5(), d = Ie(!1), T = Ie(!1), f = Ie(!1), Q = Ie((r = t.zIndex) != null ? r : o());
let y, _;
const L = bg("namespace", th), E = Kt(() => {
const oe = {}, re = `--${L.value}-dialog`;
return t.fullscreen || (t.top && (oe[`${re}-margin-top`] = t.top), t.width && (oe[`${re}-width`] = j5(t.width))), oe;
}), x = Kt(() => t.alignCenter ? { display: "flex" } : {});
function O() {
i("opened");
}
function k() {
i("closed"), i(Wo, !1), t.destroyOnClose && (f.value = !1);
}
function R() {
i("close");
}
function F() {
_ == null || _(), y == null || y(), t.openDelay && t.openDelay > 0 ? { stop: y } = lk(() => nt(), t.openDelay) : nt();
}
function U() {
y == null || y(), _ == null || _(), t.closeDelay && t.closeDelay > 0 ? { stop: _ } = lk(() => ct(), t.closeDelay) : ct();
}
function $() {
function oe(re) {
re || (T.value = !0, d.value = !1);
}
t.beforeClose ? t.beforeClose(oe) : U();
}
function et() {
t.closeOnClickModal && $();
}
function nt() {
s1 && (d.value = !0);
}
function ct() {
d.value = !1;
}
function rt() {
i("openAutoFocus");
}
function gt() {
i("closeAutoFocus");
}
function It(oe) {
var re;
((re = oe.detail) == null ? void 0 : re.focusReason) === "pointer" && oe.preventDefault();
}
t.lockScroll && got(d);
function Zt() {
t.closeOnPressEscape && $();
}
return on(() => t.modelValue, (oe) => {
oe ? (T.value = !1, F(), f.value = !0, Q.value = fz(t.zIndex) ? o() : Q.value++, i1(() => {
i("open"), e.value && (e.value.scrollTop = 0);
})) : d.value && U();
}), on(() => t.fullscreen, (oe) => {
e.value && (oe ? (s = e.value.style.transform, e.value.style.transform = "") : e.value.style.transform = s);
}), W1(() => {
t.modelValue && (d.value = !0, f.value = !0, F());
}), {
afterEnter: O,
afterLeave: k,
beforeLeave: R,
handleClose: $,
onModalClick: et,
close: U,
doClose: ct,
onOpenAutoFocus: rt,
onCloseAutoFocus: gt,
onCloseRequested: Zt,
onFocusoutPrevented: It,
titleId: a,
bodyId: u,
closed: T,
style: E,
overlayDialogStyle: x,
rendered: f,
visible: d,
zIndex: Q
};
}, P3t = mr({
name: "ElDialog",
inheritAttrs: !1
}), V3t = /* @__PURE__ */ mr({
...P3t,
props: C3t,
emits: k3t,
setup(t, { expose: e }) {
const r = t, n = hg();
u8({
scope: "el-dialog",
from: "the title slot",
replacement: "the header slot",
version: "3.0.0",
ref: "https://element-plus.org/en-US/component/dialog.html#slots"
}, Kt(() => !!n.title));
const i = Bn("dialog"), o = Ie(), s = Ie(), a = Ie(), {
visible: u,
titleId: d,
bodyId: T,
style: f,
overlayDialogStyle: Q,
rendered: y,
zIndex: _,
afterEnter: L,
afterLeave: E,
beforeLeave: x,
handleClose: O,
onModalClick: k,
onOpenAutoFocus: R,
onCloseAutoFocus: F,
onCloseRequested: U,
onFocusoutPrevented: $
} = I3t(r, o);
$1(MU, {
dialogRef: o,
headerRef: s,
bodyId: T,
ns: i,
rendered: y,
style: f
});
const et = Bz(k), nt = Kt(() => r.draggable && !r.fullscreen);
return e({
visible: u,
dialogContentRef: a,
resetPosition: () => {
var rt;
(rt = a.value) == null || rt.resetPosition();
}
}), (rt, gt) => (ce(), Or(vt(oU), {
to: rt.appendTo,
disabled: rt.appendTo !== "body" ? !1 : !rt.appendToBody
}, {
default: fe(() => [
Ce(ad, {
name: "dialog-fade",
onAfterEnter: vt(L),
onAfterLeave: vt(E),
onBeforeLeave: vt(x),
persisted: ""
}, {
default: fe(() => [
Ti(Ce(vt(M3t), {
"custom-mask-event": "",
mask: rt.modal,
"overlay-class": rt.modalClass,
"z-index": vt(_)
}, {
default: fe(() => [
je("div", {
role: "dialog",
"aria-modal": "true",
"aria-label": rt.title || void 0,
"aria-labelledby": rt.title ? void 0 : vt(d),
"aria-describedby": vt(T),
class: Be(`${vt(i).namespace.value}-overlay-dialog`),
style: M1(vt(Q)),
onClick: vt(et).onClick,
onMousedown: vt(et).onMousedown,
onMouseup: vt(et).onMouseup
}, [
Ce(vt(nU), {
loop: "",
trapped: vt(u),
"focus-start-el": "container",
onFocusAfterTrapped: vt(R),
onFocusAfterReleased: vt(F),
onFocusoutPrevented: vt($),
onReleaseRequested: vt(U)
}, {
default: fe(() => [
vt(y) ? (ce(), Or(O3t, el({
key: 0,
ref_key: "dialogContentRef",
ref: a
}, rt.$attrs, {
center: rt.center,
"align-center": rt.alignCenter,
"close-icon": rt.closeIcon,
draggable: vt(nt),
overflow: rt.overflow,
fullscreen: rt.fullscreen,
"show-close": rt.showClose,
title: rt.title,
"aria-level": rt.headerAriaLevel,
onClose: vt(O)
}), Xj({
header: fe(() => [
rt.$slots.title ? Pr(rt.$slots, "title", { key: 1 }) : Pr(rt.$slots, "header", {
key: 0,
close: vt(O),
titleId: vt(d),
titleClass: vt(i).e("title")
})
]),
default: fe(() => [
Pr(rt.$slots, "default")
]),
_: 2
}, [
rt.$slots.footer ? {
name: "footer",
fn: fe(() => [
Pr(rt.$slots, "footer")
])
} : void 0
]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : Fr("v-if", !0)
]),
_: 3
}, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
]),
_: 3
}, 8, ["mask", "overlay-class", "z-index"]), [
[zo, vt(u)]
])
]),
_: 3
}, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
]),
_: 3
}, 8, ["to", "disabled"]));
}
});
var R3t = /* @__PURE__ */ Hn(V3t, [["__file", "dialog.vue"]]);
const N3t = v2(R3t), D3t = /* @__PURE__ */ mr({
inheritAttrs: !1
});
function F3t(t, e, r, n, i, o) {
return Pr(t.$slots, "default");
}
var B3t = /* @__PURE__ */ Hn(D3t, [["render", F3t], ["__file", "collection.vue"]]);
const j3t = /* @__PURE__ */ mr({
name: "ElCollectionItem",
inheritAttrs: !1
});
function z3t(t, e, r, n, i, o) {
return Pr(t.$slots, "default");
}
var U3t = /* @__PURE__ */ Hn(j3t, [["render", z3t], ["__file", "collection-item.vue"]]);
const G3t = "data-el-collection-item", $3t = (t) => {
const e = `El${t}Collection`, r = `${e}Item`, n = Symbol(e), i = Symbol(r), o = {
...B3t,
name: e,
setup() {
const a = Ie(null), u = /* @__PURE__ */ new Map();
$1(n, {
itemMap: u,
getItems: () => {
const T = vt(a);
if (!T)
return [];
const f = Array.from(T.querySelectorAll(`[${G3t}]`));
return [...u.values()].sort((y, _) => f.indexOf(y.ref) - f.indexOf(_.ref));
},
collectionRef: a
});
}
}, s = {
...U3t,
name: r,
setup(a, { attrs: u }) {
const d = Ie(null), T = ln(n, void 0);
$1(i, {
collectionItemRef: d
}), W1(() => {
const f = vt(d);
f && T.itemMap.set(f, {
ref: f,
...u
});
}), Rs(() => {
const f = vt(d);
T.itemMap.delete(f);
});
}
};
return {
COLLECTION_INJECTION_KEY: n,
COLLECTION_ITEM_INJECTION_KEY: i,
ElCollection: o,
ElCollectionItem: s
};
}, vb = Sn({
trigger: Fh.trigger,
effect: {
...W2.effect,
default: "light"
},
type: {
type: Gr(String)
},
placement: {
type: Gr(String),
default: "bottom"
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
id: String,
size: {
type: String,
default: ""
},
splitButton: Boolean,
hideOnClick: {
type: Boolean,
default: !0
},
loop: {
type: Boolean,
default: !0
},
showTimeout: {
type: Number,
default: 150
},
hideTimeout: {
type: Number,
default: 150
},
tabindex: {
type: Gr([Number, String]),
default: 0
},
maxHeight: {
type: Gr([Number, String]),
default: ""
},
popperClass: {
type: String,
default: ""
},
disabled: Boolean,
role: {
type: String,
default: "menu"
},
buttonProps: {
type: Gr(Object)
},
teleported: W2.teleported
});
Sn({
command: {
type: [Object, String, Number],
default: () => ({})
},
disabled: Boolean,
divided: Boolean,
textValue: String,
icon: {
type: _8
}
});
Sn({
onKeydown: { type: Gr(Function) }
});
$3t("Dropdown");
const HU = Symbol("ElSelectGroup"), Eg = Symbol("ElSelect");
function W3t(t, e) {
const r = ln(Eg), n = ln(HU, { disabled: !1 }), i = Kt(() => T($6(r.props.modelValue), t.value)), o = Kt(() => {
var y;
if (r.props.multiple) {
const _ = $6((y = r.props.modelValue) != null ? y : []);
return !i.value && _.length >= r.props.multipleLimit && r.props.multipleLimit > 0;
} else
return !1;
}), s = Kt(() => t.label || (T2(t.value) ? "" : t.value)), a = Kt(() => t.value || t.label || ""), u = Kt(() => t.disabled || e.groupDisabled || o.value), d = G1(), T = (y = [], _) => {
if (T2(t.value)) {
const L = r.props.valueKey;
return y && y.some((E) => Ch(p4(E, L)) === p4(_, L));
} else
return y && y.includes(_);
}, f = () => {
!t.disabled && !n.disabled && (r.states.hoveringIndex = r.optionsArray.indexOf(d.proxy));
}, Q = (y) => {
const _ = new RegExp(W1t(y), "i");
e.visible = _.test(s.value) || t.created;
};
return on(() => s.value, () => {
!t.created && !r.props.remote && r.setSelected();
}), on(() => t.value, (y, _) => {
const { remote: L, valueKey: E } = r.props;
if (y !== _ && (r.onOptionDestroy(_, d.proxy), r.onOptionCreate(d.proxy)), !t.created && !L) {
if (E && T2(y) && T2(_) && y[E] === _[E])
return;
r.setSelected();
}
}), on(() => n.disabled, () => {
e.groupDisabled = n.disabled;
}, { immediate: !0 }), {
select: r,
currentLabel: s,
currentValue: a,
itemSelected: i,
isDisabled: u,
hoverItem: f,
updateOption: Q
};
}
const Z3t = mr({
name: "ElOption",
componentName: "ElOption",
props: {
value: {
required: !0,
type: [String, Number, Boolean, Object]
},
label: [String, Number],
created: Boolean,
disabled: Boolean
},
setup(t) {
const e = Bn("select"), r = z5(), n = Kt(() => [
e.be("dropdown", "item"),
e.is("disabled", vt(a)),
e.is("selected", vt(s)),
e.is("hovering", vt(Q))
]), i = u3({
index: -1,
groupDisabled: !1,
visible: !0,
hover: !1
}), {
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T
} = W3t(t, i), { visible: f, hover: Q } = o0(i), y = G1().proxy;
u.onOptionCreate(y), Rs(() => {
const L = y.value, { selected: E } = u.states, O = (u.props.multiple ? E : [E]).some((k) => k.value === y.value);
i1(() => {
u.states.cachedOptions.get(L) === y && !O && u.states.cachedOptions.delete(L);
}), u.onOptionDestroy(L, y);
});
function _() {
a.value || u.handleOptionSelect(y);
}
return {
ns: e,
id: r,
containerKls: n,
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T,
visible: f,
hover: Q,
selectOptionClick: _,
states: i
};
}
});
function q3t(t, e, r, n, i, o) {
return Ti((ce(), Ye("li", {
id: t.id,
class: Be(t.containerKls),
role: "option",
"aria-disabled": t.isDisabled || void 0,
"aria-selected": t.itemSelected,
onMouseenter: t.hoverItem,
onClick: m1(t.selectOptionClick, ["stop"])
}, [
Pr(t.$slots, "default", {}, () => [
je("span", null, fi(t.currentLabel), 1)
])
], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
[zo, t.visible]
]);
}
var xS = /* @__PURE__ */ Hn(Z3t, [["render", q3t], ["__file", "option.vue"]]);
const X3t = mr({
name: "ElSelectDropdown",
componentName: "ElSelectDropdown",
setup() {
const t = ln(Eg), e = Bn("select"), r = Kt(() => t.props.popperClass), n = Kt(() => t.props.multiple), i = Kt(() => t.props.fitInputWidth), o = Ie("");
function s() {
var a;
o.value = `${(a = t.selectRef) == null ? void 0 : a.offsetWidth}px`;
}
return W1(() => {
s(), F6(t.selectRef, s);
}), {
ns: e,
minWidth: o,
popperClass: r,
isMultiple: n,
isFitInputWidth: i
};
}
});
function K3t(t, e, r, n, i, o) {
return ce(), Ye("div", {
class: Be([t.ns.b("dropdown"), t.ns.is("multiple", t.isMultiple), t.popperClass]),
style: M1({ [t.isFitInputWidth ? "width" : "minWidth"]: t.minWidth })
}, [
t.$slots.header ? (ce(), Ye("div", {
key: 0,
class: Be(t.ns.be("dropdown", "header"))
}, [
Pr(t.$slots, "header")
], 2)) : Fr("v-if", !0),
Pr(t.$slots, "default"),
t.$slots.footer ? (ce(), Ye("div", {
key: 1,
class: Be(t.ns.be("dropdown", "footer"))
}, [
Pr(t.$slots, "footer")
], 2)) : Fr("v-if", !0)
], 6);
}
var Y3t = /* @__PURE__ */ Hn(X3t, [["render", K3t], ["__file", "select-dropdown.vue"]]);
const J3t = 11, t4t = (t, e) => {
const { t: r } = lS(), n = z5(), i = Bn("select"), o = Bn("input"), s = u3({
inputValue: "",
options: /* @__PURE__ */ new Map(),
cachedOptions: /* @__PURE__ */ new Map(),
disabledOptions: /* @__PURE__ */ new Map(),
optionValues: [],
selected: [],
selectionWidth: 0,
calculatorWidth: 0,
collapseItemWidth: 0,
selectedLabel: "",
hoveringIndex: -1,
previousQuery: null,
inputHovering: !1,
menuVisibleOnFocus: !1,
isBeforeHide: !1
}), a = Ie(null), u = Ie(null), d = Ie(null), T = Ie(null), f = Ie(null), Q = Ie(null), y = Ie(null), _ = Ie(null), L = Ie(null), E = Ie(null), x = Ie(null), O = Ie(null), {
isComposing: k,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U
} = V2t({
afterComposition: (Rt) => c1(Rt)
}), { wrapperRef: $, isFocused: et } = P2t(f, {
beforeFocus() {
return re.value;
},
afterFocus() {
t.automaticDropdown && !nt.value && (nt.value = !0, s.menuVisibleOnFocus = !0);
},
beforeBlur(Rt) {
var Te, Se;
return ((Te = d.value) == null ? void 0 : Te.isFocusInsideContent(Rt)) || ((Se = T.value) == null ? void 0 : Se.isFocusInsideContent(Rt));
},
afterBlur() {
nt.value = !1, s.menuVisibleOnFocus = !1;
}
}), nt = Ie(!1), ct = Ie(), { form: rt, formItem: gt } = J8(), { inputId: It } = wg(t, {
formItemContext: gt
}), { valueOnClear: Zt, isEmptyValue: oe } = B2t(t), re = Kt(() => t.disabled || (rt == null ? void 0 : rt.disabled)), Ve = Kt(() => p2(t.modelValue) ? t.modelValue.length > 0 : !oe(t.modelValue)), yr = Kt(() => t.clearable && !re.value && s.inputHovering && Ve.value), qr = Kt(() => t.remote && t.filterable && !t.remoteShowSuffix ? "" : t.suffixIcon), ie = Kt(() => i.is("reverse", qr.value && nt.value)), Qe = Kt(() => (gt == null ? void 0 : gt.validateState) || ""), Ke = Kt(() => lot[Qe.value]), He = Kt(() => t.remote ? 300 : 0), er = Kt(() => t.loading ? t.loadingText || r("el.select.loading") : t.remote && !s.inputValue && s.options.size === 0 ? !1 : t.filterable && s.inputValue && s.options.size > 0 && Je.value === 0 ? t.noMatchText || r("el.select.noMatch") : s.options.size === 0 ? t.noDataText || r("el.select.noData") : null), Je = Kt(() => Ne.value.filter((Rt) => Rt.visible).length), Ne = Kt(() => {
const Rt = Array.from(s.options.values()), Te = [];
return s.optionValues.forEach((Se) => {
const lr = Rt.findIndex((Ar) => Ar.value === Se);
lr > -1 && Te.push(Rt[lr]);
}), Te.length >= Rt.length ? Te : Rt;
}), Gt = Kt(() => Array.from(s.cachedOptions.values())), te = Kt(() => {
const Rt = Ne.value.filter((Te) => !Te.created).some((Te) => Te.currentLabel === s.inputValue);
return t.filterable && t.allowCreate && s.inputValue !== "" && !Rt;
}), me = () => {
t.filterable && Zo(t.filterMethod) || t.filterable && t.remote && Zo(t.remoteMethod) || Ne.value.forEach((Rt) => {
var Te;
(Te = Rt.updateOption) == null || Te.call(Rt, s.inputValue);
});
}, de = M8(), Ge = Kt(() => ["small"].includes(de.value) ? "small" : "default"), Tr = Kt({
get() {
return nt.value && er.value !== !1;
},
set(Rt) {
nt.value = Rt;
}
}), qe = Kt(() => {
if (t.multiple && !Z6(t.modelValue))
return $6(t.modelValue).length === 0 && !s.inputValue;
const Rt = p2(t.modelValue) ? t.modelValue[0] : t.modelValue;
return t.filterable || Z6(Rt) ? !s.inputValue : !0;
}), $e = Kt(() => {
var Rt;
const Te = (Rt = t.placeholder) != null ? Rt : r("el.select.placeholder");
return t.multiple || !Ve.value ? Te : s.selectedLabel;
}), ar = Kt(() => ox ? null : "mouseenter");
on(() => t.modelValue, (Rt, Te) => {
t.multiple && t.filterable && !t.reserveKeyword && (s.inputValue = "", Ct("")), Jr(), !PQ(Rt, Te) && t.validateEvent && (gt == null || gt.validate("change").catch((Se) => y2(Se)));
}, {
flush: "post",
deep: !0
}), on(() => nt.value, (Rt) => {
Rt ? Ct(s.inputValue) : (s.inputValue = "", s.previousQuery = null, s.isBeforeHide = !0), e("visible-change", Rt);
}), on(() => s.options.entries(), () => {
var Rt;
if (!s1)
return;
const Te = ((Rt = a.value) == null ? void 0 : Rt.querySelectorAll("input")) || [];
(!t.filterable && !t.defaultFirstOption && !Z6(t.modelValue) || !Array.from(Te).includes(document.activeElement)) && Jr(), t.defaultFirstOption && (t.filterable || t.remote) && Je.value && en();
}, {
flush: "post"
}), on(() => s.hoveringIndex, (Rt) => {
ro(Rt) && Rt > -1 ? ct.value = Ne.value[Rt] || {} : ct.value = {}, Ne.value.forEach((Te) => {
Te.hover = ct.value === Te;
});
}), Wj(() => {
s.isBeforeHide || me();
});
const Ct = (Rt) => {
s.previousQuery === Rt || k.value || (s.previousQuery = Rt, t.filterable && Zo(t.filterMethod) ? t.filterMethod(Rt) : t.filterable && t.remote && Zo(t.remoteMethod) && t.remoteMethod(Rt), t.defaultFirstOption && (t.filterable || t.remote) && Je.value ? i1(en) : i1(Rr));
}, en = () => {
const Rt = Ne.value.filter((lr) => lr.visible && !lr.disabled && !lr.states.groupDisabled), Te = Rt.find((lr) => lr.created), Se = Rt[0];
s.hoveringIndex = _r(Ne.value, Te || Se);
}, Jr = () => {
if (t.multiple)
s.selectedLabel = "";
else {
const Te = p2(t.modelValue) ? t.modelValue[0] : t.modelValue, Se = Hr(Te);
s.selectedLabel = Se.currentLabel, s.selected = [Se];
return;
}
const Rt = [];
Z6(t.modelValue) || $6(t.modelValue).forEach((Te) => {
Rt.push(Hr(Te));
}), s.selected = Rt;
}, Hr = (Rt) => {
let Te;
const Se = cb(Rt).toLowerCase() === "object", lr = cb(Rt).toLowerCase() === "null", Ar = cb(Rt).toLowerCase() === "undefined";
for (let br = s.cachedOptions.size - 1; br >= 0; br--) {
const Br = Gt.value[br];
if (Se ? p4(Br.value, t.valueKey) === p4(Rt, t.valueKey) : Br.value === Rt) {
Te = {
value: Rt,
currentLabel: Br.currentLabel,
get isDisabled() {
return Br.isDisabled;
}
};
break;
}
}
if (Te)
return Te;
const vn = Se ? Rt.label : !lr && !Ar ? Rt : "";
return {
value: Rt,
currentLabel: vn
};
}, Rr = () => {
s.hoveringIndex = Ne.value.findIndex((Rt) => s.selected.some((Te) => At(Te) === At(Rt)));
}, dn = () => {
s.selectionWidth = u.value.getBoundingClientRect().width;
}, ji = () => {
s.calculatorWidth = Q.value.getBoundingClientRect().width;
}, Ji = () => {
s.collapseItemWidth = x.value.getBoundingClientRect().width;
}, ki = () => {
var Rt, Te;
(Te = (Rt = d.value) == null ? void 0 : Rt.updatePopper) == null || Te.call(Rt);
}, _i = () => {
var Rt, Te;
(Te = (Rt = T.value) == null ? void 0 : Rt.updatePopper) == null || Te.call(Rt);
}, Ii = () => {
s.inputValue.length > 0 && !nt.value && (nt.value = !0), Ct(s.inputValue);
}, c1 = (Rt) => {
if (s.inputValue = Rt.target.value, t.remote)
ye();
else
return Ii();
}, ye = B1t(() => {
Ii();
}, He.value), bi = (Rt) => {
PQ(t.modelValue, Rt) || e(aS, Rt);
}, Xn = (Rt) => j1t(Rt, (Te) => !s.disabledOptions.has(Te)), Hi = (Rt) => {
if (t.multiple && Rt.code !== Rh.delete && Rt.target.value.length <= 0) {
const Te = $6(t.modelValue).slice(), Se = Xn(Te);
if (Se < 0)
return;
const lr = Te[Se];
Te.splice(Se, 1), e(Wo, Te), bi(Te), e("remove-tag", lr);
}
}, t1 = (Rt, Te) => {
const Se = s.selected.indexOf(Te);
if (Se > -1 && !re.value) {
const lr = $6(t.modelValue).slice();
lr.splice(Se, 1), e(Wo, lr), bi(lr), e("remove-tag", Te.value);
}
Rt.stopPropagation(), Vi();
}, xe = (Rt) => {
Rt.stopPropagation();
const Te = t.multiple ? [] : Zt.value;
if (t.multiple)
for (const Se of s.selected)
Se.isDisabled && Te.push(Se.value);
e(Wo, Te), bi(Te), s.hoveringIndex = -1, nt.value = !1, e("clear"), Vi();
}, Dr = (Rt) => {
var Te;
if (t.multiple) {
const Se = $6((Te = t.modelValue) != null ? Te : []).slice(), lr = _r(Se, Rt.value);
lr > -1 ? Se.splice(lr, 1) : (t.multipleLimit <= 0 || Se.length < t.multipleLimit) && Se.push(Rt.value), e(Wo, Se), bi(Se), Rt.created && Ct(""), t.filterable && !t.reserveKeyword && (s.inputValue = "");
} else
e(Wo, Rt.value), bi(Rt.value), nt.value = !1;
Vi(), !nt.value && i1(() => {
Vn(Rt);
});
}, _r = (Rt = [], Te) => {
if (!T2(Te))
return Rt.indexOf(Te);
const Se = t.valueKey;
let lr = -1;
return Rt.some((Ar, vn) => Ch(p4(Ar, Se)) === p4(Te, Se) ? (lr = vn, !0) : !1), lr;
}, Vn = (Rt) => {
var Te, Se, lr, Ar, vn;
const zr = p2(Rt) ? Rt[0] : Rt;
let br = null;
if (zr != null && zr.value) {
const Br = Ne.value.filter((cn) => cn.value === zr.value);
Br.length > 0 && (br = Br[0].$el);
}
if (d.value && br) {
const Br = (Ar = (lr = (Se = (Te = d.value) == null ? void 0 : Te.popperRef) == null ? void 0 : Se.contentRef) == null ? void 0 : lr.querySelector) == null ? void 0 : Ar.call(lr, `.${i.be("dropdown", "wrap")}`);
Br && X1t(Br, br);
}
(vn = O.value) == null || vn.handleScroll();
}, y1 = (Rt) => {
s.options.set(Rt.value, Rt), s.cachedOptions.set(Rt.value, Rt), Rt.disabled && s.disabledOptions.set(Rt.value, Rt);
}, wr = (Rt, Te) => {
s.options.get(Rt) === Te && s.options.delete(Rt);
}, Pi = Kt(() => {
var Rt, Te;
return (Te = (Rt = d.value) == null ? void 0 : Rt.popperRef) == null ? void 0 : Te.contentRef;
}), H1 = () => {
s.isBeforeHide = !1, i1(() => Vn(s.selected));
}, Vi = () => {
var Rt;
(Rt = f.value) == null || Rt.focus();
}, Rn = () => {
var Rt;
(Rt = f.value) == null || Rt.blur();
}, xt = (Rt) => {
xe(Rt);
}, ot = () => {
nt.value = !1, et.value && Rn();
}, st = () => {
s.inputValue.length > 0 ? s.inputValue = "" : nt.value = !1;
}, pt = () => {
re.value || (ox && (s.inputHovering = !0), s.menuVisibleOnFocus ? s.menuVisibleOnFocus = !1 : nt.value = !nt.value);
}, yt = () => {
nt.value ? Ne.value[s.hoveringIndex] && Dr(Ne.value[s.hoveringIndex]) : pt();
}, At = (Rt) => T2(Rt.value) ? p4(Rt.value, t.valueKey) : Rt.value, Vt = Kt(() => Ne.value.filter((Rt) => Rt.visible).every((Rt) => Rt.disabled)), jt = Kt(() => t.multiple ? t.collapseTags ? s.selected.slice(0, t.maxCollapseTags) : s.selected : []), St = Kt(() => t.multiple ? t.collapseTags ? s.selected.slice(t.maxCollapseTags) : [] : []), Yt = (Rt) => {
if (!nt.value) {
nt.value = !0;
return;
}
if (!(s.options.size === 0 || s.filteredOptionsCount === 0 || k.value) && !Vt.value) {
Rt === "next" ? (s.hoveringIndex++, s.hoveringIndex === s.options.size && (s.hoveringIndex = 0)) : Rt === "prev" && (s.hoveringIndex--, s.hoveringIndex < 0 && (s.hoveringIndex = s.options.size - 1));
const Te = Ne.value[s.hoveringIndex];
(Te.disabled === !0 || Te.states.groupDisabled === !0 || !Te.visible) && Yt(Rt), i1(() => Vn(ct.value));
}
}, ae = () => {
if (!u.value)
return 0;
const Rt = window.getComputedStyle(u.value);
return Number.parseFloat(Rt.gap || "6px");
}, Xt = Kt(() => {
const Rt = ae();
return { maxWidth: `${x.value && t.maxCollapseTags === 1 ? s.selectionWidth - s.collapseItemWidth - Rt : s.selectionWidth}px` };
}), Le = Kt(() => ({ maxWidth: `${s.selectionWidth}px` })), or = Kt(() => ({
width: `${Math.max(s.calculatorWidth, J3t)}px`
}));
return F6(u, dn), F6(Q, ji), F6(L, ki), F6($, ki), F6(E, _i), F6(x, Ji), W1(() => {
Jr();
}), {
inputId: It,
contentId: n,
nsSelect: i,
nsInput: o,
states: s,
isFocused: et,
expanded: nt,
optionsArray: Ne,
hoverOption: ct,
selectSize: de,
filteredOptionsCount: Je,
resetCalculatorWidth: ji,
updateTooltip: ki,
updateTagTooltip: _i,
debouncedOnInputChange: ye,
onInput: c1,
deletePrevTag: Hi,
deleteTag: t1,
deleteSelected: xe,
handleOptionSelect: Dr,
scrollToOption: Vn,
hasModelValue: Ve,
shouldShowPlaceholder: qe,
currentPlaceholder: $e,
mouseEnterEventName: ar,
showClose: yr,
iconComponent: qr,
iconReverse: ie,
validateState: Qe,
validateIcon: Ke,
showNewOption: te,
updateOptions: me,
collapseTagSize: Ge,
setSelected: Jr,
selectDisabled: re,
emptyText: er,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U,
onOptionCreate: y1,
onOptionDestroy: wr,
handleMenuEnter: H1,
focus: Vi,
blur: Rn,
handleClearClick: xt,
handleClickOutside: ot,
handleEsc: st,
toggleMenu: pt,
selectOption: yt,
getValueKey: At,
navigateOptions: Yt,
dropdownMenuVisible: Tr,
showTagList: jt,
collapseTagList: St,
tagStyle: Xt,
collapseTagStyle: Le,
inputStyle: or,
popperRef: Pi,
inputRef: f,
tooltipRef: d,
tagTooltipRef: T,
calculatorRef: Q,
prefixRef: y,
suffixRef: _,
selectRef: a,
wrapperRef: $,
selectionRef: u,
scrollbarRef: O,
menuRef: L,
tagMenuRef: E,
collapseItemRef: x
};
};
var e4t = mr({
name: "ElOptions",
setup(t, { slots: e }) {
const r = ln(Eg);
let n = [];
return () => {
var i, o;
const s = (i = e.default) == null ? void 0 : i.call(e), a = [];
function u(d) {
p2(d) && d.forEach((T) => {
var f, Q, y, _;
const L = (f = (T == null ? void 0 : T.type) || {}) == null ? void 0 : f.name;
L === "ElOptionGroup" ? u(!sa(T.children) && !p2(T.children) && Zo((Q = T.children) == null ? void 0 : Q.default) ? (y = T.children) == null ? void 0 : y.default() : T.children) : L === "ElOption" ? a.push((_ = T.props) == null ? void 0 : _.value) : p2(T.children) && u(T.children);
});
}
return s.length && u((o = s[0]) == null ? void 0 : o.children), PQ(a, n) || (n = a, r && (r.states.optionValues = a)), s;
};
}
});
const r4t = Sn({
name: String,
id: String,
modelValue: {
type: [Array, String, Number, Boolean, Object],
default: void 0
},
autocomplete: {
type: String,
default: "off"
},
automaticDropdown: Boolean,
size: Y8,
effect: {
type: Gr(String),
default: "light"
},
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String
},
defaultFirstOption: Boolean,
reserveKeyword: {
type: Boolean,
default: !0
},
valueKey: {
type: String,
default: "value"
},
collapseTags: Boolean,
collapseTagsTooltip: Boolean,
maxCollapseTags: {
type: Number,
default: 1
},
teleported: W2.teleported,
persistent: {
type: Boolean,
default: !0
},
clearIcon: {
type: _8,
default: _z
},
fitInputWidth: Boolean,
suffixIcon: {
type: _8,
default: sS
},
tagType: { ...yx.type, default: "info" },
tagEffect: { ...yx.effect, default: "light" },
validateEvent: {
type: Boolean,
default: !0
},
remoteShowSuffix: Boolean,
placement: {
type: Gr(String),
values: vg,
default: "bottom-start"
},
fallbackPlacements: {
type: Gr(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
appendTo: String,
...F2t,
...ol(["ariaLabel"])
}), vI = "ElSelect", n4t = mr({
name: vI,
componentName: vI,
components: {
ElSelectMenu: Y3t,
ElOption: xS,
ElOptions: e4t,
ElTag: d3t,
ElScrollbar: cst,
ElTooltip: sU,
ElIcon: p3
},
directives: { ClickOutside: Rat },
props: r4t,
emits: [
Wo,
aS,
"remove-tag",
"clear",
"visible-change",
"focus",
"blur"
],
setup(t, { emit: e }) {
const r = Kt(() => {
const { modelValue: o, multiple: s } = t, a = s ? [] : void 0;
return p2(o) ? s ? o : a : s ? a : o;
}), n = u3({
...o0(t),
modelValue: r
}), i = t4t(n, e);
return $1(Eg, u3({
props: n,
states: i.states,
optionsArray: i.optionsArray,
handleOptionSelect: i.handleOptionSelect,
onOptionCreate: i.onOptionCreate,
onOptionDestroy: i.onOptionDestroy,
selectRef: i.selectRef,
setSelected: i.setSelected
})), {
...i,
modelValue: r
};
}
});
function i4t(t, e, r, n, i, o) {
const s = xs("el-tag"), a = xs("el-tooltip"), u = xs("el-icon"), d = xs("el-option"), T = xs("el-options"), f = xs("el-scrollbar"), Q = xs("el-select-menu"), y = vet("click-outside");
return Ti((ce(), Ye("div", {
ref: "selectRef",
class: Be([t.nsSelect.b(), t.nsSelect.m(t.selectSize)]),
[_et(t.mouseEnterEventName)]: (_) => t.states.inputHovering = !0,
onMouseleave: (_) => t.states.inputHovering = !1
}, [
Ce(a, {
ref: "tooltipRef",
visible: t.dropdownMenuVisible,
placement: t.placement,
teleported: t.teleported,
"popper-class": [t.nsSelect.e("popper"), t.popperClass],
"popper-options": t.popperOptions,
"fallback-placements": t.fallbackPlacements,
effect: t.effect,
pure: "",
trigger: "click",
transition: `${t.nsSelect.namespace.value}-zoom-in-top`,
"stop-popper-mouse-event": !1,
"gpu-acceleration": !1,
persistent: t.persistent,
"append-to": t.appendTo,
onBeforeShow: t.handleMenuEnter,
onHide: (_) => t.states.isBeforeHide = !1
}, {
default: fe(() => {
var _;
return [
je("div", {
ref: "wrapperRef",
class: Be([
t.nsSelect.e("wrapper"),
t.nsSelect.is("focused", t.isFocused),
t.nsSelect.is("hovering", t.states.inputHovering),
t.nsSelect.is("filterable", t.filterable),
t.nsSelect.is("disabled", t.selectDisabled)
]),
onClick: m1(t.toggleMenu, ["prevent"])
}, [
t.$slots.prefix ? (ce(), Ye("div", {
key: 0,
ref: "prefixRef",
class: Be(t.nsSelect.e("prefix"))
}, [
Pr(t.$slots, "prefix")
], 2)) : Fr("v-if", !0),
je("div", {
ref: "selectionRef",
class: Be([
t.nsSelect.e("selection"),
t.nsSelect.is("near", t.multiple && !t.$slots.prefix && !!t.states.selected.length)
])
}, [
t.multiple ? Pr(t.$slots, "tag", { key: 0 }, () => [
(ce(!0), Ye(to, null, t3(t.showTagList, (L) => (ce(), Ye("div", {
key: t.getValueKey(L),
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
closable: !t.selectDisabled && !L.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: M1(t.tagStyle),
onClose: (E) => t.deleteTag(E, L)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
Pr(t.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
xn(fi(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
], 2))), 128)),
t.collapseTags && t.states.selected.length > t.maxCollapseTags ? (ce(), Or(a, {
key: 0,
ref: "tagTooltipRef",
disabled: t.dropdownMenuVisible || !t.collapseTagsTooltip,
"fallback-placements": ["bottom", "top", "right", "left"],
effect: t.effect,
placement: "bottom",
teleported: t.teleported
}, {
default: fe(() => [
je("div", {
ref: "collapseItemRef",
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
closable: !1,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: M1(t.collapseTagStyle)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, " + " + fi(t.states.selected.length - t.maxCollapseTags), 3)
]),
_: 1
}, 8, ["size", "type", "effect", "style"])
], 2)
]),
content: fe(() => [
je("div", {
ref: "tagMenuRef",
class: Be(t.nsSelect.e("selection"))
}, [
(ce(!0), Ye(to, null, t3(t.collapseTagList, (L) => (ce(), Ye("div", {
key: t.getValueKey(L),
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
class: "in-tooltip",
closable: !t.selectDisabled && !L.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
onClose: (E) => t.deleteTag(E, L)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
Pr(t.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
xn(fi(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "onClose"])
], 2))), 128))
], 2)
]),
_: 3
}, 8, ["disabled", "effect", "teleported"])) : Fr("v-if", !0)
]) : Fr("v-if", !0),
t.selectDisabled ? Fr("v-if", !0) : (ce(), Ye("div", {
key: 1,
class: Be([
t.nsSelect.e("selected-item"),
t.nsSelect.e("input-wrapper"),
t.nsSelect.is("hidden", !t.filterable)
])
}, [
Ti(je("input", {
id: t.inputId,
ref: "inputRef",
"onUpdate:modelValue": (L) => t.states.inputValue = L,
type: "text",
name: t.name,
class: Be([t.nsSelect.e("input"), t.nsSelect.is(t.selectSize)]),
disabled: t.selectDisabled,
autocomplete: t.autocomplete,
style: M1(t.inputStyle),
role: "combobox",
readonly: !t.filterable,
spellcheck: "false",
"aria-activedescendant": ((_ = t.hoverOption) == null ? void 0 : _.id) || "",
"aria-controls": t.contentId,
"aria-expanded": t.dropdownMenuVisible,
"aria-label": t.ariaLabel,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
onKeydown: [
su(m1((L) => t.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
su(m1((L) => t.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
su(m1(t.handleEsc, ["stop", "prevent"]), ["esc"]),
su(m1(t.selectOption, ["stop", "prevent"]), ["enter"]),
su(m1(t.deletePrevTag, ["stop"]), ["delete"])
],
onCompositionstart: t.handleCompositionStart,
onCompositionupdate: t.handleCompositionUpdate,
onCompositionend: t.handleCompositionEnd,
onInput: t.onInput,
onClick: m1(t.toggleMenu, ["stop"])
}, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
[bet, t.states.inputValue]
]),
t.filterable ? (ce(), Ye("span", {
key: 0,
ref: "calculatorRef",
"aria-hidden": "true",
class: Be(t.nsSelect.e("input-calculator")),
textContent: fi(t.states.inputValue)
}, null, 10, ["textContent"])) : Fr("v-if", !0)
], 2)),
t.shouldShowPlaceholder ? (ce(), Ye("div", {
key: 2,
class: Be([
t.nsSelect.e("selected-item"),
t.nsSelect.e("placeholder"),
t.nsSelect.is("transparent", !t.hasModelValue || t.expanded && !t.states.inputValue)
])
}, [
t.hasModelValue ? Pr(t.$slots, "label", {
key: 0,
label: t.currentPlaceholder,
value: t.modelValue
}, () => [
je("span", null, fi(t.currentPlaceholder), 1)
]) : (ce(), Ye("span", { key: 1 }, fi(t.currentPlaceholder), 1))
], 2)) : Fr("v-if", !0)
], 2),
je("div", {
ref: "suffixRef",
class: Be(t.nsSelect.e("suffix"))
}, [
t.iconComponent && !t.showClose ? (ce(), Or(u, {
key: 0,
class: Be([t.nsSelect.e("caret"), t.nsSelect.e("icon"), t.iconReverse])
}, {
default: fe(() => [
(ce(), Or(Ss(t.iconComponent)))
]),
_: 1
}, 8, ["class"])) : Fr("v-if", !0),
t.showClose && t.clearIcon ? (ce(), Or(u, {
key: 1,
class: Be([
t.nsSelect.e("caret"),
t.nsSelect.e("icon"),
t.nsSelect.e("clear")
]),
onClick: t.handleClearClick
}, {
default: fe(() => [
(ce(), Or(Ss(t.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0),
t.validateState && t.validateIcon ? (ce(), Or(u, {
key: 2,
class: Be([t.nsInput.e("icon"), t.nsInput.e("validateIcon")])
}, {
default: fe(() => [
(ce(), Or(Ss(t.validateIcon)))
]),
_: 1
}, 8, ["class"])) : Fr("v-if", !0)
], 2)
], 10, ["onClick"])
];
}),
content: fe(() => [
Ce(Q, { ref: "menuRef" }, {
default: fe(() => [
t.$slots.header ? (ce(), Ye("div", {
key: 0,
class: Be(t.nsSelect.be("dropdown", "header")),
onClick: m1(() => {
}, ["stop"])
}, [
Pr(t.$slots, "header")
], 10, ["onClick"])) : Fr("v-if", !0),
Ti(Ce(f, {
id: t.contentId,
ref: "scrollbarRef",
tag: "ul",
"wrap-class": t.nsSelect.be("dropdown", "wrap"),
"view-class": t.nsSelect.be("dropdown", "list"),
class: Be([t.nsSelect.is("empty", t.filteredOptionsCount === 0)]),
role: "listbox",
"aria-label": t.ariaLabel,
"aria-orientation": "vertical"
}, {
default: fe(() => [
t.showNewOption ? (ce(), Or(d, {
key: 0,
value: t.states.inputValue,
created: !0
}, null, 8, ["value"])) : Fr("v-if", !0),
Ce(T, null, {
default: fe(() => [
Pr(t.$slots, "default")
]),
_: 3
})
]),
_: 3
}, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
[zo, t.states.options.size > 0 && !t.loading]
]),
t.$slots.loading && t.loading ? (ce(), Ye("div", {
key: 1,
class: Be(t.nsSelect.be("dropdown", "loading"))
}, [
Pr(t.$slots, "loading")
], 2)) : t.loading || t.filteredOptionsCount === 0 ? (ce(), Ye("div", {
key: 2,
class: Be(t.nsSelect.be("dropdown", "empty"))
}, [
Pr(t.$slots, "empty", {}, () => [
je("span", null, fi(t.emptyText), 1)
])
], 2)) : Fr("v-if", !0),
t.$slots.footer ? (ce(), Ye("div", {
key: 3,
class: Be(t.nsSelect.be("dropdown", "footer")),
onClick: m1(() => {
}, ["stop"])
}, [
Pr(t.$slots, "footer")
], 10, ["onClick"])) : Fr("v-if", !0)
]),
_: 3
}, 512)
]),
_: 3
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"])
], 16, ["onMouseleave"])), [
[y, t.handleClickOutside, t.popperRef]
]);
}
var o4t = /* @__PURE__ */ Hn(n4t, [["render", i4t], ["__file", "select.vue"]]);
const s4t = mr({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: Boolean
},
setup(t) {
const e = Bn("select"), r = Ie(null), n = G1(), i = Ie([]);
$1(HU, u3({
...o0(t)
}));
const o = Kt(() => i.value.some((d) => d.visible === !0)), s = (d) => {
var T, f;
return ((T = d.type) == null ? void 0 : T.name) === "ElOption" && !!((f = d.component) != null && f.proxy);
}, a = (d) => {
const T = $6(d), f = [];
return T.forEach((Q) => {
var y, _;
s(Q) ? f.push(Q.component.proxy) : (y = Q.children) != null && y.length ? f.push(...a(Q.children)) : (_ = Q.component) != null && _.subTree && f.push(...a(Q.component.subTree));
}), f;
}, u = () => {
i.value = a(n.subTree);
};
return W1(() => {
u();
}), zet(r, u, {
attributes: !0,
subtree: !0,
childList: !0
}), {
groupRef: r,
visible: o,
ns: e
};
}
});
function a4t(t, e, r, n, i, o) {
return Ti((ce(), Ye("ul", {
ref: "groupRef",
class: Be(t.ns.be("group", "wrap"))
}, [
je("li", {
class: Be(t.ns.be("group", "title"))
}, fi(t.label), 3),
je("li", null, [
je("ul", {
class: Be(t.ns.b("group"))
}, [
Pr(t.$slots, "default")
], 2)
])
], 2)), [
[zo, t.visible]
]);
}
var AU = /* @__PURE__ */ Hn(s4t, [["render", a4t], ["__file", "option-group.vue"]]);
const Mg = v2(o4t, {
Option: xS,
OptionGroup: AU
}), ES = il(xS);
il(AU);
const l4t = Sn({
trigger: Fh.trigger,
placement: vb.placement,
disabled: Fh.disabled,
visible: W2.visible,
transition: W2.transition,
popperOptions: vb.popperOptions,
tabindex: vb.tabindex,
content: W2.content,
popperStyle: W2.popperStyle,
popperClass: W2.popperClass,
enterable: {
...W2.enterable,
default: !0
},
effect: {
...W2.effect,
default: "light"
},
teleported: W2.teleported,
title: String,
width: {
type: [String, Number],
default: 150
},
offset: {
type: Number,
default: void 0
},
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
},
showArrow: {
type: Boolean,
default: !0
},
persistent: {
type: Boolean,
default: !0
},
"onUpdate:visible": {
type: Function
}
}), c4t = {
"update:visible": (t) => M4(t),
"before-enter": () => !0,
"before-leave": () => !0,
"after-enter": () => !0,
"after-leave": () => !0
}, u4t = "onUpdate:visible", h4t = mr({
name: "ElPopover"
}), d4t = /* @__PURE__ */ mr({
...h4t,
props: l4t,
emits: c4t,
setup(t, { expose: e, emit: r }) {
const n = t, i = Kt(() => n[u4t]), o = Bn("popover"), s = Ie(), a = Kt(() => {
var E;
return (E = vt(s)) == null ? void 0 : E.popperRef;
}), u = Kt(() => [
{
width: j5(n.width)
},
n.popperStyle
]), d = Kt(() => [o.b(), n.popperClass, { [o.m("plain")]: !!n.content }]), T = Kt(() => n.transition === `${o.namespace.value}-fade-in-linear`), f = () => {
var E;
(E = s.value) == null || E.hide();
}, Q = () => {
r("before-enter");
}, y = () => {
r("before-leave");
}, _ = () => {
r("after-enter");
}, L = () => {
r("update:visible", !1), r("after-leave");
};
return e({
popperRef: a,
hide: f
}), (E, x) => (ce(), Or(vt(sU), el({
ref_key: "tooltipRef",
ref: s
}, E.$attrs, {
trigger: E.trigger,
placement: E.placement,
disabled: E.disabled,
visible: E.visible,
transition: E.transition,
"popper-options": E.popperOptions,
tabindex: E.tabindex,
content: E.content,
offset: E.offset,
"show-after": E.showAfter,
"hide-after": E.hideAfter,
"auto-close": E.autoClose,
"show-arrow": E.showArrow,
"aria-label": E.title,
effect: E.effect,
enterable: E.enterable,
"popper-class": vt(d),
"popper-style": vt(u),
teleported: E.teleported,
persistent: E.persistent,
"gpu-acceleration": vt(T),
"onUpdate:visible": vt(i),
onBeforeShow: Q,
onBeforeHide: y,
onShow: _,
onHide: L
}), {
content: fe(() => [
E.title ? (ce(), Ye("div", {
key: 0,
class: Be(vt(o).e("title")),
role: "title"
}, fi(E.title), 3)) : Fr("v-if", !0),
Pr(E.$slots, "default", {}, () => [
xn(fi(E.content), 1)
])
]),
default: fe(() => [
E.$slots.reference ? Pr(E.$slots, "reference", { key: 0 }) : Fr("v-if", !0)
]),
_: 3
}, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]));
}
});
var p4t = /* @__PURE__ */ Hn(d4t, [["__file", "popover.vue"]]);
const _I = (t, e) => {
const r = e.arg || e.value, n = r == null ? void 0 : r.popperRef;
n && (n.triggerRef = t);
};
var T4t = {
mounted(t, e) {
_I(t, e);
},
updated(t, e) {
_I(t, e);
}
};
const f4t = "popover", OU = cot(T4t, f4t), Sg = v2(p4t, {
directive: OU
});
function Q4t(t) {
let e;
const r = Ie(!1), n = u3({
...t,
originalPosition: "",
originalOverflow: "",
visible: !1
});
function i(Q) {
n.text = Q;
}
function o() {
const Q = n.parent, y = f.ns;
if (!Q.vLoadingAddClassList) {
let _ = Q.getAttribute("loading-number");
_ = Number.parseInt(_) - 1, _ ? Q.setAttribute("loading-number", _.toString()) : (Vh(Q, y.bm("parent", "relative")), Q.removeAttribute("loading-number")), Vh(Q, y.bm("parent", "hidden"));
}
s(), T.unmount();
}
function s() {
var Q, y;
(y = (Q = f.$el) == null ? void 0 : Q.parentNode) == null || y.removeChild(f.$el);
}
function a() {
var Q;
t.beforeClose && !t.beforeClose() || (r.value = !0, clearTimeout(e), e = setTimeout(u, 400), n.visible = !1, (Q = t.closed) == null || Q.call(t));
}
function u() {
if (!r.value)
return;
const Q = n.parent;
r.value = !1, Q.vLoadingAddClassList = void 0, o();
}
const d = mr({
name: "ElLoading",
setup(Q, { expose: y }) {
const { ns: _, zIndex: L } = z2t("loading");
return y({
ns: _,
zIndex: L
}), () => {
const E = n.spinner || n.svg, x = _7("svg", {
class: "circular",
viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50",
...E ? { innerHTML: E } : {}
}, [
_7("circle", {
class: "path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
]), O = n.text ? _7("p", { class: _.b("text") }, [n.text]) : void 0;
return _7(ad, {
name: _.b("fade"),
onAfterLeave: u
}, {
default: fe(() => [
Ti(Ce("div", {
style: {
backgroundColor: n.background || ""
},
class: [
_.b("mask"),
n.customClass,
n.fullscreen ? "is-fullscreen" : ""
]
}, [
_7("div", {
class: _.b("spinner")
}, [x, O])
]), [[zo, n.visible]])
])
});
};
}
}), T = Let(d), f = T.mount(document.createElement("div"));
return {
...o0(n),
setText: i,
removeElLoadingChild: s,
close: a,
handleAfterLeave: u,
vm: f,
get $el() {
return f.$el;
}
};
}
let Yp;
const vx = function(t = {}) {
if (!s1)
return;
const e = m4t(t);
if (e.fullscreen && Yp)
return Yp;
const r = Q4t({
...e,
closed: () => {
var i;
(i = e.closed) == null || i.call(e), e.fullscreen && (Yp = void 0);
}
});
g4t(e, e.parent, r), bI(e, e.parent, r), e.parent.vLoadingAddClassList = () => bI(e, e.parent, r);
let n = e.parent.getAttribute("loading-number");
return n ? n = `${Number.parseInt(n) + 1}` : n = "1", e.parent.setAttribute("loading-number", n), e.parent.appendChild(r.$el), i1(() => r.visible.value = e.visible), e.fullscreen && (Yp = r), r;
}, m4t = (t) => {
var e, r, n, i;
let o;
return sa(t.target) ? o = (e = document.querySelector(t.target)) != null ? e : document.body : o = t.target || document.body, {
parent: o === document.body || t.body ? document.body : o,
background: t.background || "",
svg: t.svg || "",
svgViewBox: t.svgViewBox || "",
spinner: t.spinner || !1,
text: t.text || "",
fullscreen: o === document.body && ((r = t.fullscreen) != null ? r : !0),
lock: (n = t.lock) != null ? n : !1,
customClass: t.customClass || "",
visible: (i = t.visible) != null ? i : !0,
beforeClose: t.beforeClose,
closed: t.closed,
target: o
};
}, g4t = async (t, e, r) => {
const { nextZIndex: n } = r.vm.zIndex || r.vm._.exposed.zIndex, i = {};
if (t.fullscreen)
r.originalPosition.value = b7(document.body, "position"), r.originalOverflow.value = b7(document.body, "overflow"), i.zIndex = n();
else if (t.parent === document.body) {
r.originalPosition.value = b7(document.body, "position"), await i1();
for (const o of ["top", "left"]) {
const s = o === "top" ? "scrollTop" : "scrollLeft";
i[o] = `${t.target.getBoundingClientRect()[o] + document.body[s] + document.documentElement[s] - Number.parseInt(b7(document.body, `margin-${o}`), 10)}px`;
}
for (const o of ["height", "width"])
i[o] = `${t.target.getBoundingClientRect()[o]}px`;
} else
r.originalPosition.value = b7(e, "position");
for (const [o, s] of Object.entries(i))
r.$el.style[o] = s;
}, bI = (t, e, r) => {
const n = r.vm.ns || r.vm._.exposed.ns;
["absolute", "fixed", "sticky"].includes(r.originalPosition.value) ? Vh(e, n.bm("parent", "relative")) : dx(e, n.bm("parent", "relative")), t.fullscreen && t.lock ? dx(e, n.bm("parent", "hidden")) : Vh(e, n.bm("parent", "hidden"));
}, ff = Symbol("ElLoading"), LI = (t, e) => {
var r, n, i, o;
const s = e.instance, a = (Q) => T2(e.value) ? e.value[Q] : void 0, u = (Q) => {
const y = sa(Q) && (s == null ? void 0 : s[Q]) || Q;
return y && Ie(y);
}, d = (Q) => u(a(Q) || t.getAttribute(`element-loading-${ert(Q)}`)), T = (r = a("fullscreen")) != null ? r : e.modifiers.fullscreen, f = {
text: d("text"),
svg: d("svg"),
svgViewBox: d("svgViewBox"),
spinner: d("spinner"),
background: d("background"),
customClass: d("customClass"),
fullscreen: T,
target: (n = a("target")) != null ? n : T ? void 0 : t,
body: (i = a("body")) != null ? i : e.modifiers.body,
lock: (o = a("lock")) != null ? o : e.modifiers.lock
};
t[ff] = {
options: f,
instance: vx(f)
};
}, y4t = (t, e) => {
for (const r of Object.keys(e))
g2(e[r]) && (e[r].value = t[r]);
}, _x = {
mounted(t, e) {
e.value && LI(t, e);
},
updated(t, e) {
const r = t[ff];
e.oldValue !== e.value && (e.value && !e.oldValue ? LI(t, e) : e.value && e.oldValue ? T2(e.value) && y4t(e.value, r.options) : r == null || r.instance.close());
},
unmounted(t) {
var e;
(e = t[ff]) == null || e.instance.close(), t[ff] = null;
}
}, v4t = {
install(t) {
t.directive("loading", _x), t.config.globalProperties.$loading = vx;
},
directive: _x,
service: vx
}, Hg = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, i] of e)
r[n] = i;
return r;
}, _4t = {
name: "SelectionsGroup",
components: {
Checkbox: QU,
CheckboxGroup: mU,
Col: pd,
Icon: p3,
Row: dd,
ElIconWarning: wz
},
methods: {
/**
* Function to toggle paths to default.
* Also called when the associated button is pressed.
*/
reset: function() {
this.checkAll = !0, this.checkedItems = [], this.selections.forEach((t) => {
!("enabled" in t) || t.enabled === !0 ? this.checkedItems.push(t[this.identifierKey]) : this.checkAll = !1;
});
},
setCheckboxActionData: function(t, e) {
if (t) {
const r = t.querySelector('input[type="checkbox"]'), n = t.querySelector(".el-checkbox__label"), o = t.closest(".selections-container").querySelector(".checkall-display-text");
let s = "";
r && (s = r.checked ? "checked" : "unchecked"), this.checkboxActionData = {
selectionsTitle: o ? o.innerText : "",
property: r && e !== "all" ? r.value : "",
label: n ? n.innerText : "",
checked: s
};
} else
this.checkboxActionData = {
selectionsTitle: "",
property: "",
label: "",
checked: ""
};
},
onCheckboxNativeChange: function(t) {
const e = t.target.closest(".checkbox-container");
this.setCheckboxActionData(e, "individual");
},
onAllCheckboxNativeChange: function(t) {
const e = t.target.closest(".all-checkbox");
this.setCheckboxActionData(e, "all");
},
visibilityToggle: function(t, e) {
this.$emit("changed", { key: t, value: e }), t === this.checkboxActionData.property && (this.checkboxActionData.checked = e ? "checked" : "unchecked"), this.$emit("selections-data-changed", this.checkboxActionData);
},
checkboxMouseEnterEmit: function(t, e) {
this.$emit("checkboxMouseEnter", { key: t, value: e, selections: this.selections, checked: this.checkedItems });
},
handleCheckedItemsChange: function(t) {
let e = t.length;
this.checkAll = e === this.selections.length;
},
handleCheckAllChange: function(t) {
this.checkedItems = t ? this.selections.map((e) => e[this.identifierKey]) : [], this.$emit("checkAll", {
keys: this.selections.map((e) => e[this.identifierKey]),
value: t
}), this.checkboxActionData.property = this.identifierKey, this.checkboxActionData.checked = t ? "checked" : "unchecked", this.$emit("selections-data-changed", this.checkboxActionData);
},
getBackgroundStyles: function(t) {
return "colour" in t && this.colourStyle === "background" ? { background: t.colour } : {};
},
getState: function() {
const e = this.checkedItems.length === this.selections.length;
return {
checkAll: e,
checked: e ? [] : this.checkedItems
};
},
setState: function(t) {
var e;
if (this.checkAll = t.checkAll, this.checkedItems.length = 0, (e = t.checked) != null && e.length)
this.checkedItems.push(...t.checked), this.selections.forEach((r) => {
const n = r[this.identifierKey];
this.$emit("changed", { key: n, value: this.checkedItems.includes(n) });
});
else {
const r = this.selections.map((i) => i[this.identifierKey]);
let n = !1;
this.checkAll && (n = !0, this.checkedItems.push(...r)), this.$emit("checkAll", { keys: r, value: n });
}
},
hasLineStyles: function(t) {
return "colour" in t && this.colourStyle === "line";
},
getLineStyles: function(t) {
return "colour" in t && this.colourStyle === "line" ? "dashed" in t && t.dashed === !0 ? { background: `repeating-linear-gradient(90deg,${t.colour},${t.colour} 6px,transparent 0,transparent 9px)` } : { background: t.colour } : { display: "None" };
}
},
props: {
colourStyle: {
type: String,
default: "line"
},
helpMessage: {
type: String,
default: ""
},
identifierKey: {
type: String,
default: "id"
},
labelKey: {
type: String,
default: "label"
},
title: {
type: String,
default: ""
},
selections: {
type: Array,
default: function() {
return [];
}
}
},
computed: {
isIndeterminate: function() {
return !(this.checkedItems.length === 0 || this.checkAll);
}
},
data: function() {
return {
checkedItems: [],
checkAll: !0,
checkboxActionData: {
selectionsTitle: "",
property: "",
label: "",
checked: ""
}
};
},
mounted: function() {
this.reset();
}
}, b4t = { class: "selections-container" }, L4t = { class: "checkall-display-text" }, w4t = { style: { "word-break": "keep-all" } }, x4t = { class: "checkbox-group-inner" }, E4t = ["onMouseenter", "onMouseleave"];
function M4t(t, e, r, n, i, o) {
const s = wz, a = p3, u = Sg, d = pd, T = QU, f = dd, Q = mU;
return ce(), Ye("div", b4t, [
Ce(f, null, {
default: fe(() => [
Ce(d, { span: 12 }, {
default: fe(() => [
je("span", L4t, fi(r.title), 1),
r.helpMessage ? (ce(), Or(u, {
key: 0,
width: "250",
trigger: "hover",
teleported: !1,
"popper-class": "popover-origin-help"
}, Xj({
default: fe(() => [
je("span", w4t, fi(r.helpMessage), 1)
]),
_: 2
}, [
r.helpMessage ? {
name: "reference",
fn: fe(() => [
Ce(a, { class: "info" }, {
default: fe(() => [
Ce(s)
]),
_: 1
})
]),
key: "0"
} : void 0
]), 1024)) : Fr("", !0)
]),
_: 1
}),
Ce(d, { span: 12 }, {
default: fe(() => [
r.selections && r.selections.length > 1 ? (ce(), Or(T, {
key: 0,
class: "all-checkbox",
indeterminate: o.isIndeterminate,
modelValue: t.checkAll,
"onUpdate:modelValue": e[0] || (e[0] = (y) => t.checkAll = y),
onChange: o.handleCheckAllChange,
onClick: o.onAllCheckboxNativeChange
}, {
default: fe(() => [
xn("Display all")
]),
_: 1
}, 8, ["indeterminate", "modelValue", "onChange", "onClick"])) : Fr("", !0)
]),
_: 1
})
]),
_: 1
}),
Ce(Q, {
modelValue: t.checkedItems,
"onUpdate:modelValue": e[1] || (e[1] = (y) => t.checkedItems = y),
size: "small",
class: "checkbox-group",
onChange: o.handleCheckedItemsChange
}, {
default: fe(() => [
je("div", x4t, [
(ce(!0), Ye(to, null, t3(r.selections, (y) => (ce(), Or(f, {
key: y[r.identifierKey],
label: y[r.identifierKey]
}, {
default: fe(() => [
je("div", {
class: "checkbox-container",
onMouseenter: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], !0),
onMouseleave: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], !1)
}, [
Ce(T, {
class: "my-checkbox",
label: y[r.identifierKey],
value: y[r.identifierKey],
onChange: (_) => o.visibilityToggle(y[r.identifierKey], _),
onClick: o.onCheckboxNativeChange,
checked: !("enabled" in y) || y.enabled === !0
}, {
default: fe(() => [
Ce(f, { class: "checkbox-row" }, {
default: fe(() => [
o.hasLineStyles(y) ? (ce(), Or(d, {
key: 0,
span: 4
}, {
default: fe(() => [
je("div", {
class: "path-visual",
style: M1(o.getLineStyles(y))
}, null, 4)
]),
_: 2
}, 1024)) : Fr("", !0),
Ce(d, { span: 20 }, {
default: fe(() => [
je("div", {
style: M1(o.getBackgroundStyles(y))
}, fi(y[r.labelKey]), 5)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["label", "value", "onChange", "onClick", "checked"])
], 40, E4t)
]),
_: 2
}, 1032, ["label"]))), 128))
])
]),
_: 1
}, 8, ["modelValue", "onChange"])
]);
}
const CU = /* @__PURE__ */ Hg(_4t, [["render", M4t], ["__scopeId", "data-v-fb8c9eee"]]), S4t = {
name: "SvgLegends"
}, H4t = (t) => (qM("data-v-88079d87"), t = t(), XM(), t), A4t = { class: "legends-container" }, O4t = {
version: "1.1",
id: "Layer_1",
x: "0px",
y: "0px",
viewBox: "0 0 500 500",
style: { "enable-background": "new 0 0 500 500" },
xmlns: "http://www.w3.org/2000/svg",
"xmlns:bx": "https://boxy-svg.com"
}, C4t = /* @__PURE__ */ wet(' Tissue region Brain nuclei Ganglia Ganglionated nerve plexus ', 9), k4t = [
C4t
], I4t = /* @__PURE__ */ H4t(() => /* @__PURE__ */ je("svg", {
width: "72px",
height: "72px",
viewBox: "0 0 24 24",
fill: "yellow"
}, null, -1));
function P4t(t, e, r, n, i, o) {
return ce(), Ye("div", A4t, [
(ce(), Ye("svg", O4t, k4t)),
I4t
]);
}
const kU = /* @__PURE__ */ Hg(S4t, [["render", P4t], ["__scopeId", "data-v-88079d87"]]), V4t = `
`, _b = function(t) {
return t ? [...new Set(t.map((e) => JSON.stringify(e)))].map(
(e) => JSON.parse(e)
) : [];
}, bb = [], bx = async function(t, e) {
const r = e.filter(
(o) => bb.some((s) => s.taxon === o)
), n = bb.filter(
(o) => r.includes(o.taxon)
), i = e.filter(
(o) => !r.includes(o)
);
if (i.length) {
const o = await t.queryLabels(i);
if (o.length)
return o.forEach((s) => {
let { entity: a, label: u } = s;
u === "Mammalia" && (u = "Mammalia not otherwise specified");
const d = { taxon: a, label: u };
n.push(d), bb.push(d);
}), n;
} else
return n;
}, Lb = function(t, e) {
if (!t || !e) return !1;
let r = JSON.stringify(t), n = JSON.stringify(e);
return r.indexOf(n) !== -1;
};
let R4t = function() {
this.initialise = function(t) {
this.flatmapApi = t, this.destinations = [], this.origins = [], this.components = [], this.urls = [], this.controller = void 0, this.uberons = [], this.lookUp = [];
}, this.createTooltipData = async function(t, e) {
let r = [];
e.feature.hyperlinks && e.feature.hyperlinks.length > 0 ? r = e.feature.hyperlinks : r = this.urls.map((o) => ({ url: o, id: "pubmed" }));
let n;
if (e.provenanceTaxonomy) {
n = [];
const o = await bx(t, e.provenanceTaxonomy);
o.length && o.forEach((s) => {
const { label: a } = s;
n.push(a);
});
}
return {
destinations: this.destinations,
origins: this.origins,
components: this.components,
destinationsWithDatasets: this.destinationsWithDatasets,
originsWithDatasets: this.originsWithDatasets,
componentsWithDatasets: this.componentsWithDatasets,
title: e.label,
featureId: e.resource,
hyperlinks: r,
provenanceTaxonomy: e.provenanceTaxonomy,
provenanceTaxonomyLabel: n
};
}, this.createComponentsLabelList = function(t, e) {
let r = [];
return t.forEach((n) => {
r.push(this.createLabelFromNeuralNode(n[0]), e), n.length === 2 && r.push(this.createLabelFromNeuralNode(n[1]), e);
}), r;
}, this.createLabelLookup = function(t, e) {
return new Promise(async (r) => {
let n = {};
this.uberons = [];
const i = await bx(t, e);
i.length && (i.forEach((o) => {
const { taxon: s, label: a } = o;
n[s] = a, this.uberons.push({
id: s,
name: a
});
}), r(n));
});
}, this.buildConnectivitySqlStatement = function(t) {
let e = "select knowledge from knowledge where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.buildLabelSqlStatement = function(t) {
let e = "select entity, label from labels where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.findAllIdsFromConnectivity = function(t) {
let e = t.connectivity.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), [...new Set(n.flat())];
}, this.flattenConntectivity = function(t) {
let e = t.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), n.flat();
}, this.findComponents = function(t) {
let e = t.connectivity.flat(), r = _b(e), n = [], i = !1;
return r.forEach((o) => {
i = !1, Lb(t.axons, o) && (i = !0), t.somas && Lb(t.somas, o) && (i = !0), Lb(t.dendrites, o) && (i = !0), i || n.push(o);
}), n;
}, this.retrieveFlatmapKnowledgeForEvent = async function(t, e) {
this.controller && this.controller.abort(), this.controller = new AbortController();
const r = this.controller.signal, n = e.resource;
if (this.destinations = [], this.origins = [], this.components = [], this.urls = [], !n || n.length == 0 || !n[0]) return;
let i = this.queryForConnectivityNew(t, n, r);
return await Promise.all([i]);
}, this.queryForConnectivityNew = function(t, e, r, n = !0) {
return new Promise((i) => {
t.queryKnowledge(e[0]).then((o) => {
if (this.checkConnectivityExists(o)) {
let s = o;
n ? this.processConnectivity(t, s).then((a) => {
o.references ? this.getURLsForPubMed(o.references).then((u) => {
this.urls = u, i(a);
}) : i(a);
}) : i(s);
} else
i(!1);
}).catch((o) => {
o.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${e[0]}.`), i(!1);
});
});
}, this.queryForConnectivity = function(t, e, r, n = !0) {
const i = { sql: this.buildConnectivitySqlStatement(e) }, o = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(i),
...r ? { signal: r } : {}
// add signal to header if it exists
};
return new Promise((s) => {
fetch(`${this.flatmapApi}knowledge/query/`, o).then((a) => a.json()).then((a) => {
if (this.connectivityExists(a)) {
let u = JSON.parse(a.values[0][0]);
n ? this.processConnectivity(t, u).then((d) => {
s(d);
}) : s(u);
} else
s(!1);
}).catch((a) => {
a.name === "AbortError" || console.error("Error:", a), s(!1);
});
});
}, this.checkConnectivityExists = function(t) {
var e;
return t && ((e = t.connectivity) == null ? void 0 : e.length);
}, this.connectivityExists = function(t) {
return !!(t.values && t.values.length > 0 && JSON.parse(t.values[0][0]).connectivity && JSON.parse(t.values[0][0]).connectivity.length > 0);
}, this.findIfNodeIsSingle = function(t) {
return t.length === 1 ? (console.error("Server returns a single node", t), t[0]) : t.length === 2 && t[1].length === 0 ? t[0] : !1;
}, this.createLabelFromNeuralNode = function(t, e) {
let r = this.findIfNodeIsSingle(t);
if (r)
return e[r];
let n = e[t[0]];
return t.length === 2 && t[1].length > 0 && t[1].forEach((i) => {
e[i] == null ? n += `, ${i}` : n += `, ${e[i]}`;
}), n;
}, this.flattenAndFindDatasets = function(t, e, r) {
let n = this.flattenConntectivity(t), i = this.flattenConntectivity(e), o = this.flattenConntectivity(r);
this.destinationsWithDatasets = this.uberons.filter(
(s) => i.indexOf(s.id) !== -1
), this.originsWithDatasets = this.uberons.filter(
(s) => o.indexOf(s.id) !== -1
), this.componentsWithDatasets = this.uberons.filter(
(s) => n.indexOf(s.id) !== -1
);
}, this.processConnectivity = function(t, e) {
return new Promise((r) => {
let n = this.findComponents(e), i = _b(e.axons), o = [];
e.somas && e.somas.length > 0 && o.push(...e.somas), e.dendrites && e.dendrites.length > 0 && o.push(...e.dendrites), o = _b(o);
let s = this.findAllIdsFromConnectivity(e);
this.createLabelLookup(t, s).then((a) => {
this.destinations = i.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.origins = o.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.components = n.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.flattenAndFindDatasets(n, i, o), r({
ids: {
axons: i,
dendrites: o,
components: n
},
labels: {
destinations: this.destinations,
origins: this.origins,
components: this.components
}
});
});
});
}, this.flattenConntectivity = function(t) {
let e = t.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), n.flat();
}, this.stripPMIDPrefix = function(t) {
return t.split(":")[1];
}, this.getPMID = function(t) {
return new Promise((e) => {
if (t.length > 0) {
const r = [], n = [];
t.forEach((i) => {
const o = '"' + i + '"', s = new URLSearchParams({
db: "pubmed",
term: o,
format: "json"
}), a = fetch(`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?${s}`, {
method: "GET"
}).then((u) => u.json()).then((u) => {
const d = u.esearchresult ? u.esearchresult.idlist : [];
n.push(...d);
});
r.push(a);
}), Promise.all(r).then(() => {
e(n);
}).catch(() => {
e(n);
});
} else
e([]);
});
}, this.convertPublicationIds = function(t) {
return new Promise((e) => {
const r = [], n = [];
t.forEach((i) => {
i.type === "pmid" ? r.push(i.id) : (i.type === "doi" || i.type === "pmc") && n.push(i.id);
}), this.getPMID(n).then((i) => {
r.push(...i), e(r);
}).catch(() => {
e(r);
});
});
}, this.extractPublicationIdFromURLString = function(t) {
if (!t) return;
const e = decodeURIComponent(t);
let r = { id: "", type: "" };
return [
"doi.org/",
"nih.gov/pubmed/",
"pmc/articles/",
"pubmed.ncbi.nlm.nih.gov/"
].forEach((i) => {
const o = e.lastIndexOf(i);
o !== -1 && (r.id = e.slice(o + i.length), i === "doi.org/" ? r.type = "doi" : i === "pmc/articles/" ? r.type = "pmc" : r.type = "pmid");
}), r.id === "" && (t.includes("doi:") ? (r.id = this.stripPMIDPrefix(t), r.type = "doi") : t.includes("PMID:") && (r.id = this.stripPMIDPrefix(t), r.type = "pmid")), r.id.endsWith("/") && (r.id = r.id.slice(0, -1)), r;
}, this.getURLsForPubMed = function(t) {
return new Promise((e) => {
const r = t.map(
(n) => typeof n == "object" ? this.extractPublicationIdFromURLString(n[0]) : this.extractPublicationIdFromURLString(n)
);
this.convertPublicationIds(r).then((n) => {
if (n.length > 0) {
const i = n.join();
e([this.pubmedSearchUrl(i)]);
} else
e([]);
});
});
}, this.buildPubmedSqlStatement = function(t) {
let e = "select distinct publication from publications where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.buildPubmedSqlStatementForModels = function(t) {
return `select distinct publication from publications where entity = '${t}'`;
}, this.flatmapQuery = function(t) {
const e = { sql: t };
return fetch(`${this.flatmapApi}knowledge/query/`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(e)
}).then((r) => r.json()).catch((r) => {
console.error("Error:", r);
});
}, this.pubmedQueryOnIds = function(t) {
return new Promise((e) => {
const r = t.resource, n = t.feature.source;
if (!r || r.length === 0) return;
const i = this.buildPubmedSqlStatement(r);
this.flatmapQuery(i).then((o) => {
o.values.length > 0 ? this.getURLsForPubMed(o.values).then((s) => {
this.urls = s, s.length ? e(!0) : e(!1);
}).catch(() => {
this.urls = [], e(!1);
}) : this.pubmedQueryOnModels(n).then((s) => {
e(s);
});
});
});
}, this.pubmedQueryOnModels = function(t) {
return this.flatmapQuery(
this.buildPubmedSqlStatementForModels(t)
).then((e) => (Array.isArray(e.values) && e.values.length > 0 ? this.getURLsForPubMed(e.values).then((r) => (this.urls = r, !0)).catch(() => (this.urls = [], !1)) : this.urls = [], !1));
}, this.pubmedSearchUrl = function(t) {
let e = "https://pubmed.ncbi.nlm.nih.gov/?", r = new URLSearchParams();
return r.append("term", t), e + r.toString();
};
};
const N4t = (t) => t && t.charAt(0).toUpperCase() + t.slice(1), D4t = '';
var IU = { exports: {} };
(function(t, e) {
(function(r, n) {
t.exports = n();
})(typeof window < "u" ? window : Pat, function() {
if (typeof window > "u")
return null;
var r = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")(), n = r.requestAnimationFrame || r.mozRequestAnimationFrame || r.webkitRequestAnimationFrame || function(T) {
return r.setTimeout(T, 20);
}, i = r.cancelAnimationFrame || r.mozCancelAnimationFrame || r.webkitCancelAnimationFrame || function(T) {
r.clearTimeout(T);
};
function o(T, f) {
var Q = Object.prototype.toString.call(T), y = Q === "[object Array]" || Q === "[object NodeList]" || Q === "[object HTMLCollection]" || Q === "[object Object]" || typeof jQuery < "u" && T instanceof jQuery || typeof Elements < "u" && T instanceof Elements, _ = 0, L = T.length;
if (y)
for (; _ < L; _++)
f(T[_]);
else
f(T);
}
function s(T) {
if (!T.getBoundingClientRect)
return {
width: T.offsetWidth,
height: T.offsetHeight
};
var f = T.getBoundingClientRect();
return {
width: Math.round(f.width),
height: Math.round(f.height)
};
}
function a(T, f) {
Object.keys(f).forEach(function(Q) {
T.style[Q] = f[Q];
});
}
var u = function(T, f) {
var Q = 0;
function y() {
var L = [];
this.add = function(O) {
L.push(O);
};
var E, x;
this.call = function(O) {
for (E = 0, x = L.length; E < x; E++)
L[E].call(this, O);
}, this.remove = function(O) {
var k = [];
for (E = 0, x = L.length; E < x; E++)
L[E] !== O && k.push(L[E]);
L = k;
}, this.length = function() {
return L.length;
};
}
function _(L, E) {
if (L) {
if (L.resizedAttached) {
L.resizedAttached.add(E);
return;
}
L.resizedAttached = new y(), L.resizedAttached.add(E), L.resizeSensor = document.createElement("div"), L.resizeSensor.dir = "ltr", L.resizeSensor.className = "resize-sensor";
var x = {
pointerEvents: "none",
position: "absolute",
left: "0px",
top: "0px",
right: "0px",
bottom: "0px",
overflow: "hidden",
zIndex: "-1",
visibility: "hidden",
maxWidth: "100%"
}, O = {
position: "absolute",
left: "0px",
top: "0px",
transition: "0s"
};
a(L.resizeSensor, x);
var k = document.createElement("div");
k.className = "resize-sensor-expand", a(k, x);
var R = document.createElement("div");
a(R, O), k.appendChild(R);
var F = document.createElement("div");
F.className = "resize-sensor-shrink", a(F, x);
var U = document.createElement("div");
a(U, O), a(U, { width: "200%", height: "200%" }), F.appendChild(U), L.resizeSensor.appendChild(k), L.resizeSensor.appendChild(F), L.appendChild(L.resizeSensor);
var $ = window.getComputedStyle(L), et = $ ? $.getPropertyValue("position") : null;
et !== "absolute" && et !== "relative" && et !== "fixed" && et !== "sticky" && (L.style.position = "relative");
var nt = !1, ct = 0, rt = s(L), gt = 0, It = 0, Zt = !0;
Q = 0;
var oe = function() {
var ie = L.offsetWidth, Qe = L.offsetHeight;
R.style.width = ie + 10 + "px", R.style.height = Qe + 10 + "px", k.scrollLeft = ie + 10, k.scrollTop = Qe + 10, F.scrollLeft = ie + 10, F.scrollTop = Qe + 10;
}, re = function() {
if (Zt) {
var ie = L.offsetWidth === 0 && L.offsetHeight === 0;
if (ie) {
Q || (Q = n(function() {
Q = 0, re();
}));
return;
} else
Zt = !1;
}
oe();
};
L.resizeSensor.resetSensor = re;
var Ve = function() {
ct = 0, nt && (gt = rt.width, It = rt.height, L.resizedAttached && L.resizedAttached.call(rt));
}, yr = function() {
rt = s(L), nt = rt.width !== gt || rt.height !== It, nt && !ct && (ct = n(Ve)), re();
}, qr = function(ie, Qe, Ke) {
ie.attachEvent ? ie.attachEvent("on" + Qe, Ke) : ie.addEventListener(Qe, Ke);
};
qr(k, "scroll", yr), qr(F, "scroll", yr), Q = n(function() {
Q = 0, re();
});
}
}
o(T, function(L) {
_(L, f);
}), this.detach = function(L) {
Q || (i(Q), Q = 0), u.detach(T, L);
}, this.reset = function() {
T.resizeSensor.resetSensor();
};
};
if (u.reset = function(T) {
o(T, function(f) {
f.resizeSensor.resetSensor();
});
}, u.detach = function(T, f) {
o(T, function(Q) {
Q && (Q.resizedAttached && typeof f == "function" && (Q.resizedAttached.remove(f), Q.resizedAttached.length()) || Q.resizeSensor && (Q.contains(Q.resizeSensor) && Q.removeChild(Q.resizeSensor), delete Q.resizeSensor, delete Q.resizedAttached));
});
}, typeof MutationObserver < "u") {
var d = new MutationObserver(function(T) {
for (var f in T)
if (T.hasOwnProperty(f))
for (var Q = T[f].addedNodes, y = 0; y < Q.length; y++)
Q[y].resizeSensor && u.reset(Q[y]);
});
document.addEventListener("DOMContentLoaded", function(T) {
d.observe(document.body, {
childList: !0,
subtree: !0
});
});
}
return u;
});
})(IU);
var F4t = IU.exports;
const B4t = /* @__PURE__ */ Vat(F4t);
var j4t = Object.defineProperty, z4t = (t, e, r) => e in t ? j4t(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, dt = (t, e, r) => (z4t(t, typeof e != "symbol" ? e + "" : e, r), r), MS = (t, e, r) => {
if (!e.has(t))
throw TypeError("Cannot " + r);
}, K = (t, e, r) => (MS(t, e, "read from private field"), r ? r.call(t) : e.get(t)), Ft = (t, e, r) => {
if (e.has(t))
throw TypeError("Cannot add the same private member more than once");
e instanceof WeakSet ? e.add(t) : e.set(t, r);
}, Jt = (t, e, r, n) => (MS(t, e, "write to private field"), e.set(t, r), r), se = (t, e, r) => (MS(t, e, "access private method"), r);
function U4t(t, e) {
for (var r = 0; r < e.length; r++) {
const n = e[r];
if (typeof n != "string" && !Array.isArray(n)) {
for (const i in n)
if (i !== "default" && !(i in t)) {
const o = Object.getOwnPropertyDescriptor(n, i);
o && Object.defineProperty(t, i, o.get ? o : {
enumerable: !0,
get: () => n[i]
});
}
}
}
return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
}
var P = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function d0(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
function G4t(t) {
if (t.__esModule)
return t;
var e = t.default;
if (typeof e == "function") {
var r = function n() {
return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
};
r.prototype = e.prototype;
} else
r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) {
var i = Object.getOwnPropertyDescriptor(t, n);
Object.defineProperty(r, n, i.get ? i : {
enumerable: !0,
get: function() {
return t[n];
}
});
}), r;
}
var qo = function(t) {
try {
return !!t();
} catch {
return !0;
}
}, $4t = qo, SS = !$4t(function() {
var t = (function() {
}).bind();
return typeof t != "function" || t.hasOwnProperty("prototype");
}), PU = SS, VU = Function.prototype, Lx = VU.call, W4t = PU && VU.bind.bind(Lx, Lx), oo = PU ? W4t : function(t) {
return function() {
return Lx.apply(t, arguments);
};
}, RU = oo, Z4t = RU({}.toString), q4t = RU("".slice), Td = function(t) {
return q4t(Z4t(t), 8, -1);
}, X4t = oo, K4t = qo, Y4t = Td, wb = Object, J4t = X4t("".split), t6t = K4t(function() {
return !wb("z").propertyIsEnumerable(0);
}) ? function(t) {
return Y4t(t) === "String" ? J4t(t, "") : wb(t);
} : wb, fd = function(t) {
return t == null;
}, e6t = fd, r6t = TypeError, Ag = function(t) {
if (e6t(t))
throw new r6t("Can't call method on " + t);
return t;
}, n6t = t6t, i6t = Ag, ec = function(t) {
return n6t(i6t(t));
}, uu = function(t) {
return t && t.Math === Math && t;
}, Y2 = (
// eslint-disable-next-line es/no-global-this -- safe
uu(typeof globalThis == "object" && globalThis) || uu(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe
uu(typeof self == "object" && self) || uu(typeof P == "object" && P) || uu(typeof P == "object" && P) || // eslint-disable-next-line no-new-func -- fallback
/* @__PURE__ */ function() {
return this;
}() || Function("return this")()
), NU = { exports: {} }, wI = Y2, o6t = Object.defineProperty, HS = function(t, e) {
try {
o6t(wI, t, { value: e, configurable: !0, writable: !0 });
} catch {
wI[t] = e;
}
return e;
}, s6t = Y2, a6t = HS, xI = "__core-js_shared__", EI = NU.exports = s6t[xI] || a6t(xI, {});
(EI.versions || (EI.versions = [])).push({
version: "3.37.0",
mode: "global",
copyright: "© 2014-2024 Denis Pushkarev (zloirock.ru)",
license: "https://github.com/zloirock/core-js/blob/v3.37.0/LICENSE",
source: "https://github.com/zloirock/core-js"
});
var AS = NU.exports, MI = AS, DU = function(t, e) {
return MI[t] || (MI[t] = e || {});
}, l6t = Ag, c6t = Object, FU = function(t) {
return c6t(l6t(t));
}, u6t = oo, h6t = FU, d6t = u6t({}.hasOwnProperty), _3 = Object.hasOwn || function(t, e) {
return d6t(h6t(t), e);
}, p6t = oo, T6t = 0, f6t = Math.random(), Q6t = p6t(1 .toString), OS = function(t) {
return "Symbol(" + (t === void 0 ? "" : t) + ")_" + Q6t(++T6t + f6t, 36);
}, m6t = typeof navigator < "u" && String(navigator.userAgent) || "", BU = Y2, xb = m6t, SI = BU.process, HI = BU.Deno, AI = SI && SI.versions || HI && HI.version, OI = AI && AI.v8, ta, DQ;
OI && (ta = OI.split("."), DQ = ta[0] > 0 && ta[0] < 4 ? 1 : +(ta[0] + ta[1]));
!DQ && xb && (ta = xb.match(/Edge\/(\d+)/), (!ta || ta[1] >= 74) && (ta = xb.match(/Chrome\/(\d+)/), ta && (DQ = +ta[1])));
var g6t = DQ, CI = g6t, y6t = qo, v6t = Y2, _6t = v6t.String, jU = !!Object.getOwnPropertySymbols && !y6t(function() {
var t = Symbol("symbol detection");
return !_6t(t) || !(Object(t) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && CI && CI < 41;
}), b6t = jU, zU = b6t && !Symbol.sham && typeof Symbol.iterator == "symbol", L6t = Y2, w6t = DU, kI = _3, x6t = OS, E6t = jU, M6t = zU, X7 = L6t.Symbol, Eb = w6t("wks"), S6t = M6t ? X7.for || X7 : X7 && X7.withoutSetter || x6t, Ns = function(t) {
return kI(Eb, t) || (Eb[t] = E6t && kI(X7, t) ? X7[t] : S6t("Symbol." + t)), Eb[t];
}, Mb = typeof document == "object" && document.all, Mo = typeof Mb > "u" && Mb !== void 0 ? function(t) {
return typeof t == "function" || t === Mb;
} : function(t) {
return typeof t == "function";
}, H6t = Mo, Ds = function(t) {
return typeof t == "object" ? t !== null : H6t(t);
}, A6t = Ds, O6t = String, C6t = TypeError, p0 = function(t) {
if (A6t(t))
return t;
throw new C6t(O6t(t) + " is not an object");
}, UU = {}, k6t = qo, da = !k6t(function() {
return Object.defineProperty({}, 1, { get: function() {
return 7;
} })[1] !== 7;
}), I6t = da, P6t = qo, GU = I6t && P6t(function() {
return Object.defineProperty(function() {
}, "prototype", {
value: 42,
writable: !1
}).prototype !== 42;
}), b3 = {}, V6t = Y2, II = Ds, wx = V6t.document, R6t = II(wx) && II(wx.createElement), CS = function(t) {
return R6t ? wx.createElement(t) : {};
}, N6t = da, D6t = qo, F6t = CS, $U = !N6t && !D6t(function() {
return Object.defineProperty(F6t("div"), "a", {
get: function() {
return 7;
}
}).a !== 7;
}), B6t = SS, Jp = Function.prototype.call, k4 = B6t ? Jp.bind(Jp) : function() {
return Jp.apply(Jp, arguments);
}, Sb = Y2, j6t = Mo, z6t = function(t) {
return j6t(t) ? t : void 0;
}, Qd = function(t, e) {
return arguments.length < 2 ? z6t(Sb[t]) : Sb[t] && Sb[t][e];
}, U6t = oo, kS = U6t({}.isPrototypeOf), G6t = Qd, $6t = Mo, W6t = kS, Z6t = zU, q6t = Object, WU = Z6t ? function(t) {
return typeof t == "symbol";
} : function(t) {
var e = G6t("Symbol");
return $6t(e) && W6t(e.prototype, q6t(t));
}, X6t = String, IS = function(t) {
try {
return X6t(t);
} catch {
return "Object";
}
}, K6t = Mo, Y6t = IS, J6t = TypeError, md = function(t) {
if (K6t(t))
return t;
throw new J6t(Y6t(t) + " is not a function");
}, t0t = md, e0t = fd, PS = function(t, e) {
var r = t[e];
return e0t(r) ? void 0 : t0t(r);
}, Hb = k4, Ab = Mo, Ob = Ds, r0t = TypeError, n0t = function(t, e) {
var r, n;
if (e === "string" && Ab(r = t.toString) && !Ob(n = Hb(r, t)) || Ab(r = t.valueOf) && !Ob(n = Hb(r, t)) || e !== "string" && Ab(r = t.toString) && !Ob(n = Hb(r, t)))
return n;
throw new r0t("Can't convert object to primitive value");
}, i0t = k4, PI = Ds, VI = WU, o0t = PS, s0t = n0t, a0t = Ns, l0t = TypeError, c0t = a0t("toPrimitive"), u0t = function(t, e) {
if (!PI(t) || VI(t))
return t;
var r = o0t(t, c0t), n;
if (r) {
if (e === void 0 && (e = "default"), n = i0t(r, t, e), !PI(n) || VI(n))
return n;
throw new l0t("Can't convert object to primitive value");
}
return e === void 0 && (e = "number"), s0t(t, e);
}, h0t = u0t, d0t = WU, ZU = function(t) {
var e = h0t(t, "string");
return d0t(e) ? e : e + "";
}, p0t = da, T0t = $U, f0t = GU, tT = p0, RI = ZU, Q0t = TypeError, Cb = Object.defineProperty, m0t = Object.getOwnPropertyDescriptor, kb = "enumerable", Ib = "configurable", Pb = "writable";
b3.f = p0t ? f0t ? function(t, e, r) {
if (tT(t), e = RI(e), tT(r), typeof t == "function" && e === "prototype" && "value" in r && Pb in r && !r[Pb]) {
var n = m0t(t, e);
n && n[Pb] && (t[e] = r.value, r = {
configurable: Ib in r ? r[Ib] : n[Ib],
enumerable: kb in r ? r[kb] : n[kb],
writable: !1
});
}
return Cb(t, e, r);
} : Cb : function(t, e, r) {
if (tT(t), e = RI(e), tT(r), T0t)
try {
return Cb(t, e, r);
} catch {
}
if ("get" in r || "set" in r)
throw new Q0t("Accessors not supported");
return "value" in r && (t[e] = r.value), t;
};
var g0t = Math.ceil, y0t = Math.floor, v0t = Math.trunc || function(t) {
var e = +t;
return (e > 0 ? y0t : g0t)(e);
}, _0t = v0t, Og = function(t) {
var e = +t;
return e !== e || e === 0 ? 0 : _0t(e);
}, b0t = Og, L0t = Math.max, w0t = Math.min, x0t = function(t, e) {
var r = b0t(t);
return r < 0 ? L0t(r + e, 0) : w0t(r, e);
}, E0t = Og, M0t = Math.min, S0t = function(t) {
var e = E0t(t);
return e > 0 ? M0t(e, 9007199254740991) : 0;
}, H0t = S0t, qU = function(t) {
return H0t(t.length);
}, A0t = ec, O0t = x0t, C0t = qU, NI = function(t) {
return function(e, r, n) {
var i = A0t(e), o = C0t(i);
if (o === 0)
return !t && -1;
var s = O0t(n, o), a;
if (t && r !== r) {
for (; o > s; )
if (a = i[s++], a !== a)
return !0;
} else
for (; o > s; s++)
if ((t || s in i) && i[s] === r)
return t || s || 0;
return !t && -1;
};
}, k0t = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: NI(!0),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: NI(!1)
}, Cg = {}, I0t = oo, Vb = _3, P0t = ec, V0t = k0t.indexOf, R0t = Cg, DI = I0t([].push), XU = function(t, e) {
var r = P0t(t), n = 0, i = [], o;
for (o in r)
!Vb(R0t, o) && Vb(r, o) && DI(i, o);
for (; e.length > n; )
Vb(r, o = e[n++]) && (~V0t(i, o) || DI(i, o));
return i;
}, VS = [
"constructor",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"toString",
"valueOf"
], N0t = XU, D0t = VS, F0t = Object.keys || function(t) {
return N0t(t, D0t);
}, B0t = da, j0t = GU, z0t = b3, U0t = p0, G0t = ec, $0t = F0t;
UU.f = B0t && !j0t ? Object.defineProperties : function(t, e) {
U0t(t);
for (var r = G0t(e), n = $0t(e), i = n.length, o = 0, s; i > o; )
z0t.f(t, s = n[o++], r[s]);
return t;
};
var W0t = Qd, Z0t = W0t("document", "documentElement"), q0t = DU, X0t = OS, FI = q0t("keys"), RS = function(t) {
return FI[t] || (FI[t] = X0t(t));
}, K0t = p0, Y0t = UU, BI = VS, J0t = Cg, t5t = Z0t, e5t = CS, r5t = RS, jI = ">", zI = "<", xx = "prototype", Ex = "script", KU = r5t("IE_PROTO"), Rb = function() {
}, YU = function(t) {
return zI + Ex + jI + t + zI + "/" + Ex + jI;
}, UI = function(t) {
t.write(YU("")), t.close();
var e = t.parentWindow.Object;
return t = null, e;
}, n5t = function() {
var t = e5t("iframe"), e = "java" + Ex + ":", r;
return t.style.display = "none", t5t.appendChild(t), t.src = String(e), r = t.contentWindow.document, r.open(), r.write(YU("document.F=Object")), r.close(), r.F;
}, eT, Qf = function() {
try {
eT = new ActiveXObject("htmlfile");
} catch {
}
Qf = typeof document < "u" ? document.domain && eT ? UI(eT) : n5t() : UI(eT);
for (var t = BI.length; t--; )
delete Qf[xx][BI[t]];
return Qf();
};
J0t[KU] = !0;
var NS = Object.create || function(t, e) {
var r;
return t !== null ? (Rb[xx] = K0t(t), r = new Rb(), Rb[xx] = null, r[KU] = t) : r = Qf(), e === void 0 ? r : Y0t.f(r, e);
}, i5t = Ns, o5t = NS, s5t = b3.f, Mx = i5t("unscopables"), Sx = Array.prototype;
Sx[Mx] === void 0 && s5t(Sx, Mx, {
configurable: !0,
value: o5t(null)
});
var a5t = function(t) {
Sx[Mx][t] = !0;
}, gd = {}, l5t = Y2, c5t = Mo, GI = l5t.WeakMap, u5t = c5t(GI) && /native code/.test(String(GI)), DS = function(t, e) {
return {
enumerable: !(t & 1),
configurable: !(t & 2),
writable: !(t & 4),
value: e
};
}, h5t = da, d5t = b3, p5t = DS, kg = h5t ? function(t, e, r) {
return d5t.f(t, e, p5t(1, r));
} : function(t, e, r) {
return t[e] = r, t;
}, T5t = u5t, JU = Y2, f5t = Ds, Q5t = kg, Nb = _3, Db = AS, m5t = RS, g5t = Cg, $I = "Object already initialized", Hx = JU.TypeError, y5t = JU.WeakMap, FQ, Bh, BQ, v5t = function(t) {
return BQ(t) ? Bh(t) : FQ(t, {});
}, _5t = function(t) {
return function(e) {
var r;
if (!f5t(e) || (r = Bh(e)).type !== t)
throw new Hx("Incompatible receiver, " + t + " required");
return r;
};
};
if (T5t || Db.state) {
var Ca = Db.state || (Db.state = new y5t());
Ca.get = Ca.get, Ca.has = Ca.has, Ca.set = Ca.set, FQ = function(t, e) {
if (Ca.has(t))
throw new Hx($I);
return e.facade = t, Ca.set(t, e), e;
}, Bh = function(t) {
return Ca.get(t) || {};
}, BQ = function(t) {
return Ca.has(t);
};
} else {
var Kl = m5t("state");
g5t[Kl] = !0, FQ = function(t, e) {
if (Nb(t, Kl))
throw new Hx($I);
return e.facade = t, Q5t(t, Kl, e), e;
}, Bh = function(t) {
return Nb(t, Kl) ? t[Kl] : {};
}, BQ = function(t) {
return Nb(t, Kl);
};
}
var Ig = {
set: FQ,
get: Bh,
has: BQ,
enforce: v5t,
getterFor: _5t
}, FS = {}, tG = {}, eG = {}.propertyIsEnumerable, rG = Object.getOwnPropertyDescriptor, b5t = rG && !eG.call({ 1: 2 }, 1);
tG.f = b5t ? function(t) {
var e = rG(this, t);
return !!e && e.enumerable;
} : eG;
var L5t = da, w5t = k4, x5t = tG, E5t = DS, M5t = ec, S5t = ZU, H5t = _3, A5t = $U, WI = Object.getOwnPropertyDescriptor;
FS.f = L5t ? WI : function(t, e) {
if (t = M5t(t), e = S5t(e), A5t)
try {
return WI(t, e);
} catch {
}
if (H5t(t, e))
return E5t(!w5t(x5t.f, t, e), t[e]);
};
var nG = { exports: {} }, Ax = da, O5t = _3, iG = Function.prototype, C5t = Ax && Object.getOwnPropertyDescriptor, BS = O5t(iG, "name"), k5t = BS && (function() {
}).name === "something", I5t = BS && (!Ax || Ax && C5t(iG, "name").configurable), oG = {
EXISTS: BS,
PROPER: k5t,
CONFIGURABLE: I5t
}, P5t = oo, V5t = Mo, Ox = AS, R5t = P5t(Function.toString);
V5t(Ox.inspectSource) || (Ox.inspectSource = function(t) {
return R5t(t);
});
var N5t = Ox.inspectSource, jS = oo, D5t = qo, F5t = Mo, rT = _3, Cx = da, B5t = oG.CONFIGURABLE, j5t = N5t, sG = Ig, z5t = sG.enforce, U5t = sG.get, ZI = String, mf = Object.defineProperty, G5t = jS("".slice), $5t = jS("".replace), W5t = jS([].join), Z5t = Cx && !D5t(function() {
return mf(function() {
}, "length", { value: 8 }).length !== 8;
}), q5t = String(String).split("String"), X5t = nG.exports = function(t, e, r) {
G5t(ZI(e), 0, 7) === "Symbol(" && (e = "[" + $5t(ZI(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), r && r.getter && (e = "get " + e), r && r.setter && (e = "set " + e), (!rT(t, "name") || B5t && t.name !== e) && (Cx ? mf(t, "name", { value: e, configurable: !0 }) : t.name = e), Z5t && r && rT(r, "arity") && t.length !== r.arity && mf(t, "length", { value: r.arity });
try {
r && rT(r, "constructor") && r.constructor ? Cx && mf(t, "prototype", { writable: !1 }) : t.prototype && (t.prototype = void 0);
} catch {
}
var n = z5t(t);
return rT(n, "source") || (n.source = W5t(q5t, typeof e == "string" ? e : "")), t;
};
Function.prototype.toString = X5t(function() {
return F5t(this) && U5t(this).source || j5t(this);
}, "toString");
var aG = nG.exports, K5t = Mo, Y5t = b3, J5t = aG, tlt = HS, rc = function(t, e, r, n) {
n || (n = {});
var i = n.enumerable, o = n.name !== void 0 ? n.name : e;
if (K5t(r) && J5t(r, o, n), n.global)
i ? t[e] = r : tlt(e, r);
else {
try {
n.unsafe ? t[e] && (i = !0) : delete t[e];
} catch {
}
i ? t[e] = r : Y5t.f(t, e, {
value: r,
enumerable: !1,
configurable: !n.nonConfigurable,
writable: !n.nonWritable
});
}
return t;
}, Pg = {}, elt = XU, rlt = VS, nlt = rlt.concat("length", "prototype");
Pg.f = Object.getOwnPropertyNames || function(t) {
return elt(t, nlt);
};
var lG = {};
lG.f = Object.getOwnPropertySymbols;
var ilt = Qd, olt = oo, slt = Pg, alt = lG, llt = p0, clt = olt([].concat), ult = ilt("Reflect", "ownKeys") || function(t) {
var e = slt.f(llt(t)), r = alt.f;
return r ? clt(e, r(t)) : e;
}, qI = _3, hlt = ult, dlt = FS, plt = b3, Tlt = function(t, e, r) {
for (var n = hlt(e), i = plt.f, o = dlt.f, s = 0; s < n.length; s++) {
var a = n[s];
!qI(t, a) && !(r && qI(r, a)) && i(t, a, o(e, a));
}
}, flt = qo, Qlt = Mo, mlt = /#|\.prototype\./, yd = function(t, e) {
var r = ylt[glt(t)];
return r === _lt ? !0 : r === vlt ? !1 : Qlt(e) ? flt(e) : !!e;
}, glt = yd.normalize = function(t) {
return String(t).replace(mlt, ".").toLowerCase();
}, ylt = yd.data = {}, vlt = yd.NATIVE = "N", _lt = yd.POLYFILL = "P", cG = yd, nT = Y2, blt = FS.f, Llt = kg, wlt = rc, xlt = HS, Elt = Tlt, Mlt = cG, L3 = function(t, e) {
var r = t.target, n = t.global, i = t.stat, o, s, a, u, d, T;
if (n ? s = nT : i ? s = nT[r] || xlt(r, {}) : s = nT[r] && nT[r].prototype, s)
for (a in e) {
if (d = e[a], t.dontCallGetSet ? (T = blt(s, a), u = T && T.value) : u = s[a], o = Mlt(n ? a : r + (i ? "." : "#") + a, t.forced), !o && u !== void 0) {
if (typeof d == typeof u)
continue;
Elt(d, u);
}
(t.sham || u && u.sham) && Llt(d, "sham", !0), wlt(s, a, d, t);
}
}, Slt = qo, Hlt = !Slt(function() {
function t() {
}
return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
}), Alt = _3, Olt = Mo, Clt = FU, klt = RS, Ilt = Hlt, XI = klt("IE_PROTO"), kx = Object, Plt = kx.prototype, uG = Ilt ? kx.getPrototypeOf : function(t) {
var e = Clt(t);
if (Alt(e, XI))
return e[XI];
var r = e.constructor;
return Olt(r) && e instanceof r ? r.prototype : e instanceof kx ? Plt : null;
}, Vlt = qo, Rlt = Mo, Nlt = Ds, KI = uG, Dlt = rc, Flt = Ns, Ix = Flt("iterator"), hG = !1, U5, Fb, Bb;
[].keys && (Bb = [].keys(), "next" in Bb ? (Fb = KI(KI(Bb)), Fb !== Object.prototype && (U5 = Fb)) : hG = !0);
var Blt = !Nlt(U5) || Vlt(function() {
var t = {};
return U5[Ix].call(t) !== t;
});
Blt && (U5 = {});
Rlt(U5[Ix]) || Dlt(U5, Ix, function() {
return this;
});
var dG = {
IteratorPrototype: U5,
BUGGY_SAFARI_ITERATORS: hG
}, jlt = b3.f, zlt = _3, Ult = Ns, YI = Ult("toStringTag"), Vg = function(t, e, r) {
t && !r && (t = t.prototype), t && !zlt(t, YI) && jlt(t, YI, { configurable: !0, value: e });
}, Glt = dG.IteratorPrototype, $lt = NS, Wlt = DS, Zlt = Vg, qlt = gd, Xlt = function() {
return this;
}, Klt = function(t, e, r, n) {
var i = e + " Iterator";
return t.prototype = $lt(Glt, { next: Wlt(+!n, r) }), Zlt(t, i, !1), qlt[i] = Xlt, t;
}, Ylt = oo, Jlt = md, pG = function(t, e, r) {
try {
return Ylt(Jlt(Object.getOwnPropertyDescriptor(t, e)[r]));
} catch {
}
}, t7t = Ds, e7t = function(t) {
return t7t(t) || t === null;
}, r7t = e7t, n7t = String, i7t = TypeError, o7t = function(t) {
if (r7t(t))
return t;
throw new i7t("Can't set " + n7t(t) + " as a prototype");
}, s7t = pG, a7t = Ds, l7t = Ag, c7t = o7t, TG = Object.setPrototypeOf || ("__proto__" in {} ? function() {
var t = !1, e = {}, r;
try {
r = s7t(Object.prototype, "__proto__", "set"), r(e, []), t = e instanceof Array;
} catch {
}
return function(n, i) {
return l7t(n), c7t(i), a7t(n) && (t ? r(n, i) : n.__proto__ = i), n;
};
}() : void 0), u7t = L3, h7t = k4, fG = oG, d7t = Mo, p7t = Klt, JI = uG, tP = TG, T7t = Vg, f7t = kg, jb = rc, Q7t = Ns, m7t = gd, QG = dG, g7t = fG.PROPER, y7t = fG.CONFIGURABLE, eP = QG.IteratorPrototype, iT = QG.BUGGY_SAFARI_ITERATORS, hu = Q7t("iterator"), rP = "keys", du = "values", nP = "entries", v7t = function() {
return this;
}, zS = function(t, e, r, n, i, o, s) {
p7t(r, e, n);
var a = function(x) {
if (x === i && Q)
return Q;
if (!iT && x && x in T)
return T[x];
switch (x) {
case rP:
return function() {
return new r(this, x);
};
case du:
return function() {
return new r(this, x);
};
case nP:
return function() {
return new r(this, x);
};
}
return function() {
return new r(this);
};
}, u = e + " Iterator", d = !1, T = t.prototype, f = T[hu] || T["@@iterator"] || i && T[i], Q = !iT && f || a(i), y = e === "Array" && T.entries || f, _, L, E;
if (y && (_ = JI(y.call(new t())), _ !== Object.prototype && _.next && (JI(_) !== eP && (tP ? tP(_, eP) : d7t(_[hu]) || jb(_, hu, v7t)), T7t(_, u, !0))), g7t && i === du && f && f.name !== du && (y7t ? f7t(T, "name", du) : (d = !0, Q = function() {
return h7t(f, this);
})), i)
if (L = {
values: a(du),
keys: o ? Q : a(rP),
entries: a(nP)
}, s)
for (E in L)
(iT || d || !(E in T)) && jb(T, E, L[E]);
else
u7t({ target: e, proto: !0, forced: iT || d }, L);
return T[hu] !== Q && jb(T, hu, Q, { name: i }), m7t[e] = Q, L;
}, US = function(t, e) {
return { value: t, done: e };
}, _7t = ec, GS = a5t, iP = gd, mG = Ig, b7t = b3.f, L7t = zS, oT = US, w7t = da, gG = "Array Iterator", x7t = mG.set, E7t = mG.getterFor(gG), M7t = L7t(Array, "Array", function(t, e) {
x7t(this, {
type: gG,
target: _7t(t),
// target
index: 0,
// next index
kind: e
// kind
});
}, function() {
var t = E7t(this), e = t.target, r = t.index++;
if (!e || r >= e.length)
return t.target = void 0, oT(void 0, !0);
switch (t.kind) {
case "keys":
return oT(r, !1);
case "values":
return oT(e[r], !1);
}
return oT([r, e[r]], !1);
}, "values"), oP = iP.Arguments = iP.Array;
GS("keys");
GS("values");
GS("entries");
if (w7t && oP.name !== "values")
try {
b7t(oP, "name", { value: "values" });
} catch {
}
var S7t = Ns, H7t = S7t("toStringTag"), yG = {};
yG[H7t] = "z";
var $S = String(yG) === "[object z]", A7t = $S, O7t = Mo, gf = Td, C7t = Ns, k7t = C7t("toStringTag"), I7t = Object, P7t = gf(/* @__PURE__ */ function() {
return arguments;
}()) === "Arguments", V7t = function(t, e) {
try {
return t[e];
} catch {
}
}, WS = A7t ? gf : function(t) {
var e, r, n;
return t === void 0 ? "Undefined" : t === null ? "Null" : typeof (r = V7t(e = I7t(t), k7t)) == "string" ? r : P7t ? gf(e) : (n = gf(e)) === "Object" && O7t(e.callee) ? "Arguments" : n;
}, R7t = $S, N7t = WS, D7t = R7t ? {}.toString : function() {
return "[object " + N7t(this) + "]";
}, F7t = $S, B7t = rc, j7t = D7t;
F7t || B7t(Object.prototype, "toString", j7t, { unsafe: !0 });
var vG = { exports: {} }, _G = {}, z7t = oo, U7t = z7t([].slice), G7t = Td, $7t = ec, bG = Pg.f, W7t = U7t, LG = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], Z7t = function(t) {
try {
return bG(t);
} catch {
return W7t(LG);
}
};
_G.f = function(t) {
return LG && G7t(t) === "Window" ? Z7t(t) : bG($7t(t));
};
var q7t = qo, X7t = q7t(function() {
if (typeof ArrayBuffer == "function") {
var t = new ArrayBuffer(8);
Object.isExtensible(t) && Object.defineProperty(t, "a", { value: 8 });
}
}), K7t = qo, Y7t = Ds, J7t = Td, sP = X7t, yf = Object.isExtensible, t8t = K7t(function() {
yf(1);
}), e8t = t8t || sP ? function(t) {
return !Y7t(t) || sP && J7t(t) === "ArrayBuffer" ? !1 : yf ? yf(t) : !0;
} : yf, r8t = qo, n8t = !r8t(function() {
return Object.isExtensible(Object.preventExtensions({}));
}), i8t = L3, o8t = oo, s8t = Cg, a8t = Ds, ZS = _3, l8t = b3.f, aP = Pg, c8t = _G, qS = e8t, u8t = OS, h8t = n8t, wG = !1, H4 = u8t("meta"), d8t = 0, XS = function(t) {
l8t(t, H4, { value: {
objectID: "O" + d8t++,
// object ID
weakData: {}
// weak collections IDs
} });
}, p8t = function(t, e) {
if (!a8t(t))
return typeof t == "symbol" ? t : (typeof t == "string" ? "S" : "P") + t;
if (!ZS(t, H4)) {
if (!qS(t))
return "F";
if (!e)
return "E";
XS(t);
}
return t[H4].objectID;
}, T8t = function(t, e) {
if (!ZS(t, H4)) {
if (!qS(t))
return !0;
if (!e)
return !1;
XS(t);
}
return t[H4].weakData;
}, f8t = function(t) {
return h8t && wG && qS(t) && !ZS(t, H4) && XS(t), t;
}, Q8t = function() {
m8t.enable = function() {
}, wG = !0;
var t = aP.f, e = o8t([].splice), r = {};
r[H4] = 1, t(r).length && (aP.f = function(n) {
for (var i = t(n), o = 0, s = i.length; o < s; o++)
if (i[o] === H4) {
e(i, o, 1);
break;
}
return i;
}, i8t({ target: "Object", stat: !0, forced: !0 }, {
getOwnPropertyNames: c8t.f
}));
}, m8t = vG.exports = {
enable: Q8t,
fastKey: p8t,
getWeakData: T8t,
onFreeze: f8t
};
s8t[H4] = !0;
var xG = vG.exports, g8t = Td, y8t = oo, v8t = function(t) {
if (g8t(t) === "Function")
return y8t(t);
}, lP = v8t, _8t = md, b8t = SS, L8t = lP(lP.bind), EG = function(t, e) {
return _8t(t), e === void 0 ? t : b8t ? L8t(t, e) : function() {
return t.apply(e, arguments);
};
}, w8t = Ns, x8t = gd, E8t = w8t("iterator"), M8t = Array.prototype, S8t = function(t) {
return t !== void 0 && (x8t.Array === t || M8t[E8t] === t);
}, H8t = WS, cP = PS, A8t = fd, O8t = gd, C8t = Ns, k8t = C8t("iterator"), MG = function(t) {
if (!A8t(t))
return cP(t, k8t) || cP(t, "@@iterator") || O8t[H8t(t)];
}, I8t = k4, P8t = md, V8t = p0, R8t = IS, N8t = MG, D8t = TypeError, F8t = function(t, e) {
var r = arguments.length < 2 ? N8t(t) : e;
if (P8t(r))
return V8t(I8t(r, t));
throw new D8t(R8t(t) + " is not iterable");
}, B8t = k4, uP = p0, j8t = PS, KS = function(t, e, r) {
var n, i;
uP(t);
try {
if (n = j8t(t, "return"), !n) {
if (e === "throw")
throw r;
return r;
}
n = B8t(n, t);
} catch (o) {
i = !0, n = o;
}
if (e === "throw")
throw r;
if (i)
throw n;
return uP(n), r;
}, z8t = EG, U8t = k4, G8t = p0, $8t = IS, W8t = S8t, Z8t = qU, hP = kS, q8t = F8t, X8t = MG, dP = KS, K8t = TypeError, vf = function(t, e) {
this.stopped = t, this.result = e;
}, pP = vf.prototype, SG = function(t, e, r) {
var n = r && r.that, i = !!(r && r.AS_ENTRIES), o = !!(r && r.IS_RECORD), s = !!(r && r.IS_ITERATOR), a = !!(r && r.INTERRUPTED), u = z8t(e, n), d, T, f, Q, y, _, L, E = function(O) {
return d && dP(d, "normal", O), new vf(!0, O);
}, x = function(O) {
return i ? (G8t(O), a ? u(O[0], O[1], E) : u(O[0], O[1])) : a ? u(O, E) : u(O);
};
if (o)
d = t.iterator;
else if (s)
d = t;
else {
if (T = X8t(t), !T)
throw new K8t($8t(t) + " is not iterable");
if (W8t(T)) {
for (f = 0, Q = Z8t(t); Q > f; f++)
if (y = x(t[f]), y && hP(pP, y))
return y;
return new vf(!1);
}
d = q8t(t, T);
}
for (_ = o ? t.next : d.next; !(L = U8t(_, d)).done; ) {
try {
y = x(L.value);
} catch (O) {
dP(d, "throw", O);
}
if (typeof y == "object" && y && hP(pP, y))
return y;
}
return new vf(!1);
}, Y8t = kS, J8t = TypeError, HG = function(t, e) {
if (Y8t(e, t))
return t;
throw new J8t("Incorrect invocation");
}, tct = Ns, AG = tct("iterator"), OG = !1;
try {
var ect = 0, TP = {
next: function() {
return { done: !!ect++ };
},
return: function() {
OG = !0;
}
};
TP[AG] = function() {
return this;
}, Array.from(TP, function() {
throw 2;
});
} catch {
}
var rct = function(t, e) {
try {
if (!e && !OG)
return !1;
} catch {
return !1;
}
var r = !1;
try {
var n = {};
n[AG] = function() {
return {
next: function() {
return { done: r = !0 };
}
};
}, t(n);
} catch {
}
return r;
}, nct = Mo, ict = Ds, fP = TG, oct = function(t, e, r) {
var n, i;
return (
// it can work only with native `setPrototypeOf`
fP && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
nct(n = e.constructor) && n !== r && ict(i = n.prototype) && i !== r.prototype && fP(t, i), t
);
}, sct = L3, act = Y2, lct = oo, QP = cG, cct = rc, uct = xG, hct = SG, dct = HG, pct = Mo, Tct = fd, zb = Ds, Ub = qo, fct = rct, Qct = Vg, mct = oct, gct = function(t, e, r) {
var n = t.indexOf("Map") !== -1, i = t.indexOf("Weak") !== -1, o = n ? "set" : "add", s = act[t], a = s && s.prototype, u = s, d = {}, T = function(x) {
var O = lct(a[x]);
cct(
a,
x,
x === "add" ? function(k) {
return O(this, k === 0 ? 0 : k), this;
} : x === "delete" ? function(k) {
return i && !zb(k) ? !1 : O(this, k === 0 ? 0 : k);
} : x === "get" ? function(k) {
return i && !zb(k) ? void 0 : O(this, k === 0 ? 0 : k);
} : x === "has" ? function(k) {
return i && !zb(k) ? !1 : O(this, k === 0 ? 0 : k);
} : function(k, R) {
return O(this, k === 0 ? 0 : k, R), this;
}
);
}, f = QP(
t,
!pct(s) || !(i || a.forEach && !Ub(function() {
new s().entries().next();
}))
);
if (f)
u = r.getConstructor(e, t, n, o), uct.enable();
else if (QP(t, !0)) {
var Q = new u(), y = Q[o](i ? {} : -0, 1) !== Q, _ = Ub(function() {
Q.has(1);
}), L = fct(function(x) {
new s(x);
}), E = !i && Ub(function() {
for (var x = new s(), O = 5; O--; )
x[o](O, O);
return !x.has(-0);
});
L || (u = e(function(x, O) {
dct(x, a);
var k = mct(new s(), x, u);
return Tct(O) || hct(O, k[o], { that: k, AS_ENTRIES: n }), k;
}), u.prototype = a, a.constructor = u), (_ || E) && (T("delete"), T("has"), n && T("get")), (E || y) && T(o), i && a.clear && delete a.clear;
}
return d[t] = u, sct({ global: !0, constructor: !0, forced: u !== s }, d), Qct(u, t), i || r.setStrong(u, t, n), u;
}, mP = aG, yct = b3, CG = function(t, e, r) {
return r.get && mP(r.get, e, { getter: !0 }), r.set && mP(r.set, e, { setter: !0 }), yct.f(t, e, r);
}, vct = rc, _ct = function(t, e, r) {
for (var n in e)
vct(t, n, e[n], r);
return t;
}, bct = Qd, Lct = CG, wct = Ns, xct = da, gP = wct("species"), Ect = function(t) {
var e = bct(t);
xct && e && !e[gP] && Lct(e, gP, {
configurable: !0,
get: function() {
return this;
}
});
}, yP = NS, Mct = CG, vP = _ct, Sct = EG, Hct = HG, Act = fd, Oct = SG, Cct = zS, _P = US, kct = Ect, pu = da, bP = xG.fastKey, kG = Ig, LP = kG.set, Gb = kG.getterFor, Ict = {
getConstructor: function(t, e, r, n) {
var i = t(function(d, T) {
Hct(d, o), LP(d, {
type: e,
index: yP(null),
first: void 0,
last: void 0,
size: 0
}), pu || (d.size = 0), Act(T) || Oct(T, d[n], { that: d, AS_ENTRIES: r });
}), o = i.prototype, s = Gb(e), a = function(d, T, f) {
var Q = s(d), y = u(d, T), _, L;
return y ? y.value = f : (Q.last = y = {
index: L = bP(T, !0),
key: T,
value: f,
previous: _ = Q.last,
next: void 0,
removed: !1
}, Q.first || (Q.first = y), _ && (_.next = y), pu ? Q.size++ : d.size++, L !== "F" && (Q.index[L] = y)), d;
}, u = function(d, T) {
var f = s(d), Q = bP(T), y;
if (Q !== "F")
return f.index[Q];
for (y = f.first; y; y = y.next)
if (y.key === T)
return y;
};
return vP(o, {
// `{ Map, Set }.prototype.clear()` methods
// https://tc39.es/ecma262/#sec-map.prototype.clear
// https://tc39.es/ecma262/#sec-set.prototype.clear
clear: function() {
for (var d = this, T = s(d), f = T.first; f; )
f.removed = !0, f.previous && (f.previous = f.previous.next = void 0), f = f.next;
T.first = T.last = void 0, T.index = yP(null), pu ? T.size = 0 : d.size = 0;
},
// `{ Map, Set }.prototype.delete(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.delete
// https://tc39.es/ecma262/#sec-set.prototype.delete
delete: function(d) {
var T = this, f = s(T), Q = u(T, d);
if (Q) {
var y = Q.next, _ = Q.previous;
delete f.index[Q.index], Q.removed = !0, _ && (_.next = y), y && (y.previous = _), f.first === Q && (f.first = y), f.last === Q && (f.last = _), pu ? f.size-- : T.size--;
}
return !!Q;
},
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
// https://tc39.es/ecma262/#sec-map.prototype.foreach
// https://tc39.es/ecma262/#sec-set.prototype.foreach
forEach: function(d) {
for (var T = s(this), f = Sct(d, arguments.length > 1 ? arguments[1] : void 0), Q; Q = Q ? Q.next : T.first; )
for (f(Q.value, Q.key, this); Q && Q.removed; )
Q = Q.previous;
},
// `{ Map, Set}.prototype.has(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.has
// https://tc39.es/ecma262/#sec-set.prototype.has
has: function(d) {
return !!u(this, d);
}
}), vP(o, r ? {
// `Map.prototype.get(key)` method
// https://tc39.es/ecma262/#sec-map.prototype.get
get: function(d) {
var T = u(this, d);
return T && T.value;
},
// `Map.prototype.set(key, value)` method
// https://tc39.es/ecma262/#sec-map.prototype.set
set: function(d, T) {
return a(this, d === 0 ? 0 : d, T);
}
} : {
// `Set.prototype.add(value)` method
// https://tc39.es/ecma262/#sec-set.prototype.add
add: function(d) {
return a(this, d = d === 0 ? 0 : d, d);
}
}), pu && Mct(o, "size", {
configurable: !0,
get: function() {
return s(this).size;
}
}), i;
},
setStrong: function(t, e, r) {
var n = e + " Iterator", i = Gb(e), o = Gb(n);
Cct(t, e, function(s, a) {
LP(this, {
type: n,
target: s,
state: i(s),
kind: a,
last: void 0
});
}, function() {
for (var s = o(this), a = s.kind, u = s.last; u && u.removed; )
u = u.previous;
return !s.target || !(s.last = u = u ? u.next : s.state.first) ? (s.target = void 0, _P(void 0, !0)) : _P(a === "keys" ? u.key : a === "values" ? u.value : [u.key, u.value], !1);
}, r ? "entries" : "values", !r, !0), kct(e);
}
}, Pct = gct, Vct = Ict;
Pct("Set", function(t) {
return function() {
return t(this, arguments.length ? arguments[0] : void 0);
};
}, Vct);
var $b = oo, sT = Set.prototype, w3 = {
// eslint-disable-next-line es/no-set -- safe
Set,
add: $b(sT.add),
has: $b(sT.has),
remove: $b(sT.delete),
proto: sT
}, Rct = w3.has, sl = function(t) {
return Rct(t), t;
}, Nct = k4, al = function(t, e, r) {
for (var n = r ? t : t.iterator, i = t.next, o, s; !(o = Nct(i, n)).done; )
if (s = e(o.value), s !== void 0)
return s;
}, IG = oo, Dct = al, PG = w3, Fct = PG.Set, VG = PG.proto, Bct = IG(VG.forEach), RG = IG(VG.keys), jct = RG(new Fct()).next, vd = function(t, e, r) {
return r ? Dct({ iterator: RG(t), next: jct }, e) : Bct(t, e);
}, NG = w3, zct = vd, Uct = NG.Set, Gct = NG.add, YS = function(t) {
var e = new Uct();
return zct(t, function(r) {
Gct(e, r);
}), e;
}, $ct = pG, Wct = w3, _d = $ct(Wct.proto, "size", "get") || function(t) {
return t.size;
}, Zct = function(t) {
return {
iterator: t,
next: t.next,
done: !1
};
}, wP = md, DG = p0, xP = k4, qct = Og, Xct = Zct, EP = "Invalid size", Kct = RangeError, Yct = TypeError, Jct = Math.max, FG = function(t, e) {
this.set = t, this.size = Jct(e, 0), this.has = wP(t.has), this.keys = wP(t.keys);
};
FG.prototype = {
getIterator: function() {
return Xct(DG(xP(this.keys, this.set)));
},
includes: function(t) {
return xP(this.has, this.set, t);
}
};
var ll = function(t) {
DG(t);
var e = +t.size;
if (e !== e)
throw new Yct(EP);
var r = qct(e);
if (r < 0)
throw new Kct(EP);
return new FG(t, r);
}, tut = sl, BG = w3, eut = YS, rut = _d, nut = ll, iut = vd, out = al, sut = BG.has, MP = BG.remove, aut = function(t) {
var e = tut(this), r = nut(t), n = eut(e);
return rut(e) <= r.size ? iut(e, function(i) {
r.includes(i) && MP(n, i);
}) : out(r.getIterator(), function(i) {
sut(e, i) && MP(n, i);
}), n;
}, lut = Qd, SP = function(t) {
return {
size: t,
has: function() {
return !1;
},
keys: function() {
return {
next: function() {
return { done: !0 };
}
};
}
};
}, cl = function(t) {
var e = lut("Set");
try {
new e()[t](SP(0));
try {
return new e()[t](SP(-1)), !1;
} catch {
return !0;
}
} catch {
return !1;
}
}, cut = L3, uut = aut, hut = cl;
cut({ target: "Set", proto: !0, real: !0, forced: !hut("difference") }, {
difference: uut
});
var dut = sl, JS = w3, put = _d, Tut = ll, fut = vd, Qut = al, mut = JS.Set, HP = JS.add, gut = JS.has, yut = function(t) {
var e = dut(this), r = Tut(t), n = new mut();
return put(e) > r.size ? Qut(r.getIterator(), function(i) {
gut(e, i) && HP(n, i);
}) : fut(e, function(i) {
r.includes(i) && HP(n, i);
}), n;
}, vut = L3, _ut = qo, but = yut, Lut = cl, wut = !Lut("intersection") || _ut(function() {
return String(Array.from((/* @__PURE__ */ new Set([1, 2, 3])).intersection(/* @__PURE__ */ new Set([3, 2])))) !== "3,2";
});
vut({ target: "Set", proto: !0, real: !0, forced: wut }, {
intersection: but
});
var xut = sl, Eut = w3.has, Mut = _d, Sut = ll, Hut = vd, Aut = al, Out = KS, Cut = function(t) {
var e = xut(this), r = Sut(t);
if (Mut(e) <= r.size)
return Hut(e, function(i) {
if (r.includes(i))
return !1;
}, !0) !== !1;
var n = r.getIterator();
return Aut(n, function(i) {
if (Eut(e, i))
return Out(n, "normal", !1);
}) !== !1;
}, kut = L3, Iut = Cut, Put = cl;
kut({ target: "Set", proto: !0, real: !0, forced: !Put("isDisjointFrom") }, {
isDisjointFrom: Iut
});
var Vut = sl, Rut = _d, Nut = vd, Dut = ll, Fut = function(t) {
var e = Vut(this), r = Dut(t);
return Rut(e) > r.size ? !1 : Nut(e, function(n) {
if (!r.includes(n))
return !1;
}, !0) !== !1;
}, But = L3, jut = Fut, zut = cl;
But({ target: "Set", proto: !0, real: !0, forced: !zut("isSubsetOf") }, {
isSubsetOf: jut
});
var Uut = sl, Gut = w3.has, $ut = _d, Wut = ll, Zut = al, qut = KS, Xut = function(t) {
var e = Uut(this), r = Wut(t);
if ($ut(e) < r.size)
return !1;
var n = r.getIterator();
return Zut(n, function(i) {
if (!Gut(e, i))
return qut(n, "normal", !1);
}) !== !1;
}, Kut = L3, Yut = Xut, Jut = cl;
Kut({ target: "Set", proto: !0, real: !0, forced: !Jut("isSupersetOf") }, {
isSupersetOf: Yut
});
var t9t = sl, tH = w3, e9t = YS, r9t = ll, n9t = al, i9t = tH.add, o9t = tH.has, s9t = tH.remove, a9t = function(t) {
var e = t9t(this), r = r9t(t).getIterator(), n = e9t(e);
return n9t(r, function(i) {
o9t(e, i) ? s9t(n, i) : i9t(n, i);
}), n;
}, l9t = L3, c9t = a9t, u9t = cl;
l9t({ target: "Set", proto: !0, real: !0, forced: !u9t("symmetricDifference") }, {
symmetricDifference: c9t
});
var h9t = sl, d9t = w3.add, p9t = YS, T9t = ll, f9t = al, Q9t = function(t) {
var e = h9t(this), r = T9t(t).getIterator(), n = p9t(e);
return f9t(r, function(i) {
d9t(n, i);
}), n;
}, m9t = L3, g9t = Q9t, y9t = cl;
m9t({ target: "Set", proto: !0, real: !0, forced: !y9t("union") }, {
union: g9t
});
var v9t = WS, _9t = String, jG = function(t) {
if (v9t(t) === "Symbol")
throw new TypeError("Cannot convert a Symbol value to a string");
return _9t(t);
}, eH = oo, b9t = Og, L9t = jG, w9t = Ag, x9t = eH("".charAt), AP = eH("".charCodeAt), E9t = eH("".slice), OP = function(t) {
return function(e, r) {
var n = L9t(w9t(e)), i = b9t(r), o = n.length, s, a;
return i < 0 || i >= o ? t ? "" : void 0 : (s = AP(n, i), s < 55296 || s > 56319 || i + 1 === o || (a = AP(n, i + 1)) < 56320 || a > 57343 ? t ? x9t(n, i) : s : t ? E9t(n, i, i + 2) : (s - 55296 << 10) + (a - 56320) + 65536);
};
}, M9t = {
// `String.prototype.codePointAt` method
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
codeAt: OP(!1),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: OP(!0)
}, S9t = M9t.charAt, H9t = jG, zG = Ig, A9t = zS, CP = US, UG = "String Iterator", O9t = zG.set, C9t = zG.getterFor(UG);
A9t(String, "String", function(t) {
O9t(this, {
type: UG,
string: H9t(t),
index: 0
});
}, function() {
var t = C9t(this), e = t.string, r = t.index, n;
return r >= e.length ? CP(void 0, !0) : (n = S9t(e, r), t.index += n.length, CP(n, !1));
});
var k9t = Y2, I9t = k9t, P9t = I9t, V9t = P9t.Set, R9t = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
}, N9t = CS, Wb = N9t("span").classList, kP = Wb && Wb.constructor && Wb.constructor.prototype, D9t = kP === Object.prototype ? void 0 : kP, IP = Y2, GG = R9t, F9t = D9t, a9 = M7t, PP = kg, B9t = Vg, j9t = Ns, Zb = j9t("iterator"), qb = a9.values, $G = function(t, e) {
if (t) {
if (t[Zb] !== qb)
try {
PP(t, Zb, qb);
} catch {
t[Zb] = qb;
}
if (B9t(t, e, !0), GG[e]) {
for (var r in a9)
if (t[r] !== a9[r])
try {
PP(t, r, a9[r]);
} catch {
t[r] = a9[r];
}
}
}
};
for (var Xb in GG)
$G(IP[Xb] && IP[Xb].prototype, Xb);
$G(F9t, "DOMTokenList");
var z9t = V9t, U9t = z9t, G9t = U9t, $9t = G9t;
const j6 = /* @__PURE__ */ d0($9t);
var WG = { exports: {} };
/**
* MapLibre GL JS
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt
*/
(function(t, e) {
(function(r, n) {
t.exports = n();
})(P, function() {
var r = {}, n = {};
function i(s, a, u) {
if (n[s] = u, s === "index") {
var d = "var sharedModule = {}; (" + n.shared + ")(sharedModule); (" + n.worker + ")(sharedModule);", T = {};
return n.shared(T), n.index(r, T), typeof window < "u" && r.setWorkerUrl(window.URL.createObjectURL(new Blob([d], { type: "text/javascript" }))), r;
}
}
i("shared", ["exports"], function(s) {
function a(h, c, p, g) {
return new (p || (p = Promise))(function(w, H) {
function A(z) {
try {
N(g.next(z));
} catch (W) {
H(W);
}
}
function C(z) {
try {
N(g.throw(z));
} catch (W) {
H(W);
}
}
function N(z) {
var W;
z.done ? w(z.value) : (W = z.value, W instanceof p ? W : new p(function(X) {
X(W);
})).then(A, C);
}
N((g = g.apply(h, c || [])).next());
});
}
function u(h) {
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
}
typeof SuppressedError == "function" && SuppressedError;
var d = T;
function T(h, c) {
this.x = h, this.y = c;
}
T.prototype = { clone: function() {
return new T(this.x, this.y);
}, add: function(h) {
return this.clone()._add(h);
}, sub: function(h) {
return this.clone()._sub(h);
}, multByPoint: function(h) {
return this.clone()._multByPoint(h);
}, divByPoint: function(h) {
return this.clone()._divByPoint(h);
}, mult: function(h) {
return this.clone()._mult(h);
}, div: function(h) {
return this.clone()._div(h);
}, rotate: function(h) {
return this.clone()._rotate(h);
}, rotateAround: function(h, c) {
return this.clone()._rotateAround(h, c);
}, matMult: function(h) {
return this.clone()._matMult(h);
}, 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(h) {
return this.x === h.x && this.y === h.y;
}, dist: function(h) {
return Math.sqrt(this.distSqr(h));
}, distSqr: function(h) {
var c = h.x - this.x, p = h.y - this.y;
return c * c + p * p;
}, angle: function() {
return Math.atan2(this.y, this.x);
}, angleTo: function(h) {
return Math.atan2(this.y - h.y, this.x - h.x);
}, angleWith: function(h) {
return this.angleWithSep(h.x, h.y);
}, angleWithSep: function(h, c) {
return Math.atan2(this.x * c - this.y * h, this.x * h + this.y * c);
}, _matMult: function(h) {
var c = h[2] * this.x + h[3] * this.y;
return this.x = h[0] * this.x + h[1] * this.y, this.y = c, this;
}, _add: function(h) {
return this.x += h.x, this.y += h.y, this;
}, _sub: function(h) {
return this.x -= h.x, this.y -= h.y, this;
}, _mult: function(h) {
return this.x *= h, this.y *= h, this;
}, _div: function(h) {
return this.x /= h, this.y /= h, this;
}, _multByPoint: function(h) {
return this.x *= h.x, this.y *= h.y, this;
}, _divByPoint: function(h) {
return this.x /= h.x, this.y /= h.y, this;
}, _unit: function() {
return this._div(this.mag()), this;
}, _perp: function() {
var h = this.y;
return this.y = this.x, this.x = -h, this;
}, _rotate: function(h) {
var c = Math.cos(h), p = Math.sin(h), g = p * this.x + c * this.y;
return this.x = c * this.x - p * this.y, this.y = g, this;
}, _rotateAround: function(h, c) {
var p = Math.cos(h), g = Math.sin(h), w = c.y + g * (this.x - c.x) + p * (this.y - c.y);
return this.x = c.x + p * (this.x - c.x) - g * (this.y - c.y), this.y = w, this;
}, _round: function() {
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
} }, T.convert = function(h) {
return h instanceof T ? h : Array.isArray(h) ? new T(h[0], h[1]) : h;
};
var f = u(d), Q = y;
function y(h, c, p, g) {
this.cx = 3 * h, this.bx = 3 * (p - h) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * c, this.by = 3 * (g - c) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = h, this.p1y = c, this.p2x = p, this.p2y = g;
}
y.prototype = { sampleCurveX: function(h) {
return ((this.ax * h + this.bx) * h + this.cx) * h;
}, sampleCurveY: function(h) {
return ((this.ay * h + this.by) * h + this.cy) * h;
}, sampleCurveDerivativeX: function(h) {
return (3 * this.ax * h + 2 * this.bx) * h + this.cx;
}, solveCurveX: function(h, c) {
if (c === void 0 && (c = 1e-6), h < 0)
return 0;
if (h > 1)
return 1;
for (var p = h, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h;
if (Math.abs(w) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= w / H;
}
var A = 0, C = 1;
for (p = h, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h) < c)); g++)
h > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var _ = u(Q);
let L, E;
function x() {
return L == null && (L = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") && typeof createImageBitmap == "function"), L;
}
function O() {
if (E == null && (E = !1, x())) {
const h = new OffscreenCanvas(5, 5).getContext("2d", { willReadFrequently: !0 });
if (h) {
for (let p = 0; p < 5 * 5; p++) {
const g = 4 * p;
h.fillStyle = `rgb(${g},${g + 1},${g + 2})`, h.fillRect(p % 5, Math.floor(p / 5), 1, 1);
}
const c = h.getImageData(0, 0, 5, 5).data;
for (let p = 0; p < 5 * 5 * 4; p++)
if (p % 4 != 3 && c[p] !== p) {
E = !0;
break;
}
}
}
return E || !1;
}
function k(h, c, p, g) {
const w = new _(h, c, p, g);
return (H) => w.solve(H);
}
const R = k(0.25, 0.1, 0.25, 1);
function F(h, c, p) {
return Math.min(p, Math.max(c, h));
}
function U(h, c, p) {
const g = p - c, w = ((h - c) % g + g) % g + c;
return w === c ? p : w;
}
function $(h, ...c) {
for (const p of c)
for (const g in p)
h[g] = p[g];
return h;
}
let et = 1;
function nt(h, c, p) {
const g = {};
for (const w in h)
g[w] = c.call(this, h[w], w, h);
return g;
}
function ct(h, c, p) {
const g = {};
for (const w in h)
c.call(this, h[w], w, h) && (g[w] = h[w]);
return g;
}
function rt(h) {
return Array.isArray(h) ? h.map(rt) : typeof h == "object" && h ? nt(h, rt) : h;
}
const gt = {};
function It(h) {
gt[h] || (typeof console < "u" && console.warn(h), gt[h] = !0);
}
function Zt(h, c, p) {
return (p.y - h.y) * (c.x - h.x) > (c.y - h.y) * (p.x - h.x);
}
function oe(h) {
return typeof WorkerGlobalScope < "u" && h !== void 0 && h instanceof WorkerGlobalScope;
}
let re = null;
function Ve(h) {
return typeof ImageBitmap < "u" && h instanceof ImageBitmap;
}
const yr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
function qr(h, c, p, g, w) {
return a(this, void 0, void 0, function* () {
if (typeof VideoFrame > "u")
throw new Error("VideoFrame not supported");
const H = new VideoFrame(h, { timestamp: 0 });
try {
const A = H == null ? void 0 : H.format;
if (!A || !A.startsWith("BGR") && !A.startsWith("RGB"))
throw new Error(`Unrecognized format ${A}`);
const C = A.startsWith("BGR"), N = new Uint8ClampedArray(g * w * 4);
if (yield H.copyTo(N, function(z, W, X, tt, at) {
const ut = 4 * Math.max(-W, 0), Tt = (Math.max(0, X) - X) * tt * 4 + ut, Lt = 4 * tt, Et = Math.max(0, W), $t = Math.max(0, X);
return { rect: { x: Et, y: $t, width: Math.min(z.width, W + tt) - Et, height: Math.min(z.height, X + at) - $t }, layout: [{ offset: Tt, stride: Lt }] };
}(h, c, p, g, w)), C)
for (let z = 0; z < N.length; z += 4) {
const W = N[z];
N[z] = N[z + 2], N[z + 2] = W;
}
return N;
} finally {
H.close();
}
});
}
let ie, Qe;
const Ke = "AbortError";
function He() {
return new Error(Ke);
}
const er = { MAX_PARALLEL_IMAGE_REQUESTS: 16, MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: 8, MAX_TILE_CACHE_ZOOM_LEVELS: 5, REGISTERED_PROTOCOLS: {}, WORKER_URL: "" };
function Je(h) {
return er.REGISTERED_PROTOCOLS[h.substring(0, h.indexOf("://"))];
}
const Ne = "global-dispatcher";
class Gt extends Error {
constructor(c, p, g, w) {
super(`AJAXError: ${p} (${c}): ${g}`), this.status = c, this.statusText = p, this.url = g, this.body = w;
}
}
const te = () => oe(self) ? self.worker && self.worker.referrer : (window.location.protocol === "blob:" ? window.parent : window).location.href, me = function(h, c) {
if (/:\/\//.test(h.url) && !/^https?:|^file:/.test(h.url)) {
const g = Je(h.url);
if (g)
return g(h, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h, targetMapId: Ne }, c);
}
if (!(/^file:/.test(p = h.url) || /^file:/.test(te()) && !/^\w+:/.test(p))) {
if (fetch && Request && AbortController && Object.prototype.hasOwnProperty.call(Request.prototype, "signal"))
return function(g, w) {
return a(this, void 0, void 0, function* () {
const H = new Request(g.url, { method: g.method || "GET", body: g.body, credentials: g.credentials, headers: g.headers, cache: g.cache, referrer: te(), signal: w.signal });
g.type !== "json" || H.headers.has("Accept") || H.headers.set("Accept", "application/json");
const A = yield fetch(H);
if (!A.ok) {
const z = yield A.blob();
throw new Gt(A.status, A.statusText, g.url, z);
}
let C;
C = g.type === "arrayBuffer" || g.type === "image" ? A.arrayBuffer() : g.type === "json" ? A.json() : A.text();
const N = yield C;
if (w.signal.aborted)
throw He();
return { data: N, cacheControl: A.headers.get("Cache-Control"), expires: A.headers.get("Expires") };
});
}(h, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h, mustQueue: !0, targetMapId: Ne }, c);
}
var p;
return function(g, w) {
return new Promise((H, A) => {
var C;
const N = new XMLHttpRequest();
N.open(g.method || "GET", g.url, !0), g.type !== "arrayBuffer" && g.type !== "image" || (N.responseType = "arraybuffer");
for (const z in g.headers)
N.setRequestHeader(z, g.headers[z]);
g.type === "json" && (N.responseType = "text", !((C = g.headers) === null || C === void 0) && C.Accept || N.setRequestHeader("Accept", "application/json")), N.withCredentials = g.credentials === "include", N.onerror = () => {
A(new Error(N.statusText));
}, N.onload = () => {
if (!w.signal.aborted)
if ((N.status >= 200 && N.status < 300 || N.status === 0) && N.response !== null) {
let z = N.response;
if (g.type === "json")
try {
z = JSON.parse(N.response);
} catch (W) {
return void A(W);
}
H({ data: z, cacheControl: N.getResponseHeader("Cache-Control"), expires: N.getResponseHeader("Expires") });
} else {
const z = new Blob([N.response], { type: N.getResponseHeader("Content-Type") });
A(new Gt(N.status, N.statusText, g.url, z));
}
}, w.signal.addEventListener("abort", () => {
N.abort(), A(He());
}), N.send(g.body);
});
}(h, c);
};
function de(h) {
if (!h || h.indexOf("://") <= 0 || h.indexOf("data:image/") === 0 || h.indexOf("blob:") === 0)
return !0;
const c = new URL(h), p = window.location;
return c.protocol === p.protocol && c.host === p.host;
}
function Ge(h, c, p) {
p[h] && p[h].indexOf(c) !== -1 || (p[h] = p[h] || [], p[h].push(c));
}
function Tr(h, c, p) {
if (p && p[h]) {
const g = p[h].indexOf(c);
g !== -1 && p[h].splice(g, 1);
}
}
class qe {
constructor(c, p = {}) {
$(this, p), this.type = c;
}
}
class $e extends qe {
constructor(c, p = {}) {
super("error", $({ error: c }, p));
}
}
class ar {
on(c, p) {
return this._listeners = this._listeners || {}, Ge(c, p, this._listeners), this;
}
off(c, p) {
return Tr(c, p, this._listeners), Tr(c, p, this._oneTimeListeners), this;
}
once(c, p) {
return p ? (this._oneTimeListeners = this._oneTimeListeners || {}, Ge(c, p, this._oneTimeListeners), this) : new Promise((g) => this.once(c, g));
}
fire(c, p) {
typeof c == "string" && (c = new qe(c, p || {}));
const g = c.type;
if (this.listens(g)) {
c.target = this;
const w = this._listeners && this._listeners[g] ? this._listeners[g].slice() : [];
for (const C of w)
C.call(this, c);
const H = this._oneTimeListeners && this._oneTimeListeners[g] ? this._oneTimeListeners[g].slice() : [];
for (const C of H)
Tr(g, C, this._oneTimeListeners), C.call(this, c);
const A = this._eventedParent;
A && ($(c, typeof this._eventedParentData == "function" ? this._eventedParentData() : this._eventedParentData), A.fire(c));
} else
c instanceof $e && console.error(c.error);
return this;
}
listens(c) {
return this._listeners && this._listeners[c] && this._listeners[c].length > 0 || this._oneTimeListeners && this._oneTimeListeners[c] && this._oneTimeListeners[c].length > 0 || this._eventedParent && this._eventedParent.listens(c);
}
setEventedParent(c, p) {
return this._eventedParent = c, this._eventedParentData = p, this;
}
}
var Ct = { $version: 8, $root: { version: { required: !0, 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" }, sky: { type: "sky" }, projection: { type: "projection" }, terrain: { type: "terrain" }, sources: { required: !0, type: "sources" }, sprite: { type: "sprite" }, glyphs: { type: "string" }, transition: { type: "transition" }, layers: { required: !0, 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: !0, 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: !1 }, "*": { type: "*" } }, source_raster: { type: { required: !0, 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: !1 }, "*": { type: "*" } }, source_raster_dem: { type: { required: !0, 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: !1 }, "*": { type: "*" } }, source_geojson: { type: { required: !0, type: "enum", values: { geojson: {} } }, data: { required: !0, 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: !1 }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterMinPoints: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: !1 }, generateId: { type: "boolean", default: !1 }, promoteId: { type: "promoteId" } }, source_video: { type: { required: !0, type: "enum", values: { video: {} } }, urls: { required: !0, type: "array", value: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: !0, type: "enum", values: { image: {} } }, url: { required: !0, type: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: !0 }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, background: {} }, required: !0 }, 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: !1, 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: !1, 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: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-sort-key": { type: "number", expression: { interpolated: !1, 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: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: !1, requires: ["icon-image", { "!": "icon-overlap" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: !1, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: !1, requires: ["icon-image", "text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, 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: !0, 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: !1, 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: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "padding", default: [2], units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-keep-upright": { type: "boolean", default: !1, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: !0, 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: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, "viewport-glyph": {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: !0, expression: { interpolated: !1, 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: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: !1, 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: !0, 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: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-variable-anchor-offset": { type: "variableAnchorOffsetCollection", requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !0, 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: !1, 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: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: !0, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: !1, 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: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: !1, requires: ["text-field", { "!": "text-overlap" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: !1, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: !1, requires: ["text-field", "icon-image"], expression: { interpolated: !1, 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": {} } }, 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: !1 } }, 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: !1, expression: { interpolated: !1, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, intensity: { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 } }, sky: { "sky-color": { type: "color", "property-type": "data-constant", default: "#88C6FC", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "horizon-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "fog-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "fog-ground-blend": { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "horizon-fog-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "sky-horizon-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "atmosphere-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 } }, terrain: { source: { type: "string", required: !0 }, exaggeration: { type: "number", minimum: 0, default: 1 } }, projection: { type: { type: "enum", default: "mercator", values: { mercator: {}, globe: {} } } }, 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: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: !0, requires: [{ "!": "fill-pattern" }, { "fill-antialias": !0 }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, requires: ["fill-extrusion-height"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: !0, transition: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "line-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: !0, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "line-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: !1, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: !0 } }], expression: { interpolated: !0, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: !1, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: !0, expression: { interpolated: !0, 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: !1, expression: { interpolated: !0, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: !0, overridable: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: !0, units: "degrees", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: !1, units: "milliseconds", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "number", default: 335, minimum: 0, maximum: 359, transition: !1, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: 0.5, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "color", default: "#FFFFFF", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "background-pattern" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, 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 en = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
function Jr(h, c) {
const p = {};
for (const g in h)
g !== "ref" && (p[g] = h[g]);
return en.forEach((g) => {
g in c && (p[g] = c[g]);
}), p;
}
function Hr(h, c) {
if (Array.isArray(h)) {
if (!Array.isArray(c) || h.length !== c.length)
return !1;
for (let p = 0; p < h.length; p++)
if (!Hr(h[p], c[p]))
return !1;
return !0;
}
if (typeof h == "object" && h !== null && c !== null) {
if (typeof c != "object" || Object.keys(h).length !== Object.keys(c).length)
return !1;
for (const p in h)
if (!Hr(h[p], c[p]))
return !1;
return !0;
}
return h === c;
}
function Rr(h, c) {
h.push(c);
}
function dn(h, c, p) {
Rr(p, { command: "addSource", args: [h, c[h]] });
}
function ji(h, c, p) {
Rr(c, { command: "removeSource", args: [h] }), p[h] = !0;
}
function Ji(h, c, p, g) {
ji(h, p, g), dn(h, c, p);
}
function ki(h, c, p) {
let g;
for (g in h[p])
if (Object.prototype.hasOwnProperty.call(h[p], g) && g !== "data" && !Hr(h[p][g], c[p][g]))
return !1;
for (g in c[p])
if (Object.prototype.hasOwnProperty.call(c[p], g) && g !== "data" && !Hr(h[p][g], c[p][g]))
return !1;
return !0;
}
function _i(h, c, p, g, w, H) {
h = h || {}, c = c || {};
for (const A in h)
Object.prototype.hasOwnProperty.call(h, A) && (Hr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], w] }));
for (const A in c)
Object.prototype.hasOwnProperty.call(c, A) && !Object.prototype.hasOwnProperty.call(h, A) && (Hr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], w] }));
}
function Ii(h) {
return h.id;
}
function c1(h, c) {
return h[c.id] = c, h;
}
class ye {
constructor(c, p, g, w) {
this.message = (c ? `${c}: ` : "") + g, w && (this.identifier = w), p != null && p.__line__ && (this.line = p.__line__);
}
}
function bi(h, ...c) {
for (const p of c)
for (const g in p)
h[g] = p[g];
return h;
}
class Xn extends Error {
constructor(c, p) {
super(p), this.message = p, this.key = c;
}
}
class Hi {
constructor(c, p = []) {
this.parent = c, this.bindings = {};
for (const [g, w] of p)
this.bindings[g] = w;
}
concat(c) {
return new Hi(this, c);
}
get(c) {
if (this.bindings[c])
return this.bindings[c];
if (this.parent)
return this.parent.get(c);
throw new Error(`${c} not found in scope.`);
}
has(c) {
return !!this.bindings[c] || !!this.parent && this.parent.has(c);
}
}
const t1 = { kind: "null" }, xe = { kind: "number" }, Dr = { kind: "string" }, _r = { kind: "boolean" }, Vn = { kind: "color" }, y1 = { kind: "object" }, wr = { kind: "value" }, Pi = { kind: "collator" }, H1 = { kind: "formatted" }, Vi = { kind: "padding" }, Rn = { kind: "resolvedImage" }, xt = { kind: "variableAnchorOffsetCollection" };
function ot(h, c) {
return { kind: "array", itemType: h, N: c };
}
function st(h) {
if (h.kind === "array") {
const c = st(h.itemType);
return typeof h.N == "number" ? `array<${c}, ${h.N}>` : h.itemType.kind === "value" ? "array" : `array<${c}>`;
}
return h.kind;
}
const pt = [t1, xe, Dr, _r, Vn, H1, y1, ot(wr), Vi, Rn, xt];
function yt(h, c) {
if (c.kind === "error")
return null;
if (h.kind === "array") {
if (c.kind === "array" && (c.N === 0 && c.itemType.kind === "value" || !yt(h.itemType, c.itemType)) && (typeof h.N != "number" || h.N === c.N))
return null;
} else {
if (h.kind === c.kind)
return null;
if (h.kind === "value") {
for (const p of pt)
if (!yt(p, c))
return null;
}
}
return `Expected ${st(h)} but found ${st(c)} instead.`;
}
function At(h, c) {
return c.some((p) => p.kind === h.kind);
}
function Vt(h, c) {
return c.some((p) => p === "null" ? h === null : p === "array" ? Array.isArray(h) : p === "object" ? h && !Array.isArray(h) && typeof h == "object" : p === typeof h);
}
function jt(h, c) {
return h.kind === "array" && c.kind === "array" ? h.itemType.kind === c.itemType.kind && typeof h.N == "number" : h.kind === c.kind;
}
const St = 0.96422, Yt = 0.82521, ae = 4 / 29, Xt = 6 / 29, Le = 3 * Xt * Xt, or = Xt * Xt * Xt, Rt = Math.PI / 180, Te = 180 / Math.PI;
function Se(h) {
return (h %= 360) < 0 && (h += 360), h;
}
function lr([h, c, p, g]) {
let w, H;
const A = vn((0.2225045 * (h = Ar(h)) + 0.7168786 * (c = Ar(c)) + 0.0606169 * (p = Ar(p))) / 1);
h === c && c === p ? w = H = A : (w = vn((0.4360747 * h + 0.3850649 * c + 0.1430804 * p) / St), H = vn((0.0139322 * h + 0.0971045 * c + 0.7141733 * p) / Yt));
const C = 116 * A - 16;
return [C < 0 ? 0 : C, 500 * (w - A), 200 * (A - H), g];
}
function Ar(h) {
return h <= 0.04045 ? h / 12.92 : Math.pow((h + 0.055) / 1.055, 2.4);
}
function vn(h) {
return h > or ? Math.pow(h, 1 / 3) : h / Le + ae;
}
function zr([h, c, p, g]) {
let w = (h + 16) / 116, H = isNaN(c) ? w : w + c / 500, A = isNaN(p) ? w : w - p / 200;
return w = 1 * Br(w), H = St * Br(H), A = Yt * Br(A), [br(3.1338561 * H - 1.6168667 * w - 0.4906146 * A), br(-0.9787684 * H + 1.9161415 * w + 0.033454 * A), br(0.0719453 * H - 0.2289914 * w + 1.4052427 * A), g];
}
function br(h) {
return (h = h <= 304e-5 ? 12.92 * h : 1.055 * Math.pow(h, 1 / 2.4) - 0.055) < 0 ? 0 : h > 1 ? 1 : h;
}
function Br(h) {
return h > Xt ? h * h * h : Le * (h - ae);
}
function cn(h) {
return parseInt(h.padEnd(2, h), 16) / 255;
}
function Kn(h, c) {
return Li(c ? h / 100 : h, 0, 1);
}
function Li(h, c, p) {
return Math.min(Math.max(c, h), p);
}
function Ri(h) {
return !h.some(Number.isNaN);
}
const es = { 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 tn {
constructor(c, p, g, w = 1, H = !0) {
this.r = c, this.g = p, this.b = g, this.a = w, H || (this.r *= w, this.g *= w, this.b *= w, w || this.overwriteGetter("rgb", [c, p, g, w]));
}
static parse(c) {
if (c instanceof tn)
return c;
if (typeof c != "string")
return;
const p = function(g) {
if ((g = g.toLowerCase().trim()) === "transparent")
return [0, 0, 0, 0];
const w = es[g];
if (w) {
const [A, C, N] = w;
return [A / 255, C / 255, N / 255, 1];
}
if (g.startsWith("#") && /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(g)) {
const A = g.length < 6 ? 1 : 2;
let C = 1;
return [cn(g.slice(C, C += A)), cn(g.slice(C, C += A)), cn(g.slice(C, C += A)), cn(g.slice(C, C + A) || "ff")];
}
if (g.startsWith("rgb")) {
const A = g.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
if (A) {
const [C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t] = A, Pt = [W || " ", at || " ", Lt].join("");
if (Pt === " " || Pt === " /" || Pt === ",," || Pt === ",,,") {
const Bt = [z, tt, Tt].join(""), ee = Bt === "%%%" ? 100 : Bt === "" ? 255 : 0;
if (ee) {
const _e = [Li(+N / ee, 0, 1), Li(+X / ee, 0, 1), Li(+ut / ee, 0, 1), Et ? Kn(+Et, $t) : 1];
if (Ri(_e))
return _e;
}
}
return;
}
}
const H = g.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
if (H) {
const [A, C, N, z, W, X, tt, at, ut] = H, Tt = [N || " ", W || " ", tt].join("");
if (Tt === " " || Tt === " /" || Tt === ",," || Tt === ",,,") {
const Lt = [+C, Li(+z, 0, 100), Li(+X, 0, 100), at ? Kn(+at, ut) : 1];
if (Ri(Lt))
return function([Et, $t, Pt, Bt]) {
function ee(_e) {
const Xe = (_e + Et / 30) % 12, Er = $t * Math.min(Pt, 1 - Pt);
return Pt - Er * Math.max(-1, Math.min(Xe - 3, 9 - Xe, 1));
}
return Et = Se(Et), $t /= 100, Pt /= 100, [ee(0), ee(8), ee(4), Bt];
}(Lt);
}
}
}(c);
return p ? new tn(...p, !1) : void 0;
}
get rgb() {
const { r: c, g: p, b: g, a: w } = this, H = w || 1 / 0;
return this.overwriteGetter("rgb", [c / H, p / H, g / H, w]);
}
get hcl() {
return this.overwriteGetter("hcl", function(c) {
const [p, g, w, H] = lr(c), A = Math.sqrt(g * g + w * w);
return [Math.round(1e4 * A) ? Se(Math.atan2(w, g) * Te) : NaN, A, p, H];
}(this.rgb));
}
get lab() {
return this.overwriteGetter("lab", lr(this.rgb));
}
overwriteGetter(c, p) {
return Object.defineProperty(this, c, { value: p }), p;
}
toString() {
const [c, p, g, w] = this.rgb;
return `rgba(${[c, p, g].map((H) => Math.round(255 * H)).join(",")},${w})`;
}
}
tn.black = new tn(0, 0, 0, 1), tn.white = new tn(1, 1, 1, 1), tn.transparent = new tn(0, 0, 0, 0), tn.red = new tn(1, 0, 0, 1);
class zi {
constructor(c, p, g) {
this.sensitivity = c ? p ? "variant" : "case" : p ? "accent" : "base", this.locale = g, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" });
}
compare(c, p) {
return this.collator.compare(c, p);
}
resolvedLocale() {
return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;
}
}
class co {
constructor(c, p, g, w, H) {
this.text = c, this.image = p, this.scale = g, this.fontStack = w, this.textColor = H;
}
}
class Xr {
constructor(c) {
this.sections = c;
}
static fromString(c) {
return new Xr([new co(c, null, null, null, null)]);
}
isEmpty() {
return this.sections.length === 0 || !this.sections.some((c) => c.text.length !== 0 || c.image && c.image.name.length !== 0);
}
static factory(c) {
return c instanceof Xr ? c : Xr.fromString(c);
}
toString() {
return this.sections.length === 0 ? "" : this.sections.map((c) => c.text).join("");
}
}
class Yn {
constructor(c) {
this.values = c.slice();
}
static parse(c) {
if (c instanceof Yn)
return c;
if (typeof c == "number")
return new Yn([c, c, c, c]);
if (Array.isArray(c) && !(c.length < 1 || c.length > 4)) {
for (const p of c)
if (typeof p != "number")
return;
switch (c.length) {
case 1:
c = [c[0], c[0], c[0], c[0]];
break;
case 2:
c = [c[0], c[1], c[0], c[1]];
break;
case 3:
c = [c[0], c[1], c[2], c[1]];
}
return new Yn(c);
}
}
toString() {
return JSON.stringify(this.values);
}
}
const rs = /* @__PURE__ */ new Set(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]);
class _n {
constructor(c) {
this.values = c.slice();
}
static parse(c) {
if (c instanceof _n)
return c;
if (Array.isArray(c) && !(c.length < 1) && c.length % 2 == 0) {
for (let p = 0; p < c.length; p += 2) {
const g = c[p], w = c[p + 1];
if (typeof g != "string" || !rs.has(g) || !Array.isArray(w) || w.length !== 2 || typeof w[0] != "number" || typeof w[1] != "number")
return;
}
return new _n(c);
}
}
toString() {
return JSON.stringify(this.values);
}
}
class pn {
constructor(c) {
this.name = c.name, this.available = c.available;
}
toString() {
return this.name;
}
static fromString(c) {
return c ? new pn({ name: c, available: !1 }) : null;
}
}
function uo(h, c, p, g) {
return typeof h == "number" && h >= 0 && h <= 255 && typeof c == "number" && c >= 0 && c <= 255 && typeof p == "number" && p >= 0 && p <= 255 ? g === void 0 || typeof g == "number" && g >= 0 && g <= 1 ? null : `Invalid rgba value [${[h, c, p, g].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${(typeof g == "number" ? [h, c, p, g] : [h, c, p]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`;
}
function u1(h) {
if (h === null || typeof h == "string" || typeof h == "boolean" || typeof h == "number" || h instanceof tn || h instanceof zi || h instanceof Xr || h instanceof Yn || h instanceof _n || h instanceof pn)
return !0;
if (Array.isArray(h)) {
for (const c of h)
if (!u1(c))
return !1;
return !0;
}
if (typeof h == "object") {
for (const c in h)
if (!u1(h[c]))
return !1;
return !0;
}
return !1;
}
function Qn(h) {
if (h === null)
return t1;
if (typeof h == "string")
return Dr;
if (typeof h == "boolean")
return _r;
if (typeof h == "number")
return xe;
if (h instanceof tn)
return Vn;
if (h instanceof zi)
return Pi;
if (h instanceof Xr)
return H1;
if (h instanceof Yn)
return Vi;
if (h instanceof _n)
return xt;
if (h instanceof pn)
return Rn;
if (Array.isArray(h)) {
const c = h.length;
let p;
for (const g of h) {
const w = Qn(g);
if (p) {
if (p === w)
continue;
p = wr;
break;
}
p = w;
}
return ot(p || wr, c);
}
return y1;
}
function Ui(h) {
const c = typeof h;
return h === null ? "" : c === "string" || c === "number" || c === "boolean" ? String(h) : h instanceof tn || h instanceof Xr || h instanceof Yn || h instanceof _n || h instanceof pn ? h.toString() : JSON.stringify(h);
}
class h1 {
constructor(c, p) {
this.type = c, this.value = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'literal' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (!u1(c[1]))
return p.error("invalid value");
const g = c[1];
let w = Qn(g);
const H = p.expectedType;
return w.kind !== "array" || w.N !== 0 || !H || H.kind !== "array" || typeof H.N == "number" && H.N !== 0 || (w = H), new h1(w, g);
}
evaluate() {
return this.value;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
class jn {
constructor(c) {
this.name = "ExpressionEvaluationError", this.message = c;
}
toJSON() {
return this.message;
}
}
const ns = { string: Dr, number: xe, boolean: _r, object: y1 };
class d1 {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
let g, w = 1;
const H = c[0];
if (H === "array") {
let C, N;
if (c.length > 2) {
const z = c[1];
if (typeof z != "string" || !(z in ns) || z === "object")
return p.error('The item type argument of "array" must be one of string, number, boolean', 1);
C = ns[z], w++;
} else
C = wr;
if (c.length > 3) {
if (c[2] !== null && (typeof c[2] != "number" || c[2] < 0 || c[2] !== Math.floor(c[2])))
return p.error('The length argument to "array" must be a positive integer literal', 2);
N = c[2], w++;
}
g = ot(C, N);
} else {
if (!ns[H])
throw new Error(`Types doesn't contain name = ${H}`);
g = ns[H];
}
const A = [];
for (; w < c.length; w++) {
const C = p.parse(c[w], w, wr);
if (!C)
return null;
A.push(C);
}
return new d1(g, A);
}
evaluate(c) {
for (let p = 0; p < this.args.length; p++) {
const g = this.args[p].evaluate(c);
if (!yt(this.type, Qn(g)))
return g;
if (p === this.args.length - 1)
throw new jn(`Expected value to be of type ${st(this.type)}, but found ${st(Qn(g))} instead.`);
}
throw new Error();
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
const b2 = { "to-boolean": _r, "to-color": Vn, "to-number": xe, "to-string": Dr };
class e1 {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
const g = c[0];
if (!b2[g])
throw new Error(`Can't parse ${g} as it is not part of the known types`);
if ((g === "to-boolean" || g === "to-string") && c.length !== 2)
return p.error("Expected one argument.");
const w = b2[g], H = [];
for (let A = 1; A < c.length; A++) {
const C = p.parse(c[A], A, wr);
if (!C)
return null;
H.push(C);
}
return new e1(w, H);
}
evaluate(c) {
switch (this.type.kind) {
case "boolean":
return !!this.args[0].evaluate(c);
case "color": {
let p, g;
for (const w of this.args) {
if (p = w.evaluate(c), g = null, p instanceof tn)
return p;
if (typeof p == "string") {
const H = c.parseColor(p);
if (H)
return H;
} else if (Array.isArray(p) && (g = p.length < 3 || p.length > 4 ? `Invalid rbga value ${JSON.stringify(p)}: expected an array containing either three or four numeric values.` : uo(p[0], p[1], p[2], p[3]), !g))
return new tn(p[0] / 255, p[1] / 255, p[2] / 255, p[3]);
}
throw new jn(g || `Could not parse color from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "padding": {
let p;
for (const g of this.args) {
p = g.evaluate(c);
const w = Yn.parse(p);
if (w)
return w;
}
throw new jn(`Could not parse padding from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "variableAnchorOffsetCollection": {
let p;
for (const g of this.args) {
p = g.evaluate(c);
const w = _n.parse(p);
if (w)
return w;
}
throw new jn(`Could not parse variableAnchorOffsetCollection from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "number": {
let p = null;
for (const g of this.args) {
if (p = g.evaluate(c), p === null)
return 0;
const w = Number(p);
if (!isNaN(w))
return w;
}
throw new jn(`Could not convert ${JSON.stringify(p)} to number.`);
}
case "formatted":
return Xr.fromString(Ui(this.args[0].evaluate(c)));
case "resolvedImage":
return pn.fromString(Ui(this.args[0].evaluate(c)));
default:
return Ui(this.args[0].evaluate(c));
}
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
const Ho = ["Unknown", "Point", "LineString", "Polygon"];
class ma {
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 ? typeof this.feature.type == "number" ? Ho[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(c) {
let p = this._parseColorCache[c];
return p || (p = this._parseColorCache[c] = tn.parse(c)), p;
}
}
class Xo {
constructor(c, p, g = [], w, H = new Hi(), A = []) {
this.registry = c, this.path = g, this.key = g.map((C) => `[${C}]`).join(""), this.scope = H, this.errors = A, this.expectedType = w, this._isConstant = p;
}
parse(c, p, g, w, H = {}) {
return p ? this.concat(p, g, w)._parse(c, H) : this._parse(c, H);
}
_parse(c, p) {
function g(w, H, A) {
return A === "assert" ? new d1(H, [w]) : A === "coerce" ? new e1(H, [w]) : w;
}
if (c !== null && typeof c != "string" && typeof c != "boolean" && typeof c != "number" || (c = ["literal", c]), Array.isArray(c)) {
if (c.length === 0)
return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
const w = c[0];
if (typeof w != "string")
return this.error(`Expression name must be a string, but found ${typeof w} instead. If you wanted a literal array, use ["literal", [...]].`, 0), null;
const H = this.registry[w];
if (H) {
let A = H.parse(c, this);
if (!A)
return null;
if (this.expectedType) {
const C = this.expectedType, N = A.type;
if (C.kind !== "string" && C.kind !== "number" && C.kind !== "boolean" && C.kind !== "object" && C.kind !== "array" || N.kind !== "value")
if (C.kind !== "color" && C.kind !== "formatted" && C.kind !== "resolvedImage" || N.kind !== "value" && N.kind !== "string")
if (C.kind !== "padding" || N.kind !== "value" && N.kind !== "number" && N.kind !== "array")
if (C.kind !== "variableAnchorOffsetCollection" || N.kind !== "value" && N.kind !== "array") {
if (this.checkSubtype(C, N))
return null;
} else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "assert");
}
if (!(A instanceof h1) && A.type.kind !== "resolvedImage" && this._isConstant(A)) {
const C = new ma();
try {
A = new h1(A.type, A.evaluate(C));
} catch (N) {
return this.error(N.message), null;
}
}
return A;
}
return this.error(`Unknown expression "${w}". If you wanted a literal array, use ["literal", [...]].`, 0);
}
return this.error(c === void 0 ? "'undefined' value invalid. Use null instead." : typeof c == "object" ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof c} instead.`);
}
concat(c, p, g) {
const w = typeof c == "number" ? this.path.concat(c) : this.path, H = g ? this.scope.concat(g) : this.scope;
return new Xo(this.registry, this._isConstant, w, p || null, H, this.errors);
}
error(c, ...p) {
const g = `${this.key}${p.map((w) => `[${w}]`).join("")}`;
this.errors.push(new Xn(g, c));
}
checkSubtype(c, p) {
const g = yt(c, p);
return g && this.error(g), g;
}
}
class ho {
constructor(c, p) {
this.type = p.type, this.bindings = [].concat(c), this.result = p;
}
evaluate(c) {
return this.result.evaluate(c);
}
eachChild(c) {
for (const p of this.bindings)
c(p[1]);
c(this.result);
}
static parse(c, p) {
if (c.length < 4)
return p.error(`Expected at least 3 arguments, but found ${c.length - 1} instead.`);
const g = [];
for (let H = 1; H < c.length - 1; H += 2) {
const A = c[H];
if (typeof A != "string")
return p.error(`Expected string, but found ${typeof A} instead.`, H);
if (/[^a-zA-Z0-9_]/.test(A))
return p.error("Variable names must contain only alphanumeric characters or '_'.", H);
const C = p.parse(c[H + 1], H + 1);
if (!C)
return null;
g.push([A, C]);
}
const w = p.parse(c[c.length - 1], c.length - 1, p.expectedType, g);
return w ? new ho(g, w) : null;
}
outputDefined() {
return this.result.outputDefined();
}
}
class Yr {
constructor(c, p) {
this.type = p.type, this.name = c, this.boundExpression = p;
}
static parse(c, p) {
if (c.length !== 2 || typeof c[1] != "string")
return p.error("'var' expression requires exactly one string literal argument.");
const g = c[1];
return p.scope.has(g) ? new Yr(g, p.scope.get(g)) : p.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`, 1);
}
evaluate(c) {
return this.boundExpression.evaluate(c);
}
eachChild() {
}
outputDefined() {
return !1;
}
}
class I {
constructor(c, p, g) {
this.type = c, this.index = p, this.input = g;
}
static parse(c, p) {
if (c.length !== 3)
return p.error(`Expected 2 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, xe), w = p.parse(c[2], 2, ot(p.expectedType || wr));
return g && w ? new I(w.type.itemType, g, w) : null;
}
evaluate(c) {
const p = this.index.evaluate(c), g = this.input.evaluate(c);
if (p < 0)
throw new jn(`Array index out of bounds: ${p} < 0.`);
if (p >= g.length)
throw new jn(`Array index out of bounds: ${p} > ${g.length - 1}.`);
if (p !== Math.floor(p))
throw new jn(`Array index must be an integer, but found ${p} instead.`);
return g[p];
}
eachChild(c) {
c(this.index), c(this.input);
}
outputDefined() {
return !1;
}
}
class G {
constructor(c, p) {
this.type = _r, this.needle = c, this.haystack = p;
}
static parse(c, p) {
if (c.length !== 3)
return p.error(`Expected 2 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, wr);
return g && w ? At(g.type, [_r, Dr, xe, t1, wr]) ? new G(g, w) : p.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(g.type)} instead`) : null;
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!g)
return !1;
if (!Vt(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${st(Qn(p))} instead.`);
if (!Vt(g, ["string", "array"]))
throw new jn(`Expected second argument to be of type array or string, but found ${st(Qn(g))} instead.`);
return g.indexOf(p) >= 0;
}
eachChild(c) {
c(this.needle), c(this.haystack);
}
outputDefined() {
return !0;
}
}
class B {
constructor(c, p, g) {
this.type = xe, this.needle = c, this.haystack = p, this.fromIndex = g;
}
static parse(c, p) {
if (c.length <= 2 || c.length >= 5)
return p.error(`Expected 3 or 4 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, wr);
if (!g || !w)
return null;
if (!At(g.type, [_r, Dr, xe, t1, wr]))
return p.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new B(g, w, H) : null;
}
return new B(g, w);
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!Vt(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${st(Qn(p))} instead.`);
let w;
if (this.fromIndex && (w = this.fromIndex.evaluate(c)), Vt(g, ["string"])) {
const H = g.indexOf(p, w);
return H === -1 ? -1 : [...g.slice(0, H)].length;
}
if (Vt(g, ["array"]))
return g.indexOf(p, w);
throw new jn(`Expected second argument to be of type array or string, but found ${st(Qn(g))} instead.`);
}
eachChild(c) {
c(this.needle), c(this.haystack), this.fromIndex && c(this.fromIndex);
}
outputDefined() {
return !1;
}
}
class q {
constructor(c, p, g, w, H, A) {
this.inputType = c, this.type = p, this.input = g, this.cases = w, this.outputs = H, this.otherwise = A;
}
static parse(c, p) {
if (c.length < 5)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if (c.length % 2 != 1)
return p.error("Expected an even number of arguments.");
let g, w;
p.expectedType && p.expectedType.kind !== "value" && (w = p.expectedType);
const H = {}, A = [];
for (let z = 2; z < c.length - 1; z += 2) {
let W = c[z];
const X = c[z + 1];
Array.isArray(W) || (W = [W]);
const tt = p.concat(z);
if (W.length === 0)
return tt.error("Expected at least one branch label.");
for (const ut of W) {
if (typeof ut != "number" && typeof ut != "string")
return tt.error("Branch labels must be numbers or strings.");
if (typeof ut == "number" && Math.abs(ut) > Number.MAX_SAFE_INTEGER)
return tt.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
if (typeof ut == "number" && Math.floor(ut) !== ut)
return tt.error("Numeric branch labels must be integer values.");
if (g) {
if (tt.checkSubtype(g, Qn(ut)))
return null;
} else
g = Qn(ut);
if (H[String(ut)] !== void 0)
return tt.error("Branch labels must be unique.");
H[String(ut)] = A.length;
}
const at = p.parse(X, z, w);
if (!at)
return null;
w = w || at.type, A.push(at);
}
const C = p.parse(c[1], 1, wr);
if (!C)
return null;
const N = p.parse(c[c.length - 1], c.length - 1, w);
return N ? C.type.kind !== "value" && p.concat(1).checkSubtype(g, C.type) ? null : new q(g, w, C, H, A, N) : null;
}
evaluate(c) {
const p = this.input.evaluate(c);
return (Qn(p) === this.inputType && this.outputs[this.cases[p]] || this.otherwise).evaluate(c);
}
eachChild(c) {
c(this.input), this.outputs.forEach(c), c(this.otherwise);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined()) && this.otherwise.outputDefined();
}
}
class it {
constructor(c, p, g) {
this.type = c, this.branches = p, this.otherwise = g;
}
static parse(c, p) {
if (c.length < 4)
return p.error(`Expected at least 3 arguments, but found only ${c.length - 1}.`);
if (c.length % 2 != 0)
return p.error("Expected an odd number of arguments.");
let g;
p.expectedType && p.expectedType.kind !== "value" && (g = p.expectedType);
const w = [];
for (let A = 1; A < c.length - 1; A += 2) {
const C = p.parse(c[A], A, _r);
if (!C)
return null;
const N = p.parse(c[A + 1], A + 1, g);
if (!N)
return null;
w.push([C, N]), g = g || N.type;
}
const H = p.parse(c[c.length - 1], c.length - 1, g);
if (!H)
return null;
if (!g)
throw new Error("Can't infer output type");
return new it(g, w, H);
}
evaluate(c) {
for (const [p, g] of this.branches)
if (p.evaluate(c))
return g.evaluate(c);
return this.otherwise.evaluate(c);
}
eachChild(c) {
for (const [p, g] of this.branches)
c(p), c(g);
c(this.otherwise);
}
outputDefined() {
return this.branches.every(([c, p]) => p.outputDefined()) && this.otherwise.outputDefined();
}
}
class ht {
constructor(c, p, g, w) {
this.type = c, this.input = p, this.beginIndex = g, this.endIndex = w;
}
static parse(c, p) {
if (c.length <= 2 || c.length >= 5)
return p.error(`Expected 3 or 4 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, xe);
if (!g || !w)
return null;
if (!At(g.type, [ot(wr), Dr, wr]))
return p.error(`Expected first argument to be of type array or string, but found ${st(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new ht(g.type, g, w, H) : null;
}
return new ht(g.type, g, w);
}
evaluate(c) {
const p = this.input.evaluate(c), g = this.beginIndex.evaluate(c);
let w;
if (this.endIndex && (w = this.endIndex.evaluate(c)), Vt(p, ["string"]))
return [...p].slice(g, w).join("");
if (Vt(p, ["array"]))
return p.slice(g, w);
throw new jn(`Expected first argument to be of type array or string, but found ${st(Qn(p))} instead.`);
}
eachChild(c) {
c(this.input), c(this.beginIndex), this.endIndex && c(this.endIndex);
}
outputDefined() {
return !1;
}
}
function mt(h, c) {
const p = h.length - 1;
let g, w, H = 0, A = p, C = 0;
for (; H <= A; )
if (C = Math.floor((H + A) / 2), g = h[C], w = h[C + 1], g <= c) {
if (C === p || c < w)
return C;
H = C + 1;
} else {
if (!(g > c))
throw new jn("Input is not a number.");
A = C - 1;
}
return 0;
}
class qt {
constructor(c, p, g) {
this.type = c, this.input = p, this.labels = [], this.outputs = [];
for (const [w, H] of g)
this.labels.push(w), this.outputs.push(H);
}
static parse(c, p) {
if (c.length - 1 < 4)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if ((c.length - 1) % 2 != 0)
return p.error("Expected an even number of arguments.");
const g = p.parse(c[1], 1, xe);
if (!g)
return null;
const w = [];
let H = null;
p.expectedType && p.expectedType.kind !== "value" && (H = p.expectedType);
for (let A = 1; A < c.length; A += 2) {
const C = A === 1 ? -1 / 0 : c[A], N = c[A + 1], z = A, W = A + 1;
if (typeof C != "number")
return p.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', z);
if (w.length && w[w.length - 1][0] >= C)
return p.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', z);
const X = p.parse(N, W, H);
if (!X)
return null;
H = H || X.type, w.push([C, X]);
}
return new qt(H, g, w);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const w = this.input.evaluate(c);
if (w <= p[0])
return g[0].evaluate(c);
const H = p.length;
return w >= p[H - 1] ? g[H - 1].evaluate(c) : g[mt(p, w)].evaluate(c);
}
eachChild(c) {
c(this.input);
for (const p of this.outputs)
c(p);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined());
}
}
function le(h) {
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
}
var ve = Me;
function Me(h, c, p, g) {
this.cx = 3 * h, this.bx = 3 * (p - h) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * c, this.by = 3 * (g - c) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = h, this.p1y = c, this.p2x = p, this.p2y = g;
}
Me.prototype = { sampleCurveX: function(h) {
return ((this.ax * h + this.bx) * h + this.cx) * h;
}, sampleCurveY: function(h) {
return ((this.ay * h + this.by) * h + this.cy) * h;
}, sampleCurveDerivativeX: function(h) {
return (3 * this.ax * h + 2 * this.bx) * h + this.cx;
}, solveCurveX: function(h, c) {
if (c === void 0 && (c = 1e-6), h < 0)
return 0;
if (h > 1)
return 1;
for (var p = h, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h;
if (Math.abs(w) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= w / H;
}
var A = 0, C = 1;
for (p = h, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h) < c)); g++)
h > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var be = le(ve);
function fr(h, c, p) {
return h + p * (c - h);
}
function kn(h, c, p) {
return h.map((g, w) => fr(g, c[w], p));
}
const xr = { number: fr, color: function(h, c, p, g = "rgb") {
switch (g) {
case "rgb": {
const [w, H, A, C] = kn(h.rgb, c.rgb, p);
return new tn(w, H, A, C, !1);
}
case "hcl": {
const [w, H, A, C] = h.hcl, [N, z, W, X] = c.hcl;
let tt, at;
if (isNaN(w) || isNaN(N))
isNaN(w) ? isNaN(N) ? tt = NaN : (tt = N, A !== 1 && A !== 0 || (at = z)) : (tt = w, W !== 1 && W !== 0 || (at = H));
else {
let $t = N - w;
N > w && $t > 180 ? $t -= 360 : N < w && w - N > 180 && ($t += 360), tt = w + p * $t;
}
const [ut, Tt, Lt, Et] = function([$t, Pt, Bt, ee]) {
return $t = isNaN($t) ? 0 : $t * Rt, zr([Bt, Math.cos($t) * Pt, Math.sin($t) * Pt, ee]);
}([tt, at ?? fr(H, z, p), fr(A, W, p), fr(C, X, p)]);
return new tn(ut, Tt, Lt, Et, !1);
}
case "lab": {
const [w, H, A, C] = zr(kn(h.lab, c.lab, p));
return new tn(w, H, A, C, !1);
}
}
}, array: kn, padding: function(h, c, p) {
return new Yn(kn(h.values, c.values, p));
}, variableAnchorOffsetCollection: function(h, c, p) {
const g = h.values, w = c.values;
if (g.length !== w.length)
throw new jn(`Cannot interpolate values of different length. from: ${h.toString()}, to: ${c.toString()}`);
const H = [];
for (let A = 0; A < g.length; A += 2) {
if (g[A] !== w[A])
throw new jn(`Cannot interpolate values containing mismatched anchors. from[${A}]: ${g[A]}, to[${A}]: ${w[A]}`);
H.push(g[A]);
const [C, N] = g[A + 1], [z, W] = w[A + 1];
H.push([fr(C, z, p), fr(N, W, p)]);
}
return new _n(H);
} };
class un {
constructor(c, p, g, w, H) {
this.type = c, this.operator = p, this.interpolation = g, this.input = w, this.labels = [], this.outputs = [];
for (const [A, C] of H)
this.labels.push(A), this.outputs.push(C);
}
static interpolationFactor(c, p, g, w) {
let H = 0;
if (c.name === "exponential")
H = pe(p, c.base, g, w);
else if (c.name === "linear")
H = pe(p, 1, g, w);
else if (c.name === "cubic-bezier") {
const A = c.controlPoints;
H = new be(A[0], A[1], A[2], A[3]).solve(pe(p, 1, g, w));
}
return H;
}
static parse(c, p) {
let [g, w, H, ...A] = c;
if (!Array.isArray(w) || w.length === 0)
return p.error("Expected an interpolation type expression.", 1);
if (w[0] === "linear")
w = { name: "linear" };
else if (w[0] === "exponential") {
const z = w[1];
if (typeof z != "number")
return p.error("Exponential interpolation requires a numeric base.", 1, 1);
w = { name: "exponential", base: z };
} else {
if (w[0] !== "cubic-bezier")
return p.error(`Unknown interpolation type ${String(w[0])}`, 1, 0);
{
const z = w.slice(1);
if (z.length !== 4 || z.some((W) => typeof W != "number" || W < 0 || W > 1))
return p.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
w = { name: "cubic-bezier", controlPoints: z };
}
}
if (c.length - 1 < 4)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if ((c.length - 1) % 2 != 0)
return p.error("Expected an even number of arguments.");
if (H = p.parse(H, 2, xe), !H)
return null;
const C = [];
let N = null;
g === "interpolate-hcl" || g === "interpolate-lab" ? N = Vn : p.expectedType && p.expectedType.kind !== "value" && (N = p.expectedType);
for (let z = 0; z < A.length; z += 2) {
const W = A[z], X = A[z + 1], tt = z + 3, at = z + 4;
if (typeof W != "number")
return p.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', tt);
if (C.length && C[C.length - 1][0] >= W)
return p.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', tt);
const ut = p.parse(X, at, N);
if (!ut)
return null;
N = N || ut.type, C.push([W, ut]);
}
return jt(N, xe) || jt(N, Vn) || jt(N, Vi) || jt(N, xt) || jt(N, ot(xe)) ? new un(N, g, w, H, C) : p.error(`Type ${st(N)} is not interpolatable.`);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const w = this.input.evaluate(c);
if (w <= p[0])
return g[0].evaluate(c);
const H = p.length;
if (w >= p[H - 1])
return g[H - 1].evaluate(c);
const A = mt(p, w), C = un.interpolationFactor(this.interpolation, w, p[A], p[A + 1]), N = g[A].evaluate(c), z = g[A + 1].evaluate(c);
switch (this.operator) {
case "interpolate":
return xr[this.type.kind](N, z, C);
case "interpolate-hcl":
return xr.color(N, z, C, "hcl");
case "interpolate-lab":
return xr.color(N, z, C, "lab");
}
}
eachChild(c) {
c(this.input);
for (const p of this.outputs)
c(p);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined());
}
}
function pe(h, c, p, g) {
const w = g - p, H = h - p;
return w === 0 ? 0 : c === 1 ? H / w : (Math.pow(c, H) - 1) / (Math.pow(c, w) - 1);
}
class dr {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expectected at least one argument.");
let g = null;
const w = p.expectedType;
w && w.kind !== "value" && (g = w);
const H = [];
for (const C of c.slice(1)) {
const N = p.parse(C, 1 + H.length, g, void 0, { typeAnnotation: "omit" });
if (!N)
return null;
g = g || N.type, H.push(N);
}
if (!g)
throw new Error("No output type");
const A = w && H.some((C) => yt(w, C.type));
return new dr(A ? wr : g, H);
}
evaluate(c) {
let p, g = null, w = 0;
for (const H of this.args)
if (w++, g = H.evaluate(c), g && g instanceof pn && !g.available && (p || (p = g.name), g = null, w === this.args.length && (g = p)), g !== null)
break;
return g;
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
function Tn(h, c) {
return h === "==" || h === "!=" ? c.kind === "boolean" || c.kind === "string" || c.kind === "number" || c.kind === "null" || c.kind === "value" : c.kind === "string" || c.kind === "number" || c.kind === "value";
}
function Ni(h, c, p, g) {
return g.compare(c, p) === 0;
}
function zn(h, c, p) {
const g = h !== "==" && h !== "!=";
return class ZG {
constructor(H, A, C) {
this.type = _r, this.lhs = H, this.rhs = A, this.collator = C, this.hasUntypedArgument = H.type.kind === "value" || A.type.kind === "value";
}
static parse(H, A) {
if (H.length !== 3 && H.length !== 4)
return A.error("Expected two or three arguments.");
const C = H[0];
let N = A.parse(H[1], 1, wr);
if (!N)
return null;
if (!Tn(C, N.type))
return A.concat(1).error(`"${C}" comparisons are not supported for type '${st(N.type)}'.`);
let z = A.parse(H[2], 2, wr);
if (!z)
return null;
if (!Tn(C, z.type))
return A.concat(2).error(`"${C}" comparisons are not supported for type '${st(z.type)}'.`);
if (N.type.kind !== z.type.kind && N.type.kind !== "value" && z.type.kind !== "value")
return A.error(`Cannot compare types '${st(N.type)}' and '${st(z.type)}'.`);
g && (N.type.kind === "value" && z.type.kind !== "value" ? N = new d1(z.type, [N]) : N.type.kind !== "value" && z.type.kind === "value" && (z = new d1(N.type, [z])));
let W = null;
if (H.length === 4) {
if (N.type.kind !== "string" && z.type.kind !== "string" && N.type.kind !== "value" && z.type.kind !== "value")
return A.error("Cannot use collator to compare non-string types.");
if (W = A.parse(H[3], 3, Pi), !W)
return null;
}
return new ZG(N, z, W);
}
evaluate(H) {
const A = this.lhs.evaluate(H), C = this.rhs.evaluate(H);
if (g && this.hasUntypedArgument) {
const N = Qn(A), z = Qn(C);
if (N.kind !== z.kind || N.kind !== "string" && N.kind !== "number")
throw new jn(`Expected arguments for "${h}" to be (string, string) or (number, number), but found (${N.kind}, ${z.kind}) instead.`);
}
if (this.collator && !g && this.hasUntypedArgument) {
const N = Qn(A), z = Qn(C);
if (N.kind !== "string" || z.kind !== "string")
return c(H, A, C);
}
return this.collator ? p(H, A, C, this.collator.evaluate(H)) : c(H, A, C);
}
eachChild(H) {
H(this.lhs), H(this.rhs), this.collator && H(this.collator);
}
outputDefined() {
return !0;
}
};
}
const _0 = zn("==", function(h, c, p) {
return c === p;
}, Ni), vl = zn("!=", function(h, c, p) {
return c !== p;
}, function(h, c, p, g) {
return !Ni(0, c, p, g);
}), Nn = zn("<", function(h, c, p) {
return c < p;
}, function(h, c, p, g) {
return g.compare(c, p) < 0;
}), _l = zn(">", function(h, c, p) {
return c > p;
}, function(h, c, p, g) {
return g.compare(c, p) > 0;
}), yc = zn("<=", function(h, c, p) {
return c <= p;
}, function(h, c, p, g) {
return g.compare(c, p) <= 0;
}), Ko = zn(">=", function(h, c, p) {
return c >= p;
}, function(h, c, p, g) {
return g.compare(c, p) >= 0;
});
class ga {
constructor(c, p, g) {
this.type = Pi, this.locale = g, this.caseSensitive = c, this.diacriticSensitive = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error("Expected one argument.");
const g = c[1];
if (typeof g != "object" || Array.isArray(g))
return p.error("Collator options argument must be an object.");
const w = p.parse(g["case-sensitive"] !== void 0 && g["case-sensitive"], 1, _r);
if (!w)
return null;
const H = p.parse(g["diacritic-sensitive"] !== void 0 && g["diacritic-sensitive"], 1, _r);
if (!H)
return null;
let A = null;
return g.locale && (A = p.parse(g.locale, 1, Dr), !A) ? null : new ga(w, H, A);
}
evaluate(c) {
return new zi(this.caseSensitive.evaluate(c), this.diacriticSensitive.evaluate(c), this.locale ? this.locale.evaluate(c) : null);
}
eachChild(c) {
c(this.caseSensitive), c(this.diacriticSensitive), this.locale && c(this.locale);
}
outputDefined() {
return !1;
}
}
class N4 {
constructor(c, p, g, w, H) {
this.type = Dr, this.number = c, this.locale = p, this.currency = g, this.minFractionDigits = w, this.maxFractionDigits = H;
}
static parse(c, p) {
if (c.length !== 3)
return p.error("Expected two arguments.");
const g = p.parse(c[1], 1, xe);
if (!g)
return null;
const w = c[2];
if (typeof w != "object" || Array.isArray(w))
return p.error("NumberFormat options argument must be an object.");
let H = null;
if (w.locale && (H = p.parse(w.locale, 1, Dr), !H))
return null;
let A = null;
if (w.currency && (A = p.parse(w.currency, 1, Dr), !A))
return null;
let C = null;
if (w["min-fraction-digits"] && (C = p.parse(w["min-fraction-digits"], 1, xe), !C))
return null;
let N = null;
return w["max-fraction-digits"] && (N = p.parse(w["max-fraction-digits"], 1, xe), !N) ? null : new N4(g, H, A, C, N);
}
evaluate(c) {
return new Intl.NumberFormat(this.locale ? this.locale.evaluate(c) : [], { style: this.currency ? "currency" : "decimal", currency: this.currency ? this.currency.evaluate(c) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(c) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(c) : void 0 }).format(this.number.evaluate(c));
}
eachChild(c) {
c(this.number), this.locale && c(this.locale), this.currency && c(this.currency), this.minFractionDigits && c(this.minFractionDigits), this.maxFractionDigits && c(this.maxFractionDigits);
}
outputDefined() {
return !1;
}
}
class A3 {
constructor(c) {
this.type = H1, this.sections = c;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
const g = c[1];
if (!Array.isArray(g) && typeof g == "object")
return p.error("First argument must be an image or text section.");
const w = [];
let H = !1;
for (let A = 1; A <= c.length - 1; ++A) {
const C = c[A];
if (H && typeof C == "object" && !Array.isArray(C)) {
H = !1;
let N = null;
if (C["font-scale"] && (N = p.parse(C["font-scale"], 1, xe), !N))
return null;
let z = null;
if (C["text-font"] && (z = p.parse(C["text-font"], 1, ot(Dr)), !z))
return null;
let W = null;
if (C["text-color"] && (W = p.parse(C["text-color"], 1, Vn), !W))
return null;
const X = w[w.length - 1];
X.scale = N, X.font = z, X.textColor = W;
} else {
const N = p.parse(c[A], 1, wr);
if (!N)
return null;
const z = N.type.kind;
if (z !== "string" && z !== "value" && z !== "null" && z !== "resolvedImage")
return p.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
H = !0, w.push({ content: N, scale: null, font: null, textColor: null });
}
}
return new A3(w);
}
evaluate(c) {
return new Xr(this.sections.map((p) => {
const g = p.content.evaluate(c);
return Qn(g) === Rn ? new co("", g, null, null, null) : new co(Ui(g), null, p.scale ? p.scale.evaluate(c) : null, p.font ? p.font.evaluate(c).join(",") : null, p.textColor ? p.textColor.evaluate(c) : null);
}));
}
eachChild(c) {
for (const p of this.sections)
c(p.content), p.scale && c(p.scale), p.font && c(p.font), p.textColor && c(p.textColor);
}
outputDefined() {
return !1;
}
}
class O3 {
constructor(c) {
this.type = Rn, this.input = c;
}
static parse(c, p) {
if (c.length !== 2)
return p.error("Expected two arguments.");
const g = p.parse(c[1], 1, Dr);
return g ? new O3(g) : p.error("No image name provided.");
}
evaluate(c) {
const p = this.input.evaluate(c), g = pn.fromString(p);
return g && c.availableImages && (g.available = c.availableImages.indexOf(p) > -1), g;
}
eachChild(c) {
c(this.input);
}
outputDefined() {
return !1;
}
}
class D4 {
constructor(c) {
this.type = xe, this.input = c;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`Expected 1 argument, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1);
return g ? g.type.kind !== "array" && g.type.kind !== "string" && g.type.kind !== "value" ? p.error(`Expected argument of type string or array, but found ${st(g.type)} instead.`) : new D4(g) : null;
}
evaluate(c) {
const p = this.input.evaluate(c);
if (typeof p == "string")
return [...p].length;
if (Array.isArray(p))
return p.length;
throw new jn(`Expected value to be of type string or array, but found ${st(Qn(p))} instead.`);
}
eachChild(c) {
c(this.input);
}
outputDefined() {
return !1;
}
}
const Ao = 8192;
function vc(h, c) {
const p = (180 + h[0]) / 360, g = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h[1] * Math.PI / 360))) / 360, w = Math.pow(2, c.z);
return [Math.round(p * w * Ao), Math.round(g * w * Ao)];
}
function b0(h, c) {
const p = Math.pow(2, c.z);
return [(w = (h[0] / Ao + c.x) / p, 360 * w - 180), (g = (h[1] / Ao + c.y) / p, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * g) * Math.PI / 180)) - 90)];
var g, w;
}
function Bs(h, c) {
h[0] = Math.min(h[0], c[0]), h[1] = Math.min(h[1], c[1]), h[2] = Math.max(h[2], c[0]), h[3] = Math.max(h[3], c[1]);
}
function L2(h, c) {
return !(h[0] <= c[0] || h[2] >= c[2] || h[1] <= c[1] || h[3] >= c[3]);
}
function hn(h, c, p) {
const g = h[0] - c[0], w = h[1] - c[1], H = h[0] - p[0], A = h[1] - p[1];
return g * A - H * w == 0 && g * H <= 0 && w * A <= 0;
}
function C3(h, c, p, g) {
return (w = [g[0] - p[0], g[1] - p[1]])[0] * (H = [c[0] - h[0], c[1] - h[1]])[1] - w[1] * H[0] != 0 && !(!Oo(h, c, p, g) || !Oo(p, g, h, c));
var w, H;
}
function _c(h, c, p) {
for (const g of p)
for (let w = 0; w < g.length - 1; ++w)
if (C3(h, c, g[w], g[w + 1]))
return !0;
return !1;
}
function ya(h, c, p = !1) {
let g = !1;
for (const C of c)
for (let N = 0; N < C.length - 1; N++) {
if (hn(h, C[N], C[N + 1]))
return p;
(H = C[N])[1] > (w = h)[1] != (A = C[N + 1])[1] > w[1] && w[0] < (A[0] - H[0]) * (w[1] - H[1]) / (A[1] - H[1]) + H[0] && (g = !g);
}
var w, H, A;
return g;
}
function F4(h, c) {
for (const p of c)
if (ya(h, p))
return !0;
return !1;
}
function B4(h, c) {
for (const p of h)
if (!ya(p, c))
return !1;
for (let p = 0; p < h.length - 1; ++p)
if (_c(h[p], h[p + 1], c))
return !1;
return !0;
}
function bl(h, c) {
for (const p of c)
if (B4(h, p))
return !0;
return !1;
}
function Oo(h, c, p, g) {
const w = g[0] - p[0], H = g[1] - p[1], A = (h[0] - p[0]) * H - w * (h[1] - p[1]), C = (c[0] - p[0]) * H - w * (c[1] - p[1]);
return A > 0 && C < 0 || A < 0 && C > 0;
}
function j4(h, c, p) {
const g = [];
for (let w = 0; w < h.length; w++) {
const H = [];
for (let A = 0; A < h[w].length; A++) {
const C = vc(h[w][A], p);
Bs(c, C), H.push(C);
}
g.push(H);
}
return g;
}
function L0(h, c, p) {
const g = [];
for (let w = 0; w < h.length; w++) {
const H = j4(h[w], c, p);
g.push(H);
}
return g;
}
function Ll(h, c, p, g) {
if (h[0] < p[0] || h[0] > p[2]) {
const w = 0.5 * g;
let H = h[0] - p[0] > w ? -g : p[0] - h[0] > w ? g : 0;
H === 0 && (H = h[0] - p[2] > w ? -g : p[2] - h[0] > w ? g : 0), h[0] += H;
}
Bs(c, h);
}
function w0(h, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const C of h)
for (const N of C) {
const z = [N.x + H[0], N.y + H[1]];
Ll(z, c, p, w), A.push(z);
}
return A;
}
function k3(h, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const N of h) {
const z = [];
for (const W of N) {
const X = [W.x + H[0], W.y + H[1]];
Bs(c, X), z.push(X);
}
A.push(z);
}
if (c[2] - c[0] <= w / 2) {
(C = c)[0] = C[1] = 1 / 0, C[2] = C[3] = -1 / 0;
for (const N of A)
for (const z of N)
Ll(z, c, p, w);
}
var C;
return A;
}
class is {
constructor(c, p) {
this.type = _r, this.geojson = c, this.geometries = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'within' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (u1(c[1])) {
const g = c[1];
if (g.type === "FeatureCollection") {
const w = [];
for (const H of g.features) {
const { type: A, coordinates: C } = H.geometry;
A === "Polygon" && w.push(C), A === "MultiPolygon" && w.push(...C);
}
if (w.length)
return new is(g, { type: "MultiPolygon", coordinates: w });
} else if (g.type === "Feature") {
const w = g.geometry.type;
if (w === "Polygon" || w === "MultiPolygon")
return new is(g, g.geometry);
} else if (g.type === "Polygon" || g.type === "MultiPolygon")
return new is(g, g);
}
return p.error("'within' expression requires valid geojson object that contains polygon geometry type.");
}
evaluate(c) {
if (c.geometry() != null && c.canonicalID() != null) {
if (c.geometryType() === "Point")
return function(p, g) {
const w = [1 / 0, 1 / 0, -1 / 0, -1 / 0], H = [1 / 0, 1 / 0, -1 / 0, -1 / 0], A = p.canonicalID();
if (g.type === "Polygon") {
const C = j4(g.coordinates, H, A), N = w0(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!ya(z, C))
return !1;
}
if (g.type === "MultiPolygon") {
const C = L0(g.coordinates, H, A), N = w0(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!F4(z, C))
return !1;
}
return !0;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const w = [1 / 0, 1 / 0, -1 / 0, -1 / 0], H = [1 / 0, 1 / 0, -1 / 0, -1 / 0], A = p.canonicalID();
if (g.type === "Polygon") {
const C = j4(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!B4(z, C))
return !1;
}
if (g.type === "MultiPolygon") {
const C = L0(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!bl(z, C))
return !1;
}
return !0;
}(c, this.geometries);
}
return !1;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
let x0 = class {
constructor(h = [], c = (p, g) => p < g ? -1 : p > g ? 1 : 0) {
if (this.data = h, this.length = this.data.length, this.compare = c, this.length > 0)
for (let p = (this.length >> 1) - 1; p >= 0; p--)
this._down(p);
}
push(h) {
this.data.push(h), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const h = this.data[0], c = this.data.pop();
return --this.length > 0 && (this.data[0] = c, this._down(0)), h;
}
peek() {
return this.data[0];
}
_up(h) {
const { data: c, compare: p } = this, g = c[h];
for (; h > 0; ) {
const w = h - 1 >> 1, H = c[w];
if (p(g, H) >= 0)
break;
c[h] = H, h = w;
}
c[h] = g;
}
_down(h) {
const { data: c, compare: p } = this, g = this.length >> 1, w = c[h];
for (; h < g; ) {
let H = 1 + (h << 1);
const A = H + 1;
if (A < this.length && p(c[A], c[H]) < 0 && (H = A), p(c[H], w) >= 0)
break;
c[h] = c[H], h = H;
}
c[h] = w;
}
};
function bc(h, c, p, g, w) {
os(h, c, p, g || h.length - 1, w || Lc);
}
function os(h, c, p, g, w) {
for (; g > p; ) {
if (g - p > 600) {
var H = g - p + 1, A = c - p + 1, C = Math.log(H), N = 0.5 * Math.exp(2 * C / 3), z = 0.5 * Math.sqrt(C * N * (H - N) / H) * (A - H / 2 < 0 ? -1 : 1);
os(h, c, Math.max(p, Math.floor(c - A * N / H + z)), Math.min(g, Math.floor(c + (H - A) * N / H + z)), w);
}
var W = h[c], X = p, tt = g;
for (va(h, p, c), w(h[g], W) > 0 && va(h, p, g); X < tt; ) {
for (va(h, X, tt), X++, tt--; w(h[X], W) < 0; )
X++;
for (; w(h[tt], W) > 0; )
tt--;
}
w(h[p], W) === 0 ? va(h, p, tt) : va(h, ++tt, g), tt <= c && (p = tt + 1), c <= tt && (g = tt - 1);
}
}
function va(h, c, p) {
var g = h[c];
h[c] = h[p], h[p] = g;
}
function Lc(h, c) {
return h < c ? -1 : h > c ? 1 : 0;
}
function z4(h, c) {
if (h.length <= 1)
return [h];
const p = [];
let g, w;
for (const H of h) {
const A = I3(H);
A !== 0 && (H.area = Math.abs(A), w === void 0 && (w = A < 0), w === A < 0 ? (g && p.push(g), g = [H]) : g.push(H));
}
if (g && p.push(g), c > 1)
for (let H = 0; H < p.length; H++)
p[H].length <= c || (bc(p[H], c, 1, p[H].length - 1, E0), p[H] = p[H].slice(0, c));
return p;
}
function E0(h, c) {
return c.area - h.area;
}
function I3(h) {
let c = 0;
for (let p, g, w = 0, H = h.length, A = H - 1; w < H; A = w++)
p = h[w], g = h[A], c += (g.x - p.x) * (p.y + g.y);
return c;
}
const U4 = 1 / 298.257223563, G4 = U4 * (2 - U4), $4 = Math.PI / 180;
class js {
constructor(c) {
const p = 6378.137 * $4 * 1e3, g = Math.cos(c * $4), w = 1 / (1 - G4 * (1 - g * g)), H = Math.sqrt(w);
this.kx = p * H * g, this.ky = p * H * w * (1 - G4);
}
distance(c, p) {
const g = this.wrap(c[0] - p[0]) * this.kx, w = (c[1] - p[1]) * this.ky;
return Math.sqrt(g * g + w * w);
}
pointOnLine(c, p) {
let g, w, H, A, C = 1 / 0;
for (let N = 0; N < c.length - 1; N++) {
let z = c[N][0], W = c[N][1], X = this.wrap(c[N + 1][0] - z) * this.kx, tt = (c[N + 1][1] - W) * this.ky, at = 0;
X === 0 && tt === 0 || (at = (this.wrap(p[0] - z) * this.kx * X + (p[1] - W) * this.ky * tt) / (X * X + tt * tt), at > 1 ? (z = c[N + 1][0], W = c[N + 1][1]) : at > 0 && (z += X / this.kx * at, W += tt / this.ky * at)), X = this.wrap(p[0] - z) * this.kx, tt = (p[1] - W) * this.ky;
const ut = X * X + tt * tt;
ut < C && (C = ut, g = z, w = W, H = N, A = at);
}
return { point: [g, w], index: H, t: Math.max(0, Math.min(1, A)) };
}
wrap(c) {
for (; c < -180; )
c += 360;
for (; c > 180; )
c -= 360;
return c;
}
}
function wl(h, c) {
return c[0] - h[0];
}
function W4(h) {
return h[1] - h[0] + 1;
}
function w2(h, c) {
return h[1] >= h[0] && h[1] < c;
}
function M0(h, c) {
if (h[0] > h[1])
return [null, null];
const p = W4(h);
if (c) {
if (p === 2)
return [h, null];
const w = Math.floor(p / 2);
return [[h[0], h[0] + w], [h[0] + w, h[1]]];
}
if (p === 1)
return [h, null];
const g = Math.floor(p / 2) - 1;
return [[h[0], h[0] + g], [h[0] + g + 1, h[1]]];
}
function S0(h, c) {
if (!w2(c, h.length))
return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
const p = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let g = c[0]; g <= c[1]; ++g)
Bs(p, h[g]);
return p;
}
function Z4(h) {
const c = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (const p of h)
for (const g of p)
Bs(c, g);
return c;
}
function _a(h) {
return h[0] !== -1 / 0 && h[1] !== -1 / 0 && h[2] !== 1 / 0 && h[3] !== 1 / 0;
}
function x2(h, c, p) {
if (!_a(h) || !_a(c))
return NaN;
let g = 0, w = 0;
return h[2] < c[0] && (g = c[0] - h[2]), h[0] > c[2] && (g = h[0] - c[2]), h[1] > c[3] && (w = h[1] - c[3]), h[3] < c[1] && (w = c[1] - h[3]), p.distance([0, 0], [g, w]);
}
function v1(h, c, p) {
const g = p.pointOnLine(c, h);
return p.distance(h, g.point);
}
function E2(h, c, p, g, w) {
const H = Math.min(v1(h, [p, g], w), v1(c, [p, g], w)), A = Math.min(v1(p, [h, c], w), v1(g, [h, c], w));
return Math.min(H, A);
}
function q4(h, c, p, g, w) {
if (!w2(c, h.length) || !w2(g, p.length))
return 1 / 0;
let H = 1 / 0;
for (let A = c[0]; A < c[1]; ++A) {
const C = h[A], N = h[A + 1];
for (let z = g[0]; z < g[1]; ++z) {
const W = p[z], X = p[z + 1];
if (C3(C, N, W, X))
return 0;
H = Math.min(H, E2(C, N, W, X, w));
}
}
return H;
}
function Mn(h, c, p, g, w) {
if (!w2(c, h.length) || !w2(g, p.length))
return NaN;
let H = 1 / 0;
for (let A = c[0]; A <= c[1]; ++A)
for (let C = g[0]; C <= g[1]; ++C)
if (H = Math.min(H, w.distance(h[A], p[C])), H === 0)
return H;
return H;
}
function wc(h, c, p) {
if (ya(h, c, !0))
return 0;
let g = 1 / 0;
for (const w of c) {
const H = w[0], A = w[w.length - 1];
if (H !== A && (g = Math.min(g, v1(h, [A, H], p)), g === 0))
return g;
const C = p.pointOnLine(w, h);
if (g = Math.min(g, p.distance(h, C.point)), g === 0)
return g;
}
return g;
}
function $r(h, c, p, g) {
if (!w2(c, h.length))
return NaN;
for (let H = c[0]; H <= c[1]; ++H)
if (ya(h[H], p, !0))
return 0;
let w = 1 / 0;
for (let H = c[0]; H < c[1]; ++H) {
const A = h[H], C = h[H + 1];
for (const N of p)
for (let z = 0, W = N.length, X = W - 1; z < W; X = z++) {
const tt = N[X], at = N[z];
if (C3(A, C, tt, at))
return 0;
w = Math.min(w, E2(A, C, tt, at, g));
}
}
return w;
}
function ss(h, c) {
for (const p of h)
for (const g of p)
if (ya(g, c, !0))
return !0;
return !1;
}
function An(h, c, p, g = 1 / 0) {
const w = Z4(h), H = Z4(c);
if (g !== 1 / 0 && x2(w, H, p) >= g)
return g;
if (L2(w, H)) {
if (ss(h, c))
return 0;
} else if (ss(c, h))
return 0;
let A = 1 / 0;
for (const C of h)
for (let N = 0, z = C.length, W = z - 1; N < z; W = N++) {
const X = C[W], tt = C[N];
for (const at of c)
for (let ut = 0, Tt = at.length, Lt = Tt - 1; ut < Tt; Lt = ut++) {
const Et = at[Lt], $t = at[ut];
if (C3(X, tt, Et, $t))
return 0;
A = Math.min(A, E2(X, tt, Et, $t, p));
}
}
return A;
}
function bn(h, c, p, g, w, H) {
if (!H)
return;
const A = x2(S0(g, H), w, p);
A < c && h.push([A, H, [0, 0]]);
}
function zs(h, c, p, g, w, H, A) {
if (!H || !A)
return;
const C = x2(S0(g, H), S0(w, A), p);
C < c && h.push([C, H, A]);
}
function P3(h, c, p, g, w = 1 / 0) {
let H = Math.min(g.distance(h[0], p[0][0]), w);
if (H === 0)
return H;
const A = new x0([[0, [0, h.length - 1], [0, 0]]], wl), C = Z4(p);
for (; A.length > 0; ) {
const N = A.pop();
if (N[0] >= H)
continue;
const z = N[1], W = c ? 50 : 100;
if (W4(z) <= W) {
if (!w2(z, h.length))
return NaN;
if (c) {
const X = $r(h, z, p, g);
if (isNaN(X) || X === 0)
return X;
H = Math.min(H, X);
} else
for (let X = z[0]; X <= z[1]; ++X) {
const tt = wc(h[X], p, g);
if (H = Math.min(H, tt), H === 0)
return 0;
}
} else {
const X = M0(z, c);
bn(A, H, g, h, C, X[0]), bn(A, H, g, h, C, X[1]);
}
}
return H;
}
function ba(h, c, p, g, w, H = 1 / 0) {
let A = Math.min(H, w.distance(h[0], p[0]));
if (A === 0)
return A;
const C = new x0([[0, [0, h.length - 1], [0, p.length - 1]]], wl);
for (; C.length > 0; ) {
const N = C.pop();
if (N[0] >= A)
continue;
const z = N[1], W = N[2], X = c ? 50 : 100, tt = g ? 50 : 100;
if (W4(z) <= X && W4(W) <= tt) {
if (!w2(z, h.length) && w2(W, p.length))
return NaN;
let at;
if (c && g)
at = q4(h, z, p, W, w), A = Math.min(A, at);
else if (c && !g) {
const ut = h.slice(z[0], z[1] + 1);
for (let Tt = W[0]; Tt <= W[1]; ++Tt)
if (at = v1(p[Tt], ut, w), A = Math.min(A, at), A === 0)
return A;
} else if (!c && g) {
const ut = p.slice(W[0], W[1] + 1);
for (let Tt = z[0]; Tt <= z[1]; ++Tt)
if (at = v1(h[Tt], ut, w), A = Math.min(A, at), A === 0)
return A;
} else
at = Mn(h, z, p, W, w), A = Math.min(A, at);
} else {
const at = M0(z, c), ut = M0(W, g);
zs(C, A, w, h, p, at[0], ut[0]), zs(C, A, w, h, p, at[0], ut[1]), zs(C, A, w, h, p, at[1], ut[0]), zs(C, A, w, h, p, at[1], ut[1]);
}
}
return A;
}
function X4(h) {
return h.type === "MultiPolygon" ? h.coordinates.map((c) => ({ type: "Polygon", coordinates: c })) : h.type === "MultiLineString" ? h.coordinates.map((c) => ({ type: "LineString", coordinates: c })) : h.type === "MultiPoint" ? h.coordinates.map((c) => ({ type: "Point", coordinates: c })) : [h];
}
class Yo {
constructor(c, p) {
this.type = xe, this.geojson = c, this.geometries = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'distance' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (u1(c[1])) {
const g = c[1];
if (g.type === "FeatureCollection")
return new Yo(g, g.features.map((w) => X4(w.geometry)).flat());
if (g.type === "Feature")
return new Yo(g, X4(g.geometry));
if ("type" in g && "coordinates" in g)
return new Yo(g, X4(g));
}
return p.error("'distance' expression requires valid geojson object that contains polygon geometry type.");
}
evaluate(c) {
if (c.geometry() != null && c.canonicalID() != null) {
if (c.geometryType() === "Point")
return function(p, g) {
const w = p.geometry(), H = w.flat().map((N) => b0([N.x, N.y], p.canonical));
if (w.length === 0)
return NaN;
const A = new js(H[0][1]);
let C = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
C = Math.min(C, ba(H, !1, [N.coordinates], !1, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, !1, N.coordinates, !0, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, !1, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const w = p.geometry(), H = w.flat().map((N) => b0([N.x, N.y], p.canonical));
if (w.length === 0)
return NaN;
const A = new js(H[0][1]);
let C = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
C = Math.min(C, ba(H, !0, [N.coordinates], !1, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, !0, N.coordinates, !0, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, !0, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
if (c.geometryType() === "Polygon")
return function(p, g) {
const w = p.geometry();
if (w.length === 0 || w[0].length === 0)
return NaN;
const H = z4(w, 0).map((N) => N.map((z) => z.map((W) => b0([W.x, W.y], p.canonical)))), A = new js(H[0][0][0][1]);
let C = 1 / 0;
for (const N of g)
for (const z of H) {
switch (N.type) {
case "Point":
C = Math.min(C, P3([N.coordinates], !1, z, A, C));
break;
case "LineString":
C = Math.min(C, P3(N.coordinates, !0, z, A, C));
break;
case "Polygon":
C = Math.min(C, An(z, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
}
return NaN;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
const Co = { "==": _0, "!=": vl, ">": _l, "<": Nn, ">=": Ko, "<=": yc, array: d1, at: I, boolean: d1, case: it, coalesce: dr, collator: ga, format: A3, image: O3, in: G, "index-of": B, interpolate: un, "interpolate-hcl": un, "interpolate-lab": un, length: D4, let: ho, literal: h1, match: q, number: d1, "number-format": N4, object: d1, slice: ht, step: qt, string: d1, "to-boolean": e1, "to-color": e1, "to-number": e1, "to-string": e1, var: Yr, within: is, distance: Yo };
class po {
constructor(c, p, g, w) {
this.name = c, this.type = p, this._evaluate = g, this.args = w;
}
evaluate(c) {
return this._evaluate(c, this.args);
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return !1;
}
static parse(c, p) {
const g = c[0], w = po.definitions[g];
if (!w)
return p.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`, 0);
const H = Array.isArray(w) ? w[0] : w.type, A = Array.isArray(w) ? [[w[1], w[2]]] : w.overloads, C = A.filter(([z]) => !Array.isArray(z) || z.length === c.length - 1);
let N = null;
for (const [z, W] of C) {
N = new Xo(p.registry, V3, p.path, null, p.scope);
const X = [];
let tt = !1;
for (let at = 1; at < c.length; at++) {
const ut = c[at], Tt = Array.isArray(z) ? z[at - 1] : z.type, Lt = N.parse(ut, 1 + X.length, Tt);
if (!Lt) {
tt = !0;
break;
}
X.push(Lt);
}
if (!tt)
if (Array.isArray(z) && z.length !== X.length)
N.error(`Expected ${z.length} arguments, but found ${X.length} instead.`);
else {
for (let at = 0; at < X.length; at++) {
const ut = Array.isArray(z) ? z[at] : z.type, Tt = X[at];
N.concat(at + 1).checkSubtype(ut, Tt.type);
}
if (N.errors.length === 0)
return new po(g, H, W, X);
}
}
if (C.length === 1)
p.errors.push(...N.errors);
else {
const z = (C.length ? C : A).map(([X]) => {
return tt = X, Array.isArray(tt) ? `(${tt.map(st).join(", ")})` : `(${st(tt.type)}...)`;
var tt;
}).join(" | "), W = [];
for (let X = 1; X < c.length; X++) {
const tt = p.parse(c[X], 1 + W.length);
if (!tt)
return null;
W.push(st(tt.type));
}
p.error(`Expected arguments of type ${z}, but found (${W.join(", ")}) instead.`);
}
return null;
}
static register(c, p) {
po.definitions = p;
for (const g in p)
c[g] = po;
}
}
function Jo(h, [c, p, g, w]) {
c = c.evaluate(h), p = p.evaluate(h), g = g.evaluate(h);
const H = w ? w.evaluate(h) : 1, A = uo(c, p, g, H);
if (A)
throw new jn(A);
return new tn(c / 255, p / 255, g / 255, H, !1);
}
function H0(h, c) {
return h in c;
}
function M2(h, c) {
const p = c[h];
return p === void 0 ? null : p;
}
function as(h) {
return { type: h };
}
function V3(h) {
if (h instanceof Yr)
return V3(h.boundExpression);
if (h instanceof po && h.name === "error" || h instanceof ga || h instanceof is || h instanceof Yo)
return !1;
const c = h instanceof e1 || h instanceof d1;
let p = !0;
return h.eachChild((g) => {
p = c ? p && V3(g) : p && g instanceof h1;
}), !!p && ls(h) && La(h, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]);
}
function ls(h) {
if (h instanceof po && (h.name === "get" && h.args.length === 1 || h.name === "feature-state" || h.name === "has" && h.args.length === 1 || h.name === "properties" || h.name === "geometry-type" || h.name === "id" || /^filter-/.test(h.name)) || h instanceof is || h instanceof Yo)
return !1;
let c = !0;
return h.eachChild((p) => {
c && !ls(p) && (c = !1);
}), c;
}
function cs(h) {
if (h instanceof po && h.name === "feature-state")
return !1;
let c = !0;
return h.eachChild((p) => {
c && !cs(p) && (c = !1);
}), c;
}
function La(h, c) {
if (h instanceof po && c.indexOf(h.name) >= 0)
return !1;
let p = !0;
return h.eachChild((g) => {
p && !La(g, c) && (p = !1);
}), p;
}
function R3(h) {
return { result: "success", value: h };
}
function Us(h) {
return { result: "error", value: h };
}
function t2(h) {
return h["property-type"] === "data-driven" || h["property-type"] === "cross-faded-data-driven";
}
function A0(h) {
return !!h.expression && h.expression.parameters.indexOf("zoom") > -1;
}
function O0(h) {
return !!h.expression && h.expression.interpolated;
}
function kt(h) {
return h instanceof Number ? "number" : h instanceof String ? "string" : h instanceof Boolean ? "boolean" : Array.isArray(h) ? "array" : h === null ? "null" : typeof h;
}
function ne(h) {
return typeof h == "object" && h !== null && !Array.isArray(h);
}
function Fe(h) {
return h;
}
function Lr(h, c) {
const p = c.type === "color", g = h.stops && typeof h.stops[0][0] == "object", w = g || !(g || h.property !== void 0), H = h.type || (O0(c) ? "exponential" : "interval");
if (p || c.type === "padding") {
const W = p ? tn.parse : Yn.parse;
(h = bi({}, h)).stops && (h.stops = h.stops.map((X) => [X[0], W(X[1])])), h.default = W(h.default ? h.default : c.default);
}
if (h.colorSpace && (A = h.colorSpace) !== "rgb" && A !== "hcl" && A !== "lab")
throw new Error(`Unknown color space: "${h.colorSpace}"`);
var A;
let C, N, z;
if (H === "exponential")
C = wi;
else if (H === "interval")
C = Jn;
else if (H === "categorical") {
C = rn, N = /* @__PURE__ */ Object.create(null);
for (const W of h.stops)
N[W[0]] = W[1];
z = typeof h.stops[0][0];
} else {
if (H !== "identity")
throw new Error(`Unknown function type "${H}"`);
C = To;
}
if (g) {
const W = {}, X = [];
for (let ut = 0; ut < h.stops.length; ut++) {
const Tt = h.stops[ut], Lt = Tt[0].zoom;
W[Lt] === void 0 && (W[Lt] = { zoom: Lt, type: h.type, property: h.property, default: h.default, stops: [] }, X.push(Lt)), W[Lt].stops.push([Tt[0].value, Tt[1]]);
}
const tt = [];
for (const ut of X)
tt.push([W[ut].zoom, Lr(W[ut], c)]);
const at = { name: "linear" };
return { kind: "composite", interpolationType: at, interpolationFactor: un.interpolationFactor.bind(void 0, at), zoomStops: tt.map((ut) => ut[0]), evaluate: ({ zoom: ut }, Tt) => wi({ stops: tt, base: h.base }, c, ut).evaluate(ut, Tt) };
}
if (w) {
const W = H === "exponential" ? { name: "exponential", base: h.base !== void 0 ? h.base : 1 } : null;
return { kind: "camera", interpolationType: W, interpolationFactor: un.interpolationFactor.bind(void 0, W), zoomStops: h.stops.map((X) => X[0]), evaluate: ({ zoom: X }) => C(h, c, X, N, z) };
}
return { kind: "source", evaluate(W, X) {
const tt = X && X.properties ? X.properties[h.property] : void 0;
return tt === void 0 ? Ln(h.default, c.default) : C(h, c, tt, N, z);
} };
}
function Ln(h, c, p) {
return h !== void 0 ? h : c !== void 0 ? c : p !== void 0 ? p : void 0;
}
function rn(h, c, p, g, w) {
return Ln(typeof p === w ? g[p] : void 0, h.default, c.default);
}
function Jn(h, c, p) {
if (kt(p) !== "number")
return Ln(h.default, c.default);
const g = h.stops.length;
if (g === 1 || p <= h.stops[0][0])
return h.stops[0][1];
if (p >= h.stops[g - 1][0])
return h.stops[g - 1][1];
const w = mt(h.stops.map((H) => H[0]), p);
return h.stops[w][1];
}
function wi(h, c, p) {
const g = h.base !== void 0 ? h.base : 1;
if (kt(p) !== "number")
return Ln(h.default, c.default);
const w = h.stops.length;
if (w === 1 || p <= h.stops[0][0])
return h.stops[0][1];
if (p >= h.stops[w - 1][0])
return h.stops[w - 1][1];
const H = mt(h.stops.map((W) => W[0]), p), A = function(W, X, tt, at) {
const ut = at - tt, Tt = W - tt;
return ut === 0 ? 0 : X === 1 ? Tt / ut : (Math.pow(X, Tt) - 1) / (Math.pow(X, ut) - 1);
}(p, g, h.stops[H][0], h.stops[H + 1][0]), C = h.stops[H][1], N = h.stops[H + 1][1], z = xr[c.type] || Fe;
return typeof C.evaluate == "function" ? { evaluate(...W) {
const X = C.evaluate.apply(void 0, W), tt = N.evaluate.apply(void 0, W);
if (X !== void 0 && tt !== void 0)
return z(X, tt, A, h.colorSpace);
} } : z(C, N, A, h.colorSpace);
}
function To(h, c, p) {
switch (c.type) {
case "color":
p = tn.parse(p);
break;
case "formatted":
p = Xr.fromString(p.toString());
break;
case "resolvedImage":
p = pn.fromString(p.toString());
break;
case "padding":
p = Yn.parse(p);
break;
default:
kt(p) === c.type || c.type === "enum" && c.values[p] || (p = void 0);
}
return Ln(p, h.default, c.default);
}
po.register(Co, { error: [{ kind: "error" }, [Dr], (h, [c]) => {
throw new jn(c.evaluate(h));
}], typeof: [Dr, [wr], (h, [c]) => st(Qn(c.evaluate(h)))], "to-rgba": [ot(xe, 4), [Vn], (h, [c]) => {
const [p, g, w, H] = c.evaluate(h).rgb;
return [255 * p, 255 * g, 255 * w, H];
}], rgb: [Vn, [xe, xe, xe], Jo], rgba: [Vn, [xe, xe, xe, xe], Jo], has: { type: _r, overloads: [[[Dr], (h, [c]) => H0(c.evaluate(h), h.properties())], [[Dr, y1], (h, [c, p]) => H0(c.evaluate(h), p.evaluate(h))]] }, get: { type: wr, overloads: [[[Dr], (h, [c]) => M2(c.evaluate(h), h.properties())], [[Dr, y1], (h, [c, p]) => M2(c.evaluate(h), p.evaluate(h))]] }, "feature-state": [wr, [Dr], (h, [c]) => M2(c.evaluate(h), h.featureState || {})], properties: [y1, [], (h) => h.properties()], "geometry-type": [Dr, [], (h) => h.geometryType()], id: [wr, [], (h) => h.id()], zoom: [xe, [], (h) => h.globals.zoom], "heatmap-density": [xe, [], (h) => h.globals.heatmapDensity || 0], "line-progress": [xe, [], (h) => h.globals.lineProgress || 0], accumulated: [wr, [], (h) => h.globals.accumulated === void 0 ? null : h.globals.accumulated], "+": [xe, as(xe), (h, c) => {
let p = 0;
for (const g of c)
p += g.evaluate(h);
return p;
}], "*": [xe, as(xe), (h, c) => {
let p = 1;
for (const g of c)
p *= g.evaluate(h);
return p;
}], "-": { type: xe, overloads: [[[xe, xe], (h, [c, p]) => c.evaluate(h) - p.evaluate(h)], [[xe], (h, [c]) => -c.evaluate(h)]] }, "/": [xe, [xe, xe], (h, [c, p]) => c.evaluate(h) / p.evaluate(h)], "%": [xe, [xe, xe], (h, [c, p]) => c.evaluate(h) % p.evaluate(h)], ln2: [xe, [], () => Math.LN2], pi: [xe, [], () => Math.PI], e: [xe, [], () => Math.E], "^": [xe, [xe, xe], (h, [c, p]) => Math.pow(c.evaluate(h), p.evaluate(h))], sqrt: [xe, [xe], (h, [c]) => Math.sqrt(c.evaluate(h))], log10: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h)) / Math.LN10], ln: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h))], log2: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h)) / Math.LN2], sin: [xe, [xe], (h, [c]) => Math.sin(c.evaluate(h))], cos: [xe, [xe], (h, [c]) => Math.cos(c.evaluate(h))], tan: [xe, [xe], (h, [c]) => Math.tan(c.evaluate(h))], asin: [xe, [xe], (h, [c]) => Math.asin(c.evaluate(h))], acos: [xe, [xe], (h, [c]) => Math.acos(c.evaluate(h))], atan: [xe, [xe], (h, [c]) => Math.atan(c.evaluate(h))], min: [xe, as(xe), (h, c) => Math.min(...c.map((p) => p.evaluate(h)))], max: [xe, as(xe), (h, c) => Math.max(...c.map((p) => p.evaluate(h)))], abs: [xe, [xe], (h, [c]) => Math.abs(c.evaluate(h))], round: [xe, [xe], (h, [c]) => {
const p = c.evaluate(h);
return p < 0 ? -Math.round(-p) : Math.round(p);
}], floor: [xe, [xe], (h, [c]) => Math.floor(c.evaluate(h))], ceil: [xe, [xe], (h, [c]) => Math.ceil(c.evaluate(h))], "filter-==": [_r, [Dr, wr], (h, [c, p]) => h.properties()[c.value] === p.value], "filter-id-==": [_r, [wr], (h, [c]) => h.id() === c.value], "filter-type-==": [_r, [Dr], (h, [c]) => h.geometryType() === c.value], "filter-<": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g < w;
}], "filter-id-<": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p < g;
}], "filter->": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g > w;
}], "filter-id->": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p > g;
}], "filter-<=": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g <= w;
}], "filter-id-<=": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p <= g;
}], "filter->=": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g >= w;
}], "filter-id->=": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p >= g;
}], "filter-has": [_r, [wr], (h, [c]) => c.value in h.properties()], "filter-has-id": [_r, [], (h) => h.id() !== null && h.id() !== void 0], "filter-type-in": [_r, [ot(Dr)], (h, [c]) => c.value.indexOf(h.geometryType()) >= 0], "filter-id-in": [_r, [ot(wr)], (h, [c]) => c.value.indexOf(h.id()) >= 0], "filter-in-small": [_r, [Dr, ot(wr)], (h, [c, p]) => p.value.indexOf(h.properties()[c.value]) >= 0], "filter-in-large": [_r, [Dr, ot(wr)], (h, [c, p]) => function(g, w, H, A) {
for (; H <= A; ) {
const C = H + A >> 1;
if (w[C] === g)
return !0;
w[C] > g ? A = C - 1 : H = C + 1;
}
return !1;
}(h.properties()[c.value], p.value, 0, p.value.length - 1)], all: { type: _r, overloads: [[[_r, _r], (h, [c, p]) => c.evaluate(h) && p.evaluate(h)], [as(_r), (h, c) => {
for (const p of c)
if (!p.evaluate(h))
return !1;
return !0;
}]] }, any: { type: _r, overloads: [[[_r, _r], (h, [c, p]) => c.evaluate(h) || p.evaluate(h)], [as(_r), (h, c) => {
for (const p of c)
if (p.evaluate(h))
return !0;
return !1;
}]] }, "!": [_r, [_r], (h, [c]) => !c.evaluate(h)], "is-supported-script": [_r, [Dr], (h, [c]) => {
const p = h.globals && h.globals.isSupportedScript;
return !p || p(c.evaluate(h));
}], upcase: [Dr, [Dr], (h, [c]) => c.evaluate(h).toUpperCase()], downcase: [Dr, [Dr], (h, [c]) => c.evaluate(h).toLowerCase()], concat: [Dr, as(wr), (h, c) => c.map((p) => Ui(p.evaluate(h))).join("")], "resolved-locale": [Dr, [Pi], (h, [c]) => c.evaluate(h).resolvedLocale()] });
class gi {
constructor(c, p) {
var g;
this.expression = c, this._warningHistory = {}, this._evaluator = new ma(), this._defaultValue = p ? (g = p).type === "color" && ne(g.default) ? new tn(0, 0, 0, 0) : g.type === "color" ? tn.parse(g.default) || null : g.type === "padding" ? Yn.parse(g.default) || null : g.type === "variableAnchorOffsetCollection" ? _n.parse(g.default) || null : g.default === void 0 ? null : g.default : null, this._enumValues = p && p.type === "enum" ? p.values : null;
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._evaluator.globals = c, this._evaluator.feature = p, this._evaluator.featureState = g, this._evaluator.canonical = w, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A, this.expression.evaluate(this._evaluator);
}
evaluate(c, p, g, w, H, A) {
this._evaluator.globals = c, this._evaluator.feature = p || null, this._evaluator.featureState = g || null, this._evaluator.canonical = w, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A || null;
try {
const C = this.expression.evaluate(this._evaluator);
if (C == null || typeof C == "number" && C != C)
return this._defaultValue;
if (this._enumValues && !(C in this._enumValues))
throw new jn(`Expected value to be one of ${Object.keys(this._enumValues).map((N) => JSON.stringify(N)).join(", ")}, but found ${JSON.stringify(C)} instead.`);
return C;
} catch (C) {
return this._warningHistory[C.message] || (this._warningHistory[C.message] = !0, typeof console < "u" && console.warn(C.message)), this._defaultValue;
}
}
}
function yi(h) {
return Array.isArray(h) && h.length > 0 && typeof h[0] == "string" && h[0] in Co;
}
function _1(h, c) {
const p = new Xo(Co, V3, [], c ? function(w) {
const H = { color: Vn, string: Dr, number: xe, enum: Dr, boolean: _r, formatted: H1, padding: Vi, resolvedImage: Rn, variableAnchorOffsetCollection: xt };
return w.type === "array" ? ot(H[w.value] || wr, w.length) : H[w.type];
}(c) : void 0), g = p.parse(h, void 0, void 0, void 0, c && c.type === "string" ? { typeAnnotation: "coerce" } : void 0);
return g ? R3(new gi(g, c)) : Us(p.errors);
}
class A1 {
constructor(c, p) {
this.kind = c, this._styleExpression = p, this.isStateDependent = c !== "constant" && !cs(p.expression);
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, w, H, A);
}
evaluate(c, p, g, w, H, A) {
return this._styleExpression.evaluate(c, p, g, w, H, A);
}
}
class Ai {
constructor(c, p, g, w) {
this.kind = c, this.zoomStops = g, this._styleExpression = p, this.isStateDependent = c !== "camera" && !cs(p.expression), this.interpolationType = w;
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, w, H, A);
}
evaluate(c, p, g, w, H, A) {
return this._styleExpression.evaluate(c, p, g, w, H, A);
}
interpolationFactor(c, p, g) {
return this.interpolationType ? un.interpolationFactor(this.interpolationType, c, p, g) : 0;
}
}
function ko(h, c) {
const p = _1(h, c);
if (p.result === "error")
return p;
const g = p.value.expression, w = ls(g);
if (!w && !t2(c))
return Us([new Xn("", "data expressions not supported")]);
const H = La(g, ["zoom"]);
if (!H && !A0(c))
return Us([new Xn("", "zoom expressions not supported")]);
const A = us(g);
return A || H ? A instanceof Xn ? Us([A]) : A instanceof un && !O0(c) ? Us([new Xn("", '"interpolate" expressions cannot be used with this property')]) : R3(A ? new Ai(w ? "camera" : "composite", p.value, A.labels, A instanceof un ? A.interpolation : void 0) : new A1(w ? "constant" : "source", p.value)) : Us([new Xn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
}
class Io {
constructor(c, p) {
this._parameters = c, this._specification = p, bi(this, Lr(this._parameters, this._specification));
}
static deserialize(c) {
return new Io(c._parameters, c._specification);
}
static serialize(c) {
return { _parameters: c._parameters, _specification: c._specification };
}
}
function us(h) {
let c = null;
if (h instanceof ho)
c = us(h.result);
else if (h instanceof dr) {
for (const p of h.args)
if (c = us(p), c)
break;
} else
(h instanceof qt || h instanceof un) && h.input instanceof po && h.input.name === "zoom" && (c = h);
return c instanceof Xn || h.eachChild((p) => {
const g = us(p);
g instanceof Xn ? c = g : !c && g ? c = new Xn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : c && g && c !== g && (c = new Xn("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));
}), c;
}
function S2(h) {
if (h === !0 || h === !1)
return !0;
if (!Array.isArray(h) || h.length === 0)
return !1;
switch (h[0]) {
case "has":
return h.length >= 2 && h[1] !== "$id" && h[1] !== "$type";
case "in":
return h.length >= 3 && (typeof h[1] != "string" || Array.isArray(h[2]));
case "!in":
case "!has":
case "none":
return !1;
case "==":
case "!=":
case ">":
case ">=":
case "<":
case "<=":
return h.length !== 3 || Array.isArray(h[1]) || Array.isArray(h[2]);
case "any":
case "all":
for (const c of h.slice(1))
if (!S2(c) && typeof c != "boolean")
return !1;
return !0;
default:
return !0;
}
}
const hs = { type: "boolean", default: !1, transition: !1, "property-type": "data-driven", expression: { interpolated: !1, parameters: ["zoom", "feature"] } };
function K4(h) {
if (h == null)
return { filter: () => !0, needGeometry: !1 };
S2(h) || (h = wn(h));
const c = _1(h, hs);
if (c.result === "error")
throw new Error(c.value.map((p) => `${p.key}: ${p.message}`).join(", "));
return { filter: (p, g, w) => c.value.evaluate(p, g, {}, w), needGeometry: xl(h) };
}
function xc(h, c) {
return h < c ? -1 : h > c ? 1 : 0;
}
function xl(h) {
if (!Array.isArray(h))
return !1;
if (h[0] === "within" || h[0] === "distance")
return !0;
for (let c = 1; c < h.length; c++)
if (xl(h[c]))
return !0;
return !1;
}
function wn(h) {
if (!h)
return !0;
const c = h[0];
return h.length <= 1 ? c !== "any" : c === "==" ? mn(h[1], h[2], "==") : c === "!=" ? Gi(mn(h[1], h[2], "==")) : c === "<" || c === ">" || c === "<=" || c === ">=" ? mn(h[1], h[2], c) : c === "any" ? (p = h.slice(1), ["any"].concat(p.map(wn))) : c === "all" ? ["all"].concat(h.slice(1).map(wn)) : c === "none" ? ["all"].concat(h.slice(1).map(wn).map(Gi)) : c === "in" ? ds(h[1], h.slice(2)) : c === "!in" ? Gi(ds(h[1], h.slice(2))) : c === "has" ? fo(h[1]) : c !== "!has" || Gi(fo(h[1]));
var p;
}
function mn(h, c, p) {
switch (h) {
case "$type":
return [`filter-type-${p}`, c];
case "$id":
return [`filter-id-${p}`, c];
default:
return [`filter-${p}`, h, c];
}
}
function ds(h, c) {
if (c.length === 0)
return !1;
switch (h) {
case "$type":
return ["filter-type-in", ["literal", c]];
case "$id":
return ["filter-id-in", ["literal", c]];
default:
return c.length > 200 && !c.some((p) => typeof p != typeof c[0]) ? ["filter-in-large", h, ["literal", c.sort(xc)]] : ["filter-in-small", h, ["literal", c]];
}
}
function fo(h) {
switch (h) {
case "$type":
return !0;
case "$id":
return ["filter-has-id"];
default:
return ["filter-has", h];
}
}
function Gi(h) {
return ["!", h];
}
function $i(h) {
const c = typeof h;
if (c === "number" || c === "boolean" || c === "string" || h == null)
return JSON.stringify(h);
if (Array.isArray(h)) {
let w = "[";
for (const H of h)
w += `${$i(H)},`;
return `${w}]`;
}
const p = Object.keys(h).sort();
let g = "{";
for (let w = 0; w < p.length; w++)
g += `${JSON.stringify(p[w])}:${$i(h[p[w]])},`;
return `${g}}`;
}
function e2(h) {
let c = "";
for (const p of en)
c += `/${$i(h[p])}`;
return c;
}
function H2(h) {
const c = h.value;
return c ? [new ye(h.key, c, "constants have been deprecated as of v8")] : [];
}
function Dn(h) {
return h instanceof Number || h instanceof String || h instanceof Boolean ? h.valueOf() : h;
}
function O1(h) {
if (Array.isArray(h))
return h.map(O1);
if (h instanceof Object && !(h instanceof Number || h instanceof String || h instanceof Boolean)) {
const c = {};
for (const p in h)
c[p] = O1(h[p]);
return c;
}
return Dn(h);
}
function Wi(h) {
const c = h.key, p = h.value, g = h.valueSpec || {}, w = h.objectElementValidators || {}, H = h.style, A = h.styleSpec, C = h.validateSpec;
let N = [];
const z = kt(p);
if (z !== "object")
return [new ye(c, p, `object expected, ${z} found`)];
for (const W in p) {
const X = W.split(".")[0], tt = g[X] || g["*"];
let at;
if (w[X])
at = w[X];
else if (g[X])
at = C;
else if (w["*"])
at = w["*"];
else {
if (!g["*"]) {
N.push(new ye(c, p[W], `unknown property "${W}"`));
continue;
}
at = C;
}
N = N.concat(at({ key: (c && `${c}.`) + W, value: p[W], valueSpec: tt, style: H, styleSpec: A, object: p, objectKey: W, validateSpec: C }, p));
}
for (const W in g)
w[W] || g[W].required && g[W].default === void 0 && p[W] === void 0 && N.push(new ye(c, p, `missing required property "${W}"`));
return N;
}
function Po(h) {
const c = h.value, p = h.valueSpec, g = h.style, w = h.styleSpec, H = h.key, A = h.arrayElementValidator || h.validateSpec;
if (kt(c) !== "array")
return [new ye(H, c, `array expected, ${kt(c)} found`)];
if (p.length && c.length !== p.length)
return [new ye(H, c, `array length ${p.length} expected, length ${c.length} found`)];
if (p["min-length"] && c.length < p["min-length"])
return [new ye(H, c, `array length at least ${p["min-length"]} expected, length ${c.length} found`)];
let C = { type: p.value, values: p.values };
w.$version < 7 && (C.function = p.function), kt(p.value) === "object" && (C = p.value);
let N = [];
for (let z = 0; z < c.length; z++)
N = N.concat(A({ array: c, arrayIndex: z, value: c[z], valueSpec: C, validateSpec: h.validateSpec, style: g, styleSpec: w, key: `${H}[${z}]` }));
return N;
}
function Y4(h) {
const c = h.key, p = h.value, g = h.valueSpec;
let w = kt(p);
return w === "number" && p != p && (w = "NaN"), w !== "number" ? [new ye(c, p, `number expected, ${w} found`)] : "minimum" in g && p < g.minimum ? [new ye(c, p, `${p} is less than the minimum value ${g.minimum}`)] : "maximum" in g && p > g.maximum ? [new ye(c, p, `${p} is greater than the maximum value ${g.maximum}`)] : [];
}
function Gs(h) {
const c = h.valueSpec, p = Dn(h.value.type);
let g, w, H, A = {};
const C = p !== "categorical" && h.value.property === void 0, N = !C, z = kt(h.value.stops) === "array" && kt(h.value.stops[0]) === "array" && kt(h.value.stops[0][0]) === "object", W = Wi({ key: h.key, value: h.value, valueSpec: h.styleSpec.function, validateSpec: h.validateSpec, style: h.style, styleSpec: h.styleSpec, objectElementValidators: { stops: function(at) {
if (p === "identity")
return [new ye(at.key, at.value, 'identity function may not have a "stops" property')];
let ut = [];
const Tt = at.value;
return ut = ut.concat(Po({ key: at.key, value: Tt, valueSpec: at.valueSpec, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec, arrayElementValidator: X })), kt(Tt) === "array" && Tt.length === 0 && ut.push(new ye(at.key, Tt, "array must have at least one stop")), ut;
}, default: function(at) {
return at.validateSpec({ key: at.key, value: at.value, valueSpec: c, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec });
} } });
return p === "identity" && C && W.push(new ye(h.key, h.value, 'missing required property "property"')), p === "identity" || h.value.stops || W.push(new ye(h.key, h.value, 'missing required property "stops"')), p === "exponential" && h.valueSpec.expression && !O0(h.valueSpec) && W.push(new ye(h.key, h.value, "exponential functions not supported")), h.styleSpec.$version >= 8 && (N && !t2(h.valueSpec) ? W.push(new ye(h.key, h.value, "property functions not supported")) : C && !A0(h.valueSpec) && W.push(new ye(h.key, h.value, "zoom functions not supported"))), p !== "categorical" && !z || h.value.property !== void 0 || W.push(new ye(h.key, h.value, '"property" property is required')), W;
function X(at) {
let ut = [];
const Tt = at.value, Lt = at.key;
if (kt(Tt) !== "array")
return [new ye(Lt, Tt, `array expected, ${kt(Tt)} found`)];
if (Tt.length !== 2)
return [new ye(Lt, Tt, `array length 2 expected, length ${Tt.length} found`)];
if (z) {
if (kt(Tt[0]) !== "object")
return [new ye(Lt, Tt, `object expected, ${kt(Tt[0])} found`)];
if (Tt[0].zoom === void 0)
return [new ye(Lt, Tt, "object stop key must have zoom")];
if (Tt[0].value === void 0)
return [new ye(Lt, Tt, "object stop key must have value")];
if (H && H > Dn(Tt[0].zoom))
return [new ye(Lt, Tt[0].zoom, "stop zoom values must appear in ascending order")];
Dn(Tt[0].zoom) !== H && (H = Dn(Tt[0].zoom), w = void 0, A = {}), ut = ut.concat(Wi({ key: `${Lt}[0]`, value: Tt[0], valueSpec: { zoom: {} }, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec, objectElementValidators: { zoom: Y4, value: tt } }));
} else
ut = ut.concat(tt({ key: `${Lt}[0]`, value: Tt[0], valueSpec: {}, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec }, Tt));
return yi(O1(Tt[1])) ? ut.concat([new ye(`${Lt}[1]`, Tt[1], "expressions are not allowed in function stops.")]) : ut.concat(at.validateSpec({ key: `${Lt}[1]`, value: Tt[1], valueSpec: c, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec }));
}
function tt(at, ut) {
const Tt = kt(at.value), Lt = Dn(at.value), Et = at.value !== null ? at.value : ut;
if (g) {
if (Tt !== g)
return [new ye(at.key, Et, `${Tt} stop domain type must match previous stop domain type ${g}`)];
} else
g = Tt;
if (Tt !== "number" && Tt !== "string" && Tt !== "boolean")
return [new ye(at.key, Et, "stop domain value must be a number, string, or boolean")];
if (Tt !== "number" && p !== "categorical") {
let $t = `number expected, ${Tt} found`;
return t2(c) && p === void 0 && ($t += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new ye(at.key, Et, $t)];
}
return p !== "categorical" || Tt !== "number" || isFinite(Lt) && Math.floor(Lt) === Lt ? p !== "categorical" && Tt === "number" && w !== void 0 && Lt < w ? [new ye(at.key, Et, "stop domain values must appear in ascending order")] : (w = Lt, p === "categorical" && Lt in A ? [new ye(at.key, Et, "stop domain values must be unique")] : (A[Lt] = !0, [])) : [new ye(at.key, Et, `integer expected, found ${Lt}`)];
}
}
function ps(h) {
const c = (h.expressionContext === "property" ? ko : _1)(O1(h.value), h.valueSpec);
if (c.result === "error")
return c.value.map((g) => new ye(`${h.key}${g.key}`, h.value, g.message));
const p = c.value.expression || c.value._styleExpression.expression;
if (h.expressionContext === "property" && h.propertyKey === "text-font" && !p.outputDefined())
return [new ye(h.key, h.value, `Invalid data expression for "${h.propertyKey}". Output values must be contained as literals within the expression.`)];
if (h.expressionContext === "property" && h.propertyType === "layout" && !cs(p))
return [new ye(h.key, h.value, '"feature-state" data expressions are not supported with layout properties.')];
if (h.expressionContext === "filter" && !cs(p))
return [new ye(h.key, h.value, '"feature-state" data expressions are not supported with filters.')];
if (h.expressionContext && h.expressionContext.indexOf("cluster") === 0) {
if (!La(p, ["zoom", "feature-state"]))
return [new ye(h.key, h.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
if (h.expressionContext === "cluster-initial" && !ls(p))
return [new ye(h.key, h.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
}
return [];
}
function Qo(h) {
const c = h.key, p = h.value, g = h.valueSpec, w = [];
return Array.isArray(g.values) ? g.values.indexOf(Dn(p)) === -1 && w.push(new ye(c, p, `expected one of [${g.values.join(", ")}], ${JSON.stringify(p)} found`)) : Object.keys(g.values).indexOf(Dn(p)) === -1 && w.push(new ye(c, p, `expected one of [${Object.keys(g.values).join(", ")}], ${JSON.stringify(p)} found`)), w;
}
function wa(h) {
return S2(O1(h.value)) ? ps(bi({}, h, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : N3(h);
}
function N3(h) {
const c = h.value, p = h.key;
if (kt(c) !== "array")
return [new ye(p, c, `array expected, ${kt(c)} found`)];
const g = h.styleSpec;
let w, H = [];
if (c.length < 1)
return [new ye(p, c, "filter array must have at least 1 element")];
switch (H = H.concat(Qo({ key: `${p}[0]`, value: c[0], valueSpec: g.filter_operator, style: h.style, styleSpec: h.styleSpec })), Dn(c[0])) {
case "<":
case "<=":
case ">":
case ">=":
c.length >= 2 && Dn(c[1]) === "$type" && H.push(new ye(p, c, `"$type" cannot be use with operator "${c[0]}"`));
case "==":
case "!=":
c.length !== 3 && H.push(new ye(p, c, `filter array for operator "${c[0]}" must have 3 elements`));
case "in":
case "!in":
c.length >= 2 && (w = kt(c[1]), w !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${w} found`)));
for (let A = 2; A < c.length; A++)
w = kt(c[A]), Dn(c[1]) === "$type" ? H = H.concat(Qo({ key: `${p}[${A}]`, value: c[A], valueSpec: g.geometry_type, style: h.style, styleSpec: h.styleSpec })) : w !== "string" && w !== "number" && w !== "boolean" && H.push(new ye(`${p}[${A}]`, c[A], `string, number, or boolean expected, ${w} found`));
break;
case "any":
case "all":
case "none":
for (let A = 1; A < c.length; A++)
H = H.concat(N3({ key: `${p}[${A}]`, value: c[A], style: h.style, styleSpec: h.styleSpec }));
break;
case "has":
case "!has":
w = kt(c[1]), c.length !== 2 ? H.push(new ye(p, c, `filter array for "${c[0]}" operator must have 2 elements`)) : w !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${w} found`));
}
return H;
}
function xa(h, c) {
const p = h.key, g = h.validateSpec, w = h.style, H = h.styleSpec, A = h.value, C = h.objectKey, N = H[`${c}_${h.layerType}`];
if (!N)
return [];
const z = C.match(/^(.*)-transition$/);
if (c === "paint" && z && N[z[1]] && N[z[1]].transition)
return g({ key: p, value: A, valueSpec: H.transition, style: w, styleSpec: H });
const W = h.valueSpec || N[C];
if (!W)
return [new ye(p, A, `unknown property "${C}"`)];
let X;
if (kt(A) === "string" && t2(W) && !W.tokens && (X = /^{([^}]+)}$/.exec(A)))
return [new ye(p, A, `"${C}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(X[1])} }\`.`)];
const tt = [];
return h.layerType === "symbol" && (C === "text-field" && w && !w.glyphs && tt.push(new ye(p, A, 'use of "text-field" requires a style "glyphs" property')), C === "text-font" && ne(O1(A)) && Dn(A.type) === "identity" && tt.push(new ye(p, A, '"text-font" does not support identity functions'))), tt.concat(g({ key: h.key, value: A, valueSpec: W, style: w, styleSpec: H, expressionContext: "property", propertyType: c, propertyKey: C }));
}
function $s(h) {
return xa(h, "paint");
}
function Ec(h) {
return xa(h, "layout");
}
function Mc(h) {
let c = [];
const p = h.value, g = h.key, w = h.style, H = h.styleSpec;
p.type || p.ref || c.push(new ye(g, p, 'either "type" or "ref" is required'));
let A = Dn(p.type);
const C = Dn(p.ref);
if (p.id) {
const N = Dn(p.id);
for (let z = 0; z < h.arrayIndex; z++) {
const W = w.layers[z];
Dn(W.id) === N && c.push(new ye(g, p.id, `duplicate layer id "${p.id}", previously used at line ${W.id.__line__}`));
}
}
if ("ref" in p) {
let N;
["type", "source", "source-layer", "filter", "layout"].forEach((z) => {
z in p && c.push(new ye(g, p[z], `"${z}" is prohibited for ref layers`));
}), w.layers.forEach((z) => {
Dn(z.id) === C && (N = z);
}), N ? N.ref ? c.push(new ye(g, p.ref, "ref cannot reference another ref layer")) : A = Dn(N.type) : c.push(new ye(g, p.ref, `ref layer "${C}" not found`));
} else if (A !== "background")
if (p.source) {
const N = w.sources && w.sources[p.source], z = N && Dn(N.type);
N ? z === "vector" && A === "raster" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a raster source`)) : z !== "raster-dem" && A === "hillshade" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a raster-dem source`)) : z === "raster" && A !== "raster" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a vector source`)) : z !== "vector" || p["source-layer"] ? z === "raster-dem" && A !== "hillshade" ? c.push(new ye(g, p.source, "raster-dem source can only be used with layer type 'hillshade'.")) : A !== "line" || !p.paint || !p.paint["line-gradient"] || z === "geojson" && N.lineMetrics || c.push(new ye(g, p, `layer "${p.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : c.push(new ye(g, p, `layer "${p.id}" must specify a "source-layer"`)) : c.push(new ye(g, p.source, `source "${p.source}" not found`));
} else
c.push(new ye(g, p, 'missing required property "source"'));
return c = c.concat(Wi({ key: g, value: p, valueSpec: H.layer, style: h.style, styleSpec: h.styleSpec, validateSpec: h.validateSpec, objectElementValidators: { "*": () => [], type: () => h.validateSpec({ key: `${g}.type`, value: p.type, valueSpec: H.layer.type, style: h.style, styleSpec: h.styleSpec, validateSpec: h.validateSpec, object: p, objectKey: "type" }), filter: wa, layout: (N) => Wi({ layer: p, key: N.key, value: N.value, style: N.style, styleSpec: N.styleSpec, validateSpec: N.validateSpec, objectElementValidators: { "*": (z) => Ec(bi({ layerType: A }, z)) } }), paint: (N) => Wi({ layer: p, key: N.key, value: N.value, style: N.style, styleSpec: N.styleSpec, validateSpec: N.validateSpec, objectElementValidators: { "*": (z) => $s(bi({ layerType: A }, z)) } }) } })), c;
}
function D3(h) {
const c = h.value, p = h.key, g = kt(c);
return g !== "string" ? [new ye(p, c, `string expected, ${g} found`)] : [];
}
const El = { promoteId: function({ key: h, value: c }) {
if (kt(c) === "string")
return D3({ key: h, value: c });
{
const p = [];
for (const g in c)
p.push(...D3({ key: `${h}.${g}`, value: c[g] }));
return p;
}
} };
function C0(h) {
const c = h.value, p = h.key, g = h.styleSpec, w = h.style, H = h.validateSpec;
if (!c.type)
return [new ye(p, c, '"type" is required')];
const A = Dn(c.type);
let C;
switch (A) {
case "vector":
case "raster":
return C = Wi({ key: p, value: c, valueSpec: g[`source_${A.replace("-", "_")}`], style: h.style, styleSpec: g, objectElementValidators: El, validateSpec: H }), C;
case "raster-dem":
return C = function(N) {
var z;
const W = (z = N.sourceName) !== null && z !== void 0 ? z : "", X = N.value, tt = N.styleSpec, at = tt.source_raster_dem, ut = N.style;
let Tt = [];
const Lt = kt(X);
if (X === void 0)
return Tt;
if (Lt !== "object")
return Tt.push(new ye("source_raster_dem", X, `object expected, ${Lt} found`)), Tt;
const Et = Dn(X.encoding) === "custom", $t = ["redFactor", "greenFactor", "blueFactor", "baseShift"], Pt = N.value.encoding ? `"${N.value.encoding}"` : "Default";
for (const Bt in X)
!Et && $t.includes(Bt) ? Tt.push(new ye(Bt, X[Bt], `In "${W}": "${Bt}" is only valid when "encoding" is set to "custom". ${Pt} encoding found`)) : at[Bt] ? Tt = Tt.concat(N.validateSpec({ key: Bt, value: X[Bt], valueSpec: at[Bt], validateSpec: N.validateSpec, style: ut, styleSpec: tt })) : Tt.push(new ye(Bt, X[Bt], `unknown property "${Bt}"`));
return Tt;
}({ sourceName: p, value: c, style: h.style, styleSpec: g, validateSpec: H }), C;
case "geojson":
if (C = Wi({ key: p, value: c, valueSpec: g.source_geojson, style: w, styleSpec: g, validateSpec: H, objectElementValidators: El }), c.cluster)
for (const N in c.clusterProperties) {
const [z, W] = c.clusterProperties[N], X = typeof z == "string" ? [z, ["accumulated"], ["get", N]] : z;
C.push(...ps({ key: `${p}.${N}.map`, value: W, validateSpec: H, expressionContext: "cluster-map" })), C.push(...ps({ key: `${p}.${N}.reduce`, value: X, validateSpec: H, expressionContext: "cluster-reduce" }));
}
return C;
case "video":
return Wi({ key: p, value: c, valueSpec: g.source_video, style: w, validateSpec: H, styleSpec: g });
case "image":
return Wi({ key: p, value: c, valueSpec: g.source_image, style: w, validateSpec: H, styleSpec: g });
case "canvas":
return [new ye(p, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")];
default:
return Qo({ key: `${p}.type`, value: c.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] }, style: w, validateSpec: H, styleSpec: g });
}
}
function Sc(h) {
const c = h.value, p = h.styleSpec, g = p.light, w = h.style;
let H = [];
const A = kt(c);
if (c === void 0)
return H;
if (A !== "object")
return H = H.concat([new ye("light", c, `object expected, ${A} found`)]), H;
for (const C in c) {
const N = C.match(/^(.*)-transition$/);
H = H.concat(N && g[N[1]] && g[N[1]].transition ? h.validateSpec({ key: C, value: c[C], valueSpec: p.transition, validateSpec: h.validateSpec, style: w, styleSpec: p }) : g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
}
return H;
}
function Hc(h) {
const c = h.value, p = h.styleSpec, g = p.sky, w = h.style, H = kt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("sky", c, `object expected, ${H} found`)];
let A = [];
for (const C in c)
A = A.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return A;
}
function Ac(h) {
const c = h.value, p = h.styleSpec, g = p.terrain, w = h.style;
let H = [];
const A = kt(c);
if (c === void 0)
return H;
if (A !== "object")
return H = H.concat([new ye("terrain", c, `object expected, ${A} found`)]), H;
for (const C in c)
H = H.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return H;
}
function Oc(h) {
let c = [];
const p = h.value, g = h.key;
if (Array.isArray(p)) {
const w = [], H = [];
for (const A in p)
p[A].id && w.includes(p[A].id) && c.push(new ye(g, p, `all the sprites' ids must be unique, but ${p[A].id} is duplicated`)), w.push(p[A].id), p[A].url && H.includes(p[A].url) && c.push(new ye(g, p, `all the sprites' URLs must be unique, but ${p[A].url} is duplicated`)), H.push(p[A].url), c = c.concat(Wi({ key: `${g}[${A}]`, value: p[A], valueSpec: { id: { type: "string", required: !0 }, url: { type: "string", required: !0 } }, validateSpec: h.validateSpec }));
return c;
}
return D3({ key: g, value: p });
}
const Ml = { "*": () => [], array: Po, boolean: function(h) {
const c = h.value, p = h.key, g = kt(c);
return g !== "boolean" ? [new ye(p, c, `boolean expected, ${g} found`)] : [];
}, number: Y4, color: function(h) {
const c = h.key, p = h.value, g = kt(p);
return g !== "string" ? [new ye(c, p, `color expected, ${g} found`)] : tn.parse(String(p)) ? [] : [new ye(c, p, `color expected, "${p}" found`)];
}, constants: H2, enum: Qo, filter: wa, function: Gs, layer: Mc, object: Wi, source: C0, light: Sc, sky: Hc, terrain: Ac, projection: function(h) {
const c = h.value, p = h.styleSpec, g = p.projection, w = h.style, H = kt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("projection", c, `object expected, ${H} found`)];
let A = [];
for (const C in c)
A = A.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return A;
}, string: D3, formatted: function(h) {
return D3(h).length === 0 ? [] : ps(h);
}, resolvedImage: function(h) {
return D3(h).length === 0 ? [] : ps(h);
}, padding: function(h) {
const c = h.key, p = h.value;
if (kt(p) === "array") {
if (p.length < 1 || p.length > 4)
return [new ye(c, p, `padding requires 1 to 4 values; ${p.length} values found`)];
const g = { type: "number" };
let w = [];
for (let H = 0; H < p.length; H++)
w = w.concat(h.validateSpec({ key: `${c}[${H}]`, value: p[H], validateSpec: h.validateSpec, valueSpec: g }));
return w;
}
return Y4({ key: c, value: p, valueSpec: {} });
}, variableAnchorOffsetCollection: function(h) {
const c = h.key, p = h.value, g = kt(p), w = h.styleSpec;
if (g !== "array" || p.length < 1 || p.length % 2 != 0)
return [new ye(c, p, "variableAnchorOffsetCollection requires a non-empty array of even length")];
let H = [];
for (let A = 0; A < p.length; A += 2)
H = H.concat(Qo({ key: `${c}[${A}]`, value: p[A], valueSpec: w.layout_symbol["text-anchor"] })), H = H.concat(Po({ key: `${c}[${A + 1}]`, value: p[A + 1], valueSpec: { length: 2, value: "number" }, validateSpec: h.validateSpec, style: h.style, styleSpec: w }));
return H;
}, sprite: Oc };
function J4(h) {
const c = h.value, p = h.valueSpec, g = h.styleSpec;
return h.validateSpec = J4, p.expression && ne(Dn(c)) ? Gs(h) : p.expression && yi(O1(c)) ? ps(h) : p.type && Ml[p.type] ? Ml[p.type](h) : Wi(bi({}, h, { valueSpec: p.type ? g[p.type] : p }));
}
function Tp(h) {
const c = h.value, p = h.key, g = D3(h);
return g.length || (c.indexOf("{fontstack}") === -1 && g.push(new ye(p, c, '"glyphs" url must include a "{fontstack}" token')), c.indexOf("{range}") === -1 && g.push(new ye(p, c, '"glyphs" url must include a "{range}" token'))), g;
}
function r2(h, c = Ct) {
let p = [];
return p = p.concat(J4({ key: "", value: h, valueSpec: c.$root, styleSpec: c, style: h, validateSpec: J4, objectElementValidators: { glyphs: Tp, "*": () => [] } })), h.constants && (p = p.concat(H2({ key: "constants", value: h.constants, style: h, styleSpec: c, validateSpec: J4 }))), Cc(p);
}
function Ts(h) {
return function(c) {
return h({ ...c, validateSpec: J4 });
};
}
function Cc(h) {
return [].concat(h).sort((c, p) => c.line - p.line);
}
function A2(h) {
return function(...c) {
return Cc(h.apply(this, c));
};
}
r2.source = A2(Ts(C0)), r2.sprite = A2(Ts(Oc)), r2.glyphs = A2(Ts(Tp)), r2.light = A2(Ts(Sc)), r2.sky = A2(Ts(Hc)), r2.terrain = A2(Ts(Ac)), r2.layer = A2(Ts(Mc)), r2.filter = A2(Ts(wa)), r2.paintProperty = A2(Ts($s)), r2.layoutProperty = A2(Ts(Ec));
const F3 = r2, p_ = F3.light, T_ = F3.sky, fp = F3.paintProperty, Qp = F3.layoutProperty;
function kc(h, c) {
let p = !1;
if (c && c.length)
for (const g of c)
h.fire(new $e(new Error(g.message))), p = !0;
return p;
}
class t6 {
constructor(c, p, g) {
const w = this.cells = [];
if (c instanceof ArrayBuffer) {
this.arrayBuffer = c;
const A = new Int32Array(this.arrayBuffer);
c = A[0], this.d = (p = A[1]) + 2 * (g = A[2]);
for (let N = 0; N < this.d * this.d; N++) {
const z = A[3 + N], W = A[3 + N + 1];
w.push(z === W ? null : A.subarray(z, W));
}
const C = A[3 + w.length + 1];
this.keys = A.subarray(A[3 + w.length], C), this.bboxes = A.subarray(C), this.insert = this._insertReadonly;
} else {
this.d = p + 2 * g;
for (let A = 0; A < this.d * this.d; A++)
w.push([]);
this.keys = [], this.bboxes = [];
}
this.n = p, this.extent = c, this.padding = g, this.scale = p / c, this.uid = 0;
const H = g / p * c;
this.min = -H, this.max = c + H;
}
insert(c, p, g, w, H) {
this._forEachCell(p, g, w, H, this._insertCell, this.uid++, void 0, void 0), this.keys.push(c), this.bboxes.push(p), this.bboxes.push(g), this.bboxes.push(w), this.bboxes.push(H);
}
_insertReadonly() {
throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.");
}
_insertCell(c, p, g, w, H, A) {
this.cells[H].push(A);
}
query(c, p, g, w, H) {
const A = this.min, C = this.max;
if (c <= A && p <= A && C <= g && C <= w && !H)
return Array.prototype.slice.call(this.keys);
{
const N = [];
return this._forEachCell(c, p, g, w, this._queryCell, N, {}, H), N;
}
}
_queryCell(c, p, g, w, H, A, C, N) {
const z = this.cells[H];
if (z !== null) {
const W = this.keys, X = this.bboxes;
for (let tt = 0; tt < z.length; tt++) {
const at = z[tt];
if (C[at] === void 0) {
const ut = 4 * at;
(N ? N(X[ut + 0], X[ut + 1], X[ut + 2], X[ut + 3]) : c <= X[ut + 2] && p <= X[ut + 3] && g >= X[ut + 0] && w >= X[ut + 1]) ? (C[at] = !0, A.push(W[at])) : C[at] = !1;
}
}
}
}
_forEachCell(c, p, g, w, H, A, C, N) {
const z = this._convertToCellCoord(c), W = this._convertToCellCoord(p), X = this._convertToCellCoord(g), tt = this._convertToCellCoord(w);
for (let at = z; at <= X; at++)
for (let ut = W; ut <= tt; ut++) {
const Tt = this.d * ut + at;
if ((!N || N(this._convertFromCellCoord(at), this._convertFromCellCoord(ut), this._convertFromCellCoord(at + 1), this._convertFromCellCoord(ut + 1))) && H.call(this, c, p, g, w, Tt, A, C, N))
return;
}
}
_convertFromCellCoord(c) {
return (c - this.padding) / this.scale;
}
_convertToCellCoord(c) {
return Math.max(0, Math.min(this.d - 1, Math.floor(c * this.scale) + this.padding));
}
toArrayBuffer() {
if (this.arrayBuffer)
return this.arrayBuffer;
const c = this.cells, p = 3 + this.cells.length + 1 + 1;
let g = 0;
for (let A = 0; A < this.cells.length; A++)
g += this.cells[A].length;
const w = new Int32Array(p + g + this.keys.length + this.bboxes.length);
w[0] = this.extent, w[1] = this.n, w[2] = this.padding;
let H = p;
for (let A = 0; A < c.length; A++) {
const C = c[A];
w[3 + A] = H, w.set(C, H), H += C.length;
}
return w[3 + c.length] = H, w.set(this.keys, H), H += this.keys.length, w[3 + c.length + 1] = H, w.set(this.bboxes, H), H += this.bboxes.length, w.buffer;
}
static serialize(c, p) {
const g = c.toArrayBuffer();
return p && p.push(g), { buffer: g };
}
static deserialize(c) {
return new t6(c.buffer);
}
}
const n2 = {};
function nr(h, c, p = {}) {
if (n2[h])
throw new Error(`${h} is already registered.`);
Object.defineProperty(c, "_classRegistryKey", { value: h, writeable: !1 }), n2[h] = { klass: c, omit: p.omit || [], shallow: p.shallow || [] };
}
nr("Object", Object), nr("TransferableGridIndex", t6), nr("Color", tn), nr("Error", Error), nr("AJAXError", Gt), nr("ResolvedImage", pn), nr("StylePropertyFunction", Io), nr("StyleExpression", gi, { omit: ["_evaluator"] }), nr("ZoomDependentExpression", Ai), nr("ZoomConstantExpression", A1), nr("CompoundExpression", po, { omit: ["_evaluate"] });
for (const h in Co)
Co[h]._classRegistryKey || nr(`Expression_${h}`, Co[h]);
function Sl(h) {
return h && typeof ArrayBuffer < "u" && (h instanceof ArrayBuffer || h.constructor && h.constructor.name === "ArrayBuffer");
}
function Ic(h) {
return h.$name || h.constructor._classRegistryKey;
}
function mp(h) {
return !function(c) {
if (c === null || typeof c != "object")
return !1;
const p = Ic(c);
return !(!p || p === "Object");
}(h) && (h == null || typeof h == "boolean" || typeof h == "number" || typeof h == "string" || h instanceof Boolean || h instanceof Number || h instanceof String || h instanceof Date || h instanceof RegExp || h instanceof Blob || h instanceof Error || Sl(h) || Ve(h) || ArrayBuffer.isView(h) || h instanceof ImageData);
}
function e6(h, c) {
if (mp(h))
return (Sl(h) || Ve(h)) && c && c.push(h), ArrayBuffer.isView(h) && c && c.push(h.buffer), h instanceof ImageData && c && c.push(h.data.buffer), h;
if (Array.isArray(h)) {
const H = [];
for (const A of h)
H.push(e6(A, c));
return H;
}
if (typeof h != "object")
throw new Error("can't serialize object of type " + typeof h);
const p = Ic(h);
if (!p)
throw new Error(`can't serialize object of unregistered class ${h.constructor.name}`);
if (!n2[p])
throw new Error(`${p} is not registered.`);
const { klass: g } = n2[p], w = g.serialize ? g.serialize(h, c) : {};
if (g.serialize) {
if (c && w === c[c.length - 1])
throw new Error("statically serialized object won't survive transfer of $name property");
} else {
for (const H in h) {
if (!h.hasOwnProperty(H) || n2[p].omit.indexOf(H) >= 0)
continue;
const A = h[H];
w[H] = n2[p].shallow.indexOf(H) >= 0 ? A : e6(A, c);
}
h instanceof Error && (w.message = h.message);
}
if (w.$name)
throw new Error("$name property is reserved for worker serialization logic.");
return p !== "Object" && (w.$name = p), w;
}
function r6(h) {
if (mp(h))
return h;
if (Array.isArray(h))
return h.map(r6);
if (typeof h != "object")
throw new Error("can't deserialize object of type " + typeof h);
const c = Ic(h) || "Object";
if (!n2[c])
throw new Error(`can't deserialize unregistered class ${c}`);
const { klass: p } = n2[c];
if (!p)
throw new Error(`can't deserialize unregistered class ${c}`);
if (p.deserialize)
return p.deserialize(h);
const g = Object.create(p.prototype);
for (const w of Object.keys(h)) {
if (w === "$name")
continue;
const H = h[w];
g[w] = n2[c].shallow.indexOf(w) >= 0 ? H : r6(H);
}
return g;
}
class Pc {
constructor() {
this.first = !0;
}
update(c, p) {
const g = Math.floor(c);
return this.first ? (this.first = !1, this.lastIntegerZoom = g, this.lastIntegerZoomTime = 0, this.lastZoom = c, this.lastFloorZoom = g, !0) : (this.lastFloorZoom > g ? (this.lastIntegerZoom = g + 1, this.lastIntegerZoomTime = p) : this.lastFloorZoom < g && (this.lastIntegerZoom = g, this.lastIntegerZoomTime = p), c !== this.lastZoom && (this.lastZoom = c, this.lastFloorZoom = g, !0));
}
}
const sn = { "Latin-1 Supplement": (h) => h >= 128 && h <= 255, "Hangul Jamo": (h) => h >= 4352 && h <= 4607, Khmer: (h) => h >= 6016 && h <= 6143, "General Punctuation": (h) => h >= 8192 && h <= 8303, "Letterlike Symbols": (h) => h >= 8448 && h <= 8527, "Number Forms": (h) => h >= 8528 && h <= 8591, "Miscellaneous Technical": (h) => h >= 8960 && h <= 9215, "Control Pictures": (h) => h >= 9216 && h <= 9279, "Optical Character Recognition": (h) => h >= 9280 && h <= 9311, "Enclosed Alphanumerics": (h) => h >= 9312 && h <= 9471, "Geometric Shapes": (h) => h >= 9632 && h <= 9727, "Miscellaneous Symbols": (h) => h >= 9728 && h <= 9983, "Miscellaneous Symbols and Arrows": (h) => h >= 11008 && h <= 11263, "Ideographic Description Characters": (h) => h >= 12272 && h <= 12287, "CJK Symbols and Punctuation": (h) => h >= 12288 && h <= 12351, Katakana: (h) => h >= 12448 && h <= 12543, Kanbun: (h) => h >= 12688 && h <= 12703, "CJK Strokes": (h) => h >= 12736 && h <= 12783, "Enclosed CJK Letters and Months": (h) => h >= 12800 && h <= 13055, "CJK Compatibility": (h) => h >= 13056 && h <= 13311, "Yijing Hexagram Symbols": (h) => h >= 19904 && h <= 19967, "Private Use Area": (h) => h >= 57344 && h <= 63743, "Vertical Forms": (h) => h >= 65040 && h <= 65055, "CJK Compatibility Forms": (h) => h >= 65072 && h <= 65103, "Small Form Variants": (h) => h >= 65104 && h <= 65135, "Halfwidth and Fullwidth Forms": (h) => h >= 65280 && h <= 65519 };
function Vc(h) {
for (const c of h)
if (Nc(c.charCodeAt(0)))
return !0;
return !1;
}
function f_(h) {
for (const c of h)
if (!n6(c.charCodeAt(0)))
return !1;
return !0;
}
function Rc(h) {
const c = h.map((p) => {
try {
return new RegExp(`\\p{sc=${p}}`, "u").source;
} catch {
return null;
}
}).filter((p) => p);
return new RegExp(c.join("|"), "u");
}
const Q_ = Rc(["Arab", "Dupl", "Mong", "Ougr", "Syrc"]);
function n6(h) {
return !Q_.test(String.fromCodePoint(h));
}
const gp = Rc(["Bopo", "Hani", "Hira", "Kana", "Kits", "Nshu", "Tang", "Yiii"]);
function Nc(h) {
return !(h !== 746 && h !== 747 && (h < 4352 || !(sn["CJK Compatibility Forms"](h) && !(h >= 65097 && h <= 65103) || sn["CJK Compatibility"](h) || sn["CJK Strokes"](h) || !(!sn["CJK Symbols and Punctuation"](h) || h >= 12296 && h <= 12305 || h >= 12308 && h <= 12319 || h === 12336) || sn["Enclosed CJK Letters and Months"](h) || sn["Ideographic Description Characters"](h) || sn.Kanbun(h) || sn.Katakana(h) && h !== 12540 || !(!sn["Halfwidth and Fullwidth Forms"](h) || h === 65288 || h === 65289 || h === 65293 || h >= 65306 && h <= 65310 || h === 65339 || h === 65341 || h === 65343 || h >= 65371 && h <= 65503 || h === 65507 || h >= 65512 && h <= 65519) || !(!sn["Small Form Variants"](h) || h >= 65112 && h <= 65118 || h >= 65123 && h <= 65126) || sn["Vertical Forms"](h) || sn["Yijing Hexagram Symbols"](h) || new RegExp("\\p{sc=Cans}", "u").test(String.fromCodePoint(h)) || new RegExp("\\p{sc=Hang}", "u").test(String.fromCodePoint(h)) || gp.test(String.fromCodePoint(h)))));
}
function yp(h) {
return !(Nc(h) || function(c) {
return !!(sn["Latin-1 Supplement"](c) && (c === 167 || c === 169 || c === 174 || c === 177 || c === 188 || c === 189 || c === 190 || c === 215 || c === 247) || sn["General Punctuation"](c) && (c === 8214 || c === 8224 || c === 8225 || c === 8240 || c === 8241 || c === 8251 || c === 8252 || c === 8258 || c === 8263 || c === 8264 || c === 8265 || c === 8273) || sn["Letterlike Symbols"](c) || sn["Number Forms"](c) || sn["Miscellaneous Technical"](c) && (c >= 8960 && c <= 8967 || c >= 8972 && c <= 8991 || c >= 8996 && c <= 9e3 || c === 9003 || c >= 9085 && c <= 9114 || c >= 9150 && c <= 9165 || c === 9167 || c >= 9169 && c <= 9179 || c >= 9186 && c <= 9215) || sn["Control Pictures"](c) && c !== 9251 || sn["Optical Character Recognition"](c) || sn["Enclosed Alphanumerics"](c) || sn["Geometric Shapes"](c) || sn["Miscellaneous Symbols"](c) && !(c >= 9754 && c <= 9759) || sn["Miscellaneous Symbols and Arrows"](c) && (c >= 11026 && c <= 11055 || c >= 11088 && c <= 11097 || c >= 11192 && c <= 11243) || sn["CJK Symbols and Punctuation"](c) || sn.Katakana(c) || sn["Private Use Area"](c) || sn["CJK Compatibility Forms"](c) || sn["Small Form Variants"](c) || sn["Halfwidth and Fullwidth Forms"](c) || c === 8734 || c === 8756 || c === 8757 || c >= 9984 && c <= 10087 || c >= 10102 && c <= 10131 || c === 65532 || c === 65533);
}(h));
}
const m_ = Rc(["Adlm", "Arab", "Armi", "Avst", "Chrs", "Cprt", "Egyp", "Elym", "Gara", "Hatr", "Hebr", "Hung", "Khar", "Lydi", "Mand", "Mani", "Mend", "Merc", "Mero", "Narb", "Nbat", "Nkoo", "Orkh", "Palm", "Phli", "Phlp", "Phnx", "Prti", "Rohg", "Samr", "Sarb", "Sogo", "Syrc", "Thaa", "Todr", "Yezi"]);
function Dc(h) {
return m_.test(String.fromCodePoint(h));
}
function g_(h, c) {
return !(!c && Dc(h) || h >= 2304 && h <= 3583 || h >= 3840 && h <= 4255 || sn.Khmer(h));
}
function y_(h) {
for (const c of h)
if (Dc(c.charCodeAt(0)))
return !0;
return !1;
}
const Vo = new class {
constructor() {
this.applyArabicShaping = null, this.processBidirectionalText = null, this.processStyledBidirectionalText = null, this.pluginStatus = "unavailable", this.pluginURL = null;
}
setState(h) {
this.pluginStatus = h.pluginStatus, this.pluginURL = h.pluginURL;
}
getState() {
return { pluginStatus: this.pluginStatus, pluginURL: this.pluginURL };
}
setMethods(h) {
this.applyArabicShaping = h.applyArabicShaping, this.processBidirectionalText = h.processBidirectionalText, this.processStyledBidirectionalText = h.processStyledBidirectionalText;
}
isParsed() {
return this.applyArabicShaping != null && this.processBidirectionalText != null && this.processStyledBidirectionalText != null;
}
getPluginURL() {
return this.pluginURL;
}
getRTLTextPluginStatus() {
return this.pluginStatus;
}
}();
class ti {
constructor(c, p) {
this.zoom = c, p ? (this.now = p.now, this.fadeDuration = p.fadeDuration, this.zoomHistory = p.zoomHistory, this.transition = p.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Pc(), this.transition = {});
}
isSupportedScript(c) {
return function(p, g) {
for (const w of p)
if (!g_(w.charCodeAt(0), g))
return !1;
return !0;
}(c, Vo.getRTLTextPluginStatus() === "loaded");
}
crossFadingFactor() {
return this.fadeDuration === 0 ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);
}
getCrossfadeParameters() {
const c = this.zoom, p = c - Math.floor(c), g = this.crossFadingFactor();
return c > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: p + (1 - p) * g } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - g) * p };
}
}
class i6 {
constructor(c, p) {
this.property = c, this.value = p, this.expression = function(g, w) {
if (ne(g))
return new Io(g, w);
if (yi(g)) {
const H = ko(g, w);
if (H.result === "error")
throw new Error(H.value.map((A) => `${A.key}: ${A.message}`).join(", "));
return H.value;
}
{
let H = g;
return w.type === "color" && typeof g == "string" ? H = tn.parse(g) : w.type !== "padding" || typeof g != "number" && !Array.isArray(g) ? w.type === "variableAnchorOffsetCollection" && Array.isArray(g) && (H = _n.parse(g)) : H = Yn.parse(g), { kind: "constant", evaluate: () => H };
}
}(p === void 0 ? c.specification.default : p, c.specification);
}
isDataDriven() {
return this.expression.kind === "source" || this.expression.kind === "composite";
}
possiblyEvaluate(c, p, g) {
return this.property.possiblyEvaluate(this, c, p, g);
}
}
class Hl {
constructor(c) {
this.property = c, this.value = new i6(c, void 0);
}
transitioned(c, p) {
return new vp(this.property, this.value, p, $({}, c.transition, this.transition), c.now);
}
untransitioned() {
return new vp(this.property, this.value, null, {}, 0);
}
}
class Al {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitionablePropertyValues);
}
getValue(c) {
return rt(this._values[c].value.value);
}
setValue(c, p) {
Object.prototype.hasOwnProperty.call(this._values, c) || (this._values[c] = new Hl(this._values[c].property)), this._values[c].value = new i6(this._values[c].property, p === null ? void 0 : rt(p));
}
getTransition(c) {
return rt(this._values[c].transition);
}
setTransition(c, p) {
Object.prototype.hasOwnProperty.call(this._values, c) || (this._values[c] = new Hl(this._values[c].property)), this._values[c].transition = rt(p) || void 0;
}
serialize() {
const c = {};
for (const p of Object.keys(this._values)) {
const g = this.getValue(p);
g !== void 0 && (c[p] = g);
const w = this.getTransition(p);
w !== void 0 && (c[`${p}-transition`] = w);
}
return c;
}
transitioned(c, p) {
const g = new k0(this._properties);
for (const w of Object.keys(this._values))
g._values[w] = this._values[w].transitioned(c, p._values[w]);
return g;
}
untransitioned() {
const c = new k0(this._properties);
for (const p of Object.keys(this._values))
c._values[p] = this._values[p].untransitioned();
return c;
}
}
class vp {
constructor(c, p, g, w, H) {
this.property = c, this.value = p, this.begin = H + w.delay || 0, this.end = this.begin + w.duration || 0, c.specification.transition && (w.delay || w.duration) && (this.prior = g);
}
possiblyEvaluate(c, p, g) {
const w = c.now || 0, H = this.value.possiblyEvaluate(c, p, g), A = this.prior;
if (A) {
if (w > this.end)
return this.prior = null, H;
if (this.value.isDataDriven())
return this.prior = null, H;
if (w < this.begin)
return A.possiblyEvaluate(c, p, g);
{
const C = (w - this.begin) / (this.end - this.begin);
return this.property.interpolate(A.possiblyEvaluate(c, p, g), H, function(N) {
if (N <= 0)
return 0;
if (N >= 1)
return 1;
const z = N * N, W = z * N;
return 4 * (N < 0.5 ? W : 3 * (N - z) + W - 0.75);
}(C));
}
}
return H;
}
}
class k0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitioningPropertyValues);
}
possiblyEvaluate(c, p, g) {
const w = new P0(this._properties);
for (const H of Object.keys(this._values))
w._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return w;
}
hasTransition() {
for (const c of Object.keys(this._values))
if (this._values[c].prior)
return !0;
return !1;
}
}
class I0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultPropertyValues);
}
hasValue(c) {
return this._values[c].value !== void 0;
}
getValue(c) {
return rt(this._values[c].value);
}
setValue(c, p) {
this._values[c] = new i6(this._values[c].property, p === null ? void 0 : rt(p));
}
serialize() {
const c = {};
for (const p of Object.keys(this._values)) {
const g = this.getValue(p);
g !== void 0 && (c[p] = g);
}
return c;
}
possiblyEvaluate(c, p, g) {
const w = new P0(this._properties);
for (const H of Object.keys(this._values))
w._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return w;
}
}
class fs {
constructor(c, p, g) {
this.property = c, this.value = p, this.parameters = g;
}
isConstant() {
return this.value.kind === "constant";
}
constantOr(c) {
return this.value.kind === "constant" ? this.value.value : c;
}
evaluate(c, p, g, w) {
return this.property.evaluate(this.value, this.parameters, c, p, g, w);
}
}
class P0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultPossiblyEvaluatedValues);
}
get(c) {
return this._values[c];
}
}
class cr {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p) {
if (c.isDataDriven())
throw new Error("Value should not be data driven");
return c.expression.evaluate(p);
}
interpolate(c, p, g) {
const w = xr[this.specification.type];
return w ? w(c, p, g) : c;
}
}
class Mr {
constructor(c, p) {
this.specification = c, this.overrides = p;
}
possiblyEvaluate(c, p, g, w) {
return new fs(this, c.expression.kind === "constant" || c.expression.kind === "camera" ? { kind: "constant", value: c.expression.evaluate(p, null, {}, g, w) } : c.expression, p);
}
interpolate(c, p, g) {
if (c.value.kind !== "constant" || p.value.kind !== "constant")
return c;
if (c.value.value === void 0 || p.value.value === void 0)
return new fs(this, { kind: "constant", value: void 0 }, c.parameters);
const w = xr[this.specification.type];
if (w) {
const H = w(c.value.value, p.value.value, g);
return new fs(this, { kind: "constant", value: H }, c.parameters);
}
return c;
}
evaluate(c, p, g, w, H, A) {
return c.kind === "constant" ? c.value : c.evaluate(p, g, w, H, A);
}
}
class Ol extends Mr {
possiblyEvaluate(c, p, g, w) {
if (c.value === void 0)
return new fs(this, { kind: "constant", value: void 0 }, p);
if (c.expression.kind === "constant") {
const H = c.expression.evaluate(p, null, {}, g, w), A = c.property.specification.type === "resolvedImage" && typeof H != "string" ? H.name : H, C = this._calculate(A, A, A, p);
return new fs(this, { kind: "constant", value: C }, p);
}
if (c.expression.kind === "camera") {
const H = this._calculate(c.expression.evaluate({ zoom: p.zoom - 1 }), c.expression.evaluate({ zoom: p.zoom }), c.expression.evaluate({ zoom: p.zoom + 1 }), p);
return new fs(this, { kind: "constant", value: H }, p);
}
return new fs(this, c.expression, p);
}
evaluate(c, p, g, w, H, A) {
if (c.kind === "source") {
const C = c.evaluate(p, g, w, H, A);
return this._calculate(C, C, C, p);
}
return c.kind === "composite" ? this._calculate(c.evaluate({ zoom: Math.floor(p.zoom) - 1 }, g, w), c.evaluate({ zoom: Math.floor(p.zoom) }, g, w), c.evaluate({ zoom: Math.floor(p.zoom) + 1 }, g, w), p) : c.value;
}
_calculate(c, p, g, w) {
return w.zoom > w.zoomHistory.lastIntegerZoom ? { from: c, to: p } : { from: g, to: p };
}
interpolate(c) {
return c;
}
}
class Cl {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, w) {
if (c.value !== void 0) {
if (c.expression.kind === "constant") {
const H = c.expression.evaluate(p, null, {}, g, w);
return this._calculate(H, H, H, p);
}
return this._calculate(c.expression.evaluate(new ti(Math.floor(p.zoom - 1), p)), c.expression.evaluate(new ti(Math.floor(p.zoom), p)), c.expression.evaluate(new ti(Math.floor(p.zoom + 1), p)), p);
}
}
_calculate(c, p, g, w) {
return w.zoom > w.zoomHistory.lastIntegerZoom ? { from: c, to: p } : { from: g, to: p };
}
interpolate(c) {
return c;
}
}
class Fc {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, w) {
return !!c.expression.evaluate(p, null, {}, g, w);
}
interpolate() {
return !1;
}
}
class S {
constructor(c) {
this.properties = c, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [];
for (const p in c) {
const g = c[p];
g.specification.overridable && this.overridableProperties.push(p);
const w = this.defaultPropertyValues[p] = new i6(g, void 0), H = this.defaultTransitionablePropertyValues[p] = new Hl(g);
this.defaultTransitioningPropertyValues[p] = H.untransitioned(), this.defaultPossiblyEvaluatedValues[p] = w.possiblyEvaluate({});
}
}
}
nr("DataDrivenProperty", Mr), nr("DataConstantProperty", cr), nr("CrossFadedDataDrivenProperty", Ol), nr("CrossFadedProperty", Cl), nr("ColorRampProperty", Fc);
const l = "-transition";
class m extends ar {
constructor(c, p) {
if (super(), this.id = c.id, this.type = c.type, this._featureFilter = { filter: () => !0, needGeometry: !1 }, c.type !== "custom" && (this.metadata = c.metadata, this.minzoom = c.minzoom, this.maxzoom = c.maxzoom, c.type !== "background" && (this.source = c.source, this.sourceLayer = c["source-layer"], this.filter = c.filter), p.layout && (this._unevaluatedLayout = new I0(p.layout)), p.paint)) {
this._transitionablePaint = new Al(p.paint);
for (const g in c.paint)
this.setPaintProperty(g, c.paint[g], { validate: !1 });
for (const g in c.layout)
this.setLayoutProperty(g, c.layout[g], { validate: !1 });
this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new P0(p.paint);
}
}
getCrossfadeParameters() {
return this._crossfadeParameters;
}
getLayoutProperty(c) {
return c === "visibility" ? this.visibility : this._unevaluatedLayout.getValue(c);
}
setLayoutProperty(c, p, g = {}) {
p != null && this._validate(Qp, `layers.${this.id}.layout.${c}`, c, p, g) || (c !== "visibility" ? this._unevaluatedLayout.setValue(c, p) : this.visibility = p);
}
getPaintProperty(c) {
return c.endsWith(l) ? this._transitionablePaint.getTransition(c.slice(0, -11)) : this._transitionablePaint.getValue(c);
}
setPaintProperty(c, p, g = {}) {
if (p != null && this._validate(fp, `layers.${this.id}.paint.${c}`, c, p, g))
return !1;
if (c.endsWith(l))
return this._transitionablePaint.setTransition(c.slice(0, -11), p || void 0), !1;
{
const w = this._transitionablePaint._values[c], H = w.property.specification["property-type"] === "cross-faded-data-driven", A = w.value.isDataDriven(), C = w.value;
this._transitionablePaint.setValue(c, p), this._handleSpecialPaintPropertyUpdate(c);
const N = this._transitionablePaint._values[c].value;
return N.isDataDriven() || A || H || this._handleOverridablePaintPropertyUpdate(c, C, N);
}
}
_handleSpecialPaintPropertyUpdate(c) {
}
_handleOverridablePaintPropertyUpdate(c, p, g) {
return !1;
}
isHidden(c) {
return !!(this.minzoom && c < this.minzoom) || !!(this.maxzoom && c >= this.maxzoom) || this.visibility === "none";
}
updateTransitions(c) {
this._transitioningPaint = this._transitionablePaint.transitioned(c, this._transitioningPaint);
}
hasTransition() {
return this._transitioningPaint.hasTransition();
}
recalculate(c, p) {
c.getCrossfadeParameters && (this._crossfadeParameters = c.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(c, void 0, p)), this.paint = this._transitioningPaint.possiblyEvaluate(c, void 0, p);
}
serialize() {
const c = { 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 && (c.layout = c.layout || {}, c.layout.visibility = this.visibility), ct(c, (p, g) => !(p === void 0 || g === "layout" && !Object.keys(p).length || g === "paint" && !Object.keys(p).length));
}
_validate(c, p, g, w, H = {}) {
return (!H || H.validate !== !1) && kc(this, c.call(F3, { key: p, layerType: this.type, objectKey: g, value: w, styleSpec: Ct, style: { glyphs: !0, sprite: !0 } }));
}
is3D() {
return !1;
}
isTileClipped() {
return !1;
}
hasOffscreenPass() {
return !1;
}
resize() {
}
isStateDependent() {
for (const c in this.paint._values) {
const p = this.paint.get(c);
if (p instanceof fs && t2(p.property.specification) && (p.value.kind === "source" || p.value.kind === "composite") && p.value.isStateDependent)
return !0;
}
return !1;
}
}
const v = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array };
class b {
constructor(c, p) {
this._structArray = c, this._pos1 = p * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;
}
}
class M {
constructor() {
this.isTransferred = !1, this.capacity = -1, this.resize(0);
}
static serialize(c, p) {
return c._trim(), p && (c.isTransferred = !0, p.push(c.arrayBuffer)), { length: c.length, arrayBuffer: c.arrayBuffer };
}
static deserialize(c) {
const p = Object.create(this.prototype);
return p.arrayBuffer = c.arrayBuffer, p.length = c.length, p.capacity = c.arrayBuffer.byteLength / p.bytesPerElement, p._refreshViews(), p;
}
_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(c) {
this.reserve(c), this.length = c;
}
reserve(c) {
if (c > this.capacity) {
this.capacity = Math.max(c, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
const p = this.uint8;
this._refreshViews(), p && this.uint8.set(p);
}
}
_refreshViews() {
throw new Error("_refreshViews() must be implemented by each concrete StructArray layout");
}
}
function V(h, c = 1) {
let p = 0, g = 0;
return { members: h.map((w) => {
const H = v[w.type].BYTES_PER_ELEMENT, A = p = D(p, Math.max(c, H)), C = w.components || 1;
return g = Math.max(g, H), p += H * C, { name: w.name, type: w.type, components: C, offset: A };
}), size: D(p, Math.max(g, c)), alignment: c };
}
function D(h, c) {
return Math.ceil(h / c) * c;
}
class j extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.int16[w + 0] = p, this.int16[w + 1] = g, c;
}
}
j.prototype.bytesPerElement = 4, nr("StructArrayLayout2i4", j);
class Z extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.int16[H + 0] = p, this.int16[H + 1] = g, this.int16[H + 2] = w, c;
}
}
Z.prototype.bytesPerElement = 6, nr("StructArrayLayout3i6", Z);
class Y extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, w);
}
emplace(c, p, g, w, H) {
const A = 4 * c;
return this.int16[A + 0] = p, this.int16[A + 1] = g, this.int16[A + 2] = w, this.int16[A + 3] = H, c;
}
}
Y.prototype.bytesPerElement = 8, nr("StructArrayLayout4i8", Y);
class J extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = w, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = C, c;
}
}
J.prototype.bytesPerElement = 12, nr("StructArrayLayout2i4i12", J);
class lt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 4 * c, z = 8 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.uint8[z + 4] = w, this.uint8[z + 5] = H, this.uint8[z + 6] = A, this.uint8[z + 7] = C, c;
}
}
lt.prototype.bytesPerElement = 8, nr("StructArrayLayout2i4ub8", lt);
class ft extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.float32[w + 0] = p, this.float32[w + 1] = g, c;
}
}
ft.prototype.bytesPerElement = 8, nr("StructArrayLayout2f8", ft);
class Qt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A, C, N, z, W) {
const X = this.length;
return this.resize(X + 1), this.emplace(X, c, p, g, w, H, A, C, N, z, W);
}
emplace(c, p, g, w, H, A, C, N, z, W, X) {
const tt = 10 * c;
return this.uint16[tt + 0] = p, this.uint16[tt + 1] = g, this.uint16[tt + 2] = w, this.uint16[tt + 3] = H, this.uint16[tt + 4] = A, this.uint16[tt + 5] = C, this.uint16[tt + 6] = N, this.uint16[tt + 7] = z, this.uint16[tt + 8] = W, this.uint16[tt + 9] = X, c;
}
}
Qt.prototype.bytesPerElement = 20, nr("StructArrayLayout10ui20", Qt);
class wt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = this.length;
return this.resize(at + 1), this.emplace(at, c, p, g, w, H, A, C, N, z, W, X, tt);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at) {
const ut = 12 * c;
return this.int16[ut + 0] = p, this.int16[ut + 1] = g, this.int16[ut + 2] = w, this.int16[ut + 3] = H, this.uint16[ut + 4] = A, this.uint16[ut + 5] = C, this.uint16[ut + 6] = N, this.uint16[ut + 7] = z, this.int16[ut + 8] = W, this.int16[ut + 9] = X, this.int16[ut + 10] = tt, this.int16[ut + 11] = at, c;
}
}
wt.prototype.bytesPerElement = 24, nr("StructArrayLayout4i4ui4i24", wt);
class Mt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.float32[H + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = w, c;
}
}
Mt.prototype.bytesPerElement = 12, nr("StructArrayLayout3f12", Mt);
class Ht extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.uint32[1 * c + 0] = p, c;
}
}
Ht.prototype.bytesPerElement = 4, nr("StructArrayLayout1ul4", Ht);
class Ot extends M {
_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(c, p, g, w, H, A, C, N, z) {
const W = this.length;
return this.resize(W + 1), this.emplace(W, c, p, g, w, H, A, C, N, z);
}
emplace(c, p, g, w, H, A, C, N, z, W) {
const X = 10 * c, tt = 5 * c;
return this.int16[X + 0] = p, this.int16[X + 1] = g, this.int16[X + 2] = w, this.int16[X + 3] = H, this.int16[X + 4] = A, this.int16[X + 5] = C, this.uint32[tt + 3] = N, this.uint16[X + 8] = z, this.uint16[X + 9] = W, c;
}
}
Ot.prototype.bytesPerElement = 20, nr("StructArrayLayout6i1ul2ui20", Ot);
class bt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = w, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = C, c;
}
}
bt.prototype.bytesPerElement = 12, nr("StructArrayLayout2i2i2i12", bt);
class Nt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H) {
const A = this.length;
return this.resize(A + 1), this.emplace(A, c, p, g, w, H);
}
emplace(c, p, g, w, H, A) {
const C = 4 * c, N = 8 * c;
return this.float32[C + 0] = p, this.float32[C + 1] = g, this.float32[C + 2] = w, this.int16[N + 6] = H, this.int16[N + 7] = A, c;
}
}
Nt.prototype.bytesPerElement = 16, nr("StructArrayLayout2f1f2i16", Nt);
class Dt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 16 * c, z = 4 * c, W = 8 * c;
return this.uint8[N + 0] = p, this.uint8[N + 1] = g, this.float32[z + 1] = w, this.float32[z + 2] = H, this.int16[W + 6] = A, this.int16[W + 7] = C, c;
}
}
Dt.prototype.bytesPerElement = 16, nr("StructArrayLayout2ub2f2i16", Dt);
class Wt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.uint16[H + 0] = p, this.uint16[H + 1] = g, this.uint16[H + 2] = w, c;
}
}
Wt.prototype.bytesPerElement = 6, nr("StructArrayLayout3ui6", Wt);
class he extends M {
_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(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et) {
const $t = this.length;
return this.resize($t + 1), this.emplace($t, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t) {
const Pt = 24 * c, Bt = 12 * c, ee = 48 * c;
return this.int16[Pt + 0] = p, this.int16[Pt + 1] = g, this.uint16[Pt + 2] = w, this.uint16[Pt + 3] = H, this.uint32[Bt + 2] = A, this.uint32[Bt + 3] = C, this.uint32[Bt + 4] = N, this.uint16[Pt + 10] = z, this.uint16[Pt + 11] = W, this.uint16[Pt + 12] = X, this.float32[Bt + 7] = tt, this.float32[Bt + 8] = at, this.uint8[ee + 36] = ut, this.uint8[ee + 37] = Tt, this.uint8[ee + 38] = Lt, this.uint32[Bt + 10] = Et, this.int16[Pt + 22] = $t, c;
}
}
he.prototype.bytesPerElement = 48, nr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", he);
class we extends M {
_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(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr) {
const rr = this.length;
return this.resize(rr + 1), this.emplace(rr, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr, rr) {
const ue = 32 * c, gr = 16 * c;
return this.int16[ue + 0] = p, this.int16[ue + 1] = g, this.int16[ue + 2] = w, this.int16[ue + 3] = H, this.int16[ue + 4] = A, this.int16[ue + 5] = C, this.int16[ue + 6] = N, this.int16[ue + 7] = z, this.uint16[ue + 8] = W, this.uint16[ue + 9] = X, this.uint16[ue + 10] = tt, this.uint16[ue + 11] = at, this.uint16[ue + 12] = ut, this.uint16[ue + 13] = Tt, this.uint16[ue + 14] = Lt, this.uint16[ue + 15] = Et, this.uint16[ue + 16] = $t, this.uint16[ue + 17] = Pt, this.uint16[ue + 18] = Bt, this.uint16[ue + 19] = ee, this.uint16[ue + 20] = _e, this.uint16[ue + 21] = Xe, this.uint16[ue + 22] = Er, this.uint32[gr + 12] = ze, this.float32[gr + 13] = Re, this.float32[gr + 14] = Qr, this.uint16[ue + 30] = sr, this.uint16[ue + 31] = rr, c;
}
}
we.prototype.bytesPerElement = 64, nr("StructArrayLayout8i15ui1ul2f2ui64", we);
class De extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.float32[1 * c + 0] = p, c;
}
}
De.prototype.bytesPerElement = 4, nr("StructArrayLayout1f4", De);
class tr extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.uint16[6 * c + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = w, c;
}
}
tr.prototype.bytesPerElement = 12, nr("StructArrayLayout1ui2f12", tr);
class Oe extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 4 * c;
return this.uint32[2 * c + 0] = p, this.uint16[H + 2] = g, this.uint16[H + 3] = w, c;
}
}
Oe.prototype.bytesPerElement = 8, nr("StructArrayLayout1ul2ui8", Oe);
class Ae extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.uint16[w + 0] = p, this.uint16[w + 1] = g, c;
}
}
Ae.prototype.bytesPerElement = 4, nr("StructArrayLayout2ui4", Ae);
class ur extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.uint16[1 * c + 0] = p, c;
}
}
ur.prototype.bytesPerElement = 2, nr("StructArrayLayout1ui2", ur);
class Nr extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, w);
}
emplace(c, p, g, w, H) {
const A = 4 * c;
return this.float32[A + 0] = p, this.float32[A + 1] = g, this.float32[A + 2] = w, this.float32[A + 3] = H, c;
}
}
Nr.prototype.bytesPerElement = 16, nr("StructArrayLayout4f16", Nr);
class Pe extends b {
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 f(this.anchorPointX, this.anchorPointY);
}
}
Pe.prototype.size = 20;
class We extends Ot {
get(c) {
return new Pe(this, c);
}
}
nr("CollisionBoxArray", We);
class kr extends b {
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(c) {
this._structArray.uint8[this._pos1 + 37] = c;
}
get hidden() {
return this._structArray.uint8[this._pos1 + 38];
}
set hidden(c) {
this._structArray.uint8[this._pos1 + 38] = c;
}
get crossTileID() {
return this._structArray.uint32[this._pos4 + 10];
}
set crossTileID(c) {
this._structArray.uint32[this._pos4 + 10] = c;
}
get associatedIconIndex() {
return this._structArray.int16[this._pos2 + 22];
}
}
kr.prototype.size = 48;
class ei extends he {
get(c) {
return new kr(this, c);
}
}
nr("PlacedSymbolArray", ei);
class Wr extends b {
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(c) {
this._structArray.uint32[this._pos4 + 12] = c;
}
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];
}
}
Wr.prototype.size = 64;
class nn extends we {
get(c) {
return new Wr(this, c);
}
}
nr("SymbolInstanceArray", nn);
class ri extends De {
getoffsetX(c) {
return this.float32[1 * c + 0];
}
}
nr("GlyphOffsetArray", ri);
class C1 extends Z {
getx(c) {
return this.int16[3 * c + 0];
}
gety(c) {
return this.int16[3 * c + 1];
}
gettileUnitDistanceFromAnchor(c) {
return this.int16[3 * c + 2];
}
}
nr("SymbolLineVertexArray", C1);
class O2 extends b {
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];
}
}
O2.prototype.size = 12;
class ni extends tr {
get(c) {
return new O2(this, c);
}
}
nr("TextAnchorOffsetArray", ni);
class mo extends b {
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];
}
}
mo.prototype.size = 8;
class q1 extends Oe {
get(c) {
return new mo(this, c);
}
}
nr("FeatureIndexArray", q1);
class k1 extends j {
}
class X1 extends j {
}
class Qs extends j {
}
class o6 extends J {
}
class kl extends lt {
}
class s6 extends ft {
}
class i2 extends Qt {
}
class Il extends wt {
}
class Bc extends Mt {
}
class o2 extends Ht {
}
class s2 extends bt {
}
class Ea extends Dt {
}
class C2 extends Wt {
}
class b1 extends Ae {
}
const I1 = V([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Ro } = I1;
class an {
constructor(c = []) {
this.segments = c;
}
prepareSegment(c, p, g, w) {
let H = this.segments[this.segments.length - 1];
return c > an.MAX_VERTEX_ARRAY_LENGTH && It(`Max vertices per segment is ${an.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`), (!H || H.vertexLength + c > an.MAX_VERTEX_ARRAY_LENGTH || H.sortKey !== w) && (H = { vertexOffset: p.length, primitiveOffset: g.length, vertexLength: 0, primitiveLength: 0 }, w !== void 0 && (H.sortKey = w), this.segments.push(H)), H;
}
get() {
return this.segments;
}
destroy() {
for (const c of this.segments)
for (const p in c.vaos)
c.vaos[p].destroy();
}
static simpleSegment(c, p, g, w) {
return new an([{ vertexOffset: c, primitiveOffset: p, vertexLength: g, primitiveLength: w, vaos: {}, sortKey: 0 }]);
}
}
function B3(h, c) {
return 256 * (h = F(Math.floor(h), 0, 255)) + F(Math.floor(c), 0, 255);
}
an.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, nr("SegmentVector", an);
const a6 = V([{ 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 l6 = { exports: {} }, _p = { exports: {} };
_p.exports = function(h, c) {
var p, g, w, H, A, C, N, z;
for (g = h.length - (p = 3 & h.length), w = c, A = 3432918353, C = 461845907, z = 0; z < g; )
N = 255 & h.charCodeAt(z) | (255 & h.charCodeAt(++z)) << 8 | (255 & h.charCodeAt(++z)) << 16 | (255 & h.charCodeAt(++z)) << 24, ++z, w = 27492 + (65535 & (H = 5 * (65535 & (w = (w ^= N = (65535 & (N = (N = (65535 & N) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * C + (((N >>> 16) * C & 65535) << 16) & 4294967295) << 13 | w >>> 19)) + ((5 * (w >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (H >>> 16) & 65535) << 16);
switch (N = 0, p) {
case 3:
N ^= (255 & h.charCodeAt(z + 2)) << 16;
case 2:
N ^= (255 & h.charCodeAt(z + 1)) << 8;
case 1:
w ^= N = (65535 & (N = (N = (65535 & (N ^= 255 & h.charCodeAt(z))) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * C + (((N >>> 16) * C & 65535) << 16) & 4294967295;
}
return w ^= h.length, w = 2246822507 * (65535 & (w ^= w >>> 16)) + ((2246822507 * (w >>> 16) & 65535) << 16) & 4294967295, w = 3266489909 * (65535 & (w ^= w >>> 13)) + ((3266489909 * (w >>> 16) & 65535) << 16) & 4294967295, (w ^= w >>> 16) >>> 0;
};
var v_ = _p.exports, bp = { exports: {} };
bp.exports = function(h, c) {
for (var p, g = h.length, w = c ^ g, H = 0; g >= 4; )
p = 1540483477 * (65535 & (p = 255 & h.charCodeAt(H) | (255 & h.charCodeAt(++H)) << 8 | (255 & h.charCodeAt(++H)) << 16 | (255 & h.charCodeAt(++H)) << 24)) + ((1540483477 * (p >>> 16) & 65535) << 16), w = 1540483477 * (65535 & w) + ((1540483477 * (w >>> 16) & 65535) << 16) ^ (p = 1540483477 * (65535 & (p ^= p >>> 24)) + ((1540483477 * (p >>> 16) & 65535) << 16)), g -= 4, ++H;
switch (g) {
case 3:
w ^= (255 & h.charCodeAt(H + 2)) << 16;
case 2:
w ^= (255 & h.charCodeAt(H + 1)) << 8;
case 1:
w = 1540483477 * (65535 & (w ^= 255 & h.charCodeAt(H))) + ((1540483477 * (w >>> 16) & 65535) << 16);
}
return w = 1540483477 * (65535 & (w ^= w >>> 13)) + ((1540483477 * (w >>> 16) & 65535) << 16), (w ^= w >>> 15) >>> 0;
};
var Ma = v_, Lp = bp.exports;
l6.exports = Ma, l6.exports.murmur3 = Ma, l6.exports.murmur2 = Lp;
var Pl = u(l6.exports);
class V0 {
constructor() {
this.ids = [], this.positions = [], this.indexed = !1;
}
add(c, p, g, w) {
this.ids.push(Vl(c)), this.positions.push(p, g, w);
}
getPositions(c) {
if (!this.indexed)
throw new Error("Trying to get index, but feature positions are not indexed");
const p = Vl(c);
let g = 0, w = this.ids.length - 1;
for (; g < w; ) {
const A = g + w >> 1;
this.ids[A] >= p ? w = A : g = A + 1;
}
const H = [];
for (; this.ids[g] === p; )
H.push({ index: this.positions[3 * g], start: this.positions[3 * g + 1], end: this.positions[3 * g + 2] }), g++;
return H;
}
static serialize(c, p) {
const g = new Float64Array(c.ids), w = new Uint32Array(c.positions);
return Rl(g, w, 0, g.length - 1), p && p.push(g.buffer, w.buffer), { ids: g, positions: w };
}
static deserialize(c) {
const p = new V0();
return p.ids = c.ids, p.positions = c.positions, p.indexed = !0, p;
}
}
function Vl(h) {
const c = +h;
return !isNaN(c) && c <= Number.MAX_SAFE_INTEGER ? c : Pl(String(h));
}
function Rl(h, c, p, g) {
for (; p < g; ) {
const w = h[p + g >> 1];
let H = p - 1, A = g + 1;
for (; ; ) {
do
H++;
while (h[H] < w);
do
A--;
while (h[A] > w);
if (H >= A)
break;
c6(h, H, A), c6(c, 3 * H, 3 * A), c6(c, 3 * H + 1, 3 * A + 1), c6(c, 3 * H + 2, 3 * A + 2);
}
A - p < g - A ? (Rl(h, c, p, A), p = A + 1) : (Rl(h, c, A + 1, g), g = A);
}
}
function c6(h, c, p) {
const g = h[c];
h[c] = h[p], h[p] = g;
}
nr("FeaturePositionMap", V0);
class R0 {
constructor(c, p) {
this.gl = c.gl, this.location = p;
}
}
class wp extends R0 {
constructor(c, p) {
super(c, p), this.current = 0;
}
set(c) {
this.current !== c && (this.current = c, this.gl.uniform1f(this.location, c));
}
}
class wO extends R0 {
constructor(c, p) {
super(c, p), this.current = [0, 0, 0, 0];
}
set(c) {
c[0] === this.current[0] && c[1] === this.current[1] && c[2] === this.current[2] && c[3] === this.current[3] || (this.current = c, this.gl.uniform4f(this.location, c[0], c[1], c[2], c[3]));
}
}
class xO extends R0 {
constructor(c, p) {
super(c, p), this.current = tn.transparent;
}
set(c) {
c.r === this.current.r && c.g === this.current.g && c.b === this.current.b && c.a === this.current.a || (this.current = c, this.gl.uniform4f(this.location, c.r, c.g, c.b, c.a));
}
}
const mJ = new Float32Array(16);
function __(h) {
return [B3(255 * h.r, 255 * h.g), B3(255 * h.b, 255 * h.a)];
}
class jc {
constructor(c, p, g) {
this.value = c, this.uniformNames = p.map((w) => `u_${w}`), this.type = g;
}
setUniform(c, p, g) {
c.set(g.constantOr(this.value));
}
getBinding(c, p, g) {
return this.type === "color" ? new xO(c, p) : new wp(c, p);
}
}
class Nl {
constructor(c, p) {
this.uniformNames = p.map((g) => `u_${g}`), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;
}
setConstantPatternPositions(c, p) {
this.pixelRatioFrom = p.pixelRatio, this.pixelRatioTo = c.pixelRatio, this.patternFrom = p.tlbr, this.patternTo = c.tlbr;
}
setUniform(c, p, g, w) {
const H = w === "u_pattern_to" ? this.patternTo : w === "u_pattern_from" ? this.patternFrom : w === "u_pixel_ratio_to" ? this.pixelRatioTo : w === "u_pixel_ratio_from" ? this.pixelRatioFrom : null;
H && c.set(H);
}
getBinding(c, p, g) {
return g.substr(0, 9) === "u_pattern" ? new wO(c, p) : new wp(c, p);
}
}
class j3 {
constructor(c, p, g, w) {
this.expression = c, this.type = g, this.maxValue = 0, this.paintVertexAttributes = p.map((H) => ({ name: `a_${H}`, type: "Float32", components: g === "color" ? 2 : 1, offset: 0 })), this.paintVertexArray = new w();
}
populatePaintArray(c, p, g, w, H) {
const A = this.paintVertexArray.length, C = this.expression.evaluate(new ti(0), p, {}, w, [], H);
this.paintVertexArray.resize(c), this._setPaintValue(A, c, C);
}
updatePaintArray(c, p, g, w) {
const H = this.expression.evaluate({ zoom: 0 }, g, w);
this._setPaintValue(c, p, H);
}
_setPaintValue(c, p, g) {
if (this.type === "color") {
const w = __(g);
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, w[0], w[1]);
} else {
for (let w = c; w < p; w++)
this.paintVertexArray.emplace(w, g);
this.maxValue = Math.max(this.maxValue, Math.abs(g));
}
}
upload(c) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = c.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
}
}
class Ws {
constructor(c, p, g, w, H, A) {
this.expression = c, this.uniformNames = p.map((C) => `u_${C}_t`), this.type = g, this.useIntegerZoom = w, this.zoom = H, this.maxValue = 0, this.paintVertexAttributes = p.map((C) => ({ name: `a_${C}`, type: "Float32", components: g === "color" ? 4 : 2, offset: 0 })), this.paintVertexArray = new A();
}
populatePaintArray(c, p, g, w, H) {
const A = this.expression.evaluate(new ti(this.zoom), p, {}, w, [], H), C = this.expression.evaluate(new ti(this.zoom + 1), p, {}, w, [], H), N = this.paintVertexArray.length;
this.paintVertexArray.resize(c), this._setPaintValue(N, c, A, C);
}
updatePaintArray(c, p, g, w) {
const H = this.expression.evaluate({ zoom: this.zoom }, g, w), A = this.expression.evaluate({ zoom: this.zoom + 1 }, g, w);
this._setPaintValue(c, p, H, A);
}
_setPaintValue(c, p, g, w) {
if (this.type === "color") {
const H = __(g), A = __(w);
for (let C = c; C < p; C++)
this.paintVertexArray.emplace(C, H[0], H[1], A[0], A[1]);
} else {
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, g, w);
this.maxValue = Math.max(this.maxValue, Math.abs(g), Math.abs(w));
}
}
upload(c) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = c.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
}
setUniform(c, p) {
const g = this.useIntegerZoom ? Math.floor(p.zoom) : p.zoom, w = F(this.expression.interpolationFactor(g, this.zoom, this.zoom + 1), 0, 1);
c.set(w);
}
getBinding(c, p, g) {
return new wp(c, p);
}
}
class u6 {
constructor(c, p, g, w, H, A) {
this.expression = c, this.type = p, this.useIntegerZoom = g, this.zoom = w, this.layerId = A, this.zoomInPaintVertexArray = new H(), this.zoomOutPaintVertexArray = new H();
}
populatePaintArray(c, p, g) {
const w = this.zoomInPaintVertexArray.length;
this.zoomInPaintVertexArray.resize(c), this.zoomOutPaintVertexArray.resize(c), this._setPaintValues(w, c, p.patterns && p.patterns[this.layerId], g);
}
updatePaintArray(c, p, g, w, H) {
this._setPaintValues(c, p, g.patterns && g.patterns[this.layerId], H);
}
_setPaintValues(c, p, g, w) {
if (!w || !g)
return;
const { min: H, mid: A, max: C } = g, N = w[H], z = w[A], W = w[C];
if (N && z && W)
for (let X = c; X < p; X++)
this.zoomInPaintVertexArray.emplace(X, z.tl[0], z.tl[1], z.br[0], z.br[1], N.tl[0], N.tl[1], N.br[0], N.br[1], z.pixelRatio, N.pixelRatio), this.zoomOutPaintVertexArray.emplace(X, z.tl[0], z.tl[1], z.br[0], z.br[1], W.tl[0], W.tl[1], W.br[0], W.br[1], z.pixelRatio, W.pixelRatio);
}
upload(c) {
this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = c.createVertexBuffer(this.zoomInPaintVertexArray, a6.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = c.createVertexBuffer(this.zoomOutPaintVertexArray, a6.members, this.expression.isStateDependent));
}
destroy() {
this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
}
}
class EO {
constructor(c, p, g) {
this.binders = {}, this._buffers = [];
const w = [];
for (const H in c.paint._values) {
if (!g(H))
continue;
const A = c.paint.get(H);
if (!(A instanceof fs && t2(A.property.specification)))
continue;
const C = gJ(H, c.type), N = A.value, z = A.property.specification.type, W = A.property.useIntegerZoom, X = A.property.specification["property-type"], tt = X === "cross-faded" || X === "cross-faded-data-driven";
if (N.kind === "constant")
this.binders[H] = tt ? new Nl(N.value, C) : new jc(N.value, C, z), w.push(`/u_${H}`);
else if (N.kind === "source" || tt) {
const at = MO(H, z, "source");
this.binders[H] = tt ? new u6(N, z, W, p, at, c.id) : new j3(N, C, z, at), w.push(`/a_${H}`);
} else {
const at = MO(H, z, "composite");
this.binders[H] = new Ws(N, C, z, W, p, at), w.push(`/z_${H}`);
}
}
this.cacheKey = w.sort().join("");
}
getMaxValue(c) {
const p = this.binders[c];
return p instanceof j3 || p instanceof Ws ? p.maxValue : 0;
}
populatePaintArrays(c, p, g, w, H) {
for (const A in this.binders) {
const C = this.binders[A];
(C instanceof j3 || C instanceof Ws || C instanceof u6) && C.populatePaintArray(c, p, g, w, H);
}
}
setConstantPatternPositions(c, p) {
for (const g in this.binders) {
const w = this.binders[g];
w instanceof Nl && w.setConstantPatternPositions(c, p);
}
}
updatePaintArrays(c, p, g, w, H) {
let A = !1;
for (const C in c) {
const N = p.getPositions(C);
for (const z of N) {
const W = g.feature(z.index);
for (const X in this.binders) {
const tt = this.binders[X];
if ((tt instanceof j3 || tt instanceof Ws || tt instanceof u6) && tt.expression.isStateDependent === !0) {
const at = w.paint.get(X);
tt.expression = at.value, tt.updatePaintArray(z.start, z.end, W, c[C], H), A = !0;
}
}
}
}
return A;
}
defines() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
(g instanceof jc || g instanceof Nl) && c.push(...g.uniformNames.map((w) => `#define HAS_UNIFORM_${w}`));
}
return c;
}
getBinderAttributes() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof j3 || g instanceof Ws)
for (let w = 0; w < g.paintVertexAttributes.length; w++)
c.push(g.paintVertexAttributes[w].name);
else if (g instanceof u6)
for (let w = 0; w < a6.members.length; w++)
c.push(a6.members[w].name);
}
return c;
}
getBinderUniforms() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof jc || g instanceof Nl || g instanceof Ws)
for (const w of g.uniformNames)
c.push(w);
}
return c;
}
getPaintVertexBuffers() {
return this._buffers;
}
getUniforms(c, p) {
const g = [];
for (const w in this.binders) {
const H = this.binders[w];
if (H instanceof jc || H instanceof Nl || H instanceof Ws) {
for (const A of H.uniformNames)
if (p[A]) {
const C = H.getBinding(c, p[A], A);
g.push({ name: A, property: w, binding: C });
}
}
}
return g;
}
setUniforms(c, p, g, w) {
for (const { name: H, property: A, binding: C } of p)
this.binders[A].setUniform(C, w, g.get(A), H);
}
updatePaintBuffers(c) {
this._buffers = [];
for (const p in this.binders) {
const g = this.binders[p];
if (c && g instanceof u6) {
const w = c.fromScale === 2 ? g.zoomInPaintVertexBuffer : g.zoomOutPaintVertexBuffer;
w && this._buffers.push(w);
} else
(g instanceof j3 || g instanceof Ws) && g.paintVertexBuffer && this._buffers.push(g.paintVertexBuffer);
}
}
upload(c) {
for (const p in this.binders) {
const g = this.binders[p];
(g instanceof j3 || g instanceof Ws || g instanceof u6) && g.upload(c);
}
this.updatePaintBuffers();
}
destroy() {
for (const c in this.binders) {
const p = this.binders[c];
(p instanceof j3 || p instanceof Ws || p instanceof u6) && p.destroy();
}
}
}
class N0 {
constructor(c, p, g = () => !0) {
this.programConfigurations = {};
for (const w of c)
this.programConfigurations[w.id] = new EO(w, p, g);
this.needsUpload = !1, this._featureMap = new V0(), this._bufferOffset = 0;
}
populatePaintArrays(c, p, g, w, H, A) {
for (const C in this.programConfigurations)
this.programConfigurations[C].populatePaintArrays(c, p, w, H, A);
p.id !== void 0 && this._featureMap.add(p.id, g, this._bufferOffset, c), this._bufferOffset = c, this.needsUpload = !0;
}
updatePaintArrays(c, p, g, w) {
for (const H of g)
this.needsUpload = this.programConfigurations[H.id].updatePaintArrays(c, this._featureMap, p, H, w) || this.needsUpload;
}
get(c) {
return this.programConfigurations[c];
}
upload(c) {
if (this.needsUpload) {
for (const p in this.programConfigurations)
this.programConfigurations[p].upload(c);
this.needsUpload = !1;
}
}
destroy() {
for (const c in this.programConfigurations)
this.programConfigurations[c].destroy();
}
}
function gJ(h, c) {
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"] }[h] || [h.replace(`${c}-`, "").replace(/-/g, "_")];
}
function MO(h, c, p) {
const g = { color: { source: ft, composite: Nr }, number: { source: De, composite: ft } }, w = function(H) {
return { "line-pattern": { source: i2, composite: i2 }, "fill-pattern": { source: i2, composite: i2 }, "fill-extrusion-pattern": { source: i2, composite: i2 } }[H];
}(h);
return w && w[p] || g[c][p];
}
nr("ConstantBinder", jc), nr("CrossFadedConstantBinder", Nl), nr("SourceExpressionBinder", j3), nr("CrossFadedCompositeBinder", u6), nr("CompositeExpressionBinder", Ws), nr("ProgramConfiguration", EO, { omit: ["_buffers"] }), nr("ProgramConfigurationSet", N0);
const Zi = 8192, b_ = Math.pow(2, 14) - 1, SO = -b_ - 1;
function D0(h) {
const c = Zi / h.extent, p = h.loadGeometry();
for (let g = 0; g < p.length; g++) {
const w = p[g];
for (let H = 0; H < w.length; H++) {
const A = w[H], C = Math.round(A.x * c), N = Math.round(A.y * c);
A.x = F(C, SO, b_), A.y = F(N, SO, b_), (C < A.x || C > A.x + 1 || N < A.y || N > A.y + 1) && It("Geometry exceeds allowed extent, reduce your vector tile buffer size");
}
}
return p;
}
function F0(h, c) {
return { type: h.type, id: h.id, properties: h.properties, geometry: c ? D0(h) : [] };
}
function xp(h, c, p, g, w) {
h.emplaceBack(2 * c + (g + 1) / 2, 2 * p + (w + 1) / 2);
}
class L_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.layoutVertexArray = new X1(), this.indexArray = new C2(), this.segments = new an(), this.programConfigurations = new N0(c.layers, c.zoom), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
const w = this.layers[0], H = [];
let A = null, C = !1;
w.type === "circle" && (A = w.layout.get("circle-sort-key"), C = !A.isConstant());
for (const { feature: N, id: z, index: W, sourceLayerIndex: X } of c) {
const tt = this.layers[0]._featureFilter.needGeometry, at = F0(N, tt);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), at, g))
continue;
const ut = C ? A.evaluate(at, {}, g) : void 0, Tt = { id: z, properties: N.properties, type: N.type, sourceLayerIndex: X, index: W, geometry: tt ? at.geometry : D0(N), patterns: {}, sortKey: ut };
H.push(Tt);
}
C && H.sort((N, z) => N.sortKey - z.sortKey);
for (const N of H) {
const { geometry: z, index: W, sourceLayerIndex: X } = N, tt = c[W].feature;
this.addFeature(N, z, W, g), p.featureIndex.insert(tt, z, W, X, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, Ro), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
}
addFeature(c, p, g, w) {
for (const H of p)
for (const A of H) {
const C = A.x, N = A.y;
if (C < 0 || C >= Zi || N < 0 || N >= Zi)
continue;
const z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, c.sortKey), W = z.vertexLength;
xp(this.layoutVertexArray, C, N, -1, -1), xp(this.layoutVertexArray, C, N, 1, -1), xp(this.layoutVertexArray, C, N, 1, 1), xp(this.layoutVertexArray, C, N, -1, 1), this.indexArray.emplaceBack(W, W + 1, W + 2), this.indexArray.emplaceBack(W, W + 3, W + 2), z.vertexLength += 4, z.primitiveLength += 2;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, {}, w);
}
}
function HO(h, c) {
for (let p = 0; p < h.length; p++)
if (Dl(c, h[p]))
return !0;
for (let p = 0; p < c.length; p++)
if (Dl(h, c[p]))
return !0;
return !!w_(h, c);
}
function yJ(h, c, p) {
return !!Dl(h, c) || !!x_(c, h, p);
}
function AO(h, c) {
if (h.length === 1)
return CO(c, h[0]);
for (let p = 0; p < c.length; p++) {
const g = c[p];
for (let w = 0; w < g.length; w++)
if (Dl(h, g[w]))
return !0;
}
for (let p = 0; p < h.length; p++)
if (CO(c, h[p]))
return !0;
for (let p = 0; p < c.length; p++)
if (w_(h, c[p]))
return !0;
return !1;
}
function vJ(h, c, p) {
if (h.length > 1) {
if (w_(h, c))
return !0;
for (let g = 0; g < c.length; g++)
if (x_(c[g], h, p))
return !0;
}
for (let g = 0; g < h.length; g++)
if (x_(h[g], c, p))
return !0;
return !1;
}
function w_(h, c) {
if (h.length === 0 || c.length === 0)
return !1;
for (let p = 0; p < h.length - 1; p++) {
const g = h[p], w = h[p + 1];
for (let H = 0; H < c.length - 1; H++)
if (_J(g, w, c[H], c[H + 1]))
return !0;
}
return !1;
}
function _J(h, c, p, g) {
return Zt(h, p, g) !== Zt(c, p, g) && Zt(h, c, p) !== Zt(h, c, g);
}
function x_(h, c, p) {
const g = p * p;
if (c.length === 1)
return h.distSqr(c[0]) < g;
for (let w = 1; w < c.length; w++)
if (OO(h, c[w - 1], c[w]) < g)
return !0;
return !1;
}
function OO(h, c, p) {
const g = c.distSqr(p);
if (g === 0)
return h.distSqr(c);
const w = ((h.x - c.x) * (p.x - c.x) + (h.y - c.y) * (p.y - c.y)) / g;
return h.distSqr(w < 0 ? c : w > 1 ? p : p.sub(c)._mult(w)._add(c));
}
function CO(h, c) {
let p, g, w, H = !1;
for (let A = 0; A < h.length; A++) {
p = h[A];
for (let C = 0, N = p.length - 1; C < p.length; N = C++)
g = p[C], w = p[N], g.y > c.y != w.y > c.y && c.x < (w.x - g.x) * (c.y - g.y) / (w.y - g.y) + g.x && (H = !H);
}
return H;
}
function Dl(h, c) {
let p = !1;
for (let g = 0, w = h.length - 1; g < h.length; w = g++) {
const H = h[g], A = h[w];
H.y > c.y != A.y > c.y && c.x < (A.x - H.x) * (c.y - H.y) / (A.y - H.y) + H.x && (p = !p);
}
return p;
}
function bJ(h, c, p) {
const g = p[0], w = p[2];
if (h.x < g.x && c.x < g.x || h.x > w.x && c.x > w.x || h.y < g.y && c.y < g.y || h.y > w.y && c.y > w.y)
return !1;
const H = Zt(h, c, p[0]);
return H !== Zt(h, c, p[1]) || H !== Zt(h, c, p[2]) || H !== Zt(h, c, p[3]);
}
function zc(h, c, p) {
const g = c.paint.get(h).value;
return g.kind === "constant" ? g.value : p.programConfigurations.get(c.id).getMaxValue(h);
}
function Ep(h) {
return Math.sqrt(h[0] * h[0] + h[1] * h[1]);
}
function Mp(h, c, p, g, w) {
if (!c[0] && !c[1])
return h;
const H = f.convert(c)._mult(w);
p === "viewport" && H._rotate(-g);
const A = [];
for (let C = 0; C < h.length; C++)
A.push(h[C].sub(H));
return A;
}
let kO, IO;
nr("CircleBucket", L_, { omit: ["layers"] });
var LJ = { get paint() {
return IO = IO || new S({ "circle-radius": new Mr(Ct.paint_circle["circle-radius"]), "circle-color": new Mr(Ct.paint_circle["circle-color"]), "circle-blur": new Mr(Ct.paint_circle["circle-blur"]), "circle-opacity": new Mr(Ct.paint_circle["circle-opacity"]), "circle-translate": new cr(Ct.paint_circle["circle-translate"]), "circle-translate-anchor": new cr(Ct.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new cr(Ct.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new cr(Ct.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new Mr(Ct.paint_circle["circle-stroke-width"]), "circle-stroke-color": new Mr(Ct.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new Mr(Ct.paint_circle["circle-stroke-opacity"]) });
}, get layout() {
return kO = kO || new S({ "circle-sort-key": new Mr(Ct.layout_circle["circle-sort-key"]) });
} }, go = 1e-6, Fl = typeof Float32Array < "u" ? Float32Array : Array;
function E_(h) {
return h[0] = 1, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = 1, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = 1, h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0, h[15] = 1, h;
}
function PO(h, c, p) {
var g = c[0], w = c[1], H = c[2], A = c[3], C = c[4], N = c[5], z = c[6], W = c[7], X = c[8], tt = c[9], at = c[10], ut = c[11], Tt = c[12], Lt = c[13], Et = c[14], $t = c[15], Pt = p[0], Bt = p[1], ee = p[2], _e = p[3];
return h[0] = Pt * g + Bt * C + ee * X + _e * Tt, h[1] = Pt * w + Bt * N + ee * tt + _e * Lt, h[2] = Pt * H + Bt * z + ee * at + _e * Et, h[3] = Pt * A + Bt * W + ee * ut + _e * $t, h[4] = (Pt = p[4]) * g + (Bt = p[5]) * C + (ee = p[6]) * X + (_e = p[7]) * Tt, h[5] = Pt * w + Bt * N + ee * tt + _e * Lt, h[6] = Pt * H + Bt * z + ee * at + _e * Et, h[7] = Pt * A + Bt * W + ee * ut + _e * $t, h[8] = (Pt = p[8]) * g + (Bt = p[9]) * C + (ee = p[10]) * X + (_e = p[11]) * Tt, h[9] = Pt * w + Bt * N + ee * tt + _e * Lt, h[10] = Pt * H + Bt * z + ee * at + _e * Et, h[11] = Pt * A + Bt * W + ee * ut + _e * $t, h[12] = (Pt = p[12]) * g + (Bt = p[13]) * C + (ee = p[14]) * X + (_e = p[15]) * Tt, h[13] = Pt * w + Bt * N + ee * tt + _e * Lt, h[14] = Pt * H + Bt * z + ee * at + _e * Et, h[15] = Pt * A + Bt * W + ee * ut + _e * $t, h;
}
Math.hypot || (Math.hypot = function() {
for (var h = 0, c = arguments.length; c--; )
h += arguments[c] * arguments[c];
return Math.sqrt(h);
});
var Uc, wJ = PO;
function Sp(h, c, p) {
var g = c[0], w = c[1], H = c[2], A = c[3];
return h[0] = p[0] * g + p[4] * w + p[8] * H + p[12] * A, h[1] = p[1] * g + p[5] * w + p[9] * H + p[13] * A, h[2] = p[2] * g + p[6] * w + p[10] * H + p[14] * A, h[3] = p[3] * g + p[7] * w + p[11] * H + p[15] * A, h;
}
Uc = new Fl(4), Fl != Float32Array && (Uc[0] = 0, Uc[1] = 0, Uc[2] = 0, Uc[3] = 0);
class xJ extends m {
constructor(c) {
super(c, LJ);
}
createBucket(c) {
return new L_(c);
}
queryRadius(c) {
const p = c;
return zc("circle-radius", this, p) + zc("circle-stroke-width", this, p) + Ep(this.paint.get("circle-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Mp(c, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), A.angle, C), W = this.paint.get("circle-radius").evaluate(p, g) + this.paint.get("circle-stroke-width").evaluate(p, g), X = this.paint.get("circle-pitch-alignment") === "map", tt = X ? z : function(ut, Tt) {
return ut.map((Lt) => VO(Lt, Tt));
}(z, N), at = X ? W * C : W;
for (const ut of w)
for (const Tt of ut) {
const Lt = X ? Tt : VO(Tt, N);
let Et = at;
const $t = Sp([], [Tt.x, Tt.y, 0, 1], N);
if (this.paint.get("circle-pitch-scale") === "viewport" && this.paint.get("circle-pitch-alignment") === "map" ? Et *= $t[3] / A.cameraToCenterDistance : this.paint.get("circle-pitch-scale") === "map" && this.paint.get("circle-pitch-alignment") === "viewport" && (Et *= A.cameraToCenterDistance / $t[3]), yJ(tt, Lt, Et))
return !0;
}
return !1;
}
}
function VO(h, c) {
const p = Sp([], [h.x, h.y, 0, 1], c);
return new f(p[0] / p[3], p[1] / p[3]);
}
class RO extends L_ {
}
let NO;
nr("HeatmapBucket", RO, { omit: ["layers"] });
var EJ = { get paint() {
return NO = NO || new S({ "heatmap-radius": new Mr(Ct.paint_heatmap["heatmap-radius"]), "heatmap-weight": new Mr(Ct.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new cr(Ct.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Fc(Ct.paint_heatmap["heatmap-color"]), "heatmap-opacity": new cr(Ct.paint_heatmap["heatmap-opacity"]) });
} };
function M_(h, { width: c, height: p }, g, w) {
if (w) {
if (w instanceof Uint8ClampedArray)
w = new Uint8Array(w.buffer);
else if (w.length !== c * p * g)
throw new RangeError(`mismatched image size. expected: ${w.length} but got: ${c * p * g}`);
} else
w = new Uint8Array(c * p * g);
return h.width = c, h.height = p, h.data = w, h;
}
function DO(h, { width: c, height: p }, g) {
if (c === h.width && p === h.height)
return;
const w = M_({}, { width: c, height: p }, g);
S_(h, w, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(h.width, c), height: Math.min(h.height, p) }, g), h.width = c, h.height = p, h.data = w.data;
}
function S_(h, c, p, g, w, H) {
if (w.width === 0 || w.height === 0)
return c;
if (w.width > h.width || w.height > h.height || p.x > h.width - w.width || p.y > h.height - w.height)
throw new RangeError("out of range source coordinates for image copy");
if (w.width > c.width || w.height > c.height || g.x > c.width - w.width || g.y > c.height - w.height)
throw new RangeError("out of range destination coordinates for image copy");
const A = h.data, C = c.data;
if (A === C)
throw new Error("srcData equals dstData, so image is already copied");
for (let N = 0; N < w.height; N++) {
const z = ((p.y + N) * h.width + p.x) * H, W = ((g.y + N) * c.width + g.x) * H;
for (let X = 0; X < w.width * H; X++)
C[W + X] = A[z + X];
}
return c;
}
class Gc {
constructor(c, p) {
M_(this, c, 1, p);
}
resize(c) {
DO(this, c, 1);
}
clone() {
return new Gc({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, w, H) {
S_(c, p, g, w, H, 1);
}
}
class k2 {
constructor(c, p) {
M_(this, c, 4, p);
}
resize(c) {
DO(this, c, 4);
}
replace(c, p) {
p ? this.data.set(c) : this.data = c instanceof Uint8ClampedArray ? new Uint8Array(c.buffer) : c;
}
clone() {
return new k2({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, w, H) {
S_(c, p, g, w, H, 4);
}
}
function FO(h) {
const c = {}, p = h.resolution || 256, g = h.clips ? h.clips.length : 1, w = h.image || new k2({ width: p, height: g });
if (Math.log(p) / Math.LN2 % 1 != 0)
throw new Error(`width is not a power of 2 - ${p}`);
const H = (A, C, N) => {
c[h.evaluationKey] = N;
const z = h.expression.evaluate(c);
w.data[A + C + 0] = Math.floor(255 * z.r / z.a), w.data[A + C + 1] = Math.floor(255 * z.g / z.a), w.data[A + C + 2] = Math.floor(255 * z.b / z.a), w.data[A + C + 3] = Math.floor(255 * z.a);
};
if (h.clips)
for (let A = 0, C = 0; A < g; ++A, C += 4 * p)
for (let N = 0, z = 0; N < p; N++, z += 4) {
const W = N / (p - 1), { start: X, end: tt } = h.clips[A];
H(C, z, X * (1 - W) + tt * W);
}
else
for (let A = 0, C = 0; A < p; A++, C += 4)
H(0, C, A / (p - 1));
return w;
}
nr("AlphaImage", Gc), nr("RGBAImage", k2);
const H_ = "big-fb";
class MJ extends m {
createBucket(c) {
return new RO(c);
}
constructor(c) {
super(c, EJ), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();
}
_handleSpecialPaintPropertyUpdate(c) {
c === "heatmap-color" && this._updateColorRamp();
}
_updateColorRamp() {
this.colorRamp = FO({ expression: this._transitionablePaint._values["heatmap-color"].value.expression, evaluationKey: "heatmapDensity", image: this.colorRamp }), this.colorRampTexture = null;
}
resize() {
this.heatmapFbos.has(H_) && this.heatmapFbos.delete(H_);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
return !1;
}
hasOffscreenPass() {
return this.paint.get("heatmap-opacity") !== 0 && this.visibility !== "none";
}
}
let BO;
var SJ = { get paint() {
return BO = BO || new S({ "hillshade-illumination-direction": new cr(Ct.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new cr(Ct.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new cr(Ct.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new cr(Ct.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new cr(Ct.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new cr(Ct.paint_hillshade["hillshade-accent-color"]) });
} };
class HJ extends m {
constructor(c) {
super(c, SJ);
}
hasOffscreenPass() {
return this.paint.get("hillshade-exaggeration") !== 0 && this.visibility !== "none";
}
}
const AJ = V([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: OJ } = AJ;
function jO(h, c, p = 2) {
const g = c && c.length, w = g ? c[0] * p : h.length;
let H = zO(h, 0, w, p, !0);
const A = [];
if (!H || H.next === H.prev)
return A;
let C, N, z;
if (g && (H = function(W, X, tt, at) {
const ut = [];
for (let Tt = 0, Lt = X.length; Tt < Lt; Tt++) {
const Et = zO(W, X[Tt] * at, Tt < Lt - 1 ? X[Tt + 1] * at : W.length, at, !1);
Et === Et.next && (Et.steiner = !0), ut.push(DJ(Et));
}
ut.sort(VJ);
for (let Tt = 0; Tt < ut.length; Tt++)
tt = RJ(ut[Tt], tt);
return tt;
}(h, c, H, p)), h.length > 80 * p) {
C = 1 / 0, N = 1 / 0;
let W = -1 / 0, X = -1 / 0;
for (let tt = p; tt < w; tt += p) {
const at = h[tt], ut = h[tt + 1];
at < C && (C = at), ut < N && (N = ut), at > W && (W = at), ut > X && (X = ut);
}
z = Math.max(W - C, X - N), z = z !== 0 ? 32767 / z : 0;
}
return $c(H, A, p, C, N, z, 0), A;
}
function zO(h, c, p, g, w) {
let H;
if (w === function(A, C, N, z) {
let W = 0;
for (let X = C, tt = N - z; X < N; X += z)
W += (A[tt] - A[X]) * (A[X + 1] + A[tt + 1]), tt = X;
return W;
}(h, c, p, g) > 0)
for (let A = c; A < p; A += g)
H = $O(A / g | 0, h[A], h[A + 1], H);
else
for (let A = p - g; A >= c; A -= g)
H = $O(A / g | 0, h[A], h[A + 1], H);
return H && Hp(H, H.next) && (Zc(H), H = H.next), H;
}
function B0(h, c) {
if (!h)
return h;
c || (c = h);
let p, g = h;
do
if (p = !1, g.steiner || !Hp(g, g.next) && Di(g.prev, g, g.next) !== 0)
g = g.next;
else {
if (Zc(g), g = c = g.prev, g === g.next)
break;
p = !0;
}
while (p || g !== c);
return c;
}
function $c(h, c, p, g, w, H, A) {
if (!h)
return;
!A && H && function(N, z, W, X) {
let tt = N;
do
tt.z === 0 && (tt.z = A_(tt.x, tt.y, z, W, X)), tt.prevZ = tt.prev, tt.nextZ = tt.next, tt = tt.next;
while (tt !== N);
tt.prevZ.nextZ = null, tt.prevZ = null, function(at) {
let ut, Tt = 1;
do {
let Lt, Et = at;
at = null;
let $t = null;
for (ut = 0; Et; ) {
ut++;
let Pt = Et, Bt = 0;
for (let _e = 0; _e < Tt && (Bt++, Pt = Pt.nextZ, Pt); _e++)
;
let ee = Tt;
for (; Bt > 0 || ee > 0 && Pt; )
Bt !== 0 && (ee === 0 || !Pt || Et.z <= Pt.z) ? (Lt = Et, Et = Et.nextZ, Bt--) : (Lt = Pt, Pt = Pt.nextZ, ee--), $t ? $t.nextZ = Lt : at = Lt, Lt.prevZ = $t, $t = Lt;
Et = Pt;
}
$t.nextZ = null, Tt *= 2;
} while (ut > 1);
}(tt);
}(h, g, w, H);
let C = h;
for (; h.prev !== h.next; ) {
const N = h.prev, z = h.next;
if (H ? kJ(h, g, w, H) : CJ(h))
c.push(N.i, h.i, z.i), Zc(h), h = z.next, C = z.next;
else if ((h = z) === C) {
A ? A === 1 ? $c(h = IJ(B0(h), c), c, p, g, w, H, 2) : A === 2 && PJ(h, c, p, g, w, H) : $c(B0(h), c, p, g, w, H, 1);
break;
}
}
}
function CJ(h) {
const c = h.prev, p = h, g = h.next;
if (Di(c, p, g) >= 0)
return !1;
const w = c.x, H = p.x, A = g.x, C = c.y, N = p.y, z = g.y, W = w < H ? w < A ? w : A : H < A ? H : A, X = C < N ? C < z ? C : z : N < z ? N : z, tt = w > H ? w > A ? w : A : H > A ? H : A, at = C > N ? C > z ? C : z : N > z ? N : z;
let ut = g.next;
for (; ut !== c; ) {
if (ut.x >= W && ut.x <= tt && ut.y >= X && ut.y <= at && Bl(w, C, H, N, A, z, ut.x, ut.y) && Di(ut.prev, ut, ut.next) >= 0)
return !1;
ut = ut.next;
}
return !0;
}
function kJ(h, c, p, g) {
const w = h.prev, H = h, A = h.next;
if (Di(w, H, A) >= 0)
return !1;
const C = w.x, N = H.x, z = A.x, W = w.y, X = H.y, tt = A.y, at = C < N ? C < z ? C : z : N < z ? N : z, ut = W < X ? W < tt ? W : tt : X < tt ? X : tt, Tt = C > N ? C > z ? C : z : N > z ? N : z, Lt = W > X ? W > tt ? W : tt : X > tt ? X : tt, Et = A_(at, ut, c, p, g), $t = A_(Tt, Lt, c, p, g);
let Pt = h.prevZ, Bt = h.nextZ;
for (; Pt && Pt.z >= Et && Bt && Bt.z <= $t; ) {
if (Pt.x >= at && Pt.x <= Tt && Pt.y >= ut && Pt.y <= Lt && Pt !== w && Pt !== A && Bl(C, W, N, X, z, tt, Pt.x, Pt.y) && Di(Pt.prev, Pt, Pt.next) >= 0 || (Pt = Pt.prevZ, Bt.x >= at && Bt.x <= Tt && Bt.y >= ut && Bt.y <= Lt && Bt !== w && Bt !== A && Bl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0))
return !1;
Bt = Bt.nextZ;
}
for (; Pt && Pt.z >= Et; ) {
if (Pt.x >= at && Pt.x <= Tt && Pt.y >= ut && Pt.y <= Lt && Pt !== w && Pt !== A && Bl(C, W, N, X, z, tt, Pt.x, Pt.y) && Di(Pt.prev, Pt, Pt.next) >= 0)
return !1;
Pt = Pt.prevZ;
}
for (; Bt && Bt.z <= $t; ) {
if (Bt.x >= at && Bt.x <= Tt && Bt.y >= ut && Bt.y <= Lt && Bt !== w && Bt !== A && Bl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0)
return !1;
Bt = Bt.nextZ;
}
return !0;
}
function IJ(h, c) {
let p = h;
do {
const g = p.prev, w = p.next.next;
!Hp(g, w) && UO(g, p, p.next, w) && Wc(g, w) && Wc(w, g) && (c.push(g.i, p.i, w.i), Zc(p), Zc(p.next), p = h = w), p = p.next;
} while (p !== h);
return B0(p);
}
function PJ(h, c, p, g, w, H) {
let A = h;
do {
let C = A.next.next;
for (; C !== A.prev; ) {
if (A.i !== C.i && FJ(A, C)) {
let N = GO(A, C);
return A = B0(A, A.next), N = B0(N, N.next), $c(A, c, p, g, w, H, 0), void $c(N, c, p, g, w, H, 0);
}
C = C.next;
}
A = A.next;
} while (A !== h);
}
function VJ(h, c) {
return h.x - c.x;
}
function RJ(h, c) {
const p = function(w, H) {
let A = H;
const C = w.x, N = w.y;
let z, W = -1 / 0;
do {
if (N <= A.y && N >= A.next.y && A.next.y !== A.y) {
const Tt = A.x + (N - A.y) * (A.next.x - A.x) / (A.next.y - A.y);
if (Tt <= C && Tt > W && (W = Tt, z = A.x < A.next.x ? A : A.next, Tt === C))
return z;
}
A = A.next;
} while (A !== H);
if (!z)
return null;
const X = z, tt = z.x, at = z.y;
let ut = 1 / 0;
A = z;
do {
if (C >= A.x && A.x >= tt && C !== A.x && Bl(N < at ? C : W, N, tt, at, N < at ? W : C, N, A.x, A.y)) {
const Tt = Math.abs(N - A.y) / (C - A.x);
Wc(A, w) && (Tt < ut || Tt === ut && (A.x > z.x || A.x === z.x && NJ(z, A))) && (z = A, ut = Tt);
}
A = A.next;
} while (A !== X);
return z;
}(h, c);
if (!p)
return c;
const g = GO(p, h);
return B0(g, g.next), B0(p, p.next);
}
function NJ(h, c) {
return Di(h.prev, h, c.prev) < 0 && Di(c.next, h, h.next) < 0;
}
function A_(h, c, p, g, w) {
return (h = 1431655765 & ((h = 858993459 & ((h = 252645135 & ((h = 16711935 & ((h = (h - p) * w | 0) | h << 8)) | h << 4)) | h << 2)) | h << 1)) | (c = 1431655765 & ((c = 858993459 & ((c = 252645135 & ((c = 16711935 & ((c = (c - g) * w | 0) | c << 8)) | c << 4)) | c << 2)) | c << 1)) << 1;
}
function DJ(h) {
let c = h, p = h;
do
(c.x < p.x || c.x === p.x && c.y < p.y) && (p = c), c = c.next;
while (c !== h);
return p;
}
function Bl(h, c, p, g, w, H, A, C) {
return (w - A) * (c - C) >= (h - A) * (H - C) && (h - A) * (g - C) >= (p - A) * (c - C) && (p - A) * (H - C) >= (w - A) * (g - C);
}
function FJ(h, c) {
return h.next.i !== c.i && h.prev.i !== c.i && !function(p, g) {
let w = p;
do {
if (w.i !== p.i && w.next.i !== p.i && w.i !== g.i && w.next.i !== g.i && UO(w, w.next, p, g))
return !0;
w = w.next;
} while (w !== p);
return !1;
}(h, c) && (Wc(h, c) && Wc(c, h) && function(p, g) {
let w = p, H = !1;
const A = (p.x + g.x) / 2, C = (p.y + g.y) / 2;
do
w.y > C != w.next.y > C && w.next.y !== w.y && A < (w.next.x - w.x) * (C - w.y) / (w.next.y - w.y) + w.x && (H = !H), w = w.next;
while (w !== p);
return H;
}(h, c) && (Di(h.prev, h, c.prev) || Di(h, c.prev, c)) || Hp(h, c) && Di(h.prev, h, h.next) > 0 && Di(c.prev, c, c.next) > 0);
}
function Di(h, c, p) {
return (c.y - h.y) * (p.x - c.x) - (c.x - h.x) * (p.y - c.y);
}
function Hp(h, c) {
return h.x === c.x && h.y === c.y;
}
function UO(h, c, p, g) {
const w = Op(Di(h, c, p)), H = Op(Di(h, c, g)), A = Op(Di(p, g, h)), C = Op(Di(p, g, c));
return w !== H && A !== C || !(w !== 0 || !Ap(h, p, c)) || !(H !== 0 || !Ap(h, g, c)) || !(A !== 0 || !Ap(p, h, g)) || !(C !== 0 || !Ap(p, c, g));
}
function Ap(h, c, p) {
return c.x <= Math.max(h.x, p.x) && c.x >= Math.min(h.x, p.x) && c.y <= Math.max(h.y, p.y) && c.y >= Math.min(h.y, p.y);
}
function Op(h) {
return h > 0 ? 1 : h < 0 ? -1 : 0;
}
function Wc(h, c) {
return Di(h.prev, h, h.next) < 0 ? Di(h, c, h.next) >= 0 && Di(h, h.prev, c) >= 0 : Di(h, c, h.prev) < 0 || Di(h, h.next, c) < 0;
}
function GO(h, c) {
const p = O_(h.i, h.x, h.y), g = O_(c.i, c.x, c.y), w = h.next, H = c.prev;
return h.next = c, c.prev = h, p.next = w, w.prev = p, g.next = p, p.prev = g, H.next = g, g.prev = H, g;
}
function $O(h, c, p, g) {
const w = O_(h, c, p);
return g ? (w.next = g.next, w.prev = g, g.next.prev = w, g.next = w) : (w.prev = w, w.next = w), w;
}
function Zc(h) {
h.next.prev = h.prev, h.prev.next = h.next, h.prevZ && (h.prevZ.nextZ = h.nextZ), h.nextZ && (h.nextZ.prevZ = h.prevZ);
}
function O_(h, c, p) {
return { i: h, x: c, y: p, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: !1 };
}
function C_(h, c, p) {
const g = p.patternDependencies;
let w = !1;
for (const H of c) {
const A = H.paint.get(`${h}-pattern`);
A.isConstant() || (w = !0);
const C = A.constantOr(null);
C && (w = !0, g[C.to] = !0, g[C.from] = !0);
}
return w;
}
function k_(h, c, p, g, w) {
const H = w.patternDependencies;
for (const A of c) {
const C = A.paint.get(`${h}-pattern`).value;
if (C.kind !== "constant") {
let N = C.evaluate({ zoom: g - 1 }, p, {}, w.availableImages), z = C.evaluate({ zoom: g }, p, {}, w.availableImages), W = C.evaluate({ zoom: g + 1 }, p, {}, w.availableImages);
N = N && N.name ? N.name : N, z = z && z.name ? z.name : z, W = W && W.name ? W.name : W, H[N] = !0, H[z] = !0, H[W] = !0, p.patterns[A.id] = { min: N, mid: z, max: W };
}
}
return p;
}
class I_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.patternFeatures = [], this.layoutVertexArray = new Qs(), this.indexArray = new C2(), this.indexArray2 = new b1(), this.programConfigurations = new N0(c.layers, c.zoom), this.segments = new an(), this.segments2 = new an(), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.hasPattern = C_("fill", this.layers, p);
const w = this.layers[0].layout.get("fill-sort-key"), H = !w.isConstant(), A = [];
for (const { feature: C, id: N, index: z, sourceLayerIndex: W } of c) {
const X = this.layers[0]._featureFilter.needGeometry, tt = F0(C, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), tt, g))
continue;
const at = H ? w.evaluate(tt, {}, g, p.availableImages) : void 0, ut = { id: N, properties: C.properties, type: C.type, sourceLayerIndex: W, index: z, geometry: X ? tt.geometry : D0(C), patterns: {}, sortKey: at };
A.push(ut);
}
H && A.sort((C, N) => C.sortKey - N.sortKey);
for (const C of A) {
const { geometry: N, index: z, sourceLayerIndex: W } = C;
if (this.hasPattern) {
const X = k_("fill", this.layers, C, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(C, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, W, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const w of this.patternFeatures)
this.addFeature(w, w.geometry, w.index, p, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, OJ), this.indexBuffer = c.createIndexBuffer(this.indexArray), this.indexBuffer2 = c.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
}
addFeature(c, p, g, w, H) {
for (const A of z4(p, 500)) {
let C = 0;
for (const at of A)
C += at.length;
const N = this.segments.prepareSegment(C, this.layoutVertexArray, this.indexArray), z = N.vertexLength, W = [], X = [];
for (const at of A) {
if (at.length === 0)
continue;
at !== A[0] && X.push(W.length / 2);
const ut = this.segments2.prepareSegment(at.length, this.layoutVertexArray, this.indexArray2), Tt = ut.vertexLength;
this.layoutVertexArray.emplaceBack(at[0].x, at[0].y), this.indexArray2.emplaceBack(Tt + at.length - 1, Tt), W.push(at[0].x), W.push(at[0].y);
for (let Lt = 1; Lt < at.length; Lt++)
this.layoutVertexArray.emplaceBack(at[Lt].x, at[Lt].y), this.indexArray2.emplaceBack(Tt + Lt - 1, Tt + Lt), W.push(at[Lt].x), W.push(at[Lt].y);
ut.vertexLength += at.length, ut.primitiveLength += at.length;
}
const tt = jO(W, X);
for (let at = 0; at < tt.length; at += 3)
this.indexArray.emplaceBack(z + tt[at], z + tt[at + 1], z + tt[at + 2]);
N.vertexLength += C, N.primitiveLength += tt.length / 3;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
}
let WO, ZO;
nr("FillBucket", I_, { omit: ["layers", "patternFeatures"] });
var BJ = { get paint() {
return ZO = ZO || new S({ "fill-antialias": new cr(Ct.paint_fill["fill-antialias"]), "fill-opacity": new Mr(Ct.paint_fill["fill-opacity"]), "fill-color": new Mr(Ct.paint_fill["fill-color"]), "fill-outline-color": new Mr(Ct.paint_fill["fill-outline-color"]), "fill-translate": new cr(Ct.paint_fill["fill-translate"]), "fill-translate-anchor": new cr(Ct.paint_fill["fill-translate-anchor"]), "fill-pattern": new Ol(Ct.paint_fill["fill-pattern"]) });
}, get layout() {
return WO = WO || new S({ "fill-sort-key": new Mr(Ct.layout_fill["fill-sort-key"]) });
} };
class jJ extends m {
constructor(c) {
super(c, BJ);
}
recalculate(c, p) {
super.recalculate(c, p);
const g = this.paint._values["fill-outline-color"];
g.value.kind === "constant" && g.value.value === void 0 && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]);
}
createBucket(c) {
return new I_(c);
}
queryRadius() {
return Ep(this.paint.get("fill-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
return AO(Mp(c, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), A.angle, C), w);
}
isTileClipped() {
return !0;
}
}
const zJ = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), UJ = V([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: GJ } = zJ;
var h6 = {}, $J = d, qO = jl;
function jl(h, c, p, g, w) {
this.properties = {}, this.extent = p, this.type = 0, this._pbf = h, this._geometry = -1, this._keys = g, this._values = w, h.readFields(WJ, this, c);
}
function WJ(h, c, p) {
h == 1 ? c.id = p.readVarint() : h == 2 ? function(g, w) {
for (var H = g.readVarint() + g.pos; g.pos < H; ) {
var A = w._keys[g.readVarint()], C = w._values[g.readVarint()];
w.properties[A] = C;
}
}(p, c) : h == 3 ? c.type = p.readVarint() : h == 4 && (c._geometry = p.pos);
}
function ZJ(h) {
for (var c, p, g = 0, w = 0, H = h.length, A = H - 1; w < H; A = w++)
g += ((p = h[A]).x - (c = h[w]).x) * (c.y + p.y);
return g;
}
jl.types = ["Unknown", "Point", "LineString", "Polygon"], jl.prototype.loadGeometry = function() {
var h = this._pbf;
h.pos = this._geometry;
for (var c, p = h.readVarint() + h.pos, g = 1, w = 0, H = 0, A = 0, C = []; h.pos < p; ) {
if (w <= 0) {
var N = h.readVarint();
g = 7 & N, w = N >> 3;
}
if (w--, g === 1 || g === 2)
H += h.readSVarint(), A += h.readSVarint(), g === 1 && (c && C.push(c), c = []), c.push(new $J(H, A));
else {
if (g !== 7)
throw new Error("unknown command " + g);
c && c.push(c[0].clone());
}
}
return c && C.push(c), C;
}, jl.prototype.bbox = function() {
var h = this._pbf;
h.pos = this._geometry;
for (var c = h.readVarint() + h.pos, p = 1, g = 0, w = 0, H = 0, A = 1 / 0, C = -1 / 0, N = 1 / 0, z = -1 / 0; h.pos < c; ) {
if (g <= 0) {
var W = h.readVarint();
p = 7 & W, g = W >> 3;
}
if (g--, p === 1 || p === 2)
(w += h.readSVarint()) < A && (A = w), w > C && (C = w), (H += h.readSVarint()) < N && (N = H), H > z && (z = H);
else if (p !== 7)
throw new Error("unknown command " + p);
}
return [A, N, C, z];
}, jl.prototype.toGeoJSON = function(h, c, p) {
var g, w, H = this.extent * Math.pow(2, p), A = this.extent * h, C = this.extent * c, N = this.loadGeometry(), z = jl.types[this.type];
function W(at) {
for (var ut = 0; ut < at.length; ut++) {
var Tt = at[ut];
at[ut] = [360 * (Tt.x + A) / H - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (Tt.y + C) / H) * Math.PI / 180)) - 90];
}
}
switch (this.type) {
case 1:
var X = [];
for (g = 0; g < N.length; g++)
X[g] = N[g][0];
W(N = X);
break;
case 2:
for (g = 0; g < N.length; g++)
W(N[g]);
break;
case 3:
for (N = function(at) {
var ut = at.length;
if (ut <= 1)
return [at];
for (var Tt, Lt, Et = [], $t = 0; $t < ut; $t++) {
var Pt = ZJ(at[$t]);
Pt !== 0 && (Lt === void 0 && (Lt = Pt < 0), Lt === Pt < 0 ? (Tt && Et.push(Tt), Tt = [at[$t]]) : Tt.push(at[$t]));
}
return Tt && Et.push(Tt), Et;
}(N), g = 0; g < N.length; g++)
for (w = 0; w < N[g].length; w++)
W(N[g][w]);
}
N.length === 1 ? N = N[0] : z = "Multi" + z;
var tt = { type: "Feature", geometry: { type: z, coordinates: N }, properties: this.properties };
return "id" in this && (tt.id = this.id), tt;
};
var qJ = qO, XO = KO;
function KO(h, c) {
this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = h, this._keys = [], this._values = [], this._features = [], h.readFields(XJ, this, c), this.length = this._features.length;
}
function XJ(h, c, p) {
h === 15 ? c.version = p.readVarint() : h === 1 ? c.name = p.readString() : h === 5 ? c.extent = p.readVarint() : h === 2 ? c._features.push(p.pos) : h === 3 ? c._keys.push(p.readString()) : h === 4 && c._values.push(function(g) {
for (var w = null, H = g.readVarint() + g.pos; g.pos < H; ) {
var A = g.readVarint() >> 3;
w = A === 1 ? g.readString() : A === 2 ? g.readFloat() : A === 3 ? g.readDouble() : A === 4 ? g.readVarint64() : A === 5 ? g.readVarint() : A === 6 ? g.readSVarint() : A === 7 ? g.readBoolean() : null;
}
return w;
}(p));
}
KO.prototype.feature = function(h) {
if (h < 0 || h >= this._features.length)
throw new Error("feature index out of bounds");
this._pbf.pos = this._features[h];
var c = this._pbf.readVarint() + this._pbf.pos;
return new qJ(this._pbf, c, this.extent, this._keys, this._values);
};
var KJ = XO;
function YJ(h, c, p) {
if (h === 3) {
var g = new KJ(p, p.readVarint() + p.pos);
g.length && (c[g.name] = g);
}
}
h6.VectorTile = function(h, c) {
this.layers = h.readFields(YJ, {}, c);
}, h6.VectorTileFeature = qO, h6.VectorTileLayer = XO;
const JJ = h6.VectorTileFeature.types, P_ = Math.pow(2, 13);
function qc(h, c, p, g, w, H, A, C) {
h.emplaceBack(c, p, 2 * Math.floor(g * P_) + A, w * P_ * 2, H * P_ * 2, Math.round(C));
}
class V_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.layoutVertexArray = new o6(), this.centroidVertexArray = new k1(), this.indexArray = new C2(), this.programConfigurations = new N0(c.layers, c.zoom), this.segments = new an(), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.features = [], this.hasPattern = C_("fill-extrusion", this.layers, p);
for (const { feature: w, id: H, index: A, sourceLayerIndex: C } of c) {
const N = this.layers[0]._featureFilter.needGeometry, z = F0(w, N);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), z, g))
continue;
const W = { id: H, sourceLayerIndex: C, index: A, geometry: N ? z.geometry : D0(w), properties: w.properties, type: w.type, patterns: {} };
this.hasPattern ? this.features.push(k_("fill-extrusion", this.layers, W, this.zoom, p)) : this.addFeature(W, W.geometry, A, g, {}), p.featureIndex.insert(w, W.geometry, A, C, this.index, !0);
}
}
addFeatures(c, p, g) {
for (const w of this.features) {
const { geometry: H } = w;
this.addFeature(w, H, w.index, p, g);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0 && this.centroidVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, GJ), this.centroidVertexBuffer = c.createVertexBuffer(this.centroidVertexArray, UJ.members, !0), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.centroidVertexBuffer.destroy());
}
addFeature(c, p, g, w, H) {
for (const A of z4(p, 500)) {
const C = { x: 0, y: 0, vertexCount: 0 };
let N = 0;
for (const ut of A)
N += ut.length;
let z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
for (const ut of A) {
if (ut.length === 0 || ett(ut))
continue;
let Tt = 0;
for (let Lt = 0; Lt < ut.length; Lt++) {
const Et = ut[Lt];
if (Lt >= 1) {
const $t = ut[Lt - 1];
if (!ttt(Et, $t)) {
z.vertexLength + 4 > an.MAX_VERTEX_ARRAY_LENGTH && (z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
const Pt = Et.sub($t)._perp()._unit(), Bt = $t.dist(Et);
Tt + Bt > 32768 && (Tt = 0), qc(this.layoutVertexArray, Et.x, Et.y, Pt.x, Pt.y, 0, 0, Tt), qc(this.layoutVertexArray, Et.x, Et.y, Pt.x, Pt.y, 0, 1, Tt), C.x += 2 * Et.x, C.y += 2 * Et.y, C.vertexCount += 2, Tt += Bt, qc(this.layoutVertexArray, $t.x, $t.y, Pt.x, Pt.y, 0, 0, Tt), qc(this.layoutVertexArray, $t.x, $t.y, Pt.x, Pt.y, 0, 1, Tt), C.x += 2 * $t.x, C.y += 2 * $t.y, C.vertexCount += 2;
const ee = z.vertexLength;
this.indexArray.emplaceBack(ee, ee + 2, ee + 1), this.indexArray.emplaceBack(ee + 1, ee + 2, ee + 3), z.vertexLength += 4, z.primitiveLength += 2;
}
}
}
}
if (z.vertexLength + N > an.MAX_VERTEX_ARRAY_LENGTH && (z = this.segments.prepareSegment(N, this.layoutVertexArray, this.indexArray)), JJ[c.type] !== "Polygon")
continue;
const W = [], X = [], tt = z.vertexLength;
for (const ut of A)
if (ut.length !== 0) {
ut !== A[0] && X.push(W.length / 2);
for (let Tt = 0; Tt < ut.length; Tt++) {
const Lt = ut[Tt];
qc(this.layoutVertexArray, Lt.x, Lt.y, 0, 0, 1, 1, 0), C.x += Lt.x, C.y += Lt.y, C.vertexCount += 1, W.push(Lt.x), W.push(Lt.y);
}
}
const at = jO(W, X);
for (let ut = 0; ut < at.length; ut += 3)
this.indexArray.emplaceBack(tt + at[ut], tt + at[ut + 2], tt + at[ut + 1]);
z.primitiveLength += at.length / 3, z.vertexLength += N;
for (let ut = 0; ut < C.vertexCount; ut++) {
const Tt = Math.floor(C.x / C.vertexCount), Lt = Math.floor(C.y / C.vertexCount);
this.centroidVertexArray.emplaceBack(Tt, Lt);
}
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
}
function ttt(h, c) {
return h.x === c.x && (h.x < 0 || h.x > Zi) || h.y === c.y && (h.y < 0 || h.y > Zi);
}
function ett(h) {
return h.every((c) => c.x < 0) || h.every((c) => c.x > Zi) || h.every((c) => c.y < 0) || h.every((c) => c.y > Zi);
}
let YO;
nr("FillExtrusionBucket", V_, { omit: ["layers", "features"] });
var rtt = { get paint() {
return YO = YO || new S({ "fill-extrusion-opacity": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Ol(Ct["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) });
} };
class ntt extends m {
constructor(c) {
super(c, rtt);
}
createBucket(c) {
return new V_(c);
}
queryRadius() {
return Ep(this.paint.get("fill-extrusion-translate"));
}
is3D() {
return !0;
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Mp(c, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), A.angle, C), W = this.paint.get("fill-extrusion-height").evaluate(p, g), X = this.paint.get("fill-extrusion-base").evaluate(p, g), tt = function(ut, Tt, Lt, Et) {
const $t = [];
for (const Pt of ut) {
const Bt = [Pt.x, Pt.y, 0, 1];
Sp(Bt, Bt, Tt), $t.push(new f(Bt[0] / Bt[3], Bt[1] / Bt[3]));
}
return $t;
}(z, N), at = function(ut, Tt, Lt, Et) {
const $t = [], Pt = [], Bt = Et[8] * Tt, ee = Et[9] * Tt, _e = Et[10] * Tt, Xe = Et[11] * Tt, Er = Et[8] * Lt, ze = Et[9] * Lt, Re = Et[10] * Lt, Qr = Et[11] * Lt;
for (const sr of ut) {
const rr = [], ue = [];
for (const gr of sr) {
const pr = gr.x, Ir = gr.y, Fn = Et[0] * pr + Et[4] * Ir + Et[12], Pn = Et[1] * pr + Et[5] * Ir + Et[13], p1 = Et[2] * pr + Et[6] * Ir + Et[14], ms = Et[3] * pr + Et[7] * Ir + Et[15], V1 = p1 + _e, T1 = ms + Xe, yo = Fn + Er, vo = Pn + ze, _o = p1 + Re, Oi = ms + Qr, f1 = new f((Fn + Bt) / T1, (Pn + ee) / T1);
f1.z = V1 / T1, rr.push(f1);
const K1 = new f(yo / Oi, vo / Oi);
K1.z = _o / Oi, ue.push(K1);
}
$t.push(rr), Pt.push(ue);
}
return [$t, Pt];
}(w, X, W, N);
return function(ut, Tt, Lt) {
let Et = 1 / 0;
AO(Lt, Tt) && (Et = JO(Lt, Tt[0]));
for (let $t = 0; $t < Tt.length; $t++) {
const Pt = Tt[$t], Bt = ut[$t];
for (let ee = 0; ee < Pt.length - 1; ee++) {
const _e = Pt[ee], Xe = [_e, Pt[ee + 1], Bt[ee + 1], Bt[ee], _e];
HO(Lt, Xe) && (Et = Math.min(Et, JO(Lt, Xe)));
}
}
return Et !== 1 / 0 && Et;
}(at[0], at[1], tt);
}
}
function Xc(h, c) {
return h.x * c.x + h.y * c.y;
}
function JO(h, c) {
if (h.length === 1) {
let p = 0;
const g = c[p++];
let w;
for (; !w || g.equals(w); )
if (w = c[p++], !w)
return 1 / 0;
for (; p < c.length; p++) {
const H = c[p], A = h[0], C = w.sub(g), N = H.sub(g), z = A.sub(g), W = Xc(C, C), X = Xc(C, N), tt = Xc(N, N), at = Xc(z, C), ut = Xc(z, N), Tt = W * tt - X * X, Lt = (tt * at - X * ut) / Tt, Et = (W * ut - X * at) / Tt, $t = g.z * (1 - Lt - Et) + w.z * Lt + H.z * Et;
if (isFinite($t))
return $t;
}
return 1 / 0;
}
{
let p = 1 / 0;
for (const g of c)
p = Math.min(p, g.z);
return p;
}
}
const itt = V([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: ott } = itt, stt = V([{ name: "a_uv_x", components: 1, type: "Float32" }, { name: "a_split_index", components: 1, type: "Float32" }]), { members: att } = stt, ltt = h6.VectorTileFeature.types, ctt = Math.cos(Math.PI / 180 * 37.5), tC = Math.pow(2, 14) / 0.5;
class R_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach((p) => {
this.gradients[p.id] = {};
}), this.layoutVertexArray = new kl(), this.layoutVertexArray2 = new s6(), this.indexArray = new C2(), this.programConfigurations = new N0(c.layers, c.zoom), this.segments = new an(), this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.hasPattern = C_("line", this.layers, p);
const w = this.layers[0].layout.get("line-sort-key"), H = !w.isConstant(), A = [];
for (const { feature: C, id: N, index: z, sourceLayerIndex: W } of c) {
const X = this.layers[0]._featureFilter.needGeometry, tt = F0(C, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), tt, g))
continue;
const at = H ? w.evaluate(tt, {}, g) : void 0, ut = { id: N, properties: C.properties, type: C.type, sourceLayerIndex: W, index: z, geometry: X ? tt.geometry : D0(C), patterns: {}, sortKey: at };
A.push(ut);
}
H && A.sort((C, N) => C.sortKey - N.sortKey);
for (const C of A) {
const { geometry: N, index: z, sourceLayerIndex: W } = C;
if (this.hasPattern) {
const X = k_("line", this.layers, C, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(C, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, W, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const w of this.patternFeatures)
this.addFeature(w, w.geometry, w.index, p, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexArray2.length !== 0 && (this.layoutVertexBuffer2 = c.createVertexBuffer(this.layoutVertexArray2, att)), this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, ott), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
}
lineFeatureClips(c) {
if (c.properties && Object.prototype.hasOwnProperty.call(c.properties, "mapbox_clip_start") && Object.prototype.hasOwnProperty.call(c.properties, "mapbox_clip_end"))
return { start: +c.properties.mapbox_clip_start, end: +c.properties.mapbox_clip_end };
}
addFeature(c, p, g, w, H) {
const A = this.layers[0].layout, C = A.get("line-join").evaluate(c, {}), N = A.get("line-cap"), z = A.get("line-miter-limit"), W = A.get("line-round-limit");
this.lineClips = this.lineFeatureClips(c);
for (const X of p)
this.addLine(X, c, C, N, z, W);
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
addLine(c, p, g, w, H, A) {
if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineClips) {
this.lineClipsArray.push(this.lineClips);
for (let Et = 0; Et < c.length - 1; Et++)
this.totalDistance += c[Et].dist(c[Et + 1]);
this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);
}
const C = ltt[p.type] === "Polygon";
let N = c.length;
for (; N >= 2 && c[N - 1].equals(c[N - 2]); )
N--;
let z = 0;
for (; z < N - 1 && c[z].equals(c[z + 1]); )
z++;
if (N < (C ? 3 : 2))
return;
g === "bevel" && (H = 1.05);
const W = this.overscaling <= 16 ? 15 * Zi / (512 * this.overscaling) : 0, X = this.segments.prepareSegment(10 * N, this.layoutVertexArray, this.indexArray);
let tt, at, ut, Tt, Lt;
this.e1 = this.e2 = -1, C && (tt = c[N - 2], Lt = c[z].sub(tt)._unit()._perp());
for (let Et = z; Et < N; Et++) {
if (ut = Et === N - 1 ? C ? c[z + 1] : void 0 : c[Et + 1], ut && c[Et].equals(ut))
continue;
Lt && (Tt = Lt), tt && (at = tt), tt = c[Et], Lt = ut ? ut.sub(tt)._unit()._perp() : Tt, Tt = Tt || Lt;
let $t = Tt.add(Lt);
$t.x === 0 && $t.y === 0 || $t._unit();
const Pt = Tt.x * Lt.x + Tt.y * Lt.y, Bt = $t.x * Lt.x + $t.y * Lt.y, ee = Bt !== 0 ? 1 / Bt : 1 / 0, _e = 2 * Math.sqrt(2 - 2 * Bt), Xe = Bt < ctt && at && ut, Er = Tt.x * Lt.y - Tt.y * Lt.x > 0;
if (Xe && Et > z) {
const Qr = tt.dist(at);
if (Qr > 2 * W) {
const sr = tt.sub(tt.sub(at)._mult(W / Qr)._round());
this.updateDistance(at, sr), this.addCurrentVertex(sr, Tt, 0, 0, X), at = sr;
}
}
const ze = at && ut;
let Re = ze ? g : C ? "butt" : w;
if (ze && Re === "round" && (ee < A ? Re = "miter" : ee <= 2 && (Re = "fakeround")), Re === "miter" && ee > H && (Re = "bevel"), Re === "bevel" && (ee > 2 && (Re = "flipbevel"), ee < H && (Re = "miter")), at && this.updateDistance(at, tt), Re === "miter")
$t._mult(ee), this.addCurrentVertex(tt, $t, 0, 0, X);
else if (Re === "flipbevel") {
if (ee > 100)
$t = Lt.mult(-1);
else {
const Qr = ee * Tt.add(Lt).mag() / Tt.sub(Lt).mag();
$t._perp()._mult(Qr * (Er ? -1 : 1));
}
this.addCurrentVertex(tt, $t, 0, 0, X), this.addCurrentVertex(tt, $t.mult(-1), 0, 0, X);
} else if (Re === "bevel" || Re === "fakeround") {
const Qr = -Math.sqrt(ee * ee - 1), sr = Er ? Qr : 0, rr = Er ? 0 : Qr;
if (at && this.addCurrentVertex(tt, Tt, sr, rr, X), Re === "fakeround") {
const ue = Math.round(180 * _e / Math.PI / 20);
for (let gr = 1; gr < ue; gr++) {
let pr = gr / ue;
if (pr !== 0.5) {
const Fn = pr - 0.5;
pr += pr * Fn * (pr - 1) * ((1.0904 + Pt * (Pt * (3.55645 - 1.43519 * Pt) - 3.2452)) * Fn * Fn + (0.848013 + Pt * (0.215638 * Pt - 1.06021)));
}
const Ir = Lt.sub(Tt)._mult(pr)._add(Tt)._unit()._mult(Er ? -1 : 1);
this.addHalfVertex(tt, Ir.x, Ir.y, !1, Er, 0, X);
}
}
ut && this.addCurrentVertex(tt, Lt, -sr, -rr, X);
} else if (Re === "butt")
this.addCurrentVertex(tt, $t, 0, 0, X);
else if (Re === "square") {
const Qr = at ? 1 : -1;
this.addCurrentVertex(tt, $t, Qr, Qr, X);
} else
Re === "round" && (at && (this.addCurrentVertex(tt, Tt, 0, 0, X), this.addCurrentVertex(tt, Tt, 1, 1, X, !0)), ut && (this.addCurrentVertex(tt, Lt, -1, -1, X, !0), this.addCurrentVertex(tt, Lt, 0, 0, X)));
if (Xe && Et < N - 1) {
const Qr = tt.dist(ut);
if (Qr > 2 * W) {
const sr = tt.add(ut.sub(tt)._mult(W / Qr)._round());
this.updateDistance(tt, sr), this.addCurrentVertex(sr, Lt, 0, 0, X), tt = sr;
}
}
}
}
addCurrentVertex(c, p, g, w, H, A = !1) {
const C = p.y * w - p.x, N = -p.y - p.x * w;
this.addHalfVertex(c, p.x + p.y * g, p.y - p.x * g, A, !1, g, H), this.addHalfVertex(c, C, N, A, !0, -w, H), this.distance > tC / 2 && this.totalDistance === 0 && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(c, p, g, w, H, A));
}
addHalfVertex({ x: c, y: p }, g, w, H, A, C, N) {
const z = 0.5 * (this.lineClips ? this.scaledDistance * (tC - 1) : this.scaledDistance);
this.layoutVertexArray.emplaceBack((c << 1) + (H ? 1 : 0), (p << 1) + (A ? 1 : 0), Math.round(63 * g) + 128, Math.round(63 * w) + 128, 1 + (C === 0 ? 0 : C < 0 ? -1 : 1) | (63 & z) << 2, z >> 6), this.lineClips && this.layoutVertexArray2.emplaceBack((this.scaledDistance - this.lineClips.start) / (this.lineClips.end - this.lineClips.start), this.lineClipsArray.length);
const W = N.vertexLength++;
this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, W), N.primitiveLength++), A ? this.e2 = W : this.e1 = W;
}
updateScaledDistance() {
this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;
}
updateDistance(c, p) {
this.distance += c.dist(p), this.updateScaledDistance();
}
}
let eC, rC;
nr("LineBucket", R_, { omit: ["layers", "patternFeatures"] });
var nC = { get paint() {
return rC = rC || new S({ "line-opacity": new Mr(Ct.paint_line["line-opacity"]), "line-color": new Mr(Ct.paint_line["line-color"]), "line-translate": new cr(Ct.paint_line["line-translate"]), "line-translate-anchor": new cr(Ct.paint_line["line-translate-anchor"]), "line-width": new Mr(Ct.paint_line["line-width"]), "line-gap-width": new Mr(Ct.paint_line["line-gap-width"]), "line-offset": new Mr(Ct.paint_line["line-offset"]), "line-blur": new Mr(Ct.paint_line["line-blur"]), "line-dasharray": new Cl(Ct.paint_line["line-dasharray"]), "line-pattern": new Ol(Ct.paint_line["line-pattern"]), "line-gradient": new Fc(Ct.paint_line["line-gradient"]) });
}, get layout() {
return eC = eC || new S({ "line-cap": new cr(Ct.layout_line["line-cap"]), "line-join": new Mr(Ct.layout_line["line-join"]), "line-miter-limit": new cr(Ct.layout_line["line-miter-limit"]), "line-round-limit": new cr(Ct.layout_line["line-round-limit"]), "line-sort-key": new Mr(Ct.layout_line["line-sort-key"]) });
} };
class utt extends Mr {
possiblyEvaluate(c, p) {
return p = new ti(Math.floor(p.zoom), { now: p.now, fadeDuration: p.fadeDuration, zoomHistory: p.zoomHistory, transition: p.transition }), super.possiblyEvaluate(c, p);
}
evaluate(c, p, g, w) {
return p = $({}, p, { zoom: Math.floor(p.zoom) }), super.evaluate(c, p, g, w);
}
}
let Cp;
class htt extends m {
constructor(c) {
super(c, nC), this.gradientVersion = 0, Cp || (Cp = new utt(nC.paint.properties["line-width"].specification), Cp.useIntegerZoom = !0);
}
_handleSpecialPaintPropertyUpdate(c) {
if (c === "line-gradient") {
const p = this.gradientExpression();
this.stepInterpolant = !!function(g) {
return g._styleExpression !== void 0;
}(p) && p._styleExpression.expression instanceof qt, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER;
}
}
gradientExpression() {
return this._transitionablePaint._values["line-gradient"].value.expression;
}
recalculate(c, p) {
super.recalculate(c, p), this.paint._values["line-floorwidth"] = Cp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, c);
}
createBucket(c) {
return new R_(c);
}
queryRadius(c) {
const p = c, g = iC(zc("line-width", this, p), zc("line-gap-width", this, p)), w = zc("line-offset", this, p);
return g / 2 + Math.abs(w) + Ep(this.paint.get("line-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
const N = Mp(c, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), A.angle, C), z = C / 2 * iC(this.paint.get("line-width").evaluate(p, g), this.paint.get("line-gap-width").evaluate(p, g)), W = this.paint.get("line-offset").evaluate(p, g);
return W && (w = function(X, tt) {
const at = [];
for (let ut = 0; ut < X.length; ut++) {
const Tt = X[ut], Lt = [];
for (let Et = 0; Et < Tt.length; Et++) {
const $t = Tt[Et - 1], Pt = Tt[Et], Bt = Tt[Et + 1], ee = Et === 0 ? new f(0, 0) : Pt.sub($t)._unit()._perp(), _e = Et === Tt.length - 1 ? new f(0, 0) : Bt.sub(Pt)._unit()._perp(), Xe = ee._add(_e)._unit(), Er = Xe.x * _e.x + Xe.y * _e.y;
Er !== 0 && Xe._mult(1 / Er), Lt.push(Xe._mult(tt)._add(Pt));
}
at.push(Lt);
}
return at;
}(w, W * C)), function(X, tt, at) {
for (let ut = 0; ut < tt.length; ut++) {
const Tt = tt[ut];
if (X.length >= 3) {
for (let Lt = 0; Lt < Tt.length; Lt++)
if (Dl(X, Tt[Lt]))
return !0;
}
if (vJ(X, Tt, at))
return !0;
}
return !1;
}(N, w, z);
}
isTileClipped() {
return !0;
}
}
function iC(h, c) {
return c > 0 ? c + 2 * h : h;
}
const dtt = V([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), ptt = V([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
V([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
const Ttt = V([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }, { name: "a_box_real", components: 2, type: "Int16" }]);
V([{ 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 oC = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), ftt = V([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
function Qtt(h, c, p) {
return h.sections.forEach((g) => {
g.text = function(w, H, A) {
const C = H.layout.get("text-transform").evaluate(A, {});
return C === "uppercase" ? w = w.toLocaleUpperCase() : C === "lowercase" && (w = w.toLocaleLowerCase()), Vo.applyArabicShaping && (w = Vo.applyArabicShaping(w)), w;
}(g.text, c, p);
}), h;
}
V([{ name: "triangle", components: 3, type: "Uint16" }]), V([{ 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" }]), V([{ 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" }]), V([{ type: "Float32", name: "offsetX" }]), V([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]), V([{ type: "Uint16", name: "textAnchor" }, { type: "Float32", components: 2, name: "textOffset" }]);
const Kc = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" };
var r1 = 24, sC = In, aC = function(h, c, p, g, w) {
var H, A, C = 8 * w - g - 1, N = (1 << C) - 1, z = N >> 1, W = -7, X = w - 1, tt = -1, at = h[c + X];
for (X += tt, H = at & (1 << -W) - 1, at >>= -W, W += C; W > 0; H = 256 * H + h[c + X], X += tt, W -= 8)
;
for (A = H & (1 << -W) - 1, H >>= -W, W += g; W > 0; A = 256 * A + h[c + X], X += tt, W -= 8)
;
if (H === 0)
H = 1 - z;
else {
if (H === N)
return A ? NaN : 1 / 0 * (at ? -1 : 1);
A += Math.pow(2, g), H -= z;
}
return (at ? -1 : 1) * A * Math.pow(2, H - g);
}, lC = function(h, c, p, g, w, H) {
var A, C, N, z = 8 * H - w - 1, W = (1 << z) - 1, X = W >> 1, tt = w === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, at = 0, ut = 1, Tt = c < 0 || c === 0 && 1 / c < 0 ? 1 : 0;
for (c = Math.abs(c), isNaN(c) || c === 1 / 0 ? (C = isNaN(c) ? 1 : 0, A = W) : (A = Math.floor(Math.log(c) / Math.LN2), c * (N = Math.pow(2, -A)) < 1 && (A--, N *= 2), (c += A + X >= 1 ? tt / N : tt * Math.pow(2, 1 - X)) * N >= 2 && (A++, N /= 2), A + X >= W ? (C = 0, A = W) : A + X >= 1 ? (C = (c * N - 1) * Math.pow(2, w), A += X) : (C = c * Math.pow(2, X - 1) * Math.pow(2, w), A = 0)); w >= 8; h[p + at] = 255 & C, at += ut, C /= 256, w -= 8)
;
for (A = A << w | C, z += w; z > 0; h[p + at] = 255 & A, at += ut, A /= 256, z -= 8)
;
h[p + at - ut] |= 128 * Tt;
};
function In(h) {
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(h) ? h : new Uint8Array(h || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
}
In.Varint = 0, In.Fixed64 = 1, In.Bytes = 2, In.Fixed32 = 5;
var N_ = 4294967296, cC = 1 / N_, uC = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
function z3(h) {
return h.type === In.Bytes ? h.readVarint() + h.pos : h.pos + 1;
}
function mtt(h, c, p) {
return p ? 4294967296 * c + (h >>> 0) : 4294967296 * (c >>> 0) + (h >>> 0);
}
function hC(h, c, p) {
var g = c <= 16383 ? 1 : c <= 2097151 ? 2 : c <= 268435455 ? 3 : Math.floor(Math.log(c) / (7 * Math.LN2));
p.realloc(g);
for (var w = p.pos - 1; w >= h; w--)
p.buf[w + g] = p.buf[w];
}
function gtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeVarint(h[p]);
}
function ytt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSVarint(h[p]);
}
function vtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFloat(h[p]);
}
function _tt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeDouble(h[p]);
}
function btt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeBoolean(h[p]);
}
function Ltt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFixed32(h[p]);
}
function wtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSFixed32(h[p]);
}
function xtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFixed64(h[p]);
}
function Ett(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSFixed64(h[p]);
}
function kp(h, c) {
return (h[c] | h[c + 1] << 8 | h[c + 2] << 16) + 16777216 * h[c + 3];
}
function zl(h, c, p) {
h[p] = c, h[p + 1] = c >>> 8, h[p + 2] = c >>> 16, h[p + 3] = c >>> 24;
}
function dC(h, c) {
return (h[c] | h[c + 1] << 8 | h[c + 2] << 16) + (h[c + 3] << 24);
}
In.prototype = { destroy: function() {
this.buf = null;
}, readFields: function(h, c, p) {
for (p = p || this.length; this.pos < p; ) {
var g = this.readVarint(), w = g >> 3, H = this.pos;
this.type = 7 & g, h(w, c, this), this.pos === H && this.skip(g);
}
return c;
}, readMessage: function(h, c) {
return this.readFields(h, c, this.readVarint() + this.pos);
}, readFixed32: function() {
var h = kp(this.buf, this.pos);
return this.pos += 4, h;
}, readSFixed32: function() {
var h = dC(this.buf, this.pos);
return this.pos += 4, h;
}, readFixed64: function() {
var h = kp(this.buf, this.pos) + kp(this.buf, this.pos + 4) * N_;
return this.pos += 8, h;
}, readSFixed64: function() {
var h = kp(this.buf, this.pos) + dC(this.buf, this.pos + 4) * N_;
return this.pos += 8, h;
}, readFloat: function() {
var h = aC(this.buf, this.pos, !0, 23, 4);
return this.pos += 4, h;
}, readDouble: function() {
var h = aC(this.buf, this.pos, !0, 52, 8);
return this.pos += 8, h;
}, readVarint: function(h) {
var c, p, g = this.buf;
return c = 127 & (p = g[this.pos++]), p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 7, p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 14, p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 21, p < 128 ? c : function(w, H, A) {
var C, N, z = A.buf;
if (C = (112 & (N = z[A.pos++])) >> 4, N < 128 || (C |= (127 & (N = z[A.pos++])) << 3, N < 128) || (C |= (127 & (N = z[A.pos++])) << 10, N < 128) || (C |= (127 & (N = z[A.pos++])) << 17, N < 128) || (C |= (127 & (N = z[A.pos++])) << 24, N < 128) || (C |= (1 & (N = z[A.pos++])) << 31, N < 128))
return mtt(w, C, H);
throw new Error("Expected varint not more than 10 bytes");
}(c |= (15 & (p = g[this.pos])) << 28, h, this))));
}, readVarint64: function() {
return this.readVarint(!0);
}, readSVarint: function() {
var h = this.readVarint();
return h % 2 == 1 ? (h + 1) / -2 : h / 2;
}, readBoolean: function() {
return !!this.readVarint();
}, readString: function() {
var h = this.readVarint() + this.pos, c = this.pos;
return this.pos = h, h - c >= 12 && uC ? function(p, g, w) {
return uC.decode(p.subarray(g, w));
}(this.buf, c, h) : function(p, g, w) {
for (var H = "", A = g; A < w; ) {
var C, N, z, W = p[A], X = null, tt = W > 239 ? 4 : W > 223 ? 3 : W > 191 ? 2 : 1;
if (A + tt > w)
break;
tt === 1 ? W < 128 && (X = W) : tt === 2 ? (192 & (C = p[A + 1])) == 128 && (X = (31 & W) << 6 | 63 & C) <= 127 && (X = null) : tt === 3 ? (N = p[A + 2], (192 & (C = p[A + 1])) == 128 && (192 & N) == 128 && ((X = (15 & W) << 12 | (63 & C) << 6 | 63 & N) <= 2047 || X >= 55296 && X <= 57343) && (X = null)) : tt === 4 && (N = p[A + 2], z = p[A + 3], (192 & (C = p[A + 1])) == 128 && (192 & N) == 128 && (192 & z) == 128 && ((X = (15 & W) << 18 | (63 & C) << 12 | (63 & N) << 6 | 63 & z) <= 65535 || X >= 1114112) && (X = null)), X === null ? (X = 65533, tt = 1) : X > 65535 && (X -= 65536, H += String.fromCharCode(X >>> 10 & 1023 | 55296), X = 56320 | 1023 & X), H += String.fromCharCode(X), A += tt;
}
return H;
}(this.buf, c, h);
}, readBytes: function() {
var h = this.readVarint() + this.pos, c = this.buf.subarray(this.pos, h);
return this.pos = h, c;
}, readPackedVarint: function(h, c) {
if (this.type !== In.Bytes)
return h.push(this.readVarint(c));
var p = z3(this);
for (h = h || []; this.pos < p; )
h.push(this.readVarint(c));
return h;
}, readPackedSVarint: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSVarint());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSVarint());
return h;
}, readPackedBoolean: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readBoolean());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readBoolean());
return h;
}, readPackedFloat: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFloat());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFloat());
return h;
}, readPackedDouble: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readDouble());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readDouble());
return h;
}, readPackedFixed32: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFixed32());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFixed32());
return h;
}, readPackedSFixed32: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSFixed32());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSFixed32());
return h;
}, readPackedFixed64: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFixed64());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFixed64());
return h;
}, readPackedSFixed64: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSFixed64());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSFixed64());
return h;
}, skip: function(h) {
var c = 7 & h;
if (c === In.Varint)
for (; this.buf[this.pos++] > 127; )
;
else if (c === In.Bytes)
this.pos = this.readVarint() + this.pos;
else if (c === In.Fixed32)
this.pos += 4;
else {
if (c !== In.Fixed64)
throw new Error("Unimplemented type: " + c);
this.pos += 8;
}
}, writeTag: function(h, c) {
this.writeVarint(h << 3 | c);
}, realloc: function(h) {
for (var c = this.length || 16; c < this.pos + h; )
c *= 2;
if (c !== this.length) {
var p = new Uint8Array(c);
p.set(this.buf), this.buf = p, this.length = c;
}
}, finish: function() {
return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
}, writeFixed32: function(h) {
this.realloc(4), zl(this.buf, h, this.pos), this.pos += 4;
}, writeSFixed32: function(h) {
this.realloc(4), zl(this.buf, h, this.pos), this.pos += 4;
}, writeFixed64: function(h) {
this.realloc(8), zl(this.buf, -1 & h, this.pos), zl(this.buf, Math.floor(h * cC), this.pos + 4), this.pos += 8;
}, writeSFixed64: function(h) {
this.realloc(8), zl(this.buf, -1 & h, this.pos), zl(this.buf, Math.floor(h * cC), this.pos + 4), this.pos += 8;
}, writeVarint: function(h) {
(h = +h || 0) > 268435455 || h < 0 ? function(c, p) {
var g, w;
if (c >= 0 ? (g = c % 4294967296 | 0, w = c / 4294967296 | 0) : (w = ~(-c / 4294967296), 4294967295 ^ (g = ~(-c % 4294967296)) ? g = g + 1 | 0 : (g = 0, w = w + 1 | 0)), c >= 18446744073709552e3 || c < -18446744073709552e3)
throw new Error("Given varint doesn't fit into 10 bytes");
p.realloc(10), function(H, A, C) {
C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, C.buf[C.pos] = 127 & (H >>>= 7);
}(g, 0, p), function(H, A) {
var C = (7 & H) << 4;
A.buf[A.pos++] |= C | ((H >>>= 3) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H)))));
}(w, p);
}(h, this) : (this.realloc(4), this.buf[this.pos++] = 127 & h | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = 127 & (h >>>= 7) | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = 127 & (h >>>= 7) | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = h >>> 7 & 127))));
}, writeSVarint: function(h) {
this.writeVarint(h < 0 ? 2 * -h - 1 : 2 * h);
}, writeBoolean: function(h) {
this.writeVarint(!!h);
}, writeString: function(h) {
h = String(h), this.realloc(4 * h.length), this.pos++;
var c = this.pos;
this.pos = function(g, w, H) {
for (var A, C, N = 0; N < w.length; N++) {
if ((A = w.charCodeAt(N)) > 55295 && A < 57344) {
if (!C) {
A > 56319 || N + 1 === w.length ? (g[H++] = 239, g[H++] = 191, g[H++] = 189) : C = A;
continue;
}
if (A < 56320) {
g[H++] = 239, g[H++] = 191, g[H++] = 189, C = A;
continue;
}
A = C - 55296 << 10 | A - 56320 | 65536, C = null;
} else
C && (g[H++] = 239, g[H++] = 191, g[H++] = 189, C = null);
A < 128 ? g[H++] = A : (A < 2048 ? g[H++] = A >> 6 | 192 : (A < 65536 ? g[H++] = A >> 12 | 224 : (g[H++] = A >> 18 | 240, g[H++] = A >> 12 & 63 | 128), g[H++] = A >> 6 & 63 | 128), g[H++] = 63 & A | 128);
}
return H;
}(this.buf, h, this.pos);
var p = this.pos - c;
p >= 128 && hC(c, p, this), this.pos = c - 1, this.writeVarint(p), this.pos += p;
}, writeFloat: function(h) {
this.realloc(4), lC(this.buf, h, this.pos, !0, 23, 4), this.pos += 4;
}, writeDouble: function(h) {
this.realloc(8), lC(this.buf, h, this.pos, !0, 52, 8), this.pos += 8;
}, writeBytes: function(h) {
var c = h.length;
this.writeVarint(c), this.realloc(c);
for (var p = 0; p < c; p++)
this.buf[this.pos++] = h[p];
}, writeRawMessage: function(h, c) {
this.pos++;
var p = this.pos;
h(c, this);
var g = this.pos - p;
g >= 128 && hC(p, g, this), this.pos = p - 1, this.writeVarint(g), this.pos += g;
}, writeMessage: function(h, c, p) {
this.writeTag(h, In.Bytes), this.writeRawMessage(c, p);
}, writePackedVarint: function(h, c) {
c.length && this.writeMessage(h, gtt, c);
}, writePackedSVarint: function(h, c) {
c.length && this.writeMessage(h, ytt, c);
}, writePackedBoolean: function(h, c) {
c.length && this.writeMessage(h, btt, c);
}, writePackedFloat: function(h, c) {
c.length && this.writeMessage(h, vtt, c);
}, writePackedDouble: function(h, c) {
c.length && this.writeMessage(h, _tt, c);
}, writePackedFixed32: function(h, c) {
c.length && this.writeMessage(h, Ltt, c);
}, writePackedSFixed32: function(h, c) {
c.length && this.writeMessage(h, wtt, c);
}, writePackedFixed64: function(h, c) {
c.length && this.writeMessage(h, xtt, c);
}, writePackedSFixed64: function(h, c) {
c.length && this.writeMessage(h, Ett, c);
}, writeBytesField: function(h, c) {
this.writeTag(h, In.Bytes), this.writeBytes(c);
}, writeFixed32Field: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeFixed32(c);
}, writeSFixed32Field: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeSFixed32(c);
}, writeFixed64Field: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeFixed64(c);
}, writeSFixed64Field: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeSFixed64(c);
}, writeVarintField: function(h, c) {
this.writeTag(h, In.Varint), this.writeVarint(c);
}, writeSVarintField: function(h, c) {
this.writeTag(h, In.Varint), this.writeSVarint(c);
}, writeStringField: function(h, c) {
this.writeTag(h, In.Bytes), this.writeString(c);
}, writeFloatField: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeFloat(c);
}, writeDoubleField: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeDouble(c);
}, writeBooleanField: function(h, c) {
this.writeVarintField(h, !!c);
} };
var D_ = u(sC);
const F_ = 3;
function Mtt(h, c, p) {
h === 1 && p.readMessage(Stt, c);
}
function Stt(h, c, p) {
if (h === 3) {
const { id: g, bitmap: w, width: H, height: A, left: C, top: N, advance: z } = p.readMessage(Htt, {});
c.push({ id: g, bitmap: new Gc({ width: H + 2 * F_, height: A + 2 * F_ }, w), metrics: { width: H, height: A, left: C, top: N, advance: z } });
}
}
function Htt(h, c, p) {
h === 1 ? c.id = p.readVarint() : h === 2 ? c.bitmap = p.readBytes() : h === 3 ? c.width = p.readVarint() : h === 4 ? c.height = p.readVarint() : h === 5 ? c.left = p.readSVarint() : h === 6 ? c.top = p.readSVarint() : h === 7 && (c.advance = p.readVarint());
}
const pC = F_;
function TC(h) {
let c = 0, p = 0;
for (const A of h)
c += A.w * A.h, p = Math.max(p, A.w);
h.sort((A, C) => C.h - A.h);
const g = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(c / 0.95)), p), h: 1 / 0 }];
let w = 0, H = 0;
for (const A of h)
for (let C = g.length - 1; C >= 0; C--) {
const N = g[C];
if (!(A.w > N.w || A.h > N.h)) {
if (A.x = N.x, A.y = N.y, H = Math.max(H, A.y + A.h), w = Math.max(w, A.x + A.w), A.w === N.w && A.h === N.h) {
const z = g.pop();
C < g.length && (g[C] = z);
} else
A.h === N.h ? (N.x += A.w, N.w -= A.w) : A.w === N.w ? (N.y += A.h, N.h -= A.h) : (g.push({ x: N.x + A.w, y: N.y, w: N.w - A.w, h: A.h }), N.y += A.h, N.h -= A.h);
break;
}
}
return { w, h: H, fill: c / (w * H) || 0 };
}
const No = 1;
class B_ {
constructor(c, { pixelRatio: p, version: g, stretchX: w, stretchY: H, content: A, textFitWidth: C, textFitHeight: N }) {
this.paddedRect = c, this.pixelRatio = p, this.stretchX = w, this.stretchY = H, this.content = A, this.version = g, this.textFitWidth = C, this.textFitHeight = N;
}
get tl() {
return [this.paddedRect.x + No, this.paddedRect.y + No];
}
get br() {
return [this.paddedRect.x + this.paddedRect.w - No, this.paddedRect.y + this.paddedRect.h - No];
}
get tlbr() {
return this.tl.concat(this.br);
}
get displaySize() {
return [(this.paddedRect.w - 2 * No) / this.pixelRatio, (this.paddedRect.h - 2 * No) / this.pixelRatio];
}
}
class fC {
constructor(c, p) {
const g = {}, w = {};
this.haveRenderCallbacks = [];
const H = [];
this.addImages(c, g, H), this.addImages(p, w, H);
const { w: A, h: C } = TC(H), N = new k2({ width: A || 1, height: C || 1 });
for (const z in c) {
const W = c[z], X = g[z].paddedRect;
k2.copy(W.data, N, { x: 0, y: 0 }, { x: X.x + No, y: X.y + No }, W.data);
}
for (const z in p) {
const W = p[z], X = w[z].paddedRect, tt = X.x + No, at = X.y + No, ut = W.data.width, Tt = W.data.height;
k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt, y: at }, W.data), k2.copy(W.data, N, { x: 0, y: Tt - 1 }, { x: tt, y: at - 1 }, { width: ut, height: 1 }), k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt, y: at + Tt }, { width: ut, height: 1 }), k2.copy(W.data, N, { x: ut - 1, y: 0 }, { x: tt - 1, y: at }, { width: 1, height: Tt }), k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt + ut, y: at }, { width: 1, height: Tt });
}
this.image = N, this.iconPositions = g, this.patternPositions = w;
}
addImages(c, p, g) {
for (const w in c) {
const H = c[w], A = { x: 0, y: 0, w: H.data.width + 2 * No, h: H.data.height + 2 * No };
g.push(A), p[w] = new B_(A, H), H.hasRenderCallback && this.haveRenderCallbacks.push(w);
}
}
patchUpdatedImages(c, p) {
c.dispatchRenderCallbacks(this.haveRenderCallbacks);
for (const g in c.updatedImages)
this.patchUpdatedImage(this.iconPositions[g], c.getImage(g), p), this.patchUpdatedImage(this.patternPositions[g], c.getImage(g), p);
}
patchUpdatedImage(c, p, g) {
if (!c || !p || c.version === p.version)
return;
c.version = p.version;
const [w, H] = c.tl;
g.update(p.data, void 0, { x: w, y: H });
}
}
var d6;
nr("ImagePosition", B_), nr("ImageAtlas", fC), s.ah = void 0, (d6 = s.ah || (s.ah = {}))[d6.none = 0] = "none", d6[d6.horizontal = 1] = "horizontal", d6[d6.vertical = 2] = "vertical", d6[d6.horizontalOnly = 3] = "horizontalOnly";
const Yc = -17;
class Jc {
constructor() {
this.scale = 1, this.fontStack = "", this.imageName = null;
}
static forText(c, p) {
const g = new Jc();
return g.scale = c || 1, g.fontStack = p, g;
}
static forImage(c) {
const p = new Jc();
return p.imageName = c, p;
}
}
class Ul {
constructor() {
this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;
}
static fromFeature(c, p) {
const g = new Ul();
for (let w = 0; w < c.sections.length; w++) {
const H = c.sections[w];
H.image ? g.addImageSection(H) : g.addTextSection(H, p);
}
return g;
}
length() {
return this.text.length;
}
getSection(c) {
return this.sections[this.sectionIndex[c]];
}
getSectionIndex(c) {
return this.sectionIndex[c];
}
getCharCode(c) {
return this.text.charCodeAt(c);
}
verticalizePunctuation() {
this.text = function(c) {
let p = "";
for (let g = 0; g < c.length; g++) {
const w = c.charCodeAt(g + 1) || null, H = c.charCodeAt(g - 1) || null;
p += w && yp(w) && !Kc[c[g + 1]] || H && yp(H) && !Kc[c[g - 1]] || !Kc[c[g]] ? c[g] : Kc[c[g]];
}
return p;
}(this.text);
}
trim() {
let c = 0;
for (let g = 0; g < this.text.length && Pp[this.text.charCodeAt(g)]; g++)
c++;
let p = this.text.length;
for (let g = this.text.length - 1; g >= 0 && g >= c && Pp[this.text.charCodeAt(g)]; g--)
p--;
this.text = this.text.substring(c, p), this.sectionIndex = this.sectionIndex.slice(c, p);
}
substring(c, p) {
const g = new Ul();
return g.text = this.text.substring(c, p), g.sectionIndex = this.sectionIndex.slice(c, p), g.sections = this.sections, g;
}
toString() {
return this.text;
}
getMaxScale() {
return this.sectionIndex.reduce((c, p) => Math.max(c, this.sections[p].scale), 0);
}
addTextSection(c, p) {
this.text += c.text, this.sections.push(Jc.forText(c.scale, c.fontStack || p));
const g = this.sections.length - 1;
for (let w = 0; w < c.text.length; ++w)
this.sectionIndex.push(g);
}
addImageSection(c) {
const p = c.image ? c.image.name : "";
if (p.length === 0)
return void It("Can't add FormattedSection with an empty image.");
const g = this.getNextImageSectionCharCode();
g ? (this.text += String.fromCharCode(g), this.sections.push(Jc.forImage(p)), this.sectionIndex.push(this.sections.length - 1)) : It("Reached maximum number of images 6401");
}
getNextImageSectionCharCode() {
return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
}
}
function Ip(h, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut) {
const Tt = Ul.fromFeature(h, w);
let Lt;
X === s.ah.vertical && Tt.verticalizePunctuation();
const { processBidirectionalText: Et, processStyledBidirectionalText: $t } = Vo;
if (Et && Tt.sections.length === 1) {
Lt = [];
const ee = Et(Tt.toString(), j_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Ul();
Xe.text = _e, Xe.sections = Tt.sections;
for (let Er = 0; Er < _e.length; Er++)
Xe.sectionIndex.push(0);
Lt.push(Xe);
}
} else if ($t) {
Lt = [];
const ee = $t(Tt.text, Tt.sectionIndex, j_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Ul();
Xe.text = _e[0], Xe.sectionIndex = _e[1], Xe.sections = Tt.sections, Lt.push(Xe);
}
} else
Lt = function(ee, _e) {
const Xe = [], Er = ee.text;
let ze = 0;
for (const Re of _e)
Xe.push(ee.substring(ze, Re)), ze = Re;
return ze < Er.length && Xe.push(ee.substring(ze, Er.length)), Xe;
}(Tt, j_(Tt, z, H, c, g, at));
const Pt = [], Bt = { positionedLines: Pt, text: Tt.toString(), top: W[1], bottom: W[1], left: W[0], right: W[0], writingMode: X, iconsInText: !1, verticalizable: !1 };
return function(ee, _e, Xe, Er, ze, Re, Qr, sr, rr, ue, gr, pr) {
let Ir = 0, Fn = Yc, Pn = 0, p1 = 0;
const ms = sr === "right" ? 1 : sr === "left" ? 0 : 0.5;
let V1 = 0;
for (const Oi of ze) {
Oi.trim();
const f1 = Oi.getMaxScale(), K1 = (f1 - 1) * r1, R1 = { positionedGlyphs: [], lineOffset: 0 };
ee.positionedLines[V1] = R1;
const bo = R1.positionedGlyphs;
let N1 = 0;
if (!Oi.length()) {
Fn += Re, ++V1;
continue;
}
for (let Do = 0; Do < Oi.length(); Do++) {
const fn = Oi.getSection(Do), Un = Oi.getSectionIndex(Do), ii = Oi.getCharCode(Do);
let a2 = 0, xi = null, Zl = null, Ha = null, Aa = r1;
const gs = !(rr === s.ah.horizontal || !gr && !Nc(ii) || gr && (Pp[ii] || (T1 = ii, new RegExp("\\p{sc=Arab}", "u").test(String.fromCodePoint(T1)))));
if (fn.imageName) {
const V2 = Er[fn.imageName];
if (!V2)
continue;
Ha = fn.imageName, ee.iconsInText = ee.iconsInText || !0, Zl = V2.paddedRect;
const L1 = V2.displaySize;
fn.scale = fn.scale * r1 / pr, xi = { width: L1[0], height: L1[1], left: No, top: -pC, advance: gs ? L1[1] : L1[0] }, a2 = K1 + (r1 - L1[1] * fn.scale), Aa = xi.advance;
const U3 = gs ? L1[0] * fn.scale - r1 * f1 : L1[1] * fn.scale - r1 * f1;
U3 > 0 && U3 > N1 && (N1 = U3);
} else {
const V2 = Xe[fn.fontStack], L1 = V2 && V2[ii];
if (L1 && L1.rect)
Zl = L1.rect, xi = L1.metrics;
else {
const U3 = _e[fn.fontStack], ou = U3 && U3[ii];
if (!ou)
continue;
xi = ou.metrics;
}
a2 = (f1 - fn.scale) * r1;
}
gs ? (ee.verticalizable = !0, bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: gs, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: Zl }), Ir += Aa * fn.scale + ue) : (bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: gs, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: Zl }), Ir += xi.advance * fn.scale + ue);
}
bo.length !== 0 && (Pn = Math.max(Ir - ue, Pn), ktt(bo, 0, bo.length - 1, ms, N1)), Ir = 0;
const P2 = Re * f1 + N1;
R1.lineOffset = Math.max(N1, K1), Fn += P2, p1 = Math.max(P2, p1), ++V1;
}
var T1;
const yo = Fn - Yc, { horizontalAlign: vo, verticalAlign: _o } = z_(Qr);
(function(Oi, f1, K1, R1, bo, N1, P2, Do, fn) {
const Un = (f1 - K1) * bo;
let ii = 0;
ii = N1 !== P2 ? -Do * R1 - Yc : (-R1 * fn + 0.5) * P2;
for (const a2 of Oi)
for (const xi of a2.positionedGlyphs)
xi.x += Un, xi.y += ii;
})(ee.positionedLines, ms, vo, _o, Pn, p1, Re, yo, ze.length), ee.top += -_o * yo, ee.bottom = ee.top + yo, ee.left += -vo * Pn, ee.right = ee.left + Pn;
}(Bt, c, p, g, Lt, A, C, N, X, z, tt, ut), !function(ee) {
for (const _e of ee)
if (_e.positionedGlyphs.length !== 0)
return !1;
return !0;
}(Pt) && Bt;
}
const Pp = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, Att = { 10: !0, 32: !0, 38: !0, 41: !0, 43: !0, 45: !0, 47: !0, 173: !0, 183: !0, 8203: !0, 8208: !0, 8211: !0, 8231: !0 }, Ott = { 40: !0 };
function QC(h, c, p, g, w, H) {
if (c.imageName) {
const A = g[c.imageName];
return A ? A.displaySize[0] * c.scale * r1 / H + w : 0;
}
{
const A = p[c.fontStack], C = A && A[h];
return C ? C.metrics.advance * c.scale + w : 0;
}
}
function mC(h, c, p, g) {
const w = Math.pow(h - c, 2);
return g ? h < c ? w / 2 : 2 * w : w + Math.abs(p) * p;
}
function Ctt(h, c, p) {
let g = 0;
return h === 10 && (g -= 1e4), p && (g += 150), h !== 40 && h !== 65288 || (g += 50), c !== 41 && c !== 65289 || (g += 50), g;
}
function gC(h, c, p, g, w, H) {
let A = null, C = mC(c, p, w, H);
for (const N of g) {
const z = mC(c - N.x, p, w, H) + N.badness;
z <= C && (A = N, C = z);
}
return { index: h, x: c, priorBreak: A, badness: C };
}
function yC(h) {
return h ? yC(h.priorBreak).concat(h.index) : [];
}
function j_(h, c, p, g, w, H) {
if (!h)
return [];
const A = [], C = function(X, tt, at, ut, Tt, Lt) {
let Et = 0;
for (let $t = 0; $t < X.length(); $t++) {
const Pt = X.getSection($t);
Et += QC(X.getCharCode($t), Pt, ut, Tt, tt, Lt);
}
return Et / Math.max(1, Math.ceil(Et / at));
}(h, c, p, g, w, H), N = h.text.indexOf("") >= 0;
let z = 0;
for (let X = 0; X < h.length(); X++) {
const tt = h.getSection(X), at = h.getCharCode(X);
if (Pp[at] || (z += QC(at, tt, g, w, c, H)), X < h.length() - 1) {
const ut = !((W = at) < 11904) && (!!sn["CJK Compatibility Forms"](W) || !!sn["CJK Compatibility"](W) || !!sn["CJK Strokes"](W) || !!sn["CJK Symbols and Punctuation"](W) || !!sn["Enclosed CJK Letters and Months"](W) || !!sn["Halfwidth and Fullwidth Forms"](W) || !!sn["Ideographic Description Characters"](W) || !!sn["Vertical Forms"](W) || gp.test(String.fromCodePoint(W)));
(Att[at] || ut || tt.imageName || X !== h.length() - 2 && Ott[h.getCharCode(X + 1)]) && A.push(gC(X + 1, z, C, A, Ctt(at, h.getCharCode(X + 1), ut && N), !1));
}
}
var W;
return yC(gC(h.length(), z, C, A, 0, !0));
}
function z_(h) {
let c = 0.5, p = 0.5;
switch (h) {
case "right":
case "top-right":
case "bottom-right":
c = 1;
break;
case "left":
case "top-left":
case "bottom-left":
c = 0;
}
switch (h) {
case "bottom":
case "bottom-right":
case "bottom-left":
p = 1;
break;
case "top":
case "top-right":
case "top-left":
p = 0;
}
return { horizontalAlign: c, verticalAlign: p };
}
function ktt(h, c, p, g, w) {
if (!g && !w)
return;
const H = h[p], A = (h[p].x + H.metrics.advance * H.scale) * g;
for (let C = c; C <= p; C++)
h[C].x -= A, h[C].y += w;
}
function Itt(h, c, p) {
const { horizontalAlign: g, verticalAlign: w } = z_(p), H = c[0] - h.displaySize[0] * g, A = c[1] - h.displaySize[1] * w;
return { image: h, top: A, bottom: A + h.displaySize[1], left: H, right: H + h.displaySize[0] };
}
function vC(h) {
var c, p;
let g = h.left, w = h.top, H = h.right - g, A = h.bottom - w;
const C = (c = h.image.textFitWidth) !== null && c !== void 0 ? c : "stretchOrShrink", N = (p = h.image.textFitHeight) !== null && p !== void 0 ? p : "stretchOrShrink", z = (h.image.content[2] - h.image.content[0]) / (h.image.content[3] - h.image.content[1]);
if (N === "proportional") {
if (C === "stretchOnly" && H / A < z || C === "proportional") {
const W = Math.ceil(A * z);
g *= W / H, H = W;
}
} else if (C === "proportional" && N === "stretchOnly" && z !== 0 && H / A > z) {
const W = Math.ceil(H / z);
w *= W / A, A = W;
}
return { x1: g, y1: w, x2: g + H, y2: w + A };
}
function _C(h, c, p, g, w, H) {
const A = h.image;
let C;
if (A.content) {
const Lt = A.content, Et = A.pixelRatio || 1;
C = [Lt[0] / Et, Lt[1] / Et, A.displaySize[0] - Lt[2] / Et, A.displaySize[1] - Lt[3] / Et];
}
const N = c.left * H, z = c.right * H;
let W, X, tt, at;
p === "width" || p === "both" ? (at = w[0] + N - g[3], X = w[0] + z + g[1]) : (at = w[0] + (N + z - A.displaySize[0]) / 2, X = at + A.displaySize[0]);
const ut = c.top * H, Tt = c.bottom * H;
return p === "height" || p === "both" ? (W = w[1] + ut - g[0], tt = w[1] + Tt + g[2]) : (W = w[1] + (ut + Tt - A.displaySize[1]) / 2, tt = W + A.displaySize[1]), { image: A, top: W, right: X, bottom: tt, left: at, collisionPadding: C };
}
const tu = 255, Sa = 128, p6 = tu * Sa;
function bC(h, c) {
const { expression: p } = c;
if (p.kind === "constant")
return { kind: "constant", layoutSize: p.evaluate(new ti(h + 1)) };
if (p.kind === "source")
return { kind: "source" };
{
const { zoomStops: g, interpolationType: w } = p;
let H = 0;
for (; H < g.length && g[H] <= h; )
H++;
H = Math.max(0, H - 1);
let A = H;
for (; A < g.length && g[A] < h + 1; )
A++;
A = Math.min(g.length - 1, A);
const C = g[H], N = g[A];
return p.kind === "composite" ? { kind: "composite", minZoom: C, maxZoom: N, interpolationType: w } : { kind: "camera", minZoom: C, maxZoom: N, minSize: p.evaluate(new ti(C)), maxSize: p.evaluate(new ti(N)), interpolationType: w };
}
}
function U_(h, c, p) {
let g = "never";
const w = h.get(c);
return w ? g = w : h.get(p) && (g = "always"), g;
}
const Ptt = h6.VectorTileFeature.types, Vtt = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
function Vp(h, c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = C ? Math.min(p6, Math.round(C[0])) : 0, ut = C ? Math.min(p6, Math.round(C[1])) : 0;
h.emplaceBack(c, p, Math.round(32 * g), Math.round(32 * w), H, A, (at << 1) + (N ? 1 : 0), ut, 16 * z, 16 * W, 256 * X, 256 * tt);
}
function G_(h, c, p) {
h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p);
}
function Rtt(h) {
for (const c of h.sections)
if (y_(c.text))
return !0;
return !1;
}
class $_ {
constructor(c) {
this.layoutVertexArray = new Il(), this.indexArray = new C2(), this.programConfigurations = c, this.segments = new an(), this.dynamicLayoutVertexArray = new Bc(), this.opacityVertexArray = new o2(), this.hasVisibleVertices = !1, this.placedSymbolArray = new ei();
}
isEmpty() {
return this.layoutVertexArray.length === 0 && this.indexArray.length === 0 && this.dynamicLayoutVertexArray.length === 0 && this.opacityVertexArray.length === 0;
}
upload(c, p, g, w) {
this.isEmpty() || (g && (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, dtt.members), this.indexBuffer = c.createIndexBuffer(this.indexArray, p), this.dynamicLayoutVertexBuffer = c.createVertexBuffer(this.dynamicLayoutVertexArray, ptt.members, !0), this.opacityVertexBuffer = c.createVertexBuffer(this.opacityVertexArray, Vtt, !0), this.opacityVertexBuffer.itemSize = 1), (g || w) && this.programConfigurations.upload(c));
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());
}
}
nr("SymbolBuffers", $_);
class W_ {
constructor(c, p, g) {
this.layoutVertexArray = new c(), this.layoutAttributes = p, this.indexArray = new g(), this.segments = new an(), this.collisionVertexArray = new Ea();
}
upload(c) {
this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = c.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = c.createVertexBuffer(this.collisionVertexArray, Ttt.members, !0);
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
}
}
nr("CollisionBuffers", W_);
class Gl {
constructor(c) {
this.collisionBoxArray = c.collisionBoxArray, this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((A) => A.id), this.index = c.index, this.pixelRatio = c.pixelRatio, this.sourceLayerIndex = c.sourceLayerIndex, this.hasPattern = !1, this.hasRTLText = !1, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = E_([]), this.placementViewportMatrix = E_([]);
const p = this.layers[0]._unevaluatedLayout._values;
this.textSizeData = bC(this.zoom, p["text-size"]), this.iconSizeData = bC(this.zoom, p["icon-size"]);
const g = this.layers[0].layout, w = g.get("symbol-sort-key"), H = g.get("symbol-z-order");
this.canOverlap = U_(g, "text-overlap", "text-allow-overlap") !== "never" || U_(g, "icon-overlap", "icon-allow-overlap") !== "never" || g.get("text-ignore-placement") || g.get("icon-ignore-placement"), this.sortFeaturesByKey = H !== "viewport-y" && !w.isConstant(), this.sortFeaturesByY = (H === "viewport-y" || H === "auto" && !this.sortFeaturesByKey) && this.canOverlap, g.get("symbol-placement") === "point" && (this.writingModes = g.get("text-writing-mode").map((A) => s.ah[A])), this.stateDependentLayerIds = this.layers.filter((A) => A.isStateDependent()).map((A) => A.id), this.sourceID = c.sourceID;
}
createArrays() {
this.text = new $_(new N0(this.layers, this.zoom, (c) => /^text/.test(c))), this.icon = new $_(new N0(this.layers, this.zoom, (c) => /^icon/.test(c))), this.glyphOffsetArray = new ri(), this.lineVertexArray = new C1(), this.symbolInstances = new nn(), this.textAnchorOffsets = new ni();
}
calculateGlyphDependencies(c, p, g, w, H) {
for (let A = 0; A < c.length; A++)
if (p[c.charCodeAt(A)] = !0, (g || w) && H) {
const C = Kc[c.charAt(A)];
C && (p[C.charCodeAt(0)] = !0);
}
}
populate(c, p, g) {
const w = this.layers[0], H = w.layout, A = H.get("text-font"), C = H.get("text-field"), N = H.get("icon-image"), z = (C.value.kind !== "constant" || C.value.value instanceof Xr && !C.value.value.isEmpty() || C.value.value.toString().length > 0) && (A.value.kind !== "constant" || A.value.value.length > 0), W = N.value.kind !== "constant" || !!N.value.value || Object.keys(N.parameters).length > 0, X = H.get("symbol-sort-key");
if (this.features = [], !z && !W)
return;
const tt = p.iconDependencies, at = p.glyphDependencies, ut = p.availableImages, Tt = new ti(this.zoom);
for (const { feature: Lt, id: Et, index: $t, sourceLayerIndex: Pt } of c) {
const Bt = w._featureFilter.needGeometry, ee = F0(Lt, Bt);
if (!w._featureFilter.filter(Tt, ee, g))
continue;
let _e, Xe;
if (Bt || (ee.geometry = D0(Lt)), z) {
const ze = w.getValueAndResolveTokens("text-field", ee, g, ut), Re = Xr.factory(ze), Qr = this.hasRTLText = this.hasRTLText || Rtt(Re);
(!Qr || Vo.getRTLTextPluginStatus() === "unavailable" || Qr && Vo.isParsed()) && (_e = Qtt(Re, w, ee));
}
if (W) {
const ze = w.getValueAndResolveTokens("icon-image", ee, g, ut);
Xe = ze instanceof pn ? ze : pn.fromString(ze);
}
if (!_e && !Xe)
continue;
const Er = this.sortFeaturesByKey ? X.evaluate(ee, {}, g) : void 0;
if (this.features.push({ id: Et, text: _e, icon: Xe, index: $t, sourceLayerIndex: Pt, geometry: ee.geometry, properties: Lt.properties, type: Ptt[Lt.type], sortKey: Er }), Xe && (tt[Xe.name] = !0), _e) {
const ze = A.evaluate(ee, {}, g).join(","), Re = H.get("text-rotation-alignment") !== "viewport" && H.get("symbol-placement") !== "point";
this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(s.ah.vertical) >= 0;
for (const Qr of _e.sections)
if (Qr.image)
tt[Qr.image.name] = !0;
else {
const sr = Vc(_e.toString()), rr = Qr.fontStack || ze, ue = at[rr] = at[rr] || {};
this.calculateGlyphDependencies(Qr.text, ue, Re, this.allowVerticalPlacement, sr);
}
}
}
H.get("symbol-placement") === "line" && (this.features = function(Lt) {
const Et = {}, $t = {}, Pt = [];
let Bt = 0;
function ee(ze) {
Pt.push(Lt[ze]), Bt++;
}
function _e(ze, Re, Qr) {
const sr = $t[ze];
return delete $t[ze], $t[Re] = sr, Pt[sr].geometry[0].pop(), Pt[sr].geometry[0] = Pt[sr].geometry[0].concat(Qr[0]), sr;
}
function Xe(ze, Re, Qr) {
const sr = Et[Re];
return delete Et[Re], Et[ze] = sr, Pt[sr].geometry[0].shift(), Pt[sr].geometry[0] = Qr[0].concat(Pt[sr].geometry[0]), sr;
}
function Er(ze, Re, Qr) {
const sr = Qr ? Re[0][Re[0].length - 1] : Re[0][0];
return `${ze}:${sr.x}:${sr.y}`;
}
for (let ze = 0; ze < Lt.length; ze++) {
const Re = Lt[ze], Qr = Re.geometry, sr = Re.text ? Re.text.toString() : null;
if (!sr) {
ee(ze);
continue;
}
const rr = Er(sr, Qr), ue = Er(sr, Qr, !0);
if (rr in $t && ue in Et && $t[rr] !== Et[ue]) {
const gr = Xe(rr, ue, Qr), pr = _e(rr, ue, Pt[gr].geometry);
delete Et[rr], delete $t[ue], $t[Er(sr, Pt[pr].geometry, !0)] = pr, Pt[gr].geometry = null;
} else
rr in $t ? _e(rr, ue, Qr) : ue in Et ? Xe(rr, ue, Qr) : (ee(ze), Et[rr] = Bt - 1, $t[ue] = Bt - 1);
}
return Pt.filter((ze) => ze.geometry);
}(this.features)), this.sortFeaturesByKey && this.features.sort((Lt, Et) => Lt.sortKey - Et.sortKey);
}
update(c, p, g) {
this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(c, p, this.layers, g), this.icon.programConfigurations.updatePaintArrays(c, p, this.layers, g));
}
isEmpty() {
return this.symbolInstances.length === 0 && !this.hasRTLText;
}
uploadPending() {
return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;
}
upload(c) {
!this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(c), this.iconCollisionBox.upload(c)), this.text.upload(c, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(c, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = !0;
}
destroyDebugData() {
this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();
}
destroy() {
this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();
}
addToLineVertexArray(c, p) {
const g = this.lineVertexArray.length;
if (c.segment !== void 0) {
let w = c.dist(p[c.segment + 1]), H = c.dist(p[c.segment]);
const A = {};
for (let C = c.segment + 1; C < p.length; C++)
A[C] = { x: p[C].x, y: p[C].y, tileUnitDistanceFromAnchor: w }, C < p.length - 1 && (w += p[C + 1].dist(p[C]));
for (let C = c.segment || 0; C >= 0; C--)
A[C] = { x: p[C].x, y: p[C].y, tileUnitDistanceFromAnchor: H }, C > 0 && (H += p[C - 1].dist(p[C]));
for (let C = 0; C < p.length; C++) {
const N = A[C];
this.lineVertexArray.emplaceBack(N.x, N.y, N.tileUnitDistanceFromAnchor);
}
}
return { lineStartIndex: g, lineLength: this.lineVertexArray.length - g };
}
addSymbols(c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = c.indexArray, ut = c.layoutVertexArray, Tt = c.segments.prepareSegment(4 * p.length, ut, at, this.canOverlap ? A.sortKey : void 0), Lt = this.glyphOffsetArray.length, Et = Tt.vertexLength, $t = this.allowVerticalPlacement && C === s.ah.vertical ? Math.PI / 2 : 0, Pt = A.text && A.text.sections;
for (let Bt = 0; Bt < p.length; Bt++) {
const { tl: ee, tr: _e, bl: Xe, br: Er, tex: ze, pixelOffsetTL: Re, pixelOffsetBR: Qr, minFontScaleX: sr, minFontScaleY: rr, glyphOffset: ue, isSDF: gr, sectionIndex: pr } = p[Bt], Ir = Tt.vertexLength, Fn = ue[1];
Vp(ut, N.x, N.y, ee.x, Fn + ee.y, ze.x, ze.y, g, gr, Re.x, Re.y, sr, rr), Vp(ut, N.x, N.y, _e.x, Fn + _e.y, ze.x + ze.w, ze.y, g, gr, Qr.x, Re.y, sr, rr), Vp(ut, N.x, N.y, Xe.x, Fn + Xe.y, ze.x, ze.y + ze.h, g, gr, Re.x, Qr.y, sr, rr), Vp(ut, N.x, N.y, Er.x, Fn + Er.y, ze.x + ze.w, ze.y + ze.h, g, gr, Qr.x, Qr.y, sr, rr), G_(c.dynamicLayoutVertexArray, N, $t), at.emplaceBack(Ir, Ir + 1, Ir + 2), at.emplaceBack(Ir + 1, Ir + 2, Ir + 3), Tt.vertexLength += 4, Tt.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(ue[0]), Bt !== p.length - 1 && pr === p[Bt + 1].sectionIndex || c.programConfigurations.populatePaintArrays(ut.length, A, A.index, {}, tt, Pt && Pt[pr]);
}
c.placedSymbolArray.emplaceBack(N.x, N.y, Lt, this.glyphOffsetArray.length - Lt, Et, z, W, N.segment, g ? g[0] : 0, g ? g[1] : 0, w[0], w[1], C, 0, !1, 0, X);
}
_addCollisionDebugVertex(c, p, g, w, H, A) {
return p.emplaceBack(0, 0), c.emplaceBack(g.x, g.y, w, H, Math.round(A.x), Math.round(A.y));
}
addCollisionDebugVertices(c, p, g, w, H, A, C) {
const N = H.segments.prepareSegment(4, H.layoutVertexArray, H.indexArray), z = N.vertexLength, W = H.layoutVertexArray, X = H.collisionVertexArray, tt = C.anchorX, at = C.anchorY;
this._addCollisionDebugVertex(W, X, A, tt, at, new f(c, p)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(g, p)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(g, w)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(c, w)), N.vertexLength += 4;
const ut = H.indexArray;
ut.emplaceBack(z, z + 1), ut.emplaceBack(z + 1, z + 2), ut.emplaceBack(z + 2, z + 3), ut.emplaceBack(z + 3, z), N.primitiveLength += 4;
}
addDebugCollisionBoxes(c, p, g, w) {
for (let H = c; H < p; H++) {
const A = this.collisionBoxArray.get(H);
this.addCollisionDebugVertices(A.x1, A.y1, A.x2, A.y2, w ? this.textCollisionBox : this.iconCollisionBox, A.anchorPoint, g);
}
}
generateCollisionDebugBuffers() {
this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new W_(s2, oC.members, b1), this.iconCollisionBox = new W_(s2, oC.members, b1);
for (let c = 0; c < this.symbolInstances.length; c++) {
const p = this.symbolInstances.get(c);
this.addDebugCollisionBoxes(p.textBoxStartIndex, p.textBoxEndIndex, p, !0), this.addDebugCollisionBoxes(p.verticalTextBoxStartIndex, p.verticalTextBoxEndIndex, p, !0), this.addDebugCollisionBoxes(p.iconBoxStartIndex, p.iconBoxEndIndex, p, !1), this.addDebugCollisionBoxes(p.verticalIconBoxStartIndex, p.verticalIconBoxEndIndex, p, !1);
}
}
_deserializeCollisionBoxesForSymbol(c, p, g, w, H, A, C, N, z) {
const W = {};
for (let X = p; X < g; X++) {
const tt = c.get(X);
W.textBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.textFeatureIndex = tt.featureIndex;
break;
}
for (let X = w; X < H; X++) {
const tt = c.get(X);
W.verticalTextBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.verticalTextFeatureIndex = tt.featureIndex;
break;
}
for (let X = A; X < C; X++) {
const tt = c.get(X);
W.iconBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.iconFeatureIndex = tt.featureIndex;
break;
}
for (let X = N; X < z; X++) {
const tt = c.get(X);
W.verticalIconBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.verticalIconFeatureIndex = tt.featureIndex;
break;
}
return W;
}
deserializeCollisionBoxes(c) {
this.collisionArrays = [];
for (let p = 0; p < this.symbolInstances.length; p++) {
const g = this.symbolInstances.get(p);
this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(c, g.textBoxStartIndex, g.textBoxEndIndex, g.verticalTextBoxStartIndex, g.verticalTextBoxEndIndex, g.iconBoxStartIndex, g.iconBoxEndIndex, g.verticalIconBoxStartIndex, g.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(c, p) {
const g = c.placedSymbolArray.get(p), w = g.vertexStartIndex + 4 * g.numGlyphs;
for (let H = g.vertexStartIndex; H < w; H += 4)
c.indexArray.emplaceBack(H, H + 1, H + 2), c.indexArray.emplaceBack(H + 1, H + 2, H + 3);
}
getSortedSymbolIndexes(c) {
if (this.sortedAngle === c && this.symbolInstanceIndexes !== void 0)
return this.symbolInstanceIndexes;
const p = Math.sin(c), g = Math.cos(c), w = [], H = [], A = [];
for (let C = 0; C < this.symbolInstances.length; ++C) {
A.push(C);
const N = this.symbolInstances.get(C);
w.push(0 | Math.round(p * N.anchorX + g * N.anchorY)), H.push(N.featureIndex);
}
return A.sort((C, N) => w[C] - w[N] || H[N] - H[C]), A;
}
addToSortKeyRanges(c, p) {
const g = this.sortKeyRanges[this.sortKeyRanges.length - 1];
g && g.sortKey === p ? g.symbolInstanceEnd = c + 1 : this.sortKeyRanges.push({ sortKey: p, symbolInstanceStart: c, symbolInstanceEnd: c + 1 });
}
sortFeatures(c) {
if (this.sortFeaturesByY && this.sortedAngle !== c && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
this.symbolInstanceIndexes = this.getSortedSymbolIndexes(c), this.sortedAngle = c, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];
for (const p of this.symbolInstanceIndexes) {
const g = this.symbolInstances.get(p);
this.featureSortOrder.push(g.featureIndex), [g.rightJustifiedTextSymbolIndex, g.centerJustifiedTextSymbolIndex, g.leftJustifiedTextSymbolIndex].forEach((w, H, A) => {
w >= 0 && A.indexOf(w) === H && this.addIndicesForPlacedSymbol(this.text, w);
}), g.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, g.verticalPlacedTextSymbolIndex), g.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, g.placedIconSymbolIndex), g.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, g.verticalPlacedIconSymbolIndex);
}
this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);
}
}
}
let LC, wC;
nr("SymbolBucket", Gl, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), Gl.MAX_GLYPHS = 65535, Gl.addDynamicAttributes = G_;
var Z_ = { get paint() {
return wC = wC || new S({ "icon-opacity": new Mr(Ct.paint_symbol["icon-opacity"]), "icon-color": new Mr(Ct.paint_symbol["icon-color"]), "icon-halo-color": new Mr(Ct.paint_symbol["icon-halo-color"]), "icon-halo-width": new Mr(Ct.paint_symbol["icon-halo-width"]), "icon-halo-blur": new Mr(Ct.paint_symbol["icon-halo-blur"]), "icon-translate": new cr(Ct.paint_symbol["icon-translate"]), "icon-translate-anchor": new cr(Ct.paint_symbol["icon-translate-anchor"]), "text-opacity": new Mr(Ct.paint_symbol["text-opacity"]), "text-color": new Mr(Ct.paint_symbol["text-color"], { runtimeType: Vn, getOverride: (h) => h.textColor, hasOverride: (h) => !!h.textColor }), "text-halo-color": new Mr(Ct.paint_symbol["text-halo-color"]), "text-halo-width": new Mr(Ct.paint_symbol["text-halo-width"]), "text-halo-blur": new Mr(Ct.paint_symbol["text-halo-blur"]), "text-translate": new cr(Ct.paint_symbol["text-translate"]), "text-translate-anchor": new cr(Ct.paint_symbol["text-translate-anchor"]) });
}, get layout() {
return LC = LC || new S({ "symbol-placement": new cr(Ct.layout_symbol["symbol-placement"]), "symbol-spacing": new cr(Ct.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new cr(Ct.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new Mr(Ct.layout_symbol["symbol-sort-key"]), "symbol-z-order": new cr(Ct.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new cr(Ct.layout_symbol["icon-allow-overlap"]), "icon-overlap": new cr(Ct.layout_symbol["icon-overlap"]), "icon-ignore-placement": new cr(Ct.layout_symbol["icon-ignore-placement"]), "icon-optional": new cr(Ct.layout_symbol["icon-optional"]), "icon-rotation-alignment": new cr(Ct.layout_symbol["icon-rotation-alignment"]), "icon-size": new Mr(Ct.layout_symbol["icon-size"]), "icon-text-fit": new cr(Ct.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new cr(Ct.layout_symbol["icon-text-fit-padding"]), "icon-image": new Mr(Ct.layout_symbol["icon-image"]), "icon-rotate": new Mr(Ct.layout_symbol["icon-rotate"]), "icon-padding": new Mr(Ct.layout_symbol["icon-padding"]), "icon-keep-upright": new cr(Ct.layout_symbol["icon-keep-upright"]), "icon-offset": new Mr(Ct.layout_symbol["icon-offset"]), "icon-anchor": new Mr(Ct.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new cr(Ct.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new cr(Ct.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new cr(Ct.layout_symbol["text-rotation-alignment"]), "text-field": new Mr(Ct.layout_symbol["text-field"]), "text-font": new Mr(Ct.layout_symbol["text-font"]), "text-size": new Mr(Ct.layout_symbol["text-size"]), "text-max-width": new Mr(Ct.layout_symbol["text-max-width"]), "text-line-height": new cr(Ct.layout_symbol["text-line-height"]), "text-letter-spacing": new Mr(Ct.layout_symbol["text-letter-spacing"]), "text-justify": new Mr(Ct.layout_symbol["text-justify"]), "text-radial-offset": new Mr(Ct.layout_symbol["text-radial-offset"]), "text-variable-anchor": new cr(Ct.layout_symbol["text-variable-anchor"]), "text-variable-anchor-offset": new Mr(Ct.layout_symbol["text-variable-anchor-offset"]), "text-anchor": new Mr(Ct.layout_symbol["text-anchor"]), "text-max-angle": new cr(Ct.layout_symbol["text-max-angle"]), "text-writing-mode": new cr(Ct.layout_symbol["text-writing-mode"]), "text-rotate": new Mr(Ct.layout_symbol["text-rotate"]), "text-padding": new cr(Ct.layout_symbol["text-padding"]), "text-keep-upright": new cr(Ct.layout_symbol["text-keep-upright"]), "text-transform": new Mr(Ct.layout_symbol["text-transform"]), "text-offset": new Mr(Ct.layout_symbol["text-offset"]), "text-allow-overlap": new cr(Ct.layout_symbol["text-allow-overlap"]), "text-overlap": new cr(Ct.layout_symbol["text-overlap"]), "text-ignore-placement": new cr(Ct.layout_symbol["text-ignore-placement"]), "text-optional": new cr(Ct.layout_symbol["text-optional"]) });
} };
class xC {
constructor(c) {
if (c.property.overrides === void 0)
throw new Error("overrides must be provided to instantiate FormatSectionOverride class");
this.type = c.property.overrides ? c.property.overrides.runtimeType : t1, this.defaultValue = c;
}
evaluate(c) {
if (c.formattedSection) {
const p = this.defaultValue.property.overrides;
if (p && p.hasOverride(c.formattedSection))
return p.getOverride(c.formattedSection);
}
return c.feature && c.featureState ? this.defaultValue.evaluate(c.feature, c.featureState) : this.defaultValue.property.specification.default;
}
eachChild(c) {
this.defaultValue.isConstant() || c(this.defaultValue.value._styleExpression.expression);
}
outputDefined() {
return !1;
}
serialize() {
return null;
}
}
nr("FormatSectionOverride", xC, { omit: ["defaultValue"] });
class Rp extends m {
constructor(c) {
super(c, Z_);
}
recalculate(c, p) {
if (super.recalculate(c, p), this.layout.get("icon-rotation-alignment") === "auto" && (this.layout._values["icon-rotation-alignment"] = this.layout.get("symbol-placement") !== "point" ? "map" : "viewport"), this.layout.get("text-rotation-alignment") === "auto" && (this.layout._values["text-rotation-alignment"] = this.layout.get("symbol-placement") !== "point" ? "map" : "viewport"), this.layout.get("text-pitch-alignment") === "auto" && (this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment") === "map" ? "map" : "viewport"), this.layout.get("icon-pitch-alignment") === "auto" && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")), this.layout.get("symbol-placement") === "point") {
const g = this.layout.get("text-writing-mode");
if (g) {
const w = [];
for (const H of g)
w.indexOf(H) < 0 && w.push(H);
this.layout._values["text-writing-mode"] = w;
} else
this.layout._values["text-writing-mode"] = ["horizontal"];
}
this._setPaintOverrides();
}
getValueAndResolveTokens(c, p, g, w) {
const H = this.layout.get(c).evaluate(p, {}, g, w), A = this._unevaluatedLayout._values[c];
return A.isDataDriven() || yi(A.value) || !H ? H : function(C, N) {
return N.replace(/{([^{}]+)}/g, (z, W) => C && W in C ? String(C[W]) : "");
}(p.properties, H);
}
createBucket(c) {
return new Gl(c);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
throw new Error("Should take a different path in FeatureIndex");
}
_setPaintOverrides() {
for (const c of Z_.paint.overridableProperties) {
if (!Rp.hasPaintOverride(this.layout, c))
continue;
const p = this.paint.get(c), g = new xC(p), w = new gi(g, p.property.specification);
let H = null;
H = p.value.kind === "constant" || p.value.kind === "source" ? new A1("source", w) : new Ai("composite", w, p.value.zoomStops), this.paint._values[c] = new fs(p.property, H, p.parameters);
}
}
_handleOverridablePaintPropertyUpdate(c, p, g) {
return !(!this.layout || p.isDataDriven() || g.isDataDriven()) && Rp.hasPaintOverride(this.layout, c);
}
static hasPaintOverride(c, p) {
const g = c.get("text-field"), w = Z_.paint.properties[p];
let H = !1;
const A = (C) => {
for (const N of C)
if (w.overrides && w.overrides.hasOverride(N))
return void (H = !0);
};
if (g.value.kind === "constant" && g.value.value instanceof Xr)
A(g.value.value.sections);
else if (g.value.kind === "source") {
const C = (z) => {
H || (z instanceof h1 && Qn(z.value) === H1 ? A(z.value.sections) : z instanceof A3 ? A(z.sections) : z.eachChild(C));
}, N = g.value;
N._styleExpression && C(N._styleExpression.expression);
}
return H;
}
}
let EC;
var Ntt = { get paint() {
return EC = EC || new S({ "background-color": new cr(Ct.paint_background["background-color"]), "background-pattern": new Cl(Ct.paint_background["background-pattern"]), "background-opacity": new cr(Ct.paint_background["background-opacity"]) });
} };
class Dtt extends m {
constructor(c) {
super(c, Ntt);
}
}
let MC;
var Ftt = { get paint() {
return MC = MC || new S({ "raster-opacity": new cr(Ct.paint_raster["raster-opacity"]), "raster-hue-rotate": new cr(Ct.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new cr(Ct.paint_raster["raster-brightness-min"]), "raster-brightness-max": new cr(Ct.paint_raster["raster-brightness-max"]), "raster-saturation": new cr(Ct.paint_raster["raster-saturation"]), "raster-contrast": new cr(Ct.paint_raster["raster-contrast"]), "raster-resampling": new cr(Ct.paint_raster["raster-resampling"]), "raster-fade-duration": new cr(Ct.paint_raster["raster-fade-duration"]) });
} };
class Btt extends m {
constructor(c) {
super(c, Ftt);
}
}
class jtt extends m {
constructor(c) {
super(c, {}), this.onAdd = (p) => {
this.implementation.onAdd && this.implementation.onAdd(p, p.painter.context.gl);
}, this.onRemove = (p) => {
this.implementation.onRemove && this.implementation.onRemove(p, p.painter.context.gl);
}, this.implementation = c;
}
is3D() {
return this.implementation.renderingMode === "3d";
}
hasOffscreenPass() {
return this.implementation.prerender !== void 0;
}
recalculate() {
}
updateTransitions() {
}
hasTransition() {
return !1;
}
serialize() {
throw new Error("Custom layers cannot be serialized");
}
}
class ztt {
constructor(c) {
this._methodToThrottle = c, this._triggered = !1, typeof MessageChannel < "u" && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {
this._triggered = !1, this._methodToThrottle();
});
}
trigger() {
this._triggered || (this._triggered = !0, this._channel ? this._channel.port1.postMessage(!0) : setTimeout(() => {
this._triggered = !1, this._methodToThrottle();
}, 0));
}
remove() {
delete this._channel, this._methodToThrottle = () => {
};
}
}
const q_ = 63710088e-1;
class T6 {
constructor(c, p) {
if (isNaN(c) || isNaN(p))
throw new Error(`Invalid LngLat object: (${c}, ${p})`);
if (this.lng = +c, this.lat = +p, this.lat > 90 || this.lat < -90)
throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
}
wrap() {
return new T6(U(this.lng, -180, 180), this.lat);
}
toArray() {
return [this.lng, this.lat];
}
toString() {
return `LngLat(${this.lng}, ${this.lat})`;
}
distanceTo(c) {
const p = Math.PI / 180, g = this.lat * p, w = c.lat * p, H = Math.sin(g) * Math.sin(w) + Math.cos(g) * Math.cos(w) * Math.cos((c.lng - this.lng) * p);
return q_ * Math.acos(Math.min(H, 1));
}
static convert(c) {
if (c instanceof T6)
return c;
if (Array.isArray(c) && (c.length === 2 || c.length === 3))
return new T6(Number(c[0]), Number(c[1]));
if (!Array.isArray(c) && typeof c == "object" && c !== null)
return new T6(Number("lng" in c ? c.lng : c.lon), Number(c.lat));
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]");
}
}
const SC = 2 * Math.PI * q_;
function HC(h) {
return SC * Math.cos(h * Math.PI / 180);
}
function AC(h) {
return (180 + h) / 360;
}
function OC(h) {
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h * Math.PI / 360))) / 360;
}
function CC(h, c) {
return h / HC(c);
}
function X_(h) {
return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * h) * Math.PI / 180)) - 90;
}
class eu {
constructor(c, p, g = 0) {
this.x = +c, this.y = +p, this.z = +g;
}
static fromLngLat(c, p = 0) {
const g = T6.convert(c);
return new eu(AC(g.lng), OC(g.lat), CC(p, g.lat));
}
toLngLat() {
return new T6(360 * this.x - 180, X_(this.y));
}
toAltitude() {
return this.z * HC(X_(this.y));
}
meterInMercatorCoordinateUnits() {
return 1 / SC * (c = X_(this.y), 1 / Math.cos(c * Math.PI / 180));
var c;
}
}
function kC(h, c, p) {
var g = 2 * Math.PI * 6378137 / 256 / Math.pow(2, p);
return [h * g - 2 * Math.PI * 6378137 / 2, c * g - 2 * Math.PI * 6378137 / 2];
}
class K_ {
constructor(c, p, g) {
if (!function(w, H, A) {
return !(w < 0 || w > 25 || A < 0 || A >= Math.pow(2, w) || H < 0 || H >= Math.pow(2, w));
}(c, p, g))
throw new Error(`x=${p}, y=${g}, z=${c} outside of bounds. 0<=x<${Math.pow(2, c)}, 0<=y<${Math.pow(2, c)} 0<=z<=25 `);
this.z = c, this.x = p, this.y = g, this.key = ru(0, c, c, p, g);
}
equals(c) {
return this.z === c.z && this.x === c.x && this.y === c.y;
}
url(c, p, g) {
const w = (A = this.y, C = this.z, N = kC(256 * (H = this.x), 256 * (A = Math.pow(2, C) - A - 1), C), z = kC(256 * (H + 1), 256 * (A + 1), C), N[0] + "," + N[1] + "," + z[0] + "," + z[1]);
var H, A, C, N, z;
const W = function(X, tt, at) {
let ut, Tt = "";
for (let Lt = X; Lt > 0; Lt--)
ut = 1 << Lt - 1, Tt += (tt & ut ? 1 : 0) + (at & ut ? 2 : 0);
return Tt;
}(this.z, this.x, this.y);
return c[(this.x + this.y) % c.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(g === "tms" ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(/{ratio}/g, p > 1 ? "@2x" : "").replace(/{quadkey}/g, W).replace(/{bbox-epsg-3857}/g, w);
}
isChildOf(c) {
const p = this.z - c.z;
return p > 0 && c.x === this.x >> p && c.y === this.y >> p;
}
getTilePoint(c) {
const p = Math.pow(2, this.z);
return new f((c.x * p - this.x) * Zi, (c.y * p - this.y) * Zi);
}
toString() {
return `${this.z}/${this.x}/${this.y}`;
}
}
class IC {
constructor(c, p) {
this.wrap = c, this.canonical = p, this.key = ru(c, p.z, p.z, p.x, p.y);
}
}
class I2 {
constructor(c, p, g, w, H) {
if (c < g)
throw new Error(`overscaledZ should be >= z; overscaledZ = ${c}; z = ${g}`);
this.overscaledZ = c, this.wrap = p, this.canonical = new K_(g, +w, +H), this.key = ru(p, c, g, w, H);
}
clone() {
return new I2(this.overscaledZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);
}
equals(c) {
return this.overscaledZ === c.overscaledZ && this.wrap === c.wrap && this.canonical.equals(c.canonical);
}
scaledTo(c) {
if (c > this.overscaledZ)
throw new Error(`targetZ > this.overscaledZ; targetZ = ${c}; overscaledZ = ${this.overscaledZ}`);
const p = this.canonical.z - c;
return c > this.canonical.z ? new I2(c, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new I2(c, this.wrap, c, this.canonical.x >> p, this.canonical.y >> p);
}
calculateScaledKey(c, p) {
if (c > this.overscaledZ)
throw new Error(`targetZ > this.overscaledZ; targetZ = ${c}; overscaledZ = ${this.overscaledZ}`);
const g = this.canonical.z - c;
return c > this.canonical.z ? ru(this.wrap * +p, c, this.canonical.z, this.canonical.x, this.canonical.y) : ru(this.wrap * +p, c, c, this.canonical.x >> g, this.canonical.y >> g);
}
isChildOf(c) {
if (c.wrap !== this.wrap)
return !1;
const p = this.canonical.z - c.canonical.z;
return c.overscaledZ === 0 || c.overscaledZ < this.overscaledZ && c.canonical.x === this.canonical.x >> p && c.canonical.y === this.canonical.y >> p;
}
children(c) {
if (this.overscaledZ >= c)
return [new I2(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];
const p = this.canonical.z + 1, g = 2 * this.canonical.x, w = 2 * this.canonical.y;
return [new I2(p, this.wrap, p, g, w), new I2(p, this.wrap, p, g + 1, w), new I2(p, this.wrap, p, g, w + 1), new I2(p, this.wrap, p, g + 1, w + 1)];
}
isLessThan(c) {
return this.wrap < c.wrap || !(this.wrap > c.wrap) && (this.overscaledZ < c.overscaledZ || !(this.overscaledZ > c.overscaledZ) && (this.canonical.x < c.canonical.x || !(this.canonical.x > c.canonical.x) && this.canonical.y < c.canonical.y));
}
wrapped() {
return new I2(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
}
unwrapTo(c) {
return new I2(this.overscaledZ, c, this.canonical.z, this.canonical.x, this.canonical.y);
}
overscaleFactor() {
return Math.pow(2, this.overscaledZ - this.canonical.z);
}
toUnwrapped() {
return new IC(this.wrap, this.canonical);
}
toString() {
return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;
}
getTilePoint(c) {
return this.canonical.getTilePoint(new eu(c.x - this.wrap, c.y));
}
}
function ru(h, c, p, g, w) {
(h *= 2) < 0 && (h = -1 * h - 1);
const H = 1 << p;
return (H * H * h + H * w + g).toString(36) + p.toString(36) + c.toString(36);
}
nr("CanonicalTileID", K_), nr("OverscaledTileID", I2, { omit: ["posMatrix"] });
class PC {
constructor(c, p, g, w = 1, H = 1, A = 1, C = 0) {
if (this.uid = c, p.height !== p.width)
throw new RangeError("DEM tiles must be square");
if (g && !["mapbox", "terrarium", "custom"].includes(g))
return void It(`"${g}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);
this.stride = p.height;
const N = this.dim = p.height - 2;
switch (this.data = new Uint32Array(p.data.buffer), g) {
case "terrarium":
this.redFactor = 256, this.greenFactor = 1, this.blueFactor = 1 / 256, this.baseShift = 32768;
break;
case "custom":
this.redFactor = w, this.greenFactor = H, this.blueFactor = A, this.baseShift = C;
break;
default:
this.redFactor = 6553.6, this.greenFactor = 25.6, this.blueFactor = 0.1, this.baseShift = 1e4;
}
for (let z = 0; z < N; z++)
this.data[this._idx(-1, z)] = this.data[this._idx(0, z)], this.data[this._idx(N, z)] = this.data[this._idx(N - 1, z)], this.data[this._idx(z, -1)] = this.data[this._idx(z, 0)], this.data[this._idx(z, N)] = this.data[this._idx(z, N - 1)];
this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(N, -1)] = this.data[this._idx(N - 1, 0)], this.data[this._idx(-1, N)] = this.data[this._idx(0, N - 1)], this.data[this._idx(N, N)] = this.data[this._idx(N - 1, N - 1)], this.min = Number.MAX_SAFE_INTEGER, this.max = Number.MIN_SAFE_INTEGER;
for (let z = 0; z < N; z++)
for (let W = 0; W < N; W++) {
const X = this.get(z, W);
X > this.max && (this.max = X), X < this.min && (this.min = X);
}
}
get(c, p) {
const g = new Uint8Array(this.data.buffer), w = 4 * this._idx(c, p);
return this.unpack(g[w], g[w + 1], g[w + 2]);
}
getUnpackVector() {
return [this.redFactor, this.greenFactor, this.blueFactor, this.baseShift];
}
_idx(c, p) {
if (c < -1 || c >= this.dim + 1 || p < -1 || p >= this.dim + 1)
throw new RangeError("out of range source coordinates for DEM data");
return (p + 1) * this.stride + (c + 1);
}
unpack(c, p, g) {
return c * this.redFactor + p * this.greenFactor + g * this.blueFactor - this.baseShift;
}
getPixels() {
return new k2({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));
}
backfillBorder(c, p, g) {
if (this.dim !== c.dim)
throw new Error("dem dimension mismatch");
let w = p * this.dim, H = p * this.dim + this.dim, A = g * this.dim, C = g * this.dim + this.dim;
switch (p) {
case -1:
w = H - 1;
break;
case 1:
H = w + 1;
}
switch (g) {
case -1:
A = C - 1;
break;
case 1:
C = A + 1;
}
const N = -p * this.dim, z = -g * this.dim;
for (let W = A; W < C; W++)
for (let X = w; X < H; X++)
this.data[this._idx(X, W)] = c.data[this._idx(X + N, W + z)];
}
}
nr("DEMData", PC);
class VC {
constructor(c) {
this._stringToNumber = {}, this._numberToString = [];
for (let p = 0; p < c.length; p++) {
const g = c[p];
this._stringToNumber[g] = p, this._numberToString[p] = g;
}
}
encode(c) {
return this._stringToNumber[c];
}
decode(c) {
if (c >= this._numberToString.length)
throw new Error(`Out of bounds. Index requested n=${c} can't be >= this._numberToString.length ${this._numberToString.length}`);
return this._numberToString[c];
}
}
class RC {
constructor(c, p, g, w, H) {
this.type = "Feature", this._vectorTileFeature = c, c._z = p, c._x = g, c._y = w, this.properties = c.properties, this.id = H;
}
get geometry() {
return this._geometry === void 0 && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry;
}
set geometry(c) {
this._geometry = c;
}
toJSON() {
const c = { geometry: this.geometry };
for (const p in this)
p !== "_geometry" && p !== "_vectorTileFeature" && (c[p] = this[p]);
return c;
}
}
class NC {
constructor(c, p) {
this.tileID = c, this.x = c.canonical.x, this.y = c.canonical.y, this.z = c.canonical.z, this.grid = new t6(Zi, 16, 0), this.grid3D = new t6(Zi, 16, 0), this.featureIndexArray = new q1(), this.promoteId = p;
}
insert(c, p, g, w, H, A) {
const C = this.featureIndexArray.length;
this.featureIndexArray.emplaceBack(g, w, H);
const N = A ? this.grid3D : this.grid;
for (let z = 0; z < p.length; z++) {
const W = p[z], X = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let tt = 0; tt < W.length; tt++) {
const at = W[tt];
X[0] = Math.min(X[0], at.x), X[1] = Math.min(X[1], at.y), X[2] = Math.max(X[2], at.x), X[3] = Math.max(X[3], at.y);
}
X[0] < Zi && X[1] < Zi && X[2] >= 0 && X[3] >= 0 && N.insert(C, X[0], X[1], X[2], X[3]);
}
}
loadVTLayers() {
return this.vtLayers || (this.vtLayers = new h6.VectorTile(new D_(this.rawTileData)).layers, this.sourceLayerCoder = new VC(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers;
}
query(c, p, g, w) {
this.loadVTLayers();
const H = c.params || {}, A = Zi / c.tileSize / c.scale, C = K4(H.filter), N = c.queryGeometry, z = c.queryPadding * A, W = FC(N), X = this.grid.query(W.minX - z, W.minY - z, W.maxX + z, W.maxY + z), tt = FC(c.cameraQueryGeometry), at = this.grid3D.query(tt.minX - z, tt.minY - z, tt.maxX + z, tt.maxY + z, (Lt, Et, $t, Pt) => function(Bt, ee, _e, Xe, Er) {
for (const Re of Bt)
if (ee <= Re.x && _e <= Re.y && Xe >= Re.x && Er >= Re.y)
return !0;
const ze = [new f(ee, _e), new f(ee, Er), new f(Xe, Er), new f(Xe, _e)];
if (Bt.length > 2) {
for (const Re of ze)
if (Dl(Bt, Re))
return !0;
}
for (let Re = 0; Re < Bt.length - 1; Re++)
if (bJ(Bt[Re], Bt[Re + 1], ze))
return !0;
return !1;
}(c.cameraQueryGeometry, Lt - z, Et - z, $t + z, Pt + z));
for (const Lt of at)
X.push(Lt);
X.sort(Utt);
const ut = {};
let Tt;
for (let Lt = 0; Lt < X.length; Lt++) {
const Et = X[Lt];
if (Et === Tt)
continue;
Tt = Et;
const $t = this.featureIndexArray.get(Et);
let Pt = null;
this.loadMatchingFeature(ut, $t.bucketIndex, $t.sourceLayerIndex, $t.featureIndex, C, H.layers, H.availableImages, p, g, w, (Bt, ee, _e) => (Pt || (Pt = D0(Bt)), ee.queryIntersectsFeature(N, Bt, _e, Pt, this.z, c.transform, A, c.pixelPosMatrix)));
}
return ut;
}
loadMatchingFeature(c, p, g, w, H, A, C, N, z, W, X) {
const tt = this.bucketLayerIDs[p];
if (A && !function(Lt, Et) {
for (let $t = 0; $t < Lt.length; $t++)
if (Et.indexOf(Lt[$t]) >= 0)
return !0;
return !1;
}(A, tt))
return;
const at = this.sourceLayerCoder.decode(g), ut = this.vtLayers[at].feature(w);
if (H.needGeometry) {
const Lt = F0(ut, !0);
if (!H.filter(new ti(this.tileID.overscaledZ), Lt, this.tileID.canonical))
return;
} else if (!H.filter(new ti(this.tileID.overscaledZ), ut))
return;
const Tt = this.getId(ut, at);
for (let Lt = 0; Lt < tt.length; Lt++) {
const Et = tt[Lt];
if (A && A.indexOf(Et) < 0)
continue;
const $t = N[Et];
if (!$t)
continue;
let Pt = {};
Tt && W && (Pt = W.getState($t.sourceLayer || "_geojsonTileLayer", Tt));
const Bt = $({}, z[Et]);
Bt.paint = DC(Bt.paint, $t.paint, ut, Pt, C), Bt.layout = DC(Bt.layout, $t.layout, ut, Pt, C);
const ee = !X || X(ut, $t, Pt);
if (!ee)
continue;
const _e = new RC(ut, this.z, this.x, this.y, Tt);
_e.layer = Bt;
let Xe = c[Et];
Xe === void 0 && (Xe = c[Et] = []), Xe.push({ featureIndex: w, feature: _e, intersectionZ: ee });
}
}
lookupSymbolFeatures(c, p, g, w, H, A, C, N) {
const z = {};
this.loadVTLayers();
const W = K4(H);
for (const X of c)
this.loadMatchingFeature(z, g, w, X, W, A, C, N, p);
return z;
}
hasLayer(c) {
for (const p of this.bucketLayerIDs)
for (const g of p)
if (c === g)
return !0;
return !1;
}
getId(c, p) {
let g = c.id;
return this.promoteId && (g = c.properties[typeof this.promoteId == "string" ? this.promoteId : this.promoteId[p]], typeof g == "boolean" && (g = Number(g))), g;
}
}
function DC(h, c, p, g, w) {
return nt(h, (H, A) => {
const C = c instanceof P0 ? c.get(A) : null;
return C && C.evaluate ? C.evaluate(p, g, w) : C;
});
}
function FC(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h)
c = Math.min(c, H.x), p = Math.min(p, H.y), g = Math.max(g, H.x), w = Math.max(w, H.y);
return { minX: c, minY: p, maxX: g, maxY: w };
}
function Utt(h, c) {
return c - h;
}
function BC(h, c, p, g, w) {
const H = [];
for (let A = 0; A < h.length; A++) {
const C = h[A];
let N;
for (let z = 0; z < C.length - 1; z++) {
let W = C[z], X = C[z + 1];
W.x < c && X.x < c || (W.x < c ? W = new f(c, W.y + (c - W.x) / (X.x - W.x) * (X.y - W.y))._round() : X.x < c && (X = new f(c, W.y + (c - W.x) / (X.x - W.x) * (X.y - W.y))._round()), W.y < p && X.y < p || (W.y < p ? W = new f(W.x + (p - W.y) / (X.y - W.y) * (X.x - W.x), p)._round() : X.y < p && (X = new f(W.x + (p - W.y) / (X.y - W.y) * (X.x - W.x), p)._round()), W.x >= g && X.x >= g || (W.x >= g ? W = new f(g, W.y + (g - W.x) / (X.x - W.x) * (X.y - W.y))._round() : X.x >= g && (X = new f(g, W.y + (g - W.x) / (X.x - W.x) * (X.y - W.y))._round()), W.y >= w && X.y >= w || (W.y >= w ? W = new f(W.x + (w - W.y) / (X.y - W.y) * (X.x - W.x), w)._round() : X.y >= w && (X = new f(W.x + (w - W.y) / (X.y - W.y) * (X.x - W.x), w)._round()), N && W.equals(N[N.length - 1]) || (N = [W], H.push(N)), N.push(X)))));
}
}
return H;
}
nr("FeatureIndex", NC, { omit: ["rawTileData", "sourceLayerCoder"] });
class f6 extends f {
constructor(c, p, g, w) {
super(c, p), this.angle = g, w !== void 0 && (this.segment = w);
}
clone() {
return new f6(this.x, this.y, this.angle, this.segment);
}
}
function jC(h, c, p, g, w) {
if (c.segment === void 0 || p === 0)
return !0;
let H = c, A = c.segment + 1, C = 0;
for (; C > -p / 2; ) {
if (A--, A < 0)
return !1;
C -= h[A].dist(H), H = h[A];
}
C += h[A].dist(h[A + 1]), A++;
const N = [];
let z = 0;
for (; C < p / 2; ) {
const W = h[A], X = h[A + 1];
if (!X)
return !1;
let tt = h[A - 1].angleTo(W) - W.angleTo(X);
for (tt = Math.abs((tt + 3 * Math.PI) % (2 * Math.PI) - Math.PI), N.push({ distance: C, angleDelta: tt }), z += tt; C - N[0].distance > g; )
z -= N.shift().angleDelta;
if (z > w)
return !1;
A++, C += W.dist(X);
}
return !0;
}
function zC(h) {
let c = 0;
for (let p = 0; p < h.length - 1; p++)
c += h[p].dist(h[p + 1]);
return c;
}
function UC(h, c, p) {
return h ? 0.6 * c * p : 0;
}
function GC(h, c) {
return Math.max(h ? h.right - h.left : 0, c ? c.right - c.left : 0);
}
function Gtt(h, c, p, g, w, H) {
const A = UC(p, w, H), C = GC(p, g) * H;
let N = 0;
const z = zC(h) / 2;
for (let W = 0; W < h.length - 1; W++) {
const X = h[W], tt = h[W + 1], at = X.dist(tt);
if (N + at > z) {
const ut = (z - N) / at, Tt = xr.number(X.x, tt.x, ut), Lt = xr.number(X.y, tt.y, ut), Et = new f6(Tt, Lt, tt.angleTo(X), W);
return Et._round(), !A || jC(h, Et, C, A, c) ? Et : void 0;
}
N += at;
}
}
function $tt(h, c, p, g, w, H, A, C, N) {
const z = UC(g, H, A), W = GC(g, w), X = W * A, tt = h[0].x === 0 || h[0].x === N || h[0].y === 0 || h[0].y === N;
return c - X < c / 4 && (c = X + c / 4), $C(h, tt ? c / 2 * C % c : (W / 2 + 2 * H) * A * C % c, c, z, p, X, tt, !1, N);
}
function $C(h, c, p, g, w, H, A, C, N) {
const z = H / 2, W = zC(h);
let X = 0, tt = c - p, at = [];
for (let ut = 0; ut < h.length - 1; ut++) {
const Tt = h[ut], Lt = h[ut + 1], Et = Tt.dist(Lt), $t = Lt.angleTo(Tt);
for (; tt + p < X + Et; ) {
tt += p;
const Pt = (tt - X) / Et, Bt = xr.number(Tt.x, Lt.x, Pt), ee = xr.number(Tt.y, Lt.y, Pt);
if (Bt >= 0 && Bt < N && ee >= 0 && ee < N && tt - z >= 0 && tt + z <= W) {
const _e = new f6(Bt, ee, $t, ut);
_e._round(), g && !jC(h, _e, H, g, w) || at.push(_e);
}
}
X += Et;
}
return C || at.length || A || (at = $C(h, X / 2, p, g, w, H, A, !0, N)), at;
}
nr("Anchor", f6);
const $l = No;
function WC(h, c, p, g) {
const w = [], H = h.image, A = H.pixelRatio, C = H.paddedRect.w - 2 * $l, N = H.paddedRect.h - 2 * $l;
let z = { x1: h.left, y1: h.top, x2: h.right, y2: h.bottom };
const W = H.stretchX || [[0, C]], X = H.stretchY || [[0, N]], tt = (ue, gr) => ue + gr[1] - gr[0], at = W.reduce(tt, 0), ut = X.reduce(tt, 0), Tt = C - at, Lt = N - ut;
let Et = 0, $t = at, Pt = 0, Bt = ut, ee = 0, _e = Tt, Xe = 0, Er = Lt;
if (H.content && g) {
const ue = H.content, gr = ue[2] - ue[0], pr = ue[3] - ue[1];
(H.textFitWidth || H.textFitHeight) && (z = vC(h)), Et = Np(W, 0, ue[0]), Pt = Np(X, 0, ue[1]), $t = Np(W, ue[0], ue[2]), Bt = Np(X, ue[1], ue[3]), ee = ue[0] - Et, Xe = ue[1] - Pt, _e = gr - $t, Er = pr - Bt;
}
const ze = z.x1, Re = z.y1, Qr = z.x2 - ze, sr = z.y2 - Re, rr = (ue, gr, pr, Ir) => {
const Fn = Dp(ue.stretch - Et, $t, Qr, ze), Pn = Fp(ue.fixed - ee, _e, ue.stretch, at), p1 = Dp(gr.stretch - Pt, Bt, sr, Re), ms = Fp(gr.fixed - Xe, Er, gr.stretch, ut), V1 = Dp(pr.stretch - Et, $t, Qr, ze), T1 = Fp(pr.fixed - ee, _e, pr.stretch, at), yo = Dp(Ir.stretch - Pt, Bt, sr, Re), vo = Fp(Ir.fixed - Xe, Er, Ir.stretch, ut), _o = new f(Fn, p1), Oi = new f(V1, p1), f1 = new f(V1, yo), K1 = new f(Fn, yo), R1 = new f(Pn / A, ms / A), bo = new f(T1 / A, vo / A), N1 = c * Math.PI / 180;
if (N1) {
const fn = Math.sin(N1), Un = Math.cos(N1), ii = [Un, -fn, fn, Un];
_o._matMult(ii), Oi._matMult(ii), K1._matMult(ii), f1._matMult(ii);
}
const P2 = ue.stretch + ue.fixed, Do = gr.stretch + gr.fixed;
return { tl: _o, tr: Oi, bl: K1, br: f1, tex: { x: H.paddedRect.x + $l + P2, y: H.paddedRect.y + $l + Do, w: pr.stretch + pr.fixed - P2, h: Ir.stretch + Ir.fixed - Do }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: R1, pixelOffsetBR: bo, minFontScaleX: _e / A / Qr, minFontScaleY: Er / A / sr, isSDF: p };
};
if (g && (H.stretchX || H.stretchY)) {
const ue = ZC(W, Tt, at), gr = ZC(X, Lt, ut);
for (let pr = 0; pr < ue.length - 1; pr++) {
const Ir = ue[pr], Fn = ue[pr + 1];
for (let Pn = 0; Pn < gr.length - 1; Pn++)
w.push(rr(Ir, gr[Pn], Fn, gr[Pn + 1]));
}
} else
w.push(rr({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: C + 1 }, { fixed: 0, stretch: N + 1 }));
return w;
}
function Np(h, c, p) {
let g = 0;
for (const w of h)
g += Math.max(c, Math.min(p, w[1])) - Math.max(c, Math.min(p, w[0]));
return g;
}
function ZC(h, c, p) {
const g = [{ fixed: -$l, stretch: 0 }];
for (const [w, H] of h) {
const A = g[g.length - 1];
g.push({ fixed: w - A.stretch, stretch: A.stretch }), g.push({ fixed: w - A.stretch, stretch: A.stretch + (H - w) });
}
return g.push({ fixed: c + $l, stretch: p }), g;
}
function Dp(h, c, p, g) {
return h / c * p + g;
}
function Fp(h, c, p, g) {
return h - c * p / g;
}
class Bp {
constructor(c, p, g, w, H, A, C, N, z, W) {
var X;
if (this.boxStartIndex = c.length, z) {
let tt = A.top, at = A.bottom;
const ut = A.collisionPadding;
ut && (tt -= ut[1], at += ut[3]);
let Tt = at - tt;
Tt > 0 && (Tt = Math.max(10, Tt), this.circleDiameter = Tt);
} else {
const tt = !((X = A.image) === null || X === void 0) && X.content && (A.image.textFitWidth || A.image.textFitHeight) ? vC(A) : { x1: A.left, y1: A.top, x2: A.right, y2: A.bottom };
tt.y1 = tt.y1 * C - N[0], tt.y2 = tt.y2 * C + N[2], tt.x1 = tt.x1 * C - N[3], tt.x2 = tt.x2 * C + N[1];
const at = A.collisionPadding;
if (at && (tt.x1 -= at[0] * C, tt.y1 -= at[1] * C, tt.x2 += at[2] * C, tt.y2 += at[3] * C), W) {
const ut = new f(tt.x1, tt.y1), Tt = new f(tt.x2, tt.y1), Lt = new f(tt.x1, tt.y2), Et = new f(tt.x2, tt.y2), $t = W * Math.PI / 180;
ut._rotate($t), Tt._rotate($t), Lt._rotate($t), Et._rotate($t), tt.x1 = Math.min(ut.x, Tt.x, Lt.x, Et.x), tt.x2 = Math.max(ut.x, Tt.x, Lt.x, Et.x), tt.y1 = Math.min(ut.y, Tt.y, Lt.y, Et.y), tt.y2 = Math.max(ut.y, Tt.y, Lt.y, Et.y);
}
c.emplaceBack(p.x, p.y, tt.x1, tt.y1, tt.x2, tt.y2, g, w, H);
}
this.boxEndIndex = c.length;
}
}
class Wtt {
constructor(c = [], p = (g, w) => g < w ? -1 : g > w ? 1 : 0) {
if (this.data = c, this.length = this.data.length, this.compare = p, this.length > 0)
for (let g = (this.length >> 1) - 1; g >= 0; g--)
this._down(g);
}
push(c) {
this.data.push(c), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const c = this.data[0], p = this.data.pop();
return --this.length > 0 && (this.data[0] = p, this._down(0)), c;
}
peek() {
return this.data[0];
}
_up(c) {
const { data: p, compare: g } = this, w = p[c];
for (; c > 0; ) {
const H = c - 1 >> 1, A = p[H];
if (g(w, A) >= 0)
break;
p[c] = A, c = H;
}
p[c] = w;
}
_down(c) {
const { data: p, compare: g } = this, w = this.length >> 1, H = p[c];
for (; c < w; ) {
let A = 1 + (c << 1);
const C = A + 1;
if (C < this.length && g(p[C], p[A]) < 0 && (A = C), g(p[A], H) >= 0)
break;
p[c] = p[A], c = A;
}
p[c] = H;
}
}
function Ztt(h, c = 1, p = !1) {
let g = 1 / 0, w = 1 / 0, H = -1 / 0, A = -1 / 0;
const C = h[0];
for (let at = 0; at < C.length; at++) {
const ut = C[at];
(!at || ut.x < g) && (g = ut.x), (!at || ut.y < w) && (w = ut.y), (!at || ut.x > H) && (H = ut.x), (!at || ut.y > A) && (A = ut.y);
}
const N = Math.min(H - g, A - w);
let z = N / 2;
const W = new Wtt([], qtt);
if (N === 0)
return new f(g, w);
for (let at = g; at < H; at += N)
for (let ut = w; ut < A; ut += N)
W.push(new Wl(at + z, ut + z, z, h));
let X = function(at) {
let ut = 0, Tt = 0, Lt = 0;
const Et = at[0];
for (let $t = 0, Pt = Et.length, Bt = Pt - 1; $t < Pt; Bt = $t++) {
const ee = Et[$t], _e = Et[Bt], Xe = ee.x * _e.y - _e.x * ee.y;
Tt += (ee.x + _e.x) * Xe, Lt += (ee.y + _e.y) * Xe, ut += 3 * Xe;
}
return new Wl(Tt / ut, Lt / ut, 0, at);
}(h), tt = W.length;
for (; W.length; ) {
const at = W.pop();
(at.d > X.d || !X.d) && (X = at, p && console.log("found best %d after %d probes", Math.round(1e4 * at.d) / 1e4, tt)), at.max - X.d <= c || (z = at.h / 2, W.push(new Wl(at.p.x - z, at.p.y - z, z, h)), W.push(new Wl(at.p.x + z, at.p.y - z, z, h)), W.push(new Wl(at.p.x - z, at.p.y + z, z, h)), W.push(new Wl(at.p.x + z, at.p.y + z, z, h)), tt += 4);
}
return p && (console.log(`num probes: ${tt}`), console.log(`best distance: ${X.d}`)), X.p;
}
function qtt(h, c) {
return c.max - h.max;
}
function Wl(h, c, p, g) {
this.p = new f(h, c), this.h = p, this.d = function(w, H) {
let A = !1, C = 1 / 0;
for (let N = 0; N < H.length; N++) {
const z = H[N];
for (let W = 0, X = z.length, tt = X - 1; W < X; tt = W++) {
const at = z[W], ut = z[tt];
at.y > w.y != ut.y > w.y && w.x < (ut.x - at.x) * (w.y - at.y) / (ut.y - at.y) + at.x && (A = !A), C = Math.min(C, OO(w, at, ut));
}
}
return (A ? 1 : -1) * Math.sqrt(C);
}(this.p, g), this.max = this.d + this.h * Math.SQRT2;
}
var P1;
s.aq = void 0, (P1 = s.aq || (s.aq = {}))[P1.center = 1] = "center", P1[P1.left = 2] = "left", P1[P1.right = 3] = "right", P1[P1.top = 4] = "top", P1[P1.bottom = 5] = "bottom", P1[P1["top-left"] = 6] = "top-left", P1[P1["top-right"] = 7] = "top-right", P1[P1["bottom-left"] = 8] = "bottom-left", P1[P1["bottom-right"] = 9] = "bottom-right";
const Q6 = 7, Y_ = Number.POSITIVE_INFINITY;
function qC(h, c) {
return c[1] !== Y_ ? function(p, g, w) {
let H = 0, A = 0;
switch (g = Math.abs(g), w = Math.abs(w), p) {
case "top-right":
case "top-left":
case "top":
A = w - Q6;
break;
case "bottom-right":
case "bottom-left":
case "bottom":
A = -w + Q6;
}
switch (p) {
case "top-right":
case "bottom-right":
case "right":
H = -g;
break;
case "top-left":
case "bottom-left":
case "left":
H = g;
}
return [H, A];
}(h, c[0], c[1]) : function(p, g) {
let w = 0, H = 0;
g < 0 && (g = 0);
const A = g / Math.SQRT2;
switch (p) {
case "top-right":
case "top-left":
H = A - Q6;
break;
case "bottom-right":
case "bottom-left":
H = -A + Q6;
break;
case "bottom":
H = -g + Q6;
break;
case "top":
H = g - Q6;
}
switch (p) {
case "top-right":
case "bottom-right":
w = -A;
break;
case "top-left":
case "bottom-left":
w = A;
break;
case "left":
w = g;
break;
case "right":
w = -g;
}
return [w, H];
}(h, c[0]);
}
function XC(h, c, p) {
var g;
const w = h.layout, H = (g = w.get("text-variable-anchor-offset")) === null || g === void 0 ? void 0 : g.evaluate(c, {}, p);
if (H) {
const C = H.values, N = [];
for (let z = 0; z < C.length; z += 2) {
const W = N[z] = C[z], X = C[z + 1].map((tt) => tt * r1);
W.startsWith("top") ? X[1] -= Q6 : W.startsWith("bottom") && (X[1] += Q6), N[z + 1] = X;
}
return new _n(N);
}
const A = w.get("text-variable-anchor");
if (A) {
let C;
C = h._unevaluatedLayout.getValue("text-radial-offset") !== void 0 ? [w.get("text-radial-offset").evaluate(c, {}, p) * r1, Y_] : w.get("text-offset").evaluate(c, {}, p).map((z) => z * r1);
const N = [];
for (const z of A)
N.push(z, qC(z, C));
return new _n(N);
}
return null;
}
function J_(h) {
switch (h) {
case "right":
case "top-right":
case "bottom-right":
return "right";
case "left":
case "top-left":
case "bottom-left":
return "left";
}
return "center";
}
function Xtt(h, c, p, g, w, H, A, C, N, z, W) {
let X = H.textMaxSize.evaluate(c, {});
X === void 0 && (X = A);
const tt = h.layers[0].layout, at = tt.get("icon-offset").evaluate(c, {}, W), ut = YC(p.horizontal), Tt = A / 24, Lt = h.tilePixelRatio * Tt, Et = h.tilePixelRatio * X / 24, $t = h.tilePixelRatio * C, Pt = h.tilePixelRatio * tt.get("symbol-spacing"), Bt = tt.get("text-padding") * h.tilePixelRatio, ee = function(ue, gr, pr, Ir = 1) {
const Fn = ue.get("icon-padding").evaluate(gr, {}, pr), Pn = Fn && Fn.values;
return [Pn[0] * Ir, Pn[1] * Ir, Pn[2] * Ir, Pn[3] * Ir];
}(tt, c, W, h.tilePixelRatio), _e = tt.get("text-max-angle") / 180 * Math.PI, Xe = tt.get("text-rotation-alignment") !== "viewport" && tt.get("symbol-placement") !== "point", Er = tt.get("icon-rotation-alignment") === "map" && tt.get("symbol-placement") !== "point", ze = tt.get("symbol-placement"), Re = Pt / 2, Qr = tt.get("icon-text-fit");
let sr;
g && Qr !== "none" && (h.allowVerticalPlacement && p.vertical && (sr = _C(g, p.vertical, Qr, tt.get("icon-text-fit-padding"), at, Tt)), ut && (g = _C(g, ut, Qr, tt.get("icon-text-fit-padding"), at, Tt)));
const rr = (ue, gr) => {
gr.x < 0 || gr.x >= Zi || gr.y < 0 || gr.y >= Zi || function(pr, Ir, Fn, Pn, p1, ms, V1, T1, yo, vo, _o, Oi, f1, K1, R1, bo, N1, P2, Do, fn, Un, ii, a2, xi, Zl) {
const Ha = pr.addToLineVertexArray(Ir, Fn);
let Aa, gs, V2, L1, U3 = 0, ou = 0, rk = 0, nk = 0, ab = -1, lb = -1;
const G3 = {};
let ik = Pl("");
if (pr.allowVerticalPlacement && Pn.vertical) {
const Y1 = T1.layout.get("text-rotate").evaluate(Un, {}, xi) + 90;
V2 = new Bp(yo, Ir, vo, _o, Oi, Pn.vertical, f1, K1, R1, Y1), V1 && (L1 = new Bp(yo, Ir, vo, _o, Oi, V1, N1, P2, R1, Y1));
}
if (p1) {
const Y1 = T1.layout.get("icon-rotate").evaluate(Un, {}), R2 = T1.layout.get("icon-text-fit") !== "none", j0 = WC(p1, Y1, a2, R2), qs = V1 ? WC(V1, Y1, a2, R2) : void 0;
gs = new Bp(yo, Ir, vo, _o, Oi, p1, N1, P2, !1, Y1), U3 = 4 * j0.length;
const z0 = pr.iconSizeData;
let Oa = null;
z0.kind === "source" ? (Oa = [Sa * T1.layout.get("icon-size").evaluate(Un, {})], Oa[0] > p6 && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)) : z0.kind === "composite" && (Oa = [Sa * ii.compositeIconSizes[0].evaluate(Un, {}, xi), Sa * ii.compositeIconSizes[1].evaluate(Un, {}, xi)], (Oa[0] > p6 || Oa[1] > p6) && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${tu}. Reduce your "icon-size".`)), pr.addSymbols(pr.icon, j0, Oa, fn, Do, Un, s.ah.none, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), ab = pr.icon.placedSymbolArray.length - 1, qs && (ou = 4 * qs.length, pr.addSymbols(pr.icon, qs, Oa, fn, Do, Un, s.ah.vertical, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), lb = pr.icon.placedSymbolArray.length - 1);
}
const ok = Object.keys(Pn.horizontal);
for (const Y1 of ok) {
const R2 = Pn.horizontal[Y1];
if (!Aa) {
ik = Pl(R2.text);
const qs = T1.layout.get("text-rotate").evaluate(Un, {}, xi);
Aa = new Bp(yo, Ir, vo, _o, Oi, R2, f1, K1, R1, qs);
}
const j0 = R2.positionedLines.length === 1;
if (rk += KC(pr, Ir, R2, ms, T1, R1, Un, bo, Ha, Pn.vertical ? s.ah.horizontal : s.ah.horizontalOnly, j0 ? ok : [Y1], G3, ab, ii, xi), j0)
break;
}
Pn.vertical && (nk += KC(pr, Ir, Pn.vertical, ms, T1, R1, Un, bo, Ha, s.ah.vertical, ["vertical"], G3, lb, ii, xi));
const Jtt = Aa ? Aa.boxStartIndex : pr.collisionBoxArray.length, tet = Aa ? Aa.boxEndIndex : pr.collisionBoxArray.length, eet = V2 ? V2.boxStartIndex : pr.collisionBoxArray.length, ret = V2 ? V2.boxEndIndex : pr.collisionBoxArray.length, net = gs ? gs.boxStartIndex : pr.collisionBoxArray.length, iet = gs ? gs.boxEndIndex : pr.collisionBoxArray.length, oet = L1 ? L1.boxStartIndex : pr.collisionBoxArray.length, set = L1 ? L1.boxEndIndex : pr.collisionBoxArray.length;
let Zs = -1;
const zp = (Y1, R2) => Y1 && Y1.circleDiameter ? Math.max(Y1.circleDiameter, R2) : R2;
Zs = zp(Aa, Zs), Zs = zp(V2, Zs), Zs = zp(gs, Zs), Zs = zp(L1, Zs);
const sk = Zs > -1 ? 1 : 0;
sk && (Zs *= Zl / r1), pr.glyphOffsetArray.length >= Gl.MAX_GLYPHS && It("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), Un.sortKey !== void 0 && pr.addToSortKeyRanges(pr.symbolInstances.length, Un.sortKey);
const aet = XC(T1, Un, xi), [cet, uet] = function(Y1, R2) {
const j0 = Y1.length, qs = R2 == null ? void 0 : R2.values;
if ((qs == null ? void 0 : qs.length) > 0)
for (let z0 = 0; z0 < qs.length; z0 += 2) {
const Oa = qs[z0 + 1];
Y1.emplaceBack(s.aq[qs[z0]], Oa[0], Oa[1]);
}
return [j0, Y1.length];
}(pr.textAnchorOffsets, aet);
pr.symbolInstances.emplaceBack(Ir.x, Ir.y, G3.right >= 0 ? G3.right : -1, G3.center >= 0 ? G3.center : -1, G3.left >= 0 ? G3.left : -1, G3.vertical || -1, ab, lb, ik, Jtt, tet, eet, ret, net, iet, oet, set, vo, rk, nk, U3, ou, sk, 0, f1, Zs, cet, uet);
}(h, gr, ue, p, g, w, sr, h.layers[0], h.collisionBoxArray, c.index, c.sourceLayerIndex, h.index, Lt, [Bt, Bt, Bt, Bt], Xe, N, $t, ee, Er, at, c, H, z, W, A);
};
if (ze === "line")
for (const ue of BC(c.geometry, 0, 0, Zi, Zi)) {
const gr = $tt(ue, Pt, _e, p.vertical || ut, g, 24, Et, h.overscaling, Zi);
for (const pr of gr)
ut && Ktt(h, ut.text, Re, pr) || rr(ue, pr);
}
else if (ze === "line-center") {
for (const ue of c.geometry)
if (ue.length > 1) {
const gr = Gtt(ue, _e, p.vertical || ut, g, 24, Et);
gr && rr(ue, gr);
}
} else if (c.type === "Polygon")
for (const ue of z4(c.geometry, 0)) {
const gr = Ztt(ue, 16);
rr(ue[0], new f6(gr.x, gr.y, 0));
}
else if (c.type === "LineString")
for (const ue of c.geometry)
rr(ue, new f6(ue[0].x, ue[0].y, 0));
else if (c.type === "Point")
for (const ue of c.geometry)
for (const gr of ue)
rr([gr], new f6(gr.x, gr.y, 0));
}
function KC(h, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut) {
const Tt = function($t, Pt, Bt, ee, _e, Xe, Er, ze) {
const Re = ee.layout.get("text-rotate").evaluate(Xe, {}) * Math.PI / 180, Qr = [];
for (const sr of Pt.positionedLines)
for (const rr of sr.positionedGlyphs) {
if (!rr.rect)
continue;
const ue = rr.rect || {};
let gr = pC + 1, pr = !0, Ir = 1, Fn = 0;
const Pn = (_e || ze) && rr.vertical, p1 = rr.metrics.advance * rr.scale / 2;
if (ze && Pt.verticalizable && (Fn = sr.lineOffset / 2 - (rr.imageName ? -(r1 - rr.metrics.width * rr.scale) / 2 : (rr.scale - 1) * r1)), rr.imageName) {
const fn = Er[rr.imageName];
pr = fn.sdf, Ir = fn.pixelRatio, gr = No / Ir;
}
const ms = _e ? [rr.x + p1, rr.y] : [0, 0];
let V1 = _e ? [0, 0] : [rr.x + p1 + Bt[0], rr.y + Bt[1] - Fn], T1 = [0, 0];
Pn && (T1 = V1, V1 = [0, 0]);
const yo = rr.metrics.isDoubleResolution ? 2 : 1, vo = (rr.metrics.left - gr) * rr.scale - p1 + V1[0], _o = (-rr.metrics.top - gr) * rr.scale + V1[1], Oi = vo + ue.w / yo * rr.scale / Ir, f1 = _o + ue.h / yo * rr.scale / Ir, K1 = new f(vo, _o), R1 = new f(Oi, _o), bo = new f(vo, f1), N1 = new f(Oi, f1);
if (Pn) {
const fn = new f(-p1, p1 - Yc), Un = -Math.PI / 2, ii = r1 / 2 - p1, a2 = new f(5 - Yc - ii, -(rr.imageName ? ii : 0)), xi = new f(...T1);
K1._rotateAround(Un, fn)._add(a2)._add(xi), R1._rotateAround(Un, fn)._add(a2)._add(xi), bo._rotateAround(Un, fn)._add(a2)._add(xi), N1._rotateAround(Un, fn)._add(a2)._add(xi);
}
if (Re) {
const fn = Math.sin(Re), Un = Math.cos(Re), ii = [Un, -fn, fn, Un];
K1._matMult(ii), R1._matMult(ii), bo._matMult(ii), N1._matMult(ii);
}
const P2 = new f(0, 0), Do = new f(0, 0);
Qr.push({ tl: K1, tr: R1, bl: bo, br: N1, tex: ue, writingMode: Pt.writingMode, glyphOffset: ms, sectionIndex: rr.sectionIndex, isSDF: pr, pixelOffsetTL: P2, pixelOffsetBR: Do, minFontScaleX: 0, minFontScaleY: 0 });
}
return Qr;
}(0, p, C, w, H, A, g, h.allowVerticalPlacement), Lt = h.textSizeData;
let Et = null;
Lt.kind === "source" ? (Et = [Sa * w.layout.get("text-size").evaluate(A, {})], Et[0] > p6 && It(`${h.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)) : Lt.kind === "composite" && (Et = [Sa * at.compositeTextSizes[0].evaluate(A, {}, ut), Sa * at.compositeTextSizes[1].evaluate(A, {}, ut)], (Et[0] > p6 || Et[1] > p6) && It(`${h.layerIds[0]}: Value for "text-size" is >= ${tu}. Reduce your "text-size".`)), h.addSymbols(h.text, Tt, Et, C, H, A, z, c, N.lineStartIndex, N.lineLength, tt, ut);
for (const $t of W)
X[$t] = h.text.placedSymbolArray.length - 1;
return 4 * Tt.length;
}
function YC(h) {
for (const c in h)
return h[c];
return null;
}
function Ktt(h, c, p, g) {
const w = h.compareText;
if (c in w) {
const H = w[c];
for (let A = H.length - 1; A >= 0; A--)
if (g.dist(H[A]) < p)
return !0;
} else
w[c] = [];
return w[c].push(g), !1;
}
const JC = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
class tb {
static from(c) {
if (!(c instanceof ArrayBuffer))
throw new Error("Data must be an instance of ArrayBuffer.");
const [p, g] = new Uint8Array(c, 0, 2);
if (p !== 219)
throw new Error("Data does not appear to be in a KDBush format.");
const w = g >> 4;
if (w !== 1)
throw new Error(`Got v${w} data when expected v1.`);
const H = JC[15 & g];
if (!H)
throw new Error("Unrecognized array type.");
const [A] = new Uint16Array(c, 2, 1), [C] = new Uint32Array(c, 4, 1);
return new tb(C, A, H, c);
}
constructor(c, p = 64, g = Float64Array, w) {
if (isNaN(c) || c < 0)
throw new Error(`Unpexpected numItems value: ${c}.`);
this.numItems = +c, this.nodeSize = Math.min(Math.max(+p, 2), 65535), this.ArrayType = g, this.IndexArrayType = c < 65536 ? Uint16Array : Uint32Array;
const H = JC.indexOf(this.ArrayType), A = 2 * c * this.ArrayType.BYTES_PER_ELEMENT, C = c * this.IndexArrayType.BYTES_PER_ELEMENT, N = (8 - C % 8) % 8;
if (H < 0)
throw new Error(`Unexpected typed array class: ${g}.`);
w && w instanceof ArrayBuffer ? (this.data = w, this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + C + N, 2 * c), this._pos = 2 * c, this._finished = !0) : (this.data = new ArrayBuffer(8 + A + C + N), this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + C + N, 2 * c), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, 16 + H]), new Uint16Array(this.data, 2, 1)[0] = p, new Uint32Array(this.data, 4, 1)[0] = c);
}
add(c, p) {
const g = this._pos >> 1;
return this.ids[g] = g, this.coords[this._pos++] = c, this.coords[this._pos++] = p, g;
}
finish() {
const c = this._pos >> 1;
if (c !== this.numItems)
throw new Error(`Added ${c} items when expected ${this.numItems}.`);
return eb(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
}
range(c, p, g, w) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: H, coords: A, nodeSize: C } = this, N = [0, H.length - 1, 0], z = [];
for (; N.length; ) {
const W = N.pop() || 0, X = N.pop() || 0, tt = N.pop() || 0;
if (X - tt <= C) {
for (let Lt = tt; Lt <= X; Lt++) {
const Et = A[2 * Lt], $t = A[2 * Lt + 1];
Et >= c && Et <= g && $t >= p && $t <= w && z.push(H[Lt]);
}
continue;
}
const at = tt + X >> 1, ut = A[2 * at], Tt = A[2 * at + 1];
ut >= c && ut <= g && Tt >= p && Tt <= w && z.push(H[at]), (W === 0 ? c <= ut : p <= Tt) && (N.push(tt), N.push(at - 1), N.push(1 - W)), (W === 0 ? g >= ut : w >= Tt) && (N.push(at + 1), N.push(X), N.push(1 - W));
}
return z;
}
within(c, p, g) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: w, coords: H, nodeSize: A } = this, C = [0, w.length - 1, 0], N = [], z = g * g;
for (; C.length; ) {
const W = C.pop() || 0, X = C.pop() || 0, tt = C.pop() || 0;
if (X - tt <= A) {
for (let Lt = tt; Lt <= X; Lt++)
ek(H[2 * Lt], H[2 * Lt + 1], c, p) <= z && N.push(w[Lt]);
continue;
}
const at = tt + X >> 1, ut = H[2 * at], Tt = H[2 * at + 1];
ek(ut, Tt, c, p) <= z && N.push(w[at]), (W === 0 ? c - g <= ut : p - g <= Tt) && (C.push(tt), C.push(at - 1), C.push(1 - W)), (W === 0 ? c + g >= ut : p + g >= Tt) && (C.push(at + 1), C.push(X), C.push(1 - W));
}
return N;
}
}
function eb(h, c, p, g, w, H) {
if (w - g <= p)
return;
const A = g + w >> 1;
tk(h, c, A, g, w, H), eb(h, c, p, g, A - 1, 1 - H), eb(h, c, p, A + 1, w, 1 - H);
}
function tk(h, c, p, g, w, H) {
for (; w > g; ) {
if (w - g > 600) {
const z = w - g + 1, W = p - g + 1, X = Math.log(z), tt = 0.5 * Math.exp(2 * X / 3), at = 0.5 * Math.sqrt(X * tt * (z - tt) / z) * (W - z / 2 < 0 ? -1 : 1);
tk(h, c, p, Math.max(g, Math.floor(p - W * tt / z + at)), Math.min(w, Math.floor(p + (z - W) * tt / z + at)), H);
}
const A = c[2 * p + H];
let C = g, N = w;
for (nu(h, c, g, p), c[2 * w + H] > A && nu(h, c, g, w); C < N; ) {
for (nu(h, c, C, N), C++, N--; c[2 * C + H] < A; )
C++;
for (; c[2 * N + H] > A; )
N--;
}
c[2 * g + H] === A ? nu(h, c, g, N) : (N++, nu(h, c, N, w)), N <= p && (g = N + 1), p <= N && (w = N - 1);
}
}
function nu(h, c, p, g) {
rb(h, p, g), rb(c, 2 * p, 2 * g), rb(c, 2 * p + 1, 2 * g + 1);
}
function rb(h, c, p) {
const g = h[c];
h[c] = h[p], h[p] = g;
}
function ek(h, c, p, g) {
const w = h - p, H = c - g;
return w * w + H * H;
}
var nb;
s.bg = void 0, (nb = s.bg || (s.bg = {})).create = "create", nb.load = "load", nb.fullLoad = "fullLoad";
let jp = null, iu = [];
const ib = 1e3 / 60, ob = "loadTime", sb = "fullLoadTime", Ytt = { mark(h) {
performance.mark(h);
}, frame(h) {
const c = h;
jp != null && iu.push(c - jp), jp = c;
}, clearMetrics() {
jp = null, iu = [], performance.clearMeasures(ob), performance.clearMeasures(sb);
for (const h in s.bg)
performance.clearMarks(s.bg[h]);
}, getPerformanceMetrics() {
performance.measure(ob, s.bg.create, s.bg.load), performance.measure(sb, s.bg.create, s.bg.fullLoad);
const h = performance.getEntriesByName(ob)[0].duration, c = performance.getEntriesByName(sb)[0].duration, p = iu.length, g = 1 / (iu.reduce((H, A) => H + A, 0) / p / 1e3), w = iu.filter((H) => H > ib).reduce((H, A) => H + (A - ib) / ib, 0);
return { loadTime: h, fullLoadTime: c, fps: g, percentDroppedFrames: w / (p + w) * 100, totalFrames: p };
} };
s.$ = class extends Y {
}, s.A = Fl, s.B = T_, s.C = function(h) {
if (re == null) {
const c = h.navigator ? h.navigator.userAgent : null;
re = !!h.safari || !(!c || !(/\b(iPad|iPhone|iPod)\b/.test(c) || c.match("Safari") && !c.match("Chrome")));
}
return re;
}, s.D = cr, s.E = ar, s.F = class {
constructor(h, c) {
this.target = h, this.mapId = c, this.resolveRejects = {}, this.tasks = {}, this.taskQueue = [], this.abortControllers = {}, this.messageHandlers = {}, this.invoker = new ztt(() => this.process()), this.subscription = function(p, g, w, H) {
return p.addEventListener(g, w, !1), { unsubscribe: () => {
p.removeEventListener(g, w, !1);
} };
}(this.target, "message", (p) => this.receive(p)), this.globalScope = oe(self) ? h : window;
}
registerMessageHandler(h, c) {
this.messageHandlers[h] = c;
}
sendAsync(h, c) {
return new Promise((p, g) => {
const w = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
this.resolveRejects[w] = { resolve: p, reject: g }, c && c.signal.addEventListener("abort", () => {
delete this.resolveRejects[w];
const C = { id: w, type: "", origin: location.origin, targetMapId: h.targetMapId, sourceMapId: this.mapId };
this.target.postMessage(C);
}, { once: !0 });
const H = [], A = Object.assign(Object.assign({}, h), { id: w, sourceMapId: this.mapId, origin: location.origin, data: e6(h.data, H) });
this.target.postMessage(A, { transfer: H });
});
}
receive(h) {
const c = h.data, p = c.id;
if (!(c.origin !== "file://" && location.origin !== "file://" && c.origin !== "resource://android" && location.origin !== "resource://android" && c.origin !== location.origin || c.targetMapId && this.mapId !== c.targetMapId)) {
if (c.type === "") {
delete this.tasks[p];
const g = this.abortControllers[p];
return delete this.abortControllers[p], void (g && g.abort());
}
if (oe(self) || c.mustQueue)
return this.tasks[p] = c, this.taskQueue.push(p), void this.invoker.trigger();
this.processTask(p, c);
}
}
process() {
if (this.taskQueue.length === 0)
return;
const h = this.taskQueue.shift(), c = this.tasks[h];
delete this.tasks[h], this.taskQueue.length > 0 && this.invoker.trigger(), c && this.processTask(h, c);
}
processTask(h, c) {
return a(this, void 0, void 0, function* () {
if (c.type === "") {
const w = this.resolveRejects[h];
return delete this.resolveRejects[h], w ? void (c.error ? w.reject(r6(c.error)) : w.resolve(r6(c.data))) : void 0;
}
if (!this.messageHandlers[c.type])
return void this.completeTask(h, new Error(`Could not find a registered handler for ${c.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));
const p = r6(c.data), g = new AbortController();
this.abortControllers[h] = g;
try {
const w = yield this.messageHandlers[c.type](c.sourceMapId, p, g);
this.completeTask(h, null, w);
} catch (w) {
this.completeTask(h, w);
}
});
}
completeTask(h, c, p) {
const g = [];
delete this.abortControllers[h];
const w = { id: h, type: "", sourceMapId: this.mapId, origin: location.origin, error: c ? e6(c) : null, data: e6(p, g) };
this.target.postMessage(w, { transfer: g });
}
remove() {
this.invoker.remove(), this.subscription.unsubscribe();
}
}, s.G = Ne, s.H = function() {
var h = new Fl(16);
return Fl != Float32Array && (h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0), h[0] = 1, h[5] = 1, h[10] = 1, h[15] = 1, h;
}, s.I = B_, s.J = function(h, c, p) {
var g, w, H, A, C, N, z, W, X, tt, at, ut, Tt = p[0], Lt = p[1], Et = p[2];
return c === h ? (h[12] = c[0] * Tt + c[4] * Lt + c[8] * Et + c[12], h[13] = c[1] * Tt + c[5] * Lt + c[9] * Et + c[13], h[14] = c[2] * Tt + c[6] * Lt + c[10] * Et + c[14], h[15] = c[3] * Tt + c[7] * Lt + c[11] * Et + c[15]) : (w = c[1], H = c[2], A = c[3], C = c[4], N = c[5], z = c[6], W = c[7], X = c[8], tt = c[9], at = c[10], ut = c[11], h[0] = g = c[0], h[1] = w, h[2] = H, h[3] = A, h[4] = C, h[5] = N, h[6] = z, h[7] = W, h[8] = X, h[9] = tt, h[10] = at, h[11] = ut, h[12] = g * Tt + C * Lt + X * Et + c[12], h[13] = w * Tt + N * Lt + tt * Et + c[13], h[14] = H * Tt + z * Lt + at * Et + c[14], h[15] = A * Tt + W * Lt + ut * Et + c[15]), h;
}, s.K = function(h, c, p) {
var g = p[0], w = p[1], H = p[2];
return h[0] = c[0] * g, h[1] = c[1] * g, h[2] = c[2] * g, h[3] = c[3] * g, h[4] = c[4] * w, h[5] = c[5] * w, h[6] = c[6] * w, h[7] = c[7] * w, h[8] = c[8] * H, h[9] = c[9] * H, h[10] = c[10] * H, h[11] = c[11] * H, h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15], h;
}, s.L = PO, s.M = function(h, c) {
const p = {};
for (let g = 0; g < c.length; g++) {
const w = c[g];
w in h && (p[w] = h[w]);
}
return p;
}, s.N = T6, s.O = AC, s.P = f, s.Q = OC, s.R = k2, s.S = I2, s.T = Al, s.U = x, s.V = O, s.W = qr, s.X = Zi, s.Y = V, s.Z = eu, s._ = a, s.a = er, s.a$ = function(h, c) {
var p = h[0], g = h[1], w = h[2], H = h[3], A = h[4], C = h[5], N = h[6], z = h[7], W = h[8], X = h[9], tt = h[10], at = h[11], ut = h[12], Tt = h[13], Lt = h[14], Et = h[15], $t = c[0], Pt = c[1], Bt = c[2], ee = c[3], _e = c[4], Xe = c[5], Er = c[6], ze = c[7], Re = c[8], Qr = c[9], sr = c[10], rr = c[11], ue = c[12], gr = c[13], pr = c[14], Ir = c[15];
return Math.abs(p - $t) <= go * Math.max(1, Math.abs(p), Math.abs($t)) && Math.abs(g - Pt) <= go * Math.max(1, Math.abs(g), Math.abs(Pt)) && Math.abs(w - Bt) <= go * Math.max(1, Math.abs(w), Math.abs(Bt)) && Math.abs(H - ee) <= go * Math.max(1, Math.abs(H), Math.abs(ee)) && Math.abs(A - _e) <= go * Math.max(1, Math.abs(A), Math.abs(_e)) && Math.abs(C - Xe) <= go * Math.max(1, Math.abs(C), Math.abs(Xe)) && Math.abs(N - Er) <= go * Math.max(1, Math.abs(N), Math.abs(Er)) && Math.abs(z - ze) <= go * Math.max(1, Math.abs(z), Math.abs(ze)) && Math.abs(W - Re) <= go * Math.max(1, Math.abs(W), Math.abs(Re)) && Math.abs(X - Qr) <= go * Math.max(1, Math.abs(X), Math.abs(Qr)) && Math.abs(tt - sr) <= go * Math.max(1, Math.abs(tt), Math.abs(sr)) && Math.abs(at - rr) <= go * Math.max(1, Math.abs(at), Math.abs(rr)) && Math.abs(ut - ue) <= go * Math.max(1, Math.abs(ut), Math.abs(ue)) && Math.abs(Tt - gr) <= go * Math.max(1, Math.abs(Tt), Math.abs(gr)) && Math.abs(Lt - pr) <= go * Math.max(1, Math.abs(Lt), Math.abs(pr)) && Math.abs(Et - Ir) <= go * Math.max(1, Math.abs(Et), Math.abs(Ir));
}, s.a0 = an, s.a1 = K_, s.a2 = ye, s.a3 = (h) => {
const c = window.document.createElement("video");
return c.muted = !0, new Promise((p) => {
c.onloadstart = () => {
p(c);
};
for (const g of h) {
const w = window.document.createElement("source");
de(g) || (c.crossOrigin = "Anonymous"), w.src = g, c.appendChild(w);
}
});
}, s.a4 = function() {
return et++;
}, s.a5 = We, s.a6 = Gl, s.a7 = K4, s.a8 = F0, s.a9 = RC, s.aA = function(h) {
if (h.type === "custom")
return new jtt(h);
switch (h.type) {
case "background":
return new Dtt(h);
case "circle":
return new xJ(h);
case "fill":
return new jJ(h);
case "fill-extrusion":
return new ntt(h);
case "heatmap":
return new MJ(h);
case "hillshade":
return new HJ(h);
case "line":
return new htt(h);
case "raster":
return new Btt(h);
case "symbol":
return new Rp(h);
}
}, s.aB = rt, s.aC = function(h, c) {
if (!h)
return [{ command: "setStyle", args: [c] }];
let p = [];
try {
if (!Hr(h.version, c.version))
return [{ command: "setStyle", args: [c] }];
Hr(h.center, c.center) || p.push({ command: "setCenter", args: [c.center] }), Hr(h.zoom, c.zoom) || p.push({ command: "setZoom", args: [c.zoom] }), Hr(h.bearing, c.bearing) || p.push({ command: "setBearing", args: [c.bearing] }), Hr(h.pitch, c.pitch) || p.push({ command: "setPitch", args: [c.pitch] }), Hr(h.sprite, c.sprite) || p.push({ command: "setSprite", args: [c.sprite] }), Hr(h.glyphs, c.glyphs) || p.push({ command: "setGlyphs", args: [c.glyphs] }), Hr(h.transition, c.transition) || p.push({ command: "setTransition", args: [c.transition] }), Hr(h.light, c.light) || p.push({ command: "setLight", args: [c.light] }), Hr(h.terrain, c.terrain) || p.push({ command: "setTerrain", args: [c.terrain] }), Hr(h.sky, c.sky) || p.push({ command: "setSky", args: [c.sky] }), Hr(h.projection, c.projection) || p.push({ command: "setProjection", args: [c.projection] });
const g = {}, w = [];
(function(A, C, N, z) {
let W;
for (W in C = C || {}, A = A || {})
Object.prototype.hasOwnProperty.call(A, W) && (Object.prototype.hasOwnProperty.call(C, W) || ji(W, N, z));
for (W in C)
Object.prototype.hasOwnProperty.call(C, W) && (Object.prototype.hasOwnProperty.call(A, W) ? Hr(A[W], C[W]) || (A[W].type === "geojson" && C[W].type === "geojson" && ki(A, C, W) ? Rr(N, { command: "setGeoJSONSourceData", args: [W, C[W].data] }) : Ji(W, C, N, z)) : dn(W, C, N));
})(h.sources, c.sources, w, g);
const H = [];
h.layers && h.layers.forEach((A) => {
"source" in A && g[A.source] ? p.push({ command: "removeLayer", args: [A.id] }) : H.push(A);
}), p = p.concat(w), function(A, C, N) {
C = C || [];
const z = (A = A || []).map(Ii), W = C.map(Ii), X = A.reduce(c1, {}), tt = C.reduce(c1, {}), at = z.slice(), ut = /* @__PURE__ */ Object.create(null);
let Tt, Lt, Et, $t, Pt;
for (let Bt = 0, ee = 0; Bt < z.length; Bt++)
Tt = z[Bt], Object.prototype.hasOwnProperty.call(tt, Tt) ? ee++ : (Rr(N, { command: "removeLayer", args: [Tt] }), at.splice(at.indexOf(Tt, ee), 1));
for (let Bt = 0, ee = 0; Bt < W.length; Bt++)
Tt = W[W.length - 1 - Bt], at[at.length - 1 - Bt] !== Tt && (Object.prototype.hasOwnProperty.call(X, Tt) ? (Rr(N, { command: "removeLayer", args: [Tt] }), at.splice(at.lastIndexOf(Tt, at.length - ee), 1)) : ee++, $t = at[at.length - Bt], Rr(N, { command: "addLayer", args: [tt[Tt], $t] }), at.splice(at.length - Bt, 0, Tt), ut[Tt] = !0);
for (let Bt = 0; Bt < W.length; Bt++)
if (Tt = W[Bt], Lt = X[Tt], Et = tt[Tt], !ut[Tt] && !Hr(Lt, Et))
if (Hr(Lt.source, Et.source) && Hr(Lt["source-layer"], Et["source-layer"]) && Hr(Lt.type, Et.type)) {
for (Pt in _i(Lt.layout, Et.layout, N, Tt, null, "setLayoutProperty"), _i(Lt.paint, Et.paint, N, Tt, null, "setPaintProperty"), Hr(Lt.filter, Et.filter) || Rr(N, { command: "setFilter", args: [Tt, Et.filter] }), Hr(Lt.minzoom, Et.minzoom) && Hr(Lt.maxzoom, Et.maxzoom) || Rr(N, { command: "setLayerZoomRange", args: [Tt, Et.minzoom, Et.maxzoom] }), Lt)
Object.prototype.hasOwnProperty.call(Lt, Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? _i(Lt[Pt], Et[Pt], N, Tt, Pt.slice(6), "setPaintProperty") : Hr(Lt[Pt], Et[Pt]) || Rr(N, { command: "setLayerProperty", args: [Tt, Pt, Et[Pt]] }));
for (Pt in Et)
Object.prototype.hasOwnProperty.call(Et, Pt) && !Object.prototype.hasOwnProperty.call(Lt, Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? _i(Lt[Pt], Et[Pt], N, Tt, Pt.slice(6), "setPaintProperty") : Hr(Lt[Pt], Et[Pt]) || Rr(N, { command: "setLayerProperty", args: [Tt, Pt, Et[Pt]] }));
} else
Rr(N, { command: "removeLayer", args: [Tt] }), $t = at[at.lastIndexOf(Tt) + 1], Rr(N, { command: "addLayer", args: [Et, $t] });
}(H, c.layers, p);
} catch (g) {
console.warn("Unable to compute style diff:", g), p = [{ command: "setStyle", args: [c] }];
}
return p;
}, s.aD = function(h) {
const c = [], p = h.id;
return p === void 0 && c.push({ message: `layers.${p}: missing required property "id"` }), h.render === void 0 && c.push({ message: `layers.${p}: missing required method "render"` }), h.renderingMode && h.renderingMode !== "2d" && h.renderingMode !== "3d" && c.push({ message: `layers.${p}: property "renderingMode" must be either "2d" or "3d"` }), c;
}, s.aE = function h(c, p) {
if (Array.isArray(c)) {
if (!Array.isArray(p) || c.length !== p.length)
return !1;
for (let g = 0; g < c.length; g++)
if (!h(c[g], p[g]))
return !1;
return !0;
}
if (typeof c == "object" && c !== null && p !== null) {
if (typeof p != "object" || Object.keys(c).length !== Object.keys(p).length)
return !1;
for (const g in c)
if (!h(c[g], p[g]))
return !1;
return !0;
}
return c === p;
}, s.aF = nt, s.aG = ct, s.aH = class extends R0 {
constructor(h, c) {
super(h, c), this.current = 0;
}
set(h) {
this.current !== h && (this.current = h, this.gl.uniform1i(this.location, h));
}
}, s.aI = wp, s.aJ = class extends R0 {
constructor(h, c) {
super(h, c), this.current = mJ;
}
set(h) {
if (h[12] !== this.current[12] || h[0] !== this.current[0])
return this.current = h, void this.gl.uniformMatrix4fv(this.location, !1, h);
for (let c = 1; c < 16; c++)
if (h[c] !== this.current[c]) {
this.current = h, this.gl.uniformMatrix4fv(this.location, !1, h);
break;
}
}
}, s.aK = wO, s.aL = xO, s.aM = tn, s.aN = class extends R0 {
constructor(h, c) {
super(h, c), this.current = [0, 0, 0];
}
set(h) {
h[0] === this.current[0] && h[1] === this.current[1] && h[2] === this.current[2] || (this.current = h, this.gl.uniform3f(this.location, h[0], h[1], h[2]));
}
}, s.aO = class extends R0 {
constructor(h, c) {
super(h, c), this.current = [0, 0];
}
set(h) {
h[0] === this.current[0] && h[1] === this.current[1] || (this.current = h, this.gl.uniform2f(this.location, h[0], h[1]));
}
}, s.aP = function(h, c, p, g, w, H, A) {
var C = 1 / (c - p), N = 1 / (g - w), z = 1 / (H - A);
return h[0] = -2 * C, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = -2 * N, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = 2 * z, h[11] = 0, h[12] = (c + p) * C, h[13] = (w + g) * N, h[14] = (A + H) * z, h[15] = 1, h;
}, s.aQ = wJ, s.aR = class extends Nt {
}, s.aS = ftt, s.aT = class extends Wt {
}, s.aU = H_, s.aV = function(h) {
return h <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(h) / Math.LN2));
}, s.aW = FO, s.aX = k1, s.aY = C2, s.aZ = class extends ur {
}, s.a_ = function(h, c) {
return h[0] === c[0] && h[1] === c[1] && h[2] === c[2] && h[3] === c[3] && h[4] === c[4] && h[5] === c[5] && h[6] === c[6] && h[7] === c[7] && h[8] === c[8] && h[9] === c[9] && h[10] === c[10] && h[11] === c[11] && h[12] === c[12] && h[13] === c[13] && h[14] === c[14] && h[15] === c[15];
}, s.aa = function(h) {
const c = {};
if (h.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, (p, g, w, H) => {
const A = w || H;
return c[g] = !A || A.toLowerCase(), "";
}), c["max-age"]) {
const p = parseInt(c["max-age"], 10);
isNaN(p) ? delete c["max-age"] : c["max-age"] = p;
}
return c;
}, s.ab = function(h, c) {
const p = [];
for (const g in h)
g in c || p.push(g);
return p;
}, s.ac = F, s.ad = function(h, c, p) {
var g = Math.sin(p), w = Math.cos(p), H = c[0], A = c[1], C = c[2], N = c[3], z = c[4], W = c[5], X = c[6], tt = c[7];
return c !== h && (h[8] = c[8], h[9] = c[9], h[10] = c[10], h[11] = c[11], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15]), h[0] = H * w + z * g, h[1] = A * w + W * g, h[2] = C * w + X * g, h[3] = N * w + tt * g, h[4] = z * w - H * g, h[5] = W * w - A * g, h[6] = X * w - C * g, h[7] = tt * w - N * g, h;
}, s.ae = function(h) {
var c = new Fl(16);
return c[0] = h[0], c[1] = h[1], c[2] = h[2], c[3] = h[3], c[4] = h[4], c[5] = h[5], c[6] = h[6], c[7] = h[7], c[8] = h[8], c[9] = h[9], c[10] = h[10], c[11] = h[11], c[12] = h[12], c[13] = h[13], c[14] = h[14], c[15] = h[15], c;
}, s.af = Sp, s.ag = function(h, c) {
let p = 0, g = 0;
if (h.kind === "constant")
g = h.layoutSize;
else if (h.kind !== "source") {
const { interpolationType: w, minZoom: H, maxZoom: A } = h, C = w ? F(un.interpolationFactor(w, c, H, A), 0, 1) : 0;
h.kind === "camera" ? g = xr.number(h.minSize, h.maxSize, C) : p = C;
}
return { uSizeT: p, uSize: g };
}, s.ai = function(h, { uSize: c, uSizeT: p }, { lowerSize: g, upperSize: w }) {
return h.kind === "source" ? g / Sa : h.kind === "composite" ? xr.number(g / Sa, w / Sa, p) : c;
}, s.aj = G_, s.ak = function(h, c, p, g) {
const w = c.y - h.y, H = c.x - h.x, A = g.y - p.y, C = g.x - p.x, N = A * H - C * w;
if (N === 0)
return null;
const z = (C * (h.y - p.y) - A * (h.x - p.x)) / N;
return new f(h.x + z * H, h.y + z * w);
}, s.al = BC, s.am = HO, s.an = E_, s.ao = function(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h)
c = Math.min(c, H.x), p = Math.min(p, H.y), g = Math.max(g, H.x), w = Math.max(w, H.y);
return [c, p, g, w];
}, s.ap = r1, s.ar = U_, s.as = function(h, c) {
var p = c[0], g = c[1], w = c[2], H = c[3], A = c[4], C = c[5], N = c[6], z = c[7], W = c[8], X = c[9], tt = c[10], at = c[11], ut = c[12], Tt = c[13], Lt = c[14], Et = c[15], $t = p * C - g * A, Pt = p * N - w * A, Bt = p * z - H * A, ee = g * N - w * C, _e = g * z - H * C, Xe = w * z - H * N, Er = W * Tt - X * ut, ze = W * Lt - tt * ut, Re = W * Et - at * ut, Qr = X * Lt - tt * Tt, sr = X * Et - at * Tt, rr = tt * Et - at * Lt, ue = $t * rr - Pt * sr + Bt * Qr + ee * Re - _e * ze + Xe * Er;
return ue ? (h[0] = (C * rr - N * sr + z * Qr) * (ue = 1 / ue), h[1] = (w * sr - g * rr - H * Qr) * ue, h[2] = (Tt * Xe - Lt * _e + Et * ee) * ue, h[3] = (tt * _e - X * Xe - at * ee) * ue, h[4] = (N * Re - A * rr - z * ze) * ue, h[5] = (p * rr - w * Re + H * ze) * ue, h[6] = (Lt * Bt - ut * Xe - Et * Pt) * ue, h[7] = (W * Xe - tt * Bt + at * Pt) * ue, h[8] = (A * sr - C * Re + z * Er) * ue, h[9] = (g * Re - p * sr - H * Er) * ue, h[10] = (ut * _e - Tt * Bt + Et * $t) * ue, h[11] = (X * Bt - W * _e - at * $t) * ue, h[12] = (C * ze - A * Qr - N * Er) * ue, h[13] = (p * Qr - g * ze + w * Er) * ue, h[14] = (Tt * Pt - ut * ee - Lt * $t) * ue, h[15] = (W * ee - X * Pt + tt * $t) * ue, h) : null;
}, s.at = J_, s.au = z_, s.av = tb, s.aw = function() {
const h = {}, c = Ct.$version;
for (const p in Ct.$root) {
const g = Ct.$root[p];
if (g.required) {
let w = null;
w = p === "version" ? c : g.type === "array" ? [] : {}, w != null && (h[p] = w);
}
}
return h;
}, s.ax = Pc, s.ay = te, s.az = function(h) {
h = h.slice();
const c = /* @__PURE__ */ Object.create(null);
for (let p = 0; p < h.length; p++)
c[h[p].id] = h[p];
for (let p = 0; p < h.length; p++)
"ref" in h[p] && (h[p] = Jr(h[p], c[h[p].ref]));
return h;
}, s.b = Ve, s.b0 = function(h, c) {
return h[0] = c[0], h[1] = c[1], h[2] = c[2], h[3] = c[3], h[4] = c[4], h[5] = c[5], h[6] = c[6], h[7] = c[7], h[8] = c[8], h[9] = c[9], h[10] = c[10], h[11] = c[11], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15], h;
}, s.b1 = function(h, c, p) {
return h[0] = c[0] * p[0], h[1] = c[1] * p[1], h[2] = c[2] * p[2], h[3] = c[3] * p[3], h;
}, s.b2 = function(h, c) {
return h[0] * c[0] + h[1] * c[1] + h[2] * c[2] + h[3] * c[3];
}, s.b3 = U, s.b4 = IC, s.b5 = CC, s.b6 = function(h, c, p, g, w) {
var H, A = 1 / Math.tan(c / 2);
return h[0] = A / p, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = A, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[11] = -1, h[12] = 0, h[13] = 0, h[15] = 0, w != null && w !== 1 / 0 ? (h[10] = (w + g) * (H = 1 / (g - w)), h[14] = 2 * w * g * H) : (h[10] = -1, h[14] = -2 * g), h;
}, s.b7 = function(h, c, p) {
var g = Math.sin(p), w = Math.cos(p), H = c[4], A = c[5], C = c[6], N = c[7], z = c[8], W = c[9], X = c[10], tt = c[11];
return c !== h && (h[0] = c[0], h[1] = c[1], h[2] = c[2], h[3] = c[3], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15]), h[4] = H * w + z * g, h[5] = A * w + W * g, h[6] = C * w + X * g, h[7] = N * w + tt * g, h[8] = z * w - H * g, h[9] = W * w - A * g, h[10] = X * w - C * g, h[11] = tt * w - N * g, h;
}, s.b8 = k, s.b9 = R, s.bA = sC, s.bB = function(h) {
return h.message === Ke;
}, s.bC = _1, s.bD = Vo, s.ba = function(h) {
return h * Math.PI / 180;
}, s.bb = function(h, c) {
const { x: p, y: g } = eu.fromLngLat(c);
return !(h < 0 || h > 25 || g < 0 || g >= 1 || p < 0 || p >= 1);
}, s.bc = function(h, c) {
return h[0] = c[0], h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = c[1], h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = c[2], h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0, h[15] = 1, h;
}, s.bd = class extends Z {
}, s.be = q_, s.bf = Ytt, s.bh = Gt, s.bi = function(h, c) {
er.REGISTERED_PROTOCOLS[h] = c;
}, s.bj = function(h) {
delete er.REGISTERED_PROTOCOLS[h];
}, s.bk = function(h, c) {
const p = {};
for (let w = 0; w < h.length; w++) {
const H = c && c[h[w].id] || e2(h[w]);
c && (c[h[w].id] = H);
let A = p[H];
A || (A = p[H] = []), A.push(h[w]);
}
const g = [];
for (const w in p)
g.push(p[w]);
return g;
}, s.bl = nr, s.bm = VC, s.bn = NC, s.bo = fC, s.bp = function(h) {
h.bucket.createArrays(), h.bucket.tilePixelRatio = Zi / (512 * h.bucket.overscaling), h.bucket.compareText = {}, h.bucket.iconsNeedLinear = !1;
const c = h.bucket.layers[0], p = c.layout, g = c._unevaluatedLayout._values, w = { layoutIconSize: g["icon-size"].possiblyEvaluate(new ti(h.bucket.zoom + 1), h.canonical), layoutTextSize: g["text-size"].possiblyEvaluate(new ti(h.bucket.zoom + 1), h.canonical), textMaxSize: g["text-size"].possiblyEvaluate(new ti(18)) };
if (h.bucket.textSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h.bucket.textSizeData;
w.compositeTextSizes = [g["text-size"].possiblyEvaluate(new ti(z), h.canonical), g["text-size"].possiblyEvaluate(new ti(W), h.canonical)];
}
if (h.bucket.iconSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h.bucket.iconSizeData;
w.compositeIconSizes = [g["icon-size"].possiblyEvaluate(new ti(z), h.canonical), g["icon-size"].possiblyEvaluate(new ti(W), h.canonical)];
}
const H = p.get("text-line-height") * r1, A = p.get("text-rotation-alignment") !== "viewport" && p.get("symbol-placement") !== "point", C = p.get("text-keep-upright"), N = p.get("text-size");
for (const z of h.bucket.features) {
const W = p.get("text-font").evaluate(z, {}, h.canonical).join(","), X = N.evaluate(z, {}, h.canonical), tt = w.layoutTextSize.evaluate(z, {}, h.canonical), at = w.layoutIconSize.evaluate(z, {}, h.canonical), ut = { horizontal: {}, vertical: void 0 }, Tt = z.text;
let Lt, Et = [0, 0];
if (Tt) {
const Bt = Tt.toString(), ee = p.get("text-letter-spacing").evaluate(z, {}, h.canonical) * r1, _e = f_(Bt) ? ee : 0, Xe = p.get("text-anchor").evaluate(z, {}, h.canonical), Er = XC(c, z, h.canonical);
if (!Er) {
const sr = p.get("text-radial-offset").evaluate(z, {}, h.canonical);
Et = sr ? qC(Xe, [sr * r1, Y_]) : p.get("text-offset").evaluate(z, {}, h.canonical).map((rr) => rr * r1);
}
let ze = A ? "center" : p.get("text-justify").evaluate(z, {}, h.canonical);
const Re = p.get("symbol-placement") === "point" ? p.get("text-max-width").evaluate(z, {}, h.canonical) * r1 : 1 / 0, Qr = () => {
h.bucket.allowVerticalPlacement && Vc(Bt) && (ut.vertical = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, "left", _e, Et, s.ah.vertical, !0, tt, X));
};
if (!A && Er) {
const sr = /* @__PURE__ */ new Set();
if (ze === "auto")
for (let ue = 0; ue < Er.values.length; ue += 2)
sr.add(J_(Er.values[ue]));
else
sr.add(ze);
let rr = !1;
for (const ue of sr)
if (!ut.horizontal[ue])
if (rr)
ut.horizontal[ue] = ut.horizontal[0];
else {
const gr = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, "center", ue, _e, Et, s.ah.horizontal, !1, tt, X);
gr && (ut.horizontal[ue] = gr, rr = gr.positionedLines.length === 1);
}
Qr();
} else {
ze === "auto" && (ze = J_(Xe));
const sr = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.horizontal, !1, tt, X);
sr && (ut.horizontal[ze] = sr), Qr(), Vc(Bt) && A && C && (ut.vertical = Ip(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.vertical, !1, tt, X));
}
}
let $t = !1;
if (z.icon && z.icon.name) {
const Bt = h.imageMap[z.icon.name];
Bt && (Lt = Itt(h.imagePositions[z.icon.name], p.get("icon-offset").evaluate(z, {}, h.canonical), p.get("icon-anchor").evaluate(z, {}, h.canonical)), $t = !!Bt.sdf, h.bucket.sdfIcons === void 0 ? h.bucket.sdfIcons = $t : h.bucket.sdfIcons !== $t && It("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (Bt.pixelRatio !== h.bucket.pixelRatio || p.get("icon-rotate").constantOr(1) !== 0) && (h.bucket.iconsNeedLinear = !0));
}
const Pt = YC(ut.horizontal) || ut.vertical;
h.bucket.iconsInText = !!Pt && Pt.iconsInText, (Pt || Lt) && Xtt(h.bucket, z, ut, Lt, h.imageMap, w, tt, at, Et, $t, h.canonical);
}
h.showCollisionBoxes && h.bucket.generateCollisionDebugBuffers();
}, s.bq = R_, s.br = I_, s.bs = V_, s.bt = h6, s.bu = D_, s.bv = class {
constructor(h) {
this._marks = { start: [h.url, "start"].join("#"), end: [h.url, "end"].join("#"), measure: h.url.toString() }, performance.mark(this._marks.start);
}
finish() {
performance.mark(this._marks.end);
let h = performance.getEntriesByName(this._marks.measure);
return h.length === 0 && (performance.measure(this._marks.measure, this._marks.start, this._marks.end), h = performance.getEntriesByName(this._marks.measure), performance.clearMarks(this._marks.start), performance.clearMarks(this._marks.end), performance.clearMeasures(this._marks.measure)), h;
}
}, s.bw = function(h, c, p, g, w) {
return a(this, void 0, void 0, function* () {
if (O())
try {
return yield qr(h, c, p, g, w);
} catch {
}
return function(H, A, C, N, z) {
const W = H.width, X = H.height;
ie && Qe || (ie = new OffscreenCanvas(W, X), Qe = ie.getContext("2d", { willReadFrequently: !0 })), ie.width = W, ie.height = X, Qe.drawImage(H, 0, 0, W, X);
const tt = Qe.getImageData(A, C, N, z);
return Qe.clearRect(0, 0, W, X), tt.data;
}(h, c, p, g, w);
});
}, s.bx = PC, s.by = u, s.bz = d, s.c = He, s.d = (h) => a(void 0, void 0, void 0, function* () {
if (h.byteLength === 0)
return createImageBitmap(new ImageData(1, 1));
const c = new Blob([new Uint8Array(h)], { type: "image/png" });
try {
return createImageBitmap(c);
} catch (p) {
throw new Error(`Could not load image because of ${p.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`);
}
}), s.e = $, s.f = (h) => new Promise((c, p) => {
const g = new Image();
g.onload = () => {
c(g), URL.revokeObjectURL(g.src), g.onload = null, window.requestAnimationFrame(() => {
g.src = yr;
});
}, g.onerror = () => p(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 w = new Blob([new Uint8Array(h)], { type: "image/png" });
g.src = h.byteLength ? URL.createObjectURL(w) : yr;
}), s.g = Je, s.h = (h, c) => me($(h, { type: "json" }), c), s.i = oe, s.j = $e, s.k = qe, s.l = (h, c) => me($(h, { type: "arrayBuffer" }), c), s.m = me, s.n = function(h) {
return new D_(h).readFields(Mtt, []);
}, s.o = Gc, s.p = TC, s.q = S, s.r = p_, s.s = de, s.t = kc, s.u = F3, s.v = Ct, s.w = It, s.x = function([h, c, p]) {
return c += 90, c *= Math.PI / 180, p *= Math.PI / 180, { x: h * Math.cos(c) * Math.sin(p), y: h * Math.sin(c) * Math.sin(p), z: h * Math.cos(p) };
}, s.y = xr, s.z = ti;
}), i("worker", ["./shared"], function(s) {
class a {
constructor(ot) {
this.keyCache = {}, ot && this.replace(ot);
}
replace(ot) {
this._layerConfigs = {}, this._layers = {}, this.update(ot, []);
}
update(ot, st) {
for (const yt of ot) {
this._layerConfigs[yt.id] = yt;
const At = this._layers[yt.id] = s.aA(yt);
At._featureFilter = s.a7(At.filter), this.keyCache[yt.id] && delete this.keyCache[yt.id];
}
for (const yt of st)
delete this.keyCache[yt], delete this._layerConfigs[yt], delete this._layers[yt];
this.familiesBySource = {};
const pt = s.bk(Object.values(this._layerConfigs), this.keyCache);
for (const yt of pt) {
const At = yt.map((Xt) => this._layers[Xt.id]), Vt = At[0];
if (Vt.visibility === "none")
continue;
const jt = Vt.source || "";
let St = this.familiesBySource[jt];
St || (St = this.familiesBySource[jt] = {});
const Yt = Vt.sourceLayer || "_geojsonTileLayer";
let ae = St[Yt];
ae || (ae = St[Yt] = []), ae.push(At);
}
}
}
class u {
constructor(ot) {
const st = {}, pt = [];
for (const jt in ot) {
const St = ot[jt], Yt = st[jt] = {};
for (const ae in St) {
const Xt = St[+ae];
if (!Xt || Xt.bitmap.width === 0 || Xt.bitmap.height === 0)
continue;
const Le = { x: 0, y: 0, w: Xt.bitmap.width + 2, h: Xt.bitmap.height + 2 };
pt.push(Le), Yt[ae] = { rect: Le, metrics: Xt.metrics };
}
}
const { w: yt, h: At } = s.p(pt), Vt = new s.o({ width: yt || 1, height: At || 1 });
for (const jt in ot) {
const St = ot[jt];
for (const Yt in St) {
const ae = St[+Yt];
if (!ae || ae.bitmap.width === 0 || ae.bitmap.height === 0)
continue;
const Xt = st[jt][Yt].rect;
s.o.copy(ae.bitmap, Vt, { x: 0, y: 0 }, { x: Xt.x + 1, y: Xt.y + 1 }, ae.bitmap);
}
}
this.image = Vt, this.positions = st;
}
}
s.bl("GlyphAtlas", u);
class d {
constructor(ot) {
this.tileID = new s.S(ot.tileID.overscaledZ, ot.tileID.wrap, ot.tileID.canonical.z, ot.tileID.canonical.x, ot.tileID.canonical.y), this.uid = ot.uid, this.zoom = ot.zoom, this.pixelRatio = ot.pixelRatio, this.tileSize = ot.tileSize, this.source = ot.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = ot.showCollisionBoxes, this.collectResourceTiming = !!ot.collectResourceTiming, this.returnDependencies = !!ot.returnDependencies, this.promoteId = ot.promoteId, this.inFlightDependencies = [];
}
parse(ot, st, pt, yt) {
return s._(this, void 0, void 0, function* () {
this.status = "parsing", this.data = ot, this.collisionBoxArray = new s.a5();
const At = new s.bm(Object.keys(ot.layers).sort()), Vt = new s.bn(this.tileID, this.promoteId);
Vt.bucketLayerIDs = [];
const jt = {}, St = { featureIndex: Vt, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: pt }, Yt = st.familiesBySource[this.source];
for (const br in Yt) {
const Br = ot.layers[br];
if (!Br)
continue;
Br.version === 1 && s.w(`Vector tile source "${this.source}" layer "${br}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
const cn = At.encode(br), Kn = [];
for (let Li = 0; Li < Br.length; Li++) {
const Ri = Br.feature(Li), es = Vt.getId(Ri, br);
Kn.push({ feature: Ri, id: es, index: Li, sourceLayerIndex: cn });
}
for (const Li of Yt[br]) {
const Ri = Li[0];
Ri.source !== this.source && s.w(`layer.source = ${Ri.source} does not equal this.source = ${this.source}`), Ri.minzoom && this.zoom < Math.floor(Ri.minzoom) || Ri.maxzoom && this.zoom >= Ri.maxzoom || Ri.visibility !== "none" && (T(Li, this.zoom, pt), (jt[Ri.id] = Ri.createBucket({ index: Vt.bucketLayerIDs.length, layers: Li, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: cn, sourceID: this.source })).populate(Kn, St, this.tileID.canonical), Vt.bucketLayerIDs.push(Li.map((es) => es.id)));
}
}
const ae = s.aF(St.glyphDependencies, (br) => Object.keys(br).map(Number));
this.inFlightDependencies.forEach((br) => br == null ? void 0 : br.abort()), this.inFlightDependencies = [];
let Xt = Promise.resolve({});
if (Object.keys(ae).length) {
const br = new AbortController();
this.inFlightDependencies.push(br), Xt = yt.sendAsync({ type: "GG", data: { stacks: ae, source: this.source, tileID: this.tileID, type: "glyphs" } }, br);
}
const Le = Object.keys(St.iconDependencies);
let or = Promise.resolve({});
if (Le.length) {
const br = new AbortController();
this.inFlightDependencies.push(br), or = yt.sendAsync({ type: "GI", data: { icons: Le, source: this.source, tileID: this.tileID, type: "icons" } }, br);
}
const Rt = Object.keys(St.patternDependencies);
let Te = Promise.resolve({});
if (Rt.length) {
const br = new AbortController();
this.inFlightDependencies.push(br), Te = yt.sendAsync({ type: "GI", data: { icons: Rt, source: this.source, tileID: this.tileID, type: "patterns" } }, br);
}
const [Se, lr, Ar] = yield Promise.all([Xt, or, Te]), vn = new u(Se), zr = new s.bo(lr, Ar);
for (const br in jt) {
const Br = jt[br];
Br instanceof s.a6 ? (T(Br.layers, this.zoom, pt), s.bp({ bucket: Br, glyphMap: Se, glyphPositions: vn.positions, imageMap: lr, imagePositions: zr.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical })) : Br.hasPattern && (Br instanceof s.bq || Br instanceof s.br || Br instanceof s.bs) && (T(Br.layers, this.zoom, pt), Br.addFeatures(St, this.tileID.canonical, zr.patternPositions));
}
return this.status = "done", { buckets: Object.values(jt).filter((br) => !br.isEmpty()), featureIndex: Vt, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: vn.image, imageAtlas: zr, glyphMap: this.returnDependencies ? Se : null, iconMap: this.returnDependencies ? lr : null, glyphPositions: this.returnDependencies ? vn.positions : null };
});
}
}
function T(xt, ot, st) {
const pt = new s.z(ot);
for (const yt of xt)
yt.recalculate(pt, st);
}
class f {
constructor(ot, st, pt) {
this.actor = ot, this.layerIndex = st, this.availableImages = pt, this.fetching = {}, this.loading = {}, this.loaded = {};
}
loadVectorTile(ot, st) {
return s._(this, void 0, void 0, function* () {
const pt = yield s.l(ot.request, st);
try {
return { vectorTile: new s.bt.VectorTile(new s.bu(pt.data)), rawData: pt.data, cacheControl: pt.cacheControl, expires: pt.expires };
} catch (yt) {
const At = new Uint8Array(pt.data);
let Vt = `Unable to parse the tile at ${ot.request.url}, `;
throw Vt += At[0] === 31 && At[1] === 139 ? "please make sure the data is not gzipped and that you have configured the relevant header in the server" : `got error: ${yt.message}`, new Error(Vt);
}
});
}
loadTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = ot.uid, pt = !!(ot && ot.request && ot.request.collectResourceTiming) && new s.bv(ot.request), yt = new d(ot);
this.loading[st] = yt;
const At = new AbortController();
yt.abort = At;
try {
const Vt = yield this.loadVectorTile(ot, At);
if (delete this.loading[st], !Vt)
return null;
const jt = Vt.rawData, St = {};
Vt.expires && (St.expires = Vt.expires), Vt.cacheControl && (St.cacheControl = Vt.cacheControl);
const Yt = {};
if (pt) {
const Xt = pt.finish();
Xt && (Yt.resourceTiming = JSON.parse(JSON.stringify(Xt)));
}
yt.vectorTile = Vt.vectorTile;
const ae = yt.parse(Vt.vectorTile, this.layerIndex, this.availableImages, this.actor);
this.loaded[st] = yt, this.fetching[st] = { rawTileData: jt, cacheControl: St, resourceTiming: Yt };
try {
const Xt = yield ae;
return s.e({ rawTileData: jt.slice(0) }, Xt, St, Yt);
} finally {
delete this.fetching[st];
}
} catch (Vt) {
throw delete this.loading[st], yt.status = "done", this.loaded[st] = yt, Vt;
}
});
}
reloadTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = ot.uid;
if (!this.loaded || !this.loaded[st])
throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");
const pt = this.loaded[st];
if (pt.showCollisionBoxes = ot.showCollisionBoxes, pt.status === "parsing") {
const yt = yield pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
let At;
if (this.fetching[st]) {
const { rawTileData: Vt, cacheControl: jt, resourceTiming: St } = this.fetching[st];
delete this.fetching[st], At = s.e({ rawTileData: Vt.slice(0) }, yt, jt, St);
} else
At = yt;
return At;
}
if (pt.status === "done" && pt.vectorTile)
return pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
});
}
abortTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = this.loading, pt = ot.uid;
st && st[pt] && st[pt].abort && (st[pt].abort.abort(), delete st[pt]);
});
}
removeTile(ot) {
return s._(this, void 0, void 0, function* () {
this.loaded && this.loaded[ot.uid] && delete this.loaded[ot.uid];
});
}
}
class Q {
constructor() {
this.loaded = {};
}
loadTile(ot) {
return s._(this, void 0, void 0, function* () {
const { uid: st, encoding: pt, rawImageData: yt, redFactor: At, greenFactor: Vt, blueFactor: jt, baseShift: St } = ot, Yt = yt.width + 2, ae = yt.height + 2, Xt = s.b(yt) ? new s.R({ width: Yt, height: ae }, yield s.bw(yt, -1, -1, Yt, ae)) : yt, Le = new s.bx(st, Xt, pt, At, Vt, jt, St);
return this.loaded = this.loaded || {}, this.loaded[st] = Le, Le;
});
}
removeTile(ot) {
const st = this.loaded, pt = ot.uid;
st && st[pt] && delete st[pt];
}
}
function y(xt, ot) {
if (xt.length !== 0) {
_(xt[0], ot);
for (var st = 1; st < xt.length; st++)
_(xt[st], !ot);
}
}
function _(xt, ot) {
for (var st = 0, pt = 0, yt = 0, At = xt.length, Vt = At - 1; yt < At; Vt = yt++) {
var jt = (xt[yt][0] - xt[Vt][0]) * (xt[Vt][1] + xt[yt][1]), St = st + jt;
pt += Math.abs(st) >= Math.abs(jt) ? st - St + jt : jt - St + st, st = St;
}
st + pt >= 0 != !!ot && xt.reverse();
}
var L = s.by(function xt(ot, st) {
var pt, yt = ot && ot.type;
if (yt === "FeatureCollection")
for (pt = 0; pt < ot.features.length; pt++)
xt(ot.features[pt], st);
else if (yt === "GeometryCollection")
for (pt = 0; pt < ot.geometries.length; pt++)
xt(ot.geometries[pt], st);
else if (yt === "Feature")
xt(ot.geometry, st);
else if (yt === "Polygon")
y(ot.coordinates, st);
else if (yt === "MultiPolygon")
for (pt = 0; pt < ot.coordinates.length; pt++)
y(ot.coordinates[pt], st);
return ot;
});
const E = s.bt.VectorTileFeature.prototype.toGeoJSON;
var x = { exports: {} }, O = s.bz, k = s.bt.VectorTileFeature, R = F;
function F(xt, ot) {
this.options = ot || {}, this.features = xt, this.length = xt.length;
}
function U(xt, ot) {
this.id = typeof xt.id == "number" ? xt.id : void 0, this.type = xt.type, this.rawGeometry = xt.type === 1 ? [xt.geometry] : xt.geometry, this.properties = xt.tags, this.extent = ot || 4096;
}
F.prototype.feature = function(xt) {
return new U(this.features[xt], this.options.extent);
}, U.prototype.loadGeometry = function() {
var xt = this.rawGeometry;
this.geometry = [];
for (var ot = 0; ot < xt.length; ot++) {
for (var st = xt[ot], pt = [], yt = 0; yt < st.length; yt++)
pt.push(new O(st[yt][0], st[yt][1]));
this.geometry.push(pt);
}
return this.geometry;
}, U.prototype.bbox = function() {
this.geometry || this.loadGeometry();
for (var xt = this.geometry, ot = 1 / 0, st = -1 / 0, pt = 1 / 0, yt = -1 / 0, At = 0; At < xt.length; At++)
for (var Vt = xt[At], jt = 0; jt < Vt.length; jt++) {
var St = Vt[jt];
ot = Math.min(ot, St.x), st = Math.max(st, St.x), pt = Math.min(pt, St.y), yt = Math.max(yt, St.y);
}
return [ot, pt, st, yt];
}, U.prototype.toGeoJSON = k.prototype.toGeoJSON;
var $ = s.bA, et = R;
function nt(xt) {
var ot = new $();
return function(st, pt) {
for (var yt in st.layers)
pt.writeMessage(3, ct, st.layers[yt]);
}(xt, ot), ot.finish();
}
function ct(xt, ot) {
var st;
ot.writeVarintField(15, xt.version || 1), ot.writeStringField(1, xt.name || ""), ot.writeVarintField(5, xt.extent || 4096);
var pt = { keys: [], values: [], keycache: {}, valuecache: {} };
for (st = 0; st < xt.length; st++)
pt.feature = xt.feature(st), ot.writeMessage(2, rt, pt);
var yt = pt.keys;
for (st = 0; st < yt.length; st++)
ot.writeStringField(3, yt[st]);
var At = pt.values;
for (st = 0; st < At.length; st++)
ot.writeMessage(4, re, At[st]);
}
function rt(xt, ot) {
var st = xt.feature;
st.id !== void 0 && ot.writeVarintField(1, st.id), ot.writeMessage(2, gt, xt), ot.writeVarintField(3, st.type), ot.writeMessage(4, oe, st);
}
function gt(xt, ot) {
var st = xt.feature, pt = xt.keys, yt = xt.values, At = xt.keycache, Vt = xt.valuecache;
for (var jt in st.properties) {
var St = st.properties[jt], Yt = At[jt];
if (St !== null) {
Yt === void 0 && (pt.push(jt), At[jt] = Yt = pt.length - 1), ot.writeVarint(Yt);
var ae = typeof St;
ae !== "string" && ae !== "boolean" && ae !== "number" && (St = JSON.stringify(St));
var Xt = ae + ":" + St, Le = Vt[Xt];
Le === void 0 && (yt.push(St), Vt[Xt] = Le = yt.length - 1), ot.writeVarint(Le);
}
}
}
function It(xt, ot) {
return (ot << 3) + (7 & xt);
}
function Zt(xt) {
return xt << 1 ^ xt >> 31;
}
function oe(xt, ot) {
for (var st = xt.loadGeometry(), pt = xt.type, yt = 0, At = 0, Vt = st.length, jt = 0; jt < Vt; jt++) {
var St = st[jt], Yt = 1;
pt === 1 && (Yt = St.length), ot.writeVarint(It(1, Yt));
for (var ae = pt === 3 ? St.length - 1 : St.length, Xt = 0; Xt < ae; Xt++) {
Xt === 1 && pt !== 1 && ot.writeVarint(It(2, ae - 1));
var Le = St[Xt].x - yt, or = St[Xt].y - At;
ot.writeVarint(Zt(Le)), ot.writeVarint(Zt(or)), yt += Le, At += or;
}
pt === 3 && ot.writeVarint(It(7, 1));
}
}
function re(xt, ot) {
var st = typeof xt;
st === "string" ? ot.writeStringField(1, xt) : st === "boolean" ? ot.writeBooleanField(7, xt) : st === "number" && (xt % 1 != 0 ? ot.writeDoubleField(3, xt) : xt < 0 ? ot.writeSVarintField(6, xt) : ot.writeVarintField(5, xt));
}
x.exports = nt, x.exports.fromVectorTileJs = nt, x.exports.fromGeojsonVt = function(xt, ot) {
ot = ot || {};
var st = {};
for (var pt in xt)
st[pt] = new et(xt[pt].features, ot), st[pt].name = pt, st[pt].version = ot.version, st[pt].extent = ot.extent;
return nt({ layers: st });
}, x.exports.GeoJSONWrapper = et;
var Ve = s.by(x.exports);
const yr = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: !1, generateId: !1, reduce: null, map: (xt) => xt }, qr = Math.fround || (ie = new Float32Array(1), (xt) => (ie[0] = +xt, ie[0]));
var ie;
const Qe = 3, Ke = 5, He = 6;
class er {
constructor(ot) {
this.options = Object.assign(Object.create(yr), ot), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
}
load(ot) {
const { log: st, minZoom: pt, maxZoom: yt } = this.options;
st && console.time("total time");
const At = `prepare ${ot.length} points`;
st && console.time(At), this.points = ot;
const Vt = [];
for (let St = 0; St < ot.length; St++) {
const Yt = ot[St];
if (!Yt.geometry)
continue;
const [ae, Xt] = Yt.geometry.coordinates, Le = qr(Gt(ae)), or = qr(te(Xt));
Vt.push(Le, or, 1 / 0, St, -1, 1), this.options.reduce && Vt.push(0);
}
let jt = this.trees[yt + 1] = this._createTree(Vt);
st && console.timeEnd(At);
for (let St = yt; St >= pt; St--) {
const Yt = +Date.now();
jt = this.trees[St] = this._createTree(this._cluster(jt, St)), st && console.log("z%d: %d clusters in %dms", St, jt.numItems, +Date.now() - Yt);
}
return st && console.timeEnd("total time"), this;
}
getClusters(ot, st) {
let pt = ((ot[0] + 180) % 360 + 360) % 360 - 180;
const yt = Math.max(-90, Math.min(90, ot[1]));
let At = ot[2] === 180 ? 180 : ((ot[2] + 180) % 360 + 360) % 360 - 180;
const Vt = Math.max(-90, Math.min(90, ot[3]));
if (ot[2] - ot[0] >= 360)
pt = -180, At = 180;
else if (pt > At) {
const Xt = this.getClusters([pt, yt, 180, Vt], st), Le = this.getClusters([-180, yt, At, Vt], st);
return Xt.concat(Le);
}
const jt = this.trees[this._limitZoom(st)], St = jt.range(Gt(pt), te(Vt), Gt(At), te(yt)), Yt = jt.data, ae = [];
for (const Xt of St) {
const Le = this.stride * Xt;
ae.push(Yt[Le + Ke] > 1 ? Je(Yt, Le, this.clusterProps) : this.points[Yt[Le + Qe]]);
}
return ae;
}
getChildren(ot) {
const st = this._getOriginId(ot), pt = this._getOriginZoom(ot), yt = "No cluster with the specified id.", At = this.trees[pt];
if (!At)
throw new Error(yt);
const Vt = At.data;
if (st * this.stride >= Vt.length)
throw new Error(yt);
const jt = this.options.radius / (this.options.extent * Math.pow(2, pt - 1)), St = At.within(Vt[st * this.stride], Vt[st * this.stride + 1], jt), Yt = [];
for (const ae of St) {
const Xt = ae * this.stride;
Vt[Xt + 4] === ot && Yt.push(Vt[Xt + Ke] > 1 ? Je(Vt, Xt, this.clusterProps) : this.points[Vt[Xt + Qe]]);
}
if (Yt.length === 0)
throw new Error(yt);
return Yt;
}
getLeaves(ot, st, pt) {
const yt = [];
return this._appendLeaves(yt, ot, st = st || 10, pt = pt || 0, 0), yt;
}
getTile(ot, st, pt) {
const yt = this.trees[this._limitZoom(ot)], At = Math.pow(2, ot), { extent: Vt, radius: jt } = this.options, St = jt / Vt, Yt = (pt - St) / At, ae = (pt + 1 + St) / At, Xt = { features: [] };
return this._addTileFeatures(yt.range((st - St) / At, Yt, (st + 1 + St) / At, ae), yt.data, st, pt, At, Xt), st === 0 && this._addTileFeatures(yt.range(1 - St / At, Yt, 1, ae), yt.data, At, pt, At, Xt), st === At - 1 && this._addTileFeatures(yt.range(0, Yt, St / At, ae), yt.data, -1, pt, At, Xt), Xt.features.length ? Xt : null;
}
getClusterExpansionZoom(ot) {
let st = this._getOriginZoom(ot) - 1;
for (; st <= this.options.maxZoom; ) {
const pt = this.getChildren(ot);
if (st++, pt.length !== 1)
break;
ot = pt[0].properties.cluster_id;
}
return st;
}
_appendLeaves(ot, st, pt, yt, At) {
const Vt = this.getChildren(st);
for (const jt of Vt) {
const St = jt.properties;
if (St && St.cluster ? At + St.point_count <= yt ? At += St.point_count : At = this._appendLeaves(ot, St.cluster_id, pt, yt, At) : At < yt ? At++ : ot.push(jt), ot.length === pt)
break;
}
return At;
}
_createTree(ot) {
const st = new s.av(ot.length / this.stride | 0, this.options.nodeSize, Float32Array);
for (let pt = 0; pt < ot.length; pt += this.stride)
st.add(ot[pt], ot[pt + 1]);
return st.finish(), st.data = ot, st;
}
_addTileFeatures(ot, st, pt, yt, At, Vt) {
for (const jt of ot) {
const St = jt * this.stride, Yt = st[St + Ke] > 1;
let ae, Xt, Le;
if (Yt)
ae = Ne(st, St, this.clusterProps), Xt = st[St], Le = st[St + 1];
else {
const Te = this.points[st[St + Qe]];
ae = Te.properties;
const [Se, lr] = Te.geometry.coordinates;
Xt = Gt(Se), Le = te(lr);
}
const or = { type: 1, geometry: [[Math.round(this.options.extent * (Xt * At - pt)), Math.round(this.options.extent * (Le * At - yt))]], tags: ae };
let Rt;
Rt = Yt || this.options.generateId ? st[St + Qe] : this.points[st[St + Qe]].id, Rt !== void 0 && (or.id = Rt), Vt.features.push(or);
}
}
_limitZoom(ot) {
return Math.max(this.options.minZoom, Math.min(Math.floor(+ot), this.options.maxZoom + 1));
}
_cluster(ot, st) {
const { radius: pt, extent: yt, reduce: At, minPoints: Vt } = this.options, jt = pt / (yt * Math.pow(2, st)), St = ot.data, Yt = [], ae = this.stride;
for (let Xt = 0; Xt < St.length; Xt += ae) {
if (St[Xt + 2] <= st)
continue;
St[Xt + 2] = st;
const Le = St[Xt], or = St[Xt + 1], Rt = ot.within(St[Xt], St[Xt + 1], jt), Te = St[Xt + Ke];
let Se = Te;
for (const lr of Rt) {
const Ar = lr * ae;
St[Ar + 2] > st && (Se += St[Ar + Ke]);
}
if (Se > Te && Se >= Vt) {
let lr, Ar = Le * Te, vn = or * Te, zr = -1;
const br = ((Xt / ae | 0) << 5) + (st + 1) + this.points.length;
for (const Br of Rt) {
const cn = Br * ae;
if (St[cn + 2] <= st)
continue;
St[cn + 2] = st;
const Kn = St[cn + Ke];
Ar += St[cn] * Kn, vn += St[cn + 1] * Kn, St[cn + 4] = br, At && (lr || (lr = this._map(St, Xt, !0), zr = this.clusterProps.length, this.clusterProps.push(lr)), At(lr, this._map(St, cn)));
}
St[Xt + 4] = br, Yt.push(Ar / Se, vn / Se, 1 / 0, br, -1, Se), At && Yt.push(zr);
} else {
for (let lr = 0; lr < ae; lr++)
Yt.push(St[Xt + lr]);
if (Se > 1)
for (const lr of Rt) {
const Ar = lr * ae;
if (!(St[Ar + 2] <= st)) {
St[Ar + 2] = st;
for (let vn = 0; vn < ae; vn++)
Yt.push(St[Ar + vn]);
}
}
}
}
return Yt;
}
_getOriginId(ot) {
return ot - this.points.length >> 5;
}
_getOriginZoom(ot) {
return (ot - this.points.length) % 32;
}
_map(ot, st, pt) {
if (ot[st + Ke] > 1) {
const Vt = this.clusterProps[ot[st + He]];
return pt ? Object.assign({}, Vt) : Vt;
}
const yt = this.points[ot[st + Qe]].properties, At = this.options.map(yt);
return pt && At === yt ? Object.assign({}, At) : At;
}
}
function Je(xt, ot, st) {
return { type: "Feature", id: xt[ot + Qe], properties: Ne(xt, ot, st), geometry: { type: "Point", coordinates: [(pt = xt[ot], 360 * (pt - 0.5)), me(xt[ot + 1])] } };
var pt;
}
function Ne(xt, ot, st) {
const pt = xt[ot + Ke], yt = pt >= 1e4 ? `${Math.round(pt / 1e3)}k` : pt >= 1e3 ? Math.round(pt / 100) / 10 + "k" : pt, At = xt[ot + He], Vt = At === -1 ? {} : Object.assign({}, st[At]);
return Object.assign(Vt, { cluster: !0, cluster_id: xt[ot + Qe], point_count: pt, point_count_abbreviated: yt });
}
function Gt(xt) {
return xt / 360 + 0.5;
}
function te(xt) {
const ot = Math.sin(xt * Math.PI / 180), st = 0.5 - 0.25 * Math.log((1 + ot) / (1 - ot)) / Math.PI;
return st < 0 ? 0 : st > 1 ? 1 : st;
}
function me(xt) {
const ot = (180 - 360 * xt) * Math.PI / 180;
return 360 * Math.atan(Math.exp(ot)) / Math.PI - 90;
}
function de(xt, ot, st, pt) {
let yt = pt;
const At = ot + (st - ot >> 1);
let Vt, jt = st - ot;
const St = xt[ot], Yt = xt[ot + 1], ae = xt[st], Xt = xt[st + 1];
for (let Le = ot + 3; Le < st; Le += 3) {
const or = Ge(xt[Le], xt[Le + 1], St, Yt, ae, Xt);
if (or > yt)
Vt = Le, yt = or;
else if (or === yt) {
const Rt = Math.abs(Le - At);
Rt < jt && (Vt = Le, jt = Rt);
}
}
yt > pt && (Vt - ot > 3 && de(xt, ot, Vt, pt), xt[Vt + 2] = yt, st - Vt > 3 && de(xt, Vt, st, pt));
}
function Ge(xt, ot, st, pt, yt, At) {
let Vt = yt - st, jt = At - pt;
if (Vt !== 0 || jt !== 0) {
const St = ((xt - st) * Vt + (ot - pt) * jt) / (Vt * Vt + jt * jt);
St > 1 ? (st = yt, pt = At) : St > 0 && (st += Vt * St, pt += jt * St);
}
return Vt = xt - st, jt = ot - pt, Vt * Vt + jt * jt;
}
function Tr(xt, ot, st, pt) {
const yt = { id: xt ?? null, type: ot, geometry: st, tags: pt, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
if (ot === "Point" || ot === "MultiPoint" || ot === "LineString")
qe(yt, st);
else if (ot === "Polygon")
qe(yt, st[0]);
else if (ot === "MultiLineString")
for (const At of st)
qe(yt, At);
else if (ot === "MultiPolygon")
for (const At of st)
qe(yt, At[0]);
return yt;
}
function qe(xt, ot) {
for (let st = 0; st < ot.length; st += 3)
xt.minX = Math.min(xt.minX, ot[st]), xt.minY = Math.min(xt.minY, ot[st + 1]), xt.maxX = Math.max(xt.maxX, ot[st]), xt.maxY = Math.max(xt.maxY, ot[st + 1]);
}
function $e(xt, ot, st, pt) {
if (!ot.geometry)
return;
const yt = ot.geometry.coordinates;
if (yt && yt.length === 0)
return;
const At = ot.geometry.type, Vt = Math.pow(st.tolerance / ((1 << st.maxZoom) * st.extent), 2);
let jt = [], St = ot.id;
if (st.promoteId ? St = ot.properties[st.promoteId] : st.generateId && (St = pt || 0), At === "Point")
ar(yt, jt);
else if (At === "MultiPoint")
for (const Yt of yt)
ar(Yt, jt);
else if (At === "LineString")
Ct(yt, jt, Vt, !1);
else if (At === "MultiLineString") {
if (st.lineMetrics) {
for (const Yt of yt)
jt = [], Ct(Yt, jt, Vt, !1), xt.push(Tr(St, "LineString", jt, ot.properties));
return;
}
en(yt, jt, Vt, !1);
} else if (At === "Polygon")
en(yt, jt, Vt, !0);
else {
if (At !== "MultiPolygon") {
if (At === "GeometryCollection") {
for (const Yt of ot.geometry.geometries)
$e(xt, { id: St, geometry: Yt, properties: ot.properties }, st, pt);
return;
}
throw new Error("Input data is not a valid GeoJSON object.");
}
for (const Yt of yt) {
const ae = [];
en(Yt, ae, Vt, !0), jt.push(ae);
}
}
xt.push(Tr(St, At, jt, ot.properties));
}
function ar(xt, ot) {
ot.push(Jr(xt[0]), Hr(xt[1]), 0);
}
function Ct(xt, ot, st, pt) {
let yt, At, Vt = 0;
for (let St = 0; St < xt.length; St++) {
const Yt = Jr(xt[St][0]), ae = Hr(xt[St][1]);
ot.push(Yt, ae, 0), St > 0 && (Vt += pt ? (yt * ae - Yt * At) / 2 : Math.sqrt(Math.pow(Yt - yt, 2) + Math.pow(ae - At, 2))), yt = Yt, At = ae;
}
const jt = ot.length - 3;
ot[2] = 1, de(ot, 0, jt, st), ot[jt + 2] = 1, ot.size = Math.abs(Vt), ot.start = 0, ot.end = ot.size;
}
function en(xt, ot, st, pt) {
for (let yt = 0; yt < xt.length; yt++) {
const At = [];
Ct(xt[yt], At, st, pt), ot.push(At);
}
}
function Jr(xt) {
return xt / 360 + 0.5;
}
function Hr(xt) {
const ot = Math.sin(xt * Math.PI / 180), st = 0.5 - 0.25 * Math.log((1 + ot) / (1 - ot)) / Math.PI;
return st < 0 ? 0 : st > 1 ? 1 : st;
}
function Rr(xt, ot, st, pt, yt, At, Vt, jt) {
if (pt /= ot, At >= (st /= ot) && Vt < pt)
return xt;
if (Vt < st || At >= pt)
return null;
const St = [];
for (const Yt of xt) {
const ae = Yt.geometry;
let Xt = Yt.type;
const Le = yt === 0 ? Yt.minX : Yt.minY, or = yt === 0 ? Yt.maxX : Yt.maxY;
if (Le >= st && or < pt) {
St.push(Yt);
continue;
}
if (or < st || Le >= pt)
continue;
let Rt = [];
if (Xt === "Point" || Xt === "MultiPoint")
dn(ae, Rt, st, pt, yt);
else if (Xt === "LineString")
ji(ae, Rt, st, pt, yt, !1, jt.lineMetrics);
else if (Xt === "MultiLineString")
ki(ae, Rt, st, pt, yt, !1);
else if (Xt === "Polygon")
ki(ae, Rt, st, pt, yt, !0);
else if (Xt === "MultiPolygon")
for (const Te of ae) {
const Se = [];
ki(Te, Se, st, pt, yt, !0), Se.length && Rt.push(Se);
}
if (Rt.length) {
if (jt.lineMetrics && Xt === "LineString") {
for (const Te of Rt)
St.push(Tr(Yt.id, Xt, Te, Yt.tags));
continue;
}
Xt !== "LineString" && Xt !== "MultiLineString" || (Rt.length === 1 ? (Xt = "LineString", Rt = Rt[0]) : Xt = "MultiLineString"), Xt !== "Point" && Xt !== "MultiPoint" || (Xt = Rt.length === 3 ? "Point" : "MultiPoint"), St.push(Tr(Yt.id, Xt, Rt, Yt.tags));
}
}
return St.length ? St : null;
}
function dn(xt, ot, st, pt, yt) {
for (let At = 0; At < xt.length; At += 3) {
const Vt = xt[At + yt];
Vt >= st && Vt <= pt && _i(ot, xt[At], xt[At + 1], xt[At + 2]);
}
}
function ji(xt, ot, st, pt, yt, At, Vt) {
let jt = Ji(xt);
const St = yt === 0 ? Ii : c1;
let Yt, ae, Xt = xt.start;
for (let Se = 0; Se < xt.length - 3; Se += 3) {
const lr = xt[Se], Ar = xt[Se + 1], vn = xt[Se + 2], zr = xt[Se + 3], br = xt[Se + 4], Br = yt === 0 ? lr : Ar, cn = yt === 0 ? zr : br;
let Kn = !1;
Vt && (Yt = Math.sqrt(Math.pow(lr - zr, 2) + Math.pow(Ar - br, 2))), Br < st ? cn > st && (ae = St(jt, lr, Ar, zr, br, st), Vt && (jt.start = Xt + Yt * ae)) : Br > pt ? cn < pt && (ae = St(jt, lr, Ar, zr, br, pt), Vt && (jt.start = Xt + Yt * ae)) : _i(jt, lr, Ar, vn), cn < st && Br >= st && (ae = St(jt, lr, Ar, zr, br, st), Kn = !0), cn > pt && Br <= pt && (ae = St(jt, lr, Ar, zr, br, pt), Kn = !0), !At && Kn && (Vt && (jt.end = Xt + Yt * ae), ot.push(jt), jt = Ji(xt)), Vt && (Xt += Yt);
}
let Le = xt.length - 3;
const or = xt[Le], Rt = xt[Le + 1], Te = yt === 0 ? or : Rt;
Te >= st && Te <= pt && _i(jt, or, Rt, xt[Le + 2]), Le = jt.length - 3, At && Le >= 3 && (jt[Le] !== jt[0] || jt[Le + 1] !== jt[1]) && _i(jt, jt[0], jt[1], jt[2]), jt.length && ot.push(jt);
}
function Ji(xt) {
const ot = [];
return ot.size = xt.size, ot.start = xt.start, ot.end = xt.end, ot;
}
function ki(xt, ot, st, pt, yt, At) {
for (const Vt of xt)
ji(Vt, ot, st, pt, yt, At, !1);
}
function _i(xt, ot, st, pt) {
xt.push(ot, st, pt);
}
function Ii(xt, ot, st, pt, yt, At) {
const Vt = (At - ot) / (pt - ot);
return _i(xt, At, st + (yt - st) * Vt, 1), Vt;
}
function c1(xt, ot, st, pt, yt, At) {
const Vt = (At - st) / (yt - st);
return _i(xt, ot + (pt - ot) * Vt, At, 1), Vt;
}
function ye(xt, ot) {
const st = [];
for (let pt = 0; pt < xt.length; pt++) {
const yt = xt[pt], At = yt.type;
let Vt;
if (At === "Point" || At === "MultiPoint" || At === "LineString")
Vt = bi(yt.geometry, ot);
else if (At === "MultiLineString" || At === "Polygon") {
Vt = [];
for (const jt of yt.geometry)
Vt.push(bi(jt, ot));
} else if (At === "MultiPolygon") {
Vt = [];
for (const jt of yt.geometry) {
const St = [];
for (const Yt of jt)
St.push(bi(Yt, ot));
Vt.push(St);
}
}
st.push(Tr(yt.id, At, Vt, yt.tags));
}
return st;
}
function bi(xt, ot) {
const st = [];
st.size = xt.size, xt.start !== void 0 && (st.start = xt.start, st.end = xt.end);
for (let pt = 0; pt < xt.length; pt += 3)
st.push(xt[pt] + ot, xt[pt + 1], xt[pt + 2]);
return st;
}
function Xn(xt, ot) {
if (xt.transformed)
return xt;
const st = 1 << xt.z, pt = xt.x, yt = xt.y;
for (const At of xt.features) {
const Vt = At.geometry, jt = At.type;
if (At.geometry = [], jt === 1)
for (let St = 0; St < Vt.length; St += 2)
At.geometry.push(Hi(Vt[St], Vt[St + 1], ot, st, pt, yt));
else
for (let St = 0; St < Vt.length; St++) {
const Yt = [];
for (let ae = 0; ae < Vt[St].length; ae += 2)
Yt.push(Hi(Vt[St][ae], Vt[St][ae + 1], ot, st, pt, yt));
At.geometry.push(Yt);
}
}
return xt.transformed = !0, xt;
}
function Hi(xt, ot, st, pt, yt, At) {
return [Math.round(st * (xt * pt - yt)), Math.round(st * (ot * pt - At))];
}
function t1(xt, ot, st, pt, yt) {
const At = ot === yt.maxZoom ? 0 : yt.tolerance / ((1 << ot) * yt.extent), Vt = { features: [], numPoints: 0, numSimplified: 0, numFeatures: xt.length, source: null, x: st, y: pt, z: ot, transformed: !1, minX: 2, minY: 1, maxX: -1, maxY: 0 };
for (const jt of xt)
xe(Vt, jt, At, yt);
return Vt;
}
function xe(xt, ot, st, pt) {
const yt = ot.geometry, At = ot.type, Vt = [];
if (xt.minX = Math.min(xt.minX, ot.minX), xt.minY = Math.min(xt.minY, ot.minY), xt.maxX = Math.max(xt.maxX, ot.maxX), xt.maxY = Math.max(xt.maxY, ot.maxY), At === "Point" || At === "MultiPoint")
for (let jt = 0; jt < yt.length; jt += 3)
Vt.push(yt[jt], yt[jt + 1]), xt.numPoints++, xt.numSimplified++;
else if (At === "LineString")
Dr(Vt, yt, xt, st, !1, !1);
else if (At === "MultiLineString" || At === "Polygon")
for (let jt = 0; jt < yt.length; jt++)
Dr(Vt, yt[jt], xt, st, At === "Polygon", jt === 0);
else if (At === "MultiPolygon")
for (let jt = 0; jt < yt.length; jt++) {
const St = yt[jt];
for (let Yt = 0; Yt < St.length; Yt++)
Dr(Vt, St[Yt], xt, st, !0, Yt === 0);
}
if (Vt.length) {
let jt = ot.tags || null;
if (At === "LineString" && pt.lineMetrics) {
jt = {};
for (const Yt in ot.tags)
jt[Yt] = ot.tags[Yt];
jt.mapbox_clip_start = yt.start / yt.size, jt.mapbox_clip_end = yt.end / yt.size;
}
const St = { geometry: Vt, type: At === "Polygon" || At === "MultiPolygon" ? 3 : At === "LineString" || At === "MultiLineString" ? 2 : 1, tags: jt };
ot.id !== null && (St.id = ot.id), xt.features.push(St);
}
}
function Dr(xt, ot, st, pt, yt, At) {
const Vt = pt * pt;
if (pt > 0 && ot.size < (yt ? Vt : pt))
return void (st.numPoints += ot.length / 3);
const jt = [];
for (let St = 0; St < ot.length; St += 3)
(pt === 0 || ot[St + 2] > Vt) && (st.numSimplified++, jt.push(ot[St], ot[St + 1])), st.numPoints++;
yt && function(St, Yt) {
let ae = 0;
for (let Xt = 0, Le = St.length, or = Le - 2; Xt < Le; or = Xt, Xt += 2)
ae += (St[Xt] - St[or]) * (St[Xt + 1] + St[or + 1]);
if (ae > 0 === Yt)
for (let Xt = 0, Le = St.length; Xt < Le / 2; Xt += 2) {
const or = St[Xt], Rt = St[Xt + 1];
St[Xt] = St[Le - 2 - Xt], St[Xt + 1] = St[Le - 1 - Xt], St[Le - 2 - Xt] = or, St[Le - 1 - Xt] = Rt;
}
}(jt, At), xt.push(jt);
}
const _r = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: !1, promoteId: null, generateId: !1, debug: 0 };
class Vn {
constructor(ot, st) {
const pt = (st = this.options = function(At, Vt) {
for (const jt in Vt)
At[jt] = Vt[jt];
return At;
}(Object.create(_r), st)).debug;
if (pt && console.time("preprocess data"), st.maxZoom < 0 || st.maxZoom > 24)
throw new Error("maxZoom should be in the 0-24 range");
if (st.promoteId && st.generateId)
throw new Error("promoteId and generateId cannot be used together.");
let yt = function(At, Vt) {
const jt = [];
if (At.type === "FeatureCollection")
for (let St = 0; St < At.features.length; St++)
$e(jt, At.features[St], Vt, St);
else
$e(jt, At.type === "Feature" ? At : { geometry: At }, Vt);
return jt;
}(ot, st);
this.tiles = {}, this.tileCoords = [], pt && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", st.indexMaxZoom, st.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), yt = function(At, Vt) {
const jt = Vt.buffer / Vt.extent;
let St = At;
const Yt = Rr(At, 1, -1 - jt, jt, 0, -1, 2, Vt), ae = Rr(At, 1, 1 - jt, 2 + jt, 0, -1, 2, Vt);
return (Yt || ae) && (St = Rr(At, 1, -jt, 1 + jt, 0, -1, 2, Vt) || [], Yt && (St = ye(Yt, 1).concat(St)), ae && (St = St.concat(ye(ae, -1)))), St;
}(yt, st), yt.length && this.splitTile(yt, 0, 0, 0), pt && (yt.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)));
}
splitTile(ot, st, pt, yt, At, Vt, jt) {
const St = [ot, st, pt, yt], Yt = this.options, ae = Yt.debug;
for (; St.length; ) {
yt = St.pop(), pt = St.pop(), st = St.pop(), ot = St.pop();
const Xt = 1 << st, Le = y1(st, pt, yt);
let or = this.tiles[Le];
if (!or && (ae > 1 && console.time("creation"), or = this.tiles[Le] = t1(ot, st, pt, yt, Yt), this.tileCoords.push({ z: st, x: pt, y: yt }), ae)) {
ae > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", st, pt, yt, or.numFeatures, or.numPoints, or.numSimplified), console.timeEnd("creation"));
const Kn = `z${st}`;
this.stats[Kn] = (this.stats[Kn] || 0) + 1, this.total++;
}
if (or.source = ot, At == null) {
if (st === Yt.indexMaxZoom || or.numPoints <= Yt.indexMaxPoints)
continue;
} else {
if (st === Yt.maxZoom || st === At)
continue;
if (At != null) {
const Kn = At - st;
if (pt !== Vt >> Kn || yt !== jt >> Kn)
continue;
}
}
if (or.source = null, ot.length === 0)
continue;
ae > 1 && console.time("clipping");
const Rt = 0.5 * Yt.buffer / Yt.extent, Te = 0.5 - Rt, Se = 0.5 + Rt, lr = 1 + Rt;
let Ar = null, vn = null, zr = null, br = null, Br = Rr(ot, Xt, pt - Rt, pt + Se, 0, or.minX, or.maxX, Yt), cn = Rr(ot, Xt, pt + Te, pt + lr, 0, or.minX, or.maxX, Yt);
ot = null, Br && (Ar = Rr(Br, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Yt), vn = Rr(Br, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Yt), Br = null), cn && (zr = Rr(cn, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Yt), br = Rr(cn, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Yt), cn = null), ae > 1 && console.timeEnd("clipping"), St.push(Ar || [], st + 1, 2 * pt, 2 * yt), St.push(vn || [], st + 1, 2 * pt, 2 * yt + 1), St.push(zr || [], st + 1, 2 * pt + 1, 2 * yt), St.push(br || [], st + 1, 2 * pt + 1, 2 * yt + 1);
}
}
getTile(ot, st, pt) {
ot = +ot, st = +st, pt = +pt;
const yt = this.options, { extent: At, debug: Vt } = yt;
if (ot < 0 || ot > 24)
return null;
const jt = 1 << ot, St = y1(ot, st = st + jt & jt - 1, pt);
if (this.tiles[St])
return Xn(this.tiles[St], At);
Vt > 1 && console.log("drilling down to z%d-%d-%d", ot, st, pt);
let Yt, ae = ot, Xt = st, Le = pt;
for (; !Yt && ae > 0; )
ae--, Xt >>= 1, Le >>= 1, Yt = this.tiles[y1(ae, Xt, Le)];
return Yt && Yt.source ? (Vt > 1 && (console.log("found parent tile z%d-%d-%d", ae, Xt, Le), console.time("drilling down")), this.splitTile(Yt.source, ae, Xt, Le, ot, st, pt), Vt > 1 && console.timeEnd("drilling down"), this.tiles[St] ? Xn(this.tiles[St], At) : null) : null;
}
}
function y1(xt, ot, st) {
return 32 * ((1 << xt) * st + ot) + xt;
}
function wr(xt, ot) {
return ot ? xt.properties[ot] : xt.id;
}
function Pi(xt, ot) {
if (xt == null)
return !0;
if (xt.type === "Feature")
return wr(xt, ot) != null;
if (xt.type === "FeatureCollection") {
const st = /* @__PURE__ */ new Set();
for (const pt of xt.features) {
const yt = wr(pt, ot);
if (yt == null || st.has(yt))
return !1;
st.add(yt);
}
return !0;
}
return !1;
}
function H1(xt, ot) {
const st = /* @__PURE__ */ new Map();
if (xt != null)
if (xt.type === "Feature")
st.set(wr(xt, ot), xt);
else
for (const pt of xt.features)
st.set(wr(pt, ot), pt);
return st;
}
class Vi extends f {
constructor() {
super(...arguments), this._dataUpdateable = /* @__PURE__ */ new Map();
}
loadVectorTile(ot, st) {
return s._(this, void 0, void 0, function* () {
const pt = ot.tileID.canonical;
if (!this._geoJSONIndex)
throw new Error("Unable to parse the data into a cluster or geojson");
const yt = this._geoJSONIndex.getTile(pt.z, pt.x, pt.y);
if (!yt)
return null;
const At = new class {
constructor(jt) {
this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = s.X, this.length = jt.length, this._features = jt;
}
feature(jt) {
return new class {
constructor(St) {
this._feature = St, this.extent = s.X, this.type = St.type, this.properties = St.tags, "id" in St && !isNaN(St.id) && (this.id = parseInt(St.id, 10));
}
loadGeometry() {
if (this._feature.type === 1) {
const St = [];
for (const Yt of this._feature.geometry)
St.push([new s.P(Yt[0], Yt[1])]);
return St;
}
{
const St = [];
for (const Yt of this._feature.geometry) {
const ae = [];
for (const Xt of Yt)
ae.push(new s.P(Xt[0], Xt[1]));
St.push(ae);
}
return St;
}
}
toGeoJSON(St, Yt, ae) {
return E.call(this, St, Yt, ae);
}
}(this._features[jt]);
}
}(yt.features);
let Vt = Ve(At);
return Vt.byteOffset === 0 && Vt.byteLength === Vt.buffer.byteLength || (Vt = new Uint8Array(Vt)), { vectorTile: At, rawData: Vt.buffer };
});
}
loadData(ot) {
return s._(this, void 0, void 0, function* () {
var st;
(st = this._pendingRequest) === null || st === void 0 || st.abort();
const pt = !!(ot && ot.request && ot.request.collectResourceTiming) && new s.bv(ot.request);
this._pendingRequest = new AbortController();
try {
this._pendingData = this.loadAndProcessGeoJSON(ot, this._pendingRequest), this._geoJSONIndex = ot.cluster ? new er(function({ superclusterOptions: Vt, clusterProperties: jt }) {
if (!jt || !Vt)
return Vt;
const St = {}, Yt = {}, ae = { accumulated: null, zoom: 0 }, Xt = { properties: null }, Le = Object.keys(jt);
for (const or of Le) {
const [Rt, Te] = jt[or], Se = s.bC(Te), lr = s.bC(typeof Rt == "string" ? [Rt, ["accumulated"], ["get", or]] : Rt);
St[or] = Se.value, Yt[or] = lr.value;
}
return Vt.map = (or) => {
Xt.properties = or;
const Rt = {};
for (const Te of Le)
Rt[Te] = St[Te].evaluate(ae, Xt);
return Rt;
}, Vt.reduce = (or, Rt) => {
Xt.properties = Rt;
for (const Te of Le)
ae.accumulated = or[Te], or[Te] = Yt[Te].evaluate(ae, Xt);
}, Vt;
}(ot)).load((yield this._pendingData).features) : (yt = yield this._pendingData, new Vn(yt, ot.geojsonVtOptions)), this.loaded = {};
const At = {};
if (pt) {
const Vt = pt.finish();
Vt && (At.resourceTiming = {}, At.resourceTiming[ot.source] = JSON.parse(JSON.stringify(Vt)));
}
return At;
} catch (At) {
if (delete this._pendingRequest, s.bB(At))
return { abandoned: !0 };
throw At;
}
var yt;
});
}
getData() {
return s._(this, void 0, void 0, function* () {
return this._pendingData;
});
}
reloadTile(ot) {
const st = this.loaded;
return st && st[ot.uid] ? super.reloadTile(ot) : this.loadTile(ot);
}
loadAndProcessGeoJSON(ot, st) {
return s._(this, void 0, void 0, function* () {
let pt = yield this.loadGeoJSON(ot, st);
if (delete this._pendingRequest, typeof pt != "object")
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
if (L(pt, !0), ot.filter) {
const yt = s.bC(ot.filter, { type: "boolean", "property-type": "data-driven", overridable: !1, transition: !1 });
if (yt.result === "error")
throw new Error(yt.value.map((At) => `${At.key}: ${At.message}`).join(", "));
pt = { type: "FeatureCollection", features: pt.features.filter((At) => yt.value.evaluate({ zoom: 0 }, At)) };
}
return pt;
});
}
loadGeoJSON(ot, st) {
return s._(this, void 0, void 0, function* () {
const { promoteId: pt } = ot;
if (ot.request) {
const yt = yield s.h(ot.request, st);
return this._dataUpdateable = Pi(yt.data, pt) ? H1(yt.data, pt) : void 0, yt.data;
}
if (typeof ot.data == "string")
try {
const yt = JSON.parse(ot.data);
return this._dataUpdateable = Pi(yt, pt) ? H1(yt, pt) : void 0, yt;
} catch {
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
}
if (!ot.dataDiff)
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
if (!this._dataUpdateable)
throw new Error(`Cannot update existing geojson data in ${ot.source}`);
return function(yt, At, Vt) {
var jt, St, Yt, ae;
if (At.removeAll && yt.clear(), At.remove)
for (const Xt of At.remove)
yt.delete(Xt);
if (At.add)
for (const Xt of At.add) {
const Le = wr(Xt, Vt);
Le != null && yt.set(Le, Xt);
}
if (At.update)
for (const Xt of At.update) {
let Le = yt.get(Xt.id);
if (Le == null)
continue;
const or = !Xt.removeAllProperties && (((jt = Xt.removeProperties) === null || jt === void 0 ? void 0 : jt.length) > 0 || ((St = Xt.addOrUpdateProperties) === null || St === void 0 ? void 0 : St.length) > 0);
if ((Xt.newGeometry || Xt.removeAllProperties || or) && (Le = Object.assign({}, Le), yt.set(Xt.id, Le), or && (Le.properties = Object.assign({}, Le.properties))), Xt.newGeometry && (Le.geometry = Xt.newGeometry), Xt.removeAllProperties)
Le.properties = {};
else if (((Yt = Xt.removeProperties) === null || Yt === void 0 ? void 0 : Yt.length) > 0)
for (const Rt of Xt.removeProperties)
Object.prototype.hasOwnProperty.call(Le.properties, Rt) && delete Le.properties[Rt];
if (((ae = Xt.addOrUpdateProperties) === null || ae === void 0 ? void 0 : ae.length) > 0)
for (const { key: Rt, value: Te } of Xt.addOrUpdateProperties)
Le.properties[Rt] = Te;
}
}(this._dataUpdateable, ot.dataDiff, pt), { type: "FeatureCollection", features: Array.from(this._dataUpdateable.values()) };
});
}
removeSource(ot) {
return s._(this, void 0, void 0, function* () {
this._pendingRequest && this._pendingRequest.abort();
});
}
getClusterExpansionZoom(ot) {
return this._geoJSONIndex.getClusterExpansionZoom(ot.clusterId);
}
getClusterChildren(ot) {
return this._geoJSONIndex.getChildren(ot.clusterId);
}
getClusterLeaves(ot) {
return this._geoJSONIndex.getLeaves(ot.clusterId, ot.limit, ot.offset);
}
}
class Rn {
constructor(ot) {
this.self = ot, this.actor = new s.F(ot), this.layerIndexes = {}, this.availableImages = {}, this.workerSources = {}, this.demWorkerSources = {}, this.externalWorkerSourceTypes = {}, this.self.registerWorkerSource = (st, pt) => {
if (this.externalWorkerSourceTypes[st])
throw new Error(`Worker source with name "${st}" already registered.`);
this.externalWorkerSourceTypes[st] = pt;
}, this.self.addProtocol = s.bi, this.self.removeProtocol = s.bj, this.self.registerRTLTextPlugin = (st) => {
if (s.bD.isParsed())
throw new Error("RTL text plugin already registered.");
s.bD.setMethods(st);
}, this.actor.registerMessageHandler("LDT", (st, pt) => this._getDEMWorkerSource(st, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RDT", (st, pt) => s._(this, void 0, void 0, function* () {
this._getDEMWorkerSource(st, pt.source).removeTile(pt);
})), this.actor.registerMessageHandler("GCEZ", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterExpansionZoom(pt);
})), this.actor.registerMessageHandler("GCC", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterChildren(pt);
})), this.actor.registerMessageHandler("GCL", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterLeaves(pt);
})), this.actor.registerMessageHandler("LD", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).loadData(pt)), this.actor.registerMessageHandler("GD", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).getData()), this.actor.registerMessageHandler("LT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).reloadTile(pt)), this.actor.registerMessageHandler("AT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).abortTile(pt)), this.actor.registerMessageHandler("RMT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).removeTile(pt)), this.actor.registerMessageHandler("RS", (st, pt) => s._(this, void 0, void 0, function* () {
if (!this.workerSources[st] || !this.workerSources[st][pt.type] || !this.workerSources[st][pt.type][pt.source])
return;
const yt = this.workerSources[st][pt.type][pt.source];
delete this.workerSources[st][pt.type][pt.source], yt.removeSource !== void 0 && yt.removeSource(pt);
})), this.actor.registerMessageHandler("RM", (st) => s._(this, void 0, void 0, function* () {
delete this.layerIndexes[st], delete this.availableImages[st], delete this.workerSources[st], delete this.demWorkerSources[st];
})), this.actor.registerMessageHandler("SR", (st, pt) => s._(this, void 0, void 0, function* () {
this.referrer = pt;
})), this.actor.registerMessageHandler("SRPS", (st, pt) => this._syncRTLPluginState(st, pt)), this.actor.registerMessageHandler("IS", (st, pt) => s._(this, void 0, void 0, function* () {
this.self.importScripts(pt);
})), this.actor.registerMessageHandler("SI", (st, pt) => this._setImages(st, pt)), this.actor.registerMessageHandler("UL", (st, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(st).update(pt.layers, pt.removedIds);
})), this.actor.registerMessageHandler("SL", (st, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(st).replace(pt);
}));
}
_setImages(ot, st) {
return s._(this, void 0, void 0, function* () {
this.availableImages[ot] = st;
for (const pt in this.workerSources[ot]) {
const yt = this.workerSources[ot][pt];
for (const At in yt)
yt[At].availableImages = st;
}
});
}
_syncRTLPluginState(ot, st) {
return s._(this, void 0, void 0, function* () {
if (s.bD.isParsed())
return s.bD.getState();
if (st.pluginStatus !== "loading")
return s.bD.setState(st), st;
const pt = st.pluginURL;
if (this.self.importScripts(pt), s.bD.isParsed()) {
const yt = { pluginStatus: "loaded", pluginURL: pt };
return s.bD.setState(yt), yt;
}
throw s.bD.setState({ pluginStatus: "error", pluginURL: "" }), new Error(`RTL Text Plugin failed to import scripts from ${pt}`);
});
}
_getAvailableImages(ot) {
let st = this.availableImages[ot];
return st || (st = []), st;
}
_getLayerIndex(ot) {
let st = this.layerIndexes[ot];
return st || (st = this.layerIndexes[ot] = new a()), st;
}
_getWorkerSource(ot, st, pt) {
if (this.workerSources[ot] || (this.workerSources[ot] = {}), this.workerSources[ot][st] || (this.workerSources[ot][st] = {}), !this.workerSources[ot][st][pt]) {
const yt = { sendAsync: (At, Vt) => (At.targetMapId = ot, this.actor.sendAsync(At, Vt)) };
switch (st) {
case "vector":
this.workerSources[ot][st][pt] = new f(yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
break;
case "geojson":
this.workerSources[ot][st][pt] = new Vi(yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
break;
default:
this.workerSources[ot][st][pt] = new this.externalWorkerSourceTypes[st](yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
}
}
return this.workerSources[ot][st][pt];
}
_getDEMWorkerSource(ot, st) {
return this.demWorkerSources[ot] || (this.demWorkerSources[ot] = {}), this.demWorkerSources[ot][st] || (this.demWorkerSources[ot][st] = new Q()), this.demWorkerSources[ot][st];
}
}
return s.i(self) && (self.worker = new Rn(self)), Rn;
}), i("index", ["exports", "./shared"], function(s, a) {
var u = "4.7.0";
let d, T;
const f = { now: typeof performance < "u" && performance && performance.now ? performance.now.bind(performance) : Date.now.bind(Date), frameAsync: (S) => new Promise((l, m) => {
const v = requestAnimationFrame(l);
S.signal.addEventListener("abort", () => {
cancelAnimationFrame(v), m(a.c());
});
}), getImageData(S, l = 0) {
return this.getImageCanvasContext(S).getImageData(-l, -l, S.width + 2 * l, S.height + 2 * l);
}, getImageCanvasContext(S) {
const l = window.document.createElement("canvas"), m = l.getContext("2d", { willReadFrequently: !0 });
if (!m)
throw new Error("failed to create canvas 2d context");
return l.width = S.width, l.height = S.height, m.drawImage(S, 0, 0, S.width, S.height), m;
}, resolveURL: (S) => (d || (d = document.createElement("a")), d.href = S, d.href), hardwareConcurrency: typeof navigator < "u" && navigator.hardwareConcurrency || 4, get prefersReducedMotion() {
return !!matchMedia && (T == null && (T = matchMedia("(prefers-reduced-motion: reduce)")), T.matches);
} };
class Q {
static testProp(l) {
if (!Q.docStyle)
return l[0];
for (let m = 0; m < l.length; m++)
if (l[m] in Q.docStyle)
return l[m];
return l[0];
}
static create(l, m, v) {
const b = window.document.createElement(l);
return m !== void 0 && (b.className = m), v && v.appendChild(b), b;
}
static createNS(l, m) {
return window.document.createElementNS(l, m);
}
static disableDrag() {
Q.docStyle && Q.selectProp && (Q.userSelect = Q.docStyle[Q.selectProp], Q.docStyle[Q.selectProp] = "none");
}
static enableDrag() {
Q.docStyle && Q.selectProp && (Q.docStyle[Q.selectProp] = Q.userSelect);
}
static setTransform(l, m) {
l.style[Q.transformProp] = m;
}
static addEventListener(l, m, v, b = {}) {
l.addEventListener(m, v, "passive" in b ? b : b.capture);
}
static removeEventListener(l, m, v, b = {}) {
l.removeEventListener(m, v, "passive" in b ? b : b.capture);
}
static suppressClickInternal(l) {
l.preventDefault(), l.stopPropagation(), window.removeEventListener("click", Q.suppressClickInternal, !0);
}
static suppressClick() {
window.addEventListener("click", Q.suppressClickInternal, !0), window.setTimeout(() => {
window.removeEventListener("click", Q.suppressClickInternal, !0);
}, 0);
}
static getScale(l) {
const m = l.getBoundingClientRect();
return { x: m.width / l.offsetWidth || 1, y: m.height / l.offsetHeight || 1, boundingClientRect: m };
}
static getPoint(l, m, v) {
const b = m.boundingClientRect;
return new a.P((v.clientX - b.left) / m.x - l.clientLeft, (v.clientY - b.top) / m.y - l.clientTop);
}
static mousePos(l, m) {
const v = Q.getScale(l);
return Q.getPoint(l, v, m);
}
static touchPos(l, m) {
const v = [], b = Q.getScale(l);
for (let M = 0; M < m.length; M++)
v.push(Q.getPoint(l, b, m[M]));
return v;
}
static mouseButton(l) {
return l.button;
}
static remove(l) {
l.parentNode && l.parentNode.removeChild(l);
}
}
Q.docStyle = typeof window < "u" && window.document && window.document.documentElement.style, Q.selectProp = Q.testProp(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]), Q.transformProp = Q.testProp(["transform", "WebkitTransform"]);
const y = { supported: !1, testSupport: function(S) {
!E && L && (x ? O(S) : _ = S);
} };
let _, L, E = !1, x = !1;
function O(S) {
const l = S.createTexture();
S.bindTexture(S.TEXTURE_2D, l);
try {
if (S.texImage2D(S.TEXTURE_2D, 0, S.RGBA, S.RGBA, S.UNSIGNED_BYTE, L), S.isContextLost())
return;
y.supported = !0;
} catch {
}
S.deleteTexture(l), E = !0;
}
var k;
typeof document < "u" && (L = document.createElement("img"), L.onload = () => {
_ && O(_), _ = null, x = !0;
}, L.onerror = () => {
E = !0, _ = null;
}, L.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="), function(S) {
let l, m, v, b;
S.resetRequestQueue = () => {
l = [], m = 0, v = 0, b = {};
}, S.addThrottleControl = (j) => {
const Z = v++;
return b[Z] = j, Z;
}, S.removeThrottleControl = (j) => {
delete b[j], V();
}, S.getImage = (j, Z, Y = !0) => new Promise((J, lt) => {
y.supported && (j.headers || (j.headers = {}), j.headers.accept = "image/webp,*/*"), a.e(j, { type: "image" }), l.push({ abortController: Z, requestParameters: j, supportImageRefresh: Y, state: "queued", onError: (ft) => {
lt(ft);
}, onSuccess: (ft) => {
J(ft);
} }), V();
});
const M = (j) => a._(this, void 0, void 0, function* () {
j.state = "running";
const { requestParameters: Z, supportImageRefresh: Y, onError: J, onSuccess: lt, abortController: ft } = j, Qt = Y === !1 && !a.i(self) && !a.g(Z.url) && (!Z.headers || Object.keys(Z.headers).reduce((Ht, Ot) => Ht && Ot === "accept", !0));
m++;
const wt = Qt ? D(Z, ft) : a.m(Z, ft);
try {
const Ht = yield wt;
delete j.abortController, j.state = "completed", Ht.data instanceof HTMLImageElement || a.b(Ht.data) ? lt(Ht) : Ht.data && lt({ data: yield (Mt = Ht.data, typeof createImageBitmap == "function" ? a.d(Mt) : a.f(Mt)), cacheControl: Ht.cacheControl, expires: Ht.expires });
} catch (Ht) {
delete j.abortController, J(Ht);
} finally {
m--, V();
}
var Mt;
}), V = () => {
const j = (() => {
for (const Z of Object.keys(b))
if (b[Z]())
return !0;
return !1;
})() ? a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : a.a.MAX_PARALLEL_IMAGE_REQUESTS;
for (let Z = m; Z < j && l.length > 0; Z++) {
const Y = l.shift();
Y.abortController.signal.aborted ? Z-- : M(Y);
}
}, D = (j, Z) => new Promise((Y, J) => {
const lt = new Image(), ft = j.url, Qt = j.credentials;
Qt && Qt === "include" ? lt.crossOrigin = "use-credentials" : (Qt && Qt === "same-origin" || !a.s(ft)) && (lt.crossOrigin = "anonymous"), Z.signal.addEventListener("abort", () => {
lt.src = "", J(a.c());
}), lt.fetchPriority = "high", lt.onload = () => {
lt.onerror = lt.onload = null, Y({ data: lt });
}, lt.onerror = () => {
lt.onerror = lt.onload = null, Z.signal.aborted || J(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."));
}, lt.src = ft;
});
}(k || (k = {})), k.resetRequestQueue();
class R {
constructor(l) {
this._transformRequestFn = l;
}
transformRequest(l, m) {
return this._transformRequestFn && this._transformRequestFn(l, m) || { url: l };
}
setTransformRequest(l) {
this._transformRequestFn = l;
}
}
function F(S) {
var l = new a.A(3);
return l[0] = S[0], l[1] = S[1], l[2] = S[2], l;
}
var U, $ = function(S, l, m) {
return S[0] = l[0] - m[0], S[1] = l[1] - m[1], S[2] = l[2] - m[2], S;
};
U = new a.A(3), a.A != Float32Array && (U[0] = 0, U[1] = 0, U[2] = 0);
var et = function(S) {
var l = S[0], m = S[1];
return l * l + m * m;
};
function nt(S) {
const l = [];
if (typeof S == "string")
l.push({ id: "default", url: S });
else if (S && S.length > 0) {
const m = [];
for (const { id: v, url: b } of S) {
const M = `${v}${b}`;
m.indexOf(M) === -1 && (m.push(M), l.push({ id: v, url: b }));
}
}
return l;
}
function ct(S, l, m) {
const v = S.split("?");
return v[0] += `${l}${m}`, v.join("?");
}
(function() {
var S = new a.A(2);
a.A != Float32Array && (S[0] = 0, S[1] = 0);
})();
class rt {
constructor(l, m, v, b) {
this.context = l, this.format = v, this.texture = l.gl.createTexture(), this.update(m, b);
}
update(l, m, v) {
const { width: b, height: M } = l, V = !(this.size && this.size[0] === b && this.size[1] === M || v), { context: D } = this, { gl: j } = D;
if (this.useMipmap = !!(m && m.useMipmap), j.bindTexture(j.TEXTURE_2D, this.texture), D.pixelStoreUnpackFlipY.set(!1), D.pixelStoreUnpack.set(1), D.pixelStoreUnpackPremultiplyAlpha.set(this.format === j.RGBA && (!m || m.premultiply !== !1)), V)
this.size = [b, M], l instanceof HTMLImageElement || l instanceof HTMLCanvasElement || l instanceof HTMLVideoElement || l instanceof ImageData || a.b(l) ? j.texImage2D(j.TEXTURE_2D, 0, this.format, this.format, j.UNSIGNED_BYTE, l) : j.texImage2D(j.TEXTURE_2D, 0, this.format, b, M, 0, this.format, j.UNSIGNED_BYTE, l.data);
else {
const { x: Z, y: Y } = v || { x: 0, y: 0 };
l instanceof HTMLImageElement || l instanceof HTMLCanvasElement || l instanceof HTMLVideoElement || l instanceof ImageData || a.b(l) ? j.texSubImage2D(j.TEXTURE_2D, 0, Z, Y, j.RGBA, j.UNSIGNED_BYTE, l) : j.texSubImage2D(j.TEXTURE_2D, 0, Z, Y, b, M, j.RGBA, j.UNSIGNED_BYTE, l.data);
}
this.useMipmap && this.isSizePowerOfTwo() && j.generateMipmap(j.TEXTURE_2D);
}
bind(l, m, v) {
const { context: b } = this, { gl: M } = b;
M.bindTexture(M.TEXTURE_2D, this.texture), v !== M.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (v = M.LINEAR), l !== this.filter && (M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MAG_FILTER, l), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MIN_FILTER, v || l), this.filter = l), m !== this.wrap && (M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_S, m), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_T, m), this.wrap = m);
}
isSizePowerOfTwo() {
return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
}
destroy() {
const { gl: l } = this.context;
l.deleteTexture(this.texture), this.texture = null;
}
}
function gt(S) {
const { userImage: l } = S;
return !!(l && l.render && l.render()) && (S.data.replace(new Uint8Array(l.data.buffer)), !0);
}
class It extends a.E {
constructor() {
super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = !1, this.requestors = [], this.patterns = {}, this.atlasImage = new a.R({ width: 1, height: 1 }), this.dirty = !0;
}
isLoaded() {
return this.loaded;
}
setLoaded(l) {
if (this.loaded !== l && (this.loaded = l, l)) {
for (const { ids: m, promiseResolve: v } of this.requestors)
v(this._getImagesForIds(m));
this.requestors = [];
}
}
getImage(l) {
const m = this.images[l];
if (m && !m.data && m.spriteData) {
const v = m.spriteData;
m.data = new a.R({ width: v.width, height: v.height }, v.context.getImageData(v.x, v.y, v.width, v.height).data), m.spriteData = null;
}
return m;
}
addImage(l, m) {
if (this.images[l])
throw new Error(`Image id ${l} already exist, use updateImage instead`);
this._validate(l, m) && (this.images[l] = m);
}
_validate(l, m) {
let v = !0;
const b = m.data || m.spriteData;
return this._validateStretch(m.stretchX, b && b.width) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchX" value`))), v = !1), this._validateStretch(m.stretchY, b && b.height) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchY" value`))), v = !1), this._validateContent(m.content, m) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "content" value`))), v = !1), v;
}
_validateStretch(l, m) {
if (!l)
return !0;
let v = 0;
for (const b of l) {
if (b[0] < v || b[1] < b[0] || m < b[1])
return !1;
v = b[1];
}
return !0;
}
_validateContent(l, m) {
if (!l)
return !0;
if (l.length !== 4)
return !1;
const v = m.spriteData, b = v && v.width || m.data.width, M = v && v.height || m.data.height;
return !(l[0] < 0 || b < l[0] || l[1] < 0 || M < l[1] || l[2] < 0 || b < l[2] || l[3] < 0 || M < l[3] || l[2] < l[0] || l[3] < l[1]);
}
updateImage(l, m, v = !0) {
const b = this.getImage(l);
if (v && (b.data.width !== m.data.width || b.data.height !== m.data.height))
throw new Error(`size mismatch between old image (${b.data.width}x${b.data.height}) and new image (${m.data.width}x${m.data.height}).`);
m.version = b.version + 1, this.images[l] = m, this.updatedImages[l] = !0;
}
removeImage(l) {
const m = this.images[l];
delete this.images[l], delete this.patterns[l], m.userImage && m.userImage.onRemove && m.userImage.onRemove();
}
listImages() {
return Object.keys(this.images);
}
getImages(l) {
return new Promise((m, v) => {
let b = !0;
if (!this.isLoaded())
for (const M of l)
this.images[M] || (b = !1);
this.isLoaded() || b ? m(this._getImagesForIds(l)) : this.requestors.push({ ids: l, promiseResolve: m });
});
}
_getImagesForIds(l) {
const m = {};
for (const v of l) {
let b = this.getImage(v);
b || (this.fire(new a.k("styleimagemissing", { id: v })), b = this.getImage(v)), b ? m[v] = { data: b.data.clone(), pixelRatio: b.pixelRatio, sdf: b.sdf, version: b.version, stretchX: b.stretchX, stretchY: b.stretchY, content: b.content, textFitWidth: b.textFitWidth, textFitHeight: b.textFitHeight, hasRenderCallback: !!(b.userImage && b.userImage.render) } : a.w(`Image "${v}" 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.`);
}
return m;
}
getPixelSize() {
const { width: l, height: m } = this.atlasImage;
return { width: l, height: m };
}
getPattern(l) {
const m = this.patterns[l], v = this.getImage(l);
if (!v)
return null;
if (m && m.position.version === v.version)
return m.position;
if (m)
m.position.version = v.version;
else {
const b = { w: v.data.width + 2, h: v.data.height + 2, x: 0, y: 0 }, M = new a.I(b, v);
this.patterns[l] = { bin: b, position: M };
}
return this._updatePatternAtlas(), this.patterns[l].position;
}
bind(l) {
const m = l.gl;
this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = !1) : this.atlasTexture = new rt(l, this.atlasImage, m.RGBA), this.atlasTexture.bind(m.LINEAR, m.CLAMP_TO_EDGE);
}
_updatePatternAtlas() {
const l = [];
for (const M in this.patterns)
l.push(this.patterns[M].bin);
const { w: m, h: v } = a.p(l), b = this.atlasImage;
b.resize({ width: m || 1, height: v || 1 });
for (const M in this.patterns) {
const { bin: V } = this.patterns[M], D = V.x + 1, j = V.y + 1, Z = this.getImage(M).data, Y = Z.width, J = Z.height;
a.R.copy(Z, b, { x: 0, y: 0 }, { x: D, y: j }, { width: Y, height: J }), a.R.copy(Z, b, { x: 0, y: J - 1 }, { x: D, y: j - 1 }, { width: Y, height: 1 }), a.R.copy(Z, b, { x: 0, y: 0 }, { x: D, y: j + J }, { width: Y, height: 1 }), a.R.copy(Z, b, { x: Y - 1, y: 0 }, { x: D - 1, y: j }, { width: 1, height: J }), a.R.copy(Z, b, { x: 0, y: 0 }, { x: D + Y, y: j }, { width: 1, height: J });
}
this.dirty = !0;
}
beginFrame() {
this.callbackDispatchedThisFrame = {};
}
dispatchRenderCallbacks(l) {
for (const m of l) {
if (this.callbackDispatchedThisFrame[m])
continue;
this.callbackDispatchedThisFrame[m] = !0;
const v = this.getImage(m);
v || a.w(`Image with ID: "${m}" was not found`), gt(v) && this.updateImage(m, v);
}
}
}
const Zt = 1e20;
function oe(S, l, m, v, b, M, V, D, j) {
for (let Z = l; Z < l + v; Z++)
re(S, m * M + Z, M, b, V, D, j);
for (let Z = m; Z < m + b; Z++)
re(S, Z * M + l, 1, v, V, D, j);
}
function re(S, l, m, v, b, M, V) {
M[0] = 0, V[0] = -Zt, V[1] = Zt, b[0] = S[l];
for (let D = 1, j = 0, Z = 0; D < v; D++) {
b[D] = S[l + D * m];
const Y = D * D;
do {
const J = M[j];
Z = (b[D] - b[J] + Y - J * J) / (D - J) / 2;
} while (Z <= V[j] && --j > -1);
j++, M[j] = D, V[j] = Z, V[j + 1] = Zt;
}
for (let D = 0, j = 0; D < v; D++) {
for (; V[j + 1] < D; )
j++;
const Z = M[j], Y = D - Z;
S[l + D * m] = b[Z] + Y * Y;
}
}
class Ve {
constructor(l, m) {
this.requestManager = l, this.localIdeographFontFamily = m, this.entries = {};
}
setURL(l) {
this.url = l;
}
getGlyphs(l) {
return a._(this, void 0, void 0, function* () {
const m = [];
for (const M in l)
for (const V of l[M])
m.push(this._getAndCacheGlyphsPromise(M, V));
const v = yield Promise.all(m), b = {};
for (const { stack: M, id: V, glyph: D } of v)
b[M] || (b[M] = {}), b[M][V] = D && { id: D.id, bitmap: D.bitmap.clone(), metrics: D.metrics };
return b;
});
}
_getAndCacheGlyphsPromise(l, m) {
return a._(this, void 0, void 0, function* () {
let v = this.entries[l];
v || (v = this.entries[l] = { glyphs: {}, requests: {}, ranges: {} });
let b = v.glyphs[m];
if (b !== void 0)
return { stack: l, id: m, glyph: b };
if (b = this._tinySDF(v, l, m), b)
return v.glyphs[m] = b, { stack: l, id: m, glyph: b };
const M = Math.floor(m / 256);
if (256 * M > 65535)
throw new Error("glyphs > 65535 not supported");
if (v.ranges[M])
return { stack: l, id: m, glyph: b };
if (!this.url)
throw new Error("glyphsUrl is not set");
if (!v.requests[M]) {
const D = Ve.loadGlyphRange(l, M, this.url, this.requestManager);
v.requests[M] = D;
}
const V = yield v.requests[M];
for (const D in V)
this._doesCharSupportLocalGlyph(+D) || (v.glyphs[+D] = V[+D]);
return v.ranges[M] = !0, { stack: l, id: m, glyph: V[m] || null };
});
}
_doesCharSupportLocalGlyph(l) {
return !!this.localIdeographFontFamily && new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}", "u").test(String.fromCodePoint(l));
}
_tinySDF(l, m, v) {
const b = this.localIdeographFontFamily;
if (!b || !this._doesCharSupportLocalGlyph(v))
return;
let M = l.tinySDF;
if (!M) {
let D = "400";
/bold/i.test(m) ? D = "900" : /medium/i.test(m) ? D = "500" : /light/i.test(m) && (D = "200"), M = l.tinySDF = new Ve.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: b, fontWeight: D });
}
const V = M.draw(String.fromCharCode(v));
return { id: v, bitmap: new a.o({ width: V.width || 60, height: V.height || 60 }, V.data), metrics: { width: V.glyphWidth / 2 || 24, height: V.glyphHeight / 2 || 24, left: V.glyphLeft / 2 + 0.5 || 0, top: V.glyphTop / 2 - 27.5 || -8, advance: V.glyphAdvance / 2 || 24, isDoubleResolution: !0 } };
}
}
Ve.loadGlyphRange = function(S, l, m, v) {
return a._(this, void 0, void 0, function* () {
const b = 256 * l, M = b + 255, V = v.transformRequest(m.replace("{fontstack}", S).replace("{range}", `${b}-${M}`), "Glyphs"), D = yield a.l(V, new AbortController());
if (!D || !D.data)
throw new Error(`Could not load glyph range. range: ${l}, ${b}-${M}`);
const j = {};
for (const Z of a.n(D.data))
j[Z.id] = Z;
return j;
});
}, Ve.TinySDF = class {
constructor({ fontSize: S = 24, buffer: l = 3, radius: m = 8, cutoff: v = 0.25, fontFamily: b = "sans-serif", fontWeight: M = "normal", fontStyle: V = "normal" } = {}) {
this.buffer = l, this.cutoff = v, this.radius = m;
const D = this.size = S + 4 * l, j = this._createCanvas(D), Z = this.ctx = j.getContext("2d", { willReadFrequently: !0 });
Z.font = `${V} ${M} ${S}px ${b}`, Z.textBaseline = "alphabetic", Z.textAlign = "left", Z.fillStyle = "black", this.gridOuter = new Float64Array(D * D), this.gridInner = new Float64Array(D * D), this.f = new Float64Array(D), this.z = new Float64Array(D + 1), this.v = new Uint16Array(D);
}
_createCanvas(S) {
const l = document.createElement("canvas");
return l.width = l.height = S, l;
}
draw(S) {
const { width: l, actualBoundingBoxAscent: m, actualBoundingBoxDescent: v, actualBoundingBoxLeft: b, actualBoundingBoxRight: M } = this.ctx.measureText(S), V = Math.ceil(m), D = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(M - b))), j = Math.min(this.size - this.buffer, V + Math.ceil(v)), Z = D + 2 * this.buffer, Y = j + 2 * this.buffer, J = Math.max(Z * Y, 0), lt = new Uint8ClampedArray(J), ft = { data: lt, width: Z, height: Y, glyphWidth: D, glyphHeight: j, glyphTop: V, glyphLeft: 0, glyphAdvance: l };
if (D === 0 || j === 0)
return ft;
const { ctx: Qt, buffer: wt, gridInner: Mt, gridOuter: Ht } = this;
Qt.clearRect(wt, wt, D, j), Qt.fillText(S, wt, wt + V);
const Ot = Qt.getImageData(wt, wt, D, j);
Ht.fill(Zt, 0, J), Mt.fill(0, 0, J);
for (let bt = 0; bt < j; bt++)
for (let Nt = 0; Nt < D; Nt++) {
const Dt = Ot.data[4 * (bt * D + Nt) + 3] / 255;
if (Dt === 0)
continue;
const Wt = (bt + wt) * Z + Nt + wt;
if (Dt === 1)
Ht[Wt] = 0, Mt[Wt] = Zt;
else {
const he = 0.5 - Dt;
Ht[Wt] = he > 0 ? he * he : 0, Mt[Wt] = he < 0 ? he * he : 0;
}
}
oe(Ht, 0, 0, Z, Y, Z, this.f, this.v, this.z), oe(Mt, wt, wt, D, j, Z, this.f, this.v, this.z);
for (let bt = 0; bt < J; bt++) {
const Nt = Math.sqrt(Ht[bt]) - Math.sqrt(Mt[bt]);
lt[bt] = Math.round(255 - 255 * (Nt / this.radius + this.cutoff));
}
return ft;
}
};
class yr {
constructor() {
this.specification = a.v.light.position;
}
possiblyEvaluate(l, m) {
return a.x(l.expression.evaluate(m));
}
interpolate(l, m, v) {
return { x: a.y.number(l.x, m.x, v), y: a.y.number(l.y, m.y, v), z: a.y.number(l.z, m.z, v) };
}
}
let qr;
class ie extends a.E {
constructor(l) {
super(), qr = qr || new a.q({ anchor: new a.D(a.v.light.anchor), position: new yr(), color: new a.D(a.v.light.color), intensity: new a.D(a.v.light.intensity) }), this._transitionable = new a.T(qr), this.setLight(l), this._transitioning = this._transitionable.untransitioned();
}
getLight() {
return this._transitionable.serialize();
}
setLight(l, m = {}) {
if (!this._validate(a.r, l, m))
for (const v in l) {
const b = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), b) : this._transitionable.setValue(v, b);
}
}
updateTransitions(l) {
this._transitioning = this._transitionable.transitioned(l, this._transitioning);
}
hasTransition() {
return this._transitioning.hasTransition();
}
recalculate(l) {
this.properties = this._transitioning.possiblyEvaluate(l);
}
_validate(l, m, v) {
return (!v || v.validate !== !1) && a.t(this, l.call(a.u, { value: m, style: { glyphs: !0, sprite: !0 }, styleSpec: a.v }));
}
}
const Qe = new a.q({ "sky-color": new a.D(a.v.sky["sky-color"]), "horizon-color": new a.D(a.v.sky["horizon-color"]), "fog-color": new a.D(a.v.sky["fog-color"]), "fog-ground-blend": new a.D(a.v.sky["fog-ground-blend"]), "horizon-fog-blend": new a.D(a.v.sky["horizon-fog-blend"]), "sky-horizon-blend": new a.D(a.v.sky["sky-horizon-blend"]), "atmosphere-blend": new a.D(a.v.sky["atmosphere-blend"]) });
class Ke extends a.E {
constructor(l) {
super(), this._transitionable = new a.T(Qe), this.setSky(l), this._transitioning = this._transitionable.untransitioned(), this.recalculate(new a.z(0));
}
setSky(l, m = {}) {
if (!this._validate(a.B, l, m)) {
l || (l = { "sky-color": "transparent", "horizon-color": "transparent", "fog-color": "transparent", "fog-ground-blend": 1, "atmosphere-blend": 0 });
for (const v in l) {
const b = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), b) : this._transitionable.setValue(v, b);
}
}
}
getSky() {
return this._transitionable.serialize();
}
updateTransitions(l) {
this._transitioning = this._transitionable.transitioned(l, this._transitioning);
}
hasTransition() {
return this._transitioning.hasTransition();
}
recalculate(l) {
this.properties = this._transitioning.possiblyEvaluate(l);
}
_validate(l, m, v = {}) {
return (v == null ? void 0 : v.validate) !== !1 && a.t(this, l.call(a.u, a.e({ value: m, style: { glyphs: !0, sprite: !0 }, styleSpec: a.v })));
}
calculateFogBlendOpacity(l) {
return l < 60 ? 0 : l < 70 ? (l - 60) / 10 : 1;
}
}
class He {
constructor(l, m) {
this.width = l, this.height = m, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};
}
getDash(l, m) {
const v = l.join(",") + String(m);
return this.dashEntry[v] || (this.dashEntry[v] = this.addDash(l, m)), this.dashEntry[v];
}
getDashRanges(l, m, v) {
const b = [];
let M = l.length % 2 == 1 ? -l[l.length - 1] * v : 0, V = l[0] * v, D = !0;
b.push({ left: M, right: V, isDash: D, zeroLength: l[0] === 0 });
let j = l[0];
for (let Z = 1; Z < l.length; Z++) {
D = !D;
const Y = l[Z];
M = j * v, j += Y, V = j * v, b.push({ left: M, right: V, isDash: D, zeroLength: Y === 0 });
}
return b;
}
addRoundDash(l, m, v) {
const b = m / 2;
for (let M = -v; M <= v; M++) {
const V = this.width * (this.nextRow + v + M);
let D = 0, j = l[D];
for (let Z = 0; Z < this.width; Z++) {
Z / j.right > 1 && (j = l[++D]);
const Y = Math.abs(Z - j.left), J = Math.abs(Z - j.right), lt = Math.min(Y, J);
let ft;
const Qt = M / v * (b + 1);
if (j.isDash) {
const wt = b - Math.abs(Qt);
ft = Math.sqrt(lt * lt + wt * wt);
} else
ft = b - Math.sqrt(lt * lt + Qt * Qt);
this.data[V + Z] = Math.max(0, Math.min(255, ft + 128));
}
}
}
addRegularDash(l) {
for (let D = l.length - 1; D >= 0; --D) {
const j = l[D], Z = l[D + 1];
j.zeroLength ? l.splice(D, 1) : Z && Z.isDash === j.isDash && (Z.left = j.left, l.splice(D, 1));
}
const m = l[0], v = l[l.length - 1];
m.isDash === v.isDash && (m.left = v.left - this.width, v.right = m.right + this.width);
const b = this.width * this.nextRow;
let M = 0, V = l[M];
for (let D = 0; D < this.width; D++) {
D / V.right > 1 && (V = l[++M]);
const j = Math.abs(D - V.left), Z = Math.abs(D - V.right), Y = Math.min(j, Z);
this.data[b + D] = Math.max(0, Math.min(255, (V.isDash ? Y : -Y) + 128));
}
}
addDash(l, m) {
const v = m ? 7 : 0, b = 2 * v + 1;
if (this.nextRow + b > this.height)
return a.w("LineAtlas out of space"), null;
let M = 0;
for (let D = 0; D < l.length; D++)
M += l[D];
if (M !== 0) {
const D = this.width / M, j = this.getDashRanges(l, this.width, D);
m ? this.addRoundDash(j, D, v) : this.addRegularDash(j);
}
const V = { y: (this.nextRow + v + 0.5) / this.height, height: 2 * v / this.height, width: M };
return this.nextRow += b, this.dirty = !0, V;
}
bind(l) {
const m = l.gl;
this.texture ? (m.bindTexture(m.TEXTURE_2D, this.texture), this.dirty && (this.dirty = !1, m.texSubImage2D(m.TEXTURE_2D, 0, 0, 0, this.width, this.height, m.ALPHA, m.UNSIGNED_BYTE, this.data))) : (this.texture = m.createTexture(), m.bindTexture(m.TEXTURE_2D, this.texture), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_S, m.REPEAT), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_T, m.REPEAT), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MIN_FILTER, m.LINEAR), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MAG_FILTER, m.LINEAR), m.texImage2D(m.TEXTURE_2D, 0, m.ALPHA, this.width, this.height, 0, m.ALPHA, m.UNSIGNED_BYTE, this.data));
}
}
const er = "maplibre_preloaded_worker_pool";
class Je {
constructor() {
this.active = {};
}
acquire(l) {
if (!this.workers)
for (this.workers = []; this.workers.length < Je.workerCount; )
this.workers.push(new Worker(a.a.WORKER_URL));
return this.active[l] = !0, this.workers.slice();
}
release(l) {
delete this.active[l], this.numActive() === 0 && (this.workers.forEach((m) => {
m.terminate();
}), this.workers = null);
}
isPreloaded() {
return !!this.active[er];
}
numActive() {
return Object.keys(this.active).length;
}
}
const Ne = Math.floor(f.hardwareConcurrency / 2);
let Gt, te;
function me() {
return Gt || (Gt = new Je()), Gt;
}
Je.workerCount = a.C(globalThis) ? Math.max(Math.min(Ne, 3), 1) : 1;
class de {
constructor(l, m) {
this.workerPool = l, this.actors = [], this.currentActor = 0, this.id = m;
const v = this.workerPool.acquire(m);
for (let b = 0; b < v.length; b++) {
const M = new a.F(v[b], m);
M.name = `Worker ${b}`, this.actors.push(M);
}
if (!this.actors.length)
throw new Error("No actors found");
}
broadcast(l, m) {
const v = [];
for (const b of this.actors)
v.push(b.sendAsync({ type: l, data: m }));
return Promise.all(v);
}
getActor() {
return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];
}
remove(l = !0) {
this.actors.forEach((m) => {
m.remove();
}), this.actors = [], l && this.workerPool.release(this.id);
}
registerMessageHandler(l, m) {
for (const v of this.actors)
v.registerMessageHandler(l, m);
}
}
function Ge() {
return te || (te = new de(me(), a.G), te.registerMessageHandler("GR", (S, l, m) => a.m(l, m))), te;
}
function Tr(S, l) {
const m = a.H();
return a.J(m, m, [1, 1, 0]), a.K(m, m, [0.5 * S.width, 0.5 * S.height, 1]), a.L(m, m, S.calculatePosMatrix(l.toUnwrapped()));
}
function qe(S, l, m, v, b, M) {
const V = function(J, lt, ft) {
if (J)
for (const Qt of J) {
const wt = lt[Qt];
if (wt && wt.source === ft && wt.type === "fill-extrusion")
return !0;
}
else
for (const Qt in lt) {
const wt = lt[Qt];
if (wt.source === ft && wt.type === "fill-extrusion")
return !0;
}
return !1;
}(b && b.layers, l, S.id), D = M.maxPitchScaleFactor(), j = S.tilesIn(v, D, V);
j.sort($e);
const Z = [];
for (const J of j)
Z.push({ wrappedTileID: J.tileID.wrapped().key, queryResults: J.tile.queryRenderedFeatures(l, m, S._state, J.queryGeometry, J.cameraQueryGeometry, J.scale, b, M, D, Tr(S.transform, J.tileID)) });
const Y = function(J) {
const lt = {}, ft = {};
for (const Qt of J) {
const wt = Qt.queryResults, Mt = Qt.wrappedTileID, Ht = ft[Mt] = ft[Mt] || {};
for (const Ot in wt) {
const bt = wt[Ot], Nt = Ht[Ot] = Ht[Ot] || {}, Dt = lt[Ot] = lt[Ot] || [];
for (const Wt of bt)
Nt[Wt.featureIndex] || (Nt[Wt.featureIndex] = !0, Dt.push(Wt));
}
}
return lt;
}(Z);
for (const J in Y)
Y[J].forEach((lt) => {
const ft = lt.feature, Qt = S.getFeatureState(ft.layer["source-layer"], ft.id);
ft.source = ft.layer.source, ft.layer["source-layer"] && (ft.sourceLayer = ft.layer["source-layer"]), ft.state = Qt;
});
return Y;
}
function $e(S, l) {
const m = S.tileID, v = l.tileID;
return m.overscaledZ - v.overscaledZ || m.canonical.y - v.canonical.y || m.wrap - v.wrap || m.canonical.x - v.canonical.x;
}
function ar(S, l, m) {
return a._(this, void 0, void 0, function* () {
let v = S;
if (S.url ? v = (yield a.h(l.transformRequest(S.url, "Source"), m)).data : yield f.frameAsync(m), !v)
return null;
const b = a.M(a.e(v, S), ["tiles", "minzoom", "maxzoom", "attribution", "bounds", "scheme", "tileSize", "encoding"]);
return "vector_layers" in v && v.vector_layers && (b.vectorLayerIds = v.vector_layers.map((M) => M.id)), b;
});
}
class Ct {
constructor(l, m) {
l && (m ? this.setSouthWest(l).setNorthEast(m) : Array.isArray(l) && (l.length === 4 ? this.setSouthWest([l[0], l[1]]).setNorthEast([l[2], l[3]]) : this.setSouthWest(l[0]).setNorthEast(l[1])));
}
setNorthEast(l) {
return this._ne = l instanceof a.N ? new a.N(l.lng, l.lat) : a.N.convert(l), this;
}
setSouthWest(l) {
return this._sw = l instanceof a.N ? new a.N(l.lng, l.lat) : a.N.convert(l), this;
}
extend(l) {
const m = this._sw, v = this._ne;
let b, M;
if (l instanceof a.N)
b = l, M = l;
else {
if (!(l instanceof Ct))
return Array.isArray(l) ? l.length === 4 || l.every(Array.isArray) ? this.extend(Ct.convert(l)) : this.extend(a.N.convert(l)) : l && ("lng" in l || "lon" in l) && "lat" in l ? this.extend(a.N.convert(l)) : this;
if (b = l._sw, M = l._ne, !b || !M)
return this;
}
return m || v ? (m.lng = Math.min(b.lng, m.lng), m.lat = Math.min(b.lat, m.lat), v.lng = Math.max(M.lng, v.lng), v.lat = Math.max(M.lat, v.lat)) : (this._sw = new a.N(b.lng, b.lat), this._ne = new a.N(M.lng, M.lat)), this;
}
getCenter() {
return new a.N((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 a.N(this.getWest(), this.getNorth());
}
getSouthEast() {
return new a.N(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(l) {
const { lng: m, lat: v } = a.N.convert(l);
let b = this._sw.lng <= m && m <= this._ne.lng;
return this._sw.lng > this._ne.lng && (b = this._sw.lng >= m && m >= this._ne.lng), this._sw.lat <= v && v <= this._ne.lat && b;
}
static convert(l) {
return l instanceof Ct ? l : l && new Ct(l);
}
static fromLngLat(l, m = 0) {
const v = 360 * m / 40075017, b = v / Math.cos(Math.PI / 180 * l.lat);
return new Ct(new a.N(l.lng - b, l.lat - v), new a.N(l.lng + b, l.lat + v));
}
adjustAntiMeridian() {
const l = new a.N(this._sw.lng, this._sw.lat), m = new a.N(this._ne.lng, this._ne.lat);
return new Ct(l, l.lng > m.lng ? new a.N(m.lng + 360, m.lat) : m);
}
}
class en {
constructor(l, m, v) {
this.bounds = Ct.convert(this.validateBounds(l)), this.minzoom = m || 0, this.maxzoom = v || 24;
}
validateBounds(l) {
return Array.isArray(l) && l.length === 4 ? [Math.max(-180, l[0]), Math.max(-90, l[1]), Math.min(180, l[2]), Math.min(90, l[3])] : [-180, -90, 180, 90];
}
contains(l) {
const m = Math.pow(2, l.z), v = Math.floor(a.O(this.bounds.getWest()) * m), b = Math.floor(a.Q(this.bounds.getNorth()) * m), M = Math.ceil(a.O(this.bounds.getEast()) * m), V = Math.ceil(a.Q(this.bounds.getSouth()) * m);
return l.x >= v && l.x < M && l.y >= b && l.y < V;
}
}
class Jr extends a.E {
constructor(l, m, v, b) {
if (super(), this.id = l, this.dispatcher = v, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = !0, this.isTileClipped = !0, this._loaded = !1, a.e(this, a.M(m, ["url", "scheme", "tileSize", "promoteId"])), this._options = a.e({ type: "vector" }, m), this._collectResourceTiming = m.collectResourceTiming, this.tileSize !== 512)
throw new Error("vector tile sources must have a tileSize of 512");
this.setEventedParent(b);
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
try {
const l = yield ar(this._options, this.map._requestManager, this._tileJSONRequest);
this._tileJSONRequest = null, this._loaded = !0, this.map.style.sourceCaches[this.id].clearTiles(), l && (a.e(this, l), l.bounds && (this.tileBounds = new en(l.bounds, this.minzoom, this.maxzoom)), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })));
} catch (l) {
this._tileJSONRequest = null, this.fire(new a.j(l));
}
});
}
loaded() {
return this._loaded;
}
hasTile(l) {
return !this.tileBounds || this.tileBounds.contains(l.canonical);
}
onAdd(l) {
this.map = l, this.load();
}
setSourceProperty(l) {
this._tileJSONRequest && this._tileJSONRequest.abort(), l(), this.load();
}
setTiles(l) {
return this.setSourceProperty(() => {
this._options.tiles = l;
}), this;
}
setUrl(l) {
return this.setSourceProperty(() => {
this.url = l, this._options.url = l;
}), this;
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
}
serialize() {
return a.e({}, this._options);
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), v = { request: this.map._requestManager.transformRequest(m, "Tile"), uid: l.uid, tileID: l.tileID, zoom: l.tileID.overscaledZ, tileSize: this.tileSize * l.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
v.request.collectResourceTiming = this._collectResourceTiming;
let b = "RT";
if (l.actor && l.state !== "expired") {
if (l.state === "loading")
return new Promise((M, V) => {
l.reloadPromise = { resolve: M, reject: V };
});
} else
l.actor = this.dispatcher.getActor(), b = "LT";
l.abortController = new AbortController();
try {
const M = yield l.actor.sendAsync({ type: b, data: v }, l.abortController);
if (delete l.abortController, l.aborted)
return;
this._afterTileLoadWorkerResponse(l, M);
} catch (M) {
if (delete l.abortController, l.aborted)
return;
if (M && M.status !== 404)
throw M;
this._afterTileLoadWorkerResponse(l, null);
}
});
}
_afterTileLoadWorkerResponse(l, m) {
if (m && m.resourceTiming && (l.resourceTiming = m.resourceTiming), m && this.map._refreshExpiredTiles && l.setExpiryData(m), l.loadVectorData(m, this.map.painter), l.reloadPromise) {
const v = l.reloadPromise;
l.reloadPromise = null, this.loadTile(l).then(v.resolve).catch(v.reject);
}
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController), l.actor && (yield l.actor.sendAsync({ type: "AT", data: { uid: l.uid, type: this.type, source: this.id } }));
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.unloadVectorData(), l.actor && (yield l.actor.sendAsync({ type: "RMT", data: { uid: l.uid, type: this.type, source: this.id } }));
});
}
hasTransition() {
return !1;
}
}
class Hr extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.dispatcher = v, this.setEventedParent(b), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = !0, this.scheme = "xyz", this.tileSize = 512, this._loaded = !1, this._options = a.e({ type: "raster" }, m), a.e(this, a.M(m, ["url", "scheme", "tileSize"]));
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
try {
const l = yield ar(this._options, this.map._requestManager, this._tileJSONRequest);
this._tileJSONRequest = null, this._loaded = !0, l && (a.e(this, l), l.bounds && (this.tileBounds = new en(l.bounds, this.minzoom, this.maxzoom)), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })));
} catch (l) {
this._tileJSONRequest = null, this.fire(new a.j(l));
}
});
}
loaded() {
return this._loaded;
}
onAdd(l) {
this.map = l, this.load();
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
}
setSourceProperty(l) {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null), l(), this.load();
}
setTiles(l) {
return this.setSourceProperty(() => {
this._options.tiles = l;
}), this;
}
setUrl(l) {
return this.setSourceProperty(() => {
this.url = l, this._options.url = l;
}), this;
}
serialize() {
return a.e({}, this._options);
}
hasTile(l) {
return !this.tileBounds || this.tileBounds.contains(l.canonical);
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
l.abortController = new AbortController();
try {
const v = yield k.getImage(this.map._requestManager.transformRequest(m, "Tile"), l.abortController, this.map._refreshExpiredTiles);
if (delete l.abortController, l.aborted)
return void (l.state = "unloaded");
if (v && v.data) {
this.map._refreshExpiredTiles && v.cacheControl && v.expires && l.setExpiryData({ cacheControl: v.cacheControl, expires: v.expires });
const b = this.map.painter.context, M = b.gl, V = v.data;
l.texture = this.map.painter.getTileTexture(V.width), l.texture ? l.texture.update(V, { useMipmap: !0 }) : (l.texture = new rt(b, V, M.RGBA, { useMipmap: !0 }), l.texture.bind(M.LINEAR, M.CLAMP_TO_EDGE, M.LINEAR_MIPMAP_NEAREST)), l.state = "loaded";
}
} catch (v) {
if (delete l.abortController, l.aborted)
l.state = "unloaded";
else if (v)
throw l.state = "errored", v;
}
});
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController);
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.texture && this.map.painter.saveTileTexture(l.texture);
});
}
hasTransition() {
return !1;
}
}
class Rr extends Hr {
constructor(l, m, v, b) {
super(l, m, v, b), this.type = "raster-dem", this.maxzoom = 22, this._options = a.e({ type: "raster-dem" }, m), this.encoding = m.encoding || "mapbox", this.redFactor = m.redFactor, this.greenFactor = m.greenFactor, this.blueFactor = m.blueFactor, this.baseShift = m.baseShift;
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), v = this.map._requestManager.transformRequest(m, "Tile");
l.neighboringTiles = this._getNeighboringTiles(l.tileID), l.abortController = new AbortController();
try {
const b = yield k.getImage(v, l.abortController, this.map._refreshExpiredTiles);
if (delete l.abortController, l.aborted)
return void (l.state = "unloaded");
if (b && b.data) {
const M = b.data;
this.map._refreshExpiredTiles && b.cacheControl && b.expires && l.setExpiryData({ cacheControl: b.cacheControl, expires: b.expires });
const V = a.b(M) && a.U() ? M : yield this.readImageNow(M), D = { type: this.type, uid: l.uid, source: this.id, rawImageData: V, encoding: this.encoding, redFactor: this.redFactor, greenFactor: this.greenFactor, blueFactor: this.blueFactor, baseShift: this.baseShift };
if (!l.actor || l.state === "expired") {
l.actor = this.dispatcher.getActor();
const j = yield l.actor.sendAsync({ type: "LDT", data: D });
l.dem = j, l.needsHillshadePrepare = !0, l.needsTerrainPrepare = !0, l.state = "loaded";
}
}
} catch (b) {
if (delete l.abortController, l.aborted)
l.state = "unloaded";
else if (b)
throw l.state = "errored", b;
}
});
}
readImageNow(l) {
return a._(this, void 0, void 0, function* () {
if (typeof VideoFrame < "u" && a.V()) {
const m = l.width + 2, v = l.height + 2;
try {
return new a.R({ width: m, height: v }, yield a.W(l, -1, -1, m, v));
} catch {
}
}
return f.getImageData(l, 1);
});
}
_getNeighboringTiles(l) {
const m = l.canonical, v = Math.pow(2, m.z), b = (m.x - 1 + v) % v, M = m.x === 0 ? l.wrap - 1 : l.wrap, V = (m.x + 1 + v) % v, D = m.x + 1 === v ? l.wrap + 1 : l.wrap, j = {};
return j[new a.S(l.overscaledZ, M, m.z, b, m.y).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y).key] = { backfilled: !1 }, m.y > 0 && (j[new a.S(l.overscaledZ, M, m.z, b, m.y - 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y - 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y - 1).key] = { backfilled: !1 }), m.y + 1 < v && (j[new a.S(l.overscaledZ, M, m.z, b, m.y + 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y + 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y + 1).key] = { backfilled: !1 }), j;
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.demTexture && this.map.painter.saveTileTexture(l.demTexture), l.fbo && (l.fbo.destroy(), delete l.fbo), l.dem && delete l.dem, delete l.neighboringTiles, l.state = "unloaded", l.actor && (yield l.actor.sendAsync({ type: "RDT", data: { type: this.type, uid: l.uid, source: this.id } }));
});
}
}
class dn extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = !0, this.reparseOverscaled = !0, this._removed = !1, this._pendingLoads = 0, this.actor = v.getActor(), this.setEventedParent(b), this._data = m.data, this._options = a.e({}, m), this._collectResourceTiming = m.collectResourceTiming, m.maxzoom !== void 0 && (this.maxzoom = m.maxzoom), m.type && (this.type = m.type), m.attribution && (this.attribution = m.attribution), this.promoteId = m.promoteId;
const M = a.X / this.tileSize;
m.clusterMaxZoom !== void 0 && this.maxzoom <= m.clusterMaxZoom && a.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${m.clusterMaxZoom}".`), this.workerOptions = a.e({ source: this.id, cluster: m.cluster || !1, geojsonVtOptions: { buffer: (m.buffer !== void 0 ? m.buffer : 128) * M, tolerance: (m.tolerance !== void 0 ? m.tolerance : 0.375) * M, extent: a.X, maxZoom: this.maxzoom, lineMetrics: m.lineMetrics || !1, generateId: m.generateId || !1 }, superclusterOptions: { maxZoom: m.clusterMaxZoom !== void 0 ? m.clusterMaxZoom : this.maxzoom - 1, minPoints: Math.max(2, m.clusterMinPoints || 2), extent: a.X, radius: (m.clusterRadius || 50) * M, log: !1, generateId: m.generateId || !1 }, clusterProperties: m.clusterProperties, filter: m.filter }, m.workerOptions), typeof this.promoteId == "string" && (this.workerOptions.promoteId = this.promoteId);
}
load() {
return a._(this, void 0, void 0, function* () {
yield this._updateWorkerData();
});
}
onAdd(l) {
this.map = l, this.load();
}
setData(l) {
return this._data = l, this._updateWorkerData(), this;
}
updateData(l) {
return this._updateWorkerData(l), this;
}
getData() {
return a._(this, void 0, void 0, function* () {
const l = a.e({ type: this.type }, this.workerOptions);
return this.actor.sendAsync({ type: "GD", data: l });
});
}
setClusterOptions(l) {
return this.workerOptions.cluster = l.cluster, l && (l.clusterRadius !== void 0 && (this.workerOptions.superclusterOptions.radius = l.clusterRadius), l.clusterMaxZoom !== void 0 && (this.workerOptions.superclusterOptions.maxZoom = l.clusterMaxZoom)), this._updateWorkerData(), this;
}
getClusterExpansionZoom(l) {
return this.actor.sendAsync({ type: "GCEZ", data: { type: this.type, clusterId: l, source: this.id } });
}
getClusterChildren(l) {
return this.actor.sendAsync({ type: "GCC", data: { type: this.type, clusterId: l, source: this.id } });
}
getClusterLeaves(l, m, v) {
return this.actor.sendAsync({ type: "GCL", data: { type: this.type, source: this.id, clusterId: l, limit: m, offset: v } });
}
_updateWorkerData(l) {
return a._(this, void 0, void 0, function* () {
const m = a.e({ type: this.type }, this.workerOptions);
l ? m.dataDiff = l : typeof this._data == "string" ? (m.request = this.map._requestManager.transformRequest(f.resolveURL(this._data), "Source"), m.request.collectResourceTiming = this._collectResourceTiming) : m.data = JSON.stringify(this._data), this._pendingLoads++, this.fire(new a.k("dataloading", { dataType: "source" }));
try {
const v = yield this.actor.sendAsync({ type: "LD", data: m });
if (this._pendingLoads--, this._removed || v.abandoned)
return void this.fire(new a.k("dataabort", { dataType: "source" }));
let b = null;
v.resourceTiming && v.resourceTiming[this.id] && (b = v.resourceTiming[this.id].slice(0));
const M = { dataType: "source" };
this._collectResourceTiming && b && b.length > 0 && a.e(M, { resourceTiming: b }), this.fire(new a.k("data", Object.assign(Object.assign({}, M), { sourceDataType: "metadata" }))), this.fire(new a.k("data", Object.assign(Object.assign({}, M), { sourceDataType: "content" })));
} catch (v) {
if (this._pendingLoads--, this._removed)
return void this.fire(new a.k("dataabort", { dataType: "source" }));
this.fire(new a.j(v));
}
});
}
loaded() {
return this._pendingLoads === 0;
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.actor ? "RT" : "LT";
l.actor = this.actor;
const v = { type: this.type, uid: l.uid, tileID: l.tileID, zoom: l.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
l.abortController = new AbortController();
const b = yield this.actor.sendAsync({ type: m, data: v }, l.abortController);
delete l.abortController, l.unloadVectorData(), l.aborted || l.loadVectorData(b, this.map.painter, m === "RT");
});
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController), l.aborted = !0;
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.unloadVectorData(), yield this.actor.sendAsync({ type: "RMT", data: { uid: l.uid, type: this.type, source: this.id } });
});
}
onRemove() {
this._removed = !0, this.actor.sendAsync({ type: "RS", data: { type: this.type, source: this.id } });
}
serialize() {
return a.e({}, this._options, { type: this.type, data: this._data });
}
hasTransition() {
return !1;
}
}
var ji = a.Y([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]);
class Ji extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.dispatcher = v, this.coordinates = m.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = !1, this.setEventedParent(b), this.options = m;
}
load(l) {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this.url = this.options.url, this._request = new AbortController();
try {
const m = yield k.getImage(this.map._requestManager.transformRequest(this.url, "Image"), this._request);
this._request = null, this._loaded = !0, m && m.data && (this.image = m.data, l && (this.coordinates = l), this._finishLoading());
} catch (m) {
this._request = null, this._loaded = !0, this.fire(new a.j(m));
}
});
}
loaded() {
return this._loaded;
}
updateImage(l) {
return l.url ? (this._request && (this._request.abort(), this._request = null), this.options.url = l.url, this.load(l.coordinates).finally(() => {
this.texture = null;
}), this) : this;
}
_finishLoading() {
this.map && (this.setCoordinates(this.coordinates), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })));
}
onAdd(l) {
this.map = l, this.load();
}
onRemove() {
this._request && (this._request.abort(), this._request = null);
}
setCoordinates(l) {
this.coordinates = l;
const m = l.map(a.Z.fromLngLat);
this.tileID = function(b) {
let M = 1 / 0, V = 1 / 0, D = -1 / 0, j = -1 / 0;
for (const lt of b)
M = Math.min(M, lt.x), V = Math.min(V, lt.y), D = Math.max(D, lt.x), j = Math.max(j, lt.y);
const Z = Math.max(D - M, j - V), Y = Math.max(0, Math.floor(-Math.log(Z) / Math.LN2)), J = Math.pow(2, Y);
return new a.a1(Y, Math.floor((M + D) / 2 * J), Math.floor((V + j) / 2 * J));
}(m), this.minzoom = this.maxzoom = this.tileID.z;
const v = m.map((b) => this.tileID.getTilePoint(b)._round());
return this._boundsArray = new a.$(), this._boundsArray.emplaceBack(v[0].x, v[0].y, 0, 0), this._boundsArray.emplaceBack(v[1].x, v[1].y, a.X, 0), this._boundsArray.emplaceBack(v[3].x, v[3].y, 0, a.X), this._boundsArray.emplaceBack(v[2].x, v[2].y, a.X, a.X), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })), this;
}
prepare() {
if (Object.keys(this.tiles).length === 0 || !this.image)
return;
const l = this.map.painter.context, m = l.gl;
this.boundsBuffer || (this.boundsBuffer = l.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new rt(l, this.image, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = !0);
}
v && this.fire(new a.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
this.tileID && this.tileID.equals(l.tileID.canonical) ? (this.tiles[String(l.tileID.wrap)] = l, l.buckets = {}) : l.state = "errored";
});
}
serialize() {
return { type: "image", url: this.options.url, coordinates: this.coordinates };
}
hasTransition() {
return !1;
}
}
class ki extends Ji {
constructor(l, m, v, b) {
super(l, m, v, b), this.roundZoom = !0, this.type = "video", this.options = m;
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1;
const l = this.options;
this.urls = [];
for (const m of l.urls)
this.urls.push(this.map._requestManager.transformRequest(m, "Source").url);
try {
const m = yield a.a3(this.urls);
if (this._loaded = !0, !m)
return;
this.video = m, this.video.loop = !0, this.video.addEventListener("playing", () => {
this.map.triggerRepaint();
}), this.map && this.video.play(), this._finishLoading();
} catch (m) {
this.fire(new a.j(m));
}
});
}
pause() {
this.video && this.video.pause();
}
play() {
this.video && this.video.play();
}
seek(l) {
if (this.video) {
const m = this.video.seekable;
l < m.start(0) || l > m.end(0) ? this.fire(new a.j(new a.a2(`sources.${this.id}`, null, `Playback for this video can be set only between the ${m.start(0)} and ${m.end(0)}-second mark.`))) : this.video.currentTime = l;
}
}
getVideo() {
return this.video;
}
onAdd(l) {
this.map || (this.map = l, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));
}
prepare() {
if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2)
return;
const l = this.map.painter.context, m = l.gl;
this.boundsBuffer || (this.boundsBuffer = l.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture ? this.video.paused || (this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE), m.texSubImage2D(m.TEXTURE_2D, 0, 0, 0, m.RGBA, m.UNSIGNED_BYTE, this.video)) : (this.texture = new rt(l, this.video, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = !0);
}
v && this.fire(new a.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
}
serialize() {
return { type: "video", urls: this.urls, coordinates: this.coordinates };
}
hasTransition() {
return this.video && !this.video.paused;
}
}
class _i extends Ji {
constructor(l, m, v, b) {
super(l, m, v, b), m.coordinates ? Array.isArray(m.coordinates) && m.coordinates.length === 4 && !m.coordinates.some((M) => !Array.isArray(M) || M.length !== 2 || M.some((V) => typeof V != "number")) || this.fire(new a.j(new a.a2(`sources.${l}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new a.j(new a.a2(`sources.${l}`, null, 'missing required property "coordinates"'))), m.animate && typeof m.animate != "boolean" && this.fire(new a.j(new a.a2(`sources.${l}`, null, 'optional "animate" property must be a boolean value'))), m.canvas ? typeof m.canvas == "string" || m.canvas instanceof HTMLCanvasElement || this.fire(new a.j(new a.a2(`sources.${l}`, 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 a.j(new a.a2(`sources.${l}`, null, 'missing required property "canvas"'))), this.options = m, this.animate = m.animate === void 0 || m.animate;
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !0, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new a.j(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
this._playing = !0, this.map.triggerRepaint();
}, this.pause = function() {
this._playing && (this.prepare(), this._playing = !1);
}, this._finishLoading());
});
}
getCanvas() {
return this.canvas;
}
onAdd(l) {
this.map = l, this.load(), this.canvas && this.animate && this.play();
}
onRemove() {
this.pause();
}
prepare() {
let l = !1;
if (this.canvas.width !== this.width && (this.width = this.canvas.width, l = !0), this.canvas.height !== this.height && (this.height = this.canvas.height, l = !0), this._hasInvalidDimensions() || Object.keys(this.tiles).length === 0)
return;
const m = this.map.painter.context, v = m.gl;
this.boundsBuffer || (this.boundsBuffer = m.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture ? (l || this._playing) && this.texture.update(this.canvas, { premultiply: !0 }) : this.texture = new rt(m, this.canvas, v.RGBA, { premultiply: !0 });
let b = !1;
for (const M in this.tiles) {
const V = this.tiles[M];
V.state !== "loaded" && (V.state = "loaded", V.texture = this.texture, b = !0);
}
b && this.fire(new a.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
}
serialize() {
return { type: "canvas", coordinates: this.coordinates };
}
hasTransition() {
return this._playing;
}
_hasInvalidDimensions() {
for (const l of [this.canvas.width, this.canvas.height])
if (isNaN(l) || l <= 0)
return !0;
return !1;
}
}
const Ii = {}, c1 = (S) => {
switch (S) {
case "geojson":
return dn;
case "image":
return Ji;
case "raster":
return Hr;
case "raster-dem":
return Rr;
case "vector":
return Jr;
case "video":
return ki;
case "canvas":
return _i;
}
return Ii[S];
}, ye = "RTLPluginLoaded";
class bi extends a.E {
constructor() {
super(...arguments), this.status = "unavailable", this.url = null, this.dispatcher = Ge();
}
_syncState(l) {
return this.status = l, this.dispatcher.broadcast("SRPS", { pluginStatus: l, pluginURL: this.url }).catch((m) => {
throw this.status = "error", m;
});
}
getRTLTextPluginStatus() {
return this.status;
}
clearRTLTextPlugin() {
this.status = "unavailable", this.url = null;
}
setRTLTextPlugin(l) {
return a._(this, arguments, void 0, function* (m, v = !1) {
if (this.url)
throw new Error("setRTLTextPlugin cannot be called multiple times.");
if (this.url = f.resolveURL(m), !this.url)
throw new Error(`requested url ${m} is invalid`);
if (this.status === "unavailable") {
if (!v)
return this._requestImport();
this.status = "deferred", this._syncState(this.status);
} else if (this.status === "requested")
return this._requestImport();
});
}
_requestImport() {
return a._(this, void 0, void 0, function* () {
yield this._syncState("loading"), this.status = "loaded", this.fire(new a.k(ye));
});
}
lazyLoad() {
this.status === "unavailable" ? this.status = "requested" : this.status === "deferred" && this._requestImport();
}
}
let Xn = null;
function Hi() {
return Xn || (Xn = new bi()), Xn;
}
class t1 {
constructor(l, m) {
this.timeAdded = 0, this.fadeEndTime = 0, this.tileID = l, this.uid = a.a4(), this.uses = 0, this.tileSize = m, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = !1, this.hasRTLText = !1, this.dependencies = {}, this.rtt = [], this.rttCoords = {}, this.expiredRequestCount = 0, this.state = "loading";
}
registerFadeDuration(l) {
const m = l + this.timeAdded;
m < this.fadeEndTime || (this.fadeEndTime = m);
}
wasRequested() {
return this.state === "errored" || this.state === "loaded" || this.state === "reloading";
}
clearTextures(l) {
this.demTexture && l.saveTileTexture(this.demTexture), this.demTexture = null;
}
loadVectorData(l, m, v) {
if (this.hasData() && this.unloadVectorData(), this.state = "loaded", l) {
l.featureIndex && (this.latestFeatureIndex = l.featureIndex, l.rawTileData ? (this.latestRawTileData = l.rawTileData, this.latestFeatureIndex.rawTileData = l.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = l.collisionBoxArray, this.buckets = function(b, M) {
const V = {};
if (!M)
return V;
for (const D of b) {
const j = D.layerIds.map((Z) => M.getLayer(Z)).filter(Boolean);
if (j.length !== 0) {
D.layers = j, D.stateDependentLayerIds && (D.stateDependentLayers = D.stateDependentLayerIds.map((Z) => j.filter((Y) => Y.id === Z)[0]));
for (const Z of j)
V[Z.id] = D;
}
}
return V;
}(l.buckets, m.style), this.hasSymbolBuckets = !1;
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6) {
if (this.hasSymbolBuckets = !0, !v)
break;
M.justReloaded = !0;
}
}
if (this.hasRTLText = !1, this.hasSymbolBuckets)
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6 && M.hasRTLText) {
this.hasRTLText = !0, Hi().lazyLoad();
break;
}
}
this.queryPadding = 0;
for (const b in this.buckets) {
const M = this.buckets[b];
this.queryPadding = Math.max(this.queryPadding, m.style.getLayer(b).queryRadius(M));
}
l.imageAtlas && (this.imageAtlas = l.imageAtlas), l.glyphAtlasImage && (this.glyphAtlasImage = l.glyphAtlasImage);
} else
this.collisionBoxArray = new a.a5();
}
unloadVectorData() {
for (const l in this.buckets)
this.buckets[l].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(l) {
return this.buckets[l.id];
}
upload(l) {
for (const v in this.buckets) {
const b = this.buckets[v];
b.uploadPending() && b.upload(l);
}
const m = l.gl;
this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new rt(l, this.imageAtlas.image, m.RGBA), this.imageAtlas.uploaded = !0), this.glyphAtlasImage && (this.glyphAtlasTexture = new rt(l, this.glyphAtlasImage, m.ALPHA), this.glyphAtlasImage = null);
}
prepare(l) {
this.imageAtlas && this.imageAtlas.patchUpdatedImages(l, this.imageAtlasTexture);
}
queryRenderedFeatures(l, m, v, b, M, V, D, j, Z, Y) {
return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: b, cameraQueryGeometry: M, scale: V, tileSize: this.tileSize, pixelPosMatrix: Y, transform: j, params: D, queryPadding: this.queryPadding * Z }, l, m, v) : {};
}
querySourceFeatures(l, m) {
const v = this.latestFeatureIndex;
if (!v || !v.rawTileData)
return;
const b = v.loadVTLayers(), M = m && m.sourceLayer ? m.sourceLayer : "", V = b._geojsonTileLayer || b[M];
if (!V)
return;
const D = a.a7(m && m.filter), { z: j, x: Z, y: Y } = this.tileID.canonical, J = { z: j, x: Z, y: Y };
for (let lt = 0; lt < V.length; lt++) {
const ft = V.feature(lt);
if (D.needGeometry) {
const Mt = a.a8(ft, !0);
if (!D.filter(new a.z(this.tileID.overscaledZ), Mt, this.tileID.canonical))
continue;
} else if (!D.filter(new a.z(this.tileID.overscaledZ), ft))
continue;
const Qt = v.getId(ft, M), wt = new a.a9(ft, j, Z, Y, Qt);
wt.tile = J, l.push(wt);
}
}
hasData() {
return this.state === "loaded" || this.state === "reloading" || this.state === "expired";
}
patternsLoaded() {
return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;
}
setExpiryData(l) {
const m = this.expirationTime;
if (l.cacheControl) {
const v = a.aa(l.cacheControl);
v["max-age"] && (this.expirationTime = Date.now() + 1e3 * v["max-age"]);
} else
l.expires && (this.expirationTime = new Date(l.expires).getTime());
if (this.expirationTime) {
const v = Date.now();
let b = !1;
if (this.expirationTime > v)
b = !1;
else if (m)
if (this.expirationTime < m)
b = !0;
else {
const M = this.expirationTime - m;
M ? this.expirationTime = v + Math.max(M, 3e4) : b = !0;
}
else
b = !0;
b ? (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(l, m) {
if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || Object.keys(l).length === 0)
return;
const v = this.latestFeatureIndex.loadVTLayers();
for (const b in this.buckets) {
if (!m.style.hasLayer(b))
continue;
const M = this.buckets[b], V = M.layers[0].sourceLayer || "_geojsonTileLayer", D = v[V], j = l[V];
if (!D || !j || Object.keys(j).length === 0)
continue;
M.update(j, D, this.imageAtlas && this.imageAtlas.patternPositions || {});
const Z = m && m.style && m.style.getLayer(b);
Z && (this.queryPadding = Math.max(this.queryPadding, Z.queryRadius(M)));
}
}
holdingForFade() {
return this.symbolFadeHoldUntil !== void 0;
}
symbolFadeFinished() {
return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < f.now();
}
clearFadeHold() {
this.symbolFadeHoldUntil = void 0;
}
setHoldDuration(l) {
this.symbolFadeHoldUntil = f.now() + l;
}
setDependencies(l, m) {
const v = {};
for (const b of m)
v[b] = !0;
this.dependencies[l] = v;
}
hasDependency(l, m) {
for (const v of l) {
const b = this.dependencies[v];
if (b) {
for (const M of m)
if (b[M])
return !0;
}
}
return !1;
}
}
class xe {
constructor(l, m) {
this.max = l, this.onRemove = m, this.reset();
}
reset() {
for (const l in this.data)
for (const m of this.data[l])
m.timeout && clearTimeout(m.timeout), this.onRemove(m.value);
return this.data = {}, this.order = [], this;
}
add(l, m, v) {
const b = l.wrapped().key;
this.data[b] === void 0 && (this.data[b] = []);
const M = { value: m, timeout: void 0 };
if (v !== void 0 && (M.timeout = setTimeout(() => {
this.remove(l, M);
}, v)), this.data[b].push(M), this.order.push(b), this.order.length > this.max) {
const V = this._getAndRemoveByKey(this.order[0]);
V && this.onRemove(V);
}
return this;
}
has(l) {
return l.wrapped().key in this.data;
}
getAndRemove(l) {
return this.has(l) ? this._getAndRemoveByKey(l.wrapped().key) : null;
}
_getAndRemoveByKey(l) {
const m = this.data[l].shift();
return m.timeout && clearTimeout(m.timeout), this.data[l].length === 0 && delete this.data[l], this.order.splice(this.order.indexOf(l), 1), m.value;
}
getByKey(l) {
const m = this.data[l];
return m ? m[0].value : null;
}
get(l) {
return this.has(l) ? this.data[l.wrapped().key][0].value : null;
}
remove(l, m) {
if (!this.has(l))
return this;
const v = l.wrapped().key, b = m === void 0 ? 0 : this.data[v].indexOf(m), M = this.data[v][b];
return this.data[v].splice(b, 1), M.timeout && clearTimeout(M.timeout), this.data[v].length === 0 && delete this.data[v], this.onRemove(M.value), this.order.splice(this.order.indexOf(v), 1), this;
}
setMaxSize(l) {
for (this.max = l; this.order.length > this.max; ) {
const m = this._getAndRemoveByKey(this.order[0]);
m && this.onRemove(m);
}
return this;
}
filter(l) {
const m = [];
for (const v in this.data)
for (const b of this.data[v])
l(b.value) || m.push(b);
for (const v of m)
this.remove(v.value.tileID, v);
}
}
class Dr {
constructor() {
this.state = {}, this.stateChanges = {}, this.deletedStates = {};
}
updateState(l, m, v) {
const b = String(m);
if (this.stateChanges[l] = this.stateChanges[l] || {}, this.stateChanges[l][b] = this.stateChanges[l][b] || {}, a.e(this.stateChanges[l][b], v), this.deletedStates[l] === null) {
this.deletedStates[l] = {};
for (const M in this.state[l])
M !== b && (this.deletedStates[l][M] = null);
} else if (this.deletedStates[l] && this.deletedStates[l][b] === null) {
this.deletedStates[l][b] = {};
for (const M in this.state[l][b])
v[M] || (this.deletedStates[l][b][M] = null);
} else
for (const M in v)
this.deletedStates[l] && this.deletedStates[l][b] && this.deletedStates[l][b][M] === null && delete this.deletedStates[l][b][M];
}
removeFeatureState(l, m, v) {
if (this.deletedStates[l] === null)
return;
const b = String(m);
if (this.deletedStates[l] = this.deletedStates[l] || {}, v && m !== void 0)
this.deletedStates[l][b] !== null && (this.deletedStates[l][b] = this.deletedStates[l][b] || {}, this.deletedStates[l][b][v] = null);
else if (m !== void 0)
if (this.stateChanges[l] && this.stateChanges[l][b])
for (v in this.deletedStates[l][b] = {}, this.stateChanges[l][b])
this.deletedStates[l][b][v] = null;
else
this.deletedStates[l][b] = null;
else
this.deletedStates[l] = null;
}
getState(l, m) {
const v = String(m), b = a.e({}, (this.state[l] || {})[v], (this.stateChanges[l] || {})[v]);
if (this.deletedStates[l] === null)
return {};
if (this.deletedStates[l]) {
const M = this.deletedStates[l][m];
if (M === null)
return {};
for (const V in M)
delete b[V];
}
return b;
}
initializeTileState(l, m) {
l.setFeatureState(this.state, m);
}
coalesceChanges(l, m) {
const v = {};
for (const b in this.stateChanges) {
this.state[b] = this.state[b] || {};
const M = {};
for (const V in this.stateChanges[b])
this.state[b][V] || (this.state[b][V] = {}), a.e(this.state[b][V], this.stateChanges[b][V]), M[V] = this.state[b][V];
v[b] = M;
}
for (const b in this.deletedStates) {
this.state[b] = this.state[b] || {};
const M = {};
if (this.deletedStates[b] === null)
for (const V in this.state[b])
M[V] = {}, this.state[b][V] = {};
else
for (const V in this.deletedStates[b]) {
if (this.deletedStates[b][V] === null)
this.state[b][V] = {};
else
for (const D of Object.keys(this.deletedStates[b][V]))
delete this.state[b][V][D];
M[V] = this.state[b][V];
}
v[b] = v[b] || {}, a.e(v[b], M);
}
if (this.stateChanges = {}, this.deletedStates = {}, Object.keys(v).length !== 0)
for (const b in l)
l[b].setFeatureState(v, m);
}
}
class _r extends a.E {
constructor(l, m, v) {
super(), this.id = l, this.dispatcher = v, this.on("data", (b) => this._dataHandler(b)), this.on("dataloading", () => {
this._sourceErrored = !1;
}), this.on("error", () => {
this._sourceErrored = this._source.loaded();
}), this._source = ((b, M, V, D) => {
const j = new (c1(M.type))(b, M, V, D);
if (j.id !== b)
throw new Error(`Expected Source id to be ${b} instead of ${j.id}`);
return j;
})(l, m, v, this), this._tiles = {}, this._cache = new xe(0, (b) => this._unloadTile(b)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new Dr(), this._didEmitContent = !1, this._updated = !1;
}
onAdd(l) {
this.map = l, this._maxTileCacheSize = l ? l._maxTileCacheSize : null, this._maxTileCacheZoomLevels = l ? l._maxTileCacheZoomLevels : null, this._source && this._source.onAdd && this._source.onAdd(l);
}
onRemove(l) {
this.clearTiles(), this._source && this._source.onRemove && this._source.onRemove(l);
}
loaded() {
if (this._sourceErrored)
return !0;
if (!this._sourceLoaded || !this._source.loaded())
return !1;
if (!(this.used === void 0 && this.usedForTerrain === void 0 || this.used || this.usedForTerrain))
return !0;
if (!this._updated)
return !1;
for (const l in this._tiles) {
const m = this._tiles[l];
if (m.state !== "loaded" && m.state !== "errored")
return !1;
}
return !0;
}
getSource() {
return this._source;
}
pause() {
this._paused = !0;
}
resume() {
if (!this._paused)
return;
const l = this._shouldReloadOnResume;
this._paused = !1, this._shouldReloadOnResume = !1, l && this.reload(), this.transform && this.update(this.transform, this.terrain);
}
_loadTile(l, m, v) {
return a._(this, void 0, void 0, function* () {
try {
yield this._source.loadTile(l), this._tileLoaded(l, m, v);
} catch (b) {
l.state = "errored", b.status !== 404 ? this._source.fire(new a.j(b, { tile: l })) : this.update(this.transform, this.terrain);
}
});
}
_unloadTile(l) {
this._source.unloadTile && this._source.unloadTile(l);
}
_abortTile(l) {
this._source.abortTile && this._source.abortTile(l), this._source.fire(new a.k("dataabort", { tile: l, coord: l.tileID, dataType: "source" }));
}
serialize() {
return this._source.serialize();
}
prepare(l) {
this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);
for (const m in this._tiles) {
const v = this._tiles[m];
v.upload(l), v.prepare(this.map.style.imageManager);
}
}
getIds() {
return Object.values(this._tiles).map((l) => l.tileID).sort(Vn).map((l) => l.key);
}
getRenderableIds(l) {
const m = [];
for (const v in this._tiles)
this._isIdRenderable(v, l) && m.push(this._tiles[v]);
return l ? m.sort((v, b) => {
const M = v.tileID, V = b.tileID, D = new a.P(M.canonical.x, M.canonical.y)._rotate(this.transform.angle), j = new a.P(V.canonical.x, V.canonical.y)._rotate(this.transform.angle);
return M.overscaledZ - V.overscaledZ || j.y - D.y || j.x - D.x;
}).map((v) => v.tileID.key) : m.map((v) => v.tileID).sort(Vn).map((v) => v.key);
}
hasRenderableParent(l) {
const m = this.findLoadedParent(l, 0);
return !!m && this._isIdRenderable(m.tileID.key);
}
_isIdRenderable(l, m) {
return this._tiles[l] && this._tiles[l].hasData() && !this._coveredTiles[l] && (m || !this._tiles[l].holdingForFade());
}
reload() {
if (this._paused)
this._shouldReloadOnResume = !0;
else {
this._cache.reset();
for (const l in this._tiles)
this._tiles[l].state !== "errored" && this._reloadTile(l, "reloading");
}
}
_reloadTile(l, m) {
return a._(this, void 0, void 0, function* () {
const v = this._tiles[l];
v && (v.state !== "loading" && (v.state = m), yield this._loadTile(v, l, m));
});
}
_tileLoaded(l, m, v) {
l.timeAdded = f.now(), v === "expired" && (l.refreshedUponExpiration = !0), this._setTileReloadTimer(m, l), this.getSource().type === "raster-dem" && l.dem && this._backfillDEM(l), this._state.initializeTileState(l, this.map ? this.map.painter : null), l.aborted || this._source.fire(new a.k("data", { dataType: "source", tile: l, coord: l.tileID }));
}
_backfillDEM(l) {
const m = this.getRenderableIds();
for (let b = 0; b < m.length; b++) {
const M = m[b];
if (l.neighboringTiles && l.neighboringTiles[M]) {
const V = this.getTileByID(M);
v(l, V), v(V, l);
}
}
function v(b, M) {
b.needsHillshadePrepare = !0, b.needsTerrainPrepare = !0;
let V = M.tileID.canonical.x - b.tileID.canonical.x;
const D = M.tileID.canonical.y - b.tileID.canonical.y, j = Math.pow(2, b.tileID.canonical.z), Z = M.tileID.key;
V === 0 && D === 0 || Math.abs(D) > 1 || (Math.abs(V) > 1 && (Math.abs(V + j) === 1 ? V += j : Math.abs(V - j) === 1 && (V -= j)), M.dem && b.dem && (b.dem.backfillBorder(M.dem, V, D), b.neighboringTiles && b.neighboringTiles[Z] && (b.neighboringTiles[Z].backfilled = !0)));
}
}
getTile(l) {
return this.getTileByID(l.key);
}
getTileByID(l) {
return this._tiles[l];
}
_retainLoadedChildren(l, m, v, b) {
for (const M in this._tiles) {
let V = this._tiles[M];
if (b[M] || !V.hasData() || V.tileID.overscaledZ <= m || V.tileID.overscaledZ > v)
continue;
let D = V.tileID;
for (; V && V.tileID.overscaledZ > m + 1; ) {
const Z = V.tileID.scaledTo(V.tileID.overscaledZ - 1);
V = this._tiles[Z.key], V && V.hasData() && (D = Z);
}
let j = D;
for (; j.overscaledZ > m; )
if (j = j.scaledTo(j.overscaledZ - 1), l[j.key]) {
b[D.key] = D;
break;
}
}
}
findLoadedParent(l, m) {
if (l.key in this._loadedParentTiles) {
const v = this._loadedParentTiles[l.key];
return v && v.tileID.overscaledZ >= m ? v : null;
}
for (let v = l.overscaledZ - 1; v >= m; v--) {
const b = l.scaledTo(v), M = this._getLoadedTile(b);
if (M)
return M;
}
}
findLoadedSibling(l) {
return this._getLoadedTile(l);
}
_getLoadedTile(l) {
const m = this._tiles[l.key];
return m && m.hasData() ? m : this._cache.getByKey(l.wrapped().key);
}
updateCacheSize(l) {
const m = Math.ceil(l.width / this._source.tileSize) + 1, v = Math.ceil(l.height / this._source.tileSize) + 1, b = Math.floor(m * v * (this._maxTileCacheZoomLevels === null ? a.a.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels)), M = typeof this._maxTileCacheSize == "number" ? Math.min(this._maxTileCacheSize, b) : b;
this._cache.setMaxSize(M);
}
handleWrapJump(l) {
const m = Math.round((l - (this._prevLng === void 0 ? l : this._prevLng)) / 360);
if (this._prevLng = l, m) {
const v = {};
for (const b in this._tiles) {
const M = this._tiles[b];
M.tileID = M.tileID.unwrapTo(M.tileID.wrap + m), v[M.tileID.key] = M;
}
this._tiles = v;
for (const b in this._timers)
clearTimeout(this._timers[b]), delete this._timers[b];
for (const b in this._tiles)
this._setTileReloadTimer(b, this._tiles[b]);
}
}
_updateCoveredAndRetainedTiles(l, m, v, b, M, V) {
const D = {}, j = {}, Z = Object.keys(l), Y = f.now();
for (const J of Z) {
const lt = l[J], ft = this._tiles[J];
if (!ft || ft.fadeEndTime !== 0 && ft.fadeEndTime <= Y)
continue;
const Qt = this.findLoadedParent(lt, m), wt = this.findLoadedSibling(lt), Mt = Qt || wt || null;
Mt && (this._addTile(Mt.tileID), D[Mt.tileID.key] = Mt.tileID), j[J] = lt;
}
this._retainLoadedChildren(j, b, v, l);
for (const J in D)
l[J] || (this._coveredTiles[J] = !0, l[J] = D[J]);
if (V) {
const J = {}, lt = {};
for (const ft of M)
this._tiles[ft.key].hasData() ? J[ft.key] = ft : lt[ft.key] = ft;
for (const ft in lt) {
const Qt = lt[ft].children(this._source.maxzoom);
this._tiles[Qt[0].key] && this._tiles[Qt[1].key] && this._tiles[Qt[2].key] && this._tiles[Qt[3].key] && (J[Qt[0].key] = l[Qt[0].key] = Qt[0], J[Qt[1].key] = l[Qt[1].key] = Qt[1], J[Qt[2].key] = l[Qt[2].key] = Qt[2], J[Qt[3].key] = l[Qt[3].key] = Qt[3], delete lt[ft]);
}
for (const ft in lt) {
const Qt = lt[ft], wt = this.findLoadedParent(Qt, this._source.minzoom), Mt = this.findLoadedSibling(Qt), Ht = wt || Mt || null;
if (Ht) {
J[Ht.tileID.key] = l[Ht.tileID.key] = Ht.tileID;
for (const Ot in J)
J[Ot].isChildOf(Ht.tileID) && delete J[Ot];
}
}
for (const ft in this._tiles)
J[ft] || (this._coveredTiles[ft] = !0);
}
}
update(l, m) {
if (!this._sourceLoaded || this._paused)
return;
let v;
this.transform = l, this.terrain = m, this.updateCacheSize(l), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used || this.usedForTerrain ? this._source.tileID ? v = l.getVisibleUnwrappedCoordinates(this._source.tileID).map((Y) => new a.S(Y.canonical.z, Y.wrap, Y.canonical.z, Y.canonical.x, Y.canonical.y)) : (v = l.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: m }), this._source.hasTile && (v = v.filter((Y) => this._source.hasTile(Y)))) : v = [];
const b = l.coveringZoomLevel(this._source), M = Math.max(b - _r.maxOverzooming, this._source.minzoom), V = Math.max(b + _r.maxUnderzooming, this._source.minzoom);
if (this.usedForTerrain) {
const Y = {};
for (const J of v)
if (J.canonical.z > this._source.minzoom) {
const lt = J.scaledTo(J.canonical.z - 1);
Y[lt.key] = lt;
const ft = J.scaledTo(Math.max(this._source.minzoom, Math.min(J.canonical.z, 5)));
Y[ft.key] = ft;
}
v = v.concat(Object.values(Y));
}
const D = v.length === 0 && !this._updated && this._didEmitContent;
this._updated = !0, D && this.fire(new a.k("data", { sourceDataType: "idle", dataType: "source", sourceId: this.id }));
const j = this._updateRetainedTiles(v, b);
y1(this._source.type) && this._updateCoveredAndRetainedTiles(j, M, V, b, v, m);
for (const Y in j)
this._tiles[Y].clearFadeHold();
const Z = a.ab(this._tiles, j);
for (const Y of Z) {
const J = this._tiles[Y];
J.hasSymbolBuckets && !J.holdingForFade() ? J.setHoldDuration(this.map._fadeDuration) : J.hasSymbolBuckets && !J.symbolFadeFinished() || this._removeTile(Y);
}
this._updateLoadedParentTileCache(), this._updateLoadedSiblingTileCache();
}
releaseSymbolFadeTiles() {
for (const l in this._tiles)
this._tiles[l].holdingForFade() && this._removeTile(l);
}
_updateRetainedTiles(l, m) {
var v;
const b = {}, M = {}, V = Math.max(m - _r.maxOverzooming, this._source.minzoom), D = Math.max(m + _r.maxUnderzooming, this._source.minzoom), j = {};
for (const Z of l) {
const Y = this._addTile(Z);
b[Z.key] = Z, Y.hasData() || m < this._source.maxzoom && (j[Z.key] = Z);
}
this._retainLoadedChildren(j, m, D, b);
for (const Z of l) {
let Y = this._tiles[Z.key];
if (Y.hasData())
continue;
if (m + 1 > this._source.maxzoom) {
const lt = Z.children(this._source.maxzoom)[0], ft = this.getTile(lt);
if (ft && ft.hasData()) {
b[lt.key] = lt;
continue;
}
} else {
const lt = Z.children(this._source.maxzoom);
if (b[lt[0].key] && b[lt[1].key] && b[lt[2].key] && b[lt[3].key])
continue;
}
let J = Y.wasRequested();
for (let lt = Z.overscaledZ - 1; lt >= V; --lt) {
const ft = Z.scaledTo(lt);
if (M[ft.key])
break;
if (M[ft.key] = !0, Y = this.getTile(ft), !Y && J && (Y = this._addTile(ft)), Y) {
const Qt = Y.hasData();
if ((Qt || !(!((v = this.map) === null || v === void 0) && v.cancelPendingTileRequestsWhileZooming) || J) && (b[ft.key] = ft), J = Y.wasRequested(), Qt)
break;
}
}
}
return b;
}
_updateLoadedParentTileCache() {
this._loadedParentTiles = {};
for (const l in this._tiles) {
const m = [];
let v, b = this._tiles[l].tileID;
for (; b.overscaledZ > 0; ) {
if (b.key in this._loadedParentTiles) {
v = this._loadedParentTiles[b.key];
break;
}
m.push(b.key);
const M = b.scaledTo(b.overscaledZ - 1);
if (v = this._getLoadedTile(M), v)
break;
b = M;
}
for (const M of m)
this._loadedParentTiles[M] = v;
}
}
_updateLoadedSiblingTileCache() {
this._loadedSiblingTiles = {};
for (const l in this._tiles) {
const m = this._tiles[l].tileID, v = this._getLoadedTile(m);
this._loadedSiblingTiles[m.key] = v;
}
}
_addTile(l) {
let m = this._tiles[l.key];
if (m)
return m;
m = this._cache.getAndRemove(l), m && (this._setTileReloadTimer(l.key, m), m.tileID = l, this._state.initializeTileState(m, this.map ? this.map.painter : null), this._cacheTimers[l.key] && (clearTimeout(this._cacheTimers[l.key]), delete this._cacheTimers[l.key], this._setTileReloadTimer(l.key, m)));
const v = m;
return m || (m = new t1(l, this._source.tileSize * l.overscaleFactor()), this._loadTile(m, l.key, m.state)), m.uses++, this._tiles[l.key] = m, v || this._source.fire(new a.k("dataloading", { tile: m, coord: m.tileID, dataType: "source" })), m;
}
_setTileReloadTimer(l, m) {
l in this._timers && (clearTimeout(this._timers[l]), delete this._timers[l]);
const v = m.getExpiryTimeout();
v && (this._timers[l] = setTimeout(() => {
this._reloadTile(l, "expired"), delete this._timers[l];
}, v));
}
_removeTile(l) {
const m = this._tiles[l];
m && (m.uses--, delete this._tiles[l], this._timers[l] && (clearTimeout(this._timers[l]), delete this._timers[l]), m.uses > 0 || (m.hasData() && m.state !== "reloading" ? this._cache.add(m.tileID, m, m.getExpiryTimeout()) : (m.aborted = !0, this._abortTile(m), this._unloadTile(m))));
}
_dataHandler(l) {
const m = l.sourceDataType;
l.dataType === "source" && m === "metadata" && (this._sourceLoaded = !0), this._sourceLoaded && !this._paused && l.dataType === "source" && m === "content" && (this.reload(), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = !0);
}
clearTiles() {
this._shouldReloadOnResume = !1, this._paused = !1;
for (const l in this._tiles)
this._removeTile(l);
this._cache.reset();
}
tilesIn(l, m, v) {
const b = [], M = this.transform;
if (!M)
return b;
const V = v ? M.getCameraQueryGeometry(l) : l, D = l.map((Qt) => M.pointCoordinate(Qt, this.terrain)), j = V.map((Qt) => M.pointCoordinate(Qt, this.terrain)), Z = this.getIds();
let Y = 1 / 0, J = 1 / 0, lt = -1 / 0, ft = -1 / 0;
for (const Qt of j)
Y = Math.min(Y, Qt.x), J = Math.min(J, Qt.y), lt = Math.max(lt, Qt.x), ft = Math.max(ft, Qt.y);
for (let Qt = 0; Qt < Z.length; Qt++) {
const wt = this._tiles[Z[Qt]];
if (wt.holdingForFade())
continue;
const Mt = wt.tileID, Ht = Math.pow(2, M.zoom - wt.tileID.overscaledZ), Ot = m * wt.queryPadding * a.X / wt.tileSize / Ht, bt = [Mt.getTilePoint(new a.Z(Y, J)), Mt.getTilePoint(new a.Z(lt, ft))];
if (bt[0].x - Ot < a.X && bt[0].y - Ot < a.X && bt[1].x + Ot >= 0 && bt[1].y + Ot >= 0) {
const Nt = D.map((Wt) => Mt.getTilePoint(Wt)), Dt = j.map((Wt) => Mt.getTilePoint(Wt));
b.push({ tile: wt, tileID: Mt, queryGeometry: Nt, cameraQueryGeometry: Dt, scale: Ht });
}
}
return b;
}
getVisibleCoordinates(l) {
const m = this.getRenderableIds(l).map((v) => this._tiles[v].tileID);
for (const v of m)
v.posMatrix = this.transform.calculatePosMatrix(v.toUnwrapped());
return m;
}
hasTransition() {
if (this._source.hasTransition())
return !0;
if (y1(this._source.type)) {
const l = f.now();
for (const m in this._tiles)
if (this._tiles[m].fadeEndTime >= l)
return !0;
}
return !1;
}
setFeatureState(l, m, v) {
this._state.updateState(l = l || "_geojsonTileLayer", m, v);
}
removeFeatureState(l, m, v) {
this._state.removeFeatureState(l = l || "_geojsonTileLayer", m, v);
}
getFeatureState(l, m) {
return this._state.getState(l = l || "_geojsonTileLayer", m);
}
setDependencies(l, m, v) {
const b = this._tiles[l];
b && b.setDependencies(m, v);
}
reloadTilesForDependencies(l, m) {
for (const v in this._tiles)
this._tiles[v].hasDependency(l, m) && this._reloadTile(v, "reloading");
this._cache.filter((v) => !v.hasDependency(l, m));
}
}
function Vn(S, l) {
const m = Math.abs(2 * S.wrap) - +(S.wrap < 0), v = Math.abs(2 * l.wrap) - +(l.wrap < 0);
return S.overscaledZ - l.overscaledZ || v - m || l.canonical.y - S.canonical.y || l.canonical.x - S.canonical.x;
}
function y1(S) {
return S === "raster" || S === "image" || S === "video";
}
_r.maxOverzooming = 10, _r.maxUnderzooming = 3;
class wr {
constructor(l, m) {
this.reset(l, m);
}
reset(l, m) {
this.points = l || [], this._distances = [0];
for (let v = 1; v < this.points.length; v++)
this._distances[v] = this._distances[v - 1] + this.points[v].dist(this.points[v - 1]);
this.length = this._distances[this._distances.length - 1], this.padding = Math.min(m || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;
}
lerp(l) {
if (this.points.length === 1)
return this.points[0];
l = a.ac(l, 0, 1);
let m = 1, v = this._distances[m];
const b = l * this.paddedLength + this.padding;
for (; v < b && m < this._distances.length; )
v = this._distances[++m];
const M = m - 1, V = this._distances[M], D = v - V, j = D > 0 ? (b - V) / D : 0;
return this.points[M].mult(1 - j).add(this.points[m].mult(j));
}
}
function Pi(S, l) {
let m = !0;
return S === "always" || S !== "never" && l !== "never" || (m = !1), m;
}
class H1 {
constructor(l, m, v) {
const b = this.boxCells = [], M = this.circleCells = [];
this.xCellCount = Math.ceil(l / v), this.yCellCount = Math.ceil(m / v);
for (let V = 0; V < this.xCellCount * this.yCellCount; V++)
b.push([]), M.push([]);
this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = l, this.height = m, this.xScale = this.xCellCount / l, this.yScale = this.yCellCount / m, this.boxUid = 0, this.circleUid = 0;
}
keysLength() {
return this.boxKeys.length + this.circleKeys.length;
}
insert(l, m, v, b, M) {
this._forEachCell(m, v, b, M, this._insertBoxCell, this.boxUid++), this.boxKeys.push(l), this.bboxes.push(m), this.bboxes.push(v), this.bboxes.push(b), this.bboxes.push(M);
}
insertCircle(l, m, v, b) {
this._forEachCell(m - b, v - b, m + b, v + b, this._insertCircleCell, this.circleUid++), this.circleKeys.push(l), this.circles.push(m), this.circles.push(v), this.circles.push(b);
}
_insertBoxCell(l, m, v, b, M, V) {
this.boxCells[M].push(V);
}
_insertCircleCell(l, m, v, b, M, V) {
this.circleCells[M].push(V);
}
_query(l, m, v, b, M, V, D) {
if (v < 0 || l > this.width || b < 0 || m > this.height)
return [];
const j = [];
if (l <= 0 && m <= 0 && this.width <= v && this.height <= b) {
if (M)
return [{ key: null, x1: l, y1: m, x2: v, y2: b }];
for (let Z = 0; Z < this.boxKeys.length; Z++)
j.push({ key: this.boxKeys[Z], x1: this.bboxes[4 * Z], y1: this.bboxes[4 * Z + 1], x2: this.bboxes[4 * Z + 2], y2: this.bboxes[4 * Z + 3] });
for (let Z = 0; Z < this.circleKeys.length; Z++) {
const Y = this.circles[3 * Z], J = this.circles[3 * Z + 1], lt = this.circles[3 * Z + 2];
j.push({ key: this.circleKeys[Z], x1: Y - lt, y1: J - lt, x2: Y + lt, y2: J + lt });
}
} else
this._forEachCell(l, m, v, b, this._queryCell, j, { hitTest: M, overlapMode: V, seenUids: { box: {}, circle: {} } }, D);
return j;
}
query(l, m, v, b) {
return this._query(l, m, v, b, !1, null);
}
hitTest(l, m, v, b, M, V) {
return this._query(l, m, v, b, !0, M, V).length > 0;
}
hitTestCircle(l, m, v, b, M) {
const V = l - v, D = l + v, j = m - v, Z = m + v;
if (D < 0 || V > this.width || Z < 0 || j > this.height)
return !1;
const Y = [];
return this._forEachCell(V, j, D, Z, this._queryCellCircle, Y, { hitTest: !0, overlapMode: b, circle: { x: l, y: m, radius: v }, seenUids: { box: {}, circle: {} } }, M), Y.length > 0;
}
_queryCell(l, m, v, b, M, V, D, j) {
const { seenUids: Z, hitTest: Y, overlapMode: J } = D, lt = this.boxCells[M];
if (lt !== null) {
const Qt = this.bboxes;
for (const wt of lt)
if (!Z.box[wt]) {
Z.box[wt] = !0;
const Mt = 4 * wt, Ht = this.boxKeys[wt];
if (l <= Qt[Mt + 2] && m <= Qt[Mt + 3] && v >= Qt[Mt + 0] && b >= Qt[Mt + 1] && (!j || j(Ht)) && (!Y || !Pi(J, Ht.overlapMode)) && (V.push({ key: Ht, x1: Qt[Mt], y1: Qt[Mt + 1], x2: Qt[Mt + 2], y2: Qt[Mt + 3] }), Y))
return !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Z.circle[wt]) {
Z.circle[wt] = !0;
const Mt = 3 * wt, Ht = this.circleKeys[wt];
if (this._circleAndRectCollide(Qt[Mt], Qt[Mt + 1], Qt[Mt + 2], l, m, v, b) && (!j || j(Ht)) && (!Y || !Pi(J, Ht.overlapMode))) {
const Ot = Qt[Mt], bt = Qt[Mt + 1], Nt = Qt[Mt + 2];
if (V.push({ key: Ht, x1: Ot - Nt, y1: bt - Nt, x2: Ot + Nt, y2: bt + Nt }), Y)
return !0;
}
}
}
return !1;
}
_queryCellCircle(l, m, v, b, M, V, D, j) {
const { circle: Z, seenUids: Y, overlapMode: J } = D, lt = this.boxCells[M];
if (lt !== null) {
const Qt = this.bboxes;
for (const wt of lt)
if (!Y.box[wt]) {
Y.box[wt] = !0;
const Mt = 4 * wt, Ht = this.boxKeys[wt];
if (this._circleAndRectCollide(Z.x, Z.y, Z.radius, Qt[Mt + 0], Qt[Mt + 1], Qt[Mt + 2], Qt[Mt + 3]) && (!j || j(Ht)) && !Pi(J, Ht.overlapMode))
return V.push(!0), !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Y.circle[wt]) {
Y.circle[wt] = !0;
const Mt = 3 * wt, Ht = this.circleKeys[wt];
if (this._circlesCollide(Qt[Mt], Qt[Mt + 1], Qt[Mt + 2], Z.x, Z.y, Z.radius) && (!j || j(Ht)) && !Pi(J, Ht.overlapMode))
return V.push(!0), !0;
}
}
}
_forEachCell(l, m, v, b, M, V, D, j) {
const Z = this._convertToXCellCoord(l), Y = this._convertToYCellCoord(m), J = this._convertToXCellCoord(v), lt = this._convertToYCellCoord(b);
for (let ft = Z; ft <= J; ft++)
for (let Qt = Y; Qt <= lt; Qt++)
if (M.call(this, l, m, v, b, this.xCellCount * Qt + ft, V, D, j))
return;
}
_convertToXCellCoord(l) {
return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(l * this.xScale)));
}
_convertToYCellCoord(l) {
return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(l * this.yScale)));
}
_circlesCollide(l, m, v, b, M, V) {
const D = b - l, j = M - m, Z = v + V;
return Z * Z > D * D + j * j;
}
_circleAndRectCollide(l, m, v, b, M, V, D) {
const j = (V - b) / 2, Z = Math.abs(l - (b + j));
if (Z > j + v)
return !1;
const Y = (D - M) / 2, J = Math.abs(m - (M + Y));
if (J > Y + v)
return !1;
if (Z <= j || J <= Y)
return !0;
const lt = Z - j, ft = J - Y;
return lt * lt + ft * ft <= v * v;
}
}
function Vi(S, l, m, v, b) {
const M = a.H();
return l ? (a.K(M, M, [1 / b, 1 / b, 1]), m || a.ad(M, M, v.angle)) : a.L(M, v.labelPlaneMatrix, S), M;
}
function Rn(S, l, m, v, b) {
if (l) {
const M = a.ae(S);
return a.K(M, M, [b, b, 1]), m || a.ad(M, M, -v.angle), M;
}
return v.glCoordMatrix;
}
function xt(S, l, m, v) {
let b;
v ? (b = [S, l, v(S, l), 1], a.af(b, b, m)) : (b = [S, l, 0, 1], Te(b, b, m));
const M = b[3];
return { point: new a.P(b[0] / M, b[1] / M), signedDistanceFromCamera: M, isOccluded: !1 };
}
function ot(S, l) {
return 0.5 + S / l * 0.5;
}
function st(S, l) {
return S.x >= -l[0] && S.x <= l[0] && S.y >= -l[1] && S.y <= l[1];
}
function pt(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt) {
const wt = v ? S.textSizeData : S.iconSizeData, Mt = a.ag(wt, m.transform.zoom), Ht = [256 / m.width * 2 + 1, 256 / m.height * 2 + 1], Ot = v ? S.text.dynamicLayoutVertexArray : S.icon.dynamicLayoutVertexArray;
Ot.clear();
const bt = S.lineVertexArray, Nt = v ? S.text.placedSymbolArray : S.icon.placedSymbolArray, Dt = m.transform.width / m.transform.height;
let Wt = !1;
for (let he = 0; he < Nt.length; he++) {
const we = Nt.get(he);
if (we.hidden || we.writingMode === a.ah.vertical && !Wt) {
Rt(we.numGlyphs, Ot);
continue;
}
Wt = !1;
const De = xt(we.anchorX, we.anchorY, l, Qt);
if (!st(De.point, Ht)) {
Rt(we.numGlyphs, Ot);
continue;
}
const tr = ot(m.transform.cameraToCenterDistance, De.signedDistanceFromCamera), Oe = a.ai(wt, Mt, we), Ae = V ? Oe / tr : Oe * tr, ur = { getElevation: Qt, labelPlaneMatrix: b, lineVertexArray: bt, pitchWithMap: V, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: Z, tileAnchorPoint: new a.P(we.anchorX, we.anchorY), unwrappedTileID: Y, width: J, height: lt, translation: ft }, Nr = Vt(ur, we, Ae, !1, D, l, M, S.glyphOffsetArray, Ot, Dt, j);
Wt = Nr.useVertical, (Nr.notEnoughRoom || Wt || Nr.needsFlipping && Vt(ur, we, Ae, !0, D, l, M, S.glyphOffsetArray, Ot, Dt, j).notEnoughRoom) && Rt(we.numGlyphs, Ot);
}
v ? S.text.dynamicLayoutVertexBuffer.updateData(Ot) : S.icon.dynamicLayoutVertexBuffer.updateData(Ot);
}
function yt(S, l, m, v, b, M, V, D) {
const j = M.glyphStartIndex + M.numGlyphs, Z = M.lineStartIndex, Y = M.lineStartIndex + M.lineLength, J = l.getoffsetX(M.glyphStartIndex), lt = l.getoffsetX(j - 1), ft = Le(S * J, m, v, b, M.segment, Z, Y, D, V);
if (!ft)
return null;
const Qt = Le(S * lt, m, v, b, M.segment, Z, Y, D, V);
return Qt ? D.projectionCache.anyProjectionOccluded ? null : { first: ft, last: Qt } : null;
}
function At(S, l, m, v) {
return S === a.ah.horizontal && Math.abs(m.y - l.y) > Math.abs(m.x - l.x) * v ? { useVertical: !0 } : (S === a.ah.vertical ? l.y < m.y : l.x > m.x) ? { needsFlipping: !0 } : null;
}
function Vt(S, l, m, v, b, M, V, D, j, Z, Y) {
const J = m / 24, lt = l.lineOffsetX * J, ft = l.lineOffsetY * J;
let Qt;
if (l.numGlyphs > 1) {
const wt = l.glyphStartIndex + l.numGlyphs, Mt = l.lineStartIndex, Ht = l.lineStartIndex + l.lineLength, Ot = yt(J, D, lt, ft, v, l, Y, S);
if (!Ot)
return { notEnoughRoom: !0 };
const bt = xt(Ot.first.point.x, Ot.first.point.y, V, S.getElevation).point, Nt = xt(Ot.last.point.x, Ot.last.point.y, V, S.getElevation).point;
if (b && !v) {
const Dt = At(l.writingMode, bt, Nt, Z);
if (Dt)
return Dt;
}
Qt = [Ot.first];
for (let Dt = l.glyphStartIndex + 1; Dt < wt - 1; Dt++)
Qt.push(Le(J * D.getoffsetX(Dt), lt, ft, v, l.segment, Mt, Ht, S, Y));
Qt.push(Ot.last);
} else {
if (b && !v) {
const Mt = xt(S.tileAnchorPoint.x, S.tileAnchorPoint.y, M, S.getElevation).point, Ht = l.lineStartIndex + l.segment + 1, Ot = new a.P(S.lineVertexArray.getx(Ht), S.lineVertexArray.gety(Ht)), bt = xt(Ot.x, Ot.y, M, S.getElevation), Nt = bt.signedDistanceFromCamera > 0 ? bt.point : function(Wt, he, we, De, tr, Oe) {
return jt(Wt, he, we, 1, tr, Oe);
}(S.tileAnchorPoint, Ot, Mt, 0, M, S), Dt = At(l.writingMode, Mt, Nt, Z);
if (Dt)
return Dt;
}
const wt = Le(J * D.getoffsetX(l.glyphStartIndex), lt, ft, v, l.segment, l.lineStartIndex, l.lineStartIndex + l.lineLength, S, Y);
if (!wt || S.projectionCache.anyProjectionOccluded)
return { notEnoughRoom: !0 };
Qt = [wt];
}
for (const wt of Qt)
a.aj(j, wt.point, wt.angle);
return {};
}
function jt(S, l, m, v, b, M) {
const V = S.add(S.sub(l)._unit()), D = b !== void 0 ? xt(V.x, V.y, b, M.getElevation).point : Yt(V.x, V.y, M).point, j = m.sub(D);
return m.add(j._mult(v / j.mag()));
}
function St(S, l, m) {
const v = l.projectionCache;
if (v.projections[S])
return v.projections[S];
const b = new a.P(l.lineVertexArray.getx(S), l.lineVertexArray.gety(S)), M = Yt(b.x, b.y, l);
if (M.signedDistanceFromCamera > 0)
return v.projections[S] = M.point, v.anyProjectionOccluded = v.anyProjectionOccluded || M.isOccluded, M.point;
const V = S - m.direction;
return function(D, j, Z, Y, J) {
return jt(D, j, Z, Y, void 0, J);
}(m.distanceFromAnchor === 0 ? l.tileAnchorPoint : new a.P(l.lineVertexArray.getx(V), l.lineVertexArray.gety(V)), b, m.previousVertex, m.absOffsetX - m.distanceFromAnchor + 1, l);
}
function Yt(S, l, m) {
const v = S + m.translation[0], b = l + m.translation[1];
let M;
return !m.pitchWithMap && m.projection.useSpecialProjectionForSymbols ? (M = m.projection.projectTileCoordinates(v, b, m.unwrappedTileID, m.getElevation), M.point.x = (0.5 * M.point.x + 0.5) * m.width, M.point.y = (0.5 * -M.point.y + 0.5) * m.height) : (M = xt(v, b, m.labelPlaneMatrix, m.getElevation), M.isOccluded = !1), M;
}
function ae(S, l, m) {
return S._unit()._perp()._mult(l * m);
}
function Xt(S, l, m, v, b, M, V, D, j) {
if (D.projectionCache.offsets[S])
return D.projectionCache.offsets[S];
const Z = m.add(l);
if (S + j.direction < v || S + j.direction >= b)
return D.projectionCache.offsets[S] = Z, Z;
const Y = St(S + j.direction, D, j), J = ae(Y.sub(m), V, j.direction), lt = m.add(J), ft = Y.add(J);
return D.projectionCache.offsets[S] = a.ak(M, Z, lt, ft) || Z, D.projectionCache.offsets[S];
}
function Le(S, l, m, v, b, M, V, D, j) {
const Z = v ? S - l : S + l;
let Y = Z > 0 ? 1 : -1, J = 0;
v && (Y *= -1, J = Math.PI), Y < 0 && (J += Math.PI);
let lt, ft = Y > 0 ? M + b : M + b + 1;
D.projectionCache.cachedAnchorPoint ? lt = D.projectionCache.cachedAnchorPoint : (lt = Yt(D.tileAnchorPoint.x, D.tileAnchorPoint.y, D).point, D.projectionCache.cachedAnchorPoint = lt);
let Qt, wt, Mt = lt, Ht = lt, Ot = 0, bt = 0;
const Nt = Math.abs(Z), Dt = [];
let Wt;
for (; Ot + bt <= Nt; ) {
if (ft += Y, ft < M || ft >= V)
return null;
Ot += bt, Ht = Mt, wt = Qt;
const De = { absOffsetX: Nt, direction: Y, distanceFromAnchor: Ot, previousVertex: Ht };
if (Mt = St(ft, D, De), m === 0)
Dt.push(Ht), Wt = Mt.sub(Ht);
else {
let tr;
const Oe = Mt.sub(Ht);
tr = Oe.mag() === 0 ? ae(St(ft + Y, D, De).sub(Mt), m, Y) : ae(Oe, m, Y), wt || (wt = Ht.add(tr)), Qt = Xt(ft, tr, Mt, M, V, wt, m, D, De), Dt.push(wt), Wt = Qt.sub(wt);
}
bt = Wt.mag();
}
const he = Wt._mult((Nt - Ot) / bt)._add(wt || Ht), we = J + Math.atan2(Mt.y - Ht.y, Mt.x - Ht.x);
return Dt.push(he), { point: he, angle: j ? we : 0, path: Dt };
}
const or = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
function Rt(S, l) {
for (let m = 0; m < S; m++) {
const v = l.length;
l.resize(v + 4), l.float32.set(or, 3 * v);
}
}
function Te(S, l, m) {
const v = l[0], b = l[1];
return S[0] = m[0] * v + m[4] * b + m[12], S[1] = m[1] * v + m[5] * b + m[13], S[3] = m[3] * v + m[7] * b + m[15], S;
}
const Se = 100;
class lr {
constructor(l, m, v = new H1(l.width + 200, l.height + 200, 25), b = new H1(l.width + 200, l.height + 200, 25)) {
this.transform = l, this.mapProjection = m, this.grid = v, this.ignoredGrid = b, this.pitchFactor = Math.cos(l._pitch) * l.cameraToCenterDistance, this.screenRightBoundary = l.width + Se, this.screenBottomBoundary = l.height + Se, this.gridRightBoundary = l.width + 200, this.gridBottomBoundary = l.height + 200, this.perspectiveRatioCutoff = 0.6;
}
placeCollisionBox(l, m, v, b, M, V, D, j, Z, Y, J) {
const lt = l.anchorPointX + j[0], ft = l.anchorPointY + j[1], Qt = this.projectAndGetPerspectiveRatio(b, lt, ft, M, Y), wt = v * Qt.perspectiveRatio;
let Mt;
if (V || D)
Mt = this._projectCollisionBox(l, wt, b, M, V, D, j, Qt, Y, J);
else {
const Dt = Qt.point.x + (J ? J.x * wt : 0), Wt = Qt.point.y + (J ? J.y * wt : 0);
Mt = { allPointsOccluded: !1, box: [Dt + l.x1 * wt, Wt + l.y1 * wt, Dt + l.x2 * wt, Wt + l.y2 * wt] };
}
const [Ht, Ot, bt, Nt] = Mt.box;
return this.mapProjection.useSpecialProjectionForSymbols && (V ? Mt.allPointsOccluded : this.mapProjection.isOccluded(lt, ft, M)) || Qt.perspectiveRatio < this.perspectiveRatioCutoff || !this.isInsideGrid(Ht, Ot, bt, Nt) || m !== "always" && this.grid.hitTest(Ht, Ot, bt, Nt, m, Z) ? { box: [Ht, Ot, bt, Nt], placeable: !1, offscreen: !1 } : { box: [Ht, Ot, bt, Nt], placeable: !0, offscreen: this.isOffscreen(Ht, Ot, bt, Nt) };
}
placeCollisionCircles(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt) {
const Ht = [], Ot = new a.P(m.anchorX, m.anchorY), bt = this.getPerspectiveRatio(V, Ot.x, Ot.y, D, Mt), Nt = (J ? M / bt : M * bt) / a.ap, Dt = { getElevation: Mt, labelPlaneMatrix: j, lineVertexArray: v, pitchWithMap: J, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: this.mapProjection, tileAnchorPoint: Ot, unwrappedTileID: D, width: this.transform.width, height: this.transform.height, translation: wt }, Wt = yt(Nt, b, m.lineOffsetX * Nt, m.lineOffsetY * Nt, !1, m, !1, Dt);
let he = !1, we = !1, De = !0;
if (Wt) {
const tr = 0.5 * ft * bt + Qt, Oe = new a.P(-100, -100), Ae = new a.P(this.screenRightBoundary, this.screenBottomBoundary), ur = new wr(), Nr = Wt.first, Pe = Wt.last;
let We = [];
for (let Wr = Nr.path.length - 1; Wr >= 1; Wr--)
We.push(Nr.path[Wr]);
for (let Wr = 1; Wr < Pe.path.length; Wr++)
We.push(Pe.path[Wr]);
const kr = 2.5 * tr;
if (Z) {
const Wr = this.projectPathToScreenSpace(We, Dt, Z);
We = Wr.some((nn) => nn.signedDistanceFromCamera <= 0) ? [] : Wr.map((nn) => nn.point);
}
let ei = [];
if (We.length > 0) {
const Wr = We[0].clone(), nn = We[0].clone();
for (let ri = 1; ri < We.length; ri++)
Wr.x = Math.min(Wr.x, We[ri].x), Wr.y = Math.min(Wr.y, We[ri].y), nn.x = Math.max(nn.x, We[ri].x), nn.y = Math.max(nn.y, We[ri].y);
ei = Wr.x >= Oe.x && nn.x <= Ae.x && Wr.y >= Oe.y && nn.y <= Ae.y ? [We] : nn.x < Oe.x || Wr.x > Ae.x || nn.y < Oe.y || Wr.y > Ae.y ? [] : a.al([We], Oe.x, Oe.y, Ae.x, Ae.y);
}
for (const Wr of ei) {
ur.reset(Wr, 0.25 * tr);
let nn = 0;
nn = ur.length <= 0.5 * tr ? 1 : Math.ceil(ur.paddedLength / kr) + 1;
for (let ri = 0; ri < nn; ri++) {
const C1 = ri / Math.max(nn - 1, 1), O2 = ur.lerp(C1), ni = O2.x + Se, mo = O2.y + Se;
Ht.push(ni, mo, tr, 0);
const q1 = ni - tr, k1 = mo - tr, X1 = ni + tr, Qs = mo + tr;
if (De = De && this.isOffscreen(q1, k1, X1, Qs), we = we || this.isInsideGrid(q1, k1, X1, Qs), l !== "always" && this.grid.hitTestCircle(ni, mo, tr, l, lt) && (he = !0, !Y))
return { circles: [], offscreen: !1, collisionDetected: he };
}
}
}
return { circles: !Y && he || !we || bt < this.perspectiveRatioCutoff ? [] : Ht, offscreen: De, collisionDetected: he };
}
projectPathToScreenSpace(l, m, v) {
return l.map((b) => xt(b.x, b.y, v, m.getElevation));
}
queryRenderedSymbols(l) {
if (l.length === 0 || this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)
return {};
const m = [];
let v = 1 / 0, b = 1 / 0, M = -1 / 0, V = -1 / 0;
for (const Y of l) {
const J = new a.P(Y.x + Se, Y.y + Se);
v = Math.min(v, J.x), b = Math.min(b, J.y), M = Math.max(M, J.x), V = Math.max(V, J.y), m.push(J);
}
const D = this.grid.query(v, b, M, V).concat(this.ignoredGrid.query(v, b, M, V)), j = {}, Z = {};
for (const Y of D) {
const J = Y.key;
if (j[J.bucketInstanceId] === void 0 && (j[J.bucketInstanceId] = {}), j[J.bucketInstanceId][J.featureIndex])
continue;
const lt = [new a.P(Y.x1, Y.y1), new a.P(Y.x2, Y.y1), new a.P(Y.x2, Y.y2), new a.P(Y.x1, Y.y2)];
a.am(m, lt) && (j[J.bucketInstanceId][J.featureIndex] = !0, Z[J.bucketInstanceId] === void 0 && (Z[J.bucketInstanceId] = []), Z[J.bucketInstanceId].push(J.featureIndex));
}
return Z;
}
insertCollisionBox(l, m, v, b, M, V) {
(v ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: b, featureIndex: M, collisionGroupID: V, overlapMode: m }, l[0], l[1], l[2], l[3]);
}
insertCollisionCircles(l, m, v, b, M, V) {
const D = v ? this.ignoredGrid : this.grid, j = { bucketInstanceId: b, featureIndex: M, collisionGroupID: V, overlapMode: m };
for (let Z = 0; Z < l.length; Z += 4)
D.insertCircle(j, l[Z], l[Z + 1], l[Z + 2]);
}
projectAndGetPerspectiveRatio(l, m, v, b, M) {
let V;
M ? (V = [m, v, M(m, v), 1], a.af(V, V, l)) : (V = [m, v, 0, 1], Te(V, V, l));
const D = V[3];
return { point: new a.P((V[0] / D + 1) / 2 * this.transform.width + Se, (-V[1] / D + 1) / 2 * this.transform.height + Se), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / D * 0.5, isOccluded: !1, signedDistanceFromCamera: D };
}
getPerspectiveRatio(l, m, v, b, M) {
const V = this.mapProjection.useSpecialProjectionForSymbols ? this.mapProjection.projectTileCoordinates(m, v, b, M) : xt(m, v, l, M);
return 0.5 + this.transform.cameraToCenterDistance / V.signedDistanceFromCamera * 0.5;
}
isOffscreen(l, m, v, b) {
return v < Se || l >= this.screenRightBoundary || b < Se || m > this.screenBottomBoundary;
}
isInsideGrid(l, m, v, b) {
return v >= 0 && l < this.gridRightBoundary && b >= 0 && m < this.gridBottomBoundary;
}
getViewportMatrix() {
const l = a.an([]);
return a.J(l, l, [-100, -100, 0]), l;
}
_projectCollisionBox(l, m, v, b, M, V, D, j, Z, Y) {
let J = new a.P(1, 0), lt = new a.P(0, 1);
const ft = new a.P(l.anchorPointX + D[0], l.anchorPointY + D[1]);
if (V && !M) {
const De = this.projectAndGetPerspectiveRatio(v, ft.x + 1, ft.y, b, Z).point.sub(j.point).unit(), tr = Math.atan(De.y / De.x) + (De.x < 0 ? Math.PI : 0), Oe = Math.sin(tr), Ae = Math.cos(tr);
J = new a.P(Ae, Oe), lt = new a.P(-Oe, Ae);
} else if (!V && M) {
const De = -this.transform.angle, tr = Math.sin(De), Oe = Math.cos(De);
J = new a.P(Oe, tr), lt = new a.P(-tr, Oe);
}
let Qt = j.point, wt = m;
if (M) {
Qt = ft;
const De = this.transform.zoom - Math.floor(this.transform.zoom);
wt = Math.pow(2, -De), wt *= this.mapProjection.getPitchedTextCorrection(this.transform, ft, b), Y || (wt *= a.ac(0.5 + j.signedDistanceFromCamera / this.transform.cameraToCenterDistance * 0.5, 0, 4));
}
Y && (Qt = Qt.add(J.mult(Y.x * wt)).add(lt.mult(Y.y * wt)));
const Mt = l.x1 * wt, Ht = l.x2 * wt, Ot = (Mt + Ht) / 2, bt = l.y1 * wt, Nt = l.y2 * wt, Dt = (bt + Nt) / 2, Wt = [{ offsetX: Mt, offsetY: bt }, { offsetX: Ot, offsetY: bt }, { offsetX: Ht, offsetY: bt }, { offsetX: Ht, offsetY: Dt }, { offsetX: Ht, offsetY: Nt }, { offsetX: Ot, offsetY: Nt }, { offsetX: Mt, offsetY: Nt }, { offsetX: Mt, offsetY: Dt }];
let he = [];
for (const { offsetX: De, offsetY: tr } of Wt)
he.push(new a.P(Qt.x + J.x * De + lt.x * tr, Qt.y + J.y * De + lt.y * tr));
let we = !1;
if (M) {
const De = he.map((tr) => this.projectAndGetPerspectiveRatio(v, tr.x, tr.y, b, Z));
we = De.some((tr) => !tr.isOccluded), he = De.map((tr) => tr.point);
} else
we = !0;
return { box: a.ao(he), allPointsOccluded: !we };
}
}
function Ar(S, l, m) {
return l * (a.X / (S.tileSize * Math.pow(2, m - S.tileID.overscaledZ)));
}
class vn {
constructor(l, m, v, b) {
this.opacity = l ? Math.max(0, Math.min(1, l.opacity + (l.placed ? m : -m))) : b && v ? 1 : 0, this.placed = v;
}
isHidden() {
return this.opacity === 0 && !this.placed;
}
}
class zr {
constructor(l, m, v, b, M) {
this.text = new vn(l ? l.text : null, m, v, M), this.icon = new vn(l ? l.icon : null, m, b, M);
}
isHidden() {
return this.text.isHidden() && this.icon.isHidden();
}
}
class br {
constructor(l, m, v) {
this.text = l, this.icon = m, this.skipFade = v;
}
}
class Br {
constructor() {
this.invProjMatrix = a.H(), this.viewportMatrix = a.H(), this.circles = [];
}
}
class cn {
constructor(l, m, v, b, M) {
this.bucketInstanceId = l, this.featureIndex = m, this.sourceLayerIndex = v, this.bucketIndex = b, this.tileID = M;
}
}
class Kn {
constructor(l) {
this.crossSourceCollisions = l, this.maxGroupID = 0, this.collisionGroups = {};
}
get(l) {
if (this.crossSourceCollisions)
return { ID: 0, predicate: null };
if (!this.collisionGroups[l]) {
const m = ++this.maxGroupID;
this.collisionGroups[l] = { ID: m, predicate: (v) => v.collisionGroupID === m };
}
return this.collisionGroups[l];
}
}
function Li(S, l, m, v, b) {
const { horizontalAlign: M, verticalAlign: V } = a.au(S);
return new a.P(-(M - 0.5) * l + v[0] * b, -(V - 0.5) * m + v[1] * b);
}
class Ri {
constructor(l, m, v, b, M, V) {
this.transform = l.clone(), this.terrain = v, this.collisionIndex = new lr(this.transform, m), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = !1, this.commitTime = 0, this.fadeDuration = b, this.retainedQueryData = {}, this.collisionGroups = new Kn(M), this.collisionCircleArrays = {}, this.collisionBoxArrays = /* @__PURE__ */ new Map(), this.prevPlacement = V, V && (V.prevPlacement = void 0), this.placedOrientations = {};
}
_getTerrainElevationFunc(l) {
const m = this.terrain;
return m ? (v, b) => m.getElevation(l, v, b) : null;
}
getBucketParts(l, m, v, b) {
const M = v.getBucket(m), V = v.latestFeatureIndex;
if (!M || !V || m.id !== M.layerIds[0])
return;
const D = v.collisionBoxArray, j = M.layers[0].layout, Z = M.layers[0].paint, Y = Math.pow(2, this.transform.zoom - v.tileID.overscaledZ), J = v.tileSize / a.X, lt = v.tileID.toUnwrapped(), ft = this.transform.calculatePosMatrix(lt), Qt = j.get("text-pitch-alignment") === "map", wt = j.get("text-rotation-alignment") === "map", Mt = Ar(v, 1, this.transform.zoom), Ht = this.collisionIndex.mapProjection.translatePosition(this.transform, v, Z.get("text-translate"), Z.get("text-translate-anchor")), Ot = this.collisionIndex.mapProjection.translatePosition(this.transform, v, Z.get("icon-translate"), Z.get("icon-translate-anchor")), bt = Vi(ft, Qt, wt, this.transform, Mt);
let Nt = null;
if (Qt) {
const Wt = Rn(ft, Qt, wt, this.transform, Mt);
Nt = a.L([], this.transform.labelPlaneMatrix, Wt);
}
this.retainedQueryData[M.bucketInstanceId] = new cn(M.bucketInstanceId, V, M.sourceLayerIndex, M.index, v.tileID);
const Dt = { bucket: M, layout: j, translationText: Ht, translationIcon: Ot, posMatrix: ft, unwrappedTileID: lt, textLabelPlaneMatrix: bt, labelToScreenMatrix: Nt, scale: Y, textPixelRatio: J, holdingForFade: v.holdingForFade(), collisionBoxArray: D, partiallyEvaluatedTextSize: a.ag(M.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(M.sourceID) };
if (b)
for (const Wt of M.sortKeyRanges) {
const { sortKey: he, symbolInstanceStart: we, symbolInstanceEnd: De } = Wt;
l.push({ sortKey: he, symbolInstanceStart: we, symbolInstanceEnd: De, parameters: Dt });
}
else
l.push({ symbolInstanceStart: 0, symbolInstanceEnd: M.symbolInstances.length, parameters: Dt });
}
attemptAnchorPlacement(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt, Ht, Ot, bt) {
const Nt = a.aq[l.textAnchor], Dt = [l.textOffset0, l.textOffset1], Wt = Li(Nt, v, b, Dt, M), he = this.collisionIndex.placeCollisionBox(m, lt, j, Z, Y, D, V, Mt, J.predicate, bt, Wt);
if ((!Ot || this.collisionIndex.placeCollisionBox(Ot, lt, j, Z, Y, D, V, Ht, J.predicate, bt, Wt).placeable) && he.placeable) {
let we;
if (this.prevPlacement && this.prevPlacement.variableOffsets[ft.crossTileID] && this.prevPlacement.placements[ft.crossTileID] && this.prevPlacement.placements[ft.crossTileID].text && (we = this.prevPlacement.variableOffsets[ft.crossTileID].anchor), ft.crossTileID === 0)
throw new Error("symbolInstance.crossTileID can't be 0");
return this.variableOffsets[ft.crossTileID] = { textOffset: Dt, width: v, height: b, anchor: Nt, textBoxScale: M, prevAnchor: we }, this.markUsedJustification(Qt, Nt, ft, wt), Qt.allowVerticalPlacement && (this.markUsedOrientation(Qt, wt, ft), this.placedOrientations[ft.crossTileID] = wt), { shift: Wt, placedGlyphBoxes: he };
}
}
placeLayerBucketPart(l, m, v) {
const { bucket: b, layout: M, translationText: V, translationIcon: D, posMatrix: j, unwrappedTileID: Z, textLabelPlaneMatrix: Y, labelToScreenMatrix: J, textPixelRatio: lt, holdingForFade: ft, collisionBoxArray: Qt, partiallyEvaluatedTextSize: wt, collisionGroup: Mt } = l.parameters, Ht = M.get("text-optional"), Ot = M.get("icon-optional"), bt = a.ar(M, "text-overlap", "text-allow-overlap"), Nt = bt === "always", Dt = a.ar(M, "icon-overlap", "icon-allow-overlap"), Wt = Dt === "always", he = M.get("text-rotation-alignment") === "map", we = M.get("text-pitch-alignment") === "map", De = M.get("icon-text-fit") !== "none", tr = M.get("symbol-z-order") === "viewport-y", Oe = Nt && (Wt || !b.hasIconData() || Ot), Ae = Wt && (Nt || !b.hasTextData() || Ht);
!b.collisionArrays && Qt && b.deserializeCollisionBoxes(Qt);
const ur = this._getTerrainElevationFunc(this.retainedQueryData[b.bucketInstanceId].tileID), Nr = (Pe, We, kr) => {
var ei, Wr;
if (m[Pe.crossTileID])
return;
if (ft)
return void (this.placements[Pe.crossTileID] = new br(!1, !1, !1));
let nn = !1, ri = !1, C1 = !0, O2 = null, ni = { box: null, placeable: !1, offscreen: null }, mo = { box: null, placeable: !1, offscreen: null }, q1 = null, k1 = null, X1 = null, Qs = 0, o6 = 0, kl = 0;
We.textFeatureIndex ? Qs = We.textFeatureIndex : Pe.useRuntimeCollisionCircles && (Qs = Pe.featureIndex), We.verticalTextFeatureIndex && (o6 = We.verticalTextFeatureIndex);
const s6 = We.textBox;
if (s6) {
const o2 = (b1) => {
let I1 = a.ah.horizontal;
if (b.allowVerticalPlacement && !b1 && this.prevPlacement) {
const Ro = this.prevPlacement.placedOrientations[Pe.crossTileID];
Ro && (this.placedOrientations[Pe.crossTileID] = Ro, I1 = Ro, this.markUsedOrientation(b, I1, Pe));
}
return I1;
}, s2 = (b1, I1) => {
if (b.allowVerticalPlacement && Pe.numVerticalGlyphVertices > 0 && We.verticalTextBox) {
for (const Ro of b.writingModes)
if (Ro === a.ah.vertical ? (ni = I1(), mo = ni) : ni = b1(), ni && ni.placeable)
break;
} else
ni = b1();
}, Ea = Pe.textAnchorOffsetStartIndex, C2 = Pe.textAnchorOffsetEndIndex;
if (C2 === Ea) {
const b1 = (I1, Ro) => {
const an = this.collisionIndex.placeCollisionBox(I1, bt, lt, j, Z, we, he, V, Mt.predicate, ur);
return an && an.placeable && (this.markUsedOrientation(b, Ro, Pe), this.placedOrientations[Pe.crossTileID] = Ro), an;
};
s2(() => b1(s6, a.ah.horizontal), () => {
const I1 = We.verticalTextBox;
return b.allowVerticalPlacement && Pe.numVerticalGlyphVertices > 0 && I1 ? b1(I1, a.ah.vertical) : { box: null, offscreen: null };
}), o2(ni && ni.placeable);
} else {
let b1 = a.aq[(Wr = (ei = this.prevPlacement) === null || ei === void 0 ? void 0 : ei.variableOffsets[Pe.crossTileID]) === null || Wr === void 0 ? void 0 : Wr.anchor];
const I1 = (an, B3, a6) => {
const l6 = an.x2 - an.x1, _p = an.y2 - an.y1, v_ = Pe.textBoxScale, bp = De && Dt === "never" ? B3 : null;
let Ma = null, Lp = bt === "never" ? 1 : 2, Pl = "never";
b1 && Lp++;
for (let V0 = 0; V0 < Lp; V0++) {
for (let Vl = Ea; Vl < C2; Vl++) {
const Rl = b.textAnchorOffsets.get(Vl);
if (b1 && Rl.textAnchor !== b1)
continue;
const c6 = this.attemptAnchorPlacement(Rl, an, l6, _p, v_, he, we, lt, j, Z, Mt, Pl, Pe, b, a6, V, D, bp, ur);
if (c6 && (Ma = c6.placedGlyphBoxes, Ma && Ma.placeable))
return nn = !0, O2 = c6.shift, Ma;
}
b1 ? b1 = null : Pl = bt;
}
return v && !Ma && (Ma = { box: this.collisionIndex.placeCollisionBox(s6, "always", lt, j, Z, we, he, V, Mt.predicate, ur, new a.P(0, 0)).box, offscreen: !1, placeable: !1 }), Ma;
};
s2(() => I1(s6, We.iconBox, a.ah.horizontal), () => {
const an = We.verticalTextBox;
return b.allowVerticalPlacement && (!ni || !ni.placeable) && Pe.numVerticalGlyphVertices > 0 && an ? I1(an, We.verticalIconBox, a.ah.vertical) : { box: null, occluded: !0, offscreen: null };
}), ni && (nn = ni.placeable, C1 = ni.offscreen);
const Ro = o2(ni && ni.placeable);
if (!nn && this.prevPlacement) {
const an = this.prevPlacement.variableOffsets[Pe.crossTileID];
an && (this.variableOffsets[Pe.crossTileID] = an, this.markUsedJustification(b, an.anchor, Pe, Ro));
}
}
}
if (q1 = ni, nn = q1 && q1.placeable, C1 = q1 && q1.offscreen, Pe.useRuntimeCollisionCircles) {
const o2 = b.text.placedSymbolArray.get(Pe.centerJustifiedTextSymbolIndex), s2 = a.ai(b.textSizeData, wt, o2), Ea = M.get("text-padding");
k1 = this.collisionIndex.placeCollisionCircles(bt, o2, b.lineVertexArray, b.glyphOffsetArray, s2, j, Z, Y, J, v, we, Mt.predicate, Pe.collisionCircleDiameter, Ea, V, ur), k1.circles.length && k1.collisionDetected && !v && a.w("Collisions detected, but collision boxes are not shown"), nn = Nt || k1.circles.length > 0 && !k1.collisionDetected, C1 = C1 && k1.offscreen;
}
if (We.iconFeatureIndex && (kl = We.iconFeatureIndex), We.iconBox) {
const o2 = (s2) => this.collisionIndex.placeCollisionBox(s2, Dt, lt, j, Z, we, he, D, Mt.predicate, ur, De && O2 ? O2 : void 0);
mo && mo.placeable && We.verticalIconBox ? (X1 = o2(We.verticalIconBox), ri = X1.placeable) : (X1 = o2(We.iconBox), ri = X1.placeable), C1 = C1 && X1.offscreen;
}
const i2 = Ht || Pe.numHorizontalGlyphVertices === 0 && Pe.numVerticalGlyphVertices === 0, Il = Ot || Pe.numIconVertices === 0;
i2 || Il ? Il ? i2 || (ri = ri && nn) : nn = ri && nn : ri = nn = ri && nn;
const Bc = ri && X1.placeable;
if (nn && q1.placeable && this.collisionIndex.insertCollisionBox(q1.box, bt, M.get("text-ignore-placement"), b.bucketInstanceId, mo && mo.placeable && o6 ? o6 : Qs, Mt.ID), Bc && this.collisionIndex.insertCollisionBox(X1.box, Dt, M.get("icon-ignore-placement"), b.bucketInstanceId, kl, Mt.ID), k1 && nn && this.collisionIndex.insertCollisionCircles(k1.circles, bt, M.get("text-ignore-placement"), b.bucketInstanceId, Qs, Mt.ID), v && this.storeCollisionData(b.bucketInstanceId, kr, We, q1, X1, k1), Pe.crossTileID === 0)
throw new Error("symbolInstance.crossTileID can't be 0");
if (b.bucketInstanceId === 0)
throw new Error("bucket.bucketInstanceId can't be 0");
this.placements[Pe.crossTileID] = new br(nn || Oe, ri || Ae, C1 || b.justReloaded), m[Pe.crossTileID] = !0;
};
if (tr) {
if (l.symbolInstanceStart !== 0)
throw new Error("bucket.bucketInstanceId should be 0");
const Pe = b.getSortedSymbolIndexes(this.transform.angle);
for (let We = Pe.length - 1; We >= 0; --We) {
const kr = Pe[We];
Nr(b.symbolInstances.get(kr), b.collisionArrays[kr], kr);
}
} else
for (let Pe = l.symbolInstanceStart; Pe < l.symbolInstanceEnd; Pe++)
Nr(b.symbolInstances.get(Pe), b.collisionArrays[Pe], Pe);
if (v && b.bucketInstanceId in this.collisionCircleArrays) {
const Pe = this.collisionCircleArrays[b.bucketInstanceId];
a.as(Pe.invProjMatrix, j), Pe.viewportMatrix = this.collisionIndex.getViewportMatrix();
}
b.justReloaded = !1;
}
storeCollisionData(l, m, v, b, M, V) {
if (v.textBox || v.iconBox) {
let D, j;
this.collisionBoxArrays.has(l) ? D = this.collisionBoxArrays.get(l) : (D = /* @__PURE__ */ new Map(), this.collisionBoxArrays.set(l, D)), D.has(m) ? j = D.get(m) : (j = { text: null, icon: null }, D.set(m, j)), v.textBox && (j.text = b.box), v.iconBox && (j.icon = M.box);
}
if (V) {
let D = this.collisionCircleArrays[l];
D === void 0 && (D = this.collisionCircleArrays[l] = new Br());
for (let j = 0; j < V.circles.length; j += 4)
D.circles.push(V.circles[j + 0]), D.circles.push(V.circles[j + 1]), D.circles.push(V.circles[j + 2]), D.circles.push(V.collisionDetected ? 1 : 0);
}
}
markUsedJustification(l, m, v, b) {
let M;
M = b === a.ah.vertical ? v.verticalPlacedTextSymbolIndex : { left: v.leftJustifiedTextSymbolIndex, center: v.centerJustifiedTextSymbolIndex, right: v.rightJustifiedTextSymbolIndex }[a.at(m)];
const V = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex, v.verticalPlacedTextSymbolIndex];
for (const D of V)
D >= 0 && (l.text.placedSymbolArray.get(D).crossTileID = M >= 0 && D !== M ? 0 : v.crossTileID);
}
markUsedOrientation(l, m, v) {
const b = m === a.ah.horizontal || m === a.ah.horizontalOnly ? m : 0, M = m === a.ah.vertical ? m : 0, V = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex];
for (const D of V)
l.text.placedSymbolArray.get(D).placedOrientation = b;
v.verticalPlacedTextSymbolIndex && (l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation = M);
}
commit(l) {
this.commitTime = l, this.zoomAtLastRecencyCheck = this.transform.zoom;
const m = this.prevPlacement;
let v = !1;
this.prevZoomAdjustment = m ? m.zoomAdjustment(this.transform.zoom) : 0;
const b = m ? m.symbolFadeChange(l) : 1, M = m ? m.opacities : {}, V = m ? m.variableOffsets : {}, D = m ? m.placedOrientations : {};
for (const j in this.placements) {
const Z = this.placements[j], Y = M[j];
Y ? (this.opacities[j] = new zr(Y, b, Z.text, Z.icon), v = v || Z.text !== Y.text.placed || Z.icon !== Y.icon.placed) : (this.opacities[j] = new zr(null, b, Z.text, Z.icon, Z.skipFade), v = v || Z.text || Z.icon);
}
for (const j in M) {
const Z = M[j];
if (!this.opacities[j]) {
const Y = new zr(Z, b, !1, !1);
Y.isHidden() || (this.opacities[j] = Y, v = v || Z.text.placed || Z.icon.placed);
}
}
for (const j in V)
this.variableOffsets[j] || !this.opacities[j] || this.opacities[j].isHidden() || (this.variableOffsets[j] = V[j]);
for (const j in D)
this.placedOrientations[j] || !this.opacities[j] || this.opacities[j].isHidden() || (this.placedOrientations[j] = D[j]);
if (m && m.lastPlacementChangeTime === void 0)
throw new Error("Last placement time for previous placement is not defined");
v ? this.lastPlacementChangeTime = l : typeof this.lastPlacementChangeTime != "number" && (this.lastPlacementChangeTime = m ? m.lastPlacementChangeTime : l);
}
updateLayerOpacities(l, m) {
const v = {};
for (const b of m) {
const M = b.getBucket(l);
M && b.latestFeatureIndex && l.id === M.layerIds[0] && this.updateBucketOpacities(M, b.tileID, v, b.collisionBoxArray);
}
}
updateBucketOpacities(l, m, v, b) {
l.hasTextData() && (l.text.opacityVertexArray.clear(), l.text.hasVisibleVertices = !1), l.hasIconData() && (l.icon.opacityVertexArray.clear(), l.icon.hasVisibleVertices = !1), l.hasIconCollisionBoxData() && l.iconCollisionBox.collisionVertexArray.clear(), l.hasTextCollisionBoxData() && l.textCollisionBox.collisionVertexArray.clear();
const M = l.layers[0], V = M.layout, D = new zr(null, 0, !1, !1, !0), j = V.get("text-allow-overlap"), Z = V.get("icon-allow-overlap"), Y = M._unevaluatedLayout.hasValue("text-variable-anchor") || M._unevaluatedLayout.hasValue("text-variable-anchor-offset"), J = V.get("text-rotation-alignment") === "map", lt = V.get("text-pitch-alignment") === "map", ft = V.get("icon-text-fit") !== "none", Qt = new zr(null, 0, j && (Z || !l.hasIconData() || V.get("icon-optional")), Z && (j || !l.hasTextData() || V.get("text-optional")), !0);
!l.collisionArrays && b && (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) && l.deserializeCollisionBoxes(b);
const wt = (Ht, Ot, bt) => {
for (let Nt = 0; Nt < Ot / 4; Nt++)
Ht.opacityVertexArray.emplaceBack(bt);
Ht.hasVisibleVertices = Ht.hasVisibleVertices || bt !== uo;
}, Mt = this.collisionBoxArrays.get(l.bucketInstanceId);
for (let Ht = 0; Ht < l.symbolInstances.length; Ht++) {
const Ot = l.symbolInstances.get(Ht), { numHorizontalGlyphVertices: bt, numVerticalGlyphVertices: Nt, crossTileID: Dt } = Ot;
let Wt = this.opacities[Dt];
v[Dt] ? Wt = D : Wt || (Wt = Qt, this.opacities[Dt] = Wt), v[Dt] = !0;
const he = Ot.numIconVertices > 0, we = this.placedOrientations[Ot.crossTileID], De = we === a.ah.vertical, tr = we === a.ah.horizontal || we === a.ah.horizontalOnly;
if (bt > 0 || Nt > 0) {
const Ae = pn(Wt.text);
wt(l.text, bt, De ? uo : Ae), wt(l.text, Nt, tr ? uo : Ae);
const ur = Wt.text.isHidden();
[Ot.rightJustifiedTextSymbolIndex, Ot.centerJustifiedTextSymbolIndex, Ot.leftJustifiedTextSymbolIndex].forEach((We) => {
We >= 0 && (l.text.placedSymbolArray.get(We).hidden = ur || De ? 1 : 0);
}), Ot.verticalPlacedTextSymbolIndex >= 0 && (l.text.placedSymbolArray.get(Ot.verticalPlacedTextSymbolIndex).hidden = ur || tr ? 1 : 0);
const Nr = this.variableOffsets[Ot.crossTileID];
Nr && this.markUsedJustification(l, Nr.anchor, Ot, we);
const Pe = this.placedOrientations[Ot.crossTileID];
Pe && (this.markUsedJustification(l, "left", Ot, Pe), this.markUsedOrientation(l, Pe, Ot));
}
if (he) {
const Ae = pn(Wt.icon), ur = !(ft && Ot.verticalPlacedIconSymbolIndex && De);
Ot.placedIconSymbolIndex >= 0 && (wt(l.icon, Ot.numIconVertices, ur ? Ae : uo), l.icon.placedSymbolArray.get(Ot.placedIconSymbolIndex).hidden = Wt.icon.isHidden()), Ot.verticalPlacedIconSymbolIndex >= 0 && (wt(l.icon, Ot.numVerticalIconVertices, ur ? uo : Ae), l.icon.placedSymbolArray.get(Ot.verticalPlacedIconSymbolIndex).hidden = Wt.icon.isHidden());
}
const Oe = Mt && Mt.has(Ht) ? Mt.get(Ht) : { text: null, icon: null };
if (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) {
const Ae = l.collisionArrays[Ht];
if (Ae) {
let ur = new a.P(0, 0);
if (Ae.textBox || Ae.verticalTextBox) {
let Nr = !0;
if (Y) {
const Pe = this.variableOffsets[Dt];
Pe ? (ur = Li(Pe.anchor, Pe.width, Pe.height, Pe.textOffset, Pe.textBoxScale), J && ur._rotate(lt ? this.transform.angle : -this.transform.angle)) : Nr = !1;
}
if (Ae.textBox || Ae.verticalTextBox) {
let Pe;
Ae.textBox && (Pe = De), Ae.verticalTextBox && (Pe = tr), es(l.textCollisionBox.collisionVertexArray, Wt.text.placed, !Nr || Pe, Oe.text, ur.x, ur.y);
}
}
if (Ae.iconBox || Ae.verticalIconBox) {
const Nr = !!(!tr && Ae.verticalIconBox);
let Pe;
Ae.iconBox && (Pe = Nr), Ae.verticalIconBox && (Pe = !Nr), es(l.iconCollisionBox.collisionVertexArray, Wt.icon.placed, Pe, Oe.icon, ft ? ur.x : 0, ft ? ur.y : 0);
}
}
}
}
if (l.sortFeatures(this.transform.angle), this.retainedQueryData[l.bucketInstanceId] && (this.retainedQueryData[l.bucketInstanceId].featureSortOrder = l.featureSortOrder), l.hasTextData() && l.text.opacityVertexBuffer && l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray), l.hasIconData() && l.icon.opacityVertexBuffer && l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray), l.hasIconCollisionBoxData() && l.iconCollisionBox.collisionVertexBuffer && l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray), l.hasTextCollisionBoxData() && l.textCollisionBox.collisionVertexBuffer && l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray), l.text.opacityVertexArray.length !== l.text.layoutVertexArray.length / 4)
throw new Error(`bucket.text.opacityVertexArray.length (= ${l.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${l.text.layoutVertexArray.length}) / 4`);
if (l.icon.opacityVertexArray.length !== l.icon.layoutVertexArray.length / 4)
throw new Error(`bucket.icon.opacityVertexArray.length (= ${l.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${l.icon.layoutVertexArray.length}) / 4`);
if (l.bucketInstanceId in this.collisionCircleArrays) {
const Ht = this.collisionCircleArrays[l.bucketInstanceId];
l.placementInvProjMatrix = Ht.invProjMatrix, l.placementViewportMatrix = Ht.viewportMatrix, l.collisionCircleArray = Ht.circles, delete this.collisionCircleArrays[l.bucketInstanceId];
}
}
symbolFadeChange(l) {
return this.fadeDuration === 0 ? 1 : (l - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;
}
zoomAdjustment(l) {
return Math.max(0, (this.transform.zoom - l) / 1.5);
}
hasTransitions(l) {
return this.stale || l - this.lastPlacementChangeTime < this.fadeDuration;
}
stillRecent(l, m) {
const v = this.zoomAtLastRecencyCheck === m ? 1 - this.zoomAdjustment(m) : 1;
return this.zoomAtLastRecencyCheck = m, this.commitTime + this.fadeDuration * v > l;
}
setStale() {
this.stale = !0;
}
}
function es(S, l, m, v, b, M) {
v && v.length !== 0 || (v = [0, 0, 0, 0]);
const V = v[0] - Se, D = v[1] - Se, j = v[2] - Se, Z = v[3] - Se;
S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, V, D), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, j, D), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, j, Z), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, V, Z);
}
const tn = Math.pow(2, 25), zi = Math.pow(2, 24), co = Math.pow(2, 17), Xr = Math.pow(2, 16), Yn = Math.pow(2, 9), rs = Math.pow(2, 8), _n = Math.pow(2, 1);
function pn(S) {
if (S.opacity === 0 && !S.placed)
return 0;
if (S.opacity === 1 && S.placed)
return 4294967295;
const l = S.placed ? 1 : 0, m = Math.floor(127 * S.opacity);
return m * tn + l * zi + m * co + l * Xr + m * Yn + l * rs + m * _n + l;
}
const uo = 0;
function u1() {
return { isOccluded: (S, l, m) => !1, getPitchedTextCorrection: (S, l, m) => 1, get useSpecialProjectionForSymbols() {
return !1;
}, projectTileCoordinates(S, l, m, v) {
throw new Error("Not implemented.");
}, translatePosition: (S, l, m, v) => function(b, M, V, D, j = !1) {
if (!V[0] && !V[1])
return [0, 0];
const Z = j ? D === "map" ? b.angle : 0 : D === "viewport" ? -b.angle : 0;
if (Z) {
const Y = Math.sin(Z), J = Math.cos(Z);
V = [V[0] * J - V[1] * Y, V[0] * Y + V[1] * J];
}
return [j ? V[0] : Ar(M, V[0], b.zoom), j ? V[1] : Ar(M, V[1], b.zoom)];
}(S, l, m, v), getCircleRadiusCorrection: (S) => 1 };
}
class Qn {
constructor(l) {
this._sortAcrossTiles = l.layout.get("symbol-z-order") !== "viewport-y" && !l.layout.get("symbol-sort-key").isConstant(), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];
}
continuePlacement(l, m, v, b, M) {
const V = this._bucketParts;
for (; this._currentTileIndex < l.length; )
if (m.getBucketParts(V, b, l[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, M())
return !0;
for (this._sortAcrossTiles && (this._sortAcrossTiles = !1, V.sort((D, j) => D.sortKey - j.sortKey)); this._currentPartIndex < V.length; )
if (m.placeLayerBucketPart(V[this._currentPartIndex], this._seenCrossTileIDs, v), this._currentPartIndex++, M())
return !0;
return !1;
}
}
class Ui {
constructor(l, m, v, b, M, V, D, j) {
this.placement = new Ri(l, u1(), m, V, D, j), this._currentPlacementIndex = v.length - 1, this._forceFullPlacement = b, this._showCollisionBoxes = M, this._done = !1;
}
isDone() {
return this._done;
}
continuePlacement(l, m, v) {
const b = f.now(), M = () => !this._forceFullPlacement && f.now() - b > 2;
for (; this._currentPlacementIndex >= 0; ) {
const V = m[l[this._currentPlacementIndex]], D = this.placement.collisionIndex.transform.zoom;
if (V.type === "symbol" && (!V.minzoom || V.minzoom <= D) && (!V.maxzoom || V.maxzoom > D)) {
if (this._inProgressLayer || (this._inProgressLayer = new Qn(V)), this._inProgressLayer.continuePlacement(v[V.source], this.placement, this._showCollisionBoxes, V, M))
return;
delete this._inProgressLayer;
}
this._currentPlacementIndex--;
}
this._done = !0;
}
commit(l) {
return this.placement.commit(l), this.placement;
}
}
const h1 = 512 / a.X / 2;
class jn {
constructor(l, m, v) {
this.tileID = l, this.bucketInstanceId = v, this._symbolsByKey = {};
const b = /* @__PURE__ */ new Map();
for (let M = 0; M < m.length; M++) {
const V = m.get(M), D = V.key, j = b.get(D);
j ? j.push(V) : b.set(D, [V]);
}
for (const [M, V] of b) {
const D = { positions: V.map((j) => ({ x: Math.floor(j.anchorX * h1), y: Math.floor(j.anchorY * h1) })), crossTileIDs: V.map((j) => j.crossTileID) };
if (D.positions.length > 128) {
const j = new a.av(D.positions.length, 16, Uint16Array);
for (const { x: Z, y: Y } of D.positions)
j.add(Z, Y);
j.finish(), delete D.positions, D.index = j;
}
this._symbolsByKey[M] = D;
}
}
getScaledCoordinates(l, m) {
const { x: v, y: b, z: M } = this.tileID.canonical, { x: V, y: D, z: j } = m.canonical, Z = h1 / Math.pow(2, j - M), Y = (D * a.X + l.anchorY) * Z, J = b * a.X * h1;
return { x: Math.floor((V * a.X + l.anchorX) * Z - v * a.X * h1), y: Math.floor(Y - J) };
}
findMatches(l, m, v) {
const b = this.tileID.canonical.z < m.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - m.canonical.z);
for (let M = 0; M < l.length; M++) {
const V = l.get(M);
if (V.crossTileID)
continue;
const D = this._symbolsByKey[V.key];
if (!D)
continue;
const j = this.getScaledCoordinates(V, m);
if (D.index) {
const Z = D.index.range(j.x - b, j.y - b, j.x + b, j.y + b).sort();
for (const Y of Z) {
const J = D.crossTileIDs[Y];
if (!v[J]) {
v[J] = !0, V.crossTileID = J;
break;
}
}
} else if (D.positions)
for (let Z = 0; Z < D.positions.length; Z++) {
const Y = D.positions[Z], J = D.crossTileIDs[Z];
if (Math.abs(Y.x - j.x) <= b && Math.abs(Y.y - j.y) <= b && !v[J]) {
v[J] = !0, V.crossTileID = J;
break;
}
}
}
}
getCrossTileIDsLists() {
return Object.values(this._symbolsByKey).map(({ crossTileIDs: l }) => l);
}
}
class ns {
constructor() {
this.maxCrossTileID = 0;
}
generate() {
return ++this.maxCrossTileID;
}
}
class d1 {
constructor() {
this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;
}
handleWrapJump(l) {
const m = Math.round((l - this.lng) / 360);
if (m !== 0)
for (const v in this.indexes) {
const b = this.indexes[v], M = {};
for (const V in b) {
const D = b[V];
D.tileID = D.tileID.unwrapTo(D.tileID.wrap + m), M[D.tileID.key] = D;
}
this.indexes[v] = M;
}
this.lng = l;
}
addBucket(l, m, v) {
if (this.indexes[l.overscaledZ] && this.indexes[l.overscaledZ][l.key]) {
if (this.indexes[l.overscaledZ][l.key].bucketInstanceId === m.bucketInstanceId)
return !1;
this.removeBucketCrossTileIDs(l.overscaledZ, this.indexes[l.overscaledZ][l.key]);
}
for (let M = 0; M < m.symbolInstances.length; M++)
m.symbolInstances.get(M).crossTileID = 0;
this.usedCrossTileIDs[l.overscaledZ] || (this.usedCrossTileIDs[l.overscaledZ] = {});
const b = this.usedCrossTileIDs[l.overscaledZ];
for (const M in this.indexes) {
const V = this.indexes[M];
if (Number(M) > l.overscaledZ)
for (const D in V) {
const j = V[D];
j.tileID.isChildOf(l) && j.findMatches(m.symbolInstances, l, b);
}
else {
const D = V[l.scaledTo(Number(M)).key];
D && D.findMatches(m.symbolInstances, l, b);
}
}
for (let M = 0; M < m.symbolInstances.length; M++) {
const V = m.symbolInstances.get(M);
V.crossTileID || (V.crossTileID = v.generate(), b[V.crossTileID] = !0);
}
return this.indexes[l.overscaledZ] === void 0 && (this.indexes[l.overscaledZ] = {}), this.indexes[l.overscaledZ][l.key] = new jn(l, m.symbolInstances, m.bucketInstanceId), !0;
}
removeBucketCrossTileIDs(l, m) {
for (const v of m.getCrossTileIDsLists())
for (const b of v)
delete this.usedCrossTileIDs[l][b];
}
removeStaleBuckets(l) {
let m = !1;
for (const v in this.indexes) {
const b = this.indexes[v];
for (const M in b)
l[b[M].bucketInstanceId] || (this.removeBucketCrossTileIDs(v, b[M]), delete b[M], m = !0);
}
return m;
}
}
class b2 {
constructor() {
this.layerIndexes = {}, this.crossTileIDs = new ns(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
}
addLayer(l, m, v) {
let b = this.layerIndexes[l.id];
b === void 0 && (b = this.layerIndexes[l.id] = new d1());
let M = !1;
const V = {};
b.handleWrapJump(v);
for (const D of m) {
const j = D.getBucket(l);
j && l.id === j.layerIds[0] && (j.bucketInstanceId || (j.bucketInstanceId = ++this.maxBucketInstanceId), b.addBucket(D.tileID, j, this.crossTileIDs) && (M = !0), V[j.bucketInstanceId] = !0);
}
return b.removeStaleBuckets(V) && (M = !0), M;
}
pruneUnusedLayers(l) {
const m = {};
l.forEach((v) => {
m[v] = !0;
});
for (const v in this.layerIndexes)
m[v] || delete this.layerIndexes[v];
}
}
const e1 = (S, l) => a.t(S, l && l.filter((m) => m.identifier !== "source.canvas")), Ho = a.aw();
class ma extends a.E {
constructor(l, m = {}) {
super(), this._rtlPluginLoaded = () => {
for (const v in this.sourceCaches) {
const b = this.sourceCaches[v].getSource().type;
b !== "vector" && b !== "geojson" || this.sourceCaches[v].reload();
}
}, this.map = l, this.dispatcher = new de(me(), l._getMapId()), this.dispatcher.registerMessageHandler("GG", (v, b) => this.getGlyphs(v, b)), this.dispatcher.registerMessageHandler("GI", (v, b) => this.getImages(v, b)), this.imageManager = new It(), this.imageManager.setEventedParent(this), this.glyphManager = new Ve(l._requestManager, m.localIdeographFontFamily), this.lineAtlas = new He(256, 512), this.crossTileSymbolIndex = new b2(), this._spritesImagesIds = {}, this._layers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new a.ax(), this._loaded = !1, this._availableImages = [], this._resetUpdates(), this.dispatcher.broadcast("SR", a.ay()), Hi().on(ye, this._rtlPluginLoaded), this.on("data", (v) => {
if (v.dataType !== "source" || v.sourceDataType !== "metadata")
return;
const b = this.sourceCaches[v.sourceId];
if (!b)
return;
const M = b.getSource();
if (M && M.vectorLayerIds)
for (const V in this._layers) {
const D = this._layers[V];
D.source === M.id && this._validateLayer(D);
}
});
}
loadURL(l, m = {}, v) {
this.fire(new a.k("dataloading", { dataType: "style" })), m.validate = typeof m.validate != "boolean" || m.validate;
const b = this.map._requestManager.transformRequest(l, "Style");
this._loadStyleRequest = new AbortController();
const M = this._loadStyleRequest;
a.h(b, this._loadStyleRequest).then((V) => {
this._loadStyleRequest = null, this._load(V.data, m, v);
}).catch((V) => {
this._loadStyleRequest = null, V && !M.signal.aborted && this.fire(new a.j(V));
});
}
loadJSON(l, m = {}, v) {
this.fire(new a.k("dataloading", { dataType: "style" })), this._frameRequest = new AbortController(), f.frameAsync(this._frameRequest).then(() => {
this._frameRequest = null, m.validate = m.validate !== !1, this._load(l, m, v);
}).catch(() => {
});
}
loadEmpty() {
this.fire(new a.k("dataloading", { dataType: "style" })), this._load(Ho, { validate: !1 });
}
_load(l, m, v) {
var b;
const M = m.transformStyle ? m.transformStyle(v, l) : l;
if (!m.validate || !e1(this, a.u(M))) {
this._loaded = !0, this.stylesheet = M;
for (const V in M.sources)
this.addSource(V, M.sources[V], { validate: !1 });
M.sprite ? this._loadSprite(M.sprite) : this.imageManager.setLoaded(!0), this.glyphManager.setURL(M.glyphs), this._createLayers(), this.light = new ie(this.stylesheet.light), this.sky = new Ke(this.stylesheet.sky), this.map.setTerrain((b = this.stylesheet.terrain) !== null && b !== void 0 ? b : null), this.fire(new a.k("data", { dataType: "style" })), this.fire(new a.k("style.load"));
}
}
_createLayers() {
const l = a.az(this.stylesheet.layers);
this.dispatcher.broadcast("SL", l), this._order = l.map((m) => m.id), this._layers = {}, this._serializedLayers = null;
for (const m of l) {
const v = a.aA(m);
v.setEventedParent(this, { layer: { id: m.id } }), this._layers[m.id] = v;
}
}
_loadSprite(l, m = !1, v = void 0) {
let b;
this.imageManager.setLoaded(!1), this._spriteRequest = new AbortController(), function(M, V, D, j) {
return a._(this, void 0, void 0, function* () {
const Z = nt(M), Y = D > 1 ? "@2x" : "", J = {}, lt = {};
for (const { id: ft, url: Qt } of Z) {
const wt = V.transformRequest(ct(Qt, Y, ".json"), "SpriteJSON");
J[ft] = a.h(wt, j);
const Mt = V.transformRequest(ct(Qt, Y, ".png"), "SpriteImage");
lt[ft] = k.getImage(Mt, j);
}
return yield Promise.all([...Object.values(J), ...Object.values(lt)]), function(ft, Qt) {
return a._(this, void 0, void 0, function* () {
const wt = {};
for (const Mt in ft) {
wt[Mt] = {};
const Ht = f.getImageCanvasContext((yield Qt[Mt]).data), Ot = (yield ft[Mt]).data;
for (const bt in Ot) {
const { width: Nt, height: Dt, x: Wt, y: he, sdf: we, pixelRatio: De, stretchX: tr, stretchY: Oe, content: Ae, textFitWidth: ur, textFitHeight: Nr } = Ot[bt];
wt[Mt][bt] = { data: null, pixelRatio: De, sdf: we, stretchX: tr, stretchY: Oe, content: Ae, textFitWidth: ur, textFitHeight: Nr, spriteData: { width: Nt, height: Dt, x: Wt, y: he, context: Ht } };
}
}
return wt;
});
}(J, lt);
});
}(l, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then((M) => {
if (this._spriteRequest = null, M)
for (const V in M) {
this._spritesImagesIds[V] = [];
const D = this._spritesImagesIds[V] ? this._spritesImagesIds[V].filter((j) => !(j in M)) : [];
for (const j of D)
this.imageManager.removeImage(j), this._changedImages[j] = !0;
for (const j in M[V]) {
const Z = V === "default" ? j : `${V}:${j}`;
this._spritesImagesIds[V].push(Z), Z in this.imageManager.images ? this.imageManager.updateImage(Z, M[V][j], !1) : this.imageManager.addImage(Z, M[V][j]), m && (this._changedImages[Z] = !0);
}
}
}).catch((M) => {
this._spriteRequest = null, b = M, this.fire(new a.j(b));
}).finally(() => {
this.imageManager.setLoaded(!0), this._availableImages = this.imageManager.listImages(), m && (this._changed = !0), this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" })), v && v(b);
});
}
_unloadSprite() {
for (const l of Object.values(this._spritesImagesIds).flat())
this.imageManager.removeImage(l), this._changedImages[l] = !0;
this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
}
_validateLayer(l) {
const m = this.sourceCaches[l.source];
if (!m)
return;
const v = l.sourceLayer;
if (!v)
return;
const b = m.getSource();
(b.type === "geojson" || b.vectorLayerIds && b.vectorLayerIds.indexOf(v) === -1) && this.fire(new a.j(new Error(`Source layer "${v}" does not exist on source "${b.id}" as specified by style layer "${l.id}".`)));
}
loaded() {
if (!this._loaded || Object.keys(this._updatedSources).length)
return !1;
for (const l in this.sourceCaches)
if (!this.sourceCaches[l].loaded())
return !1;
return !!this.imageManager.isLoaded();
}
_serializeByIds(l, m = !1) {
const v = this._serializedAllLayers();
if (!l || l.length === 0)
return Object.values(m ? a.aB(v) : v);
const b = [];
for (const M of l)
if (v[M]) {
const V = m ? a.aB(v[M]) : v[M];
b.push(V);
}
return b;
}
_serializedAllLayers() {
let l = this._serializedLayers;
if (l)
return l;
l = this._serializedLayers = {};
const m = Object.keys(this._layers);
for (const v of m) {
const b = this._layers[v];
b.type !== "custom" && (l[v] = b.serialize());
}
return l;
}
hasTransitions() {
if (this.light && this.light.hasTransition() || this.sky && this.sky.hasTransition())
return !0;
for (const l in this.sourceCaches)
if (this.sourceCaches[l].hasTransition())
return !0;
for (const l in this._layers)
if (this._layers[l].hasTransition())
return !0;
return !1;
}
_checkLoaded() {
if (!this._loaded)
throw new Error("Style is not done loading.");
}
update(l) {
if (!this._loaded)
return;
const m = this._changed;
if (m) {
const b = Object.keys(this._updatedLayers), M = Object.keys(this._removedLayers);
(b.length || M.length) && this._updateWorkerLayers(b, M);
for (const V in this._updatedSources) {
const D = this._updatedSources[V];
if (D === "reload")
this._reloadSource(V);
else {
if (D !== "clear")
throw new Error(`Invalid action ${D}`);
this._clearSource(V);
}
}
this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();
for (const V in this._updatedPaintProps)
this._layers[V].updateTransitions(l);
this.light.updateTransitions(l), this.sky.updateTransitions(l), this._resetUpdates();
}
const v = {};
for (const b in this.sourceCaches) {
const M = this.sourceCaches[b];
v[b] = M.used, M.used = !1;
}
for (const b of this._order) {
const M = this._layers[b];
M.recalculate(l, this._availableImages), !M.isHidden(l.zoom) && M.source && (this.sourceCaches[M.source].used = !0);
}
for (const b in v) {
const M = this.sourceCaches[b];
!!v[b] != !!M.used && M.fire(new a.k("data", { sourceDataType: "visibility", dataType: "source", sourceId: b }));
}
this.light.recalculate(l), this.sky.recalculate(l), this.z = l.zoom, m && this.fire(new a.k("data", { dataType: "style" }));
}
_updateTilesForChangedImages() {
const l = Object.keys(this._changedImages);
if (l.length) {
for (const m in this.sourceCaches)
this.sourceCaches[m].reloadTilesForDependencies(["icons", "patterns"], l);
this._changedImages = {};
}
}
_updateTilesForChangedGlyphs() {
if (this._glyphsDidChange) {
for (const l in this.sourceCaches)
this.sourceCaches[l].reloadTilesForDependencies(["glyphs"], [""]);
this._glyphsDidChange = !1;
}
}
_updateWorkerLayers(l, m) {
this.dispatcher.broadcast("UL", { layers: this._serializeByIds(l, !1), removedIds: m });
}
_resetUpdates() {
this._changed = !1, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = !1;
}
setState(l, m = {}) {
var v;
this._checkLoaded();
const b = this.serialize();
if (l = m.transformStyle ? m.transformStyle(b, l) : l, ((v = m.validate) === null || v === void 0 || v) && e1(this, a.u(l)))
return !1;
(l = a.aB(l)).layers = a.az(l.layers);
const M = a.aC(b, l), V = this._getOperationsToPerform(M);
if (V.unimplemented.length > 0)
throw new Error(`Unimplemented: ${V.unimplemented.join(", ")}.`);
if (V.operations.length === 0)
return !1;
for (const D of V.operations)
D();
return this.stylesheet = l, this._serializedLayers = null, !0;
}
_getOperationsToPerform(l) {
const m = [], v = [];
for (const b of l)
switch (b.command) {
case "setCenter":
case "setZoom":
case "setBearing":
case "setPitch":
continue;
case "addLayer":
m.push(() => this.addLayer.apply(this, b.args));
break;
case "removeLayer":
m.push(() => this.removeLayer.apply(this, b.args));
break;
case "setPaintProperty":
m.push(() => this.setPaintProperty.apply(this, b.args));
break;
case "setLayoutProperty":
m.push(() => this.setLayoutProperty.apply(this, b.args));
break;
case "setFilter":
m.push(() => this.setFilter.apply(this, b.args));
break;
case "addSource":
m.push(() => this.addSource.apply(this, b.args));
break;
case "removeSource":
m.push(() => this.removeSource.apply(this, b.args));
break;
case "setLayerZoomRange":
m.push(() => this.setLayerZoomRange.apply(this, b.args));
break;
case "setLight":
m.push(() => this.setLight.apply(this, b.args));
break;
case "setGeoJSONSourceData":
m.push(() => this.setGeoJSONSourceData.apply(this, b.args));
break;
case "setGlyphs":
m.push(() => this.setGlyphs.apply(this, b.args));
break;
case "setSprite":
m.push(() => this.setSprite.apply(this, b.args));
break;
case "setSky":
m.push(() => this.setSky.apply(this, b.args));
break;
case "setTerrain":
m.push(() => this.map.setTerrain.apply(this, b.args));
break;
case "setTransition":
m.push(() => {
});
break;
default:
v.push(b.command);
}
return { operations: m, unimplemented: v };
}
addImage(l, m) {
if (this.getImage(l))
return this.fire(new a.j(new Error(`An image named "${l}" already exists.`)));
this.imageManager.addImage(l, m), this._afterImageUpdated(l);
}
updateImage(l, m) {
this.imageManager.updateImage(l, m);
}
getImage(l) {
return this.imageManager.getImage(l);
}
removeImage(l) {
if (!this.getImage(l))
return this.fire(new a.j(new Error(`An image named "${l}" does not exist.`)));
this.imageManager.removeImage(l), this._afterImageUpdated(l);
}
_afterImageUpdated(l) {
this._availableImages = this.imageManager.listImages(), this._changedImages[l] = !0, this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
}
listImages() {
return this._checkLoaded(), this.imageManager.listImages();
}
addSource(l, m, v = {}) {
if (this._checkLoaded(), this.sourceCaches[l] !== void 0)
throw new Error(`Source "${l}" already exists.`);
if (!m.type)
throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);
if (["vector", "raster", "geojson", "video", "image"].indexOf(m.type) >= 0 && this._validate(a.u.source, `sources.${l}`, m, null, v))
return;
this.map && this.map._collectResourceTiming && (m.collectResourceTiming = !0);
const b = this.sourceCaches[l] = new _r(l, m, this.dispatcher);
b.style = this, b.setEventedParent(this, () => ({ isSourceLoaded: b.loaded(), source: b.serialize(), sourceId: l })), b.onAdd(this.map), this._changed = !0;
}
removeSource(l) {
if (this._checkLoaded(), this.sourceCaches[l] === void 0)
throw new Error("There is no source with this ID");
for (const v in this._layers)
if (this._layers[v].source === l)
return this.fire(new a.j(new Error(`Source "${l}" cannot be removed while layer "${v}" is using it.`)));
const m = this.sourceCaches[l];
delete this.sourceCaches[l], delete this._updatedSources[l], m.fire(new a.k("data", { sourceDataType: "metadata", dataType: "source", sourceId: l })), m.setEventedParent(null), m.onRemove(this.map), this._changed = !0;
}
setGeoJSONSourceData(l, m) {
if (this._checkLoaded(), this.sourceCaches[l] === void 0)
throw new Error(`There is no source with this ID=${l}`);
const v = this.sourceCaches[l].getSource();
if (v.type !== "geojson")
throw new Error(`geojsonSource.type is ${v.type}, which is !== 'geojson`);
v.setData(m), this._changed = !0;
}
getSource(l) {
return this.sourceCaches[l] && this.sourceCaches[l].getSource();
}
addLayer(l, m, v = {}) {
this._checkLoaded();
const b = l.id;
if (this.getLayer(b))
return void this.fire(new a.j(new Error(`Layer "${b}" already exists on this map.`)));
let M;
if (l.type === "custom") {
if (e1(this, a.aD(l)))
return;
M = a.aA(l);
} else {
if ("source" in l && typeof l.source == "object" && (this.addSource(b, l.source), l = a.aB(l), l = a.e(l, { source: b })), this._validate(a.u.layer, `layers.${b}`, l, { arrayIndex: -1 }, v))
return;
M = a.aA(l), this._validateLayer(M), M.setEventedParent(this, { layer: { id: b } });
}
const V = m ? this._order.indexOf(m) : this._order.length;
if (m && V === -1)
this.fire(new a.j(new Error(`Cannot add layer "${b}" before non-existing layer "${m}".`)));
else {
if (this._order.splice(V, 0, b), this._layerOrderChanged = !0, this._layers[b] = M, this._removedLayers[b] && M.source && M.type !== "custom") {
const D = this._removedLayers[b];
delete this._removedLayers[b], D.type !== M.type ? this._updatedSources[M.source] = "clear" : (this._updatedSources[M.source] = "reload", this.sourceCaches[M.source].pause());
}
this._updateLayer(M), M.onAdd && M.onAdd(this.map);
}
}
moveLayer(l, m) {
if (this._checkLoaded(), this._changed = !0, !this._layers[l])
return void this.fire(new a.j(new Error(`The layer '${l}' does not exist in the map's style and cannot be moved.`)));
if (l === m)
return;
const v = this._order.indexOf(l);
this._order.splice(v, 1);
const b = m ? this._order.indexOf(m) : this._order.length;
m && b === -1 ? this.fire(new a.j(new Error(`Cannot move layer "${l}" before non-existing layer "${m}".`))) : (this._order.splice(b, 0, l), this._layerOrderChanged = !0);
}
removeLayer(l) {
this._checkLoaded();
const m = this._layers[l];
if (!m)
return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${l}".`)));
m.setEventedParent(null);
const v = this._order.indexOf(l);
this._order.splice(v, 1), this._layerOrderChanged = !0, this._changed = !0, this._removedLayers[l] = m, delete this._layers[l], this._serializedLayers && delete this._serializedLayers[l], delete this._updatedLayers[l], delete this._updatedPaintProps[l], m.onRemove && m.onRemove(this.map);
}
getLayer(l) {
return this._layers[l];
}
getLayersOrder() {
return [...this._order];
}
hasLayer(l) {
return l in this._layers;
}
setLayerZoomRange(l, m, v) {
this._checkLoaded();
const b = this.getLayer(l);
b ? b.minzoom === m && b.maxzoom === v || (m != null && (b.minzoom = m), v != null && (b.maxzoom = v), this._updateLayer(b)) : this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${l}".`)));
}
setFilter(l, m, v = {}) {
this._checkLoaded();
const b = this.getLayer(l);
if (b) {
if (!a.aE(b.filter, m))
return m == null ? (b.filter = void 0, void this._updateLayer(b)) : void (this._validate(a.u.filter, `layers.${b.id}.filter`, m, null, v) || (b.filter = a.aB(m), this._updateLayer(b)));
} else
this.fire(new a.j(new Error(`Cannot filter non-existing layer "${l}".`)));
}
getFilter(l) {
return a.aB(this.getLayer(l).filter);
}
setLayoutProperty(l, m, v, b = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getLayoutProperty(m), v) || (M.setLayoutProperty(m, v, b), this._updateLayer(M)) : this.fire(new a.j(new Error(`Cannot style non-existing layer "${l}".`)));
}
getLayoutProperty(l, m) {
const v = this.getLayer(l);
if (v)
return v.getLayoutProperty(m);
this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${l}".`)));
}
setPaintProperty(l, m, v, b = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getPaintProperty(m), v) || (M.setPaintProperty(m, v, b) && this._updateLayer(M), this._changed = !0, this._updatedPaintProps[l] = !0, this._serializedLayers = null) : this.fire(new a.j(new Error(`Cannot style non-existing layer "${l}".`)));
}
getPaintProperty(l, m) {
return this.getLayer(l).getPaintProperty(m);
}
setFeatureState(l, m) {
this._checkLoaded();
const v = l.source, b = l.sourceLayer, M = this.sourceCaches[v];
if (M === void 0)
return void this.fire(new a.j(new Error(`The source '${v}' does not exist in the map's style.`)));
const V = M.getSource().type;
V === "geojson" && b ? this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : V !== "vector" || b ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), M.setFeatureState(b, l.id, m)) : this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
}
removeFeatureState(l, m) {
this._checkLoaded();
const v = l.source, b = this.sourceCaches[v];
if (b === void 0)
return void this.fire(new a.j(new Error(`The source '${v}' does not exist in the map's style.`)));
const M = b.getSource().type, V = M === "vector" ? l.sourceLayer : void 0;
M !== "vector" || V ? m && typeof l.id != "string" && typeof l.id != "number" ? this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))) : b.removeFeatureState(V, l.id, m) : this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
}
getFeatureState(l) {
this._checkLoaded();
const m = l.source, v = l.sourceLayer, b = this.sourceCaches[m];
if (b !== void 0)
return b.getSource().type !== "vector" || v ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), b.getFeatureState(v, l.id)) : void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
this.fire(new a.j(new Error(`The source '${m}' does not exist in the map's style.`)));
}
getTransition() {
return a.e({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);
}
serialize() {
if (!this._loaded)
return;
const l = a.aF(this.sourceCaches, (M) => M.serialize()), m = this._serializeByIds(this._order, !0), v = this.map.getTerrain() || void 0, b = this.stylesheet;
return a.aG({ version: b.version, name: b.name, metadata: b.metadata, light: b.light, sky: b.sky, center: b.center, zoom: b.zoom, bearing: b.bearing, pitch: b.pitch, sprite: b.sprite, glyphs: b.glyphs, transition: b.transition, sources: l, layers: m, terrain: v }, (M) => M !== void 0);
}
_updateLayer(l) {
this._updatedLayers[l.id] = !0, l.source && !this._updatedSources[l.source] && this.sourceCaches[l.source].getSource().type !== "raster" && (this._updatedSources[l.source] = "reload", this.sourceCaches[l.source].pause()), this._serializedLayers = null, this._changed = !0;
}
_flattenAndSortRenderedFeatures(l) {
const m = (V) => this._layers[V].type === "fill-extrusion", v = {}, b = [];
for (let V = this._order.length - 1; V >= 0; V--) {
const D = this._order[V];
if (m(D)) {
v[D] = V;
for (const j of l) {
const Z = j[D];
if (Z)
for (const Y of Z)
b.push(Y);
}
}
}
b.sort((V, D) => D.intersectionZ - V.intersectionZ);
const M = [];
for (let V = this._order.length - 1; V >= 0; V--) {
const D = this._order[V];
if (m(D))
for (let j = b.length - 1; j >= 0; j--) {
const Z = b[j].feature;
if (v[Z.layer.id] < V)
break;
M.push(Z), b.pop();
}
else
for (const j of l) {
const Z = j[D];
if (Z)
for (const Y of Z)
M.push(Y.feature);
}
}
return M;
}
queryRenderedFeatures(l, m, v) {
m && m.filter && this._validate(a.u.filter, "queryRenderedFeatures.filter", m.filter, null, m);
const b = {};
if (m && m.layers) {
if (!Array.isArray(m.layers))
return this.fire(new a.j(new Error("parameters.layers must be an Array."))), [];
for (const D of m.layers) {
const j = this._layers[D];
if (!j)
return this.fire(new a.j(new Error(`The layer '${D}' does not exist in the map's style and cannot be queried for features.`))), [];
b[j.source] = !0;
}
}
const M = [];
m.availableImages = this._availableImages;
const V = this._serializedAllLayers();
for (const D in this.sourceCaches)
m.layers && !b[D] || M.push(qe(this.sourceCaches[D], this._layers, V, l, m, v));
return this.placement && M.push(function(D, j, Z, Y, J, lt, ft) {
const Qt = {}, wt = lt.queryRenderedSymbols(Y), Mt = [];
for (const Ht of Object.keys(wt).map(Number))
Mt.push(ft[Ht]);
Mt.sort($e);
for (const Ht of Mt) {
const Ot = Ht.featureIndex.lookupSymbolFeatures(wt[Ht.bucketInstanceId], j, Ht.bucketIndex, Ht.sourceLayerIndex, J.filter, J.layers, J.availableImages, D);
for (const bt in Ot) {
const Nt = Qt[bt] = Qt[bt] || [], Dt = Ot[bt];
Dt.sort((Wt, he) => {
const we = Ht.featureSortOrder;
if (we) {
const De = we.indexOf(Wt.featureIndex);
return we.indexOf(he.featureIndex) - De;
}
return he.featureIndex - Wt.featureIndex;
});
for (const Wt of Dt)
Nt.push(Wt);
}
}
for (const Ht in Qt)
Qt[Ht].forEach((Ot) => {
const bt = Ot.feature, Nt = Z[D[Ht].source].getFeatureState(bt.layer["source-layer"], bt.id);
bt.source = bt.layer.source, bt.layer["source-layer"] && (bt.sourceLayer = bt.layer["source-layer"]), bt.state = Nt;
});
return Qt;
}(this._layers, V, this.sourceCaches, l, m, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(M);
}
querySourceFeatures(l, m) {
m && m.filter && this._validate(a.u.filter, "querySourceFeatures.filter", m.filter, null, m);
const v = this.sourceCaches[l];
return v ? function(b, M) {
const V = b.getRenderableIds().map((Z) => b.getTileByID(Z)), D = [], j = {};
for (let Z = 0; Z < V.length; Z++) {
const Y = V[Z], J = Y.tileID.canonical.key;
j[J] || (j[J] = !0, Y.querySourceFeatures(D, M));
}
return D;
}(v, m) : [];
}
getLight() {
return this.light.getLight();
}
setLight(l, m = {}) {
this._checkLoaded();
const v = this.light.getLight();
let b = !1;
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = !0;
break;
}
if (!b)
return;
const M = { now: f.now(), transition: a.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
this.light.setLight(l, m), this.light.updateTransitions(M);
}
getSky() {
var l;
return (l = this.stylesheet) === null || l === void 0 ? void 0 : l.sky;
}
setSky(l, m = {}) {
const v = this.getSky();
let b = !1;
if (!l && !v)
return;
if (l && !v)
b = !0;
else if (!l && v)
b = !0;
else
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = !0;
break;
}
if (!b)
return;
const M = { now: f.now(), transition: a.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
this.stylesheet.sky = l, this.sky.setSky(l, m), this.sky.updateTransitions(M);
}
_validate(l, m, v, b, M = {}) {
return (!M || M.validate !== !1) && e1(this, l.call(a.u, a.e({ key: m, style: this.serialize(), value: v, styleSpec: a.v }, b)));
}
_remove(l = !0) {
this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._loadStyleRequest && (this._loadStyleRequest.abort(), this._loadStyleRequest = null), this._spriteRequest && (this._spriteRequest.abort(), this._spriteRequest = null), Hi().off(ye, this._rtlPluginLoaded);
for (const m in this._layers)
this._layers[m].setEventedParent(null);
for (const m in this.sourceCaches) {
const v = this.sourceCaches[m];
v.setEventedParent(null), v.onRemove(this.map);
}
this.imageManager.setEventedParent(null), this.setEventedParent(null), l && this.dispatcher.broadcast("RM", void 0), this.dispatcher.remove(l);
}
_clearSource(l) {
this.sourceCaches[l].clearTiles();
}
_reloadSource(l) {
this.sourceCaches[l].resume(), this.sourceCaches[l].reload();
}
_updateSources(l) {
for (const m in this.sourceCaches)
this.sourceCaches[m].update(l, this.map.terrain);
}
_generateCollisionBoxes() {
for (const l in this.sourceCaches)
this._reloadSource(l);
}
_updatePlacement(l, m, v, b, M = !1) {
let V = !1, D = !1;
const j = {};
for (const Z of this._order) {
const Y = this._layers[Z];
if (Y.type !== "symbol")
continue;
if (!j[Y.source]) {
const lt = this.sourceCaches[Y.source];
j[Y.source] = lt.getRenderableIds(!0).map((ft) => lt.getTileByID(ft)).sort((ft, Qt) => Qt.tileID.overscaledZ - ft.tileID.overscaledZ || (ft.tileID.isLessThan(Qt.tileID) ? -1 : 1));
}
const J = this.crossTileSymbolIndex.addLayer(Y, j[Y.source], l.center.lng);
V = V || J;
}
if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), ((M = M || this._layerOrderChanged || v === 0) || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(f.now(), l.zoom)) && (this.pauseablePlacement = new Ui(l, this.map.terrain, this._order, M, m, v, b, this.placement), this._layerOrderChanged = !1), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, j), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(f.now()), D = !0), V && this.pauseablePlacement.placement.setStale()), D || V)
for (const Z of this._order) {
const Y = this._layers[Z];
Y.type === "symbol" && this.placement.updateLayerOpacities(Y, j[Y.source]);
}
return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(f.now());
}
_releaseSymbolFadeTiles() {
for (const l in this.sourceCaches)
this.sourceCaches[l].releaseSymbolFadeTiles();
}
getImages(l, m) {
return a._(this, void 0, void 0, function* () {
const v = yield this.imageManager.getImages(m.icons);
this._updateTilesForChangedImages();
const b = this.sourceCaches[m.source];
return b && b.setDependencies(m.tileID.key, m.type, m.icons), v;
});
}
getGlyphs(l, m) {
return a._(this, void 0, void 0, function* () {
const v = yield this.glyphManager.getGlyphs(m.stacks), b = this.sourceCaches[m.source];
return b && b.setDependencies(m.tileID.key, m.type, [""]), v;
});
}
getGlyphsUrl() {
return this.stylesheet.glyphs || null;
}
setGlyphs(l, m = {}) {
this._checkLoaded(), l && this._validate(a.u.glyphs, "glyphs", l, null, m) || (this._glyphsDidChange = !0, this.stylesheet.glyphs = l, this.glyphManager.entries = {}, this.glyphManager.setURL(l));
}
addSprite(l, m, v = {}, b) {
this._checkLoaded();
const M = [{ id: l, url: m }], V = [...nt(this.stylesheet.sprite), ...M];
this._validate(a.u.sprite, "sprite", V, null, v) || (this.stylesheet.sprite = V, this._loadSprite(M, !0, b));
}
removeSprite(l) {
this._checkLoaded();
const m = nt(this.stylesheet.sprite);
if (m.find((v) => v.id === l)) {
if (this._spritesImagesIds[l])
for (const v of this._spritesImagesIds[l])
this.imageManager.removeImage(v), this._changedImages[v] = !0;
m.splice(m.findIndex((v) => v.id === l), 1), this.stylesheet.sprite = m.length > 0 ? m : void 0, delete this._spritesImagesIds[l], this._availableImages = this.imageManager.listImages(), this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
} else
this.fire(new a.j(new Error(`Sprite "${l}" doesn't exists on this map.`)));
}
getSprite() {
return nt(this.stylesheet.sprite);
}
setSprite(l, m = {}, v) {
this._checkLoaded(), l && this._validate(a.u.sprite, "sprite", l, null, m) || (this.stylesheet.sprite = l, l ? this._loadSprite(l, !0, v) : (this._unloadSprite(), v && v(null)));
}
}
var Xo = a.Y([{ name: "a_pos", type: "Int16", components: 2 }]);
const ho = { prelude: Yr(`#ifdef GL_ES
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
`, `#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
#ifdef TERRAIN3D
uniform 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;
#endif
const 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) {
#ifdef TERRAIN3D
highp 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));
#else
return 1.0;
#endif
}float calculate_visibility(vec4 pos) {
#ifdef TERRAIN3D
vec3 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;
#else
return 1.0;
#endif
}float ele(vec2 pos) {
#ifdef TERRAIN3D
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
#else
return 0.0;
#endif
}float get_elevation(vec2 pos) {
#ifdef TERRAIN3D
vec2 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;
#else
return 0.0;
#endif
}`), background: Yr(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), backgroundPattern: Yr(`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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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: Yr(`varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);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: Yr("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: Yr(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`), heatmapTexture: Yr(`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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`, "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: Yr("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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"), collisionCircle: Yr("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: Yr("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: Yr(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`), fillOutline: Yr(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`), fillOutlinePattern: Yr(`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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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: Yr(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=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: Yr(`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;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 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;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=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
? a_pos
: 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: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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: Yr(`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;
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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: Yr(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
attribute 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`), lineGradient: Yr(`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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
attribute 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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`), linePattern: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute 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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`), lineSDF: Yr(`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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
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 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_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: Yr(`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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "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: Yr(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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: Yr(`#define SDF_PX 8.0
uniform 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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float 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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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 bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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: Yr(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform 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;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float 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;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;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);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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: Yr("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"), terrainDepth: Yr("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);}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"), terrainCoords: Yr("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);}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"), sky: Yr("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}", "attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}") };
function Yr(S, l) {
const m = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, v = l.match(/attribute ([\w]+) ([\w]+)/g), b = S.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), M = l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), V = M ? M.concat(b) : b, D = {};
return { fragmentSource: S = S.replace(m, (j, Z, Y, J, lt) => (D[lt] = !0, Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
varying ${Y} ${J} ${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : `
#ifdef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = u_${lt};
#endif
`)), vertexSource: l = l.replace(m, (j, Z, Y, J, lt) => {
const ft = J === "float" ? "vec2" : "vec4", Qt = lt.match(/color/) ? "color" : ft;
return D[lt] ? Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
uniform lowp float u_${lt}_t;
attribute ${Y} ${ft} a_${lt};
varying ${Y} ${J} ${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${lt}
${lt} = a_${lt};
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : `
#ifndef HAS_UNIFORM_u_${lt}
${lt} = unpack_mix_${Qt}(a_${lt}, u_${lt}_t);
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
uniform lowp float u_${lt}_t;
attribute ${Y} ${ft} a_${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = a_${lt};
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : `
#ifndef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = unpack_mix_${Qt}(a_${lt}, u_${lt}_t);
#else
${Y} ${J} ${lt} = u_${lt};
#endif
`;
}), staticAttributes: v, staticUniforms: V };
}
class I {
constructor() {
this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;
}
bind(l, m, v, b, M, V, D, j, Z) {
this.context = l;
let Y = this.boundPaintVertexBuffers.length !== b.length;
for (let J = 0; !Y && J < b.length; J++)
this.boundPaintVertexBuffers[J] !== b[J] && (Y = !0);
!this.vao || this.boundProgram !== m || this.boundLayoutVertexBuffer !== v || Y || this.boundIndexBuffer !== M || this.boundVertexOffset !== V || this.boundDynamicVertexBuffer !== D || this.boundDynamicVertexBuffer2 !== j || this.boundDynamicVertexBuffer3 !== Z ? this.freshBind(m, v, b, M, V, D, j, Z) : (l.bindVertexArray.set(this.vao), D && D.bind(), M && M.dynamicDraw && M.bind(), j && j.bind(), Z && Z.bind());
}
freshBind(l, m, v, b, M, V, D, j) {
const Z = l.numAttributes, Y = this.context, J = Y.gl;
this.vao && this.destroy(), this.vao = Y.createVertexArray(), Y.bindVertexArray.set(this.vao), this.boundProgram = l, this.boundLayoutVertexBuffer = m, this.boundPaintVertexBuffers = v, this.boundIndexBuffer = b, this.boundVertexOffset = M, this.boundDynamicVertexBuffer = V, this.boundDynamicVertexBuffer2 = D, this.boundDynamicVertexBuffer3 = j, m.enableAttributes(J, l);
for (const lt of v)
lt.enableAttributes(J, l);
V && V.enableAttributes(J, l), D && D.enableAttributes(J, l), j && j.enableAttributes(J, l), m.bind(), m.setVertexAttribPointers(J, l, M);
for (const lt of v)
lt.bind(), lt.setVertexAttribPointers(J, l, M);
V && (V.bind(), V.setVertexAttribPointers(J, l, M)), b && b.bind(), D && (D.bind(), D.setVertexAttribPointers(J, l, M)), j && (j.bind(), j.setVertexAttribPointers(J, l, M)), Y.currentNumAttributes = Z;
}
destroy() {
this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);
}
}
const G = (S, l, m, v, b) => ({ u_matrix: S, u_texture: 0, u_ele_delta: l, u_fog_matrix: m, u_fog_color: v ? v.properties.get("fog-color") : a.aM.white, u_fog_ground_blend: v ? v.properties.get("fog-ground-blend") : 1, u_fog_ground_blend_opacity: v ? v.calculateFogBlendOpacity(b) : 0, u_horizon_color: v ? v.properties.get("horizon-color") : a.aM.white, u_horizon_fog_blend: v ? v.properties.get("horizon-fog-blend") : 1 });
function B(S) {
const l = [];
for (let m = 0; m < S.length; m++) {
if (S[m] === null)
continue;
const v = S[m].split(" ");
l.push(v.pop());
}
return l;
}
class q {
constructor(l, m, v, b, M, V) {
const D = l.gl;
this.program = D.createProgram();
const j = B(m.staticAttributes), Z = v ? v.getBinderAttributes() : [], Y = j.concat(Z), J = ho.prelude.staticUniforms ? B(ho.prelude.staticUniforms) : [], lt = m.staticUniforms ? B(m.staticUniforms) : [], ft = v ? v.getBinderUniforms() : [], Qt = J.concat(lt).concat(ft), wt = [];
for (const Wt of Qt)
wt.indexOf(Wt) < 0 && wt.push(Wt);
const Mt = v ? v.defines() : [];
M && Mt.push("#define OVERDRAW_INSPECTOR;"), V && Mt.push("#define TERRAIN3D;");
const Ht = Mt.concat(ho.prelude.fragmentSource, m.fragmentSource).join(`
`), Ot = Mt.concat(ho.prelude.vertexSource, m.vertexSource).join(`
`), bt = D.createShader(D.FRAGMENT_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(bt, Ht), D.compileShader(bt), !D.getShaderParameter(bt, D.COMPILE_STATUS))
throw new Error(`Could not compile fragment shader: ${D.getShaderInfoLog(bt)}`);
D.attachShader(this.program, bt);
const Nt = D.createShader(D.VERTEX_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(Nt, Ot), D.compileShader(Nt), !D.getShaderParameter(Nt, D.COMPILE_STATUS))
throw new Error(`Could not compile vertex shader: ${D.getShaderInfoLog(Nt)}`);
D.attachShader(this.program, Nt), this.attributes = {};
const Dt = {};
this.numAttributes = Y.length;
for (let Wt = 0; Wt < this.numAttributes; Wt++)
Y[Wt] && (D.bindAttribLocation(this.program, Wt, Y[Wt]), this.attributes[Y[Wt]] = Wt);
if (D.linkProgram(this.program), !D.getProgramParameter(this.program, D.LINK_STATUS))
throw new Error(`Program failed to link: ${D.getProgramInfoLog(this.program)}`);
D.deleteShader(Nt), D.deleteShader(bt);
for (let Wt = 0; Wt < wt.length; Wt++) {
const he = wt[Wt];
if (he && !Dt[he]) {
const we = D.getUniformLocation(this.program, he);
we && (Dt[he] = we);
}
}
this.fixedUniforms = b(l, Dt), this.terrainUniforms = ((Wt, he) => ({ u_depth: new a.aH(Wt, he.u_depth), u_terrain: new a.aH(Wt, he.u_terrain), u_terrain_dim: new a.aI(Wt, he.u_terrain_dim), u_terrain_matrix: new a.aJ(Wt, he.u_terrain_matrix), u_terrain_unpack: new a.aK(Wt, he.u_terrain_unpack), u_terrain_exaggeration: new a.aI(Wt, he.u_terrain_exaggeration) }))(l, Dt), this.binderUniforms = v ? v.getUniforms(l, Dt) : [];
}
draw(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt, Ht, Ot) {
const bt = l.gl;
if (this.failedToCreate)
return;
if (l.program.set(this.program), l.setDepthMode(v), l.setStencilMode(b), l.setColorMode(M), l.setCullFace(V), j) {
l.activeTexture.set(bt.TEXTURE2), bt.bindTexture(bt.TEXTURE_2D, j.depthTexture), l.activeTexture.set(bt.TEXTURE3), bt.bindTexture(bt.TEXTURE_2D, j.texture);
for (const Dt in this.terrainUniforms)
this.terrainUniforms[Dt].set(j[Dt]);
}
for (const Dt in this.fixedUniforms)
this.fixedUniforms[Dt].set(D[Dt]);
wt && wt.setUniforms(l, this.binderUniforms, ft, { zoom: Qt });
let Nt = 0;
switch (m) {
case bt.LINES:
Nt = 2;
break;
case bt.TRIANGLES:
Nt = 3;
break;
case bt.LINE_STRIP:
Nt = 1;
}
for (const Dt of lt.get()) {
const Wt = Dt.vaos || (Dt.vaos = {});
(Wt[Z] || (Wt[Z] = new I())).bind(l, this, Y, wt ? wt.getPaintVertexBuffers() : [], J, Dt.vertexOffset, Mt, Ht, Ot), bt.drawElements(m, Dt.primitiveLength * Nt, bt.UNSIGNED_SHORT, Dt.primitiveOffset * Nt * 2);
}
}
}
function it(S, l, m) {
const v = 1 / Ar(m, 1, l.transform.tileZoom), b = Math.pow(2, m.tileID.overscaledZ), M = m.tileSize * Math.pow(2, l.transform.tileZoom) / b, V = M * (m.tileID.canonical.x + m.tileID.wrap * b), D = M * m.tileID.canonical.y;
return { u_image: 0, u_texsize: m.imageAtlasTexture.size, u_scale: [v, S.fromScale, S.toScale], u_fade: S.t, u_pixel_coord_upper: [V >> 16, D >> 16], u_pixel_coord_lower: [65535 & V, 65535 & D] };
}
const ht = (S, l, m, v) => {
const b = l.style.light, M = b.properties.get("position"), V = [M.x, M.y, M.z], D = function() {
var Z = new a.A(9);
return a.A != Float32Array && (Z[1] = 0, Z[2] = 0, Z[3] = 0, Z[5] = 0, Z[6] = 0, Z[7] = 0), Z[0] = 1, Z[4] = 1, Z[8] = 1, Z;
}();
b.properties.get("anchor") === "viewport" && function(Z, Y) {
var J = Math.sin(Y), lt = Math.cos(Y);
Z[0] = lt, Z[1] = J, Z[2] = 0, Z[3] = -J, Z[4] = lt, Z[5] = 0, Z[6] = 0, Z[7] = 0, Z[8] = 1;
}(D, -l.transform.angle), function(Z, Y, J) {
var lt = Y[0], ft = Y[1], Qt = Y[2];
Z[0] = lt * J[0] + ft * J[3] + Qt * J[6], Z[1] = lt * J[1] + ft * J[4] + Qt * J[7], Z[2] = lt * J[2] + ft * J[5] + Qt * J[8];
}(V, V, D);
const j = b.properties.get("color");
return { u_matrix: S, u_lightpos: V, u_lightintensity: b.properties.get("intensity"), u_lightcolor: [j.r, j.g, j.b], u_vertical_gradient: +m, u_opacity: v };
}, mt = (S, l, m, v, b, M, V) => a.e(ht(S, l, m, v), it(M, l, V), { u_height_factor: -Math.pow(2, b.overscaledZ) / V.tileSize / 8 }), qt = (S) => ({ u_matrix: S }), le = (S, l, m, v) => a.e(qt(S), it(m, l, v)), ve = (S, l) => ({ u_matrix: S, u_world: l }), Me = (S, l, m, v, b) => a.e(le(S, l, m, v), { u_world: b }), be = (S, l, m, v) => {
const b = S.transform;
let M, V;
if (v.paint.get("circle-pitch-alignment") === "map") {
const D = Ar(m, 1, b.zoom);
M = !0, V = [D, D];
} else
M = !1, V = b.pixelsToGLUnits;
return { u_camera_to_center_distance: b.cameraToCenterDistance, u_scale_with_map: +(v.paint.get("circle-pitch-scale") === "map"), u_matrix: S.translatePosMatrix(l.posMatrix, m, v.paint.get("circle-translate"), v.paint.get("circle-translate-anchor")), u_pitch_with_map: +M, u_device_pixel_ratio: S.pixelRatio, u_extrude_scale: V };
}, fr = (S, l, m) => ({ u_matrix: S, u_inv_matrix: l, u_camera_to_center_distance: m.cameraToCenterDistance, u_viewport_size: [m.width, m.height] }), kn = (S, l, m = 1) => ({ u_matrix: S, u_color: l, u_overlay: 0, u_overlay_scale: m }), xr = (S) => ({ u_matrix: S }), un = (S, l, m, v) => ({ u_matrix: S, u_extrude_scale: Ar(l, 1, m), u_intensity: v }), pe = (S, l, m, v) => {
const b = a.H();
a.aP(b, 0, S.width, S.height, 0, 0, 1);
const M = S.context.gl;
return { u_matrix: b, u_world: [M.drawingBufferWidth, M.drawingBufferHeight], u_image: m, u_color_ramp: v, u_opacity: l.paint.get("heatmap-opacity") };
};
function dr(S, l) {
const m = Math.pow(2, l.canonical.z), v = l.canonical.y;
return [new a.Z(0, v / m).toLngLat().lat, new a.Z(0, (v + 1) / m).toLngLat().lat];
}
const Tn = (S, l, m, v) => {
const b = S.transform;
return { u_matrix: Nn(S, l, m, v), u_ratio: 1 / Ar(l, 1, b.zoom), u_device_pixel_ratio: S.pixelRatio, u_units_to_pixels: [1 / b.pixelsToGLUnits[0], 1 / b.pixelsToGLUnits[1]] };
}, Ni = (S, l, m, v, b) => a.e(Tn(S, l, m, b), { u_image: 0, u_image_height: v }), zn = (S, l, m, v, b) => {
const M = S.transform, V = vl(l, M);
return { u_matrix: Nn(S, l, m, b), u_texsize: l.imageAtlasTexture.size, u_ratio: 1 / Ar(l, 1, M.zoom), u_device_pixel_ratio: S.pixelRatio, u_image: 0, u_scale: [V, v.fromScale, v.toScale], u_fade: v.t, u_units_to_pixels: [1 / M.pixelsToGLUnits[0], 1 / M.pixelsToGLUnits[1]] };
}, _0 = (S, l, m, v, b, M) => {
const V = S.lineAtlas, D = vl(l, S.transform), j = m.layout.get("line-cap") === "round", Z = V.getDash(v.from, j), Y = V.getDash(v.to, j), J = Z.width * b.fromScale, lt = Y.width * b.toScale;
return a.e(Tn(S, l, m, M), { u_patternscale_a: [D / J, -Z.height / 2], u_patternscale_b: [D / lt, -Y.height / 2], u_sdfgamma: V.width / (256 * Math.min(J, lt) * S.pixelRatio) / 2, u_image: 0, u_tex_y_a: Z.y, u_tex_y_b: Y.y, u_mix: b.t });
};
function vl(S, l) {
return 1 / Ar(S, 1, l.tileZoom);
}
function Nn(S, l, m, v) {
return S.translatePosMatrix(v ? v.posMatrix : l.tileID.posMatrix, l, m.paint.get("line-translate"), m.paint.get("line-translate-anchor"));
}
const _l = (S, l, m, v, b) => {
return { u_matrix: S, u_tl_parent: l, u_scale_parent: m, u_buffer_scale: 1, u_fade_t: v.mix, u_opacity: v.opacity * b.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: b.paint.get("raster-brightness-min"), u_brightness_high: b.paint.get("raster-brightness-max"), u_saturation_factor: (V = b.paint.get("raster-saturation"), V > 0 ? 1 - 1 / (1.001 - V) : -V), u_contrast_factor: (M = b.paint.get("raster-contrast"), M > 0 ? 1 / (1 - M) : 1 + M), u_spin_weights: yc(b.paint.get("raster-hue-rotate")) };
var M, V;
};
function yc(S) {
S *= Math.PI / 180;
const l = Math.sin(S), m = Math.cos(S);
return [(2 * m + 1) / 3, (-Math.sqrt(3) * l - m + 1) / 3, (Math.sqrt(3) * l - m + 1) / 3];
}
const Ko = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) => {
const Qt = V.transform;
return { u_is_size_zoom_constant: +(S === "constant" || S === "source"), u_is_size_feature_constant: +(S === "constant" || S === "camera"), u_size_t: l ? l.uSizeT : 0, u_size: l ? l.uSize : 0, u_camera_to_center_distance: Qt.cameraToCenterDistance, u_pitch: Qt.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +m, u_aspect_ratio: Qt.width / Qt.height, u_fade_change: V.options.fadeDuration ? V.symbolFadeChange : 1, u_matrix: D, u_label_plane_matrix: j, u_coord_matrix: Z, u_is_text: +J, u_pitch_with_map: +v, u_is_along_line: b, u_is_variable_anchor: M, u_texsize: lt, u_texture: 0, u_translation: Y, u_pitched_scale: ft };
}, ga = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt) => {
const wt = V.transform;
return a.e(Ko(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, Qt), { u_gamma_scale: v ? Math.cos(wt._pitch) * wt.cameraToCenterDistance : 1, u_device_pixel_ratio: V.pixelRatio, u_is_halo: +ft });
}, N4 = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) => a.e(ga(S, l, m, v, b, M, V, D, j, Z, Y, !0, J, !0, ft), { u_texsize_icon: lt, u_texture_icon: 1 }), A3 = (S, l, m) => ({ u_matrix: S, u_opacity: l, u_color: m }), O3 = (S, l, m, v, b, M) => a.e(function(V, D, j, Z) {
const Y = j.imageManager.getPattern(V.from.toString()), J = j.imageManager.getPattern(V.to.toString()), { width: lt, height: ft } = j.imageManager.getPixelSize(), Qt = Math.pow(2, Z.tileID.overscaledZ), wt = Z.tileSize * Math.pow(2, j.transform.tileZoom) / Qt, Mt = wt * (Z.tileID.canonical.x + Z.tileID.wrap * Qt), Ht = wt * Z.tileID.canonical.y;
return { u_image: 0, u_pattern_tl_a: Y.tl, u_pattern_br_a: Y.br, u_pattern_tl_b: J.tl, u_pattern_br_b: J.br, u_texsize: [lt, ft], u_mix: D.t, u_pattern_size_a: Y.displaySize, u_pattern_size_b: J.displaySize, u_scale_a: D.fromScale, u_scale_b: D.toScale, u_tile_units_to_pixels: 1 / Ar(Z, 1, j.transform.tileZoom), u_pixel_coord_upper: [Mt >> 16, Ht >> 16], u_pixel_coord_lower: [65535 & Mt, 65535 & Ht] };
}(v, M, m, b), { u_matrix: S, u_opacity: l }), D4 = { fillExtrusion: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_lightpos: new a.aN(S, l.u_lightpos), u_lightintensity: new a.aI(S, l.u_lightintensity), u_lightcolor: new a.aN(S, l.u_lightcolor), u_vertical_gradient: new a.aI(S, l.u_vertical_gradient), u_opacity: new a.aI(S, l.u_opacity) }), fillExtrusionPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_lightpos: new a.aN(S, l.u_lightpos), u_lightintensity: new a.aI(S, l.u_lightintensity), u_lightcolor: new a.aN(S, l.u_lightcolor), u_vertical_gradient: new a.aI(S, l.u_vertical_gradient), u_height_factor: new a.aI(S, l.u_height_factor), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade), u_opacity: new a.aI(S, l.u_opacity) }), fill: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix) }), fillPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), fillOutline: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world) }), fillOutlinePattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), circle: (S, l) => ({ u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_scale_with_map: new a.aH(S, l.u_scale_with_map), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_extrude_scale: new a.aO(S, l.u_extrude_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_matrix: new a.aJ(S, l.u_matrix) }), collisionBox: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_pixel_extrude_scale: new a.aO(S, l.u_pixel_extrude_scale) }), collisionCircle: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_inv_matrix: new a.aJ(S, l.u_inv_matrix), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_viewport_size: new a.aO(S, l.u_viewport_size) }), debug: (S, l) => ({ u_color: new a.aL(S, l.u_color), u_matrix: new a.aJ(S, l.u_matrix), u_overlay: new a.aH(S, l.u_overlay), u_overlay_scale: new a.aI(S, l.u_overlay_scale) }), clippingMask: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix) }), heatmap: (S, l) => ({ u_extrude_scale: new a.aI(S, l.u_extrude_scale), u_intensity: new a.aI(S, l.u_intensity), u_matrix: new a.aJ(S, l.u_matrix) }), heatmapTexture: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world), u_image: new a.aH(S, l.u_image), u_color_ramp: new a.aH(S, l.u_color_ramp), u_opacity: new a.aI(S, l.u_opacity) }), hillshade: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_latrange: new a.aO(S, l.u_latrange), u_light: new a.aO(S, l.u_light), u_shadow: new a.aL(S, l.u_shadow), u_highlight: new a.aL(S, l.u_highlight), u_accent: new a.aL(S, l.u_accent) }), hillshadePrepare: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_dimension: new a.aO(S, l.u_dimension), u_zoom: new a.aI(S, l.u_zoom), u_unpack: new a.aK(S, l.u_unpack) }), line: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels) }), lineGradient: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_image: new a.aH(S, l.u_image), u_image_height: new a.aI(S, l.u_image_height) }), linePattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texsize: new a.aO(S, l.u_texsize), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_image: new a.aH(S, l.u_image), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), lineSDF: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_patternscale_a: new a.aO(S, l.u_patternscale_a), u_patternscale_b: new a.aO(S, l.u_patternscale_b), u_sdfgamma: new a.aI(S, l.u_sdfgamma), u_image: new a.aH(S, l.u_image), u_tex_y_a: new a.aI(S, l.u_tex_y_a), u_tex_y_b: new a.aI(S, l.u_tex_y_b), u_mix: new a.aI(S, l.u_mix) }), raster: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_tl_parent: new a.aO(S, l.u_tl_parent), u_scale_parent: new a.aI(S, l.u_scale_parent), u_buffer_scale: new a.aI(S, l.u_buffer_scale), u_fade_t: new a.aI(S, l.u_fade_t), u_opacity: new a.aI(S, l.u_opacity), u_image0: new a.aH(S, l.u_image0), u_image1: new a.aH(S, l.u_image1), u_brightness_low: new a.aI(S, l.u_brightness_low), u_brightness_high: new a.aI(S, l.u_brightness_high), u_saturation_factor: new a.aI(S, l.u_saturation_factor), u_contrast_factor: new a.aI(S, l.u_contrast_factor), u_spin_weights: new a.aN(S, l.u_spin_weights) }), symbolIcon: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texture: new a.aH(S, l.u_texture), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), symbolSDF: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texture: new a.aH(S, l.u_texture), u_gamma_scale: new a.aI(S, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_is_halo: new a.aH(S, l.u_is_halo), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), symbolTextAndIcon: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texsize_icon: new a.aO(S, l.u_texsize_icon), u_texture: new a.aH(S, l.u_texture), u_texture_icon: new a.aH(S, l.u_texture_icon), u_gamma_scale: new a.aI(S, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_is_halo: new a.aH(S, l.u_is_halo), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), background: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_opacity: new a.aI(S, l.u_opacity), u_color: new a.aL(S, l.u_color) }), backgroundPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_opacity: new a.aI(S, l.u_opacity), u_image: new a.aH(S, l.u_image), u_pattern_tl_a: new a.aO(S, l.u_pattern_tl_a), u_pattern_br_a: new a.aO(S, l.u_pattern_br_a), u_pattern_tl_b: new a.aO(S, l.u_pattern_tl_b), u_pattern_br_b: new a.aO(S, l.u_pattern_br_b), u_texsize: new a.aO(S, l.u_texsize), u_mix: new a.aI(S, l.u_mix), u_pattern_size_a: new a.aO(S, l.u_pattern_size_a), u_pattern_size_b: new a.aO(S, l.u_pattern_size_b), u_scale_a: new a.aI(S, l.u_scale_a), u_scale_b: new a.aI(S, l.u_scale_b), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_tile_units_to_pixels: new a.aI(S, l.u_tile_units_to_pixels) }), terrain: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texture: new a.aH(S, l.u_texture), u_ele_delta: new a.aI(S, l.u_ele_delta), u_fog_matrix: new a.aJ(S, l.u_fog_matrix), u_fog_color: new a.aL(S, l.u_fog_color), u_fog_ground_blend: new a.aI(S, l.u_fog_ground_blend), u_fog_ground_blend_opacity: new a.aI(S, l.u_fog_ground_blend_opacity), u_horizon_color: new a.aL(S, l.u_horizon_color), u_horizon_fog_blend: new a.aI(S, l.u_horizon_fog_blend) }), terrainDepth: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ele_delta: new a.aI(S, l.u_ele_delta) }), terrainCoords: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texture: new a.aH(S, l.u_texture), u_terrain_coords_id: new a.aI(S, l.u_terrain_coords_id), u_ele_delta: new a.aI(S, l.u_ele_delta) }), sky: (S, l) => ({ u_sky_color: new a.aL(S, l.u_sky_color), u_horizon_color: new a.aL(S, l.u_horizon_color), u_horizon: new a.aI(S, l.u_horizon), u_sky_horizon_blend: new a.aI(S, l.u_sky_horizon_blend) }) };
class Ao {
constructor(l, m, v) {
this.context = l;
const b = l.gl;
this.buffer = b.createBuffer(), this.dynamicDraw = !!v, this.context.unbindVAO(), l.bindElementBuffer.set(this.buffer), b.bufferData(b.ELEMENT_ARRAY_BUFFER, m.arrayBuffer, this.dynamicDraw ? b.DYNAMIC_DRAW : b.STATIC_DRAW), this.dynamicDraw || delete m.arrayBuffer;
}
bind() {
this.context.bindElementBuffer.set(this.buffer);
}
updateData(l) {
const m = this.context.gl;
if (!this.dynamicDraw)
throw new Error("Attempted to update data while not in dynamic mode.");
this.context.unbindVAO(), this.bind(), m.bufferSubData(m.ELEMENT_ARRAY_BUFFER, 0, l.arrayBuffer);
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
}
}
const vc = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" };
class b0 {
constructor(l, m, v, b) {
this.length = m.length, this.attributes = v, this.itemSize = m.bytesPerElement, this.dynamicDraw = b, this.context = l;
const M = l.gl;
this.buffer = M.createBuffer(), l.bindVertexBuffer.set(this.buffer), M.bufferData(M.ARRAY_BUFFER, m.arrayBuffer, this.dynamicDraw ? M.DYNAMIC_DRAW : M.STATIC_DRAW), this.dynamicDraw || delete m.arrayBuffer;
}
bind() {
this.context.bindVertexBuffer.set(this.buffer);
}
updateData(l) {
if (l.length !== this.length)
throw new Error(`Length of new data is ${l.length}, which doesn't match current length of ${this.length}`);
const m = this.context.gl;
this.bind(), m.bufferSubData(m.ARRAY_BUFFER, 0, l.arrayBuffer);
}
enableAttributes(l, m) {
for (let v = 0; v < this.attributes.length; v++) {
const b = m.attributes[this.attributes[v].name];
b !== void 0 && l.enableVertexAttribArray(b);
}
}
setVertexAttribPointers(l, m, v) {
for (let b = 0; b < this.attributes.length; b++) {
const M = this.attributes[b], V = m.attributes[M.name];
V !== void 0 && l.vertexAttribPointer(V, M.components, l[vc[M.type]], !1, this.itemSize, M.offset + this.itemSize * (v || 0));
}
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
}
}
const Bs = /* @__PURE__ */ new WeakMap();
function L2(S) {
var l;
if (Bs.has(S))
return Bs.get(S);
{
const m = (l = S.getParameter(S.VERSION)) === null || l === void 0 ? void 0 : l.startsWith("WebGL 2.0");
return Bs.set(S, m), m;
}
}
class hn {
constructor(l) {
this.gl = l.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = !1;
}
get() {
return this.current;
}
set(l) {
}
getDefault() {
return this.default;
}
setDefault() {
this.set(this.default);
}
}
class C3 extends hn {
getDefault() {
return a.aM.transparent;
}
set(l) {
const m = this.current;
(l.r !== m.r || l.g !== m.g || l.b !== m.b || l.a !== m.a || this.dirty) && (this.gl.clearColor(l.r, l.g, l.b, l.a), this.current = l, this.dirty = !1);
}
}
class _c extends hn {
getDefault() {
return 1;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearDepth(l), this.current = l, this.dirty = !1);
}
}
class ya extends hn {
getDefault() {
return 0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearStencil(l), this.current = l, this.dirty = !1);
}
}
class F4 extends hn {
getDefault() {
return [!0, !0, !0, !0];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || l[3] !== m[3] || this.dirty) && (this.gl.colorMask(l[0], l[1], l[2], l[3]), this.current = l, this.dirty = !1);
}
}
class B4 extends hn {
getDefault() {
return !0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthMask(l), this.current = l, this.dirty = !1);
}
}
class bl extends hn {
getDefault() {
return 255;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.stencilMask(l), this.current = l, this.dirty = !1);
}
}
class Oo extends hn {
getDefault() {
return { func: this.gl.ALWAYS, ref: 0, mask: 255 };
}
set(l) {
const m = this.current;
(l.func !== m.func || l.ref !== m.ref || l.mask !== m.mask || this.dirty) && (this.gl.stencilFunc(l.func, l.ref, l.mask), this.current = l, this.dirty = !1);
}
}
class j4 extends hn {
getDefault() {
const l = this.gl;
return [l.KEEP, l.KEEP, l.KEEP];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || this.dirty) && (this.gl.stencilOp(l[0], l[1], l[2]), this.current = l, this.dirty = !1);
}
}
class L0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.STENCIL_TEST) : m.disable(m.STENCIL_TEST), this.current = l, this.dirty = !1;
}
}
class Ll extends hn {
getDefault() {
return [0, 1];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || this.dirty) && (this.gl.depthRange(l[0], l[1]), this.current = l, this.dirty = !1);
}
}
class w0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.DEPTH_TEST) : m.disable(m.DEPTH_TEST), this.current = l, this.dirty = !1;
}
}
class k3 extends hn {
getDefault() {
return this.gl.LESS;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthFunc(l), this.current = l, this.dirty = !1);
}
}
class is extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.BLEND) : m.disable(m.BLEND), this.current = l, this.dirty = !1;
}
}
class x0 extends hn {
getDefault() {
const l = this.gl;
return [l.ONE, l.ZERO];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || this.dirty) && (this.gl.blendFunc(l[0], l[1]), this.current = l, this.dirty = !1);
}
}
class bc extends hn {
getDefault() {
return a.aM.transparent;
}
set(l) {
const m = this.current;
(l.r !== m.r || l.g !== m.g || l.b !== m.b || l.a !== m.a || this.dirty) && (this.gl.blendColor(l.r, l.g, l.b, l.a), this.current = l, this.dirty = !1);
}
}
class os extends hn {
getDefault() {
return this.gl.FUNC_ADD;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.blendEquation(l), this.current = l, this.dirty = !1);
}
}
class va extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.CULL_FACE) : m.disable(m.CULL_FACE), this.current = l, this.dirty = !1;
}
}
class Lc extends hn {
getDefault() {
return this.gl.BACK;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.cullFace(l), this.current = l, this.dirty = !1);
}
}
class z4 extends hn {
getDefault() {
return this.gl.CCW;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.frontFace(l), this.current = l, this.dirty = !1);
}
}
class E0 extends hn {
getDefault() {
return null;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.useProgram(l), this.current = l, this.dirty = !1);
}
}
class I3 extends hn {
getDefault() {
return this.gl.TEXTURE0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.activeTexture(l), this.current = l, this.dirty = !1);
}
}
class U4 extends hn {
getDefault() {
const l = this.gl;
return [0, 0, l.drawingBufferWidth, l.drawingBufferHeight];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || l[3] !== m[3] || this.dirty) && (this.gl.viewport(l[0], l[1], l[2], l[3]), this.current = l, this.dirty = !1);
}
}
class G4 extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindFramebuffer(m.FRAMEBUFFER, l), this.current = l, this.dirty = !1;
}
}
class $4 extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindRenderbuffer(m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class js extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindTexture(m.TEXTURE_2D, l), this.current = l, this.dirty = !1;
}
}
class wl extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindBuffer(m.ARRAY_BUFFER, l), this.current = l, this.dirty = !1;
}
}
class W4 extends hn {
getDefault() {
return null;
}
set(l) {
const m = this.gl;
m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, l), this.current = l, this.dirty = !1;
}
}
class w2 extends hn {
getDefault() {
return null;
}
set(l) {
var m;
if (l === this.current && !this.dirty)
return;
const v = this.gl;
L2(v) ? v.bindVertexArray(l) : (m = v.getExtension("OES_vertex_array_object")) === null || m === void 0 || m.bindVertexArrayOES(l), this.current = l, this.dirty = !1;
}
}
class M0 extends hn {
getDefault() {
return 4;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_ALIGNMENT, l), this.current = l, this.dirty = !1;
}
}
class S0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL, l), this.current = l, this.dirty = !1;
}
}
class Z4 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL, l), this.current = l, this.dirty = !1;
}
}
class _a extends hn {
constructor(l, m) {
super(l), this.context = l, this.parent = m;
}
getDefault() {
return null;
}
}
class x2 extends _a {
setDirty() {
this.dirty = !0;
}
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_2D, l, 0), this.current = l, this.dirty = !1;
}
}
class v1 extends _a {
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferRenderbuffer(m.FRAMEBUFFER, m.DEPTH_ATTACHMENT, m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class E2 extends _a {
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferRenderbuffer(m.FRAMEBUFFER, m.DEPTH_STENCIL_ATTACHMENT, m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class q4 {
constructor(l, m, v, b, M) {
this.context = l, this.width = m, this.height = v;
const V = l.gl, D = this.framebuffer = V.createFramebuffer();
if (this.colorAttachment = new x2(l, D), b)
this.depthAttachment = M ? new E2(l, D) : new v1(l, D);
else if (M)
throw new Error("Stencil cannot be set without depth");
if (V.checkFramebufferStatus(V.FRAMEBUFFER) !== V.FRAMEBUFFER_COMPLETE)
throw new Error("Framebuffer is not complete");
}
destroy() {
const l = this.context.gl, m = this.colorAttachment.get();
if (m && l.deleteTexture(m), this.depthAttachment) {
const v = this.depthAttachment.get();
v && l.deleteRenderbuffer(v);
}
l.deleteFramebuffer(this.framebuffer);
}
}
class Mn {
constructor(l, m, v) {
this.blendFunction = l, this.blendColor = m, this.mask = v;
}
}
Mn.Replace = [1, 0], Mn.disabled = new Mn(Mn.Replace, a.aM.transparent, [!1, !1, !1, !1]), Mn.unblended = new Mn(Mn.Replace, a.aM.transparent, [!0, !0, !0, !0]), Mn.alphaBlended = new Mn([1, 771], a.aM.transparent, [!0, !0, !0, !0]);
class wc {
constructor(l) {
var m, v;
if (this.gl = l, this.clearColor = new C3(this), this.clearDepth = new _c(this), this.clearStencil = new ya(this), this.colorMask = new F4(this), this.depthMask = new B4(this), this.stencilMask = new bl(this), this.stencilFunc = new Oo(this), this.stencilOp = new j4(this), this.stencilTest = new L0(this), this.depthRange = new Ll(this), this.depthTest = new w0(this), this.depthFunc = new k3(this), this.blend = new is(this), this.blendFunc = new x0(this), this.blendColor = new bc(this), this.blendEquation = new os(this), this.cullFace = new va(this), this.cullFaceSide = new Lc(this), this.frontFace = new z4(this), this.program = new E0(this), this.activeTexture = new I3(this), this.viewport = new U4(this), this.bindFramebuffer = new G4(this), this.bindRenderbuffer = new $4(this), this.bindTexture = new js(this), this.bindVertexBuffer = new wl(this), this.bindElementBuffer = new W4(this), this.bindVertexArray = new w2(this), this.pixelStoreUnpack = new M0(this), this.pixelStoreUnpackPremultiplyAlpha = new S0(this), this.pixelStoreUnpackFlipY = new Z4(this), this.extTextureFilterAnisotropic = l.getExtension("EXT_texture_filter_anisotropic") || l.getExtension("MOZ_EXT_texture_filter_anisotropic") || l.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = l.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.maxTextureSize = l.getParameter(l.MAX_TEXTURE_SIZE), L2(l)) {
this.HALF_FLOAT = l.HALF_FLOAT;
const b = l.getExtension("EXT_color_buffer_half_float");
this.RGBA16F = (m = l.RGBA16F) !== null && m !== void 0 ? m : b == null ? void 0 : b.RGBA16F_EXT, this.RGB16F = (v = l.RGB16F) !== null && v !== void 0 ? v : b == null ? void 0 : b.RGB16F_EXT, l.getExtension("EXT_color_buffer_float");
} else {
l.getExtension("EXT_color_buffer_half_float"), l.getExtension("OES_texture_half_float_linear");
const b = l.getExtension("OES_texture_half_float");
this.HALF_FLOAT = b == null ? void 0 : b.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 = !0, this.clearDepth.dirty = !0, this.clearStencil.dirty = !0, this.colorMask.dirty = !0, this.depthMask.dirty = !0, this.stencilMask.dirty = !0, this.stencilFunc.dirty = !0, this.stencilOp.dirty = !0, this.stencilTest.dirty = !0, this.depthRange.dirty = !0, this.depthTest.dirty = !0, this.depthFunc.dirty = !0, this.blend.dirty = !0, this.blendFunc.dirty = !0, this.blendColor.dirty = !0, this.blendEquation.dirty = !0, this.cullFace.dirty = !0, this.cullFaceSide.dirty = !0, this.frontFace.dirty = !0, this.program.dirty = !0, this.activeTexture.dirty = !0, this.viewport.dirty = !0, this.bindFramebuffer.dirty = !0, this.bindRenderbuffer.dirty = !0, this.bindTexture.dirty = !0, this.bindVertexBuffer.dirty = !0, this.bindElementBuffer.dirty = !0, this.bindVertexArray.dirty = !0, this.pixelStoreUnpack.dirty = !0, this.pixelStoreUnpackPremultiplyAlpha.dirty = !0, this.pixelStoreUnpackFlipY.dirty = !0;
}
createIndexBuffer(l, m) {
return new Ao(this, l, m);
}
createVertexBuffer(l, m, v) {
return new b0(this, l, m, v);
}
createRenderbuffer(l, m, v) {
const b = this.gl, M = b.createRenderbuffer();
return this.bindRenderbuffer.set(M), b.renderbufferStorage(b.RENDERBUFFER, l, m, v), this.bindRenderbuffer.set(null), M;
}
createFramebuffer(l, m, v, b) {
return new q4(this, l, m, v, b);
}
clear({ color: l, depth: m, stencil: v }) {
const b = this.gl;
let M = 0;
l && (M |= b.COLOR_BUFFER_BIT, this.clearColor.set(l), this.colorMask.set([!0, !0, !0, !0])), m !== void 0 && (M |= b.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(m), this.depthMask.set(!0)), v !== void 0 && (M |= b.STENCIL_BUFFER_BIT, this.clearStencil.set(v), this.stencilMask.set(255)), b.clear(M);
}
setCullFace(l) {
l.enable === !1 ? this.cullFace.set(!1) : (this.cullFace.set(!0), this.cullFaceSide.set(l.mode), this.frontFace.set(l.frontFace));
}
setDepthMode(l) {
l.func !== this.gl.ALWAYS || l.mask ? (this.depthTest.set(!0), this.depthFunc.set(l.func), this.depthMask.set(l.mask), this.depthRange.set(l.range)) : this.depthTest.set(!1);
}
setStencilMode(l) {
l.test.func !== this.gl.ALWAYS || l.mask ? (this.stencilTest.set(!0), this.stencilMask.set(l.mask), this.stencilOp.set([l.fail, l.depthFail, l.pass]), this.stencilFunc.set({ func: l.test.func, ref: l.ref, mask: l.test.mask })) : this.stencilTest.set(!1);
}
setColorMode(l) {
a.aE(l.blendFunction, Mn.Replace) ? this.blend.set(!1) : (this.blend.set(!0), this.blendFunc.set(l.blendFunction), this.blendColor.set(l.blendColor)), this.colorMask.set(l.mask);
}
createVertexArray() {
var l;
return L2(this.gl) ? this.gl.createVertexArray() : (l = this.gl.getExtension("OES_vertex_array_object")) === null || l === void 0 ? void 0 : l.createVertexArrayOES();
}
deleteVertexArray(l) {
var m;
return L2(this.gl) ? this.gl.deleteVertexArray(l) : (m = this.gl.getExtension("OES_vertex_array_object")) === null || m === void 0 ? void 0 : m.deleteVertexArrayOES(l);
}
unbindVAO() {
this.bindVertexArray.set(null);
}
}
class $r {
constructor(l, m, v) {
this.func = l, this.mask = m, this.range = v;
}
}
$r.ReadOnly = !1, $r.ReadWrite = !0, $r.disabled = new $r(519, $r.ReadOnly, [0, 1]);
const ss = 7680;
class An {
constructor(l, m, v, b, M, V) {
this.test = l, this.ref = m, this.mask = v, this.fail = b, this.depthFail = M, this.pass = V;
}
}
An.disabled = new An({ func: 519, mask: 0 }, 0, 0, ss, ss, ss);
class bn {
constructor(l, m, v) {
this.enable = l, this.mode = m, this.frontFace = v;
}
}
let zs;
function P3(S, l, m, v, b) {
const M = S.context, V = M.gl, D = S.useProgram("collisionBox"), j = [];
let Z = 0, Y = 0;
for (let Ht = 0; Ht < v.length; Ht++) {
const Ot = v[Ht], bt = l.getTile(Ot).getBucket(m);
if (!bt)
continue;
const Nt = b ? bt.textCollisionBox : bt.iconCollisionBox, Dt = bt.collisionCircleArray;
if (Dt.length > 0) {
const Wt = a.H();
a.aQ(Wt, bt.placementInvProjMatrix, S.transform.glCoordMatrix), a.aQ(Wt, Wt, bt.placementViewportMatrix), j.push({ circleArray: Dt, circleOffset: Y, transform: Ot.posMatrix, invTransform: Wt, coord: Ot }), Z += Dt.length / 4, Y = Z;
}
Nt && D.draw(M, V.LINES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, { u_matrix: Ot.posMatrix, u_pixel_extrude_scale: [1 / (J = S.transform).width, 1 / J.height] }, S.style.map.terrain && S.style.map.terrain.getTerrainData(Ot), m.id, Nt.layoutVertexBuffer, Nt.indexBuffer, Nt.segments, null, S.transform.zoom, null, null, Nt.collisionVertexBuffer);
}
var J;
if (!b || !j.length)
return;
const lt = S.useProgram("collisionCircle"), ft = new a.aR();
ft.resize(4 * Z), ft._trim();
let Qt = 0;
for (const Ht of j)
for (let Ot = 0; Ot < Ht.circleArray.length / 4; Ot++) {
const bt = 4 * Ot, Nt = Ht.circleArray[bt + 0], Dt = Ht.circleArray[bt + 1], Wt = Ht.circleArray[bt + 2], he = Ht.circleArray[bt + 3];
ft.emplace(Qt++, Nt, Dt, Wt, he, 0), ft.emplace(Qt++, Nt, Dt, Wt, he, 1), ft.emplace(Qt++, Nt, Dt, Wt, he, 2), ft.emplace(Qt++, Nt, Dt, Wt, he, 3);
}
(!zs || zs.length < 2 * Z) && (zs = function(Ht) {
const Ot = 2 * Ht, bt = new a.aT();
bt.resize(Ot), bt._trim();
for (let Nt = 0; Nt < Ot; Nt++) {
const Dt = 6 * Nt;
bt.uint16[Dt + 0] = 4 * Nt + 0, bt.uint16[Dt + 1] = 4 * Nt + 1, bt.uint16[Dt + 2] = 4 * Nt + 2, bt.uint16[Dt + 3] = 4 * Nt + 2, bt.uint16[Dt + 4] = 4 * Nt + 3, bt.uint16[Dt + 5] = 4 * Nt + 0;
}
return bt;
}(Z));
const wt = M.createIndexBuffer(zs, !0), Mt = M.createVertexBuffer(ft, a.aS.members, !0);
for (const Ht of j) {
const Ot = fr(Ht.transform, Ht.invTransform, S.transform);
lt.draw(M, V.TRIANGLES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, Ot, S.style.map.terrain && S.style.map.terrain.getTerrainData(Ht.coord), m.id, Mt, wt, a.a0.simpleSegment(0, 2 * Ht.circleOffset, Ht.circleArray.length, Ht.circleArray.length / 2), null, S.transform.zoom, null, null, null);
}
Mt.destroy(), wt.destroy();
}
bn.disabled = new bn(!1, 1029, 2305), bn.backCCW = new bn(!0, 1029, 2305);
const ba = a.an(new Float32Array(16));
function X4(S, l, m, v, b, M) {
const { horizontalAlign: V, verticalAlign: D } = a.au(S);
return new a.P((-(V - 0.5) * l / b + v[0]) * M, (-(D - 0.5) * m / b + v[1]) * M);
}
function Yo(S, l, m, v, b, M) {
const V = l.tileAnchorPoint.add(new a.P(l.translation[0], l.translation[1]));
if (l.pitchWithMap) {
let D = v.mult(M);
m || (D = D.rotate(-b));
const j = V.add(D);
return xt(j.x, j.y, l.labelPlaneMatrix, l.getElevation).point;
}
if (m) {
const D = Yt(l.tileAnchorPoint.x + 1, l.tileAnchorPoint.y, l).point.sub(S), j = Math.atan(D.y / D.x) + (D.x < 0 ? Math.PI : 0);
return S.add(v.rotate(j));
}
return S.add(v);
}
function Co(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) {
const Qt = S.text.placedSymbolArray, wt = S.text.dynamicLayoutVertexArray, Mt = S.icon.dynamicLayoutVertexArray, Ht = {};
wt.clear();
for (let Ot = 0; Ot < Qt.length; Ot++) {
const bt = Qt.get(Ot), Nt = bt.hidden || !bt.crossTileID || S.allowVerticalPlacement && !bt.placedOrientation ? null : v[bt.crossTileID];
if (Nt) {
const Dt = new a.P(bt.anchorX, bt.anchorY), Wt = { getElevation: ft, width: b.width, height: b.height, labelPlaneMatrix: M, lineVertexArray: null, pitchWithMap: m, projection: Y, projectionCache: null, tileAnchorPoint: Dt, translation: J, unwrappedTileID: lt }, he = m ? xt(Dt.x, Dt.y, V, ft) : Yt(Dt.x, Dt.y, Wt), we = ot(b.cameraToCenterDistance, he.signedDistanceFromCamera);
let De = a.ai(S.textSizeData, j, bt) * we / a.ap;
m && (De *= S.tilePixelRatio / D);
const { width: tr, height: Oe, anchor: Ae, textOffset: ur, textBoxScale: Nr } = Nt, Pe = X4(Ae, tr, Oe, ur, Nr, De), We = Y.getPitchedTextCorrection(b, Dt.add(new a.P(J[0], J[1])), lt), kr = Yo(he.point, Wt, l, Pe, b.angle, We), ei = S.allowVerticalPlacement && bt.placedOrientation === a.ah.vertical ? Math.PI / 2 : 0;
for (let Wr = 0; Wr < bt.numGlyphs; Wr++)
a.aj(wt, kr, ei);
Z && bt.associatedIconIndex >= 0 && (Ht[bt.associatedIconIndex] = { shiftedAnchor: kr, angle: ei });
} else
Rt(bt.numGlyphs, wt);
}
if (Z) {
Mt.clear();
const Ot = S.icon.placedSymbolArray;
for (let bt = 0; bt < Ot.length; bt++) {
const Nt = Ot.get(bt);
if (Nt.hidden)
Rt(Nt.numGlyphs, Mt);
else {
const Dt = Ht[bt];
if (Dt)
for (let Wt = 0; Wt < Nt.numGlyphs; Wt++)
a.aj(Mt, Dt.shiftedAnchor, Dt.angle);
else
Rt(Nt.numGlyphs, Mt);
}
}
S.icon.dynamicLayoutVertexBuffer.updateData(Mt);
}
S.text.dynamicLayoutVertexBuffer.updateData(wt);
}
function po(S, l, m) {
return m.iconsInText && l ? "symbolTextAndIcon" : S ? "symbolSDF" : "symbolIcon";
}
function Jo(S, l, m, v, b, M, V, D, j, Z, Y, J) {
const lt = S.context, ft = lt.gl, Qt = S.transform, wt = u1(), Mt = D === "map", Ht = j === "map", Ot = D !== "viewport" && m.layout.get("symbol-placement") !== "point", bt = Mt && !Ht && !Ot, Nt = !Ht && Ot, Dt = !m.layout.get("symbol-sort-key").isConstant();
let Wt = !1;
const he = S.depthModeForSublayer(0, $r.ReadOnly), we = m._unevaluatedLayout.hasValue("text-variable-anchor") || m._unevaluatedLayout.hasValue("text-variable-anchor-offset"), De = [], tr = wt.getCircleRadiusCorrection(Qt);
for (const Oe of v) {
const Ae = l.getTile(Oe), ur = Ae.getBucket(m);
if (!ur)
continue;
const Nr = b ? ur.text : ur.icon;
if (!Nr || !Nr.segments.get().length || !Nr.hasVisibleVertices)
continue;
const Pe = Nr.programConfigurations.get(m.id), We = b || ur.sdfIcons, kr = b ? ur.textSizeData : ur.iconSizeData, ei = Ht || Qt.pitch !== 0, Wr = S.useProgram(po(We, b, ur), Pe), nn = a.ag(kr, Qt.zoom), ri = S.style.map.terrain && S.style.map.terrain.getTerrainData(Oe);
let C1, O2, ni, mo, q1 = [0, 0], k1 = null;
if (b)
O2 = Ae.glyphAtlasTexture, ni = ft.LINEAR, C1 = Ae.glyphAtlasTexture.size, ur.iconsInText && (q1 = Ae.imageAtlasTexture.size, k1 = Ae.imageAtlasTexture, mo = ei || S.options.rotating || S.options.zooming || kr.kind === "composite" || kr.kind === "camera" ? ft.LINEAR : ft.NEAREST);
else {
const an = m.layout.get("icon-size").constantOr(0) !== 1 || ur.iconsNeedLinear;
O2 = Ae.imageAtlasTexture, ni = We || S.options.rotating || S.options.zooming || an || ei ? ft.LINEAR : ft.NEAREST, C1 = Ae.imageAtlasTexture.size;
}
const X1 = Ar(Ae, 1, S.transform.zoom), Qs = Nt ? Oe.posMatrix : ba, o6 = Vi(Qs, Ht, Mt, S.transform, X1), kl = Rn(Qs, Ht, Mt, S.transform, X1), s6 = Rn(Oe.posMatrix, Ht, Mt, S.transform, X1), i2 = wt.translatePosition(S.transform, Ae, M, V), Il = we && ur.hasTextData(), Bc = m.layout.get("icon-text-fit") !== "none" && Il && ur.hasIconData();
if (Ot) {
const an = S.style.map.terrain ? (a6, l6) => S.style.map.terrain.getElevation(Oe, a6, l6) : null, B3 = m.layout.get("text-rotation-alignment") === "map";
pt(ur, Oe.posMatrix, S, b, o6, s6, Ht, Z, B3, wt, Oe.toUnwrapped(), Qt.width, Qt.height, i2, an);
}
const o2 = Oe.posMatrix, s2 = b && we || Bc, Ea = Ot || s2 ? ba : o6, C2 = kl, b1 = We && m.paint.get(b ? "text-halo-width" : "icon-halo-width").constantOr(1) !== 0;
let I1;
I1 = We ? ur.iconsInText ? N4(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, C1, q1, tr) : ga(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, b, C1, !0, tr) : Ko(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, b, C1, tr);
const Ro = { program: Wr, buffers: Nr, uniformValues: I1, atlasTexture: O2, atlasTextureIcon: k1, atlasInterpolation: ni, atlasInterpolationIcon: mo, isSDF: We, hasHalo: b1 };
if (Dt && ur.canOverlap) {
Wt = !0;
const an = Nr.segments.get();
for (const B3 of an)
De.push({ segments: new a.a0([B3]), sortKey: B3.sortKey, state: Ro, terrainData: ri });
} else
De.push({ segments: Nr.segments, sortKey: 0, state: Ro, terrainData: ri });
}
Wt && De.sort((Oe, Ae) => Oe.sortKey - Ae.sortKey);
for (const Oe of De) {
const Ae = Oe.state;
if (lt.activeTexture.set(ft.TEXTURE0), Ae.atlasTexture.bind(Ae.atlasInterpolation, ft.CLAMP_TO_EDGE), Ae.atlasTextureIcon && (lt.activeTexture.set(ft.TEXTURE1), Ae.atlasTextureIcon && Ae.atlasTextureIcon.bind(Ae.atlasInterpolationIcon, ft.CLAMP_TO_EDGE)), Ae.isSDF) {
const ur = Ae.uniformValues;
Ae.hasHalo && (ur.u_is_halo = 1, H0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, ur, Oe.terrainData)), ur.u_is_halo = 0;
}
H0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, Ae.uniformValues, Oe.terrainData);
}
}
function H0(S, l, m, v, b, M, V, D, j, Z) {
const Y = v.context;
b.draw(Y, Y.gl.TRIANGLES, M, V, D, bn.disabled, j, Z, m.id, S.layoutVertexBuffer, S.indexBuffer, l, m.paint, v.transform.zoom, S.programConfigurations.get(m.id), S.dynamicLayoutVertexBuffer, S.opacityVertexBuffer);
}
function M2(S, l, m, v) {
const b = S.context, M = b.gl, V = An.disabled, D = new Mn([M.ONE, M.ONE], a.aM.transparent, [!0, !0, !0, !0]), j = l.getBucket(m);
if (!j)
return;
const Z = v.key;
let Y = m.heatmapFbos.get(Z);
Y || (Y = V3(b, l.tileSize, l.tileSize), m.heatmapFbos.set(Z, Y)), b.bindFramebuffer.set(Y.framebuffer), b.viewport.set([0, 0, l.tileSize, l.tileSize]), b.clear({ color: a.aM.transparent });
const J = j.programConfigurations.get(m.id), lt = S.useProgram("heatmap", J), ft = S.style.map.terrain.getTerrainData(v);
lt.draw(b, M.TRIANGLES, $r.disabled, V, D, bn.disabled, un(v.posMatrix, l, S.transform.zoom, m.paint.get("heatmap-intensity")), ft, m.id, j.layoutVertexBuffer, j.indexBuffer, j.segments, m.paint, S.transform.zoom, J);
}
function as(S, l, m) {
const v = S.context, b = v.gl;
v.setColorMode(S.colorModeForRenderPass());
const M = ls(v, l), V = m.key, D = l.heatmapFbos.get(V);
D && (v.activeTexture.set(b.TEXTURE0), b.bindTexture(b.TEXTURE_2D, D.colorAttachment.get()), v.activeTexture.set(b.TEXTURE1), M.bind(b.LINEAR, b.CLAMP_TO_EDGE), S.useProgram("heatmapTexture").draw(v, b.TRIANGLES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, pe(S, l, 0, 1), null, l.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments, l.paint, S.transform.zoom), D.destroy(), l.heatmapFbos.delete(V));
}
function V3(S, l, m) {
var v, b;
const M = S.gl, V = M.createTexture();
M.bindTexture(M.TEXTURE_2D, V), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_S, M.CLAMP_TO_EDGE), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_T, M.CLAMP_TO_EDGE), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MIN_FILTER, M.LINEAR), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MAG_FILTER, M.LINEAR);
const D = (v = S.HALF_FLOAT) !== null && v !== void 0 ? v : M.UNSIGNED_BYTE, j = (b = S.RGBA16F) !== null && b !== void 0 ? b : M.RGBA;
M.texImage2D(M.TEXTURE_2D, 0, j, l, m, 0, M.RGBA, D, null);
const Z = S.createFramebuffer(l, m, !1, !1);
return Z.colorAttachment.set(V), Z;
}
function ls(S, l) {
return l.colorRampTexture || (l.colorRampTexture = new rt(S, l.colorRamp, S.gl.RGBA)), l.colorRampTexture;
}
function cs(S, l, m, v, b) {
if (!m || !v || !v.imageAtlas)
return;
const M = v.imageAtlas.patternPositions;
let V = M[m.to.toString()], D = M[m.from.toString()];
if (!V && D && (V = D), !D && V && (D = V), !V || !D) {
const j = b.getPaintProperty(l);
V = M[j], D = M[j];
}
V && D && S.setConstantPatternPositions(V, D);
}
function La(S, l, m, v, b, M, V) {
const D = S.context.gl, j = "fill-pattern", Z = m.paint.get(j), Y = Z && Z.constantOr(1), J = m.getCrossfadeParameters();
let lt, ft, Qt, wt, Mt;
V ? (ft = Y && !m.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", lt = D.LINES) : (ft = Y ? "fillPattern" : "fill", lt = D.TRIANGLES);
const Ht = Z.constantOr(null);
for (const Ot of v) {
const bt = l.getTile(Ot);
if (Y && !bt.patternsLoaded())
continue;
const Nt = bt.getBucket(m);
if (!Nt)
continue;
const Dt = Nt.programConfigurations.get(m.id), Wt = S.useProgram(ft, Dt), he = S.style.map.terrain && S.style.map.terrain.getTerrainData(Ot);
Y && (S.context.activeTexture.set(D.TEXTURE0), bt.imageAtlasTexture.bind(D.LINEAR, D.CLAMP_TO_EDGE), Dt.updatePaintBuffers(J)), cs(Dt, j, Ht, bt, m);
const we = he ? Ot : null, De = S.translatePosMatrix(we ? we.posMatrix : Ot.posMatrix, bt, m.paint.get("fill-translate"), m.paint.get("fill-translate-anchor"));
if (V) {
wt = Nt.indexBuffer2, Mt = Nt.segments2;
const tr = [D.drawingBufferWidth, D.drawingBufferHeight];
Qt = ft === "fillOutlinePattern" && Y ? Me(De, S, J, bt, tr) : ve(De, tr);
} else
wt = Nt.indexBuffer, Mt = Nt.segments, Qt = Y ? le(De, S, J, bt) : qt(De);
Wt.draw(S.context, lt, b, S.stencilModeForClipping(Ot), M, bn.disabled, Qt, he, m.id, Nt.layoutVertexBuffer, wt, Mt, m.paint, S.transform.zoom, Dt);
}
}
function R3(S, l, m, v, b, M, V) {
const D = S.context, j = D.gl, Z = "fill-extrusion-pattern", Y = m.paint.get(Z), J = Y.constantOr(1), lt = m.getCrossfadeParameters(), ft = m.paint.get("fill-extrusion-opacity"), Qt = Y.constantOr(null);
for (const wt of v) {
const Mt = l.getTile(wt), Ht = Mt.getBucket(m);
if (!Ht)
continue;
const Ot = S.style.map.terrain && S.style.map.terrain.getTerrainData(wt), bt = Ht.programConfigurations.get(m.id), Nt = S.useProgram(J ? "fillExtrusionPattern" : "fillExtrusion", bt);
J && (S.context.activeTexture.set(j.TEXTURE0), Mt.imageAtlasTexture.bind(j.LINEAR, j.CLAMP_TO_EDGE), bt.updatePaintBuffers(lt)), cs(bt, Z, Qt, Mt, m);
const Dt = S.translatePosMatrix(wt.posMatrix, Mt, m.paint.get("fill-extrusion-translate"), m.paint.get("fill-extrusion-translate-anchor")), Wt = m.paint.get("fill-extrusion-vertical-gradient"), he = J ? mt(Dt, S, Wt, ft, wt, lt, Mt) : ht(Dt, S, Wt, ft);
Nt.draw(D, D.gl.TRIANGLES, b, M, V, bn.backCCW, he, Ot, m.id, Ht.layoutVertexBuffer, Ht.indexBuffer, Ht.segments, m.paint, S.transform.zoom, bt, S.style.map.terrain && Ht.centroidVertexBuffer);
}
}
function Us(S, l, m, v, b, M, V) {
const D = S.context, j = D.gl, Z = m.fbo;
if (!Z)
return;
const Y = S.useProgram("hillshade"), J = S.style.map.terrain && S.style.map.terrain.getTerrainData(l);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, Z.colorAttachment.get()), Y.draw(D, j.TRIANGLES, b, M, V, bn.disabled, ((lt, ft, Qt, wt) => {
const Mt = Qt.paint.get("hillshade-shadow-color"), Ht = Qt.paint.get("hillshade-highlight-color"), Ot = Qt.paint.get("hillshade-accent-color");
let bt = Qt.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
Qt.paint.get("hillshade-illumination-anchor") === "viewport" && (bt -= lt.transform.angle);
const Nt = !lt.options.moving;
return { u_matrix: wt ? wt.posMatrix : lt.transform.calculatePosMatrix(ft.tileID.toUnwrapped(), Nt), u_image: 0, u_latrange: dr(0, ft.tileID), u_light: [Qt.paint.get("hillshade-exaggeration"), bt], u_shadow: Mt, u_highlight: Ht, u_accent: Ot };
})(S, m, v, J ? l : null), J, v.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments);
}
function t2(S, l, m, v, b, M) {
const V = S.context, D = V.gl, j = l.dem;
if (j && j.data) {
const Z = j.dim, Y = j.stride, J = j.getPixels();
if (V.activeTexture.set(D.TEXTURE1), V.pixelStoreUnpackPremultiplyAlpha.set(!1), l.demTexture = l.demTexture || S.getTileTexture(Y), l.demTexture) {
const ft = l.demTexture;
ft.update(J, { premultiply: !1 }), ft.bind(D.NEAREST, D.CLAMP_TO_EDGE);
} else
l.demTexture = new rt(V, J, D.RGBA, { premultiply: !1 }), l.demTexture.bind(D.NEAREST, D.CLAMP_TO_EDGE);
V.activeTexture.set(D.TEXTURE0);
let lt = l.fbo;
if (!lt) {
const ft = new rt(V, { width: Z, height: Z, data: null }, D.RGBA);
ft.bind(D.LINEAR, D.CLAMP_TO_EDGE), lt = l.fbo = V.createFramebuffer(Z, Z, !0, !1), lt.colorAttachment.set(ft.texture);
}
V.bindFramebuffer.set(lt.framebuffer), V.viewport.set([0, 0, Z, Z]), S.useProgram("hillshadePrepare").draw(V, D.TRIANGLES, v, b, M, bn.disabled, ((ft, Qt) => {
const wt = Qt.stride, Mt = a.H();
return a.aP(Mt, 0, a.X, -a.X, 0, 0, 1), a.J(Mt, Mt, [0, -a.X, 0]), { u_matrix: Mt, u_image: 1, u_dimension: [wt, wt], u_zoom: ft.overscaledZ, u_unpack: Qt.getUnpackVector() };
})(l.tileID, j), null, m.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments), l.needsHillshadePrepare = !1;
}
}
function A0(S, l, m, v, b, M) {
const V = v.paint.get("raster-fade-duration");
if (!M && V > 0) {
const D = f.now(), j = (D - S.timeAdded) / V, Z = l ? (D - l.timeAdded) / V : -1, Y = m.getSource(), J = b.coveringZoomLevel({ tileSize: Y.tileSize, roundZoom: Y.roundZoom }), lt = !l || Math.abs(l.tileID.overscaledZ - J) > Math.abs(S.tileID.overscaledZ - J), ft = lt && S.refreshedUponExpiration ? 1 : a.ac(lt ? j : 1 - Z, 0, 1);
return S.refreshedUponExpiration && j >= 1 && (S.refreshedUponExpiration = !1), l ? { opacity: 1, mix: 1 - ft } : { opacity: ft, mix: 0 };
}
return { opacity: 1, mix: 0 };
}
const O0 = new a.aM(1, 0, 0, 1), kt = new a.aM(0, 1, 0, 1), ne = new a.aM(0, 0, 1, 1), Fe = new a.aM(1, 0, 1, 1), Lr = new a.aM(0, 1, 1, 1);
function Ln(S, l, m, v) {
Jn(S, 0, l + m / 2, S.transform.width, m, v);
}
function rn(S, l, m, v) {
Jn(S, l - m / 2, 0, m, S.transform.height, v);
}
function Jn(S, l, m, v, b, M) {
const V = S.context, D = V.gl;
D.enable(D.SCISSOR_TEST), D.scissor(l * S.pixelRatio, m * S.pixelRatio, v * S.pixelRatio, b * S.pixelRatio), V.clear({ color: M }), D.disable(D.SCISSOR_TEST);
}
function wi(S, l, m) {
const v = S.context, b = v.gl, M = m.posMatrix, V = S.useProgram("debug"), D = $r.disabled, j = An.disabled, Z = S.colorModeForRenderPass(), Y = "$debug", J = S.style.map.terrain && S.style.map.terrain.getTerrainData(m);
v.activeTexture.set(b.TEXTURE0);
const lt = l.getTileByID(m.key).latestRawTileData, ft = Math.floor((lt && lt.byteLength || 0) / 1024), Qt = l.getTile(m).tileSize, wt = 512 / Math.min(Qt, 512) * (m.overscaledZ / S.transform.zoom) * 0.5;
let Mt = m.canonical.toString();
m.overscaledZ !== m.canonical.z && (Mt += ` => ${m.overscaledZ}`), function(Ht, Ot) {
Ht.initDebugOverlayCanvas();
const bt = Ht.debugOverlayCanvas, Nt = Ht.context.gl, Dt = Ht.debugOverlayCanvas.getContext("2d");
Dt.clearRect(0, 0, bt.width, bt.height), Dt.shadowColor = "white", Dt.shadowBlur = 2, Dt.lineWidth = 1.5, Dt.strokeStyle = "white", Dt.textBaseline = "top", Dt.font = "bold 36px Open Sans, sans-serif", Dt.fillText(Ot, 5, 5), Dt.strokeText(Ot, 5, 5), Ht.debugOverlayTexture.update(bt), Ht.debugOverlayTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}(S, `${Mt} ${ft}kB`), V.draw(v, b.TRIANGLES, D, j, Mn.alphaBlended, bn.disabled, kn(M, a.aM.transparent, wt), null, Y, S.debugBuffer, S.quadTriangleIndexBuffer, S.debugSegments), V.draw(v, b.LINE_STRIP, D, j, Z, bn.disabled, kn(M, a.aM.red), J, Y, S.debugBuffer, S.tileBorderIndexBuffer, S.debugSegments);
}
function To(S, l, m) {
const v = S.context, b = v.gl, M = S.colorModeForRenderPass(), V = new $r(b.LEQUAL, $r.ReadWrite, S.depthRangeFor3D), D = S.useProgram("terrain"), j = l.getTerrainMesh();
v.bindFramebuffer.set(null), v.viewport.set([0, 0, S.width, S.height]);
for (const Z of m) {
const Y = S.renderToTexture.getTexture(Z), J = l.getTerrainData(Z.tileID);
v.activeTexture.set(b.TEXTURE0), b.bindTexture(b.TEXTURE_2D, Y.texture);
const lt = S.transform.calculatePosMatrix(Z.tileID.toUnwrapped()), ft = l.getMeshFrameDelta(S.transform.zoom), Qt = S.transform.calculateFogMatrix(Z.tileID.toUnwrapped()), wt = G(lt, ft, Qt, S.style.sky, S.transform.pitch);
D.draw(v, b.TRIANGLES, V, An.disabled, M, bn.backCCW, wt, J, "terrain", j.vertexBuffer, j.indexBuffer, j.segments);
}
}
class gi {
constructor(l, m, v) {
this.vertexBuffer = l, this.indexBuffer = m, this.segments = v;
}
destroy() {
this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.vertexBuffer = null, this.indexBuffer = null, this.segments = null;
}
}
class yi {
constructor(l, m) {
this.context = new wc(l), this.transform = m, this._tileTextures = {}, this.terrainFacilitator = { dirty: !0, matrix: a.an(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = _r.maxUnderzooming + _r.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new b2();
}
resize(l, m, v) {
if (this.width = Math.floor(l * v), this.height = Math.floor(m * v), this.pixelRatio = v, this.context.viewport.set([0, 0, this.width, this.height]), this.style)
for (const b of this.style._order)
this.style._layers[b].resize();
}
setup() {
const l = this.context, m = new a.aX();
m.emplaceBack(0, 0), m.emplaceBack(a.X, 0), m.emplaceBack(0, a.X), m.emplaceBack(a.X, a.X), this.tileExtentBuffer = l.createVertexBuffer(m, Xo.members), this.tileExtentSegments = a.a0.simpleSegment(0, 0, 4, 2);
const v = new a.aX();
v.emplaceBack(0, 0), v.emplaceBack(a.X, 0), v.emplaceBack(0, a.X), v.emplaceBack(a.X, a.X), this.debugBuffer = l.createVertexBuffer(v, Xo.members), this.debugSegments = a.a0.simpleSegment(0, 0, 4, 5);
const b = new a.$();
b.emplaceBack(0, 0, 0, 0), b.emplaceBack(a.X, 0, a.X, 0), b.emplaceBack(0, a.X, 0, a.X), b.emplaceBack(a.X, a.X, a.X, a.X), this.rasterBoundsBuffer = l.createVertexBuffer(b, ji.members), this.rasterBoundsSegments = a.a0.simpleSegment(0, 0, 4, 2);
const M = new a.aX();
M.emplaceBack(0, 0), M.emplaceBack(1, 0), M.emplaceBack(0, 1), M.emplaceBack(1, 1), this.viewportBuffer = l.createVertexBuffer(M, Xo.members), this.viewportSegments = a.a0.simpleSegment(0, 0, 4, 2);
const V = new a.aZ();
V.emplaceBack(0), V.emplaceBack(1), V.emplaceBack(3), V.emplaceBack(2), V.emplaceBack(0), this.tileBorderIndexBuffer = l.createIndexBuffer(V);
const D = new a.aY();
D.emplaceBack(0, 1, 2), D.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = l.createIndexBuffer(D);
const j = this.context.gl;
this.stencilClearMode = new An({ func: j.ALWAYS, mask: 0 }, 0, 255, j.ZERO, j.ZERO, j.ZERO);
}
clearStencil() {
const l = this.context, m = l.gl;
this.nextStencilID = 1, this.currentStencilSource = void 0;
const v = a.H();
a.aP(v, 0, this.width, this.height, 0, 0, 1), a.K(v, v, [m.drawingBufferWidth, m.drawingBufferHeight, 0]), this.useProgram("clippingMask").draw(l, m.TRIANGLES, $r.disabled, this.stencilClearMode, Mn.disabled, bn.disabled, xr(v), null, "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);
}
_renderTileClippingMasks(l, m) {
if (this.currentStencilSource === l.source || !l.isTileClipped() || !m || !m.length)
return;
this.currentStencilSource = l.source;
const v = this.context, b = v.gl;
this.nextStencilID + m.length > 256 && this.clearStencil(), v.setColorMode(Mn.disabled), v.setDepthMode($r.disabled);
const M = this.useProgram("clippingMask");
this._tileClippingMaskIDs = {};
for (const V of m) {
const D = this._tileClippingMaskIDs[V.key] = this.nextStencilID++, j = this.style.map.terrain && this.style.map.terrain.getTerrainData(V);
M.draw(v, b.TRIANGLES, $r.disabled, new An({ func: b.ALWAYS, mask: 0 }, D, 255, b.KEEP, b.KEEP, b.REPLACE), Mn.disabled, bn.disabled, xr(V.posMatrix), j, "$clipping", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);
}
}
stencilModeFor3D() {
this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();
const l = this.nextStencilID++, m = this.context.gl;
return new An({ func: m.NOTEQUAL, mask: 255 }, l, 255, m.KEEP, m.KEEP, m.REPLACE);
}
stencilModeForClipping(l) {
const m = this.context.gl;
return new An({ func: m.EQUAL, mask: 255 }, this._tileClippingMaskIDs[l.key], 0, m.KEEP, m.KEEP, m.REPLACE);
}
stencilConfigForOverlap(l) {
const m = this.context.gl, v = l.sort((V, D) => D.overscaledZ - V.overscaledZ), b = v[v.length - 1].overscaledZ, M = v[0].overscaledZ - b + 1;
if (M > 1) {
this.currentStencilSource = void 0, this.nextStencilID + M > 256 && this.clearStencil();
const V = {};
for (let D = 0; D < M; D++)
V[D + b] = new An({ func: m.GEQUAL, mask: 255 }, D + this.nextStencilID, 255, m.KEEP, m.KEEP, m.REPLACE);
return this.nextStencilID += M, [V, v];
}
return [{ [b]: An.disabled }, v];
}
colorModeForRenderPass() {
const l = this.context.gl;
return this._showOverdrawInspector ? new Mn([l.CONSTANT_COLOR, l.ONE], new a.aM(0.125, 0.125, 0.125, 0), [!0, !0, !0, !0]) : this.renderPass === "opaque" ? Mn.unblended : Mn.alphaBlended;
}
depthModeForSublayer(l, m, v) {
if (!this.opaquePassEnabledForLayer())
return $r.disabled;
const b = 1 - ((1 + this.currentLayer) * this.numSublayers + l) * this.depthEpsilon;
return new $r(v || this.context.gl.LEQUAL, m, [b, b]);
}
opaquePassEnabledForLayer() {
return this.currentLayer < this.opaquePassCutoff;
}
render(l, m) {
this.style = l, this.options = m, this.lineAtlas = l.lineAtlas, this.imageManager = l.imageManager, this.glyphManager = l.glyphManager, this.symbolFadeChange = l.placement.symbolFadeChange(f.now()), this.imageManager.beginFrame();
const v = this.style._order, b = this.style.sourceCaches, M = {}, V = {}, D = {};
for (const j in b) {
const Z = b[j];
Z.used && Z.prepare(this.context), M[j] = Z.getVisibleCoordinates(), V[j] = M[j].slice().reverse(), D[j] = Z.getVisibleCoordinates(!0).reverse();
}
this.opaquePassCutoff = 1 / 0;
for (let j = 0; j < v.length; j++)
if (this.style._layers[v[j]].is3D()) {
this.opaquePassCutoff = j;
break;
}
this.maybeDrawDepthAndCoords(!1), this.renderToTexture && (this.renderToTexture.prepareForRender(this.style, this.transform.zoom), this.opaquePassCutoff = 0), this.renderPass = "offscreen";
for (const j of v) {
const Z = this.style._layers[j];
if (!Z.hasOffscreenPass() || Z.isHidden(this.transform.zoom))
continue;
const Y = V[Z.source];
(Z.type === "custom" || Y.length) && this.renderLayer(this, b[Z.source], Z, Y);
}
if (this.context.bindFramebuffer.set(null), this.context.clear({ color: m.showOverdrawInspector ? a.aM.black : a.aM.transparent, depth: 1 }), this.clearStencil(), this.style.sky && function(j, Z) {
const Y = j.context, J = Y.gl, lt = ((Ht, Ot, bt) => ({ u_sky_color: Ht.properties.get("sky-color"), u_horizon_color: Ht.properties.get("horizon-color"), u_horizon: (Ot.height / 2 + Ot.getHorizon()) * bt, u_sky_horizon_blend: Ht.properties.get("sky-horizon-blend") * Ot.height / 2 * bt }))(Z, j.style.map.transform, j.pixelRatio), ft = new $r(J.LEQUAL, $r.ReadWrite, [0, 1]), Qt = An.disabled, wt = j.colorModeForRenderPass(), Mt = j.useProgram("sky");
if (!Z.mesh) {
const Ht = new a.aX();
Ht.emplaceBack(-1, -1), Ht.emplaceBack(1, -1), Ht.emplaceBack(1, 1), Ht.emplaceBack(-1, 1);
const Ot = new a.aY();
Ot.emplaceBack(0, 1, 2), Ot.emplaceBack(0, 2, 3), Z.mesh = new gi(Y.createVertexBuffer(Ht, Xo.members), Y.createIndexBuffer(Ot), a.a0.simpleSegment(0, 0, Ht.length, Ot.length));
}
Mt.draw(Y, J.TRIANGLES, ft, Qt, wt, bn.disabled, lt, void 0, "sky", Z.mesh.vertexBuffer, Z.mesh.indexBuffer, Z.mesh.segments);
}(this, this.style.sky), this._showOverdrawInspector = m.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (l._order.length + 2) * this.numSublayers * this.depthEpsilon], !this.renderToTexture)
for (this.renderPass = "opaque", this.currentLayer = v.length - 1; this.currentLayer >= 0; this.currentLayer--) {
const j = this.style._layers[v[this.currentLayer]], Z = b[j.source], Y = M[j.source];
this._renderTileClippingMasks(j, Y), this.renderLayer(this, Z, j, Y);
}
for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < v.length; this.currentLayer++) {
const j = this.style._layers[v[this.currentLayer]], Z = b[j.source];
if (this.renderToTexture && this.renderToTexture.renderLayer(j))
continue;
const Y = (j.type === "symbol" ? D : V)[j.source];
this._renderTileClippingMasks(j, M[j.source]), this.renderLayer(this, Z, j, Y);
}
if (this.options.showTileBoundaries) {
const j = function(Z, Y) {
let J = null;
const lt = Object.values(Z._layers).flatMap((Mt) => Mt.source && !Mt.isHidden(Y) ? [Z.sourceCaches[Mt.source]] : []), ft = lt.filter((Mt) => Mt.getSource().type === "vector"), Qt = lt.filter((Mt) => Mt.getSource().type !== "vector"), wt = (Mt) => {
(!J || J.getSource().maxzoom < Mt.getSource().maxzoom) && (J = Mt);
};
return ft.forEach((Mt) => wt(Mt)), J || Qt.forEach((Mt) => wt(Mt)), J;
}(this.style, this.transform.zoom);
j && function(Z, Y, J) {
for (let lt = 0; lt < J.length; lt++)
wi(Z, Y, J[lt]);
}(this, j, j.getVisibleCoordinates());
}
this.options.showPadding && function(j) {
const Z = j.transform.padding;
Ln(j, j.transform.height - (Z.top || 0), 3, O0), Ln(j, Z.bottom || 0, 3, kt), rn(j, Z.left || 0, 3, ne), rn(j, j.transform.width - (Z.right || 0), 3, Fe);
const Y = j.transform.centerPoint;
(function(J, lt, ft, Qt) {
Jn(J, lt - 1, ft - 10, 2, 20, Qt), Jn(J, lt - 10, ft - 1, 20, 2, Qt);
})(j, Y.x, j.transform.height - Y.y, Lr);
}(this), this.context.setDefault();
}
maybeDrawDepthAndCoords(l) {
if (!this.style || !this.style.map || !this.style.map.terrain)
return;
const m = this.terrainFacilitator.matrix, v = this.transform.modelViewProjectionMatrix;
let b = this.terrainFacilitator.dirty;
b || (b = l ? !a.a_(m, v) : !a.a$(m, v)), b || (b = this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length > 0), b && (a.b0(m, v), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.dirty = !1, function(M, V) {
const D = M.context, j = D.gl, Z = Mn.unblended, Y = new $r(j.LEQUAL, $r.ReadWrite, [0, 1]), J = V.getTerrainMesh(), lt = V.sourceCache.getRenderableTiles(), ft = M.useProgram("terrainDepth");
D.bindFramebuffer.set(V.getFramebuffer("depth").framebuffer), D.viewport.set([0, 0, M.width / devicePixelRatio, M.height / devicePixelRatio]), D.clear({ color: a.aM.transparent, depth: 1 });
for (const Qt of lt) {
const wt = V.getTerrainData(Qt.tileID), Mt = { u_matrix: M.transform.calculatePosMatrix(Qt.tileID.toUnwrapped()), u_ele_delta: V.getMeshFrameDelta(M.transform.zoom) };
ft.draw(D, j.TRIANGLES, Y, An.disabled, Z, bn.backCCW, Mt, wt, "terrain", J.vertexBuffer, J.indexBuffer, J.segments);
}
D.bindFramebuffer.set(null), D.viewport.set([0, 0, M.width, M.height]);
}(this, this.style.map.terrain), function(M, V) {
const D = M.context, j = D.gl, Z = Mn.unblended, Y = new $r(j.LEQUAL, $r.ReadWrite, [0, 1]), J = V.getTerrainMesh(), lt = V.getCoordsTexture(), ft = V.sourceCache.getRenderableTiles(), Qt = M.useProgram("terrainCoords");
D.bindFramebuffer.set(V.getFramebuffer("coords").framebuffer), D.viewport.set([0, 0, M.width / devicePixelRatio, M.height / devicePixelRatio]), D.clear({ color: a.aM.transparent, depth: 1 }), V.coordsIndex = [];
for (const wt of ft) {
const Mt = V.getTerrainData(wt.tileID);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, lt.texture);
const Ht = { u_matrix: M.transform.calculatePosMatrix(wt.tileID.toUnwrapped()), u_terrain_coords_id: (255 - V.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: V.getMeshFrameDelta(M.transform.zoom) };
Qt.draw(D, j.TRIANGLES, Y, An.disabled, Z, bn.backCCW, Ht, Mt, "terrain", J.vertexBuffer, J.indexBuffer, J.segments), V.coordsIndex.push(wt.tileID.key);
}
D.bindFramebuffer.set(null), D.viewport.set([0, 0, M.width, M.height]);
}(this, this.style.map.terrain));
}
renderLayer(l, m, v, b) {
if (!v.isHidden(this.transform.zoom) && (v.type === "background" || v.type === "custom" || (b || []).length))
switch (this.id = v.id, v.type) {
case "symbol":
(function(M, V, D, j, Z) {
if (M.renderPass !== "translucent")
return;
const Y = An.disabled, J = M.colorModeForRenderPass();
(D._unevaluatedLayout.hasValue("text-variable-anchor") || D._unevaluatedLayout.hasValue("text-variable-anchor-offset")) && function(lt, ft, Qt, wt, Mt, Ht, Ot, bt, Nt) {
const Dt = ft.transform, Wt = u1(), he = Mt === "map", we = Ht === "map";
for (const De of lt) {
const tr = wt.getTile(De), Oe = tr.getBucket(Qt);
if (!Oe || !Oe.text || !Oe.text.segments.get().length)
continue;
const Ae = a.ag(Oe.textSizeData, Dt.zoom), ur = Ar(tr, 1, ft.transform.zoom), Nr = Vi(De.posMatrix, we, he, ft.transform, ur), Pe = Qt.layout.get("icon-text-fit") !== "none" && Oe.hasIconData();
if (Ae) {
const We = Math.pow(2, Dt.zoom - tr.tileID.overscaledZ), kr = ft.style.map.terrain ? (Wr, nn) => ft.style.map.terrain.getElevation(De, Wr, nn) : null, ei = Wt.translatePosition(Dt, tr, Ot, bt);
Co(Oe, he, we, Nt, Dt, Nr, De.posMatrix, We, Ae, Pe, Wt, ei, De.toUnwrapped(), kr);
}
}
}(j, M, D, V, D.layout.get("text-rotation-alignment"), D.layout.get("text-pitch-alignment"), D.paint.get("text-translate"), D.paint.get("text-translate-anchor"), Z), D.paint.get("icon-opacity").constantOr(1) !== 0 && Jo(M, V, D, j, !1, D.paint.get("icon-translate"), D.paint.get("icon-translate-anchor"), D.layout.get("icon-rotation-alignment"), D.layout.get("icon-pitch-alignment"), D.layout.get("icon-keep-upright"), Y, J), D.paint.get("text-opacity").constantOr(1) !== 0 && Jo(M, V, D, j, !0, D.paint.get("text-translate"), D.paint.get("text-translate-anchor"), D.layout.get("text-rotation-alignment"), D.layout.get("text-pitch-alignment"), D.layout.get("text-keep-upright"), Y, J), V.map.showCollisionBoxes && (P3(M, V, D, j, !0), P3(M, V, D, j, !1));
})(l, m, v, b, this.style.placement.variableOffsets);
break;
case "circle":
(function(M, V, D, j) {
if (M.renderPass !== "translucent")
return;
const Z = D.paint.get("circle-opacity"), Y = D.paint.get("circle-stroke-width"), J = D.paint.get("circle-stroke-opacity"), lt = !D.layout.get("circle-sort-key").isConstant();
if (Z.constantOr(1) === 0 && (Y.constantOr(1) === 0 || J.constantOr(1) === 0))
return;
const ft = M.context, Qt = ft.gl, wt = M.depthModeForSublayer(0, $r.ReadOnly), Mt = An.disabled, Ht = M.colorModeForRenderPass(), Ot = [];
for (let bt = 0; bt < j.length; bt++) {
const Nt = j[bt], Dt = V.getTile(Nt), Wt = Dt.getBucket(D);
if (!Wt)
continue;
const he = Wt.programConfigurations.get(D.id), we = M.useProgram("circle", he), De = Wt.layoutVertexBuffer, tr = Wt.indexBuffer, Oe = M.style.map.terrain && M.style.map.terrain.getTerrainData(Nt), Ae = { programConfiguration: he, program: we, layoutVertexBuffer: De, indexBuffer: tr, uniformValues: be(M, Nt, Dt, D), terrainData: Oe };
if (lt) {
const ur = Wt.segments.get();
for (const Nr of ur)
Ot.push({ segments: new a.a0([Nr]), sortKey: Nr.sortKey, state: Ae });
} else
Ot.push({ segments: Wt.segments, sortKey: 0, state: Ae });
}
lt && Ot.sort((bt, Nt) => bt.sortKey - Nt.sortKey);
for (const bt of Ot) {
const { programConfiguration: Nt, program: Dt, layoutVertexBuffer: Wt, indexBuffer: he, uniformValues: we, terrainData: De } = bt.state;
Dt.draw(ft, Qt.TRIANGLES, wt, Mt, Ht, bn.disabled, we, De, D.id, Wt, he, bt.segments, D.paint, M.transform.zoom, Nt);
}
})(l, m, v, b);
break;
case "heatmap":
(function(M, V, D, j) {
if (D.paint.get("heatmap-opacity") === 0)
return;
const Z = M.context;
if (M.style.map.terrain) {
for (const Y of j) {
const J = V.getTile(Y);
V.hasRenderableParent(Y) || (M.renderPass === "offscreen" ? M2(M, J, D, Y) : M.renderPass === "translucent" && as(M, D, Y));
}
Z.viewport.set([0, 0, M.width, M.height]);
} else
M.renderPass === "offscreen" ? function(Y, J, lt, ft) {
const Qt = Y.context, wt = Qt.gl, Mt = An.disabled, Ht = new Mn([wt.ONE, wt.ONE], a.aM.transparent, [!0, !0, !0, !0]);
(function(Ot, bt, Nt) {
const Dt = Ot.gl;
Ot.activeTexture.set(Dt.TEXTURE1), Ot.viewport.set([0, 0, bt.width / 4, bt.height / 4]);
let Wt = Nt.heatmapFbos.get(a.aU);
Wt ? (Dt.bindTexture(Dt.TEXTURE_2D, Wt.colorAttachment.get()), Ot.bindFramebuffer.set(Wt.framebuffer)) : (Wt = V3(Ot, bt.width / 4, bt.height / 4), Nt.heatmapFbos.set(a.aU, Wt));
})(Qt, Y, lt), Qt.clear({ color: a.aM.transparent });
for (let Ot = 0; Ot < ft.length; Ot++) {
const bt = ft[Ot];
if (J.hasRenderableParent(bt))
continue;
const Nt = J.getTile(bt), Dt = Nt.getBucket(lt);
if (!Dt)
continue;
const Wt = Dt.programConfigurations.get(lt.id), he = Y.useProgram("heatmap", Wt), { zoom: we } = Y.transform;
he.draw(Qt, wt.TRIANGLES, $r.disabled, Mt, Ht, bn.disabled, un(bt.posMatrix, Nt, we, lt.paint.get("heatmap-intensity")), null, lt.id, Dt.layoutVertexBuffer, Dt.indexBuffer, Dt.segments, lt.paint, Y.transform.zoom, Wt);
}
Qt.viewport.set([0, 0, Y.width, Y.height]);
}(M, V, D, j) : M.renderPass === "translucent" && function(Y, J) {
const lt = Y.context, ft = lt.gl;
lt.setColorMode(Y.colorModeForRenderPass());
const Qt = J.heatmapFbos.get(a.aU);
Qt && (lt.activeTexture.set(ft.TEXTURE0), ft.bindTexture(ft.TEXTURE_2D, Qt.colorAttachment.get()), lt.activeTexture.set(ft.TEXTURE1), ls(lt, J).bind(ft.LINEAR, ft.CLAMP_TO_EDGE), Y.useProgram("heatmapTexture").draw(lt, ft.TRIANGLES, $r.disabled, An.disabled, Y.colorModeForRenderPass(), bn.disabled, pe(Y, J, 0, 1), null, J.id, Y.viewportBuffer, Y.quadTriangleIndexBuffer, Y.viewportSegments, J.paint, Y.transform.zoom));
}(M, D);
})(l, m, v, b);
break;
case "line":
(function(M, V, D, j) {
if (M.renderPass !== "translucent")
return;
const Z = D.paint.get("line-opacity"), Y = D.paint.get("line-width");
if (Z.constantOr(1) === 0 || Y.constantOr(1) === 0)
return;
const J = M.depthModeForSublayer(0, $r.ReadOnly), lt = M.colorModeForRenderPass(), ft = D.paint.get("line-dasharray"), Qt = D.paint.get("line-pattern"), wt = Qt.constantOr(1), Mt = D.paint.get("line-gradient"), Ht = D.getCrossfadeParameters(), Ot = wt ? "linePattern" : ft ? "lineSDF" : Mt ? "lineGradient" : "line", bt = M.context, Nt = bt.gl;
let Dt = !0;
for (const Wt of j) {
const he = V.getTile(Wt);
if (wt && !he.patternsLoaded())
continue;
const we = he.getBucket(D);
if (!we)
continue;
const De = we.programConfigurations.get(D.id), tr = M.context.program.get(), Oe = M.useProgram(Ot, De), Ae = Dt || Oe.program !== tr, ur = M.style.map.terrain && M.style.map.terrain.getTerrainData(Wt), Nr = Qt.constantOr(null);
if (Nr && he.imageAtlas) {
const kr = he.imageAtlas, ei = kr.patternPositions[Nr.to.toString()], Wr = kr.patternPositions[Nr.from.toString()];
ei && Wr && De.setConstantPatternPositions(ei, Wr);
}
const Pe = ur ? Wt : null, We = wt ? zn(M, he, D, Ht, Pe) : ft ? _0(M, he, D, ft, Ht, Pe) : Mt ? Ni(M, he, D, we.lineClipsArray.length, Pe) : Tn(M, he, D, Pe);
if (wt)
bt.activeTexture.set(Nt.TEXTURE0), he.imageAtlasTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE), De.updatePaintBuffers(Ht);
else if (ft && (Ae || M.lineAtlas.dirty))
bt.activeTexture.set(Nt.TEXTURE0), M.lineAtlas.bind(bt);
else if (Mt) {
const kr = we.gradients[D.id];
let ei = kr.texture;
if (D.gradientVersion !== kr.version) {
let Wr = 256;
if (D.stepInterpolant) {
const nn = V.getSource().maxzoom, ri = Wt.canonical.z === nn ? Math.ceil(1 << M.transform.maxZoom - Wt.canonical.z) : 1;
Wr = a.ac(a.aV(we.maxLineLength / a.X * 1024 * ri), 256, bt.maxTextureSize);
}
kr.gradient = a.aW({ expression: D.gradientExpression(), evaluationKey: "lineProgress", resolution: Wr, image: kr.gradient || void 0, clips: we.lineClipsArray }), kr.texture ? kr.texture.update(kr.gradient) : kr.texture = new rt(bt, kr.gradient, Nt.RGBA), kr.version = D.gradientVersion, ei = kr.texture;
}
bt.activeTexture.set(Nt.TEXTURE0), ei.bind(D.stepInterpolant ? Nt.NEAREST : Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}
Oe.draw(bt, Nt.TRIANGLES, J, M.stencilModeForClipping(Wt), lt, bn.disabled, We, ur, D.id, we.layoutVertexBuffer, we.indexBuffer, we.segments, D.paint, M.transform.zoom, De, we.layoutVertexBuffer2), Dt = !1;
}
})(l, m, v, b);
break;
case "fill":
(function(M, V, D, j) {
const Z = D.paint.get("fill-color"), Y = D.paint.get("fill-opacity");
if (Y.constantOr(1) === 0)
return;
const J = M.colorModeForRenderPass(), lt = D.paint.get("fill-pattern"), ft = M.opaquePassEnabledForLayer() && !lt.constantOr(1) && Z.constantOr(a.aM.transparent).a === 1 && Y.constantOr(0) === 1 ? "opaque" : "translucent";
if (M.renderPass === ft) {
const Qt = M.depthModeForSublayer(1, M.renderPass === "opaque" ? $r.ReadWrite : $r.ReadOnly);
La(M, V, D, j, Qt, J, !1);
}
if (M.renderPass === "translucent" && D.paint.get("fill-antialias")) {
const Qt = M.depthModeForSublayer(D.getPaintProperty("fill-outline-color") ? 2 : 0, $r.ReadOnly);
La(M, V, D, j, Qt, J, !0);
}
})(l, m, v, b);
break;
case "fill-extrusion":
(function(M, V, D, j) {
const Z = D.paint.get("fill-extrusion-opacity");
if (Z !== 0 && M.renderPass === "translucent") {
const Y = new $r(M.context.gl.LEQUAL, $r.ReadWrite, M.depthRangeFor3D);
if (Z !== 1 || D.paint.get("fill-extrusion-pattern").constantOr(1))
R3(M, V, D, j, Y, An.disabled, Mn.disabled), R3(M, V, D, j, Y, M.stencilModeFor3D(), M.colorModeForRenderPass());
else {
const J = M.colorModeForRenderPass();
R3(M, V, D, j, Y, An.disabled, J);
}
}
})(l, m, v, b);
break;
case "hillshade":
(function(M, V, D, j) {
if (M.renderPass !== "offscreen" && M.renderPass !== "translucent")
return;
const Z = M.context, Y = M.depthModeForSublayer(0, $r.ReadOnly), J = M.colorModeForRenderPass(), [lt, ft] = M.renderPass === "translucent" ? M.stencilConfigForOverlap(j) : [{}, j];
for (const Qt of ft) {
const wt = V.getTile(Qt);
wt.needsHillshadePrepare !== void 0 && wt.needsHillshadePrepare && M.renderPass === "offscreen" ? t2(M, wt, D, Y, An.disabled, J) : M.renderPass === "translucent" && Us(M, Qt, wt, D, Y, lt[Qt.overscaledZ], J);
}
Z.viewport.set([0, 0, M.width, M.height]);
})(l, m, v, b);
break;
case "raster":
(function(M, V, D, j) {
if (M.renderPass !== "translucent" || D.paint.get("raster-opacity") === 0 || !j.length)
return;
const Z = M.context, Y = Z.gl, J = V.getSource(), lt = M.useProgram("raster"), ft = M.colorModeForRenderPass(), [Qt, wt] = J instanceof Ji ? [{}, j] : M.stencilConfigForOverlap(j), Mt = wt[wt.length - 1].overscaledZ, Ht = !M.options.moving;
for (const Ot of wt) {
const bt = M.depthModeForSublayer(Ot.overscaledZ - Mt, D.paint.get("raster-opacity") === 1 ? $r.ReadWrite : $r.ReadOnly, Y.LESS), Nt = V.getTile(Ot);
Nt.registerFadeDuration(D.paint.get("raster-fade-duration"));
const Dt = V.findLoadedParent(Ot, 0), Wt = V.findLoadedSibling(Ot), he = A0(Nt, Dt || Wt || null, V, D, M.transform, M.style.map.terrain);
let we, De;
const tr = D.paint.get("raster-resampling") === "nearest" ? Y.NEAREST : Y.LINEAR;
Z.activeTexture.set(Y.TEXTURE0), Nt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), Z.activeTexture.set(Y.TEXTURE1), Dt ? (Dt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), we = Math.pow(2, Dt.tileID.overscaledZ - Nt.tileID.overscaledZ), De = [Nt.tileID.canonical.x * we % 1, Nt.tileID.canonical.y * we % 1]) : Nt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), Nt.texture.useMipmap && Z.extTextureFilterAnisotropic && M.transform.pitch > 20 && Y.texParameterf(Y.TEXTURE_2D, Z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, Z.extTextureFilterAnisotropicMax);
const Oe = M.style.map.terrain && M.style.map.terrain.getTerrainData(Ot), Ae = Oe ? Ot : null, ur = Ae ? Ae.posMatrix : M.transform.calculatePosMatrix(Ot.toUnwrapped(), Ht), Nr = _l(ur, De || [0, 0], we || 1, he, D);
J instanceof Ji ? lt.draw(Z, Y.TRIANGLES, bt, An.disabled, ft, bn.disabled, Nr, Oe, D.id, J.boundsBuffer, M.quadTriangleIndexBuffer, J.boundsSegments) : lt.draw(Z, Y.TRIANGLES, bt, Qt[Ot.overscaledZ], ft, bn.disabled, Nr, Oe, D.id, M.rasterBoundsBuffer, M.quadTriangleIndexBuffer, M.rasterBoundsSegments);
}
})(l, m, v, b);
break;
case "background":
(function(M, V, D, j) {
const Z = D.paint.get("background-color"), Y = D.paint.get("background-opacity");
if (Y === 0)
return;
const J = M.context, lt = J.gl, ft = M.transform, Qt = ft.tileSize, wt = D.paint.get("background-pattern");
if (M.isPatternMissing(wt))
return;
const Mt = !wt && Z.a === 1 && Y === 1 && M.opaquePassEnabledForLayer() ? "opaque" : "translucent";
if (M.renderPass !== Mt)
return;
const Ht = An.disabled, Ot = M.depthModeForSublayer(0, Mt === "opaque" ? $r.ReadWrite : $r.ReadOnly), bt = M.colorModeForRenderPass(), Nt = M.useProgram(wt ? "backgroundPattern" : "background"), Dt = j || ft.coveringTiles({ tileSize: Qt, terrain: M.style.map.terrain });
wt && (J.activeTexture.set(lt.TEXTURE0), M.imageManager.bind(M.context));
const Wt = D.getCrossfadeParameters();
for (const he of Dt) {
const we = j ? he.posMatrix : M.transform.calculatePosMatrix(he.toUnwrapped()), De = wt ? O3(we, Y, M, wt, { tileID: he, tileSize: Qt }, Wt) : A3(we, Y, Z), tr = M.style.map.terrain && M.style.map.terrain.getTerrainData(he);
Nt.draw(J, lt.TRIANGLES, Ot, Ht, bt, bn.disabled, De, tr, D.id, M.tileExtentBuffer, M.quadTriangleIndexBuffer, M.tileExtentSegments);
}
})(l, 0, v, b);
break;
case "custom":
(function(M, V, D) {
const j = M.context, Z = D.implementation;
if (M.renderPass === "offscreen") {
const Y = Z.prerender;
Y && (M.setCustomLayerDefaults(), j.setColorMode(M.colorModeForRenderPass()), Y.call(Z, j.gl, M.transform.customLayerMatrix()), j.setDirty(), M.setBaseState());
} else if (M.renderPass === "translucent") {
M.setCustomLayerDefaults(), j.setColorMode(M.colorModeForRenderPass()), j.setStencilMode(An.disabled);
const Y = Z.renderingMode === "3d" ? new $r(M.context.gl.LEQUAL, $r.ReadWrite, M.depthRangeFor3D) : M.depthModeForSublayer(0, $r.ReadOnly);
j.setDepthMode(Y), Z.render(j.gl, M.transform.customLayerMatrix(), { farZ: M.transform.farZ, nearZ: M.transform.nearZ, fov: M.transform._fov, modelViewProjectionMatrix: M.transform.modelViewProjectionMatrix, projectionMatrix: M.transform.projectionMatrix }), j.setDirty(), M.setBaseState(), j.bindFramebuffer.set(null);
}
})(l, 0, v);
}
}
translatePosMatrix(l, m, v, b, M) {
if (!v[0] && !v[1])
return l;
const V = M ? b === "map" ? this.transform.angle : 0 : b === "viewport" ? -this.transform.angle : 0;
if (V) {
const Z = Math.sin(V), Y = Math.cos(V);
v = [v[0] * Y - v[1] * Z, v[0] * Z + v[1] * Y];
}
const D = [M ? v[0] : Ar(m, v[0], this.transform.zoom), M ? v[1] : Ar(m, v[1], this.transform.zoom), 0], j = new Float32Array(16);
return a.J(j, l, D), j;
}
saveTileTexture(l) {
const m = this._tileTextures[l.size[0]];
m ? m.push(l) : this._tileTextures[l.size[0]] = [l];
}
getTileTexture(l) {
const m = this._tileTextures[l];
return m && m.length > 0 ? m.pop() : null;
}
isPatternMissing(l) {
if (!l)
return !1;
if (!l.from || !l.to)
return !0;
const m = this.imageManager.getPattern(l.from.toString()), v = this.imageManager.getPattern(l.to.toString());
return !m || !v;
}
useProgram(l, m) {
this.cache = this.cache || {};
const v = l + (m ? m.cacheKey : "") + (this._showOverdrawInspector ? "/overdraw" : "") + (this.style.map.terrain ? "/terrain" : "");
return this.cache[v] || (this.cache[v] = new q(this.context, ho[l], m, D4[l], this._showOverdrawInspector, this.style.map.terrain)), this.cache[v];
}
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 l = this.context.gl;
this.context.cullFace.set(!1), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(l.FUNC_ADD);
}
initDebugOverlayCanvas() {
this.debugOverlayCanvas == null && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new rt(this.context, this.debugOverlayCanvas, this.context.gl.RGBA));
}
destroy() {
this.debugOverlayTexture && this.debugOverlayTexture.destroy();
}
overLimit() {
const { drawingBufferWidth: l, drawingBufferHeight: m } = this.context.gl;
return this.width !== l || this.height !== m;
}
}
class _1 {
constructor(l, m) {
this.points = l, this.planes = m;
}
static fromInvProjectionMatrix(l, m, v) {
const b = Math.pow(2, v), M = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]].map((D) => {
const j = 1 / (D = a.af([], D, l))[3] / m * b;
return a.b1(D, D, [j, j, 1 / D[3], j]);
}), V = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((D) => {
const j = function(lt, ft) {
var Qt = ft[0], wt = ft[1], Mt = ft[2], Ht = Qt * Qt + wt * wt + Mt * Mt;
return Ht > 0 && (Ht = 1 / Math.sqrt(Ht)), lt[0] = ft[0] * Ht, lt[1] = ft[1] * Ht, lt[2] = ft[2] * Ht, lt;
}([], function(lt, ft, Qt) {
var wt = ft[0], Mt = ft[1], Ht = ft[2], Ot = Qt[0], bt = Qt[1], Nt = Qt[2];
return lt[0] = Mt * Nt - Ht * bt, lt[1] = Ht * Ot - wt * Nt, lt[2] = wt * bt - Mt * Ot, lt;
}([], $([], M[D[0]], M[D[1]]), $([], M[D[2]], M[D[1]]))), Z = -((Y = j)[0] * (J = M[D[1]])[0] + Y[1] * J[1] + Y[2] * J[2]);
var Y, J;
return j.concat(Z);
});
return new _1(M, V);
}
}
class A1 {
constructor(l, m) {
this.min = l, this.max = m, this.center = function(v, b, M) {
return v[0] = 0.5 * b[0], v[1] = 0.5 * b[1], v[2] = 0.5 * b[2], v;
}([], function(v, b, M) {
return v[0] = b[0] + M[0], v[1] = b[1] + M[1], v[2] = b[2] + M[2], v;
}([], this.min, this.max));
}
quadrant(l) {
const m = [l % 2 == 0, l < 2], v = F(this.min), b = F(this.max);
for (let M = 0; M < m.length; M++)
v[M] = m[M] ? this.min[M] : this.center[M], b[M] = m[M] ? this.center[M] : this.max[M];
return b[2] = this.max[2], new A1(v, b);
}
distanceX(l) {
return Math.max(Math.min(this.max[0], l[0]), this.min[0]) - l[0];
}
distanceY(l) {
return Math.max(Math.min(this.max[1], l[1]), this.min[1]) - l[1];
}
intersects(l) {
const m = [[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 v = !0;
for (let b = 0; b < l.planes.length; b++) {
const M = l.planes[b];
let V = 0;
for (let D = 0; D < m.length; D++)
a.b2(M, m[D]) >= 0 && V++;
if (V === 0)
return 0;
V !== m.length && (v = !1);
}
if (v)
return 2;
for (let b = 0; b < 3; b++) {
let M = Number.MAX_VALUE, V = -Number.MAX_VALUE;
for (let D = 0; D < l.points.length; D++) {
const j = l.points[D][b] - this.min[b];
M = Math.min(M, j), V = Math.max(V, j);
}
if (V < 0 || M > this.max[b] - this.min[b])
return 0;
}
return 1;
}
}
class Ai {
constructor(l = 0, m = 0, v = 0, b = 0) {
if (isNaN(l) || l < 0 || isNaN(m) || m < 0 || isNaN(v) || v < 0 || isNaN(b) || b < 0)
throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
this.top = l, this.bottom = m, this.left = v, this.right = b;
}
interpolate(l, m, v) {
return m.top != null && l.top != null && (this.top = a.y.number(l.top, m.top, v)), m.bottom != null && l.bottom != null && (this.bottom = a.y.number(l.bottom, m.bottom, v)), m.left != null && l.left != null && (this.left = a.y.number(l.left, m.left, v)), m.right != null && l.right != null && (this.right = a.y.number(l.right, m.right, v)), this;
}
getCenter(l, m) {
const v = a.ac((this.left + l - this.right) / 2, 0, l), b = a.ac((this.top + m - this.bottom) / 2, 0, m);
return new a.P(v, b);
}
equals(l) {
return this.top === l.top && this.bottom === l.bottom && this.left === l.left && this.right === l.right;
}
clone() {
return new Ai(this.top, this.bottom, this.left, this.right);
}
toJSON() {
return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };
}
}
const ko = 85.051129;
class Io {
constructor(l, m, v, b, M) {
this.tileSize = 512, this._renderWorldCopies = M === void 0 || !!M, this._minZoom = l || 0, this._maxZoom = m || 22, this._minPitch = v ?? 0, this._maxPitch = b ?? 60, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new a.N(0, 0), this._elevation = 0, this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._unmodified = !0, this._edgeInsets = new Ai(), this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {}, this.minElevationForCurrentTile = 0;
}
clone() {
const l = new Io(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
return l.apply(this), l;
}
apply(l) {
this.tileSize = l.tileSize, this.latRange = l.latRange, this.lngRange = l.lngRange, this.width = l.width, this.height = l.height, this._center = l._center, this._elevation = l._elevation, this.minElevationForCurrentTile = l.minElevationForCurrentTile, this.zoom = l.zoom, this.angle = l.angle, this._fov = l._fov, this._pitch = l._pitch, this._unmodified = l._unmodified, this._edgeInsets = l._edgeInsets.clone(), this._calcMatrices();
}
get minZoom() {
return this._minZoom;
}
set minZoom(l) {
this._minZoom !== l && (this._minZoom = l, this.zoom = Math.max(this.zoom, l));
}
get maxZoom() {
return this._maxZoom;
}
set maxZoom(l) {
this._maxZoom !== l && (this._maxZoom = l, this.zoom = Math.min(this.zoom, l));
}
get minPitch() {
return this._minPitch;
}
set minPitch(l) {
this._minPitch !== l && (this._minPitch = l, this.pitch = Math.max(this.pitch, l));
}
get maxPitch() {
return this._maxPitch;
}
set maxPitch(l) {
this._maxPitch !== l && (this._maxPitch = l, this.pitch = Math.min(this.pitch, l));
}
get renderWorldCopies() {
return this._renderWorldCopies;
}
set renderWorldCopies(l) {
l === void 0 ? l = !0 : l === null && (l = !1), this._renderWorldCopies = l;
}
get worldSize() {
return this.tileSize * this.scale;
}
get centerOffset() {
return this.centerPoint._sub(this.size._div(2));
}
get size() {
return new a.P(this.width, this.height);
}
get bearing() {
return -this.angle / Math.PI * 180;
}
set bearing(l) {
const m = -a.b3(l, -180, 180) * Math.PI / 180;
this.angle !== m && (this._unmodified = !1, this.angle = m, this._calcMatrices(), this.rotationMatrix = function() {
var v = new a.A(4);
return a.A != Float32Array && (v[1] = 0, v[2] = 0), v[0] = 1, v[3] = 1, v;
}(), function(v, b, M) {
var V = b[0], D = b[1], j = b[2], Z = b[3], Y = Math.sin(M), J = Math.cos(M);
v[0] = V * J + j * Y, v[1] = D * J + Z * Y, v[2] = V * -Y + j * J, v[3] = D * -Y + Z * J;
}(this.rotationMatrix, this.rotationMatrix, this.angle));
}
get pitch() {
return this._pitch / Math.PI * 180;
}
set pitch(l) {
const m = a.ac(l, this.minPitch, this.maxPitch) / 180 * Math.PI;
this._pitch !== m && (this._unmodified = !1, this._pitch = m, this._calcMatrices());
}
get fov() {
return this._fov / Math.PI * 180;
}
set fov(l) {
l = Math.max(0.01, Math.min(60, l)), this._fov !== l && (this._unmodified = !1, this._fov = l / 180 * Math.PI, this._calcMatrices());
}
get zoom() {
return this._zoom;
}
set zoom(l) {
const m = Math.min(Math.max(l, this.minZoom), this.maxZoom);
this._zoom !== m && (this._unmodified = !1, this._zoom = m, this.tileZoom = Math.max(0, Math.floor(m)), this.scale = this.zoomScale(m), this._constrain(), this._calcMatrices());
}
get center() {
return this._center;
}
set center(l) {
l.lat === this._center.lat && l.lng === this._center.lng || (this._unmodified = !1, this._center = l, this._constrain(), this._calcMatrices());
}
get elevation() {
return this._elevation;
}
set elevation(l) {
l !== this._elevation && (this._elevation = l, this._constrain(), this._calcMatrices());
}
get padding() {
return this._edgeInsets.toJSON();
}
set padding(l) {
this._edgeInsets.equals(l) || (this._unmodified = !1, this._edgeInsets.interpolate(this._edgeInsets, l, 1), this._calcMatrices());
}
get centerPoint() {
return this._edgeInsets.getCenter(this.width, this.height);
}
isPaddingEqual(l) {
return this._edgeInsets.equals(l);
}
interpolatePadding(l, m, v) {
this._unmodified = !1, this._edgeInsets.interpolate(l, m, v), this._constrain(), this._calcMatrices();
}
coveringZoomLevel(l) {
const m = (l.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / l.tileSize));
return Math.max(0, m);
}
getVisibleUnwrappedCoordinates(l) {
const m = [new a.b4(0, l)];
if (this._renderWorldCopies) {
const v = this.pointCoordinate(new a.P(0, 0)), b = this.pointCoordinate(new a.P(this.width, 0)), M = this.pointCoordinate(new a.P(this.width, this.height)), V = this.pointCoordinate(new a.P(0, this.height)), D = Math.floor(Math.min(v.x, b.x, M.x, V.x)), j = Math.floor(Math.max(v.x, b.x, M.x, V.x)), Z = 1;
for (let Y = D - Z; Y <= j + Z; Y++)
Y !== 0 && m.push(new a.b4(Y, l));
}
return m;
}
coveringTiles(l) {
var m, v;
let b = this.coveringZoomLevel(l);
const M = b;
if (l.minzoom !== void 0 && b < l.minzoom)
return [];
l.maxzoom !== void 0 && b > l.maxzoom && (b = l.maxzoom);
const V = this.pointCoordinate(this.getCameraPoint()), D = a.Z.fromLngLat(this.center), j = Math.pow(2, b), Z = [j * V.x, j * V.y, 0], Y = [j * D.x, j * D.y, 0], J = _1.fromInvProjectionMatrix(this.invModelViewProjectionMatrix, this.worldSize, b);
let lt = l.minzoom || 0;
!l.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (lt = b);
const ft = l.terrain ? 2 / Math.min(this.tileSize, l.tileSize) * this.tileSize : 3, Qt = (bt) => ({ aabb: new A1([bt * j, 0, 0], [(bt + 1) * j, j, 0]), zoom: 0, x: 0, y: 0, wrap: bt, fullyVisible: !1 }), wt = [], Mt = [], Ht = b, Ot = l.reparseOverscaled ? M : b;
if (this._renderWorldCopies)
for (let bt = 1; bt <= 3; bt++)
wt.push(Qt(-bt)), wt.push(Qt(bt));
for (wt.push(Qt(0)); wt.length > 0; ) {
const bt = wt.pop(), Nt = bt.x, Dt = bt.y;
let Wt = bt.fullyVisible;
if (!Wt) {
const Oe = bt.aabb.intersects(J);
if (Oe === 0)
continue;
Wt = Oe === 2;
}
const he = l.terrain ? Z : Y, we = bt.aabb.distanceX(he), De = bt.aabb.distanceY(he), tr = Math.max(Math.abs(we), Math.abs(De));
if (bt.zoom === Ht || tr > ft + (1 << Ht - bt.zoom) - 2 && bt.zoom >= lt) {
const Oe = Ht - bt.zoom, Ae = Z[0] - 0.5 - (Nt << Oe), ur = Z[1] - 0.5 - (Dt << Oe);
Mt.push({ tileID: new a.S(bt.zoom === Ht ? Ot : bt.zoom, bt.wrap, bt.zoom, Nt, Dt), distanceSq: et([Y[0] - 0.5 - Nt, Y[1] - 0.5 - Dt]), tileDistanceToCamera: Math.sqrt(Ae * Ae + ur * ur) });
} else
for (let Oe = 0; Oe < 4; Oe++) {
const Ae = (Nt << 1) + Oe % 2, ur = (Dt << 1) + (Oe >> 1), Nr = bt.zoom + 1;
let Pe = bt.aabb.quadrant(Oe);
if (l.terrain) {
const We = new a.S(Nr, bt.wrap, Nr, Ae, ur), kr = l.terrain.getMinMaxElevation(We), ei = (m = kr.minElevation) !== null && m !== void 0 ? m : this.elevation, Wr = (v = kr.maxElevation) !== null && v !== void 0 ? v : this.elevation;
Pe = new A1([Pe.min[0], Pe.min[1], ei], [Pe.max[0], Pe.max[1], Wr]);
}
wt.push({ aabb: Pe, zoom: Nr, x: Ae, y: ur, wrap: bt.wrap, fullyVisible: Wt });
}
}
return Mt.sort((bt, Nt) => bt.distanceSq - Nt.distanceSq).map((bt) => bt.tileID);
}
resize(l, m) {
this.width = l, this.height = m, this.pixelsToGLUnits = [2 / l, -2 / m], this._constrain(), this._calcMatrices();
}
get unmodified() {
return this._unmodified;
}
zoomScale(l) {
return Math.pow(2, l);
}
scaleZoom(l) {
return Math.log(l) / Math.LN2;
}
project(l) {
const m = a.ac(l.lat, -85.051129, ko);
return new a.P(a.O(l.lng) * this.worldSize, a.Q(m) * this.worldSize);
}
unproject(l) {
return new a.Z(l.x / this.worldSize, l.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(l) {
const m = this.elevation, v = Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter, b = this.pointLocation(this.centerPoint, l), M = l.getElevationForLngLatZoom(b, this.tileZoom);
if (!(this.elevation - M))
return;
const V = v + m - M, D = Math.cos(this._pitch) * this.cameraToCenterDistance / V / a.b5(1, b.lat), j = this.scaleZoom(D / this.tileSize);
this._elevation = M, this._center = b, this.zoom = j;
}
setLocationAtPoint(l, m) {
const v = this.pointCoordinate(m), b = this.pointCoordinate(this.centerPoint), M = this.locationCoordinate(l), V = new a.Z(M.x - (v.x - b.x), M.y - (v.y - b.y));
this.center = this.coordinateLocation(V), this._renderWorldCopies && (this.center = this.center.wrap());
}
locationPoint(l, m) {
return m ? this.coordinatePoint(this.locationCoordinate(l), m.getElevationForLngLatZoom(l, this.tileZoom), this.pixelMatrix3D) : this.coordinatePoint(this.locationCoordinate(l));
}
pointLocation(l, m) {
return this.coordinateLocation(this.pointCoordinate(l, m));
}
locationCoordinate(l) {
return a.Z.fromLngLat(l);
}
coordinateLocation(l) {
return l && l.toLngLat();
}
pointCoordinate(l, m) {
if (m) {
const lt = m.pointCoordinate(l);
if (lt != null)
return lt;
}
const v = [l.x, l.y, 0, 1], b = [l.x, l.y, 1, 1];
a.af(v, v, this.pixelMatrixInverse), a.af(b, b, this.pixelMatrixInverse);
const M = v[3], V = b[3], D = v[1] / M, j = b[1] / V, Z = v[2] / M, Y = b[2] / V, J = Z === Y ? 0 : (0 - Z) / (Y - Z);
return new a.Z(a.y.number(v[0] / M, b[0] / V, J) / this.worldSize, a.y.number(D, j, J) / this.worldSize);
}
coordinatePoint(l, m = 0, v = this.pixelMatrix) {
const b = [l.x * this.worldSize, l.y * this.worldSize, m, 1];
return a.af(b, b, v), new a.P(b[0] / b[3], b[1] / b[3]);
}
getBounds() {
const l = Math.max(0, this.height / 2 - this.getHorizon());
return new Ct().extend(this.pointLocation(new a.P(0, l))).extend(this.pointLocation(new a.P(this.width, l))).extend(this.pointLocation(new a.P(this.width, this.height))).extend(this.pointLocation(new a.P(0, this.height)));
}
getMaxBounds() {
return this.latRange && this.latRange.length === 2 && this.lngRange && this.lngRange.length === 2 ? new Ct([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(l) {
l ? (this.lngRange = [l.getWest(), l.getEast()], this.latRange = [l.getSouth(), l.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-85.051129, ko]);
}
calculateTileMatrix(l) {
const m = l.canonical, v = this.worldSize / this.zoomScale(m.z), b = m.x + Math.pow(2, m.z) * l.wrap, M = a.an(new Float64Array(16));
return a.J(M, M, [b * v, m.y * v, 0]), a.K(M, M, [v / a.X, v / a.X, 1]), M;
}
calculatePosMatrix(l, m = !1) {
const v = l.key, b = m ? this._alignedPosMatrixCache : this._posMatrixCache;
if (b[v])
return b[v];
const M = this.calculateTileMatrix(l);
return a.L(M, m ? this.alignedModelViewProjectionMatrix : this.modelViewProjectionMatrix, M), b[v] = new Float32Array(M), b[v];
}
calculateFogMatrix(l) {
const m = l.key, v = this._fogMatrixCache;
if (v[m])
return v[m];
const b = this.calculateTileMatrix(l);
return a.L(b, this.fogMatrix, b), v[m] = new Float32Array(b), v[m];
}
customLayerMatrix() {
return this.mercatorMatrix.slice();
}
getConstrained(l, m) {
m = a.ac(+m, this.minZoom, this.maxZoom);
const v = { center: new a.N(l.lng, l.lat), zoom: m };
let b = this.lngRange;
if (!this._renderWorldCopies && b === null) {
const bt = 179.9999999999;
b = [-bt, bt];
}
const M = this.tileSize * this.zoomScale(v.zoom);
let V = 0, D = M, j = 0, Z = M, Y = 0, J = 0;
const { x: lt, y: ft } = this.size;
if (this.latRange) {
const bt = this.latRange;
V = a.Q(bt[1]) * M, D = a.Q(bt[0]) * M, D - V < ft && (Y = ft / (D - V));
}
b && (j = a.b3(a.O(b[0]) * M, 0, M), Z = a.b3(a.O(b[1]) * M, 0, M), Z < j && (Z += M), Z - j < lt && (J = lt / (Z - j)));
const { x: Qt, y: wt } = this.project.call({ worldSize: M }, l);
let Mt, Ht;
const Ot = Math.max(J || 0, Y || 0);
if (Ot) {
const bt = new a.P(J ? (Z + j) / 2 : Qt, Y ? (D + V) / 2 : wt);
return v.center = this.unproject.call({ worldSize: M }, bt).wrap(), v.zoom += this.scaleZoom(Ot), v;
}
if (this.latRange) {
const bt = ft / 2;
wt - bt < V && (Ht = V + bt), wt + bt > D && (Ht = D - bt);
}
if (b) {
const bt = (j + Z) / 2;
let Nt = Qt;
this._renderWorldCopies && (Nt = a.b3(Qt, bt - M / 2, bt + M / 2));
const Dt = lt / 2;
Nt - Dt < j && (Mt = j + Dt), Nt + Dt > Z && (Mt = Z - Dt);
}
if (Mt !== void 0 || Ht !== void 0) {
const bt = new a.P(Mt ?? Qt, Ht ?? wt);
v.center = this.unproject.call({ worldSize: M }, bt).wrap();
}
return v;
}
_constrain() {
if (!this.center || !this.width || !this.height || this._constraining)
return;
this._constraining = !0;
const l = this._unmodified, { center: m, zoom: v } = this.getConstrained(this.center, this.zoom);
this.center = m, this.zoom = v, this._unmodified = l, this._constraining = !1;
}
_calcMatrices() {
if (!this.height)
return;
const l = this.centerOffset, m = this.point.x, v = this.point.y;
this.cameraToCenterDistance = 0.5 / Math.tan(this._fov / 2) * this.height, this._pixelPerMeter = a.b5(1, this.center.lat) * this.worldSize;
let b = a.an(new Float64Array(16));
a.K(b, b, [this.width / 2, -this.height / 2, 1]), a.J(b, b, [1, -1, 0]), this.labelPlaneMatrix = b, b = a.an(new Float64Array(16)), a.K(b, b, [1, -1, 1]), a.J(b, b, [-1, -1, 0]), a.K(b, b, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = b;
const M = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch), V = Math.min(this.elevation, this.minElevationForCurrentTile), D = M - V * this._pixelPerMeter / Math.cos(this._pitch), j = V < 0 ? D : M, Z = Math.PI / 2 + this._pitch, Y = this._fov * (0.5 + l.y / this.height), J = Math.sin(Y) * j / Math.sin(a.ac(Math.PI - Z - Y, 0.01, Math.PI - 0.01)), lt = this.getHorizon(), ft = 2 * Math.atan(lt / this.cameraToCenterDistance) * (0.5 + l.y / (2 * lt)), Qt = Math.sin(ft) * j / Math.sin(a.ac(Math.PI - Z - ft, 0.01, Math.PI - 0.01)), wt = Math.min(J, Qt);
this.farZ = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * wt + j), this.nearZ = this.height / 50, b = new Float64Array(16), a.b6(b, this._fov, this.width / this.height, this.nearZ, this.farZ), b[8] = 2 * -l.x / this.width, b[9] = 2 * l.y / this.height, this.projectionMatrix = a.ae(b), a.K(b, b, [1, -1, 1]), a.J(b, b, [0, 0, -this.cameraToCenterDistance]), a.b7(b, b, this._pitch), a.ad(b, b, this.angle), a.J(b, b, [-m, -v, 0]), this.mercatorMatrix = a.K([], b, [this.worldSize, this.worldSize, this.worldSize]), a.K(b, b, [1, 1, this._pixelPerMeter]), this.pixelMatrix = a.L(new Float64Array(16), this.labelPlaneMatrix, b), a.J(b, b, [0, 0, -this.elevation]), this.modelViewProjectionMatrix = b, this.invModelViewProjectionMatrix = a.as([], b), this.fogMatrix = new Float64Array(16), a.b6(this.fogMatrix, this._fov, this.width / this.height, M, this.farZ), this.fogMatrix[8] = 2 * -l.x / this.width, this.fogMatrix[9] = 2 * l.y / this.height, a.K(this.fogMatrix, this.fogMatrix, [1, -1, 1]), a.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.cameraToCenterDistance]), a.b7(this.fogMatrix, this.fogMatrix, this._pitch), a.ad(this.fogMatrix, this.fogMatrix, this.angle), a.J(this.fogMatrix, this.fogMatrix, [-m, -v, 0]), a.K(this.fogMatrix, this.fogMatrix, [1, 1, this._pixelPerMeter]), a.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.elevation]), this.pixelMatrix3D = a.L(new Float64Array(16), this.labelPlaneMatrix, b);
const Mt = this.width % 2 / 2, Ht = this.height % 2 / 2, Ot = Math.cos(this.angle), bt = Math.sin(this.angle), Nt = m - Math.round(m) + Ot * Mt + bt * Ht, Dt = v - Math.round(v) + Ot * Ht + bt * Mt, Wt = new Float64Array(b);
if (a.J(Wt, Wt, [Nt > 0.5 ? Nt - 1 : Nt, Dt > 0.5 ? Dt - 1 : Dt, 0]), this.alignedModelViewProjectionMatrix = Wt, b = a.as(new Float64Array(16), this.pixelMatrix), !b)
throw new Error("failed to invert matrix");
this.pixelMatrixInverse = b, this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {};
}
maxPitchScaleFactor() {
if (!this.pixelMatrixInverse)
return 1;
const l = this.pointCoordinate(new a.P(0, 0)), m = [l.x * this.worldSize, l.y * this.worldSize, 0, 1];
return a.af(m, m, this.pixelMatrix)[3] / this.cameraToCenterDistance;
}
getCameraPoint() {
const l = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1);
return this.centerPoint.add(new a.P(0, l));
}
getCameraQueryGeometry(l) {
const m = this.getCameraPoint();
if (l.length === 1)
return [l[0], m];
{
let v = m.x, b = m.y, M = m.x, V = m.y;
for (const D of l)
v = Math.min(v, D.x), b = Math.min(b, D.y), M = Math.max(M, D.x), V = Math.max(V, D.y);
return [new a.P(v, b), new a.P(M, b), new a.P(M, V), new a.P(v, V), new a.P(v, b)];
}
}
lngLatToCameraDepth(l, m) {
const v = this.locationCoordinate(l), b = [v.x * this.worldSize, v.y * this.worldSize, m, 1];
return a.af(b, b, this.modelViewProjectionMatrix), b[2] / b[3];
}
}
function us(S, l) {
let m, v = !1, b = null, M = null;
const V = () => {
b = null, v && (S.apply(M, m), b = setTimeout(V, l), v = !1);
};
return (...D) => (v = !0, M = this, m = D, b || V(), b);
}
class S2 {
constructor(l) {
this._getCurrentHash = () => {
const m = window.location.hash.replace("#", "");
if (this._hashName) {
let v;
return m.split("&").map((b) => b.split("=")).forEach((b) => {
b[0] === this._hashName && (v = b);
}), (v && v[1] || "").split("/");
}
return m.split("/");
}, this._onHashChange = () => {
const m = this._getCurrentHash();
if (m.length >= 3 && !m.some((v) => isNaN(v))) {
const v = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(m[3] || 0) : this._map.getBearing();
return this._map.jumpTo({ center: [+m[2], +m[1]], zoom: +m[0], bearing: v, pitch: +(m[4] || 0) }), !0;
}
return !1;
}, this._updateHashUnthrottled = () => {
const m = window.location.href.replace(/(#.+)?$/, this.getHashString());
window.history.replaceState(window.history.state, null, m);
}, this._removeHash = () => {
const m = this._getCurrentHash();
if (m.length === 0)
return;
const v = m.join("/");
let b = v;
b.split("&").length > 0 && (b = b.split("&")[0]), this._hashName && (b = `${this._hashName}=${v}`);
let M = window.location.hash.replace(b, "");
M.startsWith("#&") ? M = M.slice(0, 1) + M.slice(2) : M === "#" && (M = "");
let V = window.location.href.replace(/(#.+)?$/, M);
V = V.replace("&&", "&"), window.history.replaceState(window.history.state, null, V);
}, this._updateHash = us(this._updateHashUnthrottled, 300), this._hashName = l && encodeURIComponent(l);
}
addTo(l) {
return this._map = l, addEventListener("hashchange", this._onHashChange, !1), this._map.on("moveend", this._updateHash), this;
}
remove() {
return removeEventListener("hashchange", this._onHashChange, !1), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), this._removeHash(), delete this._map, this;
}
getHashString(l) {
const m = this._map.getCenter(), v = Math.round(100 * this._map.getZoom()) / 100, b = Math.ceil((v * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), M = Math.pow(10, b), V = Math.round(m.lng * M) / M, D = Math.round(m.lat * M) / M, j = this._map.getBearing(), Z = this._map.getPitch();
let Y = "";
if (Y += l ? `/${V}/${D}/${v}` : `${v}/${D}/${V}`, (j || Z) && (Y += "/" + Math.round(10 * j) / 10), Z && (Y += `/${Math.round(Z)}`), this._hashName) {
const J = this._hashName;
let lt = !1;
const ft = window.location.hash.slice(1).split("&").map((Qt) => {
const wt = Qt.split("=")[0];
return wt === J ? (lt = !0, `${wt}=${Y}`) : Qt;
}).filter((Qt) => Qt);
return lt || ft.push(`${J}=${Y}`), `#${ft.join("&")}`;
}
return `#${Y}`;
}
}
const hs = { linearity: 0.3, easing: a.b8(0, 0, 0.3, 1) }, K4 = a.e({ deceleration: 2500, maxSpeed: 1400 }, hs), xc = a.e({ deceleration: 20, maxSpeed: 1400 }, hs), xl = a.e({ deceleration: 1e3, maxSpeed: 360 }, hs), wn = a.e({ deceleration: 1e3, maxSpeed: 90 }, hs);
class mn {
constructor(l) {
this._map = l, this.clear();
}
clear() {
this._inertiaBuffer = [];
}
record(l) {
this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: f.now(), settings: l });
}
_drainInertiaBuffer() {
const l = this._inertiaBuffer, m = f.now();
for (; l.length > 0 && m - l[0].time > 160; )
l.shift();
}
_onMoveEnd(l) {
if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2)
return;
const m = { zoom: 0, bearing: 0, pitch: 0, pan: new a.P(0, 0), pinchAround: void 0, around: void 0 };
for (const { settings: M } of this._inertiaBuffer)
m.zoom += M.zoomDelta || 0, m.bearing += M.bearingDelta || 0, m.pitch += M.pitchDelta || 0, M.panDelta && m.pan._add(M.panDelta), M.around && (m.around = M.around), M.pinchAround && (m.pinchAround = M.pinchAround);
const v = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, b = {};
if (m.pan.mag()) {
const M = fo(m.pan.mag(), v, a.e({}, K4, l || {}));
b.offset = m.pan.mult(M.amount / m.pan.mag()), b.center = this._map.transform.center, ds(b, M);
}
if (m.zoom) {
const M = fo(m.zoom, v, xc);
b.zoom = this._map.transform.zoom + M.amount, ds(b, M);
}
if (m.bearing) {
const M = fo(m.bearing, v, xl);
b.bearing = this._map.transform.bearing + a.ac(M.amount, -179, 179), ds(b, M);
}
if (m.pitch) {
const M = fo(m.pitch, v, wn);
b.pitch = this._map.transform.pitch + M.amount, ds(b, M);
}
if (b.zoom || b.bearing) {
const M = m.pinchAround === void 0 ? m.around : m.pinchAround;
b.around = M ? this._map.unproject(M) : this._map.getCenter();
}
return this.clear(), a.e(b, { noMoveStart: !0 });
}
}
function ds(S, l) {
(!S.duration || S.duration < l.duration) && (S.duration = l.duration, S.easing = l.easing);
}
function fo(S, l, m) {
const { maxSpeed: v, linearity: b, deceleration: M } = m, V = a.ac(S * b / (l / 1e3), -v, v), D = Math.abs(V) / (M * b);
return { easing: m.easing, duration: 1e3 * D, amount: V * (D / 2) };
}
class Gi extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v, b = {}) {
const M = Q.mousePos(m.getCanvas(), v), V = m.unproject(M);
super(l, a.e({ point: M, lngLat: V, originalEvent: v }, b)), this._defaultPrevented = !1, this.target = m;
}
}
class $i extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v) {
const b = l === "touchend" ? v.changedTouches : v.touches, M = Q.touchPos(m.getCanvasContainer(), b), V = M.map((j) => m.unproject(j)), D = M.reduce((j, Z, Y, J) => j.add(Z.div(J.length)), new a.P(0, 0));
super(l, { points: M, point: D, lngLats: V, lngLat: m.unproject(D), originalEvent: v }), this._defaultPrevented = !1;
}
}
class e2 extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v) {
super(l, { originalEvent: v }), this._defaultPrevented = !1;
}
}
class H2 {
constructor(l, m) {
this._map = l, this._clickTolerance = m.clickTolerance;
}
reset() {
delete this._mousedownPos;
}
wheel(l) {
return this._firePreventable(new e2(l.type, this._map, l));
}
mousedown(l, m) {
return this._mousedownPos = m, this._firePreventable(new Gi(l.type, this._map, l));
}
mouseup(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
click(l, m) {
this._mousedownPos && this._mousedownPos.dist(m) >= this._clickTolerance || this._map.fire(new Gi(l.type, this._map, l));
}
dblclick(l) {
return this._firePreventable(new Gi(l.type, this._map, l));
}
mouseover(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
mouseout(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
touchstart(l) {
return this._firePreventable(new $i(l.type, this._map, l));
}
touchmove(l) {
this._map.fire(new $i(l.type, this._map, l));
}
touchend(l) {
this._map.fire(new $i(l.type, this._map, l));
}
touchcancel(l) {
this._map.fire(new $i(l.type, this._map, l));
}
_firePreventable(l) {
if (this._map.fire(l), l.defaultPrevented)
return {};
}
isEnabled() {
return !0;
}
isActive() {
return !1;
}
enable() {
}
disable() {
}
}
class Dn {
constructor(l) {
this._map = l;
}
reset() {
this._delayContextMenu = !1, this._ignoreContextMenu = !0, delete this._contextMenuEvent;
}
mousemove(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
mousedown() {
this._delayContextMenu = !0, this._ignoreContextMenu = !1;
}
mouseup() {
this._delayContextMenu = !1, this._contextMenuEvent && (this._map.fire(new Gi("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);
}
contextmenu(l) {
this._delayContextMenu ? this._contextMenuEvent = l : this._ignoreContextMenu || this._map.fire(new Gi(l.type, this._map, l)), this._map.listens("contextmenu") && l.preventDefault();
}
isEnabled() {
return !0;
}
isActive() {
return !1;
}
enable() {
}
disable() {
}
}
class O1 {
constructor(l) {
this._map = l;
}
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(l) {
return this.transform.pointLocation(a.P.convert(l), this._map.terrain);
}
}
class Wi {
constructor(l, m) {
this._map = l, this._tr = new O1(l), this._el = l.getCanvasContainer(), this._container = l.getContainer(), this._clickTolerance = m.clickTolerance || 1;
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active;
}
enable() {
this.isEnabled() || (this._enabled = !0);
}
disable() {
this.isEnabled() && (this._enabled = !1);
}
mousedown(l, m) {
this.isEnabled() && l.shiftKey && l.button === 0 && (Q.disableDrag(), this._startPos = this._lastPos = m, this._active = !0);
}
mousemoveWindow(l, m) {
if (!this._active)
return;
const v = m;
if (this._lastPos.equals(v) || !this._box && v.dist(this._startPos) < this._clickTolerance)
return;
const b = this._startPos;
this._lastPos = v, this._box || (this._box = Q.create("div", "maplibregl-boxzoom", this._container), this._container.classList.add("maplibregl-crosshair"), this._fireEvent("boxzoomstart", l));
const M = Math.min(b.x, v.x), V = Math.max(b.x, v.x), D = Math.min(b.y, v.y), j = Math.max(b.y, v.y);
Q.setTransform(this._box, `translate(${M}px,${D}px)`), this._box.style.width = V - M + "px", this._box.style.height = j - D + "px";
}
mouseupWindow(l, m) {
if (!this._active || l.button !== 0)
return;
const v = this._startPos, b = m;
if (this.reset(), Q.suppressClick(), v.x !== b.x || v.y !== b.y)
return this._map.fire(new a.k("boxzoomend", { originalEvent: l })), { cameraAnimation: (M) => M.fitScreenCoordinates(v, b, this._tr.bearing, { linear: !0 }) };
this._fireEvent("boxzoomcancel", l);
}
keydown(l) {
this._active && l.keyCode === 27 && (this.reset(), this._fireEvent("boxzoomcancel", l));
}
reset() {
this._active = !1, this._container.classList.remove("maplibregl-crosshair"), this._box && (Q.remove(this._box), this._box = null), Q.enableDrag(), delete this._startPos, delete this._lastPos;
}
_fireEvent(l, m) {
return this._map.fire(new a.k(l, { originalEvent: m }));
}
}
function Po(S, l) {
if (S.length !== l.length)
throw new Error(`The number of touches and points are not equal - touches ${S.length}, points ${l.length}`);
const m = {};
for (let v = 0; v < S.length; v++)
m[S[v].identifier] = l[v];
return m;
}
class Y4 {
constructor(l) {
this.reset(), this.numTouches = l.numTouches;
}
reset() {
delete this.centroid, delete this.startTime, delete this.touches, this.aborted = !1;
}
touchstart(l, m, v) {
(this.centroid || v.length > this.numTouches) && (this.aborted = !0), this.aborted || (this.startTime === void 0 && (this.startTime = l.timeStamp), v.length === this.numTouches && (this.centroid = function(b) {
const M = new a.P(0, 0);
for (const V of b)
M._add(V);
return M.div(b.length);
}(m), this.touches = Po(v, m)));
}
touchmove(l, m, v) {
if (this.aborted || !this.centroid)
return;
const b = Po(v, m);
for (const M in this.touches) {
const V = b[M];
(!V || V.dist(this.touches[M]) > 30) && (this.aborted = !0);
}
}
touchend(l, m, v) {
if ((!this.centroid || l.timeStamp - this.startTime > 500) && (this.aborted = !0), v.length === 0) {
const b = !this.aborted && this.centroid;
if (this.reset(), b)
return b;
}
}
}
class Gs {
constructor(l) {
this.singleTap = new Y4(l), this.numTaps = l.numTaps, this.reset();
}
reset() {
this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();
}
touchstart(l, m, v) {
this.singleTap.touchstart(l, m, v);
}
touchmove(l, m, v) {
this.singleTap.touchmove(l, m, v);
}
touchend(l, m, v) {
const b = this.singleTap.touchend(l, m, v);
if (b) {
const M = l.timeStamp - this.lastTime < 500, V = !this.lastTap || this.lastTap.dist(b) < 30;
if (M && V || this.reset(), this.count++, this.lastTime = l.timeStamp, this.lastTap = b, this.count === this.numTaps)
return this.reset(), b;
}
}
}
class ps {
constructor(l) {
this._tr = new O1(l), this._zoomIn = new Gs({ numTouches: 1, numTaps: 2 }), this._zoomOut = new Gs({ numTouches: 2, numTaps: 1 }), this.reset();
}
reset() {
this._active = !1, this._zoomIn.reset(), this._zoomOut.reset();
}
touchstart(l, m, v) {
this._zoomIn.touchstart(l, m, v), this._zoomOut.touchstart(l, m, v);
}
touchmove(l, m, v) {
this._zoomIn.touchmove(l, m, v), this._zoomOut.touchmove(l, m, v);
}
touchend(l, m, v) {
const b = this._zoomIn.touchend(l, m, v), M = this._zoomOut.touchend(l, m, v), V = this._tr;
return b ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: V.zoom + 1, around: V.unproject(b) }, { originalEvent: l }) }) : M ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: V.zoom - 1, around: V.unproject(M) }, { originalEvent: l }) }) : void 0;
}
touchcancel() {
this.reset();
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Qo {
constructor(l) {
this._enabled = !!l.enable, this._moveStateManager = l.moveStateManager, this._clickTolerance = l.clickTolerance || 1, this._moveFunction = l.move, this._activateOnStart = !!l.activateOnStart, l.assignEvents(this), this.reset();
}
reset(l) {
this._active = !1, this._moved = !1, delete this._lastPoint, this._moveStateManager.endMove(l);
}
_move(...l) {
const m = this._moveFunction(...l);
if (m.bearingDelta || m.pitchDelta || m.around || m.panDelta)
return this._active = !0, m;
}
dragStart(l, m) {
this.isEnabled() && !this._lastPoint && this._moveStateManager.isValidStartEvent(l) && (this._moveStateManager.startMove(l), this._lastPoint = m.length ? m[0] : m, this._activateOnStart && this._lastPoint && (this._active = !0));
}
dragMove(l, m) {
if (!this.isEnabled())
return;
const v = this._lastPoint;
if (!v)
return;
if (l.preventDefault(), !this._moveStateManager.isValidMoveEvent(l))
return void this.reset(l);
const b = m.length ? m[0] : m;
return !this._moved && b.dist(v) < this._clickTolerance ? void 0 : (this._moved = !0, this._lastPoint = b, this._move(v, b));
}
dragEnd(l) {
this.isEnabled() && this._lastPoint && this._moveStateManager.isValidEndEvent(l) && (this._moved && Q.suppressClick(), this.reset(l));
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
getClickTolerance() {
return this._clickTolerance;
}
}
const wa = { 0: 1, 2: 2 };
class N3 {
constructor(l) {
this._correctEvent = l.checkCorrectEvent;
}
startMove(l) {
const m = Q.mouseButton(l);
this._eventButton = m;
}
endMove(l) {
delete this._eventButton;
}
isValidStartEvent(l) {
return this._correctEvent(l);
}
isValidMoveEvent(l) {
return !function(m, v) {
const b = wa[v];
return m.buttons === void 0 || (m.buttons & b) !== b;
}(l, this._eventButton);
}
isValidEndEvent(l) {
return Q.mouseButton(l) === this._eventButton;
}
}
class xa {
constructor() {
this._firstTouch = void 0;
}
_isOneFingerTouch(l) {
return l.targetTouches.length === 1;
}
_isSameTouchEvent(l) {
return l.targetTouches[0].identifier === this._firstTouch;
}
startMove(l) {
this._firstTouch = l.targetTouches[0].identifier;
}
endMove(l) {
delete this._firstTouch;
}
isValidStartEvent(l) {
return this._isOneFingerTouch(l);
}
isValidMoveEvent(l) {
return this._isOneFingerTouch(l) && this._isSameTouchEvent(l);
}
isValidEndEvent(l) {
return this._isOneFingerTouch(l) && this._isSameTouchEvent(l);
}
}
const $s = (S) => {
S.mousedown = S.dragStart, S.mousemoveWindow = S.dragMove, S.mouseup = S.dragEnd, S.contextmenu = (l) => {
l.preventDefault();
};
}, Ec = ({ enable: S, clickTolerance: l, bearingDegreesPerPixelMoved: m = 0.8 }) => {
const v = new N3({ checkCorrectEvent: (b) => Q.mouseButton(b) === 0 && b.ctrlKey || Q.mouseButton(b) === 2 });
return new Qo({ clickTolerance: l, move: (b, M) => ({ bearingDelta: (M.x - b.x) * m }), moveStateManager: v, enable: S, assignEvents: $s });
}, Mc = ({ enable: S, clickTolerance: l, pitchDegreesPerPixelMoved: m = -0.5 }) => {
const v = new N3({ checkCorrectEvent: (b) => Q.mouseButton(b) === 0 && b.ctrlKey || Q.mouseButton(b) === 2 });
return new Qo({ clickTolerance: l, move: (b, M) => ({ pitchDelta: (M.y - b.y) * m }), moveStateManager: v, enable: S, assignEvents: $s });
};
class D3 {
constructor(l, m) {
this._clickTolerance = l.clickTolerance || 1, this._map = m, this.reset();
}
reset() {
this._active = !1, this._touches = {}, this._sum = new a.P(0, 0);
}
_shouldBePrevented(l) {
return l < (this._map.cooperativeGestures.isEnabled() ? 2 : 1);
}
touchstart(l, m, v) {
return this._calculateTransform(l, m, v);
}
touchmove(l, m, v) {
if (this._active) {
if (!this._shouldBePrevented(v.length))
return l.preventDefault(), this._calculateTransform(l, m, v);
this._map.cooperativeGestures.notifyGestureBlocked("touch_pan", l);
}
}
touchend(l, m, v) {
this._calculateTransform(l, m, v), this._active && this._shouldBePrevented(v.length) && this.reset();
}
touchcancel() {
this.reset();
}
_calculateTransform(l, m, v) {
v.length > 0 && (this._active = !0);
const b = Po(v, m), M = new a.P(0, 0), V = new a.P(0, 0);
let D = 0;
for (const Z in b) {
const Y = b[Z], J = this._touches[Z];
J && (M._add(Y), V._add(Y.sub(J)), D++, b[Z] = Y);
}
if (this._touches = b, this._shouldBePrevented(D) || !V.mag())
return;
const j = V.div(D);
return this._sum._add(j), this._sum.mag() < this._clickTolerance ? void 0 : { around: M.div(D), panDelta: j };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class El {
constructor() {
this.reset();
}
reset() {
this._active = !1, delete this._firstTwoTouches;
}
touchstart(l, m, v) {
this._firstTwoTouches || v.length < 2 || (this._firstTwoTouches = [v[0].identifier, v[1].identifier], this._start([m[0], m[1]]));
}
touchmove(l, m, v) {
if (!this._firstTwoTouches)
return;
l.preventDefault();
const [b, M] = this._firstTwoTouches, V = C0(v, m, b), D = C0(v, m, M);
if (!V || !D)
return;
const j = this._aroundCenter ? null : V.add(D).div(2);
return this._move([V, D], j, l);
}
touchend(l, m, v) {
if (!this._firstTwoTouches)
return;
const [b, M] = this._firstTwoTouches, V = C0(v, m, b), D = C0(v, m, M);
V && D || (this._active && Q.suppressClick(), this.reset());
}
touchcancel() {
this.reset();
}
enable(l) {
this._enabled = !0, this._aroundCenter = !!l && l.around === "center";
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active;
}
}
function C0(S, l, m) {
for (let v = 0; v < S.length; v++)
if (S[v].identifier === m)
return l[v];
}
function Sc(S, l) {
return Math.log(S / l) / Math.LN2;
}
class Hc extends El {
reset() {
super.reset(), delete this._distance, delete this._startDistance;
}
_start(l) {
this._startDistance = this._distance = l[0].dist(l[1]);
}
_move(l, m) {
const v = this._distance;
if (this._distance = l[0].dist(l[1]), this._active || !(Math.abs(Sc(this._distance, this._startDistance)) < 0.1))
return this._active = !0, { zoomDelta: Sc(this._distance, v), pinchAround: m };
}
}
function Ac(S, l) {
return 180 * S.angleWith(l) / Math.PI;
}
class Oc extends El {
reset() {
super.reset(), delete this._minDiameter, delete this._startVector, delete this._vector;
}
_start(l) {
this._startVector = this._vector = l[0].sub(l[1]), this._minDiameter = l[0].dist(l[1]);
}
_move(l, m, v) {
const b = this._vector;
if (this._vector = l[0].sub(l[1]), this._active || !this._isBelowThreshold(this._vector))
return this._active = !0, { bearingDelta: Ac(this._vector, b), pinchAround: m };
}
_isBelowThreshold(l) {
this._minDiameter = Math.min(this._minDiameter, l.mag());
const m = 25 / (Math.PI * this._minDiameter) * 360, v = Ac(l, this._startVector);
return Math.abs(v) < m;
}
}
function Ml(S) {
return Math.abs(S.y) > Math.abs(S.x);
}
class J4 extends El {
constructor(l) {
super(), this._currentTouchCount = 0, this._map = l;
}
reset() {
super.reset(), this._valid = void 0, delete this._firstMove, delete this._lastPoints;
}
touchstart(l, m, v) {
super.touchstart(l, m, v), this._currentTouchCount = v.length;
}
_start(l) {
this._lastPoints = l, Ml(l[0].sub(l[1])) && (this._valid = !1);
}
_move(l, m, v) {
if (this._map.cooperativeGestures.isEnabled() && this._currentTouchCount < 3)
return;
const b = l[0].sub(this._lastPoints[0]), M = l[1].sub(this._lastPoints[1]);
return this._valid = this.gestureBeginsVertically(b, M, v.timeStamp), this._valid ? (this._lastPoints = l, this._active = !0, { pitchDelta: (b.y + M.y) / 2 * -0.5 }) : void 0;
}
gestureBeginsVertically(l, m, v) {
if (this._valid !== void 0)
return this._valid;
const b = l.mag() >= 2, M = m.mag() >= 2;
if (!b && !M)
return;
if (!b || !M)
return this._firstMove === void 0 && (this._firstMove = v), v - this._firstMove < 100 && void 0;
const V = l.y > 0 == m.y > 0;
return Ml(l) && Ml(m) && V;
}
}
const Tp = { panStep: 100, bearingStep: 15, pitchStep: 10 };
class r2 {
constructor(l) {
this._tr = new O1(l);
const m = Tp;
this._panStep = m.panStep, this._bearingStep = m.bearingStep, this._pitchStep = m.pitchStep, this._rotationDisabled = !1;
}
reset() {
this._active = !1;
}
keydown(l) {
if (l.altKey || l.ctrlKey || l.metaKey)
return;
let m = 0, v = 0, b = 0, M = 0, V = 0;
switch (l.keyCode) {
case 61:
case 107:
case 171:
case 187:
m = 1;
break;
case 189:
case 109:
case 173:
m = -1;
break;
case 37:
l.shiftKey ? v = -1 : (l.preventDefault(), M = -1);
break;
case 39:
l.shiftKey ? v = 1 : (l.preventDefault(), M = 1);
break;
case 38:
l.shiftKey ? b = 1 : (l.preventDefault(), V = -1);
break;
case 40:
l.shiftKey ? b = -1 : (l.preventDefault(), V = 1);
break;
default:
return;
}
return this._rotationDisabled && (v = 0, b = 0), { cameraAnimation: (D) => {
const j = this._tr;
D.easeTo({ duration: 300, easeId: "keyboardHandler", easing: Ts, zoom: m ? Math.round(j.zoom) + m * (l.shiftKey ? 2 : 1) : j.zoom, bearing: j.bearing + v * this._bearingStep, pitch: j.pitch + b * this._pitchStep, offset: [-M * this._panStep, -V * this._panStep], center: j.center }, { originalEvent: l });
} };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
disableRotation() {
this._rotationDisabled = !0;
}
enableRotation() {
this._rotationDisabled = !1;
}
}
function Ts(S) {
return S * (2 - S);
}
const Cc = 4.000244140625;
class A2 {
constructor(l, m) {
this._onTimeout = (v) => {
this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(v);
}, this._map = l, this._tr = new O1(l), this._triggerRenderFrame = m, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = 0.0022222222222222222;
}
setZoomRate(l) {
this._defaultZoomRate = l;
}
setWheelZoomRate(l) {
this._wheelZoomRate = l;
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active || this._finishTimeout !== void 0;
}
isZooming() {
return !!this._zooming;
}
enable(l) {
this.isEnabled() || (this._enabled = !0, this._aroundCenter = !!l && l.around === "center");
}
disable() {
this.isEnabled() && (this._enabled = !1);
}
_shouldBePrevented(l) {
return !!this._map.cooperativeGestures.isEnabled() && !(l.ctrlKey || this._map.cooperativeGestures.isBypassed(l));
}
wheel(l) {
if (!this.isEnabled())
return;
if (this._shouldBePrevented(l))
return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom", l);
let m = l.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * l.deltaY : l.deltaY;
const v = f.now(), b = v - (this._lastWheelEventTime || 0);
this._lastWheelEventTime = v, m !== 0 && m % Cc == 0 ? this._type = "wheel" : m !== 0 && Math.abs(m) < 4 ? this._type = "trackpad" : b > 400 ? (this._type = null, this._lastValue = m, this._timeout = setTimeout(this._onTimeout, 40, l)) : this._type || (this._type = Math.abs(b * m) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, m += this._lastValue)), l.shiftKey && m && (m /= 4), this._type && (this._lastWheelEvent = l, this._delta -= m, this._active || this._start(l)), l.preventDefault();
}
_start(l) {
if (!this._delta)
return;
this._frameId && (this._frameId = null), this._active = !0, this.isZooming() || (this._zooming = !0), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
const m = Q.mousePos(this._map.getCanvas(), l), v = this._tr;
this._around = m.y > v.transform.height / 2 - v.transform.getHorizon() ? a.N.convert(this._aroundCenter ? v.center : v.unproject(m)) : a.N.convert(v.center), this._aroundPoint = v.transform.locationPoint(this._around), this._frameId || (this._frameId = !0, this._triggerRenderFrame());
}
renderFrame() {
if (!this._frameId || (this._frameId = null, !this.isActive()))
return;
const l = this._tr.transform;
if (this._delta !== 0) {
const j = this._type === "wheel" && Math.abs(this._delta) > Cc ? this._wheelZoomRate : this._defaultZoomRate;
let Z = 2 / (1 + Math.exp(-Math.abs(this._delta * j)));
this._delta < 0 && Z !== 0 && (Z = 1 / Z);
const Y = typeof this._targetZoom == "number" ? l.zoomScale(this._targetZoom) : l.scale;
this._targetZoom = Math.min(l.maxZoom, Math.max(l.minZoom, l.scaleZoom(Y * Z))), this._type === "wheel" && (this._startZoom = l.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;
}
const m = typeof this._targetZoom == "number" ? this._targetZoom : l.zoom, v = this._startZoom, b = this._easing;
let M, V = !1;
const D = f.now() - this._lastWheelEventTime;
if (this._type === "wheel" && v && b && D) {
const j = Math.min(D / 200, 1), Z = b(j);
M = a.y.number(v, m, Z), j < 1 ? this._frameId || (this._frameId = !0) : V = !0;
} else
M = m, V = !0;
return this._active = !0, V && (this._active = !1, this._finishTimeout = setTimeout(() => {
this._zooming = !1, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;
}, 200)), { noInertia: !0, needsRenderFrame: !V, zoomDelta: M - l.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
}
_smoothOutEasing(l) {
let m = a.b9;
if (this._prevEase) {
const v = this._prevEase, b = (f.now() - v.start) / v.duration, M = v.easing(b + 0.01) - v.easing(b), V = 0.27 / Math.sqrt(M * M + 1e-4) * 0.01, D = Math.sqrt(0.0729 - V * V);
m = a.b8(V, D, 0.25, 1);
}
return this._prevEase = { start: f.now(), duration: l, easing: m }, m;
}
reset() {
this._active = !1, this._zooming = !1, delete this._targetZoom, this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
}
}
class F3 {
constructor(l, m) {
this._clickZoom = l, this._tapZoom = m;
}
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 p_ {
constructor(l) {
this._tr = new O1(l), this.reset();
}
reset() {
this._active = !1;
}
dblclick(l, m) {
return l.preventDefault(), { cameraAnimation: (v) => {
v.easeTo({ duration: 300, zoom: this._tr.zoom + (l.shiftKey ? -1 : 1), around: this._tr.unproject(m) }, { originalEvent: l });
} };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class T_ {
constructor() {
this._tap = new Gs({ numTouches: 1, numTaps: 1 }), this.reset();
}
reset() {
this._active = !1, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();
}
touchstart(l, m, v) {
if (!this._swipePoint)
if (this._tapTime) {
const b = m[0], M = l.timeStamp - this._tapTime < 500, V = this._tapPoint.dist(b) < 30;
M && V ? v.length > 0 && (this._swipePoint = b, this._swipeTouch = v[0].identifier) : this.reset();
} else
this._tap.touchstart(l, m, v);
}
touchmove(l, m, v) {
if (this._tapTime) {
if (this._swipePoint) {
if (v[0].identifier !== this._swipeTouch)
return;
const b = m[0], M = b.y - this._swipePoint.y;
return this._swipePoint = b, l.preventDefault(), this._active = !0, { zoomDelta: M / 128 };
}
} else
this._tap.touchmove(l, m, v);
}
touchend(l, m, v) {
if (this._tapTime)
this._swipePoint && v.length === 0 && this.reset();
else {
const b = this._tap.touchend(l, m, v);
b && (this._tapTime = l.timeStamp, this._tapPoint = b);
}
}
touchcancel() {
this.reset();
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class fp {
constructor(l, m, v) {
this._el = l, this._mousePan = m, this._touchPan = v;
}
enable(l) {
this._inertiaOptions = l || {}, 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 Qp {
constructor(l, m, v) {
this._pitchWithRotate = l.pitchWithRotate, this._mouseRotate = m, this._mousePitch = v;
}
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 kc {
constructor(l, m, v, b) {
this._el = l, this._touchZoom = m, this._touchRotate = v, this._tapDragZoom = b, this._rotationDisabled = !1, this._enabled = !0;
}
enable(l) {
this._touchZoom.enable(l), this._rotationDisabled || this._touchRotate.enable(l), 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 = !0, this._touchRotate.disable();
}
enableRotation() {
this._rotationDisabled = !1, this._touchZoom.isEnabled() && this._touchRotate.enable();
}
}
class t6 {
constructor(l, m) {
this._bypassKey = navigator.userAgent.indexOf("Mac") !== -1 ? "metaKey" : "ctrlKey", this._map = l, this._options = m, this._enabled = !1;
}
isActive() {
return !1;
}
reset() {
}
_setupUI() {
if (this._container)
return;
const l = this._map.getCanvasContainer();
l.classList.add("maplibregl-cooperative-gestures"), this._container = Q.create("div", "maplibregl-cooperative-gesture-screen", l);
let m = this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");
this._bypassKey === "metaKey" && (m = this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));
const v = this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"), b = document.createElement("div");
b.className = "maplibregl-desktop-message", b.textContent = m, this._container.appendChild(b);
const M = document.createElement("div");
M.className = "maplibregl-mobile-message", M.textContent = v, this._container.appendChild(M), this._container.setAttribute("aria-hidden", "true");
}
_destroyUI() {
this._container && (Q.remove(this._container), this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")), delete this._container;
}
enable() {
this._setupUI(), this._enabled = !0;
}
disable() {
this._enabled = !1, this._destroyUI();
}
isEnabled() {
return this._enabled;
}
isBypassed(l) {
return l[this._bypassKey];
}
notifyGestureBlocked(l, m) {
this._enabled && (this._map.fire(new a.k("cooperativegestureprevented", { gestureType: l, originalEvent: m })), this._container.classList.add("maplibregl-show"), setTimeout(() => {
this._container.classList.remove("maplibregl-show");
}, 100));
}
}
const n2 = (S) => S.zoom || S.drag || S.pitch || S.rotate;
class nr extends a.k {
}
function Sl(S) {
return S.panDelta && S.panDelta.mag() || S.zoomDelta || S.bearingDelta || S.pitchDelta;
}
class Ic {
constructor(l, m) {
this.handleWindowEvent = (b) => {
this.handleEvent(b, `${b.type}Window`);
}, this.handleEvent = (b, M) => {
if (b.type === "blur")
return void this.stop(!0);
this._updatingCamera = !0;
const V = b.type === "renderFrame" ? void 0 : b, D = { needsRenderFrame: !1 }, j = {}, Z = {}, Y = b.touches, J = Y ? this._getMapTouches(Y) : void 0, lt = J ? Q.touchPos(this._map.getCanvas(), J) : Q.mousePos(this._map.getCanvas(), b);
for (const { handlerName: wt, handler: Mt, allowed: Ht } of this._handlers) {
if (!Mt.isEnabled())
continue;
let Ot;
this._blockedByActive(Z, Ht, wt) ? Mt.reset() : Mt[M || b.type] && (Ot = Mt[M || b.type](b, lt, J), this.mergeHandlerResult(D, j, Ot, wt, V), Ot && Ot.needsRenderFrame && this._triggerRenderFrame()), (Ot || Mt.isActive()) && (Z[wt] = Mt);
}
const ft = {};
for (const wt in this._previousActiveHandlers)
Z[wt] || (ft[wt] = V);
this._previousActiveHandlers = Z, (Object.keys(ft).length || Sl(D)) && (this._changes.push([D, j, ft]), this._triggerRenderFrame()), (Object.keys(Z).length || Sl(D)) && this._map._stop(!0), this._updatingCamera = !1;
const { cameraAnimation: Qt } = D;
Qt && (this._inertia.clear(), this._fireEvents({}, {}, !0), this._changes = [], Qt(this._map));
}, this._map = l, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new mn(l), this._bearingSnap = m.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(m);
const v = this._el;
this._listeners = [[v, "touchstart", { passive: !0 }], [v, "touchmove", { passive: !1 }], [v, "touchend", void 0], [v, "touchcancel", void 0], [v, "mousedown", void 0], [v, "mousemove", void 0], [v, "mouseup", void 0], [document, "mousemove", { capture: !0 }], [document, "mouseup", void 0], [v, "mouseover", void 0], [v, "mouseout", void 0], [v, "dblclick", void 0], [v, "click", void 0], [v, "keydown", { capture: !1 }], [v, "keyup", void 0], [v, "wheel", { passive: !1 }], [v, "contextmenu", void 0], [window, "blur", void 0]];
for (const [b, M, V] of this._listeners)
Q.addEventListener(b, M, b === document ? this.handleWindowEvent : this.handleEvent, V);
}
destroy() {
for (const [l, m, v] of this._listeners)
Q.removeEventListener(l, m, l === document ? this.handleWindowEvent : this.handleEvent, v);
}
_addDefaultHandlers(l) {
const m = this._map, v = m.getCanvasContainer();
this._add("mapEvent", new H2(m, l));
const b = m.boxZoom = new Wi(m, l);
this._add("boxZoom", b), l.interactive && l.boxZoom && b.enable();
const M = m.cooperativeGestures = new t6(m, l.cooperativeGestures);
this._add("cooperativeGestures", M), l.cooperativeGestures && M.enable();
const V = new ps(m), D = new p_(m);
m.doubleClickZoom = new F3(D, V), this._add("tapZoom", V), this._add("clickZoom", D), l.interactive && l.doubleClickZoom && m.doubleClickZoom.enable();
const j = new T_();
this._add("tapDragZoom", j);
const Z = m.touchPitch = new J4(m);
this._add("touchPitch", Z), l.interactive && l.touchPitch && m.touchPitch.enable(l.touchPitch);
const Y = Ec(l), J = Mc(l);
m.dragRotate = new Qp(l, Y, J), this._add("mouseRotate", Y, ["mousePitch"]), this._add("mousePitch", J, ["mouseRotate"]), l.interactive && l.dragRotate && m.dragRotate.enable();
const lt = (({ enable: Ot, clickTolerance: bt }) => {
const Nt = new N3({ checkCorrectEvent: (Dt) => Q.mouseButton(Dt) === 0 && !Dt.ctrlKey });
return new Qo({ clickTolerance: bt, move: (Dt, Wt) => ({ around: Wt, panDelta: Wt.sub(Dt) }), activateOnStart: !0, moveStateManager: Nt, enable: Ot, assignEvents: $s });
})(l), ft = new D3(l, m);
m.dragPan = new fp(v, lt, ft), this._add("mousePan", lt), this._add("touchPan", ft, ["touchZoom", "touchRotate"]), l.interactive && l.dragPan && m.dragPan.enable(l.dragPan);
const Qt = new Oc(), wt = new Hc();
m.touchZoomRotate = new kc(v, wt, Qt, j), this._add("touchRotate", Qt, ["touchPan", "touchZoom"]), this._add("touchZoom", wt, ["touchPan", "touchRotate"]), l.interactive && l.touchZoomRotate && m.touchZoomRotate.enable(l.touchZoomRotate);
const Mt = m.scrollZoom = new A2(m, () => this._triggerRenderFrame());
this._add("scrollZoom", Mt, ["mousePan"]), l.interactive && l.scrollZoom && m.scrollZoom.enable(l.scrollZoom);
const Ht = m.keyboard = new r2(m);
this._add("keyboard", Ht), l.interactive && l.keyboard && m.keyboard.enable(), this._add("blockableMapEvent", new Dn(m));
}
_add(l, m, v) {
this._handlers.push({ handlerName: l, handler: m, allowed: v }), this._handlersById[l] = m;
}
stop(l) {
if (!this._updatingCamera) {
for (const { handler: m } of this._handlers)
m.reset();
this._inertia.clear(), this._fireEvents({}, {}, l), this._changes = [];
}
}
isActive() {
for (const { handler: l } of this._handlers)
if (l.isActive())
return !0;
return !1;
}
isZooming() {
return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
}
isRotating() {
return !!this._eventsInProgress.rotate;
}
isMoving() {
return !!n2(this._eventsInProgress) || this.isZooming();
}
_blockedByActive(l, m, v) {
for (const b in l)
if (b !== v && (!m || m.indexOf(b) < 0))
return !0;
return !1;
}
_getMapTouches(l) {
const m = [];
for (const v of l)
this._el.contains(v.target) && m.push(v);
return m;
}
mergeHandlerResult(l, m, v, b, M) {
if (!v)
return;
a.e(l, v);
const V = { handlerName: b, originalEvent: v.originalEvent || M };
v.zoomDelta !== void 0 && (m.zoom = V), v.panDelta !== void 0 && (m.drag = V), v.pitchDelta !== void 0 && (m.pitch = V), v.bearingDelta !== void 0 && (m.rotate = V);
}
_applyChanges() {
const l = {}, m = {}, v = {};
for (const [b, M, V] of this._changes)
b.panDelta && (l.panDelta = (l.panDelta || new a.P(0, 0))._add(b.panDelta)), b.zoomDelta && (l.zoomDelta = (l.zoomDelta || 0) + b.zoomDelta), b.bearingDelta && (l.bearingDelta = (l.bearingDelta || 0) + b.bearingDelta), b.pitchDelta && (l.pitchDelta = (l.pitchDelta || 0) + b.pitchDelta), b.around !== void 0 && (l.around = b.around), b.pinchAround !== void 0 && (l.pinchAround = b.pinchAround), b.noInertia && (l.noInertia = b.noInertia), a.e(m, M), a.e(v, V);
this._updateMapTransform(l, m, v), this._changes = [];
}
_updateMapTransform(l, m, v) {
const b = this._map, M = b._getTransformForUpdate(), V = b.terrain;
if (!(Sl(l) || V && this._terrainMovement))
return this._fireEvents(m, v, !0);
let { panDelta: D, zoomDelta: j, bearingDelta: Z, pitchDelta: Y, around: J, pinchAround: lt } = l;
lt !== void 0 && (J = lt), b._stop(!0), J = J || b.transform.centerPoint;
const ft = M.pointLocation(D ? J.sub(D) : J);
Z && (M.bearing += Z), Y && (M.pitch += Y), j && (M.zoom += j), V ? this._terrainMovement || !m.drag && !m.zoom ? m.drag && this._terrainMovement ? M.center = M.pointLocation(M.centerPoint.sub(D)) : M.setLocationAtPoint(ft, J) : (this._terrainMovement = !0, this._map._elevationFreeze = !0, M.setLocationAtPoint(ft, J)) : M.setLocationAtPoint(ft, J), b._applyUpdatedTransform(M), this._map._update(), l.noInertia || this._inertia.record(l), this._fireEvents(m, v, !0);
}
_fireEvents(l, m, v) {
const b = n2(this._eventsInProgress), M = n2(l), V = {};
for (const J in l) {
const { originalEvent: lt } = l[J];
this._eventsInProgress[J] || (V[`${J}start`] = lt), this._eventsInProgress[J] = l[J];
}
!b && M && this._fireEvent("movestart", M.originalEvent);
for (const J in V)
this._fireEvent(J, V[J]);
M && this._fireEvent("move", M.originalEvent);
for (const J in l) {
const { originalEvent: lt } = l[J];
this._fireEvent(J, lt);
}
const D = {};
let j;
for (const J in this._eventsInProgress) {
const { handlerName: lt, originalEvent: ft } = this._eventsInProgress[J];
this._handlersById[lt].isActive() || (delete this._eventsInProgress[J], j = m[lt] || ft, D[`${J}end`] = j);
}
for (const J in D)
this._fireEvent(J, D[J]);
const Z = n2(this._eventsInProgress), Y = (b || M) && !Z;
if (Y && this._terrainMovement) {
this._map._elevationFreeze = !1, this._terrainMovement = !1;
const J = this._map._getTransformForUpdate();
J.recalculateZoom(this._map.terrain), this._map._applyUpdatedTransform(J);
}
if (v && Y) {
this._updatingCamera = !0;
const J = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), lt = (ft) => ft !== 0 && -this._bearingSnap < ft && ft < this._bearingSnap;
!J || !J.essential && f.prefersReducedMotion ? (this._map.fire(new a.k("moveend", { originalEvent: j })), lt(this._map.getBearing()) && this._map.resetNorth()) : (lt(J.bearing || this._map.getBearing()) && (J.bearing = 0), J.freezeElevation = !0, this._map.easeTo(J, { originalEvent: j })), this._updatingCamera = !1;
}
}
_fireEvent(l, m) {
this._map.fire(new a.k(l, m ? { originalEvent: m } : {}));
}
_requestFrame() {
return this._map.triggerRepaint(), this._map._renderTaskQueue.add((l) => {
delete this._frameId, this.handleEvent(new nr("renderFrame", { timeStamp: l })), this._applyChanges();
});
}
_triggerRenderFrame() {
this._frameId === void 0 && (this._frameId = this._requestFrame());
}
}
class mp extends a.E {
constructor(l, m) {
super(), this._renderFrameCallback = () => {
const v = Math.min((f.now() - this._easeStart) / this._easeOptions.duration, 1);
this._onEaseFrame(this._easeOptions.easing(v)), v < 1 && this._easeFrameId ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();
}, this._moving = !1, this._zooming = !1, this.transform = l, this._bearingSnap = m.bearingSnap, this.on("moveend", () => {
delete this._requestedCameraState;
});
}
getCenter() {
return new a.N(this.transform.center.lng, this.transform.center.lat);
}
setCenter(l, m) {
return this.jumpTo({ center: l }, m);
}
panBy(l, m, v) {
return l = a.P.convert(l).mult(-1), this.panTo(this.transform.center, a.e({ offset: l }, m), v);
}
panTo(l, m, v) {
return this.easeTo(a.e({ center: l }, m), v);
}
getZoom() {
return this.transform.zoom;
}
setZoom(l, m) {
return this.jumpTo({ zoom: l }, m), this;
}
zoomTo(l, m, v) {
return this.easeTo(a.e({ zoom: l }, m), v);
}
zoomIn(l, m) {
return this.zoomTo(this.getZoom() + 1, l, m), this;
}
zoomOut(l, m) {
return this.zoomTo(this.getZoom() - 1, l, m), this;
}
getBearing() {
return this.transform.bearing;
}
setBearing(l, m) {
return this.jumpTo({ bearing: l }, m), this;
}
getPadding() {
return this.transform.padding;
}
setPadding(l, m) {
return this.jumpTo({ padding: l }, m), this;
}
rotateTo(l, m, v) {
return this.easeTo(a.e({ bearing: l }, m), v);
}
resetNorth(l, m) {
return this.rotateTo(0, a.e({ duration: 1e3 }, l), m), this;
}
resetNorthPitch(l, m) {
return this.easeTo(a.e({ bearing: 0, pitch: 0, duration: 1e3 }, l), m), this;
}
snapToNorth(l, m) {
return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(l, m) : this;
}
getPitch() {
return this.transform.pitch;
}
setPitch(l, m) {
return this.jumpTo({ pitch: l }, m), this;
}
cameraForBounds(l, m) {
l = Ct.convert(l).adjustAntiMeridian();
const v = m && m.bearing || 0;
return this._cameraForBoxAndBearing(l.getNorthWest(), l.getSouthEast(), v, m);
}
_cameraForBoxAndBearing(l, m, v, b) {
const M = { top: 0, bottom: 0, right: 0, left: 0 };
if (typeof (b = a.e({ padding: M, offset: [0, 0], maxZoom: this.transform.maxZoom }, b)).padding == "number") {
const Oe = b.padding;
b.padding = { top: Oe, bottom: Oe, right: Oe, left: Oe };
}
b.padding = a.e(M, b.padding);
const V = this.transform, D = V.padding, j = new Ct(l, m), Z = V.project(j.getNorthWest()), Y = V.project(j.getNorthEast()), J = V.project(j.getSouthEast()), lt = V.project(j.getSouthWest()), ft = a.ba(-v), Qt = Z.rotate(ft), wt = Y.rotate(ft), Mt = J.rotate(ft), Ht = lt.rotate(ft), Ot = new a.P(Math.max(Qt.x, wt.x, Ht.x, Mt.x), Math.max(Qt.y, wt.y, Ht.y, Mt.y)), bt = new a.P(Math.min(Qt.x, wt.x, Ht.x, Mt.x), Math.min(Qt.y, wt.y, Ht.y, Mt.y)), Nt = Ot.sub(bt), Dt = (V.width - (D.left + D.right + b.padding.left + b.padding.right)) / Nt.x, Wt = (V.height - (D.top + D.bottom + b.padding.top + b.padding.bottom)) / Nt.y;
if (Wt < 0 || Dt < 0)
return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
const he = Math.min(V.scaleZoom(V.scale * Math.min(Dt, Wt)), b.maxZoom), we = a.P.convert(b.offset), De = new a.P((b.padding.left - b.padding.right) / 2, (b.padding.top - b.padding.bottom) / 2).rotate(a.ba(v)), tr = we.add(De).mult(V.scale / V.zoomScale(he));
return { center: V.unproject(Z.add(J).div(2).sub(tr)), zoom: he, bearing: v };
}
fitBounds(l, m, v) {
return this._fitInternal(this.cameraForBounds(l, m), m, v);
}
fitScreenCoordinates(l, m, v, b, M) {
return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.P.convert(l)), this.transform.pointLocation(a.P.convert(m)), v, b), b, M);
}
_fitInternal(l, m, v) {
return l ? (delete (m = a.e(l, m)).padding, m.linear ? this.easeTo(m, v) : this.flyTo(m, v)) : this;
}
jumpTo(l, m) {
this.stop();
const v = this._getTransformForUpdate();
let b = !1, M = !1, V = !1;
return "zoom" in l && v.zoom !== +l.zoom && (b = !0, v.zoom = +l.zoom), l.center !== void 0 && (v.center = a.N.convert(l.center)), "bearing" in l && v.bearing !== +l.bearing && (M = !0, v.bearing = +l.bearing), "pitch" in l && v.pitch !== +l.pitch && (V = !0, v.pitch = +l.pitch), l.padding == null || v.isPaddingEqual(l.padding) || (v.padding = l.padding), this._applyUpdatedTransform(v), this.fire(new a.k("movestart", m)).fire(new a.k("move", m)), b && this.fire(new a.k("zoomstart", m)).fire(new a.k("zoom", m)).fire(new a.k("zoomend", m)), M && this.fire(new a.k("rotatestart", m)).fire(new a.k("rotate", m)).fire(new a.k("rotateend", m)), V && this.fire(new a.k("pitchstart", m)).fire(new a.k("pitch", m)).fire(new a.k("pitchend", m)), this.fire(new a.k("moveend", m));
}
calculateCameraOptionsFromTo(l, m, v, b = 0) {
const M = a.Z.fromLngLat(l, m), V = a.Z.fromLngLat(v, b), D = V.x - M.x, j = V.y - M.y, Z = V.z - M.z, Y = Math.hypot(D, j, Z);
if (Y === 0)
throw new Error("Can't calculate camera options with same From and To");
const J = Math.hypot(D, j), lt = this.transform.scaleZoom(this.transform.cameraToCenterDistance / Y / this.transform.tileSize), ft = 180 * Math.atan2(D, -j) / Math.PI;
let Qt = 180 * Math.acos(J / Y) / Math.PI;
return Qt = Z < 0 ? 90 - Qt : 90 + Qt, { center: V.toLngLat(), zoom: lt, pitch: Qt, bearing: ft };
}
easeTo(l, m) {
var v;
this._stop(!1, l.easeId), ((l = a.e({ offset: [0, 0], duration: 500, easing: a.b9 }, l)).animate === !1 || !l.essential && f.prefersReducedMotion) && (l.duration = 0);
const b = this._getTransformForUpdate(), M = b.zoom, V = b.bearing, D = b.pitch, j = b.padding, Z = "bearing" in l ? this._normalizeBearing(l.bearing, V) : V, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : b.padding, lt = a.P.convert(l.offset);
let ft = b.centerPoint.add(lt);
const Qt = b.pointLocation(ft), { center: wt, zoom: Mt } = b.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(wt, b);
const Ht = b.project(Qt), Ot = b.project(wt).sub(Ht), bt = b.zoomScale(Mt - M);
let Nt, Dt;
l.around && (Nt = a.N.convert(l.around), Dt = b.locationPoint(Nt));
const Wt = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };
return this._zooming = this._zooming || Mt !== M, this._rotating = this._rotating || V !== Z, this._pitching = this._pitching || Y !== D, this._padding = !b.isPaddingEqual(J), this._easeId = l.easeId, this._prepareEase(m, l.noMoveStart, Wt), this.terrain && this._prepareElevation(wt), this._ease((he) => {
if (this._zooming && (b.zoom = a.y.number(M, Mt, he)), this._rotating && (b.bearing = a.y.number(V, Z, he)), this._pitching && (b.pitch = a.y.number(D, Y, he)), this._padding && (b.interpolatePadding(j, J, he), ft = b.centerPoint.add(lt)), this.terrain && !l.freezeElevation && this._updateElevation(he), Nt)
b.setLocationAtPoint(Nt, Dt);
else {
const we = b.zoomScale(b.zoom - M), De = Mt > M ? Math.min(2, bt) : Math.max(0.5, bt), tr = Math.pow(De, 1 - he), Oe = b.unproject(Ht.add(Ot.mult(he * tr)).mult(we));
b.setLocationAtPoint(b.renderWorldCopies ? Oe.wrap() : Oe, ft);
}
this._applyUpdatedTransform(b), this._fireMoveEvents(m);
}, (he) => {
this.terrain && l.freezeElevation && this._finalizeElevation(), this._afterEase(m, he);
}, l), this;
}
_prepareEase(l, m, v = {}) {
this._moving = !0, m || v.moving || this.fire(new a.k("movestart", l)), this._zooming && !v.zooming && this.fire(new a.k("zoomstart", l)), this._rotating && !v.rotating && this.fire(new a.k("rotatestart", l)), this._pitching && !v.pitching && this.fire(new a.k("pitchstart", l));
}
_prepareElevation(l) {
this._elevationCenter = l, this._elevationStart = this.transform.elevation, this._elevationTarget = this.terrain.getElevationForLngLatZoom(l, this.transform.tileZoom), this._elevationFreeze = !0;
}
_updateElevation(l) {
this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
const m = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
if (l < 1 && m !== this._elevationTarget) {
const v = this._elevationTarget - this._elevationStart;
this._elevationStart += l * (v - (m - (v * l + this._elevationStart)) / (1 - l)), this._elevationTarget = m;
}
this.transform.elevation = a.y.number(this._elevationStart, this._elevationTarget, l);
}
_finalizeElevation() {
this._elevationFreeze = !1, this.transform.recalculateZoom(this.terrain);
}
_getTransformForUpdate() {
return this.transformCameraUpdate || this.terrain ? (this._requestedCameraState || (this._requestedCameraState = this.transform.clone()), this._requestedCameraState) : this.transform;
}
_elevateCameraIfInsideTerrain(l) {
const m = l.getCameraPosition(), v = this.terrain.getElevationForLngLatZoom(m.lngLat, l.zoom);
if (m.altitude < v) {
const b = this.calculateCameraOptionsFromTo(m.lngLat, v, l.center, l.elevation);
return { pitch: b.pitch, zoom: b.zoom };
}
return {};
}
_applyUpdatedTransform(l) {
const m = [];
if (this.terrain && m.push((b) => this._elevateCameraIfInsideTerrain(b)), this.transformCameraUpdate && m.push((b) => this.transformCameraUpdate(b)), !m.length)
return;
const v = l.clone();
for (const b of m) {
const M = v.clone(), { center: V, zoom: D, pitch: j, bearing: Z, elevation: Y } = b(M);
V && (M.center = V), D !== void 0 && (M.zoom = D), j !== void 0 && (M.pitch = j), Z !== void 0 && (M.bearing = Z), Y !== void 0 && (M.elevation = Y), v.apply(M);
}
this.transform.apply(v);
}
_fireMoveEvents(l) {
this.fire(new a.k("move", l)), this._zooming && this.fire(new a.k("zoom", l)), this._rotating && this.fire(new a.k("rotate", l)), this._pitching && this.fire(new a.k("pitch", l));
}
_afterEase(l, m) {
if (this._easeId && m && this._easeId === m)
return;
delete this._easeId;
const v = this._zooming, b = this._rotating, M = this._pitching;
this._moving = !1, this._zooming = !1, this._rotating = !1, this._pitching = !1, this._padding = !1, v && this.fire(new a.k("zoomend", l)), b && this.fire(new a.k("rotateend", l)), M && this.fire(new a.k("pitchend", l)), this.fire(new a.k("moveend", l));
}
flyTo(l, m) {
var v;
if (!l.essential && f.prefersReducedMotion) {
const We = a.M(l, ["center", "zoom", "bearing", "pitch", "around"]);
return this.jumpTo(We, m);
}
this.stop(), l = a.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: a.b9 }, l);
const b = this._getTransformForUpdate(), M = b.zoom, V = b.bearing, D = b.pitch, j = b.padding, Z = "bearing" in l ? this._normalizeBearing(l.bearing, V) : V, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : b.padding, lt = a.P.convert(l.offset);
let ft = b.centerPoint.add(lt);
const Qt = b.pointLocation(ft), { center: wt, zoom: Mt } = b.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(wt, b);
const Ht = b.zoomScale(Mt - M), Ot = b.project(Qt), bt = b.project(wt).sub(Ot);
let Nt = l.curve;
const Dt = Math.max(b.width, b.height), Wt = Dt / Ht, he = bt.mag();
if ("minZoom" in l) {
const We = a.ac(Math.min(l.minZoom, M, Mt), b.minZoom, b.maxZoom), kr = Dt / b.zoomScale(We - M);
Nt = Math.sqrt(kr / he * 2);
}
const we = Nt * Nt;
function De(We) {
const kr = (Wt * Wt - Dt * Dt + (We ? -1 : 1) * we * we * he * he) / (2 * (We ? Wt : Dt) * we * he);
return Math.log(Math.sqrt(kr * kr + 1) - kr);
}
function tr(We) {
return (Math.exp(We) - Math.exp(-We)) / 2;
}
function Oe(We) {
return (Math.exp(We) + Math.exp(-We)) / 2;
}
const Ae = De(!1);
let ur = function(We) {
return Oe(Ae) / Oe(Ae + Nt * We);
}, Nr = function(We) {
return Dt * ((Oe(Ae) * (tr(kr = Ae + Nt * We) / Oe(kr)) - tr(Ae)) / we) / he;
var kr;
}, Pe = (De(!0) - Ae) / Nt;
if (Math.abs(he) < 1e-6 || !isFinite(Pe)) {
if (Math.abs(Dt - Wt) < 1e-6)
return this.easeTo(l, m);
const We = Wt < Dt ? -1 : 1;
Pe = Math.abs(Math.log(Wt / Dt)) / Nt, Nr = () => 0, ur = (kr) => Math.exp(We * Nt * kr);
}
return l.duration = "duration" in l ? +l.duration : 1e3 * Pe / ("screenSpeed" in l ? +l.screenSpeed / Nt : +l.speed), l.maxDuration && l.duration > l.maxDuration && (l.duration = 0), this._zooming = !0, this._rotating = V !== Z, this._pitching = Y !== D, this._padding = !b.isPaddingEqual(J), this._prepareEase(m, !1), this.terrain && this._prepareElevation(wt), this._ease((We) => {
const kr = We * Pe, ei = 1 / ur(kr);
b.zoom = We === 1 ? Mt : M + b.scaleZoom(ei), this._rotating && (b.bearing = a.y.number(V, Z, We)), this._pitching && (b.pitch = a.y.number(D, Y, We)), this._padding && (b.interpolatePadding(j, J, We), ft = b.centerPoint.add(lt)), this.terrain && !l.freezeElevation && this._updateElevation(We);
const Wr = We === 1 ? wt : b.unproject(Ot.add(bt.mult(Nr(kr))).mult(ei));
b.setLocationAtPoint(b.renderWorldCopies ? Wr.wrap() : Wr, ft), this._applyUpdatedTransform(b), this._fireMoveEvents(m);
}, () => {
this.terrain && l.freezeElevation && this._finalizeElevation(), this._afterEase(m);
}, l), this;
}
isEasing() {
return !!this._easeFrameId;
}
stop() {
return this._stop();
}
_stop(l, m) {
var v;
if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {
const b = this._onEaseEnd;
delete this._onEaseEnd, b.call(this, m);
}
return l || (v = this.handlers) === null || v === void 0 || v.stop(!1), this;
}
_ease(l, m, v) {
v.animate === !1 || v.duration === 0 ? (l(1), m()) : (this._easeStart = f.now(), this._easeOptions = v, this._onEaseFrame = l, this._onEaseEnd = m, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));
}
_normalizeBearing(l, m) {
l = a.b3(l, -180, 180);
const v = Math.abs(l - m);
return Math.abs(l - 360 - m) < v && (l -= 360), Math.abs(l + 360 - m) < v && (l += 360), l;
}
_normalizeCenter(l, m) {
if (!m.renderWorldCopies || m.lngRange)
return;
const v = l.lng - m.center.lng;
l.lng += v > 180 ? -360 : v < -180 ? 360 : 0;
}
queryTerrainElevation(l) {
return this.terrain ? this.terrain.getElevationForLngLatZoom(a.N.convert(l), this.transform.tileZoom) - this.transform.elevation : null;
}
}
const e6 = { compact: !0, customAttribution: 'MapLibre' };
class r6 {
constructor(l = e6) {
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 = (m) => {
!m || m.sourceDataType !== "metadata" && m.sourceDataType !== "visibility" && m.dataType !== "style" && m.type !== "terrain" || this._updateAttributions();
}, this._updateCompact = () => {
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? this._compact === !1 ? 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 = l;
}
getDefaultPosition() {
return "bottom-right";
}
onAdd(l) {
return this._map = l, this._compact = this.options.compact, this._container = Q.create("details", "maplibregl-ctrl maplibregl-ctrl-attrib"), this._compactButton = Q.create("summary", "maplibregl-ctrl-attrib-button", this._container), this._compactButton.addEventListener("click", this._toggleAttribution), this._setElementTitle(this._compactButton, "ToggleAttribution"), this._innerContainer = Q.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() {
Q.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(l, m) {
const v = this._map._getUIString(`AttributionControl.${m}`);
l.title = v, l.setAttribute("aria-label", v);
}
_updateAttributions() {
if (!this._map.style)
return;
let l = [];
if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? l = l.concat(this.options.customAttribution.map((b) => typeof b != "string" ? "" : b)) : typeof this.options.customAttribution == "string" && l.push(this.options.customAttribution)), this._map.style.stylesheet) {
const b = this._map.style.stylesheet;
this.styleOwner = b.owner, this.styleId = b.id;
}
const m = this._map.style.sourceCaches;
for (const b in m) {
const M = m[b];
if (M.used || M.usedForTerrain) {
const V = M.getSource();
V.attribution && l.indexOf(V.attribution) < 0 && l.push(V.attribution);
}
}
l = l.filter((b) => String(b).trim()), l.sort((b, M) => b.length - M.length), l = l.filter((b, M) => {
for (let V = M + 1; V < l.length; V++)
if (l[V].indexOf(b) >= 0)
return !1;
return !0;
});
const v = l.join(" | ");
v !== this._attribHTML && (this._attribHTML = v, l.length ? (this._innerContainer.innerHTML = v, this._container.classList.remove("maplibregl-attrib-empty")) : this._container.classList.add("maplibregl-attrib-empty"), this._updateCompact(), this._editLink = null);
}
}
class Pc {
constructor(l = {}) {
this._updateCompact = () => {
const m = this._container.children;
if (m.length) {
const v = m[0];
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? this._compact !== !1 && v.classList.add("maplibregl-compact") : v.classList.remove("maplibregl-compact");
}
}, this.options = l;
}
getDefaultPosition() {
return "bottom-left";
}
onAdd(l) {
this._map = l, this._compact = this.options && this.options.compact, this._container = Q.create("div", "maplibregl-ctrl");
const m = Q.create("a", "maplibregl-ctrl-logo");
return m.target = "_blank", m.rel = "noopener nofollow", m.href = "https://maplibre.org/", m.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), m.setAttribute("rel", "noopener nofollow"), this._container.appendChild(m), this._container.style.display = "block", this._map.on("resize", this._updateCompact), this._updateCompact(), this._container;
}
onRemove() {
Q.remove(this._container), this._map.off("resize", this._updateCompact), this._map = void 0, this._compact = void 0;
}
}
class sn {
constructor() {
this._queue = [], this._id = 0, this._cleared = !1, this._currentlyRunning = !1;
}
add(l) {
const m = ++this._id;
return this._queue.push({ callback: l, id: m, cancelled: !1 }), m;
}
remove(l) {
const m = this._currentlyRunning, v = m ? this._queue.concat(m) : this._queue;
for (const b of v)
if (b.id === l)
return void (b.cancelled = !0);
}
run(l = 0) {
if (this._currentlyRunning)
throw new Error("Attempting to run(), but is already running.");
const m = this._currentlyRunning = this._queue;
this._queue = [];
for (const v of m)
if (!v.cancelled && (v.callback(l), this._cleared))
break;
this._cleared = !1, this._currentlyRunning = !1;
}
clear() {
this._currentlyRunning && (this._cleared = !0), this._queue = [];
}
}
var Vc = a.Y([{ name: "a_pos3d", type: "Int16", components: 3 }]);
class f_ extends a.E {
constructor(l) {
super(), this.sourceCache = l, this._tiles = {}, this._renderableTilesKeys = [], this._sourceTileCache = {}, this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.deltaZoom = 1, l.usedForTerrain = !0, l.tileSize = this.tileSize * 2 ** this.deltaZoom;
}
destruct() {
this.sourceCache.usedForTerrain = !1, this.sourceCache.tileSize = null;
}
update(l, m) {
this.sourceCache.update(l, m), this._renderableTilesKeys = [];
const v = {};
for (const b of l.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: !1, terrain: m }))
v[b.key] = !0, this._renderableTilesKeys.push(b.key), this._tiles[b.key] || (b.posMatrix = new Float64Array(16), a.aP(b.posMatrix, 0, a.X, 0, a.X, 0, 1), this._tiles[b.key] = new t1(b, this.tileSize));
for (const b in this._tiles)
v[b] || delete this._tiles[b];
}
freeRtt(l) {
for (const m in this._tiles) {
const v = this._tiles[m];
(!l || v.tileID.equals(l) || v.tileID.isChildOf(l) || l.isChildOf(v.tileID)) && (v.rtt = []);
}
}
getRenderableTiles() {
return this._renderableTilesKeys.map((l) => this.getTileByID(l));
}
getTileByID(l) {
return this._tiles[l];
}
getTerrainCoords(l) {
const m = {};
for (const v of this._renderableTilesKeys) {
const b = this._tiles[v].tileID;
if (b.canonical.equals(l.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16), a.aP(M.posMatrix, 0, a.X, 0, a.X, 0, 1), m[v] = M;
} else if (b.canonical.isChildOf(l.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const V = b.canonical.z - l.canonical.z, D = b.canonical.x - (b.canonical.x >> V << V), j = b.canonical.y - (b.canonical.y >> V << V), Z = a.X >> V;
a.aP(M.posMatrix, 0, Z, 0, Z, 0, 1), a.J(M.posMatrix, M.posMatrix, [-D * Z, -j * Z, 0]), m[v] = M;
} else if (l.canonical.isChildOf(b.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const V = l.canonical.z - b.canonical.z, D = l.canonical.x - (l.canonical.x >> V << V), j = l.canonical.y - (l.canonical.y >> V << V), Z = a.X >> V;
a.aP(M.posMatrix, 0, a.X, 0, a.X, 0, 1), a.J(M.posMatrix, M.posMatrix, [D * Z, j * Z, 0]), a.K(M.posMatrix, M.posMatrix, [1 / 2 ** V, 1 / 2 ** V, 0]), m[v] = M;
}
}
return m;
}
getSourceTile(l, m) {
const v = this.sourceCache._source;
let b = l.overscaledZ - this.deltaZoom;
if (b > v.maxzoom && (b = v.maxzoom), b < v.minzoom)
return null;
this._sourceTileCache[l.key] || (this._sourceTileCache[l.key] = l.scaledTo(b).key);
let M = this.sourceCache.getTileByID(this._sourceTileCache[l.key]);
if ((!M || !M.dem) && m)
for (; b >= v.minzoom && (!M || !M.dem); )
M = this.sourceCache.getTileByID(l.scaledTo(b--).key);
return M;
}
tilesAfterTime(l = Date.now()) {
return Object.values(this._tiles).filter((m) => m.timeAdded >= l);
}
}
class Rc {
constructor(l, m, v) {
this.painter = l, this.sourceCache = new f_(m), this.options = v, this.exaggeration = typeof v.exaggeration == "number" ? v.exaggeration : 1, this.qualityFactor = 2, this.meshSize = 128, this._demMatrixCache = {}, this.coordsIndex = [], this._coordsTextureSize = 1024;
}
getDEMElevation(l, m, v, b = a.X) {
var M;
if (!(m >= 0 && m < b && v >= 0 && v < b))
return 0;
const V = this.getTerrainData(l), D = (M = V.tile) === null || M === void 0 ? void 0 : M.dem;
if (!D)
return 0;
const j = function(Qt, wt, Mt) {
var Ht = wt[0], Ot = wt[1];
return Qt[0] = Mt[0] * Ht + Mt[4] * Ot + Mt[12], Qt[1] = Mt[1] * Ht + Mt[5] * Ot + Mt[13], Qt;
}([], [m / b * a.X, v / b * a.X], V.u_terrain_matrix), Z = [j[0] * D.dim, j[1] * D.dim], Y = Math.floor(Z[0]), J = Math.floor(Z[1]), lt = Z[0] - Y, ft = Z[1] - J;
return D.get(Y, J) * (1 - lt) * (1 - ft) + D.get(Y + 1, J) * lt * (1 - ft) + D.get(Y, J + 1) * (1 - lt) * ft + D.get(Y + 1, J + 1) * lt * ft;
}
getElevationForLngLatZoom(l, m) {
if (!a.bb(m, l.wrap()))
return 0;
const { tileID: v, mercatorX: b, mercatorY: M } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return this.getElevation(v, b % a.X, M % a.X, a.X);
}
getElevation(l, m, v, b = a.X) {
return this.getDEMElevation(l, m, v, b) * this.exaggeration;
}
getTerrainData(l) {
if (!this._emptyDemTexture) {
const b = this.painter.context, M = new a.R({ width: 1, height: 1 }, new Uint8Array(4));
this._emptyDepthTexture = new rt(b, M, b.gl.RGBA, { premultiply: !1 }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new rt(b, new a.R({ width: 1, height: 1 }), b.gl.RGBA, { premultiply: !1 }), this._emptyDemTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = a.an([]);
}
const m = this.sourceCache.getSourceTile(l, !0);
if (m && m.dem && (!m.demTexture || m.needsTerrainPrepare)) {
const b = this.painter.context;
m.demTexture = this.painter.getTileTexture(m.dem.stride), m.demTexture ? m.demTexture.update(m.dem.getPixels(), { premultiply: !1 }) : m.demTexture = new rt(b, m.dem.getPixels(), b.gl.RGBA, { premultiply: !1 }), m.demTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), m.needsTerrainPrepare = !1;
}
const v = m && m + m.tileID.key + l.key;
if (v && !this._demMatrixCache[v]) {
const b = this.sourceCache.sourceCache._source.maxzoom;
let M = l.canonical.z - m.tileID.canonical.z;
l.overscaledZ > l.canonical.z && (l.canonical.z >= b ? M = l.canonical.z - b : a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));
const V = l.canonical.x - (l.canonical.x >> M << M), D = l.canonical.y - (l.canonical.y >> M << M), j = a.bc(new Float64Array(16), [1 / (a.X << M), 1 / (a.X << M), 0]);
a.J(j, j, [V * a.X, D * a.X, 0]), this._demMatrixCache[l.key] = { matrix: j, coord: l };
}
return { u_depth: 2, u_terrain: 3, u_terrain_dim: m && m.dem && m.dem.dim || 1, u_terrain_matrix: v ? this._demMatrixCache[l.key].matrix : this._emptyDemMatrix, u_terrain_unpack: m && m.dem && m.dem.getUnpackVector() || this._emptyDemUnpack, u_terrain_exaggeration: this.exaggeration, texture: (m && m.demTexture || this._emptyDemTexture).texture, depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture, tile: m };
}
getFramebuffer(l) {
const m = this.painter, v = m.width / devicePixelRatio, b = m.height / devicePixelRatio;
return !this._fbo || this._fbo.width === v && this._fbo.height === b || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new rt(m.context, { width: v, height: b, data: null }, m.context.gl.RGBA, { premultiply: !1 }), this._fboCoordsTexture.bind(m.context.gl.NEAREST, m.context.gl.CLAMP_TO_EDGE)), this._fboDepthTexture || (this._fboDepthTexture = new rt(m.context, { width: v, height: b, data: null }, m.context.gl.RGBA, { premultiply: !1 }), this._fboDepthTexture.bind(m.context.gl.NEAREST, m.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = m.context.createFramebuffer(v, b, !0, !1), this._fbo.depthAttachment.set(m.context.createRenderbuffer(m.context.gl.DEPTH_COMPONENT16, v, b))), this._fbo.colorAttachment.set(l === "coords" ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture), this._fbo;
}
getCoordsTexture() {
const l = this.painter.context;
if (this._coordsTexture)
return this._coordsTexture;
const m = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);
for (let M = 0, V = 0; M < this._coordsTextureSize; M++)
for (let D = 0; D < this._coordsTextureSize; D++, V += 4)
m[V + 0] = 255 & D, m[V + 1] = 255 & M, m[V + 2] = D >> 8 << 4 | M >> 8, m[V + 3] = 0;
const v = new a.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(m.buffer)), b = new rt(l, v, l.gl.RGBA, { premultiply: !1 });
return b.bind(l.gl.NEAREST, l.gl.CLAMP_TO_EDGE), this._coordsTexture = b, b;
}
pointCoordinate(l) {
this.painter.maybeDrawDepthAndCoords(!0);
const m = new Uint8Array(4), v = this.painter.context, b = v.gl, M = Math.round(l.x * this.painter.pixelRatio / devicePixelRatio), V = Math.round(l.y * this.painter.pixelRatio / devicePixelRatio), D = Math.round(this.painter.height / devicePixelRatio);
v.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer), b.readPixels(M, D - V - 1, 1, 1, b.RGBA, b.UNSIGNED_BYTE, m), v.bindFramebuffer.set(null);
const j = m[0] + (m[2] >> 4 << 8), Z = m[1] + ((15 & m[2]) << 8), Y = this.coordsIndex[255 - m[3]], J = Y && this.sourceCache.getTileByID(Y);
if (!J)
return null;
const lt = this._coordsTextureSize, ft = (1 << J.tileID.canonical.z) * lt;
return new a.Z((J.tileID.canonical.x * lt + j) / ft + J.tileID.wrap, (J.tileID.canonical.y * lt + Z) / ft, this.getElevation(J.tileID, j, Z, lt));
}
depthAtPoint(l) {
const m = new Uint8Array(4), v = this.painter.context, b = v.gl;
return v.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer), b.readPixels(l.x, this.painter.height / devicePixelRatio - l.y - 1, 1, 1, b.RGBA, b.UNSIGNED_BYTE, m), v.bindFramebuffer.set(null), (m[0] / 16777216 + m[1] / 65536 + m[2] / 256 + m[3]) / 256;
}
getTerrainMesh() {
if (this._mesh)
return this._mesh;
const l = this.painter.context, m = new a.bd(), v = new a.aY(), b = this.meshSize, M = a.X / b, V = b * b;
for (let J = 0; J <= b; J++)
for (let lt = 0; lt <= b; lt++)
m.emplaceBack(lt * M, J * M, 0);
for (let J = 0; J < V; J += b + 1)
for (let lt = 0; lt < b; lt++)
v.emplaceBack(lt + J, b + lt + J + 1, b + lt + J + 2), v.emplaceBack(lt + J, b + lt + J + 2, lt + J + 1);
const D = m.length, j = D + 2 * (b + 1);
for (const J of [0, 1])
for (let lt = 0; lt <= b; lt++)
for (const ft of [0, 1])
m.emplaceBack(lt * M, J * a.X, ft);
for (let J = 0; J < 2 * b; J += 2)
v.emplaceBack(j + J, j + J + 1, j + J + 3), v.emplaceBack(j + J, j + J + 3, j + J + 2), v.emplaceBack(D + J, D + J + 3, D + J + 1), v.emplaceBack(D + J, D + J + 2, D + J + 3);
const Z = m.length, Y = Z + 2 * (b + 1);
for (const J of [0, 1])
for (let lt = 0; lt <= b; lt++)
for (const ft of [0, 1])
m.emplaceBack(J * a.X, lt * M, ft);
for (let J = 0; J < 2 * b; J += 2)
v.emplaceBack(Z + J, Z + J + 1, Z + J + 3), v.emplaceBack(Z + J, Z + J + 3, Z + J + 2), v.emplaceBack(Y + J, Y + J + 3, Y + J + 1), v.emplaceBack(Y + J, Y + J + 2, Y + J + 3);
return this._mesh = new gi(l.createVertexBuffer(m, Vc.members), l.createIndexBuffer(v), a.a0.simpleSegment(0, 0, m.length, v.length)), this._mesh;
}
getMeshFrameDelta(l) {
return 2 * Math.PI * a.be / Math.pow(2, l) / 5;
}
getMinTileElevationForLngLatZoom(l, m) {
var v;
const { tileID: b } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return (v = this.getMinMaxElevation(b).minElevation) !== null && v !== void 0 ? v : 0;
}
getMinMaxElevation(l) {
const m = this.getTerrainData(l).tile, v = { minElevation: null, maxElevation: null };
return m && m.dem && (v.minElevation = m.dem.min * this.exaggeration, v.maxElevation = m.dem.max * this.exaggeration), v;
}
_getOverscaledTileIDFromLngLatZoom(l, m) {
const v = a.Z.fromLngLat(l.wrap()), b = (1 << m) * a.X, M = v.x * b, V = v.y * b, D = Math.floor(M / a.X), j = Math.floor(V / a.X);
return { tileID: new a.S(m, 0, m, D, j), mercatorX: M, mercatorY: V };
}
}
class Q_ {
constructor(l, m, v) {
this._context = l, this._size = m, this._tileSize = v, this._objects = [], this._recentlyUsed = [], this._stamp = 0;
}
destruct() {
for (const l of this._objects)
l.texture.destroy(), l.fbo.destroy();
}
_createObject(l) {
const m = this._context.createFramebuffer(this._tileSize, this._tileSize, !0, !0), v = new rt(this._context, { width: this._tileSize, height: this._tileSize, data: null }, this._context.gl.RGBA);
return v.bind(this._context.gl.LINEAR, this._context.gl.CLAMP_TO_EDGE), m.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL, this._tileSize, this._tileSize)), m.colorAttachment.set(v.texture), { id: l, fbo: m, texture: v, stamp: -1, inUse: !1 };
}
getObjectForId(l) {
return this._objects[l];
}
useObject(l) {
l.inUse = !0, this._recentlyUsed = this._recentlyUsed.filter((m) => l.id !== m), this._recentlyUsed.push(l.id);
}
stampObject(l) {
l.stamp = ++this._stamp;
}
getOrCreateFreeObject() {
for (const m of this._recentlyUsed)
if (!this._objects[m].inUse)
return this._objects[m];
if (this._objects.length >= this._size)
throw new Error("No free RenderPool available, call freeAllObjects() required!");
const l = this._createObject(this._objects.length);
return this._objects.push(l), l;
}
freeObject(l) {
l.inUse = !1;
}
freeAllObjects() {
for (const l of this._objects)
this.freeObject(l);
}
isFull() {
return !(this._objects.length < this._size) && this._objects.some((l) => !l.inUse) === !1;
}
}
const n6 = { background: !0, fill: !0, line: !0, raster: !0, hillshade: !0 };
class gp {
constructor(l, m) {
this.painter = l, this.terrain = m, this.pool = new Q_(l.context, 30, m.sourceCache.tileSize * m.qualityFactor);
}
destruct() {
this.pool.destruct();
}
getTexture(l) {
return this.pool.getObjectForId(l.rtt[this._stacks.length - 1].id).texture;
}
prepareForRender(l, m) {
this._stacks = [], this._prevType = null, this._rttTiles = [], this._renderableTiles = this.terrain.sourceCache.getRenderableTiles(), this._renderableLayerIds = l._order.filter((v) => !l._layers[v].isHidden(m)), this._coordsDescendingInv = {};
for (const v in l.sourceCaches) {
this._coordsDescendingInv[v] = {};
const b = l.sourceCaches[v].getVisibleCoordinates();
for (const M of b) {
const V = this.terrain.sourceCache.getTerrainCoords(M);
for (const D in V)
this._coordsDescendingInv[v][D] || (this._coordsDescendingInv[v][D] = []), this._coordsDescendingInv[v][D].push(V[D]);
}
}
this._coordsDescendingInvStr = {};
for (const v of l._order) {
const b = l._layers[v], M = b.source;
if (n6[b.type] && !this._coordsDescendingInvStr[M]) {
this._coordsDescendingInvStr[M] = {};
for (const V in this._coordsDescendingInv[M])
this._coordsDescendingInvStr[M][V] = this._coordsDescendingInv[M][V].map((D) => D.key).sort().join();
}
}
for (const v of this._renderableTiles)
for (const b in this._coordsDescendingInvStr) {
const M = this._coordsDescendingInvStr[b][v.tileID.key];
M && M !== v.rttCoords[b] && (v.rtt = []);
}
}
renderLayer(l) {
if (l.isHidden(this.painter.transform.zoom))
return !1;
const m = l.type, v = this.painter, b = this._renderableLayerIds[this._renderableLayerIds.length - 1] === l.id;
if (n6[m] && (this._prevType && n6[this._prevType] || this._stacks.push([]), this._prevType = m, this._stacks[this._stacks.length - 1].push(l.id), !b))
return !0;
if (n6[this._prevType] || n6[m] && b) {
this._prevType = m;
const M = this._stacks.length - 1, V = this._stacks[M] || [];
for (const D of this._renderableTiles) {
if (this.pool.isFull() && (To(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects()), this._rttTiles.push(D), D.rtt[M]) {
const Z = this.pool.getObjectForId(D.rtt[M].id);
if (Z.stamp === D.rtt[M].stamp) {
this.pool.useObject(Z);
continue;
}
}
const j = this.pool.getOrCreateFreeObject();
this.pool.useObject(j), this.pool.stampObject(j), D.rtt[M] = { id: j.id, stamp: j.stamp }, v.context.bindFramebuffer.set(j.fbo.framebuffer), v.context.clear({ color: a.aM.transparent, stencil: 0 }), v.currentStencilSource = void 0;
for (let Z = 0; Z < V.length; Z++) {
const Y = v.style._layers[V[Z]], J = Y.source ? this._coordsDescendingInv[Y.source][D.tileID.key] : [D.tileID];
v.context.viewport.set([0, 0, j.fbo.width, j.fbo.height]), v._renderTileClippingMasks(Y, J), v.renderLayer(v, v.style.sourceCaches[Y.source], Y, J), Y.source && (D.rttCoords[Y.source] = this._coordsDescendingInvStr[Y.source][D.tileID.key]);
}
}
return To(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects(), n6[m];
}
return !1;
}
}
const Nc = { "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": "MapLibre logo", "Map.Title": "Map", "Marker.Title": "Map marker", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "Popup.Close": "Close popup", "ScaleControl.Feet": "ft", "ScaleControl.Meters": "m", "ScaleControl.Kilometers": "km", "ScaleControl.Miles": "mi", "ScaleControl.NauticalMiles": "nm", "TerrainControl.Enable": "Enable terrain", "TerrainControl.Disable": "Disable terrain", "CooperativeGesturesHandler.WindowsHelpText": "Use Ctrl + scroll to zoom the map", "CooperativeGesturesHandler.MacHelpText": "Use ⌘ + scroll to zoom the map", "CooperativeGesturesHandler.MobileHelpText": "Use two fingers to move the map" }, yp = u, m_ = { hash: !1, interactive: !0, bearingSnap: 7, attributionControl: e6, maplibreLogo: !1, failIfMajorPerformanceCaveat: !1, preserveDrawingBuffer: !1, refreshExpiredTiles: !0, scrollZoom: !0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, boxZoom: !0, dragRotate: !0, dragPan: !0, keyboard: !0, doubleClickZoom: !0, touchZoomRotate: !0, touchPitch: !0, cooperativeGestures: !1, trackResize: !0, center: [0, 0], zoom: 0, bearing: 0, pitch: 0, renderWorldCopies: !0, maxTileCacheSize: null, maxTileCacheZoomLevels: a.a.MAX_TILE_CACHE_ZOOM_LEVELS, transformRequest: null, transformCameraUpdate: null, fadeDuration: 300, crossSourceCollisions: !0, clickTolerance: 3, localIdeographFontFamily: "sans-serif", pitchWithRotate: !0, validateStyle: !0, maxCanvasSize: [4096, 4096], cancelPendingTileRequestsWhileZooming: !0 }, Dc = (S) => {
S.touchstart = S.dragStart, S.touchmoveWindow = S.dragMove, S.touchend = S.dragEnd;
}, g_ = { showCompass: !0, showZoom: !0, visualizePitch: !1 };
class y_ {
constructor(l, m, v = !1) {
this.mousedown = (V) => {
this.startMouse(a.e({}, V, { ctrlKey: !0, preventDefault: () => V.preventDefault() }), Q.mousePos(this.element, V)), Q.addEventListener(window, "mousemove", this.mousemove), Q.addEventListener(window, "mouseup", this.mouseup);
}, this.mousemove = (V) => {
this.moveMouse(V, Q.mousePos(this.element, V));
}, this.mouseup = (V) => {
this.mouseRotate.dragEnd(V), this.mousePitch && this.mousePitch.dragEnd(V), this.offTemp();
}, this.touchstart = (V) => {
V.targetTouches.length !== 1 ? this.reset() : (this._startPos = this._lastPos = Q.touchPos(this.element, V.targetTouches)[0], this.startTouch(V, this._startPos), Q.addEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.addEventListener(window, "touchend", this.touchend));
}, this.touchmove = (V) => {
V.targetTouches.length !== 1 ? this.reset() : (this._lastPos = Q.touchPos(this.element, V.targetTouches)[0], this.moveTouch(V, this._lastPos));
}, this.touchend = (V) => {
V.targetTouches.length === 0 && 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 b = l.dragRotate._mouseRotate.getClickTolerance(), M = l.dragRotate._mousePitch.getClickTolerance();
this.element = m, this.mouseRotate = Ec({ clickTolerance: b, enable: !0 }), this.touchRotate = (({ enable: V, clickTolerance: D, bearingDegreesPerPixelMoved: j = 0.8 }) => {
const Z = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ bearingDelta: (J.x - Y.x) * j }), moveStateManager: Z, enable: V, assignEvents: Dc });
})({ clickTolerance: b, enable: !0 }), this.map = l, v && (this.mousePitch = Mc({ clickTolerance: M, enable: !0 }), this.touchPitch = (({ enable: V, clickTolerance: D, pitchDegreesPerPixelMoved: j = -0.5 }) => {
const Z = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ pitchDelta: (J.y - Y.y) * j }), moveStateManager: Z, enable: V, assignEvents: Dc });
})({ clickTolerance: M, enable: !0 })), Q.addEventListener(m, "mousedown", this.mousedown), Q.addEventListener(m, "touchstart", this.touchstart, { passive: !1 }), Q.addEventListener(m, "touchcancel", this.reset);
}
startMouse(l, m) {
this.mouseRotate.dragStart(l, m), this.mousePitch && this.mousePitch.dragStart(l, m), Q.disableDrag();
}
startTouch(l, m) {
this.touchRotate.dragStart(l, m), this.touchPitch && this.touchPitch.dragStart(l, m), Q.disableDrag();
}
moveMouse(l, m) {
const v = this.map, { bearingDelta: b } = this.mouseRotate.dragMove(l, m) || {};
if (b && v.setBearing(v.getBearing() + b), this.mousePitch) {
const { pitchDelta: M } = this.mousePitch.dragMove(l, m) || {};
M && v.setPitch(v.getPitch() + M);
}
}
moveTouch(l, m) {
const v = this.map, { bearingDelta: b } = this.touchRotate.dragMove(l, m) || {};
if (b && v.setBearing(v.getBearing() + b), this.touchPitch) {
const { pitchDelta: M } = this.touchPitch.dragMove(l, m) || {};
M && v.setPitch(v.getPitch() + M);
}
}
off() {
const l = this.element;
Q.removeEventListener(l, "mousedown", this.mousedown), Q.removeEventListener(l, "touchstart", this.touchstart, { passive: !1 }), Q.removeEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.removeEventListener(window, "touchend", this.touchend), Q.removeEventListener(l, "touchcancel", this.reset), this.offTemp();
}
offTemp() {
Q.enableDrag(), Q.removeEventListener(window, "mousemove", this.mousemove), Q.removeEventListener(window, "mouseup", this.mouseup), Q.removeEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.removeEventListener(window, "touchend", this.touchend);
}
}
let Vo;
function ti(S, l, m) {
const v = new a.N(S.lng, S.lat);
if (S = new a.N(S.lng, S.lat), l) {
const b = new a.N(S.lng - 360, S.lat), M = new a.N(S.lng + 360, S.lat), V = m.locationPoint(S).distSqr(l);
m.locationPoint(b).distSqr(l) < V ? S = b : m.locationPoint(M).distSqr(l) < V && (S = M);
}
for (; Math.abs(S.lng - m.center.lng) > 180; ) {
const b = m.locationPoint(S);
if (b.x >= 0 && b.y >= 0 && b.x <= m.width && b.y <= m.height)
break;
S.lng > m.center.lng ? S.lng -= 360 : S.lng += 360;
}
return S.lng !== v.lng && m.locationPoint(S).y > m.height / 2 - m.getHorizon() ? S : v;
}
const i6 = { 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 Hl(S, l, m) {
const v = S.classList;
for (const b in i6)
v.remove(`maplibregl-${m}-anchor-${b}`);
v.add(`maplibregl-${m}-anchor-${l}`);
}
class Al extends a.E {
constructor(l) {
if (super(), this._onKeyPress = (m) => {
const v = m.code, b = m.charCode || m.keyCode;
v !== "Space" && v !== "Enter" && b !== 32 && b !== 13 || this.togglePopup();
}, this._onMapClick = (m) => {
const v = m.originalEvent.target, b = this._element;
this._popup && (v === b || b.contains(v)) && this.togglePopup();
}, this._update = (m) => {
var v;
if (!this._map)
return;
const b = this._map.loaded() && !this._map.isMoving();
((m == null ? void 0 : m.type) === "terrain" || (m == null ? void 0 : m.type) === "render" && !b) && this._map.once("render", this._update), this._lngLat = this._map.transform.renderWorldCopies ? ti(this._lngLat, this._flatPos, this._map.transform) : (v = this._lngLat) === null || v === void 0 ? void 0 : v.wrap(), this._flatPos = this._pos = this._map.project(this._lngLat)._add(this._offset), this._map.terrain && (this._flatPos = this._map.transform.locationPoint(this._lngLat)._add(this._offset));
let M = "";
this._rotationAlignment === "viewport" || this._rotationAlignment === "auto" ? M = `rotateZ(${this._rotation}deg)` : this._rotationAlignment === "map" && (M = `rotateZ(${this._rotation - this._map.getBearing()}deg)`);
let V = "";
this._pitchAlignment === "viewport" || this._pitchAlignment === "auto" ? V = "rotateX(0deg)" : this._pitchAlignment === "map" && (V = `rotateX(${this._map.getPitch()}deg)`), this._subpixelPositioning || m && m.type !== "moveend" || (this._pos = this._pos.round()), Q.setTransform(this._element, `${i6[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${V} ${M}`), f.frameAsync(new AbortController()).then(() => {
this._updateOpacity(m && m.type === "moveend");
}).catch(() => {
});
}, this._onMove = (m) => {
if (!this._isDragging) {
const v = this._clickTolerance || this._map._clickTolerance;
this._isDragging = m.point.dist(this._pointerdownPos) >= v;
}
this._isDragging && (this._pos = m.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", this._state === "pending" && (this._state = "active", this.fire(new a.k("dragstart"))), this.fire(new a.k("drag")));
}, this._onUp = () => {
this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = !1, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), this._state === "active" && this.fire(new a.k("dragend")), this._state = "inactive";
}, this._addDragHandler = (m) => {
this._element.contains(m.originalEvent.target) && (m.preventDefault(), this._positionDelta = m.point.sub(this._pos).add(this._offset), this._pointerdownPos = m.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 = l && l.anchor || "center", this._color = l && l.color || "#3FB1CE", this._scale = l && l.scale || 1, this._draggable = l && l.draggable || !1, this._clickTolerance = l && l.clickTolerance || 0, this._subpixelPositioning = l && l.subpixelPositioning || !1, this._isDragging = !1, this._state = "inactive", this._rotation = l && l.rotation || 0, this._rotationAlignment = l && l.rotationAlignment || "auto", this._pitchAlignment = l && l.pitchAlignment && l.pitchAlignment !== "auto" ? l.pitchAlignment : this._rotationAlignment, this.setOpacity(), this.setOpacity(l == null ? void 0 : l.opacity, l == null ? void 0 : l.opacityWhenCovered), l && l.element)
this._element = l.element, this._offset = a.P.convert(l && l.offset || [0, 0]);
else {
this._defaultMarker = !0, this._element = Q.create("div");
const m = Q.createNS("http://www.w3.org/2000/svg", "svg"), v = 41, b = 27;
m.setAttributeNS(null, "display", "block"), m.setAttributeNS(null, "height", `${v}px`), m.setAttributeNS(null, "width", `${b}px`), m.setAttributeNS(null, "viewBox", `0 0 ${b} ${v}`);
const M = Q.createNS("http://www.w3.org/2000/svg", "g");
M.setAttributeNS(null, "stroke", "none"), M.setAttributeNS(null, "stroke-width", "1"), M.setAttributeNS(null, "fill", "none"), M.setAttributeNS(null, "fill-rule", "evenodd");
const V = Q.createNS("http://www.w3.org/2000/svg", "g");
V.setAttributeNS(null, "fill-rule", "nonzero");
const D = Q.createNS("http://www.w3.org/2000/svg", "g");
D.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), D.setAttributeNS(null, "fill", "#000000");
const j = [{ 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 Ht of j) {
const Ot = Q.createNS("http://www.w3.org/2000/svg", "ellipse");
Ot.setAttributeNS(null, "opacity", "0.04"), Ot.setAttributeNS(null, "cx", "10.5"), Ot.setAttributeNS(null, "cy", "5.80029008"), Ot.setAttributeNS(null, "rx", Ht.rx), Ot.setAttributeNS(null, "ry", Ht.ry), D.appendChild(Ot);
}
const Z = Q.createNS("http://www.w3.org/2000/svg", "g");
Z.setAttributeNS(null, "fill", this._color);
const Y = Q.createNS("http://www.w3.org/2000/svg", "path");
Y.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"), Z.appendChild(Y);
const J = Q.createNS("http://www.w3.org/2000/svg", "g");
J.setAttributeNS(null, "opacity", "0.25"), J.setAttributeNS(null, "fill", "#000000");
const lt = Q.createNS("http://www.w3.org/2000/svg", "path");
lt.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"), J.appendChild(lt);
const ft = Q.createNS("http://www.w3.org/2000/svg", "g");
ft.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), ft.setAttributeNS(null, "fill", "#FFFFFF");
const Qt = Q.createNS("http://www.w3.org/2000/svg", "g");
Qt.setAttributeNS(null, "transform", "translate(8.0, 8.0)");
const wt = Q.createNS("http://www.w3.org/2000/svg", "circle");
wt.setAttributeNS(null, "fill", "#000000"), wt.setAttributeNS(null, "opacity", "0.25"), wt.setAttributeNS(null, "cx", "5.5"), wt.setAttributeNS(null, "cy", "5.5"), wt.setAttributeNS(null, "r", "5.4999962");
const Mt = Q.createNS("http://www.w3.org/2000/svg", "circle");
Mt.setAttributeNS(null, "fill", "#FFFFFF"), Mt.setAttributeNS(null, "cx", "5.5"), Mt.setAttributeNS(null, "cy", "5.5"), Mt.setAttributeNS(null, "r", "5.4999962"), Qt.appendChild(wt), Qt.appendChild(Mt), V.appendChild(D), V.appendChild(Z), V.appendChild(J), V.appendChild(ft), V.appendChild(Qt), m.appendChild(V), m.setAttributeNS(null, "height", v * this._scale + "px"), m.setAttributeNS(null, "width", b * this._scale + "px"), this._element.appendChild(m), this._offset = a.P.convert(l && l.offset || [0, -14]);
}
if (this._element.classList.add("maplibregl-marker"), this._element.addEventListener("dragstart", (m) => {
m.preventDefault();
}), this._element.addEventListener("mousedown", (m) => {
m.preventDefault();
}), Hl(this._element, this._anchor, "marker"), l && l.className)
for (const m of l.className.split(" "))
this._element.classList.add(m);
this._popup = null;
}
addTo(l) {
return this.remove(), this._map = l, this._element.setAttribute("aria-label", l._getUIString("Marker.Title")), l.getCanvasContainer().appendChild(this._element), l.on("move", this._update), l.on("moveend", this._update), l.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("terrain", 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), Q.remove(this._element), this._popup && this._popup.remove(), this;
}
getLngLat() {
return this._lngLat;
}
setLngLat(l) {
return this._lngLat = a.N.convert(l), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;
}
getElement() {
return this._element;
}
setPopup(l) {
if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), l) {
if (!("offset" in l.options)) {
const m = Math.abs(13.5) / Math.SQRT2;
l.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -38.1], "bottom-left": [m, -1 * (38.1 - 13.5 + m)], "bottom-right": [-m, -1 * (38.1 - 13.5 + m)], left: [13.5, -1 * (38.1 - 13.5)], right: [-13.5, -1 * (38.1 - 13.5)] } : this._offset;
}
this._popup = l, this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress);
}
return this;
}
setSubpixelPositioning(l) {
return this._subpixelPositioning = l, this;
}
getPopup() {
return this._popup;
}
togglePopup() {
const l = this._popup;
return this._element.style.opacity === this._opacityWhenCovered ? this : l ? (l.isOpen() ? l.remove() : (l.setLngLat(this._lngLat), l.addTo(this._map)), this) : this;
}
_updateOpacity(l = !1) {
var m, v;
if (!(!((m = this._map) === null || m === void 0) && m.terrain))
return void (this._element.style.opacity !== this._opacity && (this._element.style.opacity = this._opacity));
if (l)
this._opacityTimeout = null;
else {
if (this._opacityTimeout)
return;
this._opacityTimeout = setTimeout(() => {
this._opacityTimeout = null;
}, 100);
}
const b = this._map, M = b.terrain.depthAtPoint(this._pos), V = b.terrain.getElevationForLngLatZoom(this._lngLat, b.transform.tileZoom);
if (b.transform.lngLatToCameraDepth(this._lngLat, V) - M < 6e-3)
return void (this._element.style.opacity = this._opacity);
const D = -this._offset.y / b.transform._pixelPerMeter, j = Math.sin(b.getPitch() * Math.PI / 180) * D, Z = b.terrain.depthAtPoint(new a.P(this._pos.x, this._pos.y - this._offset.y)), Y = b.transform.lngLatToCameraDepth(this._lngLat, V + j) - Z > 6e-3;
!((v = this._popup) === null || v === void 0) && v.isOpen() && Y && this._popup.remove(), this._element.style.opacity = Y ? this._opacityWhenCovered : this._opacity;
}
getOffset() {
return this._offset;
}
setOffset(l) {
return this._offset = a.P.convert(l), this._update(), this;
}
addClassName(l) {
this._element.classList.add(l);
}
removeClassName(l) {
this._element.classList.remove(l);
}
toggleClassName(l) {
return this._element.classList.toggle(l);
}
setDraggable(l) {
return this._draggable = !!l, this._map && (l ? (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(l) {
return this._rotation = l || 0, this._update(), this;
}
getRotation() {
return this._rotation;
}
setRotationAlignment(l) {
return this._rotationAlignment = l || "auto", this._update(), this;
}
getRotationAlignment() {
return this._rotationAlignment;
}
setPitchAlignment(l) {
return this._pitchAlignment = l && l !== "auto" ? l : this._rotationAlignment, this._update(), this;
}
getPitchAlignment() {
return this._pitchAlignment;
}
setOpacity(l, m) {
return l === void 0 && m === void 0 && (this._opacity = "1", this._opacityWhenCovered = "0.2"), l !== void 0 && (this._opacity = l), m !== void 0 && (this._opacityWhenCovered = m), this._map && this._updateOpacity(!0), this;
}
}
const vp = { positionOptions: { enableHighAccuracy: !1, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: !1, showAccuracyCircle: !0, showUserLocation: !0 };
let k0 = 0, I0 = !1;
const fs = { maxWidth: 100, unit: "metric" };
function P0(S, l, m) {
const v = m && m.maxWidth || 100, b = S._container.clientHeight / 2, M = S.unproject([0, b]), V = S.unproject([v, b]), D = M.distanceTo(V);
if (m && m.unit === "imperial") {
const j = 3.2808 * D;
j > 5280 ? cr(l, v, j / 5280, S._getUIString("ScaleControl.Miles")) : cr(l, v, j, S._getUIString("ScaleControl.Feet"));
} else
m && m.unit === "nautical" ? cr(l, v, D / 1852, S._getUIString("ScaleControl.NauticalMiles")) : D >= 1e3 ? cr(l, v, D / 1e3, S._getUIString("ScaleControl.Kilometers")) : cr(l, v, D, S._getUIString("ScaleControl.Meters"));
}
function cr(S, l, m, v) {
const b = function(M) {
const V = Math.pow(10, `${Math.floor(M)}`.length - 1);
let D = M / V;
return D = D >= 10 ? 10 : D >= 5 ? 5 : D >= 3 ? 3 : D >= 2 ? 2 : D >= 1 ? 1 : function(j) {
const Z = Math.pow(10, Math.ceil(-Math.log(j) / Math.LN10));
return Math.round(j * Z) / Z;
}(D), V * D;
}(m);
S.style.width = l * (b / m) + "px", S.innerHTML = `${b} ${v}`;
}
const Mr = { closeButton: !0, closeOnClick: !0, focusAfterOpen: !0, className: "", maxWidth: "240px", subpixelPositioning: !1 }, Ol = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
function Cl(S) {
if (S) {
if (typeof S == "number") {
const l = Math.round(Math.abs(S) / Math.SQRT2);
return { center: new a.P(0, 0), top: new a.P(0, S), "top-left": new a.P(l, l), "top-right": new a.P(-l, l), bottom: new a.P(0, -S), "bottom-left": new a.P(l, -l), "bottom-right": new a.P(-l, -l), left: new a.P(S, 0), right: new a.P(-S, 0) };
}
if (S instanceof a.P || Array.isArray(S)) {
const l = a.P.convert(S);
return { center: l, top: l, "top-left": l, "top-right": l, bottom: l, "bottom-left": l, "bottom-right": l, left: l, right: l };
}
return { center: a.P.convert(S.center || [0, 0]), top: a.P.convert(S.top || [0, 0]), "top-left": a.P.convert(S["top-left"] || [0, 0]), "top-right": a.P.convert(S["top-right"] || [0, 0]), bottom: a.P.convert(S.bottom || [0, 0]), "bottom-left": a.P.convert(S["bottom-left"] || [0, 0]), "bottom-right": a.P.convert(S["bottom-right"] || [0, 0]), left: a.P.convert(S.left || [0, 0]), right: a.P.convert(S.right || [0, 0]) };
}
return Cl(new a.P(0, 0));
}
const Fc = u;
s.AJAXError = a.bh, s.Evented = a.E, s.LngLat = a.N, s.MercatorCoordinate = a.Z, s.Point = a.P, s.addProtocol = a.bi, s.config = a.a, s.removeProtocol = a.bj, s.AttributionControl = r6, s.BoxZoomHandler = Wi, s.CanvasSource = _i, s.CooperativeGesturesHandler = t6, s.DoubleClickZoomHandler = F3, s.DragPanHandler = fp, s.DragRotateHandler = Qp, s.EdgeInsets = Ai, s.FullscreenControl = class extends a.E {
constructor(S = {}) {
super(), this._onFullscreenChange = () => {
var l;
let m = window.document.fullscreenElement || window.document.mozFullScreenElement || window.document.webkitFullscreenElement || window.document.msFullscreenElement;
for (; !((l = m == null ? void 0 : m.shadowRoot) === null || l === void 0) && l.fullscreenElement; )
m = m.shadowRoot.fullscreenElement;
m === this._container !== this._fullscreen && this._handleFullscreenChange();
}, this._onClickFullscreen = () => {
this._isFullscreen() ? this._exitFullscreen() : this._requestFullscreen();
}, this._fullscreen = !1, S && S.container && (S.container instanceof HTMLElement ? this._container = S.container : a.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(S) {
return this._map = S, this._container || (this._container = this._map.getContainer()), this._controlContainer = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), this._controlContainer;
}
onRemove() {
Q.remove(this._controlContainer), this._map = null, window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);
}
_setupUI() {
const S = this._fullscreenButton = Q.create("button", "maplibregl-ctrl-fullscreen", this._controlContainer);
Q.create("span", "maplibregl-ctrl-icon", S).setAttribute("aria-hidden", "true"), S.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);
}
_updateTitle() {
const S = this._getTitle();
this._fullscreenButton.setAttribute("aria-label", S), this._fullscreenButton.title = S;
}
_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 a.k("fullscreenstart")), this._prevCooperativeGesturesEnabled = this._map.cooperativeGestures.isEnabled(), this._map.cooperativeGestures.disable()) : (this.fire(new a.k("fullscreenend")), this._prevCooperativeGesturesEnabled && this._map.cooperativeGestures.enable());
}
_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();
}
}, s.GeoJSONSource = dn, s.GeolocateControl = class extends a.E {
constructor(S) {
super(), this._onSuccess = (l) => {
if (this._map) {
if (this._isOutOfMapMaxBounds(l))
return this._setErrorState(), this.fire(new a.k("outofmaxbounds", l)), this._updateMarker(), void this._finish();
if (this.options.trackUserLocation)
switch (this._lastKnownPosition = l, 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 && this._watchState !== "OFF" && this._updateMarker(l), this.options.trackUserLocation && this._watchState !== "ACTIVE_LOCK" || this._updateCamera(l), this.options.showUserLocation && this._dotElement.classList.remove("maplibregl-user-location-dot-stale"), this.fire(new a.k("geolocate", l)), this._finish();
}
}, this._updateCamera = (l) => {
const m = new a.N(l.coords.longitude, l.coords.latitude), v = l.coords.accuracy, b = this._map.getBearing(), M = a.e({ bearing: b }, this.options.fitBoundsOptions), V = Ct.fromLngLat(m, v);
this._map.fitBounds(V, M, { geolocateSource: !0 });
}, this._updateMarker = (l) => {
if (l) {
const m = new a.N(l.coords.longitude, l.coords.latitude);
this._accuracyCircleMarker.setLngLat(m).addTo(this._map), this._userLocationDotMarker.setLngLat(m).addTo(this._map), this._accuracy = l.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 = (l) => {
if (this._map) {
if (this.options.trackUserLocation)
if (l.code === 1) {
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 = !0;
const m = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m), this._geolocationWatchID !== void 0 && this._clearWatch();
} else {
if (l.code === 3 && I0)
return;
this._setErrorState();
}
this._watchState !== "OFF" && this.options.showUserLocation && this._dotElement.classList.add("maplibregl-user-location-dot-stale"), this.fire(new a.k("error", l)), this._finish();
}
}, this._finish = () => {
this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;
}, this._setupUI = () => {
this._map && (this._container.addEventListener("contextmenu", (l) => l.preventDefault()), this._geolocateButton = Q.create("button", "maplibregl-ctrl-geolocate", this._container), Q.create("span", "maplibregl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", this._geolocateButton.disabled = !0);
}, this._finishSetupUI = (l) => {
if (this._map) {
if (l === !1) {
a.w("Geolocation support is not available so the GeolocateControl will be disabled.");
const m = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.disabled = !0, this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m);
} else {
const m = this._map._getUIString("GeolocateControl.FindMyLocation");
this._geolocateButton.disabled = !1, this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m);
}
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = Q.create("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new Al({ element: this._dotElement }), this._circleElement = Q.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Al({ element: this._circleElement, pitchAlignment: "map" }), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("zoom", this._onZoom)), this._geolocateButton.addEventListener("click", () => this.trigger()), this._setup = !0, this.options.trackUserLocation && this._map.on("movestart", (m) => {
m.geolocateSource || this._watchState !== "ACTIVE_LOCK" || m.originalEvent && m.originalEvent.type === "resize" || (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this.fire(new a.k("trackuserlocationend")), this.fire(new a.k("userlocationlostfocus")));
});
}
}, this.options = a.e({}, vp, S);
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), function() {
return a._(this, arguments, void 0, function* (l = !1) {
if (Vo !== void 0 && !l)
return Vo;
if (window.navigator.permissions === void 0)
return Vo = !!window.navigator.geolocation, Vo;
try {
Vo = (yield window.navigator.permissions.query({ name: "geolocation" })).state !== "denied";
} catch {
Vo = !!window.navigator.geolocation;
}
return Vo;
});
}().then((l) => this._finishSetupUI(l)), this._container;
}
onRemove() {
this._geolocationWatchID !== void 0 && (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(), Q.remove(this._container), this._map.off("zoom", this._onZoom), this._map = void 0, k0 = 0, I0 = !1;
}
_isOutOfMapMaxBounds(S) {
const l = this._map.getMaxBounds(), m = S.coords;
return l && (m.longitude < l.getWest() || m.longitude > l.getEast() || m.latitude < l.getSouth() || m.latitude > l.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 S = this._map.getBounds(), l = S.getSouthEast(), m = S.getNorthEast(), v = l.distanceTo(m), b = Math.ceil(this._accuracy / (v / this._map._container.clientHeight) * 2);
this._circleElement.style.width = `${b}px`, this._circleElement.style.height = `${b}px`;
}
trigger() {
if (!this._setup)
return a.w("Geolocate control triggered before added to a map"), !1;
if (this.options.trackUserLocation) {
switch (this._watchState) {
case "OFF":
this._watchState = "WAITING_ACTIVE", this.fire(new a.k("trackuserlocationstart"));
break;
case "WAITING_ACTIVE":
case "ACTIVE_LOCK":
case "ACTIVE_ERROR":
case "BACKGROUND_ERROR":
k0--, I0 = !1, 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 a.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 a.k("trackuserlocationstart")), this.fire(new a.k("userlocationfocus"));
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 (this._watchState === "OFF" && this._geolocationWatchID !== void 0)
this._clearWatch();
else if (this._geolocationWatchID === void 0) {
let S;
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), k0++, k0 > 1 ? (S = { maximumAge: 6e5, timeout: 0 }, I0 = !0) : (S = this.options.positionOptions, I0 = !1), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, S);
}
} else
window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
return !0;
}
_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);
}
}, s.Hash = S2, s.ImageSource = Ji, s.KeyboardHandler = r2, s.LngLatBounds = Ct, s.LogoControl = Pc, s.Map = class extends mp {
constructor(S) {
a.bf.mark(a.bg.create);
const l = Object.assign(Object.assign({}, m_), S);
if (l.minZoom != null && l.maxZoom != null && l.minZoom > l.maxZoom)
throw new Error("maxZoom must be greater than or equal to minZoom");
if (l.minPitch != null && l.maxPitch != null && l.minPitch > l.maxPitch)
throw new Error("maxPitch must be greater than or equal to minPitch");
if (l.minPitch != null && l.minPitch < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (l.maxPitch != null && l.maxPitch > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (super(new Io(l.minZoom, l.maxZoom, l.minPitch, l.maxPitch, l.renderWorldCopies), { bearingSnap: l.bearingSnap }), this._idleTriggered = !1, this._crossFadingFactor = 1, this._renderTaskQueue = new sn(), this._controls = [], this._mapId = a.a4(), this._contextLost = (m) => {
m.preventDefault(), this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this.fire(new a.k("webglcontextlost", { originalEvent: m }));
}, this._contextRestored = (m) => {
this._setupPainter(), this.resize(), this._update(), this.fire(new a.k("webglcontextrestored", { originalEvent: m }));
}, this._onMapScroll = (m) => {
if (m.target === this._container)
return this._container.scrollTop = 0, this._container.scrollLeft = 0, !1;
}, this._onWindowOnline = () => {
this._update();
}, this._interactive = l.interactive, this._maxTileCacheSize = l.maxTileCacheSize, this._maxTileCacheZoomLevels = l.maxTileCacheZoomLevels, this._failIfMajorPerformanceCaveat = l.failIfMajorPerformanceCaveat === !0, this._preserveDrawingBuffer = l.preserveDrawingBuffer === !0, this._antialias = l.antialias === !0, this._trackResize = l.trackResize === !0, this._bearingSnap = l.bearingSnap, this._refreshExpiredTiles = l.refreshExpiredTiles === !0, this._fadeDuration = l.fadeDuration, this._crossSourceCollisions = l.crossSourceCollisions === !0, this._collectResourceTiming = l.collectResourceTiming === !0, this._locale = Object.assign(Object.assign({}, Nc), l.locale), this._clickTolerance = l.clickTolerance, this._overridePixelRatio = l.pixelRatio, this._maxCanvasSize = l.maxCanvasSize, this.transformCameraUpdate = l.transformCameraUpdate, this.cancelPendingTileRequestsWhileZooming = l.cancelPendingTileRequestsWhileZooming === !0, this._imageQueueHandle = k.addThrottleControl(() => this.isMoving()), this._requestManager = new R(l.transformRequest), typeof l.container == "string") {
if (this._container = document.getElementById(l.container), !this._container)
throw new Error(`Container '${l.container}' not found.`);
} else {
if (!(l.container instanceof HTMLElement))
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
this._container = l.container;
}
if (l.maxBounds && this.setMaxBounds(l.maxBounds), this._setupContainer(), this._setupPainter(), this.on("move", () => this._update(!1)).on("moveend", () => this._update(!1)).on("zoom", () => this._update(!0)).on("terrain", () => {
this.painter.terrainFacilitator.dirty = !0, this._update(!0);
}).once("idle", () => {
this._idleTriggered = !0;
}), typeof window < "u") {
addEventListener("online", this._onWindowOnline, !1);
let m = !1;
const v = us((b) => {
this._trackResize && !this._removed && (this.resize(b), this.redraw());
}, 50);
this._resizeObserver = new ResizeObserver((b) => {
m ? v(b) : m = !0;
}), this._resizeObserver.observe(this._container);
}
this.handlers = new Ic(this, l), this._hash = l.hash && new S2(typeof l.hash == "string" && l.hash || void 0).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: l.center, zoom: l.zoom, bearing: l.bearing, pitch: l.pitch }), l.bounds && (this.resize(), this.fitBounds(l.bounds, a.e({}, l.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = l.localIdeographFontFamily, this._validateStyle = l.validateStyle, l.style && this.setStyle(l.style, { localIdeographFontFamily: l.localIdeographFontFamily }), l.attributionControl && this.addControl(new r6(typeof l.attributionControl == "boolean" ? void 0 : l.attributionControl)), l.maplibreLogo && this.addControl(new Pc(), l.logoPosition), this.on("style.load", () => {
this.transform.unmodified && this.jumpTo(this.style.stylesheet);
}), this.on("data", (m) => {
this._update(m.dataType === "style"), this.fire(new a.k(`${m.dataType}data`, m));
}), this.on("dataloading", (m) => {
this.fire(new a.k(`${m.dataType}dataloading`, m));
}), this.on("dataabort", (m) => {
this.fire(new a.k("sourcedataabort", m));
});
}
_getMapId() {
return this._mapId;
}
addControl(S, l) {
if (l === void 0 && (l = S.getDefaultPosition ? S.getDefaultPosition() : "top-right"), !S || !S.onAdd)
return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
const m = S.onAdd(this);
this._controls.push(S);
const v = this._controlPositions[l];
return l.indexOf("bottom") !== -1 ? v.insertBefore(m, v.firstChild) : v.appendChild(m), this;
}
removeControl(S) {
if (!S || !S.onRemove)
return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
const l = this._controls.indexOf(S);
return l > -1 && this._controls.splice(l, 1), S.onRemove(this), this;
}
hasControl(S) {
return this._controls.indexOf(S) > -1;
}
calculateCameraOptionsFromTo(S, l, m, v) {
return v == null && this.terrain && (v = this.terrain.getElevationForLngLatZoom(m, this.transform.tileZoom)), super.calculateCameraOptionsFromTo(S, l, m, v);
}
resize(S) {
var l;
const m = this._containerDimensions(), v = m[0], b = m[1], M = this._getClampedPixelRatio(v, b);
if (this._resizeCanvas(v, b, M), this.painter.resize(v, b, M), this.painter.overLimit()) {
const D = this.painter.context.gl;
this._maxCanvasSize = [D.drawingBufferWidth, D.drawingBufferHeight];
const j = this._getClampedPixelRatio(v, b);
this._resizeCanvas(v, b, j), this.painter.resize(v, b, j);
}
this.transform.resize(v, b), (l = this._requestedCameraState) === null || l === void 0 || l.resize(v, b);
const V = !this._moving;
return V && (this.stop(), this.fire(new a.k("movestart", S)).fire(new a.k("move", S))), this.fire(new a.k("resize", S)), V && this.fire(new a.k("moveend", S)), this;
}
_getClampedPixelRatio(S, l) {
const { 0: m, 1: v } = this._maxCanvasSize, b = this.getPixelRatio(), M = S * b, V = l * b;
return Math.min(M > m ? m / M : 1, V > v ? v / V : 1) * b;
}
getPixelRatio() {
var S;
return (S = this._overridePixelRatio) !== null && S !== void 0 ? S : devicePixelRatio;
}
setPixelRatio(S) {
this._overridePixelRatio = S, this.resize();
}
getBounds() {
return this.transform.getBounds();
}
getMaxBounds() {
return this.transform.getMaxBounds();
}
setMaxBounds(S) {
return this.transform.setMaxBounds(Ct.convert(S)), this._update();
}
setMinZoom(S) {
if ((S = S ?? -2) >= -2 && S <= this.transform.maxZoom)
return this.transform.minZoom = S, this._update(), this.getZoom() < S && this.setZoom(S), this;
throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
}
getMinZoom() {
return this.transform.minZoom;
}
setMaxZoom(S) {
if ((S = S ?? 22) >= this.transform.minZoom)
return this.transform.maxZoom = S, this._update(), this.getZoom() > S && this.setZoom(S), this;
throw new Error("maxZoom must be greater than the current minZoom");
}
getMaxZoom() {
return this.transform.maxZoom;
}
setMinPitch(S) {
if ((S = S ?? 0) < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (S >= 0 && S <= this.transform.maxPitch)
return this.transform.minPitch = S, this._update(), this.getPitch() < S && this.setPitch(S), this;
throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
}
getMinPitch() {
return this.transform.minPitch;
}
setMaxPitch(S) {
if ((S = S ?? 60) > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (S >= this.transform.minPitch)
return this.transform.maxPitch = S, this._update(), this.getPitch() > S && this.setPitch(S), this;
throw new Error("maxPitch must be greater than the current minPitch");
}
getMaxPitch() {
return this.transform.maxPitch;
}
getRenderWorldCopies() {
return this.transform.renderWorldCopies;
}
setRenderWorldCopies(S) {
return this.transform.renderWorldCopies = S, this._update();
}
project(S) {
return this.transform.locationPoint(a.N.convert(S), this.style && this.terrain);
}
unproject(S) {
return this.transform.pointLocation(a.P.convert(S), this.terrain);
}
isMoving() {
var S;
return this._moving || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isMoving());
}
isZooming() {
var S;
return this._zooming || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isZooming());
}
isRotating() {
var S;
return this._rotating || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isRotating());
}
_createDelegatedListener(S, l, m) {
if (S === "mouseenter" || S === "mouseover") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (b) => {
const M = l.filter((D) => this.getLayer(D)), V = M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : [];
V.length ? v || (v = !0, m.call(this, new Gi(S, this, b.originalEvent, { features: V }))) : v = !1;
}, mouseout: () => {
v = !1;
} } };
}
if (S === "mouseleave" || S === "mouseout") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (b) => {
const M = l.filter((V) => this.getLayer(V));
(M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : []).length ? v = !0 : v && (v = !1, m.call(this, new Gi(S, this, b.originalEvent)));
}, mouseout: (b) => {
v && (v = !1, m.call(this, new Gi(S, this, b.originalEvent)));
} } };
}
{
const v = (b) => {
const M = l.filter((D) => this.getLayer(D)), V = M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : [];
V.length && (b.features = V, m.call(this, b), delete b.features);
};
return { layers: l, listener: m, delegates: { [S]: v } };
}
}
_saveDelegatedListener(S, l) {
this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[S] = this._delegatedListeners[S] || [], this._delegatedListeners[S].push(l);
}
_removeDelegatedListener(S, l, m) {
if (!this._delegatedListeners || !this._delegatedListeners[S])
return;
const v = this._delegatedListeners[S];
for (let b = 0; b < v.length; b++) {
const M = v[b];
if (M.listener === m && M.layers.length === l.length && M.layers.every((V) => l.includes(V))) {
for (const V in M.delegates)
this.off(V, M.delegates[V]);
return void v.splice(b, 1);
}
}
}
on(S, l, m) {
if (m === void 0)
return super.on(S, l);
const v = this._createDelegatedListener(S, typeof l == "string" ? [l] : l, m);
this._saveDelegatedListener(S, v);
for (const b in v.delegates)
this.on(b, v.delegates[b]);
return this;
}
once(S, l, m) {
if (m === void 0)
return super.once(S, l);
const v = typeof l == "string" ? [l] : l, b = this._createDelegatedListener(S, v, m);
for (const M in b.delegates) {
const V = b.delegates[M];
b.delegates[M] = (...D) => {
this._removeDelegatedListener(S, v, m), V(...D);
};
}
this._saveDelegatedListener(S, b);
for (const M in b.delegates)
this.once(M, b.delegates[M]);
return this;
}
off(S, l, m) {
return m === void 0 ? super.off(S, l) : (this._removeDelegatedListener(S, typeof l == "string" ? [l] : l, m), this);
}
queryRenderedFeatures(S, l) {
if (!this.style)
return [];
let m;
const v = S instanceof a.P || Array.isArray(S), b = v ? S : [[0, 0], [this.transform.width, this.transform.height]];
if (l = l || (v ? {} : S) || {}, b instanceof a.P || typeof b[0] == "number")
m = [a.P.convert(b)];
else {
const M = a.P.convert(b[0]), V = a.P.convert(b[1]);
m = [M, new a.P(V.x, M.y), V, new a.P(M.x, V.y), M];
}
return this.style.queryRenderedFeatures(m, l, this.transform);
}
querySourceFeatures(S, l) {
return this.style.querySourceFeatures(S, l);
}
setStyle(S, l) {
return (l = a.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, l)).diff !== !1 && l.localIdeographFontFamily === this._localIdeographFontFamily && this.style && S ? (this._diffStyle(S, l), this) : (this._localIdeographFontFamily = l.localIdeographFontFamily, this._updateStyle(S, l));
}
setTransformRequest(S) {
return this._requestManager.setTransformRequest(S), this;
}
_getUIString(S) {
const l = this._locale[S];
if (l == null)
throw new Error(`Missing UI string '${S}'`);
return l;
}
_updateStyle(S, l) {
if (l.transformStyle && this.style && !this.style._loaded)
return void this.style.once("style.load", () => this._updateStyle(S, l));
const m = this.style && l.transformStyle ? this.style.serialize() : void 0;
return this.style && (this.style.setEventedParent(null), this.style._remove(!S)), S ? (this.style = new ma(this, l || {}), this.style.setEventedParent(this, { style: this.style }), typeof S == "string" ? this.style.loadURL(S, l, m) : this.style.loadJSON(S, l, m), this) : (delete this.style, this);
}
_lazyInitEmptyStyle() {
this.style || (this.style = new ma(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());
}
_diffStyle(S, l) {
if (typeof S == "string") {
const m = this._requestManager.transformRequest(S, "Style");
a.h(m, new AbortController()).then((v) => {
this._updateDiff(v.data, l);
}).catch((v) => {
v && this.fire(new a.j(v));
});
} else
typeof S == "object" && this._updateDiff(S, l);
}
_updateDiff(S, l) {
try {
this.style.setState(S, l) && this._update(!0);
} catch (m) {
a.w(`Unable to perform style diff: ${m.message || m.error || m}. Rebuilding the style from scratch.`), this._updateStyle(S, l);
}
}
getStyle() {
if (this.style)
return this.style.serialize();
}
isStyleLoaded() {
return this.style ? this.style.loaded() : a.w("There is no style added to the map.");
}
addSource(S, l) {
return this._lazyInitEmptyStyle(), this.style.addSource(S, l), this._update(!0);
}
isSourceLoaded(S) {
const l = this.style && this.style.sourceCaches[S];
if (l !== void 0)
return l.loaded();
this.fire(new a.j(new Error(`There is no source with ID '${S}'`)));
}
setTerrain(S) {
if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off("data", this._terrainDataCallback), S) {
const l = this.style.sourceCaches[S.source];
if (!l)
throw new Error(`cannot load terrain, because there exists no source with ID: ${S.source}`);
this.terrain === null && l.reload();
for (const m in this.style._layers) {
const v = this.style._layers[m];
v.type === "hillshade" && v.source === S.source && a.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 Rc(this.painter, l, S), this.painter.renderToTexture = new gp(this.painter, this.terrain), this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._terrainDataCallback = (m) => {
m.dataType === "style" ? this.terrain.sourceCache.freeRtt() : m.dataType === "source" && m.tile && (m.sourceId !== S.source || this._elevationFreeze || (this.transform.minElevationForCurrentTile = 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(m.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.minElevationForCurrentTile = 0, this.transform.elevation = 0;
return this.fire(new a.k("terrain", { terrain: S })), this;
}
getTerrain() {
var S, l;
return (l = (S = this.terrain) === null || S === void 0 ? void 0 : S.options) !== null && l !== void 0 ? l : null;
}
areTilesLoaded() {
const S = this.style && this.style.sourceCaches;
for (const l in S) {
const m = S[l]._tiles;
for (const v in m) {
const b = m[v];
if (b.state !== "loaded" && b.state !== "errored")
return !1;
}
}
return !0;
}
removeSource(S) {
return this.style.removeSource(S), this._update(!0);
}
getSource(S) {
return this.style.getSource(S);
}
addImage(S, l, m = {}) {
const { pixelRatio: v = 1, sdf: b = !1, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z } = m;
if (this._lazyInitEmptyStyle(), !(l instanceof HTMLImageElement || a.b(l))) {
if (l.width === void 0 || l.height === void 0)
return this.fire(new a.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: Y, height: J, data: lt } = l, ft = l;
return this.style.addImage(S, { data: new a.R({ width: Y, height: J }, new Uint8Array(lt)), pixelRatio: v, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z, sdf: b, version: 0, userImage: ft }), ft.onAdd && ft.onAdd(this, S), this;
}
}
{
const { width: Y, height: J, data: lt } = f.getImageData(l);
this.style.addImage(S, { data: new a.R({ width: Y, height: J }, lt), pixelRatio: v, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z, sdf: b, version: 0 });
}
}
updateImage(S, l) {
const m = this.style.getImage(S);
if (!m)
return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
const v = l instanceof HTMLImageElement || a.b(l) ? f.getImageData(l) : l, { width: b, height: M, data: V } = v;
if (b === void 0 || M === void 0)
return this.fire(new a.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 (b !== m.data.width || M !== m.data.height)
return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));
const D = !(l instanceof HTMLImageElement || a.b(l));
return m.data.replace(V, D), this.style.updateImage(S, m), this;
}
getImage(S) {
return this.style.getImage(S);
}
hasImage(S) {
return S ? !!this.style.getImage(S) : (this.fire(new a.j(new Error("Missing required image id"))), !1);
}
removeImage(S) {
this.style.removeImage(S);
}
loadImage(S) {
return k.getImage(this._requestManager.transformRequest(S, "Image"), new AbortController());
}
listImages() {
return this.style.listImages();
}
addLayer(S, l) {
return this._lazyInitEmptyStyle(), this.style.addLayer(S, l), this._update(!0);
}
moveLayer(S, l) {
return this.style.moveLayer(S, l), this._update(!0);
}
removeLayer(S) {
return this.style.removeLayer(S), this._update(!0);
}
getLayer(S) {
return this.style.getLayer(S);
}
getLayersOrder() {
return this.style.getLayersOrder();
}
setLayerZoomRange(S, l, m) {
return this.style.setLayerZoomRange(S, l, m), this._update(!0);
}
setFilter(S, l, m = {}) {
return this.style.setFilter(S, l, m), this._update(!0);
}
getFilter(S) {
return this.style.getFilter(S);
}
setPaintProperty(S, l, m, v = {}) {
return this.style.setPaintProperty(S, l, m, v), this._update(!0);
}
getPaintProperty(S, l) {
return this.style.getPaintProperty(S, l);
}
setLayoutProperty(S, l, m, v = {}) {
return this.style.setLayoutProperty(S, l, m, v), this._update(!0);
}
getLayoutProperty(S, l) {
return this.style.getLayoutProperty(S, l);
}
setGlyphs(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setGlyphs(S, l), this._update(!0);
}
getGlyphs() {
return this.style.getGlyphsUrl();
}
addSprite(S, l, m = {}) {
return this._lazyInitEmptyStyle(), this.style.addSprite(S, l, m, (v) => {
v || this._update(!0);
}), this;
}
removeSprite(S) {
return this._lazyInitEmptyStyle(), this.style.removeSprite(S), this._update(!0);
}
getSprite() {
return this.style.getSprite();
}
setSprite(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setSprite(S, l, (m) => {
m || this._update(!0);
}), this;
}
setLight(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setLight(S, l), this._update(!0);
}
getLight() {
return this.style.getLight();
}
setSky(S) {
return this._lazyInitEmptyStyle(), this.style.setSky(S), this._update(!0);
}
getSky() {
return this.style.getSky();
}
setFeatureState(S, l) {
return this.style.setFeatureState(S, l), this._update();
}
removeFeatureState(S, l) {
return this.style.removeFeatureState(S, l), this._update();
}
getFeatureState(S) {
return this.style.getFeatureState(S);
}
getContainer() {
return this._container;
}
getCanvasContainer() {
return this._canvasContainer;
}
getCanvas() {
return this._canvas;
}
_containerDimensions() {
let S = 0, l = 0;
return this._container && (S = this._container.clientWidth || 400, l = this._container.clientHeight || 300), [S, l];
}
_setupContainer() {
const S = this._container;
S.classList.add("maplibregl-map");
const l = this._canvasContainer = Q.create("div", "maplibregl-canvas-container", S);
this._interactive && l.classList.add("maplibregl-interactive"), this._canvas = Q.create("canvas", "maplibregl-canvas", l), this._canvas.addEventListener("webglcontextlost", this._contextLost, !1), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.setAttribute("tabindex", this._interactive ? "0" : "-1"), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region");
const m = this._containerDimensions(), v = this._getClampedPixelRatio(m[0], m[1]);
this._resizeCanvas(m[0], m[1], v);
const b = this._controlContainer = Q.create("div", "maplibregl-control-container", S), M = this._controlPositions = {};
["top-left", "top-right", "bottom-left", "bottom-right"].forEach((V) => {
M[V] = Q.create("div", `maplibregl-ctrl-${V} `, b);
}), this._container.addEventListener("scroll", this._onMapScroll, !1);
}
_resizeCanvas(S, l, m) {
this._canvas.width = Math.floor(m * S), this._canvas.height = Math.floor(m * l), this._canvas.style.width = `${S}px`, this._canvas.style.height = `${l}px`;
}
_setupPainter() {
const S = { alpha: !0, stencil: !0, depth: !0, failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || !1 };
let l = null;
this._canvas.addEventListener("webglcontextcreationerror", (v) => {
l = { requestedAttributes: S }, v && (l.statusMessage = v.statusMessage, l.type = v.type);
}, { once: !0 });
const m = this._canvas.getContext("webgl2", S) || this._canvas.getContext("webgl", S);
if (!m) {
const v = "Failed to initialize WebGL";
throw l ? (l.message = v, new Error(JSON.stringify(l))) : new Error(v);
}
this.painter = new yi(m, this.transform), y.testSupport(m);
}
loaded() {
return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
}
_update(S) {
return this.style && this.style._loaded ? (this._styleDirty = this._styleDirty || S, this._sourcesDirty = !0, this.triggerRepaint(), this) : this;
}
_requestRenderFrame(S) {
return this._update(), this._renderTaskQueue.add(S);
}
_cancelRenderFrame(S) {
this._renderTaskQueue.remove(S);
}
_render(S) {
const l = this._idleTriggered ? this._fadeDuration : 0;
if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(S), this._removed)
return;
let m = !1;
if (this.style && this._styleDirty) {
this._styleDirty = !1;
const b = this.transform.zoom, M = f.now();
this.style.zoomHistory.update(b, M);
const V = new a.z(b, { now: M, fadeDuration: l, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), D = V.crossFadingFactor();
D === 1 && D === this._crossFadingFactor || (m = !0, this._crossFadingFactor = D), this.style.update(V);
}
this.style && this._sourcesDirty && (this._sourcesDirty = !1, this.style._updateSources(this.transform)), this.terrain ? (this.terrain.sourceCache.update(this.transform, this.terrain), this.transform.minElevationForCurrentTile = 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.minElevationForCurrentTile = 0, this.transform.elevation = 0), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, l, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: l, showPadding: this.showPadding }), this.fire(new a.k("render")), this.loaded() && !this._loaded && (this._loaded = !0, a.bf.mark(a.bg.load), this.fire(new a.k("load"))), this.style && (this.style.hasTransitions() || m) && (this._styleDirty = !0), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles();
const v = this._sourcesDirty || this._styleDirty || this._placementDirty;
return v || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new a.k("idle")), !this._loaded || this._fullyLoaded || v || (this._fullyLoaded = !0, a.bf.mark(a.bg.fullLoad)), this;
}
redraw() {
return this.style && (this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._render(0)), this;
}
remove() {
var S;
this._hash && this._hash.remove();
for (const m of this._controls)
m.onRemove(this);
this._controls = [], this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._renderTaskQueue.clear(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), typeof window < "u" && removeEventListener("online", this._onWindowOnline, !1), k.removeThrottleControl(this._imageQueueHandle), (S = this._resizeObserver) === null || S === void 0 || S.disconnect();
const l = this.painter.context.gl.getExtension("WEBGL_lose_context");
l != null && l.loseContext && l.loseContext(), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.removeEventListener("webglcontextlost", this._contextLost, !1), Q.remove(this._canvasContainer), Q.remove(this._controlContainer), this._container.classList.remove("maplibregl-map"), a.bf.clearMetrics(), this._removed = !0, this.fire(new a.k("remove"));
}
triggerRepaint() {
this.style && !this._frameRequest && (this._frameRequest = new AbortController(), f.frameAsync(this._frameRequest).then((S) => {
a.bf.frame(S), this._frameRequest = null, this._render(S);
}).catch(() => {
}));
}
get showTileBoundaries() {
return !!this._showTileBoundaries;
}
set showTileBoundaries(S) {
this._showTileBoundaries !== S && (this._showTileBoundaries = S, this._update());
}
get showPadding() {
return !!this._showPadding;
}
set showPadding(S) {
this._showPadding !== S && (this._showPadding = S, this._update());
}
get showCollisionBoxes() {
return !!this._showCollisionBoxes;
}
set showCollisionBoxes(S) {
this._showCollisionBoxes !== S && (this._showCollisionBoxes = S, S ? this.style._generateCollisionBoxes() : this._update());
}
get showOverdrawInspector() {
return !!this._showOverdrawInspector;
}
set showOverdrawInspector(S) {
this._showOverdrawInspector !== S && (this._showOverdrawInspector = S, this._update());
}
get repaint() {
return !!this._repaint;
}
set repaint(S) {
this._repaint !== S && (this._repaint = S, this.triggerRepaint());
}
get vertices() {
return !!this._vertices;
}
set vertices(S) {
this._vertices = S, this._update();
}
get version() {
return yp;
}
getCameraTargetElevation() {
return this.transform.elevation;
}
}, s.MapMouseEvent = Gi, s.MapTouchEvent = $i, s.MapWheelEvent = e2, s.Marker = Al, s.NavigationControl = class {
constructor(S) {
this._updateZoomButtons = () => {
const l = this._map.getZoom(), m = l === this._map.getMaxZoom(), v = l === this._map.getMinZoom();
this._zoomInButton.disabled = m, this._zoomOutButton.disabled = v, this._zoomInButton.setAttribute("aria-disabled", m.toString()), this._zoomOutButton.setAttribute("aria-disabled", v.toString());
}, this._rotateCompassArrow = () => {
const l = 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 = l;
}, this._setButtonTitle = (l, m) => {
const v = this._map._getUIString(`NavigationControl.${m}`);
l.title = v, l.setAttribute("aria-label", v);
}, this.options = a.e({}, g_, S), this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._container.addEventListener("contextmenu", (l) => l.preventDefault()), this.options.showZoom && (this._zoomInButton = this._createButton("maplibregl-ctrl-zoom-in", (l) => this._map.zoomIn({}, { originalEvent: l })), Q.create("span", "maplibregl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("maplibregl-ctrl-zoom-out", (l) => this._map.zoomOut({}, { originalEvent: l })), Q.create("span", "maplibregl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (this._compass = this._createButton("maplibregl-ctrl-compass", (l) => {
this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: l }) : this._map.resetNorth({}, { originalEvent: l });
}), this._compassIcon = Q.create("span", "maplibregl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true"));
}
onAdd(S) {
return this._map = S, 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 y_(this._map, this._compass, this.options.visualizePitch)), this._container;
}
onRemove() {
Q.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(S, l) {
const m = Q.create("button", S, this._container);
return m.type = "button", m.addEventListener("click", l), m;
}
}, s.Popup = class extends a.E {
constructor(S) {
super(), this.remove = () => (this._content && Q.remove(this._content), this._container && (Q.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), this._map._canvasContainer.classList.remove("maplibregl-track-pointer"), delete this._map, this.fire(new a.k("close"))), this), this._onMouseUp = (l) => {
this._update(l.point);
}, this._onMouseMove = (l) => {
this._update(l.point);
}, this._onDrag = (l) => {
this._update(l.point);
}, this._update = (l) => {
var m;
if (!this._map || !this._lngLat && !this._trackPointer || !this._content)
return;
if (!this._container) {
if (this._container = Q.create("div", "maplibregl-popup", this._map.getContainer()), this._tip = Q.create("div", "maplibregl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className)
for (const D of this.options.className.split(" "))
this._container.classList.add(D);
this._closeButton && this._closeButton.setAttribute("aria-label", this._map._getUIString("Popup.Close")), 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._lngLat = this._map.transform.renderWorldCopies && !this._trackPointer ? ti(this._lngLat, this._flatPos, this._map.transform) : (m = this._lngLat) === null || m === void 0 ? void 0 : m.wrap(), this._trackPointer && !l)
return;
const v = this._flatPos = this._pos = this._trackPointer && l ? l : this._map.project(this._lngLat);
this._map.terrain && (this._flatPos = this._trackPointer && l ? l : this._map.transform.locationPoint(this._lngLat));
let b = this.options.anchor;
const M = Cl(this.options.offset);
if (!b) {
const D = this._container.offsetWidth, j = this._container.offsetHeight;
let Z;
Z = v.y + M.bottom.y < j ? ["top"] : v.y > this._map.transform.height - j ? ["bottom"] : [], v.x < D / 2 ? Z.push("left") : v.x > this._map.transform.width - D / 2 && Z.push("right"), b = Z.length === 0 ? "bottom" : Z.join("-");
}
let V = v.add(M[b]);
this.options.subpixelPositioning || (V = V.round()), Q.setTransform(this._container, `${i6[b]} translate(${V.x}px,${V.y}px)`), Hl(this._container, b, "popup");
}, this._onClose = () => {
this.remove();
}, this.options = a.e(Object.create(Mr), S);
}
addTo(S) {
return this._map && this.remove(), this._map = S, 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 a.k("open")), this;
}
isOpen() {
return !!this._map;
}
getLngLat() {
return this._lngLat;
}
setLngLat(S) {
return this._lngLat = a.N.convert(S), this._pos = null, this._flatPos = null, this._trackPointer = !1, 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 = !0, this._pos = null, this._flatPos = 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(S) {
return this.setDOMContent(document.createTextNode(S));
}
setHTML(S) {
const l = document.createDocumentFragment(), m = document.createElement("body");
let v;
for (m.innerHTML = S; v = m.firstChild, v; )
l.appendChild(v);
return this.setDOMContent(l);
}
getMaxWidth() {
var S;
return (S = this._container) === null || S === void 0 ? void 0 : S.style.maxWidth;
}
setMaxWidth(S) {
return this.options.maxWidth = S, this._update(), this;
}
setDOMContent(S) {
if (this._content)
for (; this._content.hasChildNodes(); )
this._content.firstChild && this._content.removeChild(this._content.firstChild);
else
this._content = Q.create("div", "maplibregl-popup-content", this._container);
return this._content.appendChild(S), this._createCloseButton(), this._update(), this._focusFirstElement(), this;
}
addClassName(S) {
return this._container && this._container.classList.add(S), this;
}
removeClassName(S) {
return this._container && this._container.classList.remove(S), this;
}
setOffset(S) {
return this.options.offset = S, this._update(), this;
}
toggleClassName(S) {
if (this._container)
return this._container.classList.toggle(S);
}
setSubpixelPositioning(S) {
this.options.subpixelPositioning = S;
}
_createCloseButton() {
this.options.closeButton && (this._closeButton = Q.create("button", "maplibregl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.innerHTML = "×", this._closeButton.addEventListener("click", this._onClose));
}
_focusFirstElement() {
if (!this.options.focusAfterOpen || !this._container)
return;
const S = this._container.querySelector(Ol);
S && S.focus();
}
}, s.RasterDEMTileSource = Rr, s.RasterTileSource = Hr, s.ScaleControl = class {
constructor(S) {
this._onMove = () => {
P0(this._map, this._container, this.options);
}, this.setUnit = (l) => {
this.options.unit = l, P0(this._map, this._container, this.options);
}, this.options = Object.assign(Object.assign({}, fs), S);
}
getDefaultPosition() {
return "bottom-left";
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-scale", S.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container;
}
onRemove() {
Q.remove(this._container), this._map.off("move", this._onMove), this._map = void 0;
}
}, s.ScrollZoomHandler = A2, s.Style = ma, s.TerrainControl = class {
constructor(S) {
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.Disable")) : (this._terrainButton.classList.add("maplibregl-ctrl-terrain"), this._terrainButton.title = this._map._getUIString("TerrainControl.Enable"));
}, this.options = S;
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._terrainButton = Q.create("button", "maplibregl-ctrl-terrain", this._container), Q.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() {
Q.remove(this._container), this._map.off("terrain", this._updateTerrainIcon), this._map = void 0;
}
}, s.TwoFingersTouchPitchHandler = J4, s.TwoFingersTouchRotateHandler = Oc, s.TwoFingersTouchZoomHandler = Hc, s.TwoFingersTouchZoomRotateHandler = kc, s.VectorTileSource = Jr, s.VideoSource = ki, s.addSourceType = (S, l) => a._(void 0, void 0, void 0, function* () {
if (c1(S))
throw new Error(`A source type called "${S}" already exists.`);
((m, v) => {
Ii[m] = v;
})(S, l);
}), s.clearPrewarmedResources = function() {
const S = Gt;
S && (S.isPreloaded() && S.numActive() === 1 ? (S.release(er), Gt = 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()"));
}, s.getMaxParallelImageRequests = function() {
return a.a.MAX_PARALLEL_IMAGE_REQUESTS;
}, s.getRTLTextPluginStatus = function() {
return Hi().getRTLTextPluginStatus();
}, s.getVersion = function() {
return Fc;
}, s.getWorkerCount = function() {
return Je.workerCount;
}, s.getWorkerUrl = function() {
return a.a.WORKER_URL;
}, s.importScriptInWorkers = function(S) {
return Ge().broadcast("IS", S);
}, s.prewarm = function() {
me().acquire(er);
}, s.setMaxParallelImageRequests = function(S) {
a.a.MAX_PARALLEL_IMAGE_REQUESTS = S;
}, s.setRTLTextPlugin = function(S, l) {
return Hi().setRTLTextPlugin(S, l);
}, s.setWorkerCount = function(S) {
Je.workerCount = S;
}, s.setWorkerUrl = function(S) {
a.a.WORKER_URL = S;
};
});
var o = r;
return o;
});
})(WG);
var W9t = WG.exports;
const Uo = /* @__PURE__ */ d0(W9t);
function nc(t, e, r) {
r === void 0 && (r = {});
var n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = {}, n.geometry = t, n;
}
function Z9t(t, e, r) {
switch (t) {
case "Point":
return rH(e).geometry;
case "LineString":
return qG(e).geometry;
case "Polygon":
return q9t(e).geometry;
case "MultiPoint":
return K9t(e).geometry;
case "MultiLineString":
return X9t(e).geometry;
case "MultiPolygon":
return Y9t(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
function rH(t, e, r) {
if (r === void 0 && (r = {}), !t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!Px(t[0]) || !Px(t[1]))
throw new Error("coordinates must contain numbers");
var n = {
type: "Point",
coordinates: t
};
return nc(n, e, r);
}
function q9t(t, e, r) {
r === void 0 && (r = {});
for (var n = 0, i = t; n < i.length; n++) {
var o = i[n];
if (o.length < 4)
throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
for (var s = 0; s < o[o.length - 1].length; s++)
if (o[o.length - 1][s] !== o[0][s])
throw new Error("First and last Position are not equivalent.");
}
var a = {
type: "Polygon",
coordinates: t
};
return nc(a, e, r);
}
function qG(t, e, r) {
if (r === void 0 && (r = {}), t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
var n = {
type: "LineString",
coordinates: t
};
return nc(n, e, r);
}
function X9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiLineString",
coordinates: t
};
return nc(n, e, r);
}
function K9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPoint",
coordinates: t
};
return nc(n, e, r);
}
function Y9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPolygon",
coordinates: t
};
return nc(n, e, r);
}
function Px(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
var N2 = 63710088e-1, J9t = {
centimeters: N2 * 100,
centimetres: N2 * 100,
degrees: 360 / (2 * Math.PI),
feet: N2 * 3.28084,
inches: N2 * 39.37,
kilometers: N2 / 1e3,
kilometres: N2 / 1e3,
meters: N2,
metres: N2,
miles: N2 / 1609.344,
millimeters: N2 * 1e3,
millimetres: N2 * 1e3,
nauticalmiles: N2 / 1852,
radians: 1,
yards: N2 * 1.0936
};
function tht(t, e = "kilometers") {
const r = J9t[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
function aT(t) {
return t % 360 * Math.PI / 180;
}
function VP(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function m5(t, e, r = {}) {
var n = VP(t), i = VP(e), o = aT(i[1] - n[1]), s = aT(i[0] - n[0]), a = aT(n[1]), u = aT(i[1]), d = Math.pow(Math.sin(o / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(u);
return tht(
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
r.units
);
}
var RP = Object.prototype.toString, XG = function(t) {
var e = RP.call(t), r = e === "[object Arguments]";
return r || (r = e !== "[object Array]" && t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && RP.call(t.callee) === "[object Function]"), r;
}, Kb, NP;
function eht() {
if (NP)
return Kb;
NP = 1;
var t;
if (!Object.keys) {
var e = Object.prototype.hasOwnProperty, r = Object.prototype.toString, n = XG, i = Object.prototype.propertyIsEnumerable, o = !i.call({ toString: null }, "toString"), s = i.call(function() {
}, "prototype"), a = [
"toString",
"toLocaleString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"constructor"
], u = function(Q) {
var y = Q.constructor;
return y && y.prototype === Q;
}, d = {
$applicationCache: !0,
$console: !0,
$external: !0,
$frame: !0,
$frameElement: !0,
$frames: !0,
$innerHeight: !0,
$innerWidth: !0,
$onmozfullscreenchange: !0,
$onmozfullscreenerror: !0,
$outerHeight: !0,
$outerWidth: !0,
$pageXOffset: !0,
$pageYOffset: !0,
$parent: !0,
$scrollLeft: !0,
$scrollTop: !0,
$scrollX: !0,
$scrollY: !0,
$self: !0,
$webkitIndexedDB: !0,
$webkitStorageInfo: !0,
$window: !0
}, T = function() {
if (typeof window > "u")
return !1;
for (var Q in window)
try {
if (!d["$" + Q] && e.call(window, Q) && window[Q] !== null && typeof window[Q] == "object")
try {
u(window[Q]);
} catch {
return !0;
}
} catch {
return !0;
}
return !1;
}(), f = function(Q) {
if (typeof window > "u" || !T)
return u(Q);
try {
return u(Q);
} catch {
return !1;
}
};
t = function(Q) {
var y = Q !== null && typeof Q == "object", _ = r.call(Q) === "[object Function]", L = n(Q), E = y && r.call(Q) === "[object String]", x = [];
if (!y && !_ && !L)
throw new TypeError("Object.keys called on a non-object");
var O = s && _;
if (E && Q.length > 0 && !e.call(Q, 0))
for (var k = 0; k < Q.length; ++k)
x.push(String(k));
if (L && Q.length > 0)
for (var R = 0; R < Q.length; ++R)
x.push(String(R));
else
for (var F in Q)
!(O && F === "prototype") && e.call(Q, F) && x.push(String(F));
if (o)
for (var U = f(Q), $ = 0; $ < a.length; ++$)
!(U && a[$] === "constructor") && e.call(Q, a[$]) && x.push(a[$]);
return x;
};
}
return Kb = t, Kb;
}
var rht = Array.prototype.slice, nht = XG, DP = Object.keys, _f = DP ? function(t) {
return DP(t);
} : eht(), FP = Object.keys;
_f.shim = function() {
if (Object.keys) {
var t = function() {
var e = Object.keys(arguments);
return e && e.length === arguments.length;
}(1, 2);
t || (Object.keys = function(e) {
return nht(e) ? FP(rht.call(e)) : FP(e);
});
} else
Object.keys = _f;
return Object.keys || _f;
};
var nH = _f, iht = Error, oht = EvalError, sht = RangeError, aht = ReferenceError, KG = SyntaxError, T0 = TypeError, lht = URIError, Rg = function() {
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
return !1;
if (typeof Symbol.iterator == "symbol")
return !0;
var t = {}, e = Symbol("test"), r = Object(e);
if (typeof e == "string" || Object.prototype.toString.call(e) !== "[object Symbol]" || Object.prototype.toString.call(r) !== "[object Symbol]")
return !1;
var n = 42;
t[e] = n;
for (e in t)
return !1;
if (typeof Object.keys == "function" && Object.keys(t).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(t).length !== 0)
return !1;
var i = Object.getOwnPropertySymbols(t);
if (i.length !== 1 || i[0] !== e || !Object.prototype.propertyIsEnumerable.call(t, e))
return !1;
if (typeof Object.getOwnPropertyDescriptor == "function") {
var o = Object.getOwnPropertyDescriptor(t, e);
if (o.value !== n || o.enumerable !== !0)
return !1;
}
return !0;
}, BP = typeof Symbol < "u" && Symbol, cht = Rg, iH = function() {
return typeof BP != "function" || typeof Symbol != "function" || typeof BP("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : cht();
}, Yb = {
__proto__: null,
foo: {}
}, uht = Object, hht = function() {
return { __proto__: Yb }.foo === Yb.foo && !(Yb instanceof uht);
}, dht = "Function.prototype.bind called on incompatible ", pht = Object.prototype.toString, Tht = Math.max, fht = "[object Function]", jP = function(t, e) {
for (var r = [], n = 0; n < t.length; n += 1)
r[n] = t[n];
for (var i = 0; i < e.length; i += 1)
r[i + t.length] = e[i];
return r;
}, Qht = function(t, e) {
for (var r = [], n = e, i = 0; n < t.length; n += 1, i += 1)
r[i] = t[n];
return r;
}, mht = function(t, e) {
for (var r = "", n = 0; n < t.length; n += 1)
r += t[n], n + 1 < t.length && (r += e);
return r;
}, ght = function(t) {
var e = this;
if (typeof e != "function" || pht.apply(e) !== fht)
throw new TypeError(dht + e);
for (var r = Qht(arguments, 1), n, i = function() {
if (this instanceof n) {
var d = e.apply(
this,
jP(r, arguments)
);
return Object(d) === d ? d : this;
}
return e.apply(
t,
jP(r, arguments)
);
}, o = Tht(0, e.length - r.length), s = [], a = 0; a < o; a++)
s[a] = "$" + a;
if (n = Function("binder", "return function (" + mht(s, ",") + "){ return binder.apply(this,arguments); }")(i), e.prototype) {
var u = function() {
};
u.prototype = e.prototype, n.prototype = new u(), u.prototype = null;
}
return n;
}, yht = ght, oH = Function.prototype.bind || yht, vht = Function.prototype.call, _ht = Object.prototype.hasOwnProperty, bht = oH, YG = bht.call(vht, _ht), gn, Lht = iht, wht = oht, xht = sht, Eht = aht, S8 = KG, h8 = T0, Mht = lht, JG = Function, Jb = function(t) {
try {
return JG('"use strict"; return (' + t + ").constructor;")();
} catch {
}
}, I5 = Object.getOwnPropertyDescriptor;
if (I5)
try {
I5({}, "");
} catch {
I5 = null;
}
var tL = function() {
throw new h8();
}, Sht = I5 ? function() {
try {
return arguments.callee, tL;
} catch {
try {
return I5(arguments, "callee").get;
} catch {
return tL;
}
}
}() : tL, Yl = iH(), Hht = hht(), B1 = Object.getPrototypeOf || (Hht ? function(t) {
return t.__proto__;
} : null), w7 = {}, Aht = typeof Uint8Array > "u" || !B1 ? gn : B1(Uint8Array), P5 = {
__proto__: null,
"%AggregateError%": typeof AggregateError > "u" ? gn : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer > "u" ? gn : ArrayBuffer,
"%ArrayIteratorPrototype%": Yl && B1 ? B1([][Symbol.iterator]()) : gn,
"%AsyncFromSyncIteratorPrototype%": gn,
"%AsyncFunction%": w7,
"%AsyncGenerator%": w7,
"%AsyncGeneratorFunction%": w7,
"%AsyncIteratorPrototype%": w7,
"%Atomics%": typeof Atomics > "u" ? gn : Atomics,
"%BigInt%": typeof BigInt > "u" ? gn : BigInt,
"%BigInt64Array%": typeof BigInt64Array > "u" ? gn : BigInt64Array,
"%BigUint64Array%": typeof BigUint64Array > "u" ? gn : BigUint64Array,
"%Boolean%": Boolean,
"%DataView%": typeof DataView > "u" ? gn : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": Lht,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": wht,
"%Float32Array%": typeof Float32Array > "u" ? gn : Float32Array,
"%Float64Array%": typeof Float64Array > "u" ? gn : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? gn : FinalizationRegistry,
"%Function%": JG,
"%GeneratorFunction%": w7,
"%Int8Array%": typeof Int8Array > "u" ? gn : Int8Array,
"%Int16Array%": typeof Int16Array > "u" ? gn : Int16Array,
"%Int32Array%": typeof Int32Array > "u" ? gn : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": Yl && B1 ? B1(B1([][Symbol.iterator]())) : gn,
"%JSON%": typeof JSON == "object" ? JSON : gn,
"%Map%": typeof Map > "u" ? gn : Map,
"%MapIteratorPrototype%": typeof Map > "u" || !Yl || !B1 ? gn : B1((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise > "u" ? gn : Promise,
"%Proxy%": typeof Proxy > "u" ? gn : Proxy,
"%RangeError%": xht,
"%ReferenceError%": Eht,
"%Reflect%": typeof Reflect > "u" ? gn : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set > "u" ? gn : Set,
"%SetIteratorPrototype%": typeof Set > "u" || !Yl || !B1 ? gn : B1((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? gn : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": Yl && B1 ? B1(""[Symbol.iterator]()) : gn,
"%Symbol%": Yl ? Symbol : gn,
"%SyntaxError%": S8,
"%ThrowTypeError%": Sht,
"%TypedArray%": Aht,
"%TypeError%": h8,
"%Uint8Array%": typeof Uint8Array > "u" ? gn : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? gn : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array > "u" ? gn : Uint16Array,
"%Uint32Array%": typeof Uint32Array > "u" ? gn : Uint32Array,
"%URIError%": Mht,
"%WeakMap%": typeof WeakMap > "u" ? gn : WeakMap,
"%WeakRef%": typeof WeakRef > "u" ? gn : WeakRef,
"%WeakSet%": typeof WeakSet > "u" ? gn : WeakSet
};
if (B1)
try {
null.error;
} catch (t) {
var Oht = B1(B1(t));
P5["%Error.prototype%"] = Oht;
}
var Cht = function t(e) {
var r;
if (e === "%AsyncFunction%")
r = Jb("async function () {}");
else if (e === "%GeneratorFunction%")
r = Jb("function* () {}");
else if (e === "%AsyncGeneratorFunction%")
r = Jb("async function* () {}");
else if (e === "%AsyncGenerator%") {
var n = t("%AsyncGeneratorFunction%");
n && (r = n.prototype);
} else if (e === "%AsyncIteratorPrototype%") {
var i = t("%AsyncGenerator%");
i && B1 && (r = B1(i.prototype));
}
return P5[e] = r, r;
}, zP = {
__proto__: null,
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
}, bd = oH, jQ = YG, kht = bd.call(Function.call, Array.prototype.concat), Iht = bd.call(Function.apply, Array.prototype.splice), UP = bd.call(Function.call, String.prototype.replace), zQ = bd.call(Function.call, String.prototype.slice), Pht = bd.call(Function.call, RegExp.prototype.exec), Vht = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Rht = /\\(\\)?/g, Nht = function(t) {
var e = zQ(t, 0, 1), r = zQ(t, -1);
if (e === "%" && r !== "%")
throw new S8("invalid intrinsic syntax, expected closing `%`");
if (r === "%" && e !== "%")
throw new S8("invalid intrinsic syntax, expected opening `%`");
var n = [];
return UP(t, Vht, function(i, o, s, a) {
n[n.length] = s ? UP(a, Rht, "$1") : o || i;
}), n;
}, Dht = function(t, e) {
var r = t, n;
if (jQ(zP, r) && (n = zP[r], r = "%" + n[0] + "%"), jQ(P5, r)) {
var i = P5[r];
if (i === w7 && (i = Cht(r)), typeof i > "u" && !e)
throw new h8("intrinsic " + t + " exists, but is not available. Please file an issue!");
return {
alias: n,
name: r,
value: i
};
}
throw new S8("intrinsic " + t + " does not exist!");
}, x3 = function(t, e) {
if (typeof t != "string" || t.length === 0)
throw new h8("intrinsic name must be a non-empty string");
if (arguments.length > 1 && typeof e != "boolean")
throw new h8('"allowMissing" argument must be a boolean');
if (Pht(/^%?[^%]*%?$/, t) === null)
throw new S8("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
var r = Nht(t), n = r.length > 0 ? r[0] : "", i = Dht("%" + n + "%", e), o = i.name, s = i.value, a = !1, u = i.alias;
u && (n = u[0], Iht(r, kht([0, 1], u)));
for (var d = 1, T = !0; d < r.length; d += 1) {
var f = r[d], Q = zQ(f, 0, 1), y = zQ(f, -1);
if ((Q === '"' || Q === "'" || Q === "`" || y === '"' || y === "'" || y === "`") && Q !== y)
throw new S8("property names with quotes must have matching quotes");
if ((f === "constructor" || !T) && (a = !0), n += "." + f, o = "%" + n + "%", jQ(P5, o))
s = P5[o];
else if (s != null) {
if (!(f in s)) {
if (!e)
throw new h8("base intrinsic for " + t + " exists, but the property is not available.");
return;
}
if (I5 && d + 1 >= r.length) {
var _ = I5(s, f);
T = !!_, T && "get" in _ && !("originalValue" in _.get) ? s = _.get : s = s[f];
} else
T = jQ(s, f), s = s[f];
T && !a && (P5[o] = s);
}
}
return s;
}, eL, GP;
function sH() {
if (GP)
return eL;
GP = 1;
var t = x3, e = t("%Object.defineProperty%", !0) || !1;
if (e)
try {
e({}, "a", { value: 1 });
} catch {
e = !1;
}
return eL = e, eL;
}
var Fht = x3, bf = Fht("%Object.getOwnPropertyDescriptor%", !0);
if (bf)
try {
bf([], "length");
} catch {
bf = null;
}
var aH = bf, $P = sH(), Bht = KG, Jl = T0, WP = aH, lH = function(t, e, r) {
if (!t || typeof t != "object" && typeof t != "function")
throw new Jl("`obj` must be an object or a function`");
if (typeof e != "string" && typeof e != "symbol")
throw new Jl("`property` must be a string or a symbol`");
if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
throw new Jl("`nonEnumerable`, if provided, must be a boolean or null");
if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
throw new Jl("`nonWritable`, if provided, must be a boolean or null");
if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
throw new Jl("`nonConfigurable`, if provided, must be a boolean or null");
if (arguments.length > 6 && typeof arguments[6] != "boolean")
throw new Jl("`loose`, if provided, must be a boolean");
var n = arguments.length > 3 ? arguments[3] : null, i = arguments.length > 4 ? arguments[4] : null, o = arguments.length > 5 ? arguments[5] : null, s = arguments.length > 6 ? arguments[6] : !1, a = !!WP && WP(t, e);
if ($P)
$P(t, e, {
configurable: o === null && a ? a.configurable : !o,
enumerable: n === null && a ? a.enumerable : !n,
value: r,
writable: i === null && a ? a.writable : !i
});
else if (s || !n && !i && !o)
t[e] = r;
else
throw new Bht("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
}, Vx = sH(), t$ = function() {
return !!Vx;
};
t$.hasArrayLengthDefineBug = function() {
if (!Vx)
return null;
try {
return Vx([], "length", { value: 1 }).length !== 1;
} catch {
return !0;
}
};
var cH = t$, jht = nH, zht = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", Uht = Object.prototype.toString, Ght = Array.prototype.concat, ZP = lH, $ht = function(t) {
return typeof t == "function" && Uht.call(t) === "[object Function]";
}, e$ = cH(), Wht = function(t, e, r, n) {
if (e in t) {
if (n === !0) {
if (t[e] === r)
return;
} else if (!$ht(n) || !n())
return;
}
e$ ? ZP(t, e, r, !0) : ZP(t, e, r);
}, r$ = function(t, e) {
var r = arguments.length > 2 ? arguments[2] : {}, n = jht(e);
zht && (n = Ght.call(n, Object.getOwnPropertySymbols(e)));
for (var i = 0; i < n.length; i += 1)
Wht(t, n[i], e[n[i]], r[n[i]]);
};
r$.supportsDescriptors = !!e$;
var ul = r$, n$ = { exports: {} }, Zht = x3, qP = lH, qht = cH(), XP = aH, KP = T0, Xht = Zht("%Math.floor%"), Kht = function(t, e) {
if (typeof t != "function")
throw new KP("`fn` is not a function");
if (typeof e != "number" || e < 0 || e > 4294967295 || Xht(e) !== e)
throw new KP("`length` must be a positive 32-bit integer");
var r = arguments.length > 2 && !!arguments[2], n = !0, i = !0;
if ("length" in t && XP) {
var o = XP(t, "length");
o && !o.configurable && (n = !1), o && !o.writable && (i = !1);
}
return (n || i || !r) && (qht ? qP(
/** @type {Parameters[0]} */
t,
"length",
e,
!0,
!0
) : qP(
/** @type {Parameters[0]} */
t,
"length",
e
)), t;
};
(function(t) {
var e = oH, r = x3, n = Kht, i = T0, o = r("%Function.prototype.apply%"), s = r("%Function.prototype.call%"), a = r("%Reflect.apply%", !0) || e.call(s, o), u = sH(), d = r("%Math.max%");
t.exports = function(f) {
if (typeof f != "function")
throw new i("a function is required");
var Q = a(e, s, arguments);
return n(
Q,
1 + d(0, f.length - (arguments.length - 1)),
!0
);
};
var T = function() {
return a(e, o, arguments);
};
u ? u(t.exports, "apply", { value: T }) : t.exports.apply = T;
})(n$);
var ic = n$.exports, i$ = x3, o$ = ic, Yht = o$(i$("String.prototype.indexOf")), Fs = function(t, e) {
var r = i$(t, !!e);
return typeof r == "function" && Yht(t, ".prototype.") > -1 ? o$(r) : r;
}, Jht = nH, s$ = Rg(), a$ = Fs, YP = Object, tdt = a$("Array.prototype.push"), JP = a$("Object.prototype.propertyIsEnumerable"), edt = s$ ? Object.getOwnPropertySymbols : null, l$ = function(t, e) {
if (t == null)
throw new TypeError("target must be an object");
var r = YP(t);
if (arguments.length === 1)
return r;
for (var n = 1; n < arguments.length; ++n) {
var i = YP(arguments[n]), o = Jht(i), s = s$ && (Object.getOwnPropertySymbols || edt);
if (s)
for (var a = s(i), u = 0; u < a.length; ++u) {
var d = a[u];
JP(i, d) && tdt(o, d);
}
for (var T = 0; T < o.length; ++T) {
var f = o[T];
if (JP(i, f)) {
var Q = i[f];
r[f] = Q;
}
}
}
return r;
}, rdt = l$, ndt = function() {
if (!Object.assign)
return !1;
for (var t = "abcdefghijklmnopqrst", e = t.split(""), r = {}, n = 0; n < e.length; ++n)
r[e[n]] = e[n];
var i = Object.assign({}, r), o = "";
for (var s in i)
o += s;
return t !== o;
}, idt = function() {
if (!Object.assign || !Object.preventExtensions)
return !1;
var t = Object.preventExtensions({ 1: 2 });
try {
Object.assign(t, "xy");
} catch {
return t[1] === "y";
}
return !1;
}, c$ = function() {
return !Object.assign || ndt() || idt() ? rdt : Object.assign;
}, odt = ul, sdt = c$, adt = function() {
var t = sdt();
return odt(
Object,
{ assign: t },
{ assign: function() {
return Object.assign !== t;
} }
), t;
}, ldt = ul, cdt = ic, udt = l$, u$ = c$, hdt = adt, ddt = cdt.apply(u$()), h$ = function(t, e) {
return ddt(Object, arguments);
};
ldt(h$, {
getPolyfill: u$,
implementation: udt,
shim: hdt
});
var pdt = h$, jh = function() {
return typeof (function() {
}).name == "string";
}, nh = Object.getOwnPropertyDescriptor;
if (nh)
try {
nh([], "length");
} catch {
nh = null;
}
jh.functionsHaveConfigurableNames = function() {
if (!jh() || !nh)
return !1;
var t = nh(function() {
}, "name");
return !!t && !!t.configurable;
};
var Tdt = Function.prototype.bind;
jh.boundFunctionsHaveNames = function() {
return jh() && typeof Tdt == "function" && (function() {
}).bind().name !== "";
};
var fdt = jh, tV = lH, Qdt = cH(), mdt = fdt.functionsHaveConfigurableNames(), gdt = T0, ydt = function(t, e) {
if (typeof t != "function")
throw new gdt("`fn` is not a function");
var r = arguments.length > 2 && !!arguments[2];
return (!r || mdt) && (Qdt ? tV(
/** @type {Parameters[0]} */
t,
"name",
e,
!0,
!0
) : tV(
/** @type {Parameters[0]} */
t,
"name",
e
)), t;
}, vdt = ydt, _dt = T0, bdt = Object, d$ = vdt(function() {
if (this == null || this !== bdt(this))
throw new _dt("RegExp.prototype.flags getter called on non-object");
var t = "";
return this.hasIndices && (t += "d"), this.global && (t += "g"), this.ignoreCase && (t += "i"), this.multiline && (t += "m"), this.dotAll && (t += "s"), this.unicode && (t += "u"), this.unicodeSets && (t += "v"), this.sticky && (t += "y"), t;
}, "get flags", !0), Ldt = d$, wdt = ul.supportsDescriptors, xdt = Object.getOwnPropertyDescriptor, p$ = function() {
if (wdt && /a/mig.flags === "gim") {
var t = xdt(RegExp.prototype, "flags");
if (t && typeof t.get == "function" && typeof RegExp.prototype.dotAll == "boolean" && typeof RegExp.prototype.hasIndices == "boolean") {
var e = "", r = {};
if (Object.defineProperty(r, "hasIndices", {
get: function() {
e += "d";
}
}), Object.defineProperty(r, "sticky", {
get: function() {
e += "y";
}
}), e === "dy")
return t.get;
}
}
return Ldt;
}, Edt = ul.supportsDescriptors, Mdt = p$, Sdt = Object.getOwnPropertyDescriptor, Hdt = Object.defineProperty, Adt = TypeError, eV = Object.getPrototypeOf, Odt = /a/, Cdt = function() {
if (!Edt || !eV)
throw new Adt("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");
var t = Mdt(), e = eV(Odt), r = Sdt(e, "flags");
return (!r || r.get !== t) && Hdt(e, "flags", {
configurable: !0,
enumerable: !1,
get: t
}), t;
}, kdt = ul, Idt = ic, Pdt = d$, T$ = p$, Vdt = Cdt, f$ = Idt(T$());
kdt(f$, {
getPolyfill: T$,
implementation: Pdt,
shim: Vdt
});
var Rdt = f$, Lf = { exports: {} }, Ndt = Rg, hl = function() {
return Ndt() && !!Symbol.toStringTag;
}, Ddt = hl(), Fdt = Fs, Rx = Fdt("Object.prototype.toString"), Ng = function(t) {
return Ddt && t && typeof t == "object" && Symbol.toStringTag in t ? !1 : Rx(t) === "[object Arguments]";
}, Q$ = function(t) {
return Ng(t) ? !0 : t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && Rx(t) !== "[object Array]" && Rx(t.callee) === "[object Function]";
}, Bdt = function() {
return Ng(arguments);
}();
Ng.isLegacyArguments = Q$;
var m$ = Bdt ? Ng : Q$;
const jdt = {}, zdt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: jdt
}, Symbol.toStringTag, { value: "Module" })), Udt = /* @__PURE__ */ G4t(zdt);
var uH = typeof Map == "function" && Map.prototype, rL = Object.getOwnPropertyDescriptor && uH ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, UQ = uH && rL && typeof rL.get == "function" ? rL.get : null, rV = uH && Map.prototype.forEach, hH = typeof Set == "function" && Set.prototype, nL = Object.getOwnPropertyDescriptor && hH ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, GQ = hH && nL && typeof nL.get == "function" ? nL.get : null, nV = hH && Set.prototype.forEach, Gdt = typeof WeakMap == "function" && WeakMap.prototype, ih = Gdt ? WeakMap.prototype.has : null, $dt = typeof WeakSet == "function" && WeakSet.prototype, oh = $dt ? WeakSet.prototype.has : null, Wdt = typeof WeakRef == "function" && WeakRef.prototype, iV = Wdt ? WeakRef.prototype.deref : null, Zdt = Boolean.prototype.valueOf, qdt = Object.prototype.toString, Xdt = Function.prototype.toString, Kdt = String.prototype.match, dH = String.prototype.slice, X6 = String.prototype.replace, Ydt = String.prototype.toUpperCase, oV = String.prototype.toLowerCase, g$ = RegExp.prototype.test, sV = Array.prototype.concat, Ja = Array.prototype.join, Jdt = Array.prototype.slice, aV = Math.floor, Nx = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, iL = Object.getOwnPropertySymbols, Dx = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, H8 = typeof Symbol == "function" && typeof Symbol.iterator == "object", Eo = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === H8 || !0) ? Symbol.toStringTag : null, y$ = Object.prototype.propertyIsEnumerable, lV = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
return t.__proto__;
} : null);
function cV(t, e) {
if (t === 1 / 0 || t === -1 / 0 || t !== t || t && t > -1e3 && t < 1e3 || g$.call(/e/, e))
return e;
var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof t == "number") {
var n = t < 0 ? -aV(-t) : aV(t);
if (n !== t) {
var i = String(n), o = dH.call(e, i.length + 1);
return X6.call(i, r, "$&_") + "." + X6.call(X6.call(o, /([0-9]{3})/g, "$&_"), /_$/, "");
}
}
return X6.call(e, r, "$&_");
}
var Fx = Udt, uV = Fx.custom, hV = _$(uV) ? uV : null, tpt = function t(e, r, n, i) {
var o = r || {};
if (z6(o, "quoteStyle") && o.quoteStyle !== "single" && o.quoteStyle !== "double")
throw new TypeError('option "quoteStyle" must be "single" or "double"');
if (z6(o, "maxStringLength") && (typeof o.maxStringLength == "number" ? o.maxStringLength < 0 && o.maxStringLength !== 1 / 0 : o.maxStringLength !== null))
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
var s = z6(o, "customInspect") ? o.customInspect : !0;
if (typeof s != "boolean" && s !== "symbol")
throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
if (z6(o, "indent") && o.indent !== null && o.indent !== " " && !(parseInt(o.indent, 10) === o.indent && o.indent > 0))
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
if (z6(o, "numericSeparator") && typeof o.numericSeparator != "boolean")
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
var a = o.numericSeparator;
if (typeof e > "u")
return "undefined";
if (e === null)
return "null";
if (typeof e == "boolean")
return e ? "true" : "false";
if (typeof e == "string")
return L$(e, o);
if (typeof e == "number") {
if (e === 0)
return 1 / 0 / e > 0 ? "0" : "-0";
var u = String(e);
return a ? cV(e, u) : u;
}
if (typeof e == "bigint") {
var d = String(e) + "n";
return a ? cV(e, d) : d;
}
var T = typeof o.depth > "u" ? 5 : o.depth;
if (typeof n > "u" && (n = 0), n >= T && T > 0 && typeof e == "object")
return Bx(e) ? "[Array]" : "[Object]";
var f = gpt(o, n);
if (typeof i > "u")
i = [];
else if (b$(i, e) >= 0)
return "[Circular]";
function Q(It, Zt, oe) {
if (Zt && (i = Jdt.call(i), i.push(Zt)), oe) {
var re = {
depth: o.depth
};
return z6(o, "quoteStyle") && (re.quoteStyle = o.quoteStyle), t(It, re, n + 1, i);
}
return t(It, o, n + 1, i);
}
if (typeof e == "function" && !dV(e)) {
var y = cpt(e), _ = lT(e, Q);
return "[Function" + (y ? ": " + y : " (anonymous)") + "]" + (_.length > 0 ? " { " + Ja.call(_, ", ") + " }" : "");
}
if (_$(e)) {
var L = H8 ? X6.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Dx.call(e);
return typeof e == "object" && !H8 ? Tu(L) : L;
}
if (fpt(e)) {
for (var E = "<" + oV.call(String(e.nodeName)), x = e.attributes || [], O = 0; O < x.length; O++)
E += " " + x[O].name + "=" + v$(ept(x[O].value), "double", o);
return E += ">", e.childNodes && e.childNodes.length && (E += "..."), E += "" + oV.call(String(e.nodeName)) + ">", E;
}
if (Bx(e)) {
if (e.length === 0)
return "[]";
var k = lT(e, Q);
return f && !mpt(k) ? "[" + jx(k, f) + "]" : "[ " + Ja.call(k, ", ") + " ]";
}
if (npt(e)) {
var R = lT(e, Q);
return !("cause" in Error.prototype) && "cause" in e && !y$.call(e, "cause") ? "{ [" + String(e) + "] " + Ja.call(sV.call("[cause]: " + Q(e.cause), R), ", ") + " }" : R.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + Ja.call(R, ", ") + " }";
}
if (typeof e == "object" && s) {
if (hV && typeof e[hV] == "function" && Fx)
return Fx(e, { depth: T - n });
if (s !== "symbol" && typeof e.inspect == "function")
return e.inspect();
}
if (upt(e)) {
var F = [];
return rV && rV.call(e, function(It, Zt) {
F.push(Q(Zt, e, !0) + " => " + Q(It, e));
}), pV("Map", UQ.call(e), F, f);
}
if (ppt(e)) {
var U = [];
return nV && nV.call(e, function(It) {
U.push(Q(It, e));
}), pV("Set", GQ.call(e), U, f);
}
if (hpt(e))
return oL("WeakMap");
if (Tpt(e))
return oL("WeakSet");
if (dpt(e))
return oL("WeakRef");
if (opt(e))
return Tu(Q(Number(e)));
if (apt(e))
return Tu(Q(Nx.call(e)));
if (spt(e))
return Tu(Zdt.call(e));
if (ipt(e))
return Tu(Q(String(e)));
if (typeof window < "u" && e === window)
return "{ [object Window] }";
if (e === P)
return "{ [object globalThis] }";
if (!rpt(e) && !dV(e)) {
var $ = lT(e, Q), et = lV ? lV(e) === Object.prototype : e instanceof Object || e.constructor === Object, nt = e instanceof Object ? "" : "null prototype", ct = !et && Eo && Object(e) === e && Eo in e ? dH.call(f0(e), 8, -1) : nt ? "Object" : "", rt = et || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", gt = rt + (ct || nt ? "[" + Ja.call(sV.call([], ct || [], nt || []), ": ") + "] " : "");
return $.length === 0 ? gt + "{}" : f ? gt + "{" + jx($, f) + "}" : gt + "{ " + Ja.call($, ", ") + " }";
}
return String(e);
};
function v$(t, e, r) {
var n = (r.quoteStyle || e) === "double" ? '"' : "'";
return n + t + n;
}
function ept(t) {
return X6.call(String(t), /"/g, """);
}
function Bx(t) {
return f0(t) === "[object Array]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function rpt(t) {
return f0(t) === "[object Date]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function dV(t) {
return f0(t) === "[object RegExp]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function npt(t) {
return f0(t) === "[object Error]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function ipt(t) {
return f0(t) === "[object String]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function opt(t) {
return f0(t) === "[object Number]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function spt(t) {
return f0(t) === "[object Boolean]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function _$(t) {
if (H8)
return t && typeof t == "object" && t instanceof Symbol;
if (typeof t == "symbol")
return !0;
if (!t || typeof t != "object" || !Dx)
return !1;
try {
return Dx.call(t), !0;
} catch {
}
return !1;
}
function apt(t) {
if (!t || typeof t != "object" || !Nx)
return !1;
try {
return Nx.call(t), !0;
} catch {
}
return !1;
}
var lpt = Object.prototype.hasOwnProperty || function(t) {
return t in this;
};
function z6(t, e) {
return lpt.call(t, e);
}
function f0(t) {
return qdt.call(t);
}
function cpt(t) {
if (t.name)
return t.name;
var e = Kdt.call(Xdt.call(t), /^function\s*([\w$]+)/);
return e ? e[1] : null;
}
function b$(t, e) {
if (t.indexOf)
return t.indexOf(e);
for (var r = 0, n = t.length; r < n; r++)
if (t[r] === e)
return r;
return -1;
}
function upt(t) {
if (!UQ || !t || typeof t != "object")
return !1;
try {
UQ.call(t);
try {
GQ.call(t);
} catch {
return !0;
}
return t instanceof Map;
} catch {
}
return !1;
}
function hpt(t) {
if (!ih || !t || typeof t != "object")
return !1;
try {
ih.call(t, ih);
try {
oh.call(t, oh);
} catch {
return !0;
}
return t instanceof WeakMap;
} catch {
}
return !1;
}
function dpt(t) {
if (!iV || !t || typeof t != "object")
return !1;
try {
return iV.call(t), !0;
} catch {
}
return !1;
}
function ppt(t) {
if (!GQ || !t || typeof t != "object")
return !1;
try {
GQ.call(t);
try {
UQ.call(t);
} catch {
return !0;
}
return t instanceof Set;
} catch {
}
return !1;
}
function Tpt(t) {
if (!oh || !t || typeof t != "object")
return !1;
try {
oh.call(t, oh);
try {
ih.call(t, ih);
} catch {
return !0;
}
return t instanceof WeakSet;
} catch {
}
return !1;
}
function fpt(t) {
return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
}
function L$(t, e) {
if (t.length > e.maxStringLength) {
var r = t.length - e.maxStringLength, n = "... " + r + " more character" + (r > 1 ? "s" : "");
return L$(dH.call(t, 0, e.maxStringLength), e) + n;
}
var i = X6.call(X6.call(t, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, Qpt);
return v$(i, "single", e);
}
function Qpt(t) {
var e = t.charCodeAt(0), r = {
8: "b",
9: "t",
10: "n",
12: "f",
13: "r"
}[e];
return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + Ydt.call(e.toString(16));
}
function Tu(t) {
return "Object(" + t + ")";
}
function oL(t) {
return t + " { ? }";
}
function pV(t, e, r, n) {
var i = n ? jx(r, n) : Ja.call(r, ", ");
return t + " (" + e + ") {" + i + "}";
}
function mpt(t) {
for (var e = 0; e < t.length; e++)
if (b$(t[e], `
`) >= 0)
return !1;
return !0;
}
function gpt(t, e) {
var r;
if (t.indent === " ")
r = " ";
else if (typeof t.indent == "number" && t.indent > 0)
r = Ja.call(Array(t.indent + 1), " ");
else
return null;
return {
base: r,
prev: Ja.call(Array(e + 1), r)
};
}
function jx(t, e) {
if (t.length === 0)
return "";
var r = `
` + e.prev + e.base;
return r + Ja.call(t, "," + r) + `
` + e.prev;
}
function lT(t, e) {
var r = Bx(t), n = [];
if (r) {
n.length = t.length;
for (var i = 0; i < t.length; i++)
n[i] = z6(t, i) ? e(t[i], t) : "";
}
var o = typeof iL == "function" ? iL(t) : [], s;
if (H8) {
s = {};
for (var a = 0; a < o.length; a++)
s["$" + o[a]] = o[a];
}
for (var u in t)
z6(t, u) && (r && String(Number(u)) === u && u < t.length || H8 && s["$" + u] instanceof Symbol || (g$.call(/[^\w$]/, u) ? n.push(e(u, t) + ": " + e(t[u], t)) : n.push(u + ": " + e(t[u], t))));
if (typeof iL == "function")
for (var d = 0; d < o.length; d++)
y$.call(t, o[d]) && n.push("[" + e(o[d]) + "]: " + e(t[o[d]], t));
return n;
}
var w$ = x3, oc = Fs, ypt = tpt, vpt = T0, cT = w$("%WeakMap%", !0), uT = w$("%Map%", !0), _pt = oc("WeakMap.prototype.get", !0), bpt = oc("WeakMap.prototype.set", !0), Lpt = oc("WeakMap.prototype.has", !0), wpt = oc("Map.prototype.get", !0), xpt = oc("Map.prototype.set", !0), Ept = oc("Map.prototype.has", !0), pH = function(t, e) {
for (var r = t, n; (n = r.next) !== null; r = n)
if (n.key === e)
return r.next = n.next, n.next = /** @type {NonNullable} */
t.next, t.next = n, n;
}, Mpt = function(t, e) {
var r = pH(t, e);
return r && r.value;
}, Spt = function(t, e, r) {
var n = pH(t, e);
n ? n.value = r : t.next = /** @type {import('.').ListNode} */
{
// eslint-disable-line no-param-reassign, no-extra-parens
key: e,
next: t.next,
value: r
};
}, Hpt = function(t, e) {
return !!pH(t, e);
}, x$ = function() {
var t, e, r, n = {
assert: function(i) {
if (!n.has(i))
throw new vpt("Side channel does not contain " + ypt(i));
},
get: function(i) {
if (cT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return _pt(t, i);
} else if (uT) {
if (e)
return wpt(e, i);
} else if (r)
return Mpt(r, i);
},
has: function(i) {
if (cT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return Lpt(t, i);
} else if (uT) {
if (e)
return Ept(e, i);
} else if (r)
return Hpt(r, i);
return !1;
},
set: function(i, o) {
cT && i && (typeof i == "object" || typeof i == "function") ? (t || (t = new cT()), bpt(t, i, o)) : uT ? (e || (e = new uT()), xpt(e, i, o)) : (r || (r = { key: {}, next: null }), Spt(r, i, o));
}
};
return n;
}, Apt = YG, fu = x$(), W3 = T0, TH = {
assert: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
if (fu.assert(t), !TH.has(t, e))
throw new W3("`" + e + "` is not present on `O`");
},
get: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = fu.get(t);
return r && r["$" + e];
},
has: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = fu.get(t);
return !!r && Apt(r, "$" + e);
},
set: function(t, e, r) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var n = fu.get(t);
n || (n = {}, fu.set(t, n)), n["$" + e] = r;
}
};
Object.freeze && Object.freeze(TH);
var Opt = TH, Qu = Opt, Cpt = SyntaxError, TV = typeof StopIteration == "object" ? StopIteration : null, kpt = function(t) {
if (!TV)
throw new Cpt("this environment lacks StopIteration");
Qu.set(t, "[[Done]]", !1);
var e = {
next: function() {
var r = Qu.get(this, "[[Iterator]]"), n = Qu.get(r, "[[Done]]");
try {
return {
done: n,
value: n ? void 0 : r.next()
};
} catch (i) {
if (Qu.set(r, "[[Done]]", !0), i !== TV)
throw i;
return {
done: !0,
value: void 0
};
}
}
};
return Qu.set(e, "[[Iterator]]", t), e;
}, Ipt = {}.toString, E$ = Array.isArray || function(t) {
return Ipt.call(t) == "[object Array]";
}, Ppt = String.prototype.valueOf, Vpt = function(t) {
try {
return Ppt.call(t), !0;
} catch {
return !1;
}
}, Rpt = Object.prototype.toString, Npt = "[object String]", Dpt = hl(), M$ = function(t) {
return typeof t == "string" ? !0 : typeof t != "object" ? !1 : Dpt ? Vpt(t) : Rpt.call(t) === Npt;
}, fH = typeof Map == "function" && Map.prototype ? Map : null, Fpt = typeof Set == "function" && Set.prototype ? Set : null, $Q;
fH || ($Q = function(t) {
return !1;
});
var S$ = fH ? Map.prototype.has : null, fV = Fpt ? Set.prototype.has : null;
!$Q && !S$ && ($Q = function(t) {
return !1;
});
var H$ = $Q || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (S$.call(t), fV)
try {
fV.call(t);
} catch {
return !0;
}
return t instanceof fH;
} catch {
}
return !1;
}, Bpt = typeof Map == "function" && Map.prototype ? Map : null, QH = typeof Set == "function" && Set.prototype ? Set : null, WQ;
QH || (WQ = function(t) {
return !1;
});
var QV = Bpt ? Map.prototype.has : null, A$ = QH ? Set.prototype.has : null;
!WQ && !A$ && (WQ = function(t) {
return !1;
});
var O$ = WQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (A$.call(t), QV)
try {
QV.call(t);
} catch {
return !0;
}
return t instanceof QH;
} catch {
}
return !1;
}, mV = m$, gV = kpt;
if (iH() || Rg()) {
var sL = Symbol.iterator;
Lf.exports = function(t) {
if (t != null && typeof t[sL] < "u")
return t[sL]();
if (mV(t))
return Array.prototype[sL].call(t);
};
} else {
var jpt = E$, zpt = M$, yV = x3, Upt = yV("%Map%", !0), Gpt = yV("%Set%", !0), Xs = Fs, vV = Xs("Array.prototype.push"), _V = Xs("String.prototype.charCodeAt"), $pt = Xs("String.prototype.slice"), Wpt = function(t, e) {
var r = t.length;
if (e + 1 >= r)
return e + 1;
var n = _V(t, e);
if (n < 55296 || n > 56319)
return e + 1;
var i = _V(t, e + 1);
return i < 56320 || i > 57343 ? e + 1 : e + 2;
}, aL = function(t) {
var e = 0;
return {
next: function() {
var r = e >= t.length, n;
return r || (n = t[e], e += 1), {
done: r,
value: n
};
}
};
}, bV = function(t, e) {
if (jpt(t) || mV(t))
return aL(t);
if (zpt(t)) {
var r = 0;
return {
next: function() {
var n = Wpt(t, r), i = $pt(t, r, n);
return r = n, {
done: n > t.length,
value: i
};
}
};
}
if (e && typeof t["_es6-shim iterator_"] < "u")
return t["_es6-shim iterator_"]();
};
if (!Upt && !Gpt)
Lf.exports = function(t) {
if (t != null)
return bV(t, !0);
};
else {
var Zpt = H$, qpt = O$, LV = Xs("Map.prototype.forEach", !0), wV = Xs("Set.prototype.forEach", !0);
if (typeof process > "u" || !process.versions || !process.versions.node)
var xV = Xs("Map.prototype.iterator", !0), EV = Xs("Set.prototype.iterator", !0);
var MV = Xs("Map.prototype.@@iterator", !0) || Xs("Map.prototype._es6-shim iterator_", !0), SV = Xs("Set.prototype.@@iterator", !0) || Xs("Set.prototype._es6-shim iterator_", !0), Xpt = function(t) {
if (Zpt(t)) {
if (xV)
return gV(xV(t));
if (MV)
return MV(t);
if (LV) {
var e = [];
return LV(t, function(n, i) {
vV(e, [i, n]);
}), aL(e);
}
}
if (qpt(t)) {
if (EV)
return gV(EV(t));
if (SV)
return SV(t);
if (wV) {
var r = [];
return wV(t, function(n) {
vV(r, n);
}), aL(r);
}
}
};
Lf.exports = function(t) {
return Xpt(t) || bV(t);
};
}
}
var Kpt = Lf.exports, HV = function(t) {
return t !== t;
}, C$ = function(t, e) {
return t === 0 && e === 0 ? 1 / t === 1 / e : !!(t === e || HV(t) && HV(e));
}, Ypt = C$, k$ = function() {
return typeof Object.is == "function" ? Object.is : Ypt;
}, Jpt = k$, tTt = ul, eTt = function() {
var t = Jpt();
return tTt(Object, { is: t }, {
is: function() {
return Object.is !== t;
}
}), t;
}, rTt = ul, nTt = ic, iTt = C$, I$ = k$, oTt = eTt, P$ = nTt(I$(), Object);
rTt(P$, {
getPolyfill: I$,
implementation: iTt,
shim: oTt
});
var sTt = P$, aTt = ic, V$ = Fs, lTt = x3, zx = lTt("%ArrayBuffer%", !0), wf = V$("ArrayBuffer.prototype.byteLength", !0), cTt = V$("Object.prototype.toString"), AV = !!zx && !wf && new zx(0).slice, OV = !!AV && aTt(AV), R$ = wf || OV ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return wf ? wf(t) : OV(t, 0), !0;
} catch {
return !1;
}
} : zx ? function(t) {
return cTt(t) === "[object ArrayBuffer]";
} : function(t) {
return !1;
}, uTt = Date.prototype.getDay, hTt = function(t) {
try {
return uTt.call(t), !0;
} catch {
return !1;
}
}, dTt = Object.prototype.toString, pTt = "[object Date]", TTt = hl(), fTt = function(t) {
return typeof t != "object" || t === null ? !1 : TTt ? hTt(t) : dTt.call(t) === pTt;
}, Ux = Fs, N$ = hl(), D$, F$, Gx, $x;
if (N$) {
D$ = Ux("Object.prototype.hasOwnProperty"), F$ = Ux("RegExp.prototype.exec"), Gx = {};
var lL = function() {
throw Gx;
};
$x = {
toString: lL,
valueOf: lL
}, typeof Symbol.toPrimitive == "symbol" && ($x[Symbol.toPrimitive] = lL);
}
var QTt = Ux("Object.prototype.toString"), mTt = Object.getOwnPropertyDescriptor, gTt = "[object RegExp]", yTt = N$ ? function(t) {
if (!t || typeof t != "object")
return !1;
var e = mTt(t, "lastIndex"), r = e && D$(e, "value");
if (!r)
return !1;
try {
F$(t, $x);
} catch (n) {
return n === Gx;
}
} : function(t) {
return !t || typeof t != "object" && typeof t != "function" ? !1 : QTt(t) === gTt;
}, vTt = Fs, CV = vTt("SharedArrayBuffer.prototype.byteLength", !0), _Tt = CV ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return CV(t), !0;
} catch {
return !1;
}
} : function(t) {
return !1;
}, bTt = Number.prototype.toString, LTt = function(t) {
try {
return bTt.call(t), !0;
} catch {
return !1;
}
}, wTt = Object.prototype.toString, xTt = "[object Number]", ETt = hl(), MTt = function(t) {
return typeof t == "number" ? !0 : typeof t != "object" ? !1 : ETt ? LTt(t) : wTt.call(t) === xTt;
}, B$ = Fs, STt = B$("Boolean.prototype.toString"), HTt = B$("Object.prototype.toString"), ATt = function(t) {
try {
return STt(t), !0;
} catch {
return !1;
}
}, OTt = "[object Boolean]", CTt = hl(), kTt = function(t) {
return typeof t == "boolean" ? !0 : t === null || typeof t != "object" ? !1 : CTt && Symbol.toStringTag in t ? ATt(t) : HTt(t) === OTt;
}, Wx = { exports: {} }, ITt = Object.prototype.toString, PTt = iH();
if (PTt) {
var VTt = Symbol.prototype.toString, RTt = /^Symbol\(.*\)$/, NTt = function(t) {
return typeof t.valueOf() != "symbol" ? !1 : RTt.test(VTt.call(t));
};
Wx.exports = function(t) {
if (typeof t == "symbol")
return !0;
if (ITt.call(t) !== "[object Symbol]")
return !1;
try {
return NTt(t);
} catch {
return !1;
}
};
} else
Wx.exports = function(t) {
return !1;
};
var DTt = Wx.exports, Zx = { exports: {} }, kV = typeof BigInt < "u" && BigInt, FTt = function() {
return typeof kV == "function" && typeof BigInt == "function" && typeof kV(42) == "bigint" && typeof BigInt(42) == "bigint";
}, BTt = FTt();
if (BTt) {
var jTt = BigInt.prototype.valueOf, zTt = function(t) {
try {
return jTt.call(t), !0;
} catch {
}
return !1;
};
Zx.exports = function(t) {
return t === null || typeof t > "u" || typeof t == "boolean" || typeof t == "string" || typeof t == "number" || typeof t == "symbol" || typeof t == "function" ? !1 : typeof t == "bigint" ? !0 : zTt(t);
};
} else
Zx.exports = function(t) {
return !1;
};
var UTt = Zx.exports, GTt = M$, $Tt = MTt, WTt = kTt, ZTt = DTt, qTt = UTt, XTt = function(t) {
if (t == null || typeof t != "object" && typeof t != "function")
return null;
if (GTt(t))
return "String";
if ($Tt(t))
return "Number";
if (WTt(t))
return "Boolean";
if (ZTt(t))
return "Symbol";
if (qTt(t))
return "BigInt";
}, ZQ = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap : null, IV = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet : null, qQ;
ZQ || (qQ = function(t) {
return !1;
});
var qx = ZQ ? ZQ.prototype.has : null, cL = IV ? IV.prototype.has : null;
!qQ && !qx && (qQ = function(t) {
return !1;
});
var KTt = qQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (qx.call(t, qx), cL)
try {
cL.call(t, cL);
} catch {
return !0;
}
return t instanceof ZQ;
} catch {
}
return !1;
}, Xx = { exports: {} }, YTt = x3, j$ = Fs, JTt = YTt("%WeakSet%", !0), uL = j$("WeakSet.prototype.has", !0);
if (uL) {
var hL = j$("WeakMap.prototype.has", !0);
Xx.exports = function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (uL(t, uL), hL)
try {
hL(t, hL);
} catch {
return !0;
}
return t instanceof JTt;
} catch {
}
return !1;
};
} else
Xx.exports = function(t) {
return !1;
};
var tft = Xx.exports, eft = H$, rft = O$, nft = KTt, ift = tft, oft = function(t) {
if (t && typeof t == "object") {
if (eft(t))
return "Map";
if (rft(t))
return "Set";
if (nft(t))
return "WeakMap";
if (ift(t))
return "WeakSet";
}
return !1;
}, z$ = Function.prototype.toString, K7 = typeof Reflect == "object" && Reflect !== null && Reflect.apply, Kx, xf;
if (typeof K7 == "function" && typeof Object.defineProperty == "function")
try {
Kx = Object.defineProperty({}, "length", {
get: function() {
throw xf;
}
}), xf = {}, K7(function() {
throw 42;
}, null, Kx);
} catch (t) {
t !== xf && (K7 = null);
}
else
K7 = null;
var sft = /^\s*class\b/, Yx = function(t) {
try {
var e = z$.call(t);
return sft.test(e);
} catch {
return !1;
}
}, dL = function(t) {
try {
return Yx(t) ? !1 : (z$.call(t), !0);
} catch {
return !1;
}
}, Ef = Object.prototype.toString, aft = "[object Object]", lft = "[object Function]", cft = "[object GeneratorFunction]", uft = "[object HTMLAllCollection]", hft = "[object HTML document.all class]", dft = "[object HTMLCollection]", pft = typeof Symbol == "function" && !!Symbol.toStringTag, Tft = !(0 in [,]), Jx = function() {
return !1;
};
if (typeof document == "object") {
var fft = document.all;
Ef.call(fft) === Ef.call(document.all) && (Jx = function(t) {
if ((Tft || !t) && (typeof t > "u" || typeof t == "object"))
try {
var e = Ef.call(t);
return (e === uft || e === hft || e === dft || e === aft) && t("") == null;
} catch {
}
return !1;
});
}
var Qft = K7 ? function(t) {
if (Jx(t))
return !0;
if (!t || typeof t != "function" && typeof t != "object")
return !1;
try {
K7(t, null, Kx);
} catch (e) {
if (e !== xf)
return !1;
}
return !Yx(t) && dL(t);
} : function(t) {
if (Jx(t))
return !0;
if (!t || typeof t != "function" && typeof t != "object")
return !1;
if (pft)
return dL(t);
if (Yx(t))
return !1;
var e = Ef.call(t);
return e !== lft && e !== cft && !/^\[object HTML/.test(e) ? !1 : dL(t);
}, mft = Qft, gft = Object.prototype.toString, U$ = Object.prototype.hasOwnProperty, yft = function(t, e, r) {
for (var n = 0, i = t.length; n < i; n++)
U$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, vft = function(t, e, r) {
for (var n = 0, i = t.length; n < i; n++)
r == null ? e(t.charAt(n), n, t) : e.call(r, t.charAt(n), n, t);
}, _ft = function(t, e, r) {
for (var n in t)
U$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, bft = function(t, e, r) {
if (!mft(e))
throw new TypeError("iterator must be a function");
var n;
arguments.length >= 3 && (n = r), gft.call(t) === "[object Array]" ? yft(t, e, n) : typeof t == "string" ? vft(t, e, n) : _ft(t, e, n);
}, Lft = bft, wft = [
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
], pL = wft, xft = typeof globalThis > "u" ? P : globalThis, Eft = function() {
for (var t = [], e = 0; e < pL.length; e++)
typeof xft[pL[e]] == "function" && (t[t.length] = pL[e]);
return t;
}, XQ = Lft, Mft = Eft, PV = ic, mH = Fs, Mf = aH, Sft = mH("Object.prototype.toString"), G$ = hl(), VV = typeof globalThis > "u" ? P : globalThis, tE = Mft(), gH = mH("String.prototype.slice"), TL = Object.getPrototypeOf, Hft = mH("Array.prototype.indexOf", !0) || function(t, e) {
for (var r = 0; r < t.length; r += 1)
if (t[r] === e)
return r;
return -1;
}, KQ = { __proto__: null };
G$ && Mf && TL ? XQ(tE, function(t) {
var e = new VV[t]();
if (Symbol.toStringTag in e) {
var r = TL(e), n = Mf(r, Symbol.toStringTag);
if (!n) {
var i = TL(r);
n = Mf(i, Symbol.toStringTag);
}
KQ["$" + t] = PV(n.get);
}
}) : XQ(tE, function(t) {
var e = new VV[t](), r = e.slice || e.set;
r && (KQ["$" + t] = PV(r));
});
var Aft = function(t) {
var e = !1;
return XQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
KQ,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
"$" + r(t) === n && (e = gH(n, 1));
} catch {
}
}
), e;
}, Oft = function(t) {
var e = !1;
return XQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
KQ,
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
r(t), e = gH(n, 1);
} catch {
}
}
), e;
}, Cft = function(t) {
if (!t || typeof t != "object")
return !1;
if (!G$) {
var e = gH(Sft(t), 8, -1);
return Hft(tE, e) > -1 ? e : e !== "Object" ? !1 : Oft(t);
}
return Mf ? Aft(t) : null;
}, kft = Fs, RV = kft("ArrayBuffer.prototype.byteLength", !0), Ift = R$, Pft = function(t) {
return Ift(t) ? RV ? RV(t) : t.byteLength : NaN;
}, $$ = pdt, E3 = Fs, NV = Rdt, Vft = x3, A8 = Kpt, Rft = x$, DV = sTt, FV = m$, BV = E$, jV = R$, zV = fTt, UV = yTt, GV = _Tt, $V = nH, WV = XTt, ZV = oft, qV = Cft, XV = Pft, KV = E3("SharedArrayBuffer.prototype.byteLength", !0), YV = E3("Date.prototype.getTime"), fL = Object.getPrototypeOf, JV = E3("Object.prototype.toString"), YQ = Vft("%Set%", !0), eE = E3("Map.prototype.has", !0), JQ = E3("Map.prototype.get", !0), tR = E3("Map.prototype.size", !0), tm = E3("Set.prototype.add", !0), W$ = E3("Set.prototype.delete", !0), em = E3("Set.prototype.has", !0), Sf = E3("Set.prototype.size", !0);
function eR(t, e, r, n) {
for (var i = A8(t), o; (o = i.next()) && !o.done; )
if (oa(e, o.value, r, n))
return W$(t, o.value), !0;
return !1;
}
function Z$(t) {
if (typeof t > "u")
return null;
if (typeof t != "object")
return typeof t == "symbol" ? !1 : typeof t == "string" || typeof t == "number" ? +t == +t : !0;
}
function Nft(t, e, r, n, i, o) {
var s = Z$(r);
if (s != null)
return s;
var a = JQ(e, s), u = $$({}, i, { strict: !1 });
return typeof a > "u" && !eE(e, s) || !oa(n, a, u, o) ? !1 : !eE(t, s) && oa(n, a, u, o);
}
function Dft(t, e, r) {
var n = Z$(r);
return n ?? (em(e, n) && !em(t, n));
}
function rR(t, e, r, n, i, o) {
for (var s = A8(t), a, u; (a = s.next()) && !a.done; )
if (u = a.value, // eslint-disable-next-line no-use-before-define
oa(r, u, i, o) && oa(n, JQ(e, u), i, o))
return W$(t, u), !0;
return !1;
}
function oa(t, e, r, n) {
var i = r || {};
if (i.strict ? DV(t, e) : t === e)
return !0;
var o = WV(t), s = WV(e);
if (o !== s)
return !1;
if (!t || !e || typeof t != "object" && typeof e != "object")
return i.strict ? DV(t, e) : t == e;
var a = n.has(t), u = n.has(e), d;
if (a && u) {
if (n.get(t) === n.get(e))
return !0;
} else
d = {};
return a || n.set(t, d), u || n.set(e, d), jft(t, e, i, n);
}
function nR(t) {
return !t || typeof t != "object" || typeof t.length != "number" || typeof t.copy != "function" || typeof t.slice != "function" || t.length > 0 && typeof t[0] != "number" ? !1 : !!(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t));
}
function Fft(t, e, r, n) {
if (Sf(t) !== Sf(e))
return !1;
for (var i = A8(t), o = A8(e), s, a, u; (s = i.next()) && !s.done; )
if (s.value && typeof s.value == "object")
u || (u = new YQ()), tm(u, s.value);
else if (!em(e, s.value)) {
if (r.strict || !Dft(t, e, s.value))
return !1;
u || (u = new YQ()), tm(u, s.value);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (a.value && typeof a.value == "object") {
if (!eR(u, a.value, r.strict, n))
return !1;
} else if (!r.strict && !em(t, a.value) && !eR(u, a.value, r.strict, n))
return !1;
return Sf(u) === 0;
}
return !0;
}
function Bft(t, e, r, n) {
if (tR(t) !== tR(e))
return !1;
for (var i = A8(t), o = A8(e), s, a, u, d, T, f; (s = i.next()) && !s.done; )
if (d = s.value[0], T = s.value[1], d && typeof d == "object")
u || (u = new YQ()), tm(u, d);
else if (f = JQ(e, d), typeof f > "u" && !eE(e, d) || !oa(T, f, r, n)) {
if (r.strict || !Nft(t, e, d, T, r, n))
return !1;
u || (u = new YQ()), tm(u, d);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (d = a.value[0], f = a.value[1], d && typeof d == "object") {
if (!rR(u, t, d, f, r, n))
return !1;
} else if (!r.strict && (!t.has(d) || !oa(JQ(t, d), f, r, n)) && !rR(u, t, d, f, $$({}, r, { strict: !1 }), n))
return !1;
return Sf(u) === 0;
}
return !0;
}
function jft(t, e, r, n) {
var i, o;
if (typeof t != typeof e || t == null || e == null || JV(t) !== JV(e) || FV(t) !== FV(e))
return !1;
var s = BV(t), a = BV(e);
if (s !== a)
return !1;
var u = t instanceof Error, d = e instanceof Error;
if (u !== d || (u || d) && (t.name !== e.name || t.message !== e.message))
return !1;
var T = UV(t), f = UV(e);
if (T !== f || (T || f) && (t.source !== e.source || NV(t) !== NV(e)))
return !1;
var Q = zV(t), y = zV(e);
if (Q !== y || (Q || y) && YV(t) !== YV(e) || r.strict && fL && fL(t) !== fL(e))
return !1;
var _ = qV(t), L = qV(e);
if (_ !== L)
return !1;
if (_ || L) {
if (t.length !== e.length)
return !1;
for (i = 0; i < t.length; i++)
if (t[i] !== e[i])
return !1;
return !0;
}
var E = nR(t), x = nR(e);
if (E !== x)
return !1;
if (E || x) {
if (t.length !== e.length)
return !1;
for (i = 0; i < t.length; i++)
if (t[i] !== e[i])
return !1;
return !0;
}
var O = jV(t), k = jV(e);
if (O !== k)
return !1;
if (O || k)
return XV(t) !== XV(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
var R = GV(t), F = GV(e);
if (R !== F)
return !1;
if (R || F)
return KV(t) !== KV(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
if (typeof t != typeof e)
return !1;
var U = $V(t), $ = $V(e);
if (U.length !== $.length)
return !1;
for (U.sort(), $.sort(), i = U.length - 1; i >= 0; i--)
if (U[i] != $[i])
return !1;
for (i = U.length - 1; i >= 0; i--)
if (o = U[i], !oa(t[o], e[o], r, n))
return !1;
var et = ZV(t), nt = ZV(e);
return et !== nt ? !1 : et === "Set" || nt === "Set" ? Fft(t, e, r, n) : et === "Map" ? Bft(t, e, r, n) : !0;
}
var zft = function(t, e, r) {
return oa(t, e, r, Rft());
};
const yH = /* @__PURE__ */ d0(zft);
var Uft = Object.defineProperty, $n = (t, e) => Uft(t, "name", { value: e, configurable: !0 }), Gft = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !l9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = rE(t), n = rE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!l9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return l9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? yH(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return l9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
$n(Gft, "GeojsonEquality");
function l9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
$n(l9, "sameLength");
function rE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
$n(rE, "explode");
var D2 = 63710088e-1, q$ = {
centimeters: D2 * 100,
centimetres: D2 * 100,
degrees: 360 / (2 * Math.PI),
feet: D2 * 3.28084,
inches: D2 * 39.37,
kilometers: D2 / 1e3,
kilometres: D2 / 1e3,
meters: D2,
metres: D2,
miles: D2 / 1609.344,
millimeters: D2 * 1e3,
millimetres: D2 * 1e3,
nauticalmiles: D2 / 1852,
radians: 1,
yards: D2 * 1.0936
}, iR = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function T3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
$n(T3, "feature");
function $ft(t, e, r = {}) {
switch (t) {
case "Point":
return l4(e).geometry;
case "LineString":
return f4(e).geometry;
case "Polygon":
return vH(e).geometry;
case "MultiPoint":
return K$(e).geometry;
case "MultiLineString":
return X$(e).geometry;
case "MultiPolygon":
return Y$(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
$n($ft, "geometry");
function l4(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!rm(t[0]) || !rm(t[1]))
throw new Error("coordinates must contain numbers");
return T3({
type: "Point",
coordinates: t
}, e, r);
}
$n(l4, "point");
function Wft(t, e, r = {}) {
return Dg(
t.map((n) => l4(n, e)),
r
);
}
$n(Wft, "points");
function vH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return T3({
type: "Polygon",
coordinates: t
}, e, r);
}
$n(vH, "polygon");
function Zft(t, e, r = {}) {
return Dg(
t.map((n) => vH(n, e)),
r
);
}
$n(Zft, "polygons");
function f4(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return T3({
type: "LineString",
coordinates: t
}, e, r);
}
$n(f4, "lineString");
function qft(t, e, r = {}) {
return Dg(
t.map((n) => f4(n, e)),
r
);
}
$n(qft, "lineStrings");
function Dg(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
$n(Dg, "featureCollection");
function X$(t, e, r = {}) {
return T3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
$n(X$, "multiLineString");
function K$(t, e, r = {}) {
return T3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
$n(K$, "multiPoint");
function Y$(t, e, r = {}) {
return T3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
$n(Y$, "multiPolygon");
function Xft(t, e, r = {}) {
return T3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
$n(Xft, "geometryCollection");
function Kft(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
$n(Kft, "round");
function J$(t, e = "kilometers") {
const r = q$[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
$n(J$, "radiansToLength");
function _H(t, e = "kilometers") {
const r = q$[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
$n(_H, "lengthToRadians");
function Yft(t, e) {
return tW(_H(t, e));
}
$n(Yft, "lengthToDegrees");
function Jft(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
$n(Jft, "bearingToAzimuth");
function tW(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
$n(tW, "radiansToDegrees");
function tQt(t) {
return t % 360 * Math.PI / 180;
}
$n(tQt, "degreesToRadians");
function eQt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return J$(_H(t, e), r);
}
$n(eQt, "convertLength");
function rQt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = iR[e];
if (!n)
throw new Error("invalid original units");
const i = iR[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
$n(rQt, "convertArea");
function rm(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
$n(rm, "isNumber");
function bH(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
$n(bH, "isObject");
function nQt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!rm(e))
throw new Error("bbox must only contain numbers");
});
}
$n(nQt, "validateBBox");
function iQt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
$n(iQt, "validateId");
var oQt = Object.defineProperty, so = (t, e) => oQt(t, "name", { value: e, configurable: !0 });
function Ld(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = r && (F === "Polygon" || F === "MultiPolygon") ? 1 : 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (Ld(s.geometries[n], e, r) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
so(Ld, "coordEach");
function sQt(t, e, r, n) {
var i = r;
return Ld(
t,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
so(sQt, "coordReduce");
function eW(t, e) {
var r;
switch (t.type) {
case "FeatureCollection":
for (r = 0; r < t.features.length && e(t.features[r].properties, r) !== !1; r++)
;
break;
case "Feature":
e(t.properties, 0);
break;
}
}
so(eW, "propEach");
function aQt(t, e, r) {
var n = r;
return eW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(aQt, "propReduce");
function rW(t, e) {
if (t.type === "Feature")
e(t, 0);
else if (t.type === "FeatureCollection")
for (var r = 0; r < t.features.length && e(t.features[r], r) !== !1; r++)
;
}
so(rW, "featureEach");
function lQt(t, e, r) {
var n = r;
return rW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(lQt, "featureReduce");
function cQt(t) {
var e = [];
return Ld(t, function(r) {
e.push(r);
}), e;
}
so(cQt, "coordAll");
function LH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
so(LH, "geomEach");
function uQt(t, e, r) {
var n = r;
return LH(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
so(uQt, "geomReduce");
function Fg(t, e) {
LH(t, function(r, n, i, o, s) {
var a = r === null ? null : r.type;
switch (a) {
case null:
case "Point":
case "LineString":
case "Polygon":
return e(
T3(r, i, { bbox: o, id: s }),
n,
0
) === !1 ? !1 : void 0;
}
var u;
switch (a) {
case "MultiPoint":
u = "Point";
break;
case "MultiLineString":
u = "LineString";
break;
case "MultiPolygon":
u = "Polygon";
break;
}
for (var d = 0; d < r.coordinates.length; d++) {
var T = r.coordinates[d], f = {
type: u,
coordinates: T
};
if (e(T3(f, i), n, d) === !1)
return !1;
}
});
}
so(Fg, "flattenEach");
function hQt(t, e, r) {
var n = r;
return Fg(
t,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
so(hQt, "flattenReduce");
function nW(t, e) {
Fg(t, function(r, n, i) {
var o = 0;
if (r.geometry) {
var s = r.geometry.type;
if (!(s === "Point" || s === "MultiPoint")) {
var a, u = 0, d = 0, T = 0;
if (Ld(
r,
function(f, Q, y, _, L) {
if (a === void 0 || n > u || _ > d || L > T) {
a = f, u = n, d = _, T = L, o = 0;
return;
}
var E = f4(
[a, f],
r.properties
);
if (e(
E,
n,
i,
L,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
so(nW, "segmentEach");
function iW(t, e, r) {
var n = r, i = !1;
return nW(
t,
function(o, s, a, u, d) {
i === !1 && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = !0;
}
), n;
}
so(iW, "segmentReduce");
function oW(t, e) {
if (!t)
throw new Error("geojson is required");
Fg(t, function(r, n, i) {
if (r.geometry !== null) {
var o = r.geometry.type, s = r.geometry.coordinates;
switch (o) {
case "LineString":
if (e(r, n, i, 0, 0) === !1)
return !1;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
f4(s[a], r.properties),
n,
i,
a
) === !1)
return !1;
break;
}
}
});
}
so(oW, "lineEach");
function dQt(t, e, r) {
var n = r;
return oW(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
so(dQt, "lineReduce");
function pQt(t, e) {
if (e = e || {}, !bH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.segmentIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
case "MultiPoint":
return null;
case "LineString":
return o < 0 && (o = u.length + o - 1), f4(
[u[o], u[o + 1]],
s,
e
);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o - 1), f4(
[
u[i][o],
u[i][o + 1]
],
s,
e
);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o - 1), f4(
[
u[n][o],
u[n][o + 1]
],
s,
e
);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o - 1), f4(
[
u[n][i][o],
u[n][i][o + 1]
],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(pQt, "findSegment");
function TQt(t, e) {
if (e = e || {}, !bH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.coordIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
return l4(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), l4(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), l4(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), l4(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), l4(u[n][o], s, e);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o), l4(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(TQt, "findPoint");
var fQt = Object.defineProperty, QQt = (t, e) => fQt(t, "name", { value: e, configurable: !0 });
function sW(t, e = {}) {
return iW(
t,
(r, n) => {
const i = n.geometry.coordinates;
return r + m5(i[0], i[1], e);
},
0
);
}
QQt(sW, "length");
const QL = 1.3;
var Hf, Af, Of, c9;
class mQt {
constructor(e) {
Ft(this, Hf, void 0), Ft(this, Af, ""), Ft(this, Of, 0), Ft(this, c9, []), Jt(this, Hf, e);
}
get latestSource() {
return K(this, Af);
}
get knowledgeSchema() {
return K(this, Of);
}
async initialise() {
try {
const e = await this.loadJSON("knowledge/schema-version");
if (e === void 0)
return;
"version" in e && Jt(this, Of, +e.version);
const r = await this.loadJSON("knowledge/sources");
r && "sources" in r && (Jt(this, c9, r.sources), K(this, c9).length && Jt(this, Af, K(this, c9)[0]));
} catch {
}
}
url(e = "") {
return new URL(e, K(this, Hf)).href;
}
async loadJSON(e) {
const r = this.url(e);
try {
const n = await fetch(r, {
method: "GET",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store"
}
});
if (!n.ok)
throw new Error(`Cannot access ${r}`);
return await n.json();
} catch (n) {
throw n;
}
}
async queryKnowledge(e, r = []) {
const n = this.url("knowledge/query/"), i = { sql: e, params: r };
try {
const o = await fetch(n, {
method: "POST",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store",
"Content-Type": "application/json"
},
body: JSON.stringify(i)
});
if (!o.ok)
throw new Error(`Cannot access ${n}`);
const s = await o.json();
if ("error" in s)
throw new TypeError(s.error);
return s.values;
} catch (o) {
throw o;
}
}
}
Hf = /* @__PURE__ */ new WeakMap(), Af = /* @__PURE__ */ new WeakMap(), Of = /* @__PURE__ */ new WeakMap(), c9 = /* @__PURE__ */ new WeakMap();
function gQt(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);
}
}
function aW(t, e, r) {
return e && gQt(t.prototype, e), t;
}
function yQt(t, e, r) {
return e in t ? Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = r, t;
}
function oR(t, e) {
var r = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t);
e && (n = n.filter(function(i) {
return Object.getOwnPropertyDescriptor(t, i).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function F1(t) {
for (var e = 1; e < arguments.length; e++) {
var r = arguments[e] != null ? arguments[e] : {};
e % 2 ? oR(Object(r), !0).forEach(function(n) {
yQt(t, n, r[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : oR(Object(r)).forEach(function(n) {
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return t;
}
function vQt(t, e) {
if (t) {
if (typeof t == "string")
return sR(t, e);
var r = Object.prototype.toString.call(t).slice(8, -1);
if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set")
return Array.from(t);
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
return sR(t, e);
}
}
function sR(t, e) {
(e == null || e > t.length) && (e = t.length);
for (var r = 0, n = new Array(e); r < e; r++)
n[r] = t[r];
return n;
}
function lW(t, e) {
var r;
if (typeof Symbol > "u" || t[Symbol.iterator] == null) {
if (Array.isArray(t) || (r = vQt(t)) || e) {
r && (t = r);
var n = 0;
return function() {
return n >= t.length ? {
done: !0
} : {
done: !1,
value: t[n++]
};
};
}
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
return r = t[Symbol.iterator](), r.next.bind(r);
}
var mL = /* @__PURE__ */ function() {
function t(r, n) {
var i = r._tree, o = Object.keys(i);
this.set = r, this.type = n, this.path = o.length > 0 ? [{
node: i,
keys: o
}] : [];
}
var e = t.prototype;
return e.next = function() {
var r = this.dive();
return this.backtrack(), r;
}, e.dive = function() {
if (this.path.length === 0)
return {
done: !0
};
var r = g6(this.path), n = r.node, i = r.keys;
return g6(i) === $o ? {
done: !1,
value: this.result()
} : (this.path.push({
node: n[g6(i)],
keys: Object.keys(n[g6(i)])
}), this.dive());
}, e.backtrack = function() {
this.path.length !== 0 && (g6(this.path).keys.pop(), !(g6(this.path).keys.length > 0) && (this.path.pop(), this.backtrack()));
}, e.key = function() {
return this.set._prefix + this.path.map(function(r) {
var n = r.keys;
return g6(n);
}).filter(function(r) {
return r !== $o;
}).join("");
}, e.value = function() {
return g6(this.path).node[$o];
}, e.result = function() {
return this.type === uW ? this.value() : this.type === cW ? this.key() : [this.key(), this.value()];
}, e[Symbol.iterator] = function() {
return this;
}, t;
}(), _Qt = "ENTRIES", cW = "KEYS", uW = "VALUES", $o = "", g6 = function(t) {
return t[t.length - 1];
}, bQt = function(t, e, r) {
for (var n = [{
distance: 0,
i: 0,
key: "",
node: t
}], i = {}, o = [], s = function() {
var a = n.pop(), u = a.node, d = a.distance, T = a.key, f = a.i, Q = a.edit;
Object.keys(u).forEach(function(y) {
if (y === $o) {
var _ = d + (e.length - f), L = i[T] || [null, 1 / 0], E = L[1];
_ <= r && _ < E && (i[T] = [u[y], _]);
} else
LQt(e, y, r - d, f, Q, o).forEach(function(x) {
var O = x.distance, k = x.i, R = x.edit;
n.push({
node: u[y],
distance: d + O,
key: T + y,
i: k,
edit: R
});
});
});
}; n.length > 0; )
s();
return i;
}, LQt = function(t, e, r, n, i, o) {
o.push({
distance: 0,
ia: n,
ib: 0,
edit: i
});
for (var s = []; o.length > 0; ) {
var a = o.pop(), u = a.distance, d = a.ia, T = a.ib, f = a.edit;
if (T === e.length) {
s.push({
distance: u,
i: d,
edit: f
});
continue;
}
if (t[d] === e[T])
o.push({
distance: u,
ia: d + 1,
ib: T + 1,
edit: wQt
});
else {
if (u >= r)
continue;
f !== gL && o.push({
distance: u + 1,
ia: d,
ib: T + 1,
edit: yL
}), d < t.length && (f !== yL && o.push({
distance: u + 1,
ia: d + 1,
ib: T,
edit: gL
}), f !== yL && f !== gL && o.push({
distance: u + 1,
ia: d + 1,
ib: T + 1,
edit: xQt
}));
}
}
return s;
}, wQt = 0, xQt = 1, gL = 2, yL = 3, r0 = /* @__PURE__ */ function() {
function t(r, n) {
r === void 0 && (r = {}), n === void 0 && (n = ""), this._tree = r, this._prefix = n;
}
var e = t.prototype;
return e.atPrefix = function(r) {
if (!r.startsWith(this._prefix))
throw new Error("Mismatched prefix");
var n = hW(this._tree, r.slice(this._prefix.length)), i = n[0], o = n[1];
if (i === void 0) {
var s = wH(o), a = s[0], u = s[1], d = Object.keys(a).find(function(f) {
return f !== $o && f.startsWith(u);
});
if (d !== void 0) {
var T;
return new t((T = {}, T[d.slice(u.length)] = a[d], T), r);
}
}
return new t(i || {}, r);
}, e.clear = function() {
delete this._size, this._tree = {};
}, e.delete = function(r) {
return delete this._size, MQt(this._tree, r);
}, e.entries = function() {
return new mL(this, _Qt);
}, e.forEach = function(r) {
for (var n = lW(this), i; !(i = n()).done; ) {
var o = i.value, s = o[0], a = o[1];
r(s, a, this);
}
}, e.fuzzyGet = function(r, n) {
return bQt(this._tree, r, n);
}, e.get = function(r) {
var n = aR(this._tree, r);
return n !== void 0 ? n[$o] : void 0;
}, e.has = function(r) {
var n = aR(this._tree, r);
return n !== void 0 && n.hasOwnProperty($o);
}, e.keys = function() {
return new mL(this, cW);
}, e.set = function(r, n) {
if (typeof r != "string")
throw new Error("key must be a string");
delete this._size;
var i = lR(this._tree, r);
return i[$o] = n, this;
}, e.update = function(r, n) {
if (typeof r != "string")
throw new Error("key must be a string");
delete this._size;
var i = lR(this._tree, r);
return i[$o] = n(i[$o]), this;
}, e.values = function() {
return new mL(this, uW);
}, e[Symbol.iterator] = function() {
return this.entries();
}, aW(t, [{
key: "size",
get: function() {
var r = this;
return this._size ? this._size : (this._size = 0, this.forEach(function() {
r._size += 1;
}), this._size);
}
}]), t;
}();
r0.from = function(t) {
for (var e = new r0(), r = lW(t), n; !(n = r()).done; ) {
var i = n.value, o = i[0], s = i[1];
e.set(o, s);
}
return e;
};
r0.fromObject = function(t) {
return r0.from(Object.entries(t));
};
var hW = function t(e, r, n) {
if (n === void 0 && (n = []), r.length === 0)
return [e, n];
var i = Object.keys(e).find(function(o) {
return o !== $o && r.startsWith(o);
});
return i === void 0 ? t(void 0, "", [].concat(n, [[e, r]])) : t(e[i], r.slice(i.length), [].concat(n, [[e, i]]));
}, aR = function t(e, r) {
if (r.length === 0)
return e;
var n = Object.keys(e).find(function(i) {
return i !== $o && r.startsWith(i);
});
if (n !== void 0)
return t(e[n], r.slice(n.length));
}, lR = function t(e, r) {
if (r.length === 0)
return e;
var n = Object.keys(e).find(function(a) {
return a !== $o && r.startsWith(a);
});
if (n === void 0) {
var i = Object.keys(e).find(function(a) {
return a !== $o && a.startsWith(r[0]);
});
if (i === void 0)
e[r] = {};
else {
var o, s = EQt(r, i);
return e[s] = (o = {}, o[i.slice(s.length)] = e[i], o), delete e[i], t(e[s], r.slice(s.length));
}
return e[r];
}
return t(e[n], r.slice(n.length));
}, EQt = function t(e, r, n, i, o) {
return n === void 0 && (n = 0), i === void 0 && (i = Math.min(e.length, r.length)), o === void 0 && (o = ""), n >= i || e[n] !== r[n] ? o : t(e, r, n + 1, i, o + e[n]);
}, MQt = function(t, e) {
var r = hW(t, e), n = r[0], i = r[1];
if (n !== void 0) {
delete n[$o];
var o = Object.keys(n);
o.length === 0 && SQt(i), o.length === 1 && HQt(i, o[0], n[o[0]]);
}
}, SQt = function t(e) {
if (e.length !== 0) {
var r = wH(e), n = r[0], i = r[1];
delete n[i], Object.keys(n).length === 0 && t(e.slice(0, -1));
}
}, HQt = function(t, e, r) {
if (t.length !== 0) {
var n = wH(t), i = n[0], o = n[1];
i[o + e] = r, delete i[o];
}
}, wH = function(t) {
return t[t.length - 1];
}, hT, nm = "or", AQt = "and", dW = /* @__PURE__ */ function() {
function t(r) {
r === void 0 && (r = {}), this._options = F1(F1({}, bL), r), this._options.searchOptions = F1(F1({}, BQt), this._options.searchOptions || {});
var n = this._options.fields;
if (n == null)
throw new Error('MiniSearch: option "fields" must be provided');
this._index = new r0(), this._documentCount = 0, this._documentIds = {}, this._fieldIds = {}, this._fieldLength = {}, this._averageFieldLength = {}, this._nextId = 0, this._storedFields = {}, IQt(this, n);
}
var e = t.prototype;
return e.add = function(r) {
var n = this, i = this._options, o = i.extractField, s = i.tokenize, a = i.processTerm, u = i.fields, d = i.idField, T = o(r, d);
if (T == null)
throw new Error('MiniSearch: document does not have ID field "' + d + '"');
var f = kQt(this, T);
VQt(this, f, r), u.forEach(function(Q) {
var y = o(r, Q);
if (y != null) {
var _ = s(y.toString(), Q);
PQt(n, f, n._fieldIds[Q], n.documentCount - 1, _.length), _.forEach(function(L) {
var E = a(L, Q);
_L(E) && OQt(n, n._fieldIds[Q], f, E);
});
}
});
}, e.addAll = function(r) {
var n = this;
r.forEach(function(i) {
return n.add(i);
});
}, e.addAllAsync = function(r, n) {
var i = this;
n === void 0 && (n = {});
var o = n, s = o.chunkSize, a = s === void 0 ? 10 : s, u = {
chunk: [],
promise: Promise.resolve(null)
}, d = r.reduce(function(Q, y, _) {
var L = Q.chunk, E = Q.promise;
return L.push(y), (_ + 1) % a === 0 ? {
chunk: [],
promise: E.then(function() {
return i.addAll(L);
})
} : {
chunk: L,
promise: E
};
}, u), T = d.chunk, f = d.promise;
return f.then(function() {
return i.addAll(T);
});
}, e.remove = function(r) {
var n = this, i = this._options, o = i.tokenize, s = i.processTerm, a = i.extractField, u = i.fields, d = i.idField, T = a(r, d);
if (T == null)
throw new Error('MiniSearch: document does not have ID field "' + d + '"');
var f = Object.entries(this._documentIds).find(function(y) {
y[0];
var _ = y[1];
return T === _;
}) || [], Q = f[0];
if (Q == null)
throw new Error("MiniSearch: cannot remove document with ID " + T + ": it is not in the index");
u.forEach(function(y) {
var _ = a(r, y);
if (_ != null) {
var L = o(_.toString(), y);
L.forEach(function(E) {
var x = s(E, y);
_L(x) && CQt(n, n._fieldIds[y], Q, x);
});
}
}), delete this._storedFields[Q], delete this._documentIds[Q], this._documentCount -= 1;
}, e.removeAll = function(r) {
var n = this;
arguments.length === 0 ? (this._index = new r0(), this._documentCount = 0, this._documentIds = {}, this._fieldLength = {}, this._averageFieldLength = {}, this._storedFields = {}, this._nextId = 0) : r.forEach(function(i) {
return n.remove(i);
});
}, e.search = function(r, n) {
var i = this;
n === void 0 && (n = {});
var o = this._options, s = o.tokenize, a = o.processTerm, u = o.searchOptions;
n = F1(F1({
tokenize: s,
processTerm: a
}, u), n);
var d = n, T = d.tokenize, f = d.processTerm, Q = T(r).map(function(L) {
return f(L);
}).filter(_L).map(DQt(n)), y = Q.map(function(L) {
return i.executeQuery(L, n);
}), _ = this.combineResults(y, n.combineWith);
return Object.entries(_).reduce(function(L, E) {
var x = E[0], O = E[1], k = O.score, R = O.match, F = O.terms, U = {
id: i._documentIds[x],
terms: FQt(F),
score: k,
match: R
};
return Object.assign(U, i._storedFields[x]), (n.filter == null || n.filter(U)) && L.push(U), L;
}, []).sort(function(L, E) {
var x = L.score, O = E.score;
return x < O ? 1 : -1;
});
}, e.autoSuggest = function(r, n) {
n === void 0 && (n = {}), n = F1(F1({}, jQt), n);
var i = this.search(r, n).reduce(function(o, s) {
var a = s.score, u = s.terms, d = u.join(" ");
return o[d] == null ? o[d] = {
score: a,
terms: u,
count: 1
} : (o[d].score += a, o[d].count += 1), o;
}, {});
return Object.entries(i).map(function(o) {
var s = o[0], a = o[1], u = a.score, d = a.terms, T = a.count;
return {
suggestion: s,
terms: d,
score: u / T
};
}).sort(function(o, s) {
var a = o.score, u = s.score;
return a < u ? 1 : -1;
});
}, t.loadJSON = function(r, n) {
if (n == null)
throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
return t.loadJS(JSON.parse(r), n);
}, t.getDefault = function(r) {
if (bL.hasOwnProperty(r))
return bL[r];
throw new Error('MiniSearch: unknown option "' + r + '"');
}, t.loadJS = function(r, n) {
n === void 0 && (n = {});
var i = r.index, o = r.documentCount, s = r.nextId, a = r.documentIds, u = r.fieldIds, d = r.fieldLength, T = r.averageFieldLength, f = r.storedFields, Q = new t(n);
return Q._index = new r0(i._tree, i._prefix), Q._documentCount = o, Q._nextId = s, Q._documentIds = a, Q._fieldIds = u, Q._fieldLength = d, Q._averageFieldLength = T, Q._fieldIds = u, Q._storedFields = f || {}, Q;
}, e.executeQuery = function(r, n) {
var i = this;
n === void 0 && (n = {}), n = F1(F1({}, this._options.searchOptions), n);
var o = (n.fields || this._options.fields).reduce(function(E, x) {
var O;
return F1(F1({}, E), {}, (O = {}, O[x] = pW(E, x) || 1, O));
}, n.boost || {}), s = n, a = s.boostDocument, u = s.weights, d = u.fuzzy, T = d === void 0 ? 0.9 : d, f = u.prefix, Q = f === void 0 ? 0.75 : f, y = vL(this, r.term, o, a, this._index.get(r.term));
if (!r.fuzzy && !r.prefix)
return y;
var _ = [y];
if (r.prefix && this._index.atPrefix(r.term).forEach(function(E, x) {
var O = 0.3 * (E.length - r.term.length) / E.length;
_.push(vL(i, E, o, a, x, Q, O));
}), r.fuzzy) {
var L = r.fuzzy < 1 ? Math.round(r.term.length * r.fuzzy) : r.fuzzy;
Object.entries(this._index.fuzzyGet(r.term, L)).forEach(function(E) {
var x = E[0], O = E[1], k = O[0], R = O[1], F = R / x.length;
_.push(vL(i, x, o, a, k, T, F));
});
}
return _.reduce(uR[nm], {});
}, e.combineResults = function(r, n) {
if (n === void 0 && (n = nm), r.length === 0)
return {};
var i = n.toLowerCase();
return r.reduce(uR[i], null);
}, e.toJSON = function() {
return {
index: this._index,
documentCount: this._documentCount,
nextId: this._nextId,
documentIds: this._documentIds,
fieldIds: this._fieldIds,
fieldLength: this._fieldLength,
averageFieldLength: this._averageFieldLength,
storedFields: this._storedFields
};
}, aW(t, [{
key: "documentCount",
get: function() {
return this._documentCount;
}
}]), t;
}();
dW.SearchableMap = r0;
var OQt = function(t, e, r, n) {
t._index.update(n, function(i) {
var o;
i = i || {};
var s = i[e] || {
df: 0,
ds: {}
};
return s.ds[r] == null && (s.df += 1), s.ds[r] = (s.ds[r] || 0) + 1, F1(F1({}, i), {}, (o = {}, o[e] = s, o));
});
}, CQt = function(t, e, r, n) {
if (!t._index.has(n)) {
cR(t, r, e, n);
return;
}
t._index.update(n, function(i) {
var o, s = i[e];
if (s == null || s.ds[r] == null)
return cR(t, r, e, n), i;
if (s.ds[r] <= 1) {
if (s.df <= 1)
return delete i[e], i;
s.df -= 1;
}
return s.ds[r] <= 1 ? (delete s.ds[r], i) : (s.ds[r] -= 1, F1(F1({}, i), {}, (o = {}, o[e] = s, o)));
}), Object.keys(t._index.get(n)).length === 0 && t._index.delete(n);
}, cR = function(t, e, r, n) {
if (!(console == null || console.warn == null)) {
var i = Object.entries(t._fieldIds).find(function(o) {
o[0];
var s = o[1];
return s === r;
})[0];
console.warn("MiniSearch: document with ID " + t._documentIds[e] + ' has changed before removal: term "' + n + '" was not present in field "' + i + '". Removing a document after it has changed can corrupt the index!');
}
}, kQt = function(t, e) {
var r = t._nextId.toString(36);
return t._documentIds[r] = e, t._documentCount += 1, t._nextId += 1, r;
}, IQt = function(t, e) {
e.forEach(function(r, n) {
t._fieldIds[r] = n;
});
}, vL = function(t, e, r, n, i, o, s) {
return s === void 0 && (s = 0), i == null ? {} : Object.entries(r).reduce(function(a, u) {
var d = u[0], T = u[1], f = t._fieldIds[d], Q = i[f] || {
ds: {}
}, y = Q.df, _ = Q.ds;
return Object.entries(_).forEach(function(L) {
var E = L[0], x = L[1], O = n ? n(t._documentIds[E], e) : 1;
if (O) {
var k = t._fieldLength[E][f] / t._averageFieldLength[f];
a[E] = a[E] || {
score: 0,
match: {},
terms: []
}, a[E].terms.push(e), a[E].match[e] = pW(a[E].match, e) || [], a[E].score += O * NQt(x, y, t._documentCount, k, T, s), a[E].match[e].push(d);
}
}), a;
}, {});
}, pW = function(t, e) {
return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
}, PQt = function(t, e, r, n, i) {
t._averageFieldLength[r] = t._averageFieldLength[r] || 0;
var o = t._averageFieldLength[r] * n + i;
t._fieldLength[e] = t._fieldLength[e] || {}, t._fieldLength[e][r] = i, t._averageFieldLength[r] = o / (n + 1);
}, VQt = function(t, e, r) {
var n = t._options, i = n.storeFields, o = n.extractField;
i == null || i.length === 0 || (t._storedFields[e] = t._storedFields[e] || {}, i.forEach(function(s) {
var a = o(r, s);
a !== void 0 && (t._storedFields[e][s] = a);
}));
}, uR = (hT = {}, hT[nm] = function(t, e) {
return Object.entries(e).reduce(function(r, n) {
var i = n[0], o = n[1], s = o.score, a = o.match, u = o.terms;
return r[i] == null ? r[i] = {
score: s,
match: a,
terms: u
} : (r[i].score += s, r[i].score *= 1.5, r[i].terms = [].concat(r[i].terms, u), Object.assign(r[i].match, a)), r;
}, t || {});
}, hT[AQt] = function(t, e) {
return t == null ? e : Object.entries(e).reduce(function(r, n) {
var i = n[0], o = n[1], s = o.score, a = o.match, u = o.terms;
return t[i] === void 0 || (r[i] = r[i] || {}, r[i].score = t[i].score + s, r[i].match = F1(F1({}, t[i].match), a), r[i].terms = [].concat(t[i].terms, u)), r;
}, {});
}, hT), RQt = function(t, e, r) {
return t * Math.log(r / e);
}, NQt = function(t, e, r, n, i, o) {
var s = i / (1 + 0.333 * i * o);
return s * RQt(t, e, r) / n;
}, DQt = function(t) {
return function(e, r, n) {
var i = typeof t.fuzzy == "function" ? t.fuzzy(e, r, n) : t.fuzzy, o = typeof t.prefix == "function" ? t.prefix(e, r, n) : t.prefix;
return {
term: e,
fuzzy: i,
prefix: o
};
};
}, FQt = function(t) {
return t.filter(function(e, r, n) {
return n.indexOf(e) === r;
});
}, _L = function(t) {
return !!t;
}, bL = {
idField: "id",
extractField: function(t, e) {
return t[e];
},
tokenize: function(t, e) {
return t.split(zQt);
},
processTerm: function(t, e) {
return t.toLowerCase();
},
fields: void 0,
searchOptions: void 0,
storeFields: []
}, BQt = {
combineWith: nm,
prefix: !1,
fuzzy: !1,
weights: {}
}, jQt = {
prefix: function(t, e, r) {
return e === r.length - 1;
}
}, zQt = /[\n\r -#%-\*,-\/:;\?@\[-\]_\{\}\xA0\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/;
const TW = [
"id",
"label",
"models",
"source"
];
var u9, i5;
class UQt {
constructor() {
Ft(this, u9, []), Ft(this, i5, void 0), Jt(this, i5, new dW({
fields: ["text"],
storeFields: ["text"],
tokenize: (e, r) => e.split(" ")
}));
}
indexMetadata(e, r) {
const n = [];
for (const i of TW)
if (i in r) {
const o = r[i];
n.includes(o) || (this.indexText(e, o), n.push(o));
}
}
indexText(e, r) {
r = r.replace(new RegExp("
", "g"), " ").replace(new RegExp(`
`, "g"), " "), r && (K(this, i5).add({
id: K(this, u9).length,
text: r
}), K(this, u9).push(e));
}
auto_suggest(e) {
return K(this, i5).autoSuggest(e, { prefix: !0 });
}
search(e) {
let r = [];
e = e.trim(), e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), r = K(this, i5).search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (r = K(this, i5).search(e, { prefix: !0 }));
const n = r.map((i) => ({
featureId: K(this, u9)[i.id],
score: i.score,
terms: i.terms,
text: i.text
}));
return new GQt(n);
}
}
u9 = /* @__PURE__ */ new WeakMap(), i5 = /* @__PURE__ */ new WeakMap();
var Cf, kf;
class GQt {
constructor(e) {
Ft(this, Cf, void 0), Ft(this, kf, void 0), Jt(this, kf, e.sort((r, n) => n.score - r.score)), Jt(this, Cf, e.map((r) => r.featureId));
}
get featureIds() {
return K(this, Cf);
}
get results() {
return K(this, kf);
}
}
Cf = /* @__PURE__ */ new WeakMap(), kf = /* @__PURE__ */ new WeakMap();
function fW(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (fW(s.geometries[n], e) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
function $Qt(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
function WQt(t, e, r) {
var n = r;
return $Qt(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
var hR = 6378137;
function ZQt(t) {
return WQt(t, function(e, r) {
return e + qQt(r);
}, 0);
}
function qQt(t) {
var e = 0, r;
switch (t.type) {
case "Polygon":
return dR(t.coordinates);
case "MultiPolygon":
for (r = 0; r < t.coordinates.length; r++)
e += dR(t.coordinates[r]);
return e;
case "Point":
case "MultiPoint":
case "LineString":
case "MultiLineString":
return 0;
}
return 0;
}
function dR(t) {
var e = 0;
if (t && t.length > 0) {
e += Math.abs(pR(t[0]));
for (var r = 1; r < t.length; r++)
e -= Math.abs(pR(t[r]));
}
return e;
}
function pR(t) {
var e, r, n, i, o, s, a, u = 0, d = t.length;
if (d > 2) {
for (a = 0; a < d; a++)
a === d - 2 ? (i = d - 2, o = d - 1, s = 0) : a === d - 1 ? (i = d - 1, o = 0, s = 1) : (i = a, o = a + 1, s = a + 2), e = t[i], r = t[o], n = t[s], u += (LL(n[0]) - LL(e[0])) * Math.sin(LL(r[1]));
u = u * hR * hR / 2;
}
return u;
}
function LL(t) {
return t * Math.PI / 180;
}
function XQt(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
function dT(t) {
return t % 360 * Math.PI / 180;
}
function TR(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function xH(t, e, r = {}) {
if (r.final === !0)
return KQt(t, e);
const n = TR(t), i = TR(e), o = dT(n[0]), s = dT(i[0]), a = dT(n[1]), u = dT(i[1]), d = Math.sin(s - o) * Math.cos(u), T = Math.cos(a) * Math.sin(u) - Math.sin(a) * Math.cos(u) * Math.cos(s - o);
return XQt(Math.atan2(d, T));
}
function KQt(t, e) {
let r = xH(e, t);
return r = (r + 180) % 360, r;
}
var F2 = 63710088e-1, YQt = {
centimeters: F2 * 100,
centimetres: F2 * 100,
degrees: 360 / (2 * Math.PI),
feet: F2 * 3.28084,
inches: F2 * 39.37,
kilometers: F2 / 1e3,
kilometres: F2 / 1e3,
meters: F2,
metres: F2,
miles: F2 / 1609.344,
millimeters: F2 * 1e3,
millimetres: F2 * 1e3,
nauticalmiles: F2 / 1852,
radians: 1,
yards: F2 * 1.0936
};
function JQt(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
function tmt(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!QR(t[0]) || !QR(t[1]))
throw new Error("coordinates must contain numbers");
return JQt({
type: "Point",
coordinates: t
}, e, r);
}
function emt(t, e = "kilometers") {
const r = YQt[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
function fR(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
function wL(t) {
return t % 360 * Math.PI / 180;
}
function QR(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
function rmt(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function nE(t, e, r, n = {}) {
const i = rmt(t), o = wL(i[0]), s = wL(i[1]), a = wL(r), u = emt(e, n.units), d = Math.asin(
Math.sin(s) * Math.cos(u) + Math.cos(s) * Math.sin(u) * Math.cos(a)
), T = o + Math.atan2(
Math.sin(a) * Math.sin(u) * Math.cos(s),
Math.cos(u) - Math.sin(s) * Math.sin(d)
), f = fR(T), Q = fR(d);
return tmt([f, Q], n.properties);
}
function nmt(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = {}, n.geometry = t, n;
}
function mR(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!gR(t[0]) || !gR(t[1]))
throw new Error("coordinates must contain numbers");
return nmt({
type: "Point",
coordinates: t
}, e, r);
}
function gR(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
function imt(t) {
return t.type === "Feature" ? t.geometry : t;
}
function omt(t, e, r = {}) {
const n = imt(t).coordinates;
let i = 0;
for (let o = 0; o < n.length && !(e >= i && o === n.length - 1); o++)
if (i >= e) {
const s = e - i;
if (s) {
const a = xH(n[o], n[o - 1]) - 180;
return nE(
n[o],
s,
a,
r
);
} else
return mR(n[o]);
} else
i += m5(n[o], n[o + 1], r);
return mR(n[n.length - 1]);
}
var smt = omt, amt = Object.defineProperty, Wn = (t, e) => amt(t, "name", { value: e, configurable: !0 }), lmt = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !h9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = iE(t), n = iE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!h9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return h9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? yH(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return h9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
Wn(lmt, "GeojsonEquality");
function h9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Wn(h9, "sameLength");
function iE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Wn(iE, "explode");
var B2 = 63710088e-1, QW = {
centimeters: B2 * 100,
centimetres: B2 * 100,
degrees: 360 / (2 * Math.PI),
feet: B2 * 3.28084,
inches: B2 * 39.37,
kilometers: B2 / 1e3,
kilometres: B2 / 1e3,
meters: B2,
metres: B2,
miles: B2 / 1609.344,
millimeters: B2 * 1e3,
millimetres: B2 * 1e3,
nauticalmiles: B2 / 1852,
radians: 1,
yards: B2 * 1.0936
}, yR = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function f3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
Wn(f3, "feature");
function cmt(t, e, r = {}) {
switch (t) {
case "Point":
return Bg(e).geometry;
case "LineString":
return MH(e).geometry;
case "Polygon":
return EH(e).geometry;
case "MultiPoint":
return gW(e).geometry;
case "MultiLineString":
return mW(e).geometry;
case "MultiPolygon":
return yW(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Wn(cmt, "geometry");
function Bg(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!im(t[0]) || !im(t[1]))
throw new Error("coordinates must contain numbers");
return f3({
type: "Point",
coordinates: t
}, e, r);
}
Wn(Bg, "point");
function umt(t, e, r = {}) {
return O8(
t.map((n) => Bg(n, e)),
r
);
}
Wn(umt, "points");
function EH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return f3({
type: "Polygon",
coordinates: t
}, e, r);
}
Wn(EH, "polygon");
function hmt(t, e, r = {}) {
return O8(
t.map((n) => EH(n, e)),
r
);
}
Wn(hmt, "polygons");
function MH(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return f3({
type: "LineString",
coordinates: t
}, e, r);
}
Wn(MH, "lineString");
function dmt(t, e, r = {}) {
return O8(
t.map((n) => MH(n, e)),
r
);
}
Wn(dmt, "lineStrings");
function O8(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
Wn(O8, "featureCollection");
function mW(t, e, r = {}) {
return f3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Wn(mW, "multiLineString");
function gW(t, e, r = {}) {
return f3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Wn(gW, "multiPoint");
function yW(t, e, r = {}) {
return f3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Wn(yW, "multiPolygon");
function pmt(t, e, r = {}) {
return f3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Wn(pmt, "geometryCollection");
function Tmt(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
Wn(Tmt, "round");
function vW(t, e = "kilometers") {
const r = QW[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Wn(vW, "radiansToLength");
function SH(t, e = "kilometers") {
const r = QW[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Wn(SH, "lengthToRadians");
function fmt(t, e) {
return _W(SH(t, e));
}
Wn(fmt, "lengthToDegrees");
function Qmt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Wn(Qmt, "bearingToAzimuth");
function _W(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Wn(_W, "radiansToDegrees");
function mmt(t) {
return t % 360 * Math.PI / 180;
}
Wn(mmt, "degreesToRadians");
function gmt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return vW(SH(t, e), r);
}
Wn(gmt, "convertLength");
function ymt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = yR[e];
if (!n)
throw new Error("invalid original units");
const i = yR[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
Wn(ymt, "convertArea");
function im(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Wn(im, "isNumber");
function vmt(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Wn(vmt, "isObject");
function _mt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!im(e))
throw new Error("bbox must only contain numbers");
});
}
Wn(_mt, "validateBBox");
function bmt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
Wn(bmt, "validateId");
let bW = class {
constructor(t = [], e = Lmt) {
if (this.data = t, this.length = this.data.length, this.compare = e, this.length > 0)
for (let r = (this.length >> 1) - 1; r >= 0; r--)
this._down(r);
}
push(t) {
this.data.push(t), this.length++, this._up(this.length - 1);
}
pop() {
if (this.length === 0)
return;
const t = this.data[0], e = this.data.pop();
return this.length--, this.length > 0 && (this.data[0] = e, this._down(0)), t;
}
peek() {
return this.data[0];
}
_up(t) {
const { data: e, compare: r } = this, n = e[t];
for (; t > 0; ) {
const i = t - 1 >> 1, o = e[i];
if (r(n, o) >= 0)
break;
e[t] = o, t = i;
}
e[t] = n;
}
_down(t) {
const { data: e, compare: r } = this, n = this.length >> 1, i = e[t];
for (; t < n; ) {
let o = (t << 1) + 1, s = e[o];
const a = o + 1;
if (a < this.length && r(e[a], s) < 0 && (o = a, s = e[a]), r(s, i) >= 0)
break;
e[t] = s, t = o;
}
e[t] = i;
}
};
function Lmt(t, e) {
return t < e ? -1 : t > e ? 1 : 0;
}
function LW(t, e) {
return t.p.x > e.p.x ? 1 : t.p.x < e.p.x ? -1 : t.p.y !== e.p.y ? t.p.y > e.p.y ? 1 : -1 : 1;
}
function wmt(t, e) {
return t.rightSweepEvent.p.x > e.rightSweepEvent.p.x ? 1 : t.rightSweepEvent.p.x < e.rightSweepEvent.p.x ? -1 : t.rightSweepEvent.p.y !== e.rightSweepEvent.p.y ? t.rightSweepEvent.p.y < e.rightSweepEvent.p.y ? 1 : -1 : 1;
}
class vR {
constructor(e, r, n, i) {
this.p = {
x: e[0],
y: e[1]
}, this.featureId = r, this.ringId = n, this.eventId = i, this.otherEvent = null, this.isLeftEndpoint = null;
}
isSamePoint(e) {
return this.p.x === e.p.x && this.p.y === e.p.y;
}
}
function xmt(t, e) {
if (t.type === "FeatureCollection") {
const r = t.features;
for (let n = 0; n < r.length; n++)
_R(r[n], e);
} else
_R(t, e);
}
let pT = 0, TT = 0, fT = 0;
function _R(t, e) {
const r = t.type === "Feature" ? t.geometry : t;
let n = r.coordinates;
(r.type === "Polygon" || r.type === "MultiLineString") && (n = [n]), r.type === "LineString" && (n = [[n]]);
for (let i = 0; i < n.length; i++)
for (let o = 0; o < n[i].length; o++) {
let s = n[i][o][0], a = null;
TT = TT + 1;
for (let u = 0; u < n[i][o].length - 1; u++) {
a = n[i][o][u + 1];
const d = new vR(s, pT, TT, fT), T = new vR(a, pT, TT, fT + 1);
d.otherEvent = T, T.otherEvent = d, LW(d, T) > 0 ? (T.isLeftEndpoint = !0, d.isLeftEndpoint = !1) : (d.isLeftEndpoint = !0, T.isLeftEndpoint = !1), e.push(d), e.push(T), s = a, fT = fT + 1;
}
}
pT = pT + 1;
}
class Emt {
constructor(e) {
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
}
}
function Mmt(t, e) {
if (t === null || e === null || t.leftSweepEvent.ringId === e.leftSweepEvent.ringId && (t.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t.rightSweepEvent.isSamePoint(e.rightSweepEvent) || t.leftSweepEvent.isSamePoint(e.leftSweepEvent) || t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))
return !1;
const r = t.leftSweepEvent.p.x, n = t.leftSweepEvent.p.y, i = t.rightSweepEvent.p.x, o = t.rightSweepEvent.p.y, s = e.leftSweepEvent.p.x, a = e.leftSweepEvent.p.y, u = e.rightSweepEvent.p.x, d = e.rightSweepEvent.p.y, T = (d - a) * (i - r) - (u - s) * (o - n), f = (u - s) * (n - a) - (d - a) * (r - s), Q = (i - r) * (n - a) - (o - n) * (r - s);
if (T === 0)
return !1;
const y = f / T, _ = Q / T;
if (y >= 0 && y <= 1 && _ >= 0 && _ <= 1) {
const L = r + y * (i - r), E = n + y * (o - n);
return [L, E];
}
return !1;
}
function Smt(t, e) {
e = e || !1;
const r = [], n = new bW([], wmt);
for (; t.length; ) {
const i = t.pop();
if (i.isLeftEndpoint) {
const o = new Emt(i);
for (let s = 0; s < n.data.length; s++) {
const a = n.data[s];
if (e && a.leftSweepEvent.featureId === i.featureId)
continue;
const u = Mmt(o, a);
u !== !1 && r.push(u);
}
n.push(o);
} else
i.isLeftEndpoint === !1 && n.pop();
}
return r;
}
function Hmt(t, e) {
const r = new bW([], LW);
return xmt(t, r), Smt(r, e);
}
var Amt = Object.defineProperty, Omt = (t, e) => Amt(t, "name", { value: e, configurable: !0 }), Cmt = Hmt;
function wW(t, e, r = {}) {
const { removeDuplicates: n = !0, ignoreSelfIntersections: i = !1 } = r;
let o = [];
t.type === "FeatureCollection" ? o = o.concat(t.features) : t.type === "Feature" ? o.push(t) : (t.type === "LineString" || t.type === "Polygon" || t.type === "MultiLineString" || t.type === "MultiPolygon") && o.push(f3(t)), e.type === "FeatureCollection" ? o = o.concat(e.features) : e.type === "Feature" ? o.push(e) : (e.type === "LineString" || e.type === "Polygon" || e.type === "MultiLineString" || e.type === "MultiPolygon") && o.push(f3(e));
const s = Cmt(
O8(o),
i
);
let a = [];
if (n) {
const u = {};
s.forEach((d) => {
const T = d.join(",");
u[T] || (u[T] = !0, a.push(d));
});
} else
a = s;
return O8(a.map((u) => Bg(u)));
}
Omt(wW, "lineIntersect");
var kmt = Object.defineProperty, Zn = (t, e) => kmt(t, "name", { value: e, configurable: !0 }), Imt = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !d9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = oE(t), n = oE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!d9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return d9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? yH(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return d9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
Zn(Imt, "GeojsonEquality");
function d9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Zn(d9, "sameLength");
function oE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Zn(oE, "explode");
var j2 = 63710088e-1, xW = {
centimeters: j2 * 100,
centimetres: j2 * 100,
degrees: 360 / (2 * Math.PI),
feet: j2 * 3.28084,
inches: j2 * 39.37,
kilometers: j2 / 1e3,
kilometres: j2 / 1e3,
meters: j2,
metres: j2,
miles: j2 / 1609.344,
millimeters: j2 * 1e3,
millimetres: j2 * 1e3,
nauticalmiles: j2 / 1852,
radians: 1,
yards: j2 * 1.0936
}, bR = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function Q3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
Zn(Q3, "feature");
function Pmt(t, e, r = {}) {
switch (t) {
case "Point":
return Es(e).geometry;
case "LineString":
return ra(e).geometry;
case "Polygon":
return HH(e).geometry;
case "MultiPoint":
return MW(e).geometry;
case "MultiLineString":
return EW(e).geometry;
case "MultiPolygon":
return SW(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Zn(Pmt, "geometry");
function Es(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!C8(t[0]) || !C8(t[1]))
throw new Error("coordinates must contain numbers");
return Q3({
type: "Point",
coordinates: t
}, e, r);
}
Zn(Es, "point");
function Vmt(t, e, r = {}) {
return jg(
t.map((n) => Es(n, e)),
r
);
}
Zn(Vmt, "points");
function HH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return Q3({
type: "Polygon",
coordinates: t
}, e, r);
}
Zn(HH, "polygon");
function Rmt(t, e, r = {}) {
return jg(
t.map((n) => HH(n, e)),
r
);
}
Zn(Rmt, "polygons");
function ra(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return Q3({
type: "LineString",
coordinates: t
}, e, r);
}
Zn(ra, "lineString");
function Nmt(t, e, r = {}) {
return jg(
t.map((n) => ra(n, e)),
r
);
}
Zn(Nmt, "lineStrings");
function jg(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
Zn(jg, "featureCollection");
function EW(t, e, r = {}) {
return Q3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Zn(EW, "multiLineString");
function MW(t, e, r = {}) {
return Q3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Zn(MW, "multiPoint");
function SW(t, e, r = {}) {
return Q3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Zn(SW, "multiPolygon");
function Dmt(t, e, r = {}) {
return Q3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Zn(Dmt, "geometryCollection");
function Fmt(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
Zn(Fmt, "round");
function HW(t, e = "kilometers") {
const r = xW[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Zn(HW, "radiansToLength");
function AH(t, e = "kilometers") {
const r = xW[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Zn(AH, "lengthToRadians");
function Bmt(t, e) {
return AW(AH(t, e));
}
Zn(Bmt, "lengthToDegrees");
function jmt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Zn(jmt, "bearingToAzimuth");
function AW(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Zn(AW, "radiansToDegrees");
function zmt(t) {
return t % 360 * Math.PI / 180;
}
Zn(zmt, "degreesToRadians");
function Umt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return HW(AH(t, e), r);
}
Zn(Umt, "convertLength");
function Gmt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = bR[e];
if (!n)
throw new Error("invalid original units");
const i = bR[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
Zn(Gmt, "convertArea");
function C8(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Zn(C8, "isNumber");
function OH(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Zn(OH, "isObject");
function $mt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!C8(e))
throw new Error("bbox must only contain numbers");
});
}
Zn($mt, "validateBBox");
function Wmt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
Zn(Wmt, "validateId");
var Zmt = Object.defineProperty, ao = (t, e) => Zmt(t, "name", { value: e, configurable: !0 });
function wd(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = r && (F === "Polygon" || F === "MultiPolygon") ? 1 : 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (wd(s.geometries[n], e, r) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
ao(wd, "coordEach");
function qmt(t, e, r, n) {
var i = r;
return wd(
t,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
ao(qmt, "coordReduce");
function OW(t, e) {
var r;
switch (t.type) {
case "FeatureCollection":
for (r = 0; r < t.features.length && e(t.features[r].properties, r) !== !1; r++)
;
break;
case "Feature":
e(t.properties, 0);
break;
}
}
ao(OW, "propEach");
function Xmt(t, e, r) {
var n = r;
return OW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Xmt, "propReduce");
function CW(t, e) {
if (t.type === "Feature")
e(t, 0);
else if (t.type === "FeatureCollection")
for (var r = 0; r < t.features.length && e(t.features[r], r) !== !1; r++)
;
}
ao(CW, "featureEach");
function Kmt(t, e, r) {
var n = r;
return CW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Kmt, "featureReduce");
function Ymt(t) {
var e = [];
return wd(t, function(r) {
e.push(r);
}), e;
}
ao(Ymt, "coordAll");
function CH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
ao(CH, "geomEach");
function Jmt(t, e, r) {
var n = r;
return CH(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
ao(Jmt, "geomReduce");
function xd(t, e) {
CH(t, function(r, n, i, o, s) {
var a = r === null ? null : r.type;
switch (a) {
case null:
case "Point":
case "LineString":
case "Polygon":
return e(
Q3(r, i, { bbox: o, id: s }),
n,
0
) === !1 ? !1 : void 0;
}
var u;
switch (a) {
case "MultiPoint":
u = "Point";
break;
case "MultiLineString":
u = "LineString";
break;
case "MultiPolygon":
u = "Polygon";
break;
}
for (var d = 0; d < r.coordinates.length; d++) {
var T = r.coordinates[d], f = {
type: u,
coordinates: T
};
if (e(Q3(f, i), n, d) === !1)
return !1;
}
});
}
ao(xd, "flattenEach");
function tgt(t, e, r) {
var n = r;
return xd(
t,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
ao(tgt, "flattenReduce");
function kW(t, e) {
xd(t, function(r, n, i) {
var o = 0;
if (r.geometry) {
var s = r.geometry.type;
if (!(s === "Point" || s === "MultiPoint")) {
var a, u = 0, d = 0, T = 0;
if (wd(
r,
function(f, Q, y, _, L) {
if (a === void 0 || n > u || _ > d || L > T) {
a = f, u = n, d = _, T = L, o = 0;
return;
}
var E = ra(
[a, f],
r.properties
);
if (e(
E,
n,
i,
L,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
ao(kW, "segmentEach");
function egt(t, e, r) {
var n = r, i = !1;
return kW(
t,
function(o, s, a, u, d) {
i === !1 && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = !0;
}
), n;
}
ao(egt, "segmentReduce");
function IW(t, e) {
if (!t)
throw new Error("geojson is required");
xd(t, function(r, n, i) {
if (r.geometry !== null) {
var o = r.geometry.type, s = r.geometry.coordinates;
switch (o) {
case "LineString":
if (e(r, n, i, 0, 0) === !1)
return !1;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
ra(s[a], r.properties),
n,
i,
a
) === !1)
return !1;
break;
}
}
});
}
ao(IW, "lineEach");
function rgt(t, e, r) {
var n = r;
return IW(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
ao(rgt, "lineReduce");
function ngt(t, e) {
if (e = e || {}, !OH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.segmentIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
case "MultiPoint":
return null;
case "LineString":
return o < 0 && (o = u.length + o - 1), ra(
[u[o], u[o + 1]],
s,
e
);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o - 1), ra(
[
u[i][o],
u[i][o + 1]
],
s,
e
);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o - 1), ra(
[
u[n][o],
u[n][o + 1]
],
s,
e
);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o - 1), ra(
[
u[n][i][o],
u[n][i][o + 1]
],
s,
e
);
}
throw new Error("geojson is invalid");
}
ao(ngt, "findSegment");
function igt(t, e) {
if (e = e || {}, !OH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.coordIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
return Es(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), Es(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), Es(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), Es(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), Es(u[n][o], s, e);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o), Es(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
ao(igt, "findPoint");
var ogt = Object.defineProperty, Q0 = (t, e) => ogt(t, "name", { value: e, configurable: !0 });
function sgt(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
Q0(sgt, "getCoord");
function PW(t) {
if (Array.isArray(t))
return t;
if (t.type === "Feature") {
if (t.geometry !== null)
return t.geometry.coordinates;
} else if (t.coordinates)
return t.coordinates;
throw new Error(
"coords must be GeoJSON Feature, Geometry Object or an Array"
);
}
Q0(PW, "getCoords");
function VW(t) {
if (t.length > 1 && C8(t[0]) && C8(t[1]))
return !0;
if (Array.isArray(t[0]) && t[0].length)
return VW(t[0]);
throw new Error("coordinates must only contain numbers");
}
Q0(VW, "containsNumber");
function agt(t, e, r) {
if (!e || !r)
throw new Error("type and name required");
if (!t || t.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t.type
);
}
Q0(agt, "geojsonType");
function lgt(t, e, r) {
if (!t)
throw new Error("No feature passed");
if (!r)
throw new Error(".featureOf() requires a name");
if (!t || t.type !== "Feature" || !t.geometry)
throw new Error(
"Invalid input to " + r + ", Feature with geometry required"
);
if (!t.geometry || t.geometry.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t.geometry.type
);
}
Q0(lgt, "featureOf");
function cgt(t, e, r) {
if (!t)
throw new Error("No featureCollection passed");
if (!r)
throw new Error(".collectionOf() requires a name");
if (!t || t.type !== "FeatureCollection")
throw new Error(
"Invalid input to " + r + ", FeatureCollection required"
);
for (const n of t.features) {
if (!n || n.type !== "Feature" || !n.geometry)
throw new Error(
"Invalid input to " + r + ", Feature with geometry required"
);
if (!n.geometry || n.geometry.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + n.geometry.type
);
}
}
Q0(cgt, "collectionOf");
function ugt(t) {
return t.type === "Feature" ? t.geometry : t;
}
Q0(ugt, "getGeom");
function hgt(t, e) {
return t.type === "FeatureCollection" ? "FeatureCollection" : t.type === "GeometryCollection" ? "GeometryCollection" : t.type === "Feature" && t.geometry !== null ? t.geometry.type : t.type;
}
Q0(hgt, "getType");
var RW = Object.defineProperty, dgt = Object.defineProperties, pgt = Object.getOwnPropertyDescriptors, LR = Object.getOwnPropertySymbols, Tgt = Object.prototype.hasOwnProperty, fgt = Object.prototype.propertyIsEnumerable, wR = (t, e, r) => e in t ? RW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, G0 = (t, e) => {
for (var r in e || (e = {}))
Tgt.call(e, r) && wR(t, r, e[r]);
if (LR)
for (var r of LR(e))
fgt.call(e, r) && wR(t, r, e[r]);
return t;
}, $0 = (t, e) => dgt(t, pgt(e)), Qgt = (t, e) => RW(t, "name", { value: e, configurable: !0 });
function NW(t, e, r = {}) {
if (!t || !e)
throw new Error("lines and pt are required arguments");
let n = Es([1 / 0, 1 / 0], {
dist: 1 / 0,
index: -1,
location: -1
}), i = 0;
return xd(t, function(o) {
const s = PW(o);
for (let a = 0; a < s.length - 1; a++) {
const u = Es(s[a]);
u.properties.dist = m5(e, u, r);
const d = Es(s[a + 1]);
d.properties.dist = m5(e, d, r);
const T = m5(u, d, r), f = Math.max(
u.properties.dist,
d.properties.dist
), Q = xH(u, d), y = nE(
e,
f,
Q + 90,
r
), _ = nE(
e,
f,
Q - 90,
r
), L = wW(
ra([
y.geometry.coordinates,
_.geometry.coordinates
]),
ra([u.geometry.coordinates, d.geometry.coordinates])
);
let E;
L.features.length > 0 && L.features[0] && (E = $0(G0({}, L.features[0]), {
properties: {
dist: m5(e, L.features[0], r),
location: i + m5(u, L.features[0], r)
}
})), u.properties.dist < n.properties.dist && (n = $0(G0({}, u), {
properties: $0(G0({}, u.properties), { index: a, location: i })
})), d.properties.dist < n.properties.dist && (n = $0(G0({}, d), {
properties: $0(G0({}, d.properties), {
index: a + 1,
location: i + T
})
})), E && E.properties.dist < n.properties.dist && (n = $0(G0({}, E), {
properties: $0(G0({}, E.properties), { index: a })
})), i += T;
}
}), n;
}
Qgt(NW, "nearestPointOnLine");
function mgt(t) {
if (!t)
throw new Error("geojson is required");
switch (t.type) {
case "Feature":
return DW(t);
case "FeatureCollection":
return ggt(t);
case "Point":
case "LineString":
case "Polygon":
case "MultiPoint":
case "MultiLineString":
case "MultiPolygon":
case "GeometryCollection":
return kH(t);
default:
throw new Error("unknown GeoJSON type");
}
}
function DW(t) {
var e = { type: "Feature" };
return Object.keys(t).forEach(function(r) {
switch (r) {
case "type":
case "properties":
case "geometry":
return;
default:
e[r] = t[r];
}
}), e.properties = FW(t.properties), e.geometry = kH(t.geometry), e;
}
function FW(t) {
var e = {};
return t && Object.keys(t).forEach(function(r) {
var n = t[r];
typeof n == "object" ? n === null ? e[r] = null : Array.isArray(n) ? e[r] = n.map(function(i) {
return i;
}) : e[r] = FW(n) : e[r] = n;
}), e;
}
function ggt(t) {
var e = { type: "FeatureCollection" };
return Object.keys(t).forEach(function(r) {
switch (r) {
case "type":
case "features":
return;
default:
e[r] = t[r];
}
}), e.features = t.features.map(function(r) {
return DW(r);
}), e;
}
function kH(t) {
var e = { type: t.type };
return t.bbox && (e.bbox = t.bbox), t.type === "GeometryCollection" ? (e.geometries = t.geometries.map(function(r) {
return kH(r);
}), e) : (e.coordinates = BW(t.coordinates), e);
}
function BW(t) {
var e = t;
return typeof e[0] != "object" ? e.slice() : e.map(function(r) {
return BW(r);
});
}
function ygt(t, e) {
return e === void 0 && (e = {}), vgt(t, "mercator", e);
}
function vgt(t, e, r) {
r === void 0 && (r = {}), r = r || {};
var n = r.mutate;
if (!t)
throw new Error("geojson is required");
return Array.isArray(t) && Px(t[0]) ? t = xR(t) : (n !== !0 && (t = mgt(t)), fW(t, function(i) {
var o = xR(i);
i[0] = o[0], i[1] = o[1];
})), t;
}
function xR(t) {
var e = Math.PI / 180, r = 6378137, n = 20037508342789244e-9, i = Math.abs(t[0]) <= 180 ? t[0] : t[0] - _gt(t[0]) * 360, o = [
r * i * e,
r * Math.log(Math.tan(Math.PI * 0.25 + 0.5 * t[1] * e))
];
return o[0] > n && (o[0] = n), o[0] < -n && (o[0] = -n), o[1] > n && (o[1] = n), o[1] < -n && (o[1] = -n), o;
}
function _gt(t) {
return t < 0 ? -1 : t > 0 ? 1 : 0;
}
class bgt {
constructor(e = [], r = (n, i) => n < i ? -1 : n > i ? 1 : 0) {
if (this.data = e, this.length = this.data.length, this.compare = r, this.length > 0)
for (let n = (this.length >> 1) - 1; n >= 0; n--)
this._down(n);
}
push(e) {
this.data.push(e), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const e = this.data[0], r = this.data.pop();
return --this.length > 0 && (this.data[0] = r, this._down(0)), e;
}
peek() {
return this.data[0];
}
_up(e) {
const { data: r, compare: n } = this, i = r[e];
for (; e > 0; ) {
const o = e - 1 >> 1, s = r[o];
if (n(i, s) >= 0)
break;
r[e] = s, e = o;
}
r[e] = i;
}
_down(e) {
const { data: r, compare: n } = this, i = this.length >> 1, o = r[e];
for (; e < i; ) {
let s = (e << 1) + 1;
const a = s + 1;
if (a < this.length && n(r[a], r[s]) < 0 && (s = a), n(r[s], o) >= 0)
break;
r[e] = r[s], e = s;
}
r[e] = o;
}
}
function Lgt(t, e = 1, r = !1) {
let n = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
for (const [x, O] of t[0])
x < n && (n = x), O < i && (i = O), x > o && (o = x), O > s && (s = O);
const a = o - n, u = s - i, d = Math.max(e, Math.min(a, u));
if (d === e) {
const x = [n, i];
return x.distance = 0, x;
}
const T = new bgt([], (x, O) => O.max - x.max);
let f = xgt(t);
const Q = new om(n + a / 2, i + u / 2, 0, t);
Q.d > f.d && (f = Q);
let y = 2;
function _(x, O, k) {
const R = new om(x, O, k, t);
y++, R.max > f.d + e && T.push(R), R.d > f.d && (f = R, r && console.log(`found best ${Math.round(1e4 * R.d) / 1e4} after ${y} probes`));
}
let L = d / 2;
for (let x = n; x < o; x += d)
for (let O = i; O < s; O += d)
_(x + L, O + L, L);
for (; T.length; ) {
const { max: x, x: O, y: k, h: R } = T.pop();
if (x - f.d <= e)
break;
L = R / 2, _(O - L, k - L, L), _(O + L, k - L, L), _(O - L, k + L, L), _(O + L, k + L, L);
}
r && console.log(`num probes: ${y}
best distance: ${f.d}`);
const E = [f.x, f.y];
return E.distance = f.d, E;
}
function om(t, e, r, n) {
this.x = t, this.y = e, this.h = r, this.d = wgt(t, e, n), this.max = this.d + this.h * Math.SQRT2;
}
function wgt(t, e, r) {
let n = !1, i = 1 / 0;
for (const o of r)
for (let s = 0, a = o.length, u = a - 1; s < a; u = s++) {
const d = o[s], T = o[u];
d[1] > e != T[1] > e && t < (T[0] - d[0]) * (e - d[1]) / (T[1] - d[1]) + d[0] && (n = !n), i = Math.min(i, Egt(t, e, d, T));
}
return i === 0 ? 0 : (n ? 1 : -1) * Math.sqrt(i);
}
function xgt(t) {
let e = 0, r = 0, n = 0;
const i = t[0];
for (let s = 0, a = i.length, u = a - 1; s < a; u = s++) {
const d = i[s], T = i[u], f = d[0] * T[1] - T[0] * d[1];
r += (d[0] + T[0]) * f, n += (d[1] + T[1]) * f, e += f * 3;
}
const o = new om(r / e, n / e, 0, t);
return e === 0 || o.d < 0 ? new om(i[0][0], i[0][1], 0, t) : o;
}
function Egt(t, e, r, n) {
let i = r[0], o = r[1], s = n[0] - i, a = n[1] - o;
if (s !== 0 || a !== 0) {
const u = ((t - i) * s + (e - o) * a) / (s * s + a * a);
u > 1 ? (i = n[0], o = n[1]) : u > 0 && (i += s * u, o += a * u);
}
return s = t - i, a = e - o, s * s + a * a;
}
var di, sh, If, ah, Pf;
class v4 {
constructor(e = !0) {
Ft(this, sh), Ft(this, ah), Ft(this, di, void 0), e.constructor !== Object ? Jt(this, di, e) : Jt(this, di, Object.assign({}, e));
}
get filter() {
return K(this, di);
}
clear() {
K(this, di) !== !0 && Jt(this, di, !0);
}
expand(e) {
if (K(this, di) === !1)
Jt(this, di, e);
else if (K(this, di) !== !0) {
const r = Object.assign({}, e);
Jt(this, di, { OR: [K(this, di), r] });
}
}
invert() {
if (K(this, di) === !1)
Jt(this, di, !0);
else if (K(this, di) === !0)
Jt(this, di, !1);
else {
const e = Object.assign({}, K(this, di));
Jt(this, di, { NOT: e });
}
}
getStyleFilter() {
return se(this, sh, If).call(this, K(this, di));
}
match(e) {
return se(this, ah, Pf).call(this, e, K(this, di));
}
narrow(e) {
if (K(this, di) === !0)
Jt(this, di, e);
else if (K(this, di) !== !1) {
const r = Object.assign({}, e);
Jt(this, di, { AND: [K(this, di), r] });
}
}
setFilter(e) {
e.constructor !== Object ? Jt(this, di, e) : Jt(this, di, Object.assign({}, e));
}
}
di = /* @__PURE__ */ new WeakMap(), sh = /* @__PURE__ */ new WeakSet(), If = function(t) {
if (t.constructor !== Object)
return ["boolean", !!t];
const e = [];
for (const [r, n] of Object.entries(t))
if (r === "AND" || r === "OR")
Array.isArray(n) && n.length >= 1 ? e.push(
r === "AND" ? "all" : "any",
...n.map((i) => se(this, sh, If).call(this, i))
) : console.warn(`makeFilter: Invalid ${r} operands: ${n}`);
else if (r === "EMPTY")
e.push("==", ["get", n], "[]");
else if (r === "HAS")
e.push("has", n);
else if (r === "IN")
e.push("in", n[0], ["get", n[1]]);
else if (r === "NOT") {
const i = se(this, sh, If).call(this, n);
Array.isArray(i) ? i.length === 3 && ["==", "!="].includes(i[0]) ? i[0] === "==" ? e.push("!=", i[1], i[2]) : e.push("==", i[1], i[2]) : e.push("!", i) : e.push(!i);
} else
Array.isArray(n) ? e.push("any", ...n.map((i) => ["==", ["get", r], i])) : e.push("==", ["get", r], n);
return e;
}, ah = /* @__PURE__ */ new WeakSet(), Pf = function(t, e) {
if (e.constructor !== Object)
return !!e;
for (const [r, n] of Object.entries(e)) {
let i = !0;
if (r === "AND" || r === "OR")
if (Array.isArray(n) && n.length >= 1) {
const o = n.map((s) => se(this, ah, Pf).call(this, t, s));
i = r === "AND" ? o.reduce((s, a) => s && a, !0) : o.reduce((s, a) => s || a, !1);
} else
console.warn(`makeFilter: Invalid ${r} operands: ${n}`);
else if (r === "EMPTY") {
const o = t[n] || void 0;
i = !Array.isArray(o) || o.length === 0;
} else if (r === "HAS")
i = n in t;
else if (r === "IN") {
const o = t[n[1]] || void 0;
i = !Array.isArray(o) || o.includes(n[0]);
} else if (r === "NOT")
i = !se(this, ah, Pf).call(this, t, n);
else if (r in t) {
const o = t[r];
Array.isArray(o) ? Array.isArray(n) ? i = !new j6(o).isDisjointFrom(new j6(n)) : i = o.includes(n) : Array.isArray(n) ? i = n.includes(o) : i = o === n;
}
if (!i)
return !1;
}
return !0;
};
var Mgt = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, Z3 = function(t) {
return typeof t == "string" ? t.length > 0 : typeof t == "number";
}, z1 = function(t, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = Math.pow(10, e)), Math.round(r * t) / r + 0;
}, Ms = function(t, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = 1), t > r ? r : t > e ? t : e;
}, jW = function(t) {
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
}, ER = function(t) {
return { r: Ms(t.r, 0, 255), g: Ms(t.g, 0, 255), b: Ms(t.b, 0, 255), a: Ms(t.a) };
}, xL = function(t) {
return { r: z1(t.r), g: z1(t.g), b: z1(t.b), a: z1(t.a, 3) };
}, Sgt = /^#([0-9a-f]{3,8})$/i, QT = function(t) {
var e = t.toString(16);
return e.length < 2 ? "0" + e : e;
}, zW = function(t) {
var e = t.r, r = t.g, n = t.b, i = t.a, o = Math.max(e, r, n), s = o - Math.min(e, r, n), a = s ? o === e ? (r - n) / s : o === r ? 2 + (n - e) / s : 4 + (e - r) / s : 0;
return { h: 60 * (a < 0 ? a + 6 : a), s: o ? s / o * 100 : 0, v: o / 255 * 100, a: i };
}, UW = function(t) {
var e = t.h, r = t.s, n = t.v, i = t.a;
e = e / 360 * 6, r /= 100, n /= 100;
var o = Math.floor(e), s = n * (1 - r), a = n * (1 - (e - o) * r), u = n * (1 - (1 - e + o) * r), d = o % 6;
return { r: 255 * [n, a, s, s, u, n][d], g: 255 * [u, n, n, a, s, s][d], b: 255 * [s, s, u, n, n, a][d], a: i };
}, MR = function(t) {
return { h: jW(t.h), s: Ms(t.s, 0, 100), l: Ms(t.l, 0, 100), a: Ms(t.a) };
}, SR = function(t) {
return { h: z1(t.h), s: z1(t.s), l: z1(t.l), a: z1(t.a, 3) };
}, HR = function(t) {
return UW((r = (e = t).s, { h: e.h, s: (r *= ((n = e.l) < 50 ? n : 100 - n) / 100) > 0 ? 2 * r / (n + r) * 100 : 0, v: n + r, a: e.a }));
var e, r, n;
}, lh = function(t) {
return { h: (e = zW(t)).h, s: (i = (200 - (r = e.s)) * (n = e.v) / 100) > 0 && i < 200 ? r * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
var e, r, n, i;
}, Hgt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Agt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ogt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Cgt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, AR = { string: [[function(t) {
var e = Sgt.exec(t);
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? z1(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? z1(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
}, "hex"], [function(t) {
var e = Ogt.exec(t) || Cgt.exec(t);
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : ER({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
}, "rgb"], [function(t) {
var e = Hgt.exec(t) || Agt.exec(t);
if (!e)
return null;
var r, n, i = MR({ h: (r = e[1], n = e[2], n === void 0 && (n = "deg"), Number(r) * (Mgt[n] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
return HR(i);
}, "hsl"]], object: [[function(t) {
var e = t.r, r = t.g, n = t.b, i = t.a, o = i === void 0 ? 1 : i;
return Z3(e) && Z3(r) && Z3(n) ? ER({ r: Number(e), g: Number(r), b: Number(n), a: Number(o) }) : null;
}, "rgb"], [function(t) {
var e = t.h, r = t.s, n = t.l, i = t.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = MR({ h: Number(e), s: Number(r), l: Number(n), a: Number(o) });
return HR(s);
}, "hsl"], [function(t) {
var e = t.h, r = t.s, n = t.v, i = t.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = function(a) {
return { h: jW(a.h), s: Ms(a.s, 0, 100), v: Ms(a.v, 0, 100), a: Ms(a.a) };
}({ h: Number(e), s: Number(r), v: Number(n), a: Number(o) });
return UW(s);
}, "hsv"]] }, OR = function(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r][0](t);
if (n)
return [n, e[r][1]];
}
return [null, void 0];
}, kgt = function(t) {
return typeof t == "string" ? OR(t.trim(), AR.string) : typeof t == "object" && t !== null ? OR(t, AR.object) : [null, void 0];
}, EL = function(t, e) {
var r = lh(t);
return { h: r.h, s: Ms(r.s + 100 * e, 0, 100), l: r.l, a: r.a };
}, ML = function(t) {
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
}, CR = function(t, e) {
var r = lh(t);
return { h: r.h, s: r.s, l: Ms(r.l + 100 * e, 0, 100), a: r.a };
}, kR = function() {
function t(e) {
this.parsed = kgt(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
}
return t.prototype.isValid = function() {
return this.parsed !== null;
}, t.prototype.brightness = function() {
return z1(ML(this.rgba), 2);
}, t.prototype.isDark = function() {
return ML(this.rgba) < 0.5;
}, t.prototype.isLight = function() {
return ML(this.rgba) >= 0.5;
}, t.prototype.toHex = function() {
return e = xL(this.rgba), r = e.r, n = e.g, i = e.b, s = (o = e.a) < 1 ? QT(z1(255 * o)) : "", "#" + QT(r) + QT(n) + QT(i) + s;
var e, r, n, i, o, s;
}, t.prototype.toRgb = function() {
return xL(this.rgba);
}, t.prototype.toRgbString = function() {
return e = xL(this.rgba), r = e.r, n = e.g, i = e.b, (o = e.a) < 1 ? "rgba(" + r + ", " + n + ", " + i + ", " + o + ")" : "rgb(" + r + ", " + n + ", " + i + ")";
var e, r, n, i, o;
}, t.prototype.toHsl = function() {
return SR(lh(this.rgba));
}, t.prototype.toHslString = function() {
return e = SR(lh(this.rgba)), r = e.h, n = e.s, i = e.l, (o = e.a) < 1 ? "hsla(" + r + ", " + n + "%, " + i + "%, " + o + ")" : "hsl(" + r + ", " + n + "%, " + i + "%)";
var e, r, n, i, o;
}, t.prototype.toHsv = function() {
return e = zW(this.rgba), { h: z1(e.h), s: z1(e.s), v: z1(e.v), a: z1(e.a, 3) };
var e;
}, t.prototype.invert = function() {
return ja({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
var e;
}, t.prototype.saturate = function(e) {
return e === void 0 && (e = 0.1), ja(EL(this.rgba, e));
}, t.prototype.desaturate = function(e) {
return e === void 0 && (e = 0.1), ja(EL(this.rgba, -e));
}, t.prototype.grayscale = function() {
return ja(EL(this.rgba, -1));
}, t.prototype.lighten = function(e) {
return e === void 0 && (e = 0.1), ja(CR(this.rgba, e));
}, t.prototype.darken = function(e) {
return e === void 0 && (e = 0.1), ja(CR(this.rgba, -e));
}, t.prototype.rotate = function(e) {
return e === void 0 && (e = 15), this.hue(this.hue() + e);
}, t.prototype.alpha = function(e) {
return typeof e == "number" ? ja({ r: (r = this.rgba).r, g: r.g, b: r.b, a: e }) : z1(this.rgba.a, 3);
var r;
}, t.prototype.hue = function(e) {
var r = lh(this.rgba);
return typeof e == "number" ? ja({ h: e, s: r.s, l: r.l, a: r.a }) : z1(r.h);
}, t.prototype.isEqual = function(e) {
return this.toHex() === ja(e).toHex();
}, t;
}(), ja = function(t) {
return t instanceof kR ? t : new kR(t);
};
const IR = {
ILX: 7,
UBERON: 7
};
class zg extends Array {
constructor(e = null) {
super(), e !== null && this.extend(e);
}
append(e) {
return super.push(e), this;
}
contains(e) {
return super.includes(e);
}
extend(e) {
if (this === e)
throw new Error("Cannot extend a list with itself...");
return e && super.push(...e), this;
}
slice(e, r) {
return new zg(Array(...this).slice(e, r));
}
}
var p9;
class Igt {
constructor() {
Ft(this, p9, void 0), Jt(this, p9, Promise.resolve());
}
lock() {
let e = (r) => {
};
return Jt(this, p9, K(this, p9).then(() => new Promise(e))), new Promise((r) => {
e = r;
});
}
async dispatch(e) {
const r = await this.lock();
try {
return await Promise.resolve(e());
} finally {
r();
}
}
}
p9 = /* @__PURE__ */ new WeakMap();
function mT(t) {
if (!t.includes(":"))
return t;
const e = t.split(":"), r = e[e.length - 1];
return e[0].toUpperCase() in IR && "0123456789".includes(r[0]) ? (e[e.length - 1] = r.padStart(IR[e[0].toUpperCase()], "0"), e.join(":")) : t;
}
function d8(t, e) {
if (t == null)
return e;
for (const [r, n] of Object.entries(e))
r in t || (t[r] = n);
return t;
}
function PR(t) {
const e = /* @__PURE__ */ new Map();
for (const [r, n] of t.entries())
for (const i of n)
e.has(i) ? e.get(i).add(r) : e.set(i, /* @__PURE__ */ new Set([r]));
return e;
}
function Pgt(t, e = 0) {
let r;
return function(...n) {
clearTimeout(r), r = setTimeout(() => t.apply(this, n), e);
};
}
const _s = "pathways", Vgt = "ilxtr:", sm = [
{ type: "cns", label: "CNS", colour: "#9B1FC1" },
{ type: "intracardiac", label: "Local circuit neuron", colour: "#F19E38" },
{ type: "para-pre", label: "Parasympathetic pre-ganglionic", colour: "#3F8F4A" },
{ type: "para-post", label: "Parasympathetic post-ganglionic", colour: "#3F8F4A", dashed: !0 },
{ type: "sensory", label: "Sensory (afferent) neuron", colour: "#2A62F6" },
{ type: "motor", label: "Somatic lower motor", colour: "#98561D" },
{ type: "somatic", label: "Somatic lower motor", colour: "#98561D" },
{ type: "symp-pre", label: "Sympathetic pre-ganglionic", colour: "#EA3423" },
{ type: "symp-post", label: "Sympathetic post-ganglionic", colour: "#EA3423", dashed: !0 },
{ type: "other", label: "Other neuron type", colour: "#888" },
{ type: "arterial", label: "Arterial blood vessel", colour: "#F00", enabled: !1 },
{ type: "venous", label: "Venous blood vessel", colour: "#2F6EBA", enabled: !1 },
{ type: "centreline", label: "Nerve centrelines", colour: "#CCC", enabled: !1 },
{ type: "error", label: "Paths with errors or warnings", colour: "#FF0", enabled: !1 }
], Vf = new Map(sm.map((t) => [t.type, t])), GW = sm.flatMap((t) => [["==", ["get", "kind"], t.type], t.colour]);
function Rgt(t, e = 255) {
const r = ja(Vf.has(t) ? Vf.get(t).colour : Vf.get("other").colour).toRgb();
return [r.r, r.g, r.b, e];
}
const Ngt = ["NO-NERVES", "No associated nerves"];
var Rf, T9, x7, f9, Nf, Q9, J3, A6, s4, E7, za, c4, O6, m9, M7, C6, t4, o5, sE, $W, Ua, e4, WW, S7, ch, Df, aE;
class Dgt {
constructor(e, r) {
if (Ft(this, sE), Ft(this, Ua), Ft(this, WW), Ft(this, Df), Ft(this, Rf, void 0), Ft(this, T9, /* @__PURE__ */ new Map()), Ft(this, x7, void 0), Ft(this, f9, !1), Ft(this, Nf, void 0), Ft(this, Q9, !0), Ft(this, J3, void 0), Ft(this, A6, /* @__PURE__ */ new Map()), Ft(this, s4, void 0), Ft(this, E7, /* @__PURE__ */ new Map()), Ft(this, za, void 0), Ft(this, c4, void 0), Ft(this, O6, void 0), Ft(this, m9, void 0), Ft(this, M7, void 0), Ft(this, C6, void 0), Ft(this, t4, void 0), Ft(this, o5, void 0), Ft(this, S7, 0), Ft(this, ch, /* @__PURE__ */ new Map()), Jt(this, Nf, e), Jt(this, o5, r), Jt(this, x7, {}), Jt(this, M7, {}), "models" in e.pathways)
for (const a of e.pathways.models) {
K(this, x7)[a.id] = a.paths;
for (const u of a.paths)
K(this, M7)[u] = a.id;
}
Jt(this, za, {}), Jt(this, C6, {}), Jt(this, c4, {});
const n = /* @__PURE__ */ new Map();
if (e.pathways.paths, "paths" in e.pathways)
for (const [a, u] of Object.entries(e.pathways.paths)) {
if (K(this, E7).set(a, u.lines), n.set(a, u.nerves), K(this, c4)[a] = u, K(this, c4)[a].systemCount = 0, "models" in u) {
const d = u.models;
d in K(this, za) || (K(this, za)[d] = []), K(this, za)[d].push(a), K(this, C6)[a] = d;
}
for (const d of u.centrelines || [])
K(this, A6).has(d) || K(this, A6).set(d, /* @__PURE__ */ new Set()), K(this, A6).get(d).add(a);
}
Jt(this, O6, PR(K(this, E7))), Jt(this, m9, PR(n));
const i = e.pathways["node-paths"];
Jt(this, J3, i);
const o = /* @__PURE__ */ new Set();
for (const a of Object.values(K(this, J3)))
se(this, Ua, e4).call(this, a, o);
Jt(this, Rf, o);
const s = {};
Jt(this, t4, {});
for (const a of sm)
s[a.type] = a, K(this, t4)[a.type] = !("enabled" in a) || a.enabled;
Jt(this, s4, {}), K(this, s4).other = [];
for (const [a, u] of Object.entries(e.pathways["type-paths"]))
if (a in s ? K(this, s4)[a] = u : (K(this, s4).other.push(...u), K(this, t4)[a] = !1), a === "centreline")
for (const d of u) {
const T = e.annotationById(d);
(e.options.style === no.CENTRELINE || K(this, A6).has(d)) && T && "models" in T && K(this, T9).set(T.models, T.label || T.models);
}
se(this, sE, $W).call(this), e.options.style === no.CENTRELINE ? Jt(this, f9, !0) : Jt(this, Q9, K(this, T9).size > 0);
}
get nerveCentrelineDetails() {
return [Ngt, ...K(this, T9).entries()].map((e) => {
const r = e[1];
return {
models: e[0],
label: r.charAt(0).toUpperCase() + r.slice(1)
};
});
}
get haveCentrelines() {
return K(this, Q9);
}
get enabledCentrelines() {
return K(this, f9);
}
pathStyles() {
const e = [];
for (const r of this.pathTypes()) {
const n = Vf.get(r.type);
e.push({
type: n.type,
colour: n.colour,
dashed: n.dashed || !1
});
}
return e;
}
pathTypes() {
const e = [];
for (const r of sm)
r.type in K(this, s4) && K(this, s4)[r.type].length > 0 && (r.type === "centreline" ? K(this, Nf).options.style !== no.CENTRELINE && (Jt(this, Q9, !0), Jt(this, f9, K(this, t4)[r.type])) : e.push({
...r,
enabled: K(this, t4)[r.type]
}));
return e;
}
allFeatureIds() {
return K(this, Rf);
}
lineFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
for (const n of e)
K(this, O6).has(n) && se(this, Ua, e4).call(this, K(this, O6).get(n), r);
return r;
}
nerveFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return K(this, m9).has(e) && se(this, Ua, e4).call(this, K(this, m9).get(e), r), r;
}
pathProperties(e) {
const r = Object.assign({}, e.properties);
if (K(this, O6).has(e.id))
for (const n of K(this, O6).get(e.id))
n in K(this, M7) && (r.connectivity = K(this, M7)[n]), n in K(this, C6) && (r.models = K(this, C6)[n]);
return r;
}
connectivityModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, x7) && se(this, Ua, e4).call(this, K(this, x7)[e], r), r;
}
pathModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, za) && se(this, Ua, e4).call(this, K(this, za)[e], r), r;
}
isNode(e) {
return e in K(this, J3);
}
pathFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, J3) && se(this, Ua, e4).call(this, K(this, J3)[e], r), r;
}
enablePathLines(e, r = !1) {
for (const n of K(this, O6).keys())
K(this, o5).enableFeature(n, e, r);
}
enablePathsByCentreline(e, r, n = !1) {
if (K(this, A6).has(e)) {
if (K(this, E7).has(e))
for (const o of K(this, E7).get(e))
K(this, o5).enableFeature(o, r, n);
const i = /* @__PURE__ */ new Set();
se(this, Ua, e4).call(this, K(this, A6).get(e), i);
for (const o of i)
K(this, o5).enableFeature(o, r, n);
se(this, Df, aE).call(this);
}
}
enablePathsBySystem(e, r, n = !1) {
let i = !1;
for (const o of e.pathIds) {
const s = K(this, c4)[o];
if (K(this, t4)[s.pathType] && (n || r && s.systemCount === 0 || !r && s.systemCount == 1)) {
const a = /* @__PURE__ */ new Set();
se(this, Ua, e4).call(this, [o], a);
for (const u of a)
K(this, o5).enableFeature(u, r, n);
i = !0;
}
s.systemCount += r ? 1 : -1, s.systemCount < 0 && (s.systemCount = 0);
}
i && se(this, Df, aE).call(this);
}
pathTypeEnabled(e) {
return K(this, t4)[e] || !1;
}
nodePathModels(e) {
const r = /* @__PURE__ */ new Set();
if (e in K(this, J3))
for (const n of K(this, J3)[e])
n in K(this, C6) && r.add(K(this, C6)[n]);
return r;
}
pathModelNodes(e) {
const r = /* @__PURE__ */ new Set();
if (e in K(this, za))
for (const n of K(this, za)[e])
for (const i of K(this, c4)[n].nodes)
r.add(i);
return r;
}
addWatcher(e) {
return Jt(this, S7, K(this, S7) + 1), K(this, ch).set(K(this, S7), e), K(this, S7);
}
removeWatcher(e) {
K(this, ch).delete(e);
}
}
Rf = /* @__PURE__ */ new WeakMap(), T9 = /* @__PURE__ */ new WeakMap(), x7 = /* @__PURE__ */ new WeakMap(), f9 = /* @__PURE__ */ new WeakMap(), Nf = /* @__PURE__ */ new WeakMap(), Q9 = /* @__PURE__ */ new WeakMap(), J3 = /* @__PURE__ */ new WeakMap(), A6 = /* @__PURE__ */ new WeakMap(), s4 = /* @__PURE__ */ new WeakMap(), E7 = /* @__PURE__ */ new WeakMap(), za = /* @__PURE__ */ new WeakMap(), c4 = /* @__PURE__ */ new WeakMap(), O6 = /* @__PURE__ */ new WeakMap(), m9 = /* @__PURE__ */ new WeakMap(), M7 = /* @__PURE__ */ new WeakMap(), C6 = /* @__PURE__ */ new WeakMap(), t4 = /* @__PURE__ */ new WeakMap(), o5 = /* @__PURE__ */ new WeakMap(), sE = /* @__PURE__ */ new WeakSet(), $W = function() {
for (const [t, e] of Object.entries(K(this, s4)))
for (const r of e)
K(this, c4)[r].pathType = t;
}, Ua = /* @__PURE__ */ new WeakSet(), e4 = function(t, e) {
for (const r of t) {
const n = K(this, c4)[r];
n.lines.forEach((i) => e.add(i)), n.nerves.forEach((i) => e.add(i)), n.nodes.forEach((i) => e.add(i));
}
}, WW = /* @__PURE__ */ new WeakSet(), S7 = /* @__PURE__ */ new WeakMap(), ch = /* @__PURE__ */ new WeakMap(), Df = /* @__PURE__ */ new WeakSet(), aE = function(t = {}) {
for (const e of K(this, ch).values())
e(t);
};
const ZW = class H7 {
/************************
* Public functions
***********************/
/**
* Adds an image template to the SvgTemplateManager.
* @param templateName The name of the template.
* @param template The SVG template to add. Supports `{color}`, `{secondaryColor}`, `{scale}`, and `{text}`
* @param override Specifies if it should override existing templates if one with the same name already exists.
*/
static addTemplate(e, r, n) {
const i = H7._imageTemplates;
(n || !i[e.toLowerCase()]) && (i[e.toLowerCase()] = r);
}
/**
* Inflates a template and converts it into an HTMLElement.
* @param templateName The name of the template to inflate.
* @param text Text to display in the template.
* @param color Primary color.
* @param secondaryColor Secondary colors.
* @param scale Scale of the template.
* @returns
*/
static getElement(e, r = "", n = "#1A73AA", i = "white", o = 1) {
const s = document.createElement("div");
return s.innerHTML = H7._applyStyle(e, r, n, i, o), s;
}
/**
* Retrieves an SVG template by name.
* @param templateName The name of the template to retrieve.
* @param scale Optional. A value indicating how much to scale the image.
*/
static getTemplate(e, r = 1) {
r = Math.abs(r || 1);
const n = H7._imageTemplates;
if (typeof e == "string" && n[e.toLowerCase()]) {
const i = n[e.toLowerCase()], o = /calc\(([0-9.]+)[px]*\s*\*\s*\{scale\}\)/gi;
let s = i, a = o.exec(i);
for (; a; )
s = s.replace(a[0], parseFloat(a[1]) * r + ""), a = o.exec(i);
return s = s.replace("{scale}", r + ""), s;
} else
throw new Error("Invalid templateName.");
}
/**
* Gets the name of all image templates loaded into the SvgTemplateManager
*/
static getAllTemplateNames() {
return Object.keys(H7._imageTemplates);
}
/**
* Fills in the placeholder values of a template with the given values
* @param templateName Name of the template to use.
* @param text Text to display in the template.
* @param color Primary color.
* @param secondaryColor Secondary colors.
* @param scale Scale of the template.
* @returns HTML string of the filled template.
*/
static _applyStyle(e, r = "", n = "#1A73AA", i = "white", o = 1) {
n = n || "#1A73AA", i = i || "#fff";
let s = H7.getTemplate(e, o);
return s = s.replace(/{color}/g, n).replace(/{secondaryColor}/g, i).replace(/{text}/g, r || ""), s;
}
};
ZW._imageTemplates = {
/**********************
* Marker templates
**********************/
marker: '',
"marker-thick": '',
"marker-circle": '',
pin: '',
"pin-round": '',
"marker-flat": '',
"marker-arrow": '',
"marker-ball-pin": '',
"marker-square": '',
"marker-square-cluster": '',
"marker-square-rounded": '',
"marker-square-rounded-cluster": '',
flag: '',
"flag-triangle": '',
"rounded-square": '',
"rounded-square-thick": '',
triangle: '',
"triangle-thick": '',
hexagon: '',
"hexagon-thick": '',
"hexagon-rounded": '',
"hexagon-rounded-thick": '',
"triangle-arrow-up": '',
"triangle-arrow-left": '',
"arrow-up": '',
"arrow-up-thin": '',
car: '',
/**********************
* Fill Patterns
**********************/
checker: '',
"checker-rotated": '',
"zig-zag": '',
"zig-zag-vertical": '',
"circles-spaced": '',
circles: '',
"diagonal-lines-up": '',
"diagonal-lines-down": '',
"diagonal-stripes-up": '',
"diagonal-stripes-down": '',
"grid-lines": '',
"rotated-grid-lines": '',
"rotated-grid-stripes": '',
"x-fill": '',
dots: ''
};
let lE = ZW;
class Fgt {
/************************
* Constructor
***********************/
/**
* A class that manages the lifecycle of SVG's for a map instance.
* @param map A maplibre-gl-js map instance.
*/
constructor(e) {
this._images = {}, this._map = e;
}
/************************
* Public functions
***********************/
/**
* Adds an SVG image to the maps image sprite.
* @param id A unique ID to reference the image by. Use this to render this image in your layers. If the specified id matches the ID of a previously added image the new image will be ignored.
* @param svg An inline SVG string, or URL to an SVG image.
* @param maxWidth The maximum width to allow the image to be. If the image exceeds this width it will be scaled down to fit. Default: 100
* @param maxHeight The maximum height to allow the image to be. If the image exceeds this height it will be scaled down to fit. Default: 100
*/
add(e, r, n = 100, i = 100) {
return new Promise((o, s) => {
const a = this._images, u = this._map;
if (a[e]) {
o();
return;
}
if (typeof r == "string") {
let d;
/