import {
GI,
UI,
qI
} from "./chunk-5CHFQKBT.js";
import {
hn,
wn
} from "./chunk-EEZUFMIV.js";
import {
Comment,
Fragment,
Teleport,
Text,
Transition,
cloneVNode,
computed,
createApp,
createBaseVNode,
createBlock,
createCommentVNode,
createElementBlock,
createSlots,
createStaticVNode,
createTextVNode,
createVNode,
defineComponent,
effectScope,
getCurrentInstance,
getCurrentScope,
h,
hasInjectionContext,
inject,
isReactive,
isRef,
markRaw,
mergeProps,
nextTick,
normalizeClass,
normalizeStyle,
onActivated,
onBeforeMount,
onBeforeUnmount,
onDeactivated,
onMounted,
onScopeDispose,
onUnmounted,
onUpdated,
openBlock,
popScopeId,
provide,
pushScopeId,
reactive,
readonly,
ref,
renderList,
renderSlot,
resolveComponent,
resolveDirective,
resolveDynamicComponent,
shallowRef,
toDisplayString,
toHandlerKey,
toRaw,
toRef,
toRefs,
unref,
useSlots,
vModelCheckbox,
vModelRadio,
vModelText,
vShow,
warn,
watch,
watchEffect,
withCtx,
withDirectives,
withKeys,
withModifiers
} from "./chunk-6UGCK2MK.js";
import "./chunk-DC5AMYBS.js";
// node_modules/@abi-software/flatmapvuer/dist/flatmapvuer.js
var s4 = (t10, e, { checkForDefaultPrevented: r = true } = {}) => (i) => {
const o = t10 == null ? void 0 : t10(i);
if (r === false || !o)
return e == null ? void 0 : e(i);
};
var uk;
var s1 = typeof window < "u";
var Pet = (t10) => typeof t10 == "string";
var Jj = () => {
};
var sx = s1 && ((uk = window == null ? void 0 : window.navigator) == null ? void 0 : uk.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function tS(t10) {
return typeof t10 == "function" ? t10() : unref(t10);
}
function Vet(t10) {
return t10;
}
function ud(t10) {
return getCurrentScope() ? (onScopeDispose(t10), true) : false;
}
function Ret(t10, e = true) {
getCurrentInstance() ? onMounted(t10) : e ? t10() : nextTick(t10);
}
function hk(t10, e, r = {}) {
const {
immediate: n = true
} = r, i = ref(false);
let o = null;
function s() {
o && (clearTimeout(o), o = null);
}
function a() {
i.value = false, s();
}
function u(...d) {
s(), i.value = true, o = setTimeout(() => {
i.value = false, o = null, t10(...d);
}, tS(e));
}
return n && (i.value = true, s1 && u()), ud(a), {
isPending: readonly(i),
start: u,
stop: a
};
}
function f4(t10) {
var e;
const r = tS(t10);
return (e = r == null ? void 0 : r.$el) != null ? e : r;
}
var Tg = s1 ? window : void 0;
function ea(...t10) {
let e, r, n, i;
if (Pet(t10[0]) || Array.isArray(t10[0]) ? ([r, n, i] = t10, e = Tg) : [e, r, n, i] = t10, !e)
return Jj;
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 = watch(() => [f4(e), tS(i)], ([T, f]) => {
s(), T && o.push(...r.flatMap((Q) => n.map((y) => a(T, Q, y, f))));
}, { immediate: true, flush: "post" }), d = () => {
u(), s();
};
return ud(d), d;
}
var dk = false;
function Net(t10, e, r = {}) {
const { window: n = Tg, ignore: i = [], capture: o = true, detectIframe: s = false } = r;
if (!n)
return;
sx && !dk && (dk = true, Array.from(n.document.body.children).forEach((Q) => Q.addEventListener("click", Jj)));
let a = true;
const u = (Q) => i.some((y) => {
if (typeof y == "string")
return Array.from(n.document.querySelectorAll(y)).some((_) => _ === Q.target || Q.composedPath().includes(_));
{
const _ = f4(y);
return _ && (Q.target === _ || Q.composedPath().includes(_));
}
}), T = [
ea(n, "click", (Q) => {
const y = f4(t10);
if (!(!y || y === Q.target || Q.composedPath().includes(y))) {
if (Q.detail === 0 && (a = !u(Q)), !a) {
a = true;
return;
}
e(Q);
}
}, { passive: true, capture: o }),
ea(n, "pointerdown", (Q) => {
const y = f4(t10);
y && (a = !Q.composedPath().includes(y) && !u(Q));
}, { passive: true }),
s && ea(n, "blur", (Q) => {
var y;
const _ = f4(t10);
((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 tz(t10, e = false) {
const r = ref(), n = () => r.value = !!t10();
return n(), Ret(n, e), r;
}
var pk = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
var Tk = "__vueuse_ssr_handlers__";
pk[Tk] = pk[Tk] || {};
var fk = Object.getOwnPropertySymbols;
var Det = Object.prototype.hasOwnProperty;
var Fet = Object.prototype.propertyIsEnumerable;
var Bet = (t10, e) => {
var r = {};
for (var n in t10)
Det.call(t10, n) && e.indexOf(n) < 0 && (r[n] = t10[n]);
if (t10 != null && fk)
for (var n of fk(t10))
e.indexOf(n) < 0 && Fet.call(t10, n) && (r[n] = t10[n]);
return r;
};
function B6(t10, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Bet(n, ["window"]);
let s;
const a = tz(() => i && "ResizeObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = watch(() => f4(t10), (f) => {
u(), a.value && i && f && (s = new ResizeObserver(e), s.observe(f, o));
}, { immediate: true, flush: "post" }), T = () => {
u(), d();
};
return ud(T), {
isSupported: a,
stop: T
};
}
var Qk = Object.getOwnPropertySymbols;
var jet = Object.prototype.hasOwnProperty;
var zet = Object.prototype.propertyIsEnumerable;
var Uet = (t10, e) => {
var r = {};
for (var n in t10)
jet.call(t10, n) && e.indexOf(n) < 0 && (r[n] = t10[n]);
if (t10 != null && Qk)
for (var n of Qk(t10))
e.indexOf(n) < 0 && zet.call(t10, n) && (r[n] = t10[n]);
return r;
};
function Get(t10, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Uet(n, ["window"]);
let s;
const a = tz(() => i && "MutationObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = watch(() => f4(t10), (f) => {
u(), a.value && i && f && (s = new MutationObserver(e), s.observe(f, o));
}, { immediate: true }), T = () => {
u(), d();
};
return ud(T), {
isSupported: a,
stop: T
};
}
var mk;
(function(t10) {
t10.UP = "UP", t10.RIGHT = "RIGHT", t10.DOWN = "DOWN", t10.LEFT = "LEFT", t10.NONE = "NONE";
})(mk || (mk = {}));
var $et = Object.defineProperty;
var gk = Object.getOwnPropertySymbols;
var Wet = Object.prototype.hasOwnProperty;
var Zet = Object.prototype.propertyIsEnumerable;
var yk = (t10, e, r) => e in t10 ? $et(t10, e, { enumerable: true, configurable: true, writable: true, value: r }) : t10[e] = r;
var qet = (t10, e) => {
for (var r in e || (e = {}))
Wet.call(e, r) && yk(t10, r, e[r]);
if (gk)
for (var r of gk(e))
Zet.call(e, r) && yk(t10, r, e[r]);
return t10;
};
var Xet = {
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]
};
qet({
linear: Vet
}, Xet);
Object.freeze({});
Object.freeze([]);
var C5 = () => {
};
var Ket = Object.prototype.hasOwnProperty;
var vk = (t10, e) => Ket.call(t10, e);
var p2 = Array.isArray;
var Zo = (t10) => typeof t10 == "function";
var sa = (t10) => typeof t10 == "string";
var T2 = (t10) => t10 !== null && typeof t10 == "object";
var Yet = Object.prototype.toString;
var Jet = (t10) => Yet.call(t10);
var hb = (t10) => Jet(t10).slice(8, -1);
var ez = (t10) => {
const e = /* @__PURE__ */ Object.create(null);
return (r) => e[r] || (e[r] = t10(r));
};
var trt = /-(\w)/g;
var ert = ez((t10) => t10.replace(trt, (e, r) => r ? r.toUpperCase() : ""));
var rrt = /\B([A-Z])/g;
var nrt = ez(
(t10) => t10.replace(rrt, "-$1").toLowerCase()
);
var rz = typeof global == "object" && global && global.Object === Object && global;
var irt = typeof self == "object" && self && self.Object === Object && self;
var v3 = rz || irt || Function("return this")();
var h3 = v3.Symbol;
var nz = Object.prototype;
var ort = nz.hasOwnProperty;
var srt = nz.toString;
var lu = h3 ? h3.toStringTag : void 0;
function art(t10) {
var e = ort.call(t10, lu), r = t10[lu];
try {
t10[lu] = void 0;
var n = true;
} catch {
}
var i = srt.call(t10);
return n && (e ? t10[lu] = r : delete t10[lu]), i;
}
var lrt = Object.prototype;
var crt = lrt.toString;
function urt(t10) {
return crt.call(t10);
}
var hrt = "[object Null]";
var drt = "[object Undefined]";
var _k = h3 ? h3.toStringTag : void 0;
function Y8(t10) {
return t10 == null ? t10 === void 0 ? drt : hrt : _k && _k in Object(t10) ? art(t10) : urt(t10);
}
function _8(t10) {
return t10 != null && typeof t10 == "object";
}
var prt = "[object Symbol]";
function fg(t10) {
return typeof t10 == "symbol" || _8(t10) && Y8(t10) == prt;
}
function Trt(t10, e) {
for (var r = -1, n = t10 == null ? 0 : t10.length, i = Array(n); ++r < n; )
i[r] = e(t10[r], r, t10);
return i;
}
var aa = Array.isArray;
var frt = 1 / 0;
var bk = h3 ? h3.prototype : void 0;
var Lk = bk ? bk.toString : void 0;
function iz(t10) {
if (typeof t10 == "string")
return t10;
if (aa(t10))
return Trt(t10, iz) + "";
if (fg(t10))
return Lk ? Lk.call(t10) : "";
var e = t10 + "";
return e == "0" && 1 / t10 == -frt ? "-0" : e;
}
var Qrt = /\s/;
function mrt(t10) {
for (var e = t10.length; e-- && Qrt.test(t10.charAt(e)); )
;
return e;
}
var grt = /^\s+/;
function yrt(t10) {
return t10 && t10.slice(0, mrt(t10) + 1).replace(grt, "");
}
function a0(t10) {
var e = typeof t10;
return t10 != null && (e == "object" || e == "function");
}
var wk = NaN;
var vrt = /^[-+]0x[0-9a-f]+$/i;
var _rt = /^0b[01]+$/i;
var brt = /^0o[0-7]+$/i;
var Lrt = parseInt;
function xk(t10) {
if (typeof t10 == "number")
return t10;
if (fg(t10))
return wk;
if (a0(t10)) {
var e = typeof t10.valueOf == "function" ? t10.valueOf() : t10;
t10 = a0(e) ? e + "" : e;
}
if (typeof t10 != "string")
return t10 === 0 ? t10 : +t10;
t10 = yrt(t10);
var r = _rt.test(t10);
return r || brt.test(t10) ? Lrt(t10.slice(2), r ? 2 : 8) : vrt.test(t10) ? wk : +t10;
}
function oz(t10) {
return t10;
}
var wrt = "[object AsyncFunction]";
var xrt = "[object Function]";
var Ert = "[object GeneratorFunction]";
var Mrt = "[object Proxy]";
function sz(t10) {
if (!a0(t10))
return false;
var e = Y8(t10);
return e == xrt || e == Ert || e == wrt || e == Mrt;
}
var db = v3["__core-js_shared__"];
var Ek = function() {
var t10 = /[^.]+$/.exec(db && db.keys && db.keys.IE_PROTO || "");
return t10 ? "Symbol(src)_1." + t10 : "";
}();
function Srt(t10) {
return !!Ek && Ek in t10;
}
var Hrt = Function.prototype;
var Art = Hrt.toString;
function nl(t10) {
if (t10 != null) {
try {
return Art.call(t10);
} catch {
}
try {
return t10 + "";
} catch {
}
}
return "";
}
var Ort = /[\\^$.*+?()[\]{}|]/g;
var Crt = /^\[object .+?Constructor\]$/;
var krt = Function.prototype;
var Irt = Object.prototype;
var Prt = krt.toString;
var Vrt = Irt.hasOwnProperty;
var Rrt = RegExp(
"^" + Prt.call(Vrt).replace(Ort, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Nrt(t10) {
if (!a0(t10) || Srt(t10))
return false;
var e = sz(t10) ? Rrt : Crt;
return e.test(nl(t10));
}
function Drt(t10, e) {
return t10 == null ? void 0 : t10[e];
}
function il(t10, e) {
var r = Drt(t10, e);
return Nrt(r) ? r : void 0;
}
var ax = il(v3, "WeakMap");
function Frt(t10, e, r) {
switch (r.length) {
case 0:
return t10.call(e);
case 1:
return t10.call(e, r[0]);
case 2:
return t10.call(e, r[0], r[1]);
case 3:
return t10.call(e, r[0], r[1], r[2]);
}
return t10.apply(e, r);
}
var Brt = 800;
var jrt = 16;
var zrt = Date.now;
function Urt(t10) {
var e = 0, r = 0;
return function() {
var n = zrt(), i = jrt - (n - r);
if (r = n, i > 0) {
if (++e >= Brt)
return arguments[0];
} else
e = 0;
return t10.apply(void 0, arguments);
};
}
function Grt(t10) {
return function() {
return t10;
};
}
var VQ = function() {
try {
var t10 = il(Object, "defineProperty");
return t10({}, "", {}), t10;
} catch {
}
}();
var $rt = VQ ? function(t10, e) {
return VQ(t10, "toString", {
configurable: true,
enumerable: false,
value: Grt(e),
writable: true
});
} : oz;
var Wrt = Urt($rt);
function Zrt(t10, e, r, n) {
t10.length;
for (var i = r + 1; i--; )
if (e(t10[i], i, t10))
return i;
return -1;
}
var qrt = 9007199254740991;
var Xrt = /^(?:0|[1-9]\d*)$/;
function eS(t10, e) {
var r = typeof t10;
return e = e ?? qrt, !!e && (r == "number" || r != "symbol" && Xrt.test(t10)) && t10 > -1 && t10 % 1 == 0 && t10 < e;
}
function Krt(t10, e, r) {
e == "__proto__" && VQ ? VQ(t10, e, {
configurable: true,
enumerable: true,
value: r,
writable: true
}) : t10[e] = r;
}
function rS(t10, e) {
return t10 === e || t10 !== t10 && e !== e;
}
var Yrt = Object.prototype;
var Jrt = Yrt.hasOwnProperty;
function tnt(t10, e, r) {
var n = t10[e];
(!(Jrt.call(t10, e) && rS(n, r)) || r === void 0 && !(e in t10)) && Krt(t10, e, r);
}
var Mk = Math.max;
function ent(t10, e, r) {
return e = Mk(e === void 0 ? t10.length - 1 : e, 0), function() {
for (var n = arguments, i = -1, o = Mk(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), Frt(t10, this, a);
};
}
var rnt = 9007199254740991;
function nS(t10) {
return typeof t10 == "number" && t10 > -1 && t10 % 1 == 0 && t10 <= rnt;
}
function nnt(t10) {
return t10 != null && nS(t10.length) && !sz(t10);
}
var int = Object.prototype;
function ont(t10) {
var e = t10 && t10.constructor, r = typeof e == "function" && e.prototype || int;
return t10 === r;
}
function snt(t10, e) {
for (var r = -1, n = Array(t10); ++r < t10; )
n[r] = e(r);
return n;
}
var ant = "[object Arguments]";
function Sk(t10) {
return _8(t10) && Y8(t10) == ant;
}
var az = Object.prototype;
var lnt = az.hasOwnProperty;
var cnt = az.propertyIsEnumerable;
var iS = Sk(/* @__PURE__ */ function() {
return arguments;
}()) ? Sk : function(t10) {
return _8(t10) && lnt.call(t10, "callee") && !cnt.call(t10, "callee");
};
function unt() {
return false;
}
var lz = typeof exports == "object" && exports && !exports.nodeType && exports;
var Hk = lz && typeof module == "object" && module && !module.nodeType && module;
var hnt = Hk && Hk.exports === lz;
var Ak = hnt ? v3.Buffer : void 0;
var dnt = Ak ? Ak.isBuffer : void 0;
var lx = dnt || unt;
var pnt = "[object Arguments]";
var Tnt = "[object Array]";
var fnt = "[object Boolean]";
var Qnt = "[object Date]";
var mnt = "[object Error]";
var gnt = "[object Function]";
var ynt = "[object Map]";
var vnt = "[object Number]";
var _nt = "[object Object]";
var bnt = "[object RegExp]";
var Lnt = "[object Set]";
var wnt = "[object String]";
var xnt = "[object WeakMap]";
var Ent = "[object ArrayBuffer]";
var Mnt = "[object DataView]";
var Snt = "[object Float32Array]";
var Hnt = "[object Float64Array]";
var Ant = "[object Int8Array]";
var Ont = "[object Int16Array]";
var Cnt = "[object Int32Array]";
var knt = "[object Uint8Array]";
var Int = "[object Uint8ClampedArray]";
var Pnt = "[object Uint16Array]";
var Vnt = "[object Uint32Array]";
var Mi = {};
Mi[Snt] = Mi[Hnt] = Mi[Ant] = Mi[Ont] = Mi[Cnt] = Mi[knt] = Mi[Int] = Mi[Pnt] = Mi[Vnt] = true;
Mi[pnt] = Mi[Tnt] = Mi[Ent] = Mi[fnt] = Mi[Mnt] = Mi[Qnt] = Mi[mnt] = Mi[gnt] = Mi[ynt] = Mi[vnt] = Mi[_nt] = Mi[bnt] = Mi[Lnt] = Mi[wnt] = Mi[xnt] = false;
function Rnt(t10) {
return _8(t10) && nS(t10.length) && !!Mi[Y8(t10)];
}
function Nnt(t10) {
return function(e) {
return t10(e);
};
}
var cz = typeof exports == "object" && exports && !exports.nodeType && exports;
var th = cz && typeof module == "object" && module && !module.nodeType && module;
var Dnt = th && th.exports === cz;
var pb = Dnt && rz.process;
var Ok = function() {
try {
var t10 = th && th.require && th.require("util").types;
return t10 || pb && pb.binding && pb.binding("util");
} catch {
}
}();
var Ck = Ok && Ok.isTypedArray;
var uz = Ck ? Nnt(Ck) : Rnt;
var Fnt = Object.prototype;
var Bnt = Fnt.hasOwnProperty;
function jnt(t10, e) {
var r = aa(t10), n = !r && iS(t10), i = !r && !n && lx(t10), o = !r && !n && !i && uz(t10), s = r || n || i || o, a = s ? snt(t10.length, String) : [], u = a.length;
for (var d in t10)
Bnt.call(t10, 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.
eS(d, u))) && a.push(d);
return a;
}
function znt(t10, e) {
return function(r) {
return t10(e(r));
};
}
var Unt = znt(Object.keys, Object);
var Gnt = Object.prototype;
var $nt = Gnt.hasOwnProperty;
function Wnt(t10) {
if (!ont(t10))
return Unt(t10);
var e = [];
for (var r in Object(t10))
$nt.call(t10, r) && r != "constructor" && e.push(r);
return e;
}
function hz(t10) {
return nnt(t10) ? jnt(t10) : Wnt(t10);
}
var Znt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var qnt = /^\w*$/;
function oS(t10, e) {
if (aa(t10))
return false;
var r = typeof t10;
return r == "number" || r == "symbol" || r == "boolean" || t10 == null || fg(t10) ? true : qnt.test(t10) || !Znt.test(t10) || e != null && t10 in Object(e);
}
var Ih = il(Object, "create");
function Xnt() {
this.__data__ = Ih ? Ih(null) : {}, this.size = 0;
}
function Knt(t10) {
var e = this.has(t10) && delete this.__data__[t10];
return this.size -= e ? 1 : 0, e;
}
var Ynt = "__lodash_hash_undefined__";
var Jnt = Object.prototype;
var tit = Jnt.hasOwnProperty;
function eit(t10) {
var e = this.__data__;
if (Ih) {
var r = e[t10];
return r === Ynt ? void 0 : r;
}
return tit.call(e, t10) ? e[t10] : void 0;
}
var rit = Object.prototype;
var nit = rit.hasOwnProperty;
function iit(t10) {
var e = this.__data__;
return Ih ? e[t10] !== void 0 : nit.call(e, t10);
}
var oit = "__lodash_hash_undefined__";
function sit(t10, e) {
var r = this.__data__;
return this.size += this.has(t10) ? 0 : 1, r[t10] = Ih && e === void 0 ? oit : e, this;
}
function j5(t10) {
var e = -1, r = t10 == null ? 0 : t10.length;
for (this.clear(); ++e < r; ) {
var n = t10[e];
this.set(n[0], n[1]);
}
}
j5.prototype.clear = Xnt;
j5.prototype.delete = Knt;
j5.prototype.get = eit;
j5.prototype.has = iit;
j5.prototype.set = sit;
function ait() {
this.__data__ = [], this.size = 0;
}
function Qg(t10, e) {
for (var r = t10.length; r--; )
if (rS(t10[r][0], e))
return r;
return -1;
}
var lit = Array.prototype;
var cit = lit.splice;
function uit(t10) {
var e = this.__data__, r = Qg(e, t10);
if (r < 0)
return false;
var n = e.length - 1;
return r == n ? e.pop() : cit.call(e, r, 1), --this.size, true;
}
function hit(t10) {
var e = this.__data__, r = Qg(e, t10);
return r < 0 ? void 0 : e[r][1];
}
function dit(t10) {
return Qg(this.__data__, t10) > -1;
}
function pit(t10, e) {
var r = this.__data__, n = Qg(r, t10);
return n < 0 ? (++this.size, r.push([t10, e])) : r[n][1] = e, this;
}
function C4(t10) {
var e = -1, r = t10 == null ? 0 : t10.length;
for (this.clear(); ++e < r; ) {
var n = t10[e];
this.set(n[0], n[1]);
}
}
C4.prototype.clear = ait;
C4.prototype.delete = uit;
C4.prototype.get = hit;
C4.prototype.has = dit;
C4.prototype.set = pit;
var Ph = il(v3, "Map");
function Tit() {
this.size = 0, this.__data__ = {
hash: new j5(),
map: new (Ph || C4)(),
string: new j5()
};
}
function fit(t10) {
var e = typeof t10;
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t10 !== "__proto__" : t10 === null;
}
function mg(t10, e) {
var r = t10.__data__;
return fit(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
}
function Qit(t10) {
var e = mg(this, t10).delete(t10);
return this.size -= e ? 1 : 0, e;
}
function mit(t10) {
return mg(this, t10).get(t10);
}
function git(t10) {
return mg(this, t10).has(t10);
}
function yit(t10, e) {
var r = mg(this, t10), n = r.size;
return r.set(t10, e), this.size += r.size == n ? 0 : 1, this;
}
function k4(t10) {
var e = -1, r = t10 == null ? 0 : t10.length;
for (this.clear(); ++e < r; ) {
var n = t10[e];
this.set(n[0], n[1]);
}
}
k4.prototype.clear = Tit;
k4.prototype.delete = Qit;
k4.prototype.get = mit;
k4.prototype.has = git;
k4.prototype.set = yit;
var vit = "Expected a function";
function sS(t10, e) {
if (typeof t10 != "function" || e != null && typeof e != "function")
throw new TypeError(vit);
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 = t10.apply(this, n);
return r.cache = o.set(i, s) || o, s;
};
return r.cache = new (sS.Cache || k4)(), r;
}
sS.Cache = k4;
var _it = 500;
function bit(t10) {
var e = sS(t10, function(n) {
return r.size === _it && r.clear(), n;
}), r = e.cache;
return e;
}
var Lit = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var wit = /\\(\\)?/g;
var xit = bit(function(t10) {
var e = [];
return t10.charCodeAt(0) === 46 && e.push(""), t10.replace(Lit, function(r, n, i, o) {
e.push(i ? o.replace(wit, "$1") : n || r);
}), e;
});
function Eit(t10) {
return t10 == null ? "" : iz(t10);
}
function gg(t10, e) {
return aa(t10) ? t10 : oS(t10, e) ? [t10] : xit(Eit(t10));
}
var Mit = 1 / 0;
function hd(t10) {
if (typeof t10 == "string" || fg(t10))
return t10;
var e = t10 + "";
return e == "0" && 1 / t10 == -Mit ? "-0" : e;
}
function aS(t10, e) {
e = gg(e, t10);
for (var r = 0, n = e.length; t10 != null && r < n; )
t10 = t10[hd(e[r++])];
return r && r == n ? t10 : void 0;
}
function T4(t10, e, r) {
var n = t10 == null ? void 0 : aS(t10, e);
return n === void 0 ? r : n;
}
function dz(t10, e) {
for (var r = -1, n = e.length, i = t10.length; ++r < n; )
t10[i + r] = e[r];
return t10;
}
var kk = h3 ? h3.isConcatSpreadable : void 0;
function Sit(t10) {
return aa(t10) || iS(t10) || !!(kk && t10 && t10[kk]);
}
function Hit(t10, e, r, n, i) {
var o = -1, s = t10.length;
for (r || (r = Sit), i || (i = []); ++o < s; ) {
var a = t10[o];
r(a) ? dz(i, a) : i[i.length] = a;
}
return i;
}
function Ait(t10) {
var e = t10 == null ? 0 : t10.length;
return e ? Hit(t10) : [];
}
function Oit(t10) {
return Wrt(ent(t10, void 0, Ait), t10 + "");
}
function W6() {
if (!arguments.length)
return [];
var t10 = arguments[0];
return aa(t10) ? t10 : [t10];
}
function Cit() {
this.__data__ = new C4(), this.size = 0;
}
function kit(t10) {
var e = this.__data__, r = e.delete(t10);
return this.size = e.size, r;
}
function Iit(t10) {
return this.__data__.get(t10);
}
function Pit(t10) {
return this.__data__.has(t10);
}
var Vit = 200;
function Rit(t10, e) {
var r = this.__data__;
if (r instanceof C4) {
var n = r.__data__;
if (!Ph || n.length < Vit - 1)
return n.push([t10, e]), this.size = ++r.size, this;
r = this.__data__ = new k4(n);
}
return r.set(t10, e), this.size = r.size, this;
}
function v4(t10) {
var e = this.__data__ = new C4(t10);
this.size = e.size;
}
v4.prototype.clear = Cit;
v4.prototype.delete = kit;
v4.prototype.get = Iit;
v4.prototype.has = Pit;
v4.prototype.set = Rit;
function Nit(t10, e) {
for (var r = -1, n = t10 == null ? 0 : t10.length, i = 0, o = []; ++r < n; ) {
var s = t10[r];
e(s, r, t10) && (o[i++] = s);
}
return o;
}
function Dit() {
return [];
}
var Fit = Object.prototype;
var Bit = Fit.propertyIsEnumerable;
var Ik = Object.getOwnPropertySymbols;
var jit = Ik ? function(t10) {
return t10 == null ? [] : (t10 = Object(t10), Nit(Ik(t10), function(e) {
return Bit.call(t10, e);
}));
} : Dit;
function zit(t10, e, r) {
var n = e(t10);
return aa(t10) ? n : dz(n, r(t10));
}
function Pk(t10) {
return zit(t10, hz, jit);
}
var cx = il(v3, "DataView");
var ux = il(v3, "Promise");
var hx = il(v3, "Set");
var Vk = "[object Map]";
var Uit = "[object Object]";
var Rk = "[object Promise]";
var Nk = "[object Set]";
var Dk = "[object WeakMap]";
var Fk = "[object DataView]";
var Git = nl(cx);
var $it = nl(Ph);
var Wit = nl(ux);
var Zit = nl(hx);
var qit = nl(ax);
var j6 = Y8;
(cx && j6(new cx(new ArrayBuffer(1))) != Fk || Ph && j6(new Ph()) != Vk || ux && j6(ux.resolve()) != Rk || hx && j6(new hx()) != Nk || ax && j6(new ax()) != Dk) && (j6 = function(t10) {
var e = Y8(t10), r = e == Uit ? t10.constructor : void 0, n = r ? nl(r) : "";
if (n)
switch (n) {
case Git:
return Fk;
case $it:
return Vk;
case Wit:
return Rk;
case Zit:
return Nk;
case qit:
return Dk;
}
return e;
});
var Bk = v3.Uint8Array;
var Xit = "__lodash_hash_undefined__";
function Kit(t10) {
return this.__data__.set(t10, Xit), this;
}
function Yit(t10) {
return this.__data__.has(t10);
}
function RQ(t10) {
var e = -1, r = t10 == null ? 0 : t10.length;
for (this.__data__ = new k4(); ++e < r; )
this.add(t10[e]);
}
RQ.prototype.add = RQ.prototype.push = Kit;
RQ.prototype.has = Yit;
function Jit(t10, e) {
for (var r = -1, n = t10 == null ? 0 : t10.length; ++r < n; )
if (e(t10[r], r, t10))
return true;
return false;
}
function t1t(t10, e) {
return t10.has(e);
}
var e1t = 1;
var r1t = 2;
function pz(t10, e, r, n, i, o) {
var s = r & e1t, a = t10.length, u = e.length;
if (a != u && !(s && u > a))
return false;
var d = o.get(t10), T = o.get(e);
if (d && T)
return d == e && T == t10;
var f = -1, Q = true, y = r & r1t ? new RQ() : void 0;
for (o.set(t10, e), o.set(e, t10); ++f < a; ) {
var _ = t10[f], L = e[f];
if (n)
var E = s ? n(L, _, f, e, t10, o) : n(_, L, f, t10, e, o);
if (E !== void 0) {
if (E)
continue;
Q = false;
break;
}
if (y) {
if (!Jit(e, function(x, O) {
if (!t1t(y, O) && (_ === x || i(_, x, r, n, o)))
return y.push(O);
})) {
Q = false;
break;
}
} else if (!(_ === L || i(_, L, r, n, o))) {
Q = false;
break;
}
}
return o.delete(t10), o.delete(e), Q;
}
function n1t(t10) {
var e = -1, r = Array(t10.size);
return t10.forEach(function(n, i) {
r[++e] = [i, n];
}), r;
}
function i1t(t10) {
var e = -1, r = Array(t10.size);
return t10.forEach(function(n) {
r[++e] = n;
}), r;
}
var o1t = 1;
var s1t = 2;
var a1t = "[object Boolean]";
var l1t = "[object Date]";
var c1t = "[object Error]";
var u1t = "[object Map]";
var h1t = "[object Number]";
var d1t = "[object RegExp]";
var p1t = "[object Set]";
var T1t = "[object String]";
var f1t = "[object Symbol]";
var Q1t = "[object ArrayBuffer]";
var m1t = "[object DataView]";
var jk = h3 ? h3.prototype : void 0;
var Tb = jk ? jk.valueOf : void 0;
function g1t(t10, e, r, n, i, o, s) {
switch (r) {
case m1t:
if (t10.byteLength != e.byteLength || t10.byteOffset != e.byteOffset)
return false;
t10 = t10.buffer, e = e.buffer;
case Q1t:
return !(t10.byteLength != e.byteLength || !o(new Bk(t10), new Bk(e)));
case a1t:
case l1t:
case h1t:
return rS(+t10, +e);
case c1t:
return t10.name == e.name && t10.message == e.message;
case d1t:
case T1t:
return t10 == e + "";
case u1t:
var a = n1t;
case p1t:
var u = n & o1t;
if (a || (a = i1t), t10.size != e.size && !u)
return false;
var d = s.get(t10);
if (d)
return d == e;
n |= s1t, s.set(t10, e);
var T = pz(a(t10), a(e), n, i, o, s);
return s.delete(t10), T;
case f1t:
if (Tb)
return Tb.call(t10) == Tb.call(e);
}
return false;
}
var y1t = 1;
var v1t = Object.prototype;
var _1t = v1t.hasOwnProperty;
function b1t(t10, e, r, n, i, o) {
var s = r & y1t, a = Pk(t10), u = a.length, d = Pk(e), T = d.length;
if (u != T && !s)
return false;
for (var f = u; f--; ) {
var Q = a[f];
if (!(s ? Q in e : _1t.call(e, Q)))
return false;
}
var y = o.get(t10), _ = o.get(e);
if (y && _)
return y == e && _ == t10;
var L = true;
o.set(t10, e), o.set(e, t10);
for (var E = s; ++f < u; ) {
Q = a[f];
var x = t10[Q], O = e[Q];
if (n)
var k = s ? n(O, x, Q, e, t10, o) : n(x, O, Q, t10, e, o);
if (!(k === void 0 ? x === O || i(x, O, r, n, o) : k)) {
L = false;
break;
}
E || (E = Q == "constructor");
}
if (L && !E) {
var R = t10.constructor, F = e.constructor;
R != F && "constructor" in t10 && "constructor" in e && !(typeof R == "function" && R instanceof R && typeof F == "function" && F instanceof F) && (L = false);
}
return o.delete(t10), o.delete(e), L;
}
var L1t = 1;
var zk = "[object Arguments]";
var Uk = "[object Array]";
var $p = "[object Object]";
var w1t = Object.prototype;
var Gk = w1t.hasOwnProperty;
function x1t(t10, e, r, n, i, o) {
var s = aa(t10), a = aa(e), u = s ? Uk : j6(t10), d = a ? Uk : j6(e);
u = u == zk ? $p : u, d = d == zk ? $p : d;
var T = u == $p, f = d == $p, Q = u == d;
if (Q && lx(t10)) {
if (!lx(e))
return false;
s = true, T = false;
}
if (Q && !T)
return o || (o = new v4()), s || uz(t10) ? pz(t10, e, r, n, i, o) : g1t(t10, e, u, r, n, i, o);
if (!(r & L1t)) {
var y = T && Gk.call(t10, "__wrapped__"), _ = f && Gk.call(e, "__wrapped__");
if (y || _) {
var L = y ? t10.value() : t10, E = _ ? e.value() : e;
return o || (o = new v4()), i(L, E, r, n, o);
}
}
return Q ? (o || (o = new v4()), b1t(t10, e, r, n, i, o)) : false;
}
function yg(t10, e, r, n, i) {
return t10 === e ? true : t10 == null || e == null || !_8(t10) && !_8(e) ? t10 !== t10 && e !== e : x1t(t10, e, r, n, yg, i);
}
var E1t = 1;
var M1t = 2;
function S1t(t10, e, r, n) {
var i = r.length, o = i;
if (t10 == null)
return !o;
for (t10 = Object(t10); i--; ) {
var s = r[i];
if (s[2] ? s[1] !== t10[s[0]] : !(s[0] in t10))
return false;
}
for (; ++i < o; ) {
s = r[i];
var a = s[0], u = t10[a], d = s[1];
if (s[2]) {
if (u === void 0 && !(a in t10))
return false;
} else {
var T = new v4(), f;
if (!(f === void 0 ? yg(d, u, E1t | M1t, n, T) : f))
return false;
}
}
return true;
}
function Tz(t10) {
return t10 === t10 && !a0(t10);
}
function H1t(t10) {
for (var e = hz(t10), r = e.length; r--; ) {
var n = e[r], i = t10[n];
e[r] = [n, i, Tz(i)];
}
return e;
}
function fz(t10, e) {
return function(r) {
return r == null ? false : r[t10] === e && (e !== void 0 || t10 in Object(r));
};
}
function A1t(t10) {
var e = H1t(t10);
return e.length == 1 && e[0][2] ? fz(e[0][0], e[0][1]) : function(r) {
return r === t10 || S1t(r, t10, e);
};
}
function O1t(t10, e) {
return t10 != null && e in Object(t10);
}
function C1t(t10, e, r) {
e = gg(e, t10);
for (var n = -1, i = e.length, o = false; ++n < i; ) {
var s = hd(e[n]);
if (!(o = t10 != null && r(t10, s)))
break;
t10 = t10[s];
}
return o || ++n != i ? o : (i = t10 == null ? 0 : t10.length, !!i && nS(i) && eS(s, i) && (aa(t10) || iS(t10)));
}
function Qz(t10, e) {
return t10 != null && C1t(t10, e, O1t);
}
var k1t = 1;
var I1t = 2;
function P1t(t10, e) {
return oS(t10) && Tz(e) ? fz(hd(t10), e) : function(r) {
var n = T4(r, t10);
return n === void 0 && n === e ? Qz(r, t10) : yg(e, n, k1t | I1t);
};
}
function V1t(t10) {
return function(e) {
return e == null ? void 0 : e[t10];
};
}
function R1t(t10) {
return function(e) {
return aS(e, t10);
};
}
function N1t(t10) {
return oS(t10) ? V1t(hd(t10)) : R1t(t10);
}
function D1t(t10) {
return typeof t10 == "function" ? t10 : t10 == null ? oz : typeof t10 == "object" ? aa(t10) ? P1t(t10[0], t10[1]) : A1t(t10) : N1t(t10);
}
var fb = function() {
return v3.Date.now();
};
var F1t = "Expected a function";
var B1t = Math.max;
var j1t = Math.min;
function z1t(t10, e, r) {
var n, i, o, s, a, u, d = 0, T = false, f = false, Q = true;
if (typeof t10 != "function")
throw new TypeError(F1t);
e = xk(e) || 0, a0(r) && (T = !!r.leading, f = "maxWait" in r, o = f ? B1t(xk(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 = t10.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 ? j1t(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 = fb();
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(fb());
}
function F() {
var U = fb(), $ = 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 U1t(t10, e, r) {
var n = t10 == null ? 0 : t10.length;
if (!n)
return -1;
var i = n - 1;
return Zrt(t10, D1t(e), i);
}
function dx(t10) {
for (var e = -1, r = t10 == null ? 0 : t10.length, n = {}; ++e < r; ) {
var i = t10[e];
n[i[0]] = i[1];
}
return n;
}
function NQ(t10, e) {
return yg(t10, e);
}
function vg(t10) {
return t10 == null;
}
function mz(t10) {
return t10 === void 0;
}
function G1t(t10, e, r, n) {
if (!a0(t10))
return t10;
e = gg(e, t10);
for (var i = -1, o = e.length, s = o - 1, a = t10; a != null && ++i < o; ) {
var u = hd(e[i]), d = r;
if (u === "__proto__" || u === "constructor" || u === "prototype")
return t10;
if (i != s) {
var T = a[u];
d = void 0, d === void 0 && (d = a0(T) ? T : eS(e[i + 1]) ? [] : {});
}
tnt(a, u, d), a = a[u];
}
return t10;
}
function $1t(t10, e, r) {
for (var n = -1, i = e.length, o = {}; ++n < i; ) {
var s = e[n], a = aS(t10, s);
r(a, s) && G1t(o, gg(s, t10), a);
}
return o;
}
function W1t(t10, e) {
return $1t(t10, e, function(r, n) {
return Qz(t10, n);
});
}
var gz = Oit(function(t10, e) {
return t10 == null ? {} : W1t(t10, e);
});
var q6 = (t10) => t10 === void 0;
var S4 = (t10) => typeof t10 == "boolean";
var ro = (t10) => typeof t10 == "number";
var k5 = (t10) => typeof Element > "u" ? false : t10 instanceof Element;
var Vh = (t10) => vg(t10);
var Z1t = (t10) => sa(t10) ? !Number.isNaN(Number(t10)) : false;
var q1t = (t10 = "") => t10.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
var $k = (t10) => Object.keys(t10);
var yz = class extends Error {
constructor(e) {
super(e), this.name = "ElementPlusError";
}
};
function vz(t10, e) {
throw new yz(`[${t10}] ${e}`);
}
function y2(t10, e) {
if (true) {
const r = sa(t10) ? new yz(`[${t10}] ${e}`) : t10;
console.warn(r);
}
}
var X1t = "utils/dom/style";
var _z = (t10 = "") => t10.split(" ").filter((e) => !!e.trim());
var Wk = (t10, e) => {
if (!t10 || !e)
return false;
if (e.includes(" "))
throw new Error("className should not contain space.");
return t10.classList.contains(e);
};
var px = (t10, e) => {
!t10 || !e.trim() || t10.classList.add(..._z(e));
};
var Rh = (t10, e) => {
!t10 || !e.trim() || t10.classList.remove(..._z(e));
};
var L7 = (t10, e) => {
var r;
if (!s1 || !t10 || !e)
return "";
let n = ert(e);
n === "float" && (n = "cssFloat");
try {
const i = t10.style[n];
if (i)
return i;
const o = (r = document.defaultView) == null ? void 0 : r.getComputedStyle(t10, "");
return o ? o[n] : "";
} catch {
return t10.style[n];
}
};
function z5(t10, e = "px") {
if (!t10)
return "";
if (ro(t10) || Z1t(t10))
return `${t10}${e}`;
if (sa(t10))
return t10;
y2(X1t, "binding value must be a string or number");
}
var Wp;
var K1t = (t10) => {
var e;
if (!s1)
return 0;
if (Wp !== void 0)
return Wp;
const r = document.createElement("div");
r.className = `${t10}-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), Wp = n - o, Wp;
};
function Y1t(t10, e) {
if (!s1)
return;
if (!e) {
t10.scrollTop = 0;
return;
}
const r = [];
let n = e.offsetParent;
for (; n !== null && t10 !== n && t10.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 = t10.scrollTop, a = s + t10.clientHeight;
i < s ? t10.scrollTop = i : o > a && (t10.scrollTop = o - t10.clientHeight);
}
var J1t = defineComponent({
name: "ArrowDown",
__name: "arrow-down",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var lS = J1t;
var tot = defineComponent({
name: "ArrowLeft",
__name: "arrow-left",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var bz = tot;
var eot = defineComponent({
name: "CircleCheck",
__name: "circle-check",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
}),
createBaseVNode("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"
})
]));
}
});
var rot = eot;
var not = defineComponent({
name: "CircleClose",
__name: "circle-close",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
}),
createBaseVNode("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"
})
]));
}
});
var Lz = not;
var iot = defineComponent({
name: "Close",
__name: "close",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var Tx = iot;
var oot = defineComponent({
name: "Loading",
__name: "loading",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var wz = oot;
var sot = defineComponent({
name: "WarningFilled",
__name: "warning-filled",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var xz = sot;
var aot = defineComponent({
name: "Warning",
__name: "warning",
setup(t10) {
return (e, r) => (openBlock(), createElementBlock("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
createBaseVNode("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"
})
]));
}
});
var Ez = aot;
var Mz = "__epPropKey";
var Gr = (t10) => t10;
var lot = (t10) => T2(t10) && !!t10[Mz];
var _g = (t10, e) => {
if (!T2(t10) || lot(t10))
return t10;
const { values: r, required: n, default: i, type: o, validator: s } = t10, u = {
type: o,
required: !!n,
validator: r || s ? (d) => {
let T = false, f = [];
if (r && (f = Array.from(r), vk(t10, "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(", ");
warn(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${Q}], got value ${JSON.stringify(d)}.`);
}
return T;
} : void 0,
[Mz]: true
};
return vk(t10, "default") && (u.default = i), u;
};
var Sn = (t10) => dx(Object.entries(t10).map(([e, r]) => [
e,
_g(r, e)
]));
var b8 = Gr([
String,
Object,
Function
]);
var cot = {
Close: Tx
};
var uot = {
validating: wz,
success: rot,
error: Lz
};
var v2 = (t10, e) => {
if (t10.install = (r) => {
for (const n of [t10, ...Object.values(e ?? {})])
r.component(n.name, n);
}, e)
for (const [r, n] of Object.entries(e))
t10[r] = n;
return t10;
};
var hot = (t10, e) => (t10.install = (r) => {
r.directive(e, t10);
}, t10);
var ol = (t10) => (t10.install = C5, t10);
var dot = (...t10) => (e) => {
t10.forEach((r) => {
Zo(r) ? r(e) : r.value = e;
});
};
var Nh = {
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"
};
var Wo = "update:modelValue";
var cS = "change";
var Sz = ["", "default", "small", "large"];
var ff = ((t10) => (t10[t10.TEXT = 1] = "TEXT", t10[t10.CLASS = 2] = "CLASS", t10[t10.STYLE = 4] = "STYLE", t10[t10.PROPS = 8] = "PROPS", t10[t10.FULL_PROPS = 16] = "FULL_PROPS", t10[t10.HYDRATE_EVENTS = 32] = "HYDRATE_EVENTS", t10[t10.STABLE_FRAGMENT = 64] = "STABLE_FRAGMENT", t10[t10.KEYED_FRAGMENT = 128] = "KEYED_FRAGMENT", t10[t10.UNKEYED_FRAGMENT = 256] = "UNKEYED_FRAGMENT", t10[t10.NEED_PATCH = 512] = "NEED_PATCH", t10[t10.DYNAMIC_SLOTS = 1024] = "DYNAMIC_SLOTS", t10[t10.HOISTED = -1] = "HOISTED", t10[t10.BAIL = -2] = "BAIL", t10))(ff || {});
var pot = (t10) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(t10);
var cu = (t10) => t10;
var h8 = ({ from: t10, replacement: e, scope: r, version: n, ref: i, type: o = "API" }, s) => {
watch(() => unref(s), (a) => {
a && y2(r, `[${o}] ${t10} is about to be deprecated in version ${n}, please use ${e} instead.
For more detail, please visit: ${i}
`);
}, {
immediate: true
});
};
var Tot = (t10, e, r, n) => {
let i = {
offsetX: 0,
offsetY: 0
};
const o = (d) => {
const T = d.clientX, f = d.clientY, { offsetX: Q, offsetY: y } = i, _ = t10.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
}, t10.value && (t10.value.style.transform = `translate(${z5(gt)}, ${z5(It)})`);
}, ct = () => {
document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", ct);
};
document.addEventListener("mousemove", nt), document.addEventListener("mouseup", ct);
}, s = () => {
e.value && t10.value && e.value.addEventListener("mousedown", o);
}, a = () => {
e.value && t10.value && e.value.removeEventListener("mousedown", o);
}, u = () => {
i = {
offsetX: 0,
offsetY: 0
}, t10.value && (t10.value.style.transform = "none");
};
return onMounted(() => {
watchEffect(() => {
r.value ? s() : a();
});
}), onBeforeUnmount(() => {
a();
}), {
resetPosition: u
};
};
var fot = {
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}"
}
}
};
var Qot = (t10) => (e, r) => mot(e, r, unref(t10));
var mot = (t10, e, r) => T4(r, t10, t10).replace(/\{(\w+)\}/g, (n, i) => {
var o;
return `${(o = e == null ? void 0 : e[i]) != null ? o : `{${i}}`}`;
});
var got = (t10) => {
const e = computed(() => unref(t10).name), r = isRef(t10) ? t10 : ref(t10);
return {
lang: e,
locale: r,
t: Qot(t10)
};
};
var Hz = Symbol("localeContextKey");
var uS = (t10) => {
const e = t10 || inject(Hz, ref());
return got(computed(() => e.value || fot));
};
var eh = "el";
var yot = "is-";
var G0 = (t10, e, r, n, i) => {
let o = `${t10}-${e}`;
return r && (o += `-${r}`), n && (o += `__${n}`), i && (o += `--${i}`), o;
};
var Az = Symbol("namespaceContextKey");
var hS = (t10) => {
const e = t10 || (getCurrentInstance() ? inject(Az, ref(eh)) : ref(eh));
return computed(() => unref(e) || eh);
};
var Bn = (t10, e) => {
const r = hS(e);
return {
namespace: r,
b: (L = "") => G0(r.value, t10, L, "", ""),
e: (L) => L ? G0(r.value, t10, "", L, "") : "",
m: (L) => L ? G0(r.value, t10, "", "", L) : "",
be: (L, E) => L && E ? G0(r.value, t10, L, E, "") : "",
em: (L, E) => L && E ? G0(r.value, t10, "", L, E) : "",
bm: (L, E) => L && E ? G0(r.value, t10, L, "", E) : "",
bem: (L, E, x) => L && E && x ? G0(r.value, t10, L, E, x) : "",
is: (L, ...E) => {
const x = E.length >= 1 ? E[0] : true;
return L && x ? `${yot}${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}-${t10}-${x}`] = L[x]);
return E;
},
cssVarBlockName: (L) => `--${r.value}-${t10}-${L}`
};
};
var vot = (t10, e = {}) => {
isRef(t10) || vz("[useLockscreen]", "You need to pass a ref param to this function");
const r = e.ns || Bn("popup"), n = computed(() => r.bm("parent", "hidden"));
if (!s1 || Wk(document.body, n.value))
return;
let i = 0, o = false, s = "0";
const a = () => {
setTimeout(() => {
Rh(document == null ? void 0 : document.body, n.value), o && document && (document.body.style.width = s);
}, 200);
};
watch(t10, (u) => {
if (!u) {
a();
return;
}
o = !Wk(document.body, n.value), o && (s = document.body.style.width), i = K1t(r.namespace.value);
const d = document.documentElement.clientHeight < document.body.scrollHeight, T = L7(document.body, "overflowY");
i > 0 && (d || T === "scroll") && o && (document.body.style.width = `calc(100% - ${i}px)`), px(document.body, n.value);
}), onScopeDispose(() => a());
};
var _ot = _g({
type: Gr(Boolean),
default: null
});
var bot = _g({
type: Gr(Function)
});
var Lot = (t10) => {
const e = `update:${t10}`, r = `onUpdate:${t10}`, n = [e], i = {
[t10]: _ot,
[r]: bot
};
return {
useModelToggle: ({
indicator: s,
toggleReason: a,
shouldHideWhenRouteChanges: u,
shouldProceed: d,
onShow: T,
onHide: f
}) => {
const Q = getCurrentInstance(), { emit: y } = Q, _ = Q.props, L = computed(() => Zo(_[r])), E = computed(() => _[t10] === null), x = ($) => {
s.value !== true && (s.value = true, a && (a.value = $), Zo(T) && T($));
}, O = ($) => {
s.value !== false && (s.value = false, a && (a.value = $), Zo(f) && f($));
}, k = ($) => {
if (_.disabled === true || Zo(d) && !d())
return;
const et = L.value && s1;
et && y(e, true), (E.value || !et) && x($);
}, R = ($) => {
if (_.disabled === true || !s1)
return;
const et = L.value && s1;
et && y(e, false), (E.value || !et) && O($);
}, F = ($) => {
S4($) && (_.disabled && $ ? L.value && y(e, false) : s.value !== $ && ($ ? x() : O()));
}, U = () => {
s.value ? R() : k();
};
return watch(() => _[t10], F), u && Q.appContext.config.globalProperties.$route !== void 0 && watch(() => ({
...Q.proxy.$route
}), () => {
u.value && s.value && R();
}), onMounted(() => {
F(_[t10]);
}), {
hide: R,
show: k,
toggle: U,
hasUpdateHandler: L
};
},
useModelToggleProps: i,
useModelToggleEmits: n
};
};
var Oz = (t10) => {
const e = getCurrentInstance();
return computed(() => {
var r, n;
return (n = (r = e == null ? void 0 : e.proxy) == null ? void 0 : r.$props) == null ? void 0 : n[t10];
});
};
var Q2 = "top";
var ks = "bottom";
var Is = "right";
var m2 = "left";
var dS = "auto";
var dd = [Q2, ks, Is, m2];
var L8 = "start";
var Dh = "end";
var wot = "clippingParents";
var Cz = "viewport";
var uu = "popper";
var xot = "reference";
var Zk = dd.reduce(function(t10, e) {
return t10.concat([e + "-" + L8, e + "-" + Dh]);
}, []);
var bg = [].concat(dd, [dS]).reduce(function(t10, e) {
return t10.concat([e, e + "-" + L8, e + "-" + Dh]);
}, []);
var Eot = "beforeRead";
var Mot = "read";
var Sot = "afterRead";
var Hot = "beforeMain";
var Aot = "main";
var Oot = "afterMain";
var Cot = "beforeWrite";
var kot = "write";
var Iot = "afterWrite";
var Pot = [Eot, Mot, Sot, Hot, Aot, Oot, Cot, kot, Iot];
function d3(t10) {
return t10 ? (t10.nodeName || "").toLowerCase() : null;
}
function ha(t10) {
if (t10 == null) return window;
if (t10.toString() !== "[object Window]") {
var e = t10.ownerDocument;
return e && e.defaultView || window;
}
return t10;
}
function w8(t10) {
var e = ha(t10).Element;
return t10 instanceof e || t10 instanceof Element;
}
function Hs(t10) {
var e = ha(t10).HTMLElement;
return t10 instanceof e || t10 instanceof HTMLElement;
}
function pS(t10) {
if (typeof ShadowRoot > "u") return false;
var e = ha(t10).ShadowRoot;
return t10 instanceof e || t10 instanceof ShadowRoot;
}
function Vot(t10) {
var e = t10.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 === false ? o.removeAttribute(s) : o.setAttribute(s, a === true ? "" : a);
}));
});
}
function Rot(t10) {
var e = t10.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 kz = { name: "applyStyles", enabled: true, phase: "write", fn: Vot, effect: Rot, requires: ["computeStyles"] };
function o3(t10) {
return t10.split("-")[0];
}
var I5 = Math.max;
var DQ = Math.min;
var x8 = Math.round;
function E8(t10, e) {
e === void 0 && (e = false);
var r = t10.getBoundingClientRect(), n = 1, i = 1;
if (Hs(t10) && e) {
var o = t10.offsetHeight, s = t10.offsetWidth;
s > 0 && (n = x8(r.width) / s || 1), o > 0 && (i = x8(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 TS(t10) {
var e = E8(t10), r = t10.offsetWidth, n = t10.offsetHeight;
return Math.abs(e.width - r) <= 1 && (r = e.width), Math.abs(e.height - n) <= 1 && (n = e.height), { x: t10.offsetLeft, y: t10.offsetTop, width: r, height: n };
}
function Iz(t10, e) {
var r = e.getRootNode && e.getRootNode();
if (t10.contains(e)) return true;
if (r && pS(r)) {
var n = e;
do {
if (n && t10.isSameNode(n)) return true;
n = n.parentNode || n.host;
} while (n);
}
return false;
}
function H4(t10) {
return ha(t10).getComputedStyle(t10);
}
function Not(t10) {
return ["table", "td", "th"].indexOf(d3(t10)) >= 0;
}
function d0(t10) {
return ((w8(t10) ? t10.ownerDocument : t10.document) || window.document).documentElement;
}
function Lg(t10) {
return d3(t10) === "html" ? t10 : t10.assignedSlot || t10.parentNode || (pS(t10) ? t10.host : null) || d0(t10);
}
function qk(t10) {
return !Hs(t10) || H4(t10).position === "fixed" ? null : t10.offsetParent;
}
function Dot(t10) {
var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, r = navigator.userAgent.indexOf("Trident") !== -1;
if (r && Hs(t10)) {
var n = H4(t10);
if (n.position === "fixed") return null;
}
var i = Lg(t10);
for (pS(i) && (i = i.host); Hs(i) && ["html", "body"].indexOf(d3(i)) < 0; ) {
var o = H4(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 pd(t10) {
for (var e = ha(t10), r = qk(t10); r && Not(r) && H4(r).position === "static"; ) r = qk(r);
return r && (d3(r) === "html" || d3(r) === "body" && H4(r).position === "static") ? e : r || Dot(t10) || e;
}
function fS(t10) {
return ["top", "bottom"].indexOf(t10) >= 0 ? "x" : "y";
}
function rh(t10, e, r) {
return I5(t10, DQ(e, r));
}
function Fot(t10, e, r) {
var n = rh(t10, e, r);
return n > r ? r : n;
}
function Pz() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function Vz(t10) {
return Object.assign({}, Pz(), t10);
}
function Rz(t10, e) {
return e.reduce(function(r, n) {
return r[n] = t10, r;
}, {});
}
var Bot = function(t10, e) {
return t10 = typeof t10 == "function" ? t10(Object.assign({}, e.rects, { placement: e.placement })) : t10, Vz(typeof t10 != "number" ? t10 : Rz(t10, dd));
};
function jot(t10) {
var e, r = t10.state, n = t10.name, i = t10.options, o = r.elements.arrow, s = r.modifiersData.popperOffsets, a = o3(r.placement), u = fS(a), d = [m2, Is].indexOf(a) >= 0, T = d ? "height" : "width";
if (!(!o || !s)) {
var f = Bot(i.padding, r), Q = TS(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 = pd(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, $ = rh(R, U, F), et = u;
r.modifiersData[n] = (e = {}, e[et] = $, e.centerOffset = $ - U, e);
}
}
function zot(t10) {
var e = t10.state, r = t10.options, n = r.element, i = n === void 0 ? "[data-popper-arrow]" : n;
i != null && (typeof i == "string" && (i = e.elements.popper.querySelector(i), !i) || !Iz(e.elements.popper, i) || (e.elements.arrow = i));
}
var Uot = { name: "arrow", enabled: true, phase: "main", fn: jot, effect: zot, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function M8(t10) {
return t10.split("-")[1];
}
var Got = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function $ot(t10) {
var e = t10.x, r = t10.y, n = window, i = n.devicePixelRatio || 1;
return { x: x8(e * i) / i || 0, y: x8(r * i) / i || 0 };
}
function Xk(t10) {
var e, r = t10.popper, n = t10.popperRect, i = t10.placement, o = t10.variation, s = t10.offsets, a = t10.position, u = t10.gpuAcceleration, d = t10.adaptive, T = t10.roundOffsets, f = t10.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 = pd(r), $ = "clientHeight", et = "clientWidth";
if (U === ha(r) && (U = d0(r), H4(U).position !== "static" && a === "absolute" && ($ = "scrollHeight", et = "scrollWidth")), U = U, i === Q2 || (i === m2 || i === Is) && o === Dh) {
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 === Dh) {
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 && Got), gt = T === true ? $ot({ 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 Wot(t10) {
var e = t10.state, r = t10.options, n = r.gpuAcceleration, i = n === void 0 ? true : n, o = r.adaptive, s = o === void 0 ? true : o, a = r.roundOffsets, u = a === void 0 ? true : a, d = { placement: o3(e.placement), variation: M8(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, Xk(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, Xk(Object.assign({}, d, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: u })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var Nz = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Wot, data: {} };
var Zp = { passive: true };
function Zot(t10) {
var e = t10.state, r = t10.instance, n = t10.options, i = n.scroll, o = i === void 0 ? true : i, s = n.resize, a = s === void 0 ? true : 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, Zp);
}), a && u.addEventListener("resize", r.update, Zp), function() {
o && d.forEach(function(T) {
T.removeEventListener("scroll", r.update, Zp);
}), a && u.removeEventListener("resize", r.update, Zp);
};
}
var Dz = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
}, effect: Zot, data: {} };
var qot = { left: "right", right: "left", bottom: "top", top: "bottom" };
function Qf(t10) {
return t10.replace(/left|right|bottom|top/g, function(e) {
return qot[e];
});
}
var Xot = { start: "end", end: "start" };
function Kk(t10) {
return t10.replace(/start|end/g, function(e) {
return Xot[e];
});
}
function QS(t10) {
var e = ha(t10), r = e.pageXOffset, n = e.pageYOffset;
return { scrollLeft: r, scrollTop: n };
}
function mS(t10) {
return E8(d0(t10)).left + QS(t10).scrollLeft;
}
function Kot(t10) {
var e = ha(t10), r = d0(t10), 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 + mS(t10), y: a };
}
function Yot(t10) {
var e, r = d0(t10), n = QS(t10), i = (e = t10.ownerDocument) == null ? void 0 : e.body, o = I5(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = I5(r.scrollHeight, r.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), a = -n.scrollLeft + mS(t10), u = -n.scrollTop;
return H4(i || r).direction === "rtl" && (a += I5(r.clientWidth, i ? i.clientWidth : 0) - o), { width: o, height: s, x: a, y: u };
}
function gS(t10) {
var e = H4(t10), r = e.overflow, n = e.overflowX, i = e.overflowY;
return /auto|scroll|overlay|hidden/.test(r + i + n);
}
function Fz(t10) {
return ["html", "body", "#document"].indexOf(d3(t10)) >= 0 ? t10.ownerDocument.body : Hs(t10) && gS(t10) ? t10 : Fz(Lg(t10));
}
function nh(t10, e) {
var r;
e === void 0 && (e = []);
var n = Fz(t10), i = n === ((r = t10.ownerDocument) == null ? void 0 : r.body), o = ha(n), s = i ? [o].concat(o.visualViewport || [], gS(n) ? n : []) : n, a = e.concat(s);
return i ? a : a.concat(nh(Lg(s)));
}
function fx(t10) {
return Object.assign({}, t10, { left: t10.x, top: t10.y, right: t10.x + t10.width, bottom: t10.y + t10.height });
}
function Jot(t10) {
var e = E8(t10);
return e.top = e.top + t10.clientTop, e.left = e.left + t10.clientLeft, e.bottom = e.top + t10.clientHeight, e.right = e.left + t10.clientWidth, e.width = t10.clientWidth, e.height = t10.clientHeight, e.x = e.left, e.y = e.top, e;
}
function Yk(t10, e) {
return e === Cz ? fx(Kot(t10)) : w8(e) ? Jot(e) : fx(Yot(d0(t10)));
}
function t2t(t10) {
var e = nh(Lg(t10)), r = ["absolute", "fixed"].indexOf(H4(t10).position) >= 0, n = r && Hs(t10) ? pd(t10) : t10;
return w8(n) ? e.filter(function(i) {
return w8(i) && Iz(i, n) && d3(i) !== "body";
}) : [];
}
function e2t(t10, e, r) {
var n = e === "clippingParents" ? t2t(t10) : [].concat(e), i = [].concat(n, [r]), o = i[0], s = i.reduce(function(a, u) {
var d = Yk(t10, u);
return a.top = I5(d.top, a.top), a.right = DQ(d.right, a.right), a.bottom = DQ(d.bottom, a.bottom), a.left = I5(d.left, a.left), a;
}, Yk(t10, o));
return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
}
function Bz(t10) {
var e = t10.reference, r = t10.element, n = t10.placement, i = n ? o3(n) : null, o = n ? M8(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 ? fS(i) : null;
if (d != null) {
var T = d === "y" ? "height" : "width";
switch (o) {
case L8:
u[d] = u[d] - (e[T] / 2 - r[T] / 2);
break;
case Dh:
u[d] = u[d] + (e[T] / 2 - r[T] / 2);
break;
}
}
return u;
}
function Fh(t10, e) {
e === void 0 && (e = {});
var r = e, n = r.placement, i = n === void 0 ? t10.placement : n, o = r.boundary, s = o === void 0 ? wot : o, a = r.rootBoundary, u = a === void 0 ? Cz : a, d = r.elementContext, T = d === void 0 ? uu : d, f = r.altBoundary, Q = f === void 0 ? false : f, y = r.padding, _ = y === void 0 ? 0 : y, L = Vz(typeof _ != "number" ? _ : Rz(_, dd)), E = T === uu ? xot : uu, x = t10.rects.popper, O = t10.elements[Q ? E : T], k = e2t(w8(O) ? O : O.contextElement || d0(t10.elements.popper), s, u), R = E8(t10.elements.reference), F = Bz({ reference: R, element: x, strategy: "absolute", placement: i }), U = fx(Object.assign({}, x, F)), $ = T === uu ? 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 = t10.modifiersData.offset;
if (T === uu && 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 r2t(t10, 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 ? bg : u, T = M8(n), f = T ? a ? Zk : Zk.filter(function(_) {
return M8(_) === T;
}) : dd, Q = f.filter(function(_) {
return d.indexOf(_) >= 0;
});
Q.length === 0 && (Q = f);
var y = Q.reduce(function(_, L) {
return _[L] = Fh(t10, { placement: L, boundary: i, rootBoundary: o, padding: s })[o3(L)], _;
}, {});
return Object.keys(y).sort(function(_, L) {
return y[_] - y[L];
});
}
function n2t(t10) {
if (o3(t10) === dS) return [];
var e = Qf(t10);
return [Kk(t10), e, Kk(e)];
}
function i2t(t10) {
var e = t10.state, r = t10.options, n = t10.name;
if (!e.modifiersData[n]._skip) {
for (var i = r.mainAxis, o = i === void 0 ? true : i, s = r.altAxis, a = s === void 0 ? true : s, u = r.fallbackPlacements, d = r.padding, T = r.boundary, f = r.rootBoundary, Q = r.altBoundary, y = r.flipVariations, _ = y === void 0 ? true : y, L = r.allowedAutoPlacements, E = e.options.placement, x = o3(E), O = x === E, k = u || (O || !_ ? [Qf(E)] : n2t(E)), R = [E].concat(k).reduce(function(er, Je) {
return er.concat(o3(Je) === dS ? r2t(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 = true, nt = R[0], ct = 0; ct < R.length; ct++) {
var rt = R[ct], gt = o3(rt), It = M8(rt) === L8, Zt = [Q2, ks].indexOf(gt) >= 0, oe = Zt ? "width" : "height", re = Fh(e, { placement: rt, boundary: T, rootBoundary: f, altBoundary: Q, padding: d }), Ve = Zt ? It ? Is : m2 : It ? ks : Q2;
F[oe] > U[oe] && (Ve = Qf(Ve));
var yr = Qf(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 = false;
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 = true, e.placement = nt, e.reset = true);
}
}
var o2t = { name: "flip", enabled: true, phase: "main", fn: i2t, requiresIfExists: ["offset"], data: { _skip: false } };
function Jk(t10, e, r) {
return r === void 0 && (r = { x: 0, y: 0 }), { top: t10.top - e.height - r.y, right: t10.right - e.width + r.x, bottom: t10.bottom - e.height + r.y, left: t10.left - e.width - r.x };
}
function tI(t10) {
return [Q2, Is, ks, m2].some(function(e) {
return t10[e] >= 0;
});
}
function s2t(t10) {
var e = t10.state, r = t10.name, n = e.rects.reference, i = e.rects.popper, o = e.modifiersData.preventOverflow, s = Fh(e, { elementContext: "reference" }), a = Fh(e, { altBoundary: true }), u = Jk(s, n), d = Jk(a, i, o), T = tI(u), f = tI(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 a2t = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: s2t };
function l2t(t10, e, r) {
var n = o3(t10), i = [m2, Q2].indexOf(n) >= 0 ? -1 : 1, o = typeof r == "function" ? r(Object.assign({}, e, { placement: t10 })) : 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 c2t(t10) {
var e = t10.state, r = t10.options, n = t10.name, i = r.offset, o = i === void 0 ? [0, 0] : i, s = bg.reduce(function(T, f) {
return T[f] = l2t(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 u2t = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: c2t };
function h2t(t10) {
var e = t10.state, r = t10.name;
e.modifiersData[r] = Bz({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var jz = { name: "popperOffsets", enabled: true, phase: "read", fn: h2t, data: {} };
function d2t(t10) {
return t10 === "x" ? "y" : "x";
}
function p2t(t10) {
var e = t10.state, r = t10.options, n = t10.name, i = r.mainAxis, o = i === void 0 ? true : i, s = r.altAxis, a = s === void 0 ? false : s, u = r.boundary, d = r.rootBoundary, T = r.altBoundary, f = r.padding, Q = r.tether, y = Q === void 0 ? true : Q, _ = r.tetherOffset, L = _ === void 0 ? 0 : _, E = Fh(e, { boundary: u, rootBoundary: d, padding: f, altBoundary: T }), x = o3(e.placement), O = M8(e.placement), k = !O, R = fS(x), F = d2t(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 === L8 ? $[re] : et[re], Ke = O === L8 ? -et[re] : -$[re], He = e.elements.arrow, er = y && He ? TS(He) : { width: 0, height: 0 }, Je = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Pz(), Ne = Je[Zt], Gt = Je[oe], te = rh(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 && pd(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 = rh(y ? DQ(yr, $e) : yr, Ve, y ? I5(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 ? Fot(Ii, Rr, c1) : rh(y ? Ii : ji, Rr, y ? c1 : Ji);
U[F] = ye, gt[F] = ye - Rr;
}
e.modifiersData[n] = gt;
}
}
var T2t = { name: "preventOverflow", enabled: true, phase: "main", fn: p2t, requiresIfExists: ["offset"] };
function f2t(t10) {
return { scrollLeft: t10.scrollLeft, scrollTop: t10.scrollTop };
}
function Q2t(t10) {
return t10 === ha(t10) || !Hs(t10) ? QS(t10) : f2t(t10);
}
function m2t(t10) {
var e = t10.getBoundingClientRect(), r = x8(e.width) / t10.offsetWidth || 1, n = x8(e.height) / t10.offsetHeight || 1;
return r !== 1 || n !== 1;
}
function g2t(t10, e, r) {
r === void 0 && (r = false);
var n = Hs(e), i = Hs(e) && m2t(e), o = d0(e), s = E8(t10, i), a = { scrollLeft: 0, scrollTop: 0 }, u = { x: 0, y: 0 };
return (n || !n && !r) && ((d3(e) !== "body" || gS(o)) && (a = Q2t(e)), Hs(e) ? (u = E8(e, true), u.x += e.clientLeft, u.y += e.clientTop) : o && (u.x = mS(o))), { x: s.left + a.scrollLeft - u.x, y: s.top + a.scrollTop - u.y, width: s.width, height: s.height };
}
function y2t(t10) {
var e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), n = [];
t10.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 t10.forEach(function(o) {
r.has(o.name) || i(o);
}), n;
}
function v2t(t10) {
var e = y2t(t10);
return Pot.reduce(function(r, n) {
return r.concat(e.filter(function(i) {
return i.phase === n;
}));
}, []);
}
function _2t(t10) {
var e;
return function() {
return e || (e = new Promise(function(r) {
Promise.resolve().then(function() {
e = void 0, r(t10());
});
})), e;
};
}
function b2t(t10) {
var e = t10.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 eI = { placement: "bottom", modifiers: [], strategy: "absolute" };
function rI() {
for (var t10 = arguments.length, e = new Array(t10), r = 0; r < t10; r++) e[r] = arguments[r];
return !e.some(function(n) {
return !(n && typeof n.getBoundingClientRect == "function");
});
}
function yS(t10) {
t10 === void 0 && (t10 = {});
var e = t10, r = e.defaultModifiers, n = r === void 0 ? [] : r, i = e.defaultOptions, o = i === void 0 ? eI : i;
return function(s, a, u) {
u === void 0 && (u = o);
var d = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, eI, o), modifiersData: {}, elements: { reference: s, popper: a }, attributes: {}, styles: {} }, T = [], f = false, 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: w8(s) ? nh(s) : s.contextElement ? nh(s.contextElement) : [], popper: nh(a) };
var x = v2t(b2t([].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 (rI(E, x)) {
d.rects = { reference: g2t(E, pd(x), d.options.strategy === "fixed"), popper: TS(x) }, d.reset = false, 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 === true) {
d.reset = false, 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: _2t(function() {
return new Promise(function(L) {
Q.forceUpdate(), L(d);
});
}), destroy: function() {
_(), f = true;
} };
if (!rI(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;
};
}
yS();
var L2t = [Dz, jz, Nz, kz];
yS({ defaultModifiers: L2t });
var w2t = [Dz, jz, Nz, kz, u2t, o2t, T2t, Uot, a2t];
var x2t = yS({ defaultModifiers: w2t });
var E2t = (t10, e, r = {}) => {
const n = {
name: "updateState",
enabled: true,
phase: "write",
fn: ({ state: u }) => {
const d = M2t(u);
Object.assign(s.value, d);
},
requires: ["computeStyles"]
}, i = computed(() => {
const { onFirstUpdate: u, placement: d, strategy: T, modifiers: f } = unref(r);
return {
onFirstUpdate: u,
placement: d || "bottom",
strategy: T || "absolute",
modifiers: [
...f || [],
n,
{ name: "applyStyles", enabled: false }
]
};
}), o = shallowRef(), s = ref({
styles: {
popper: {
position: unref(i).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
}), a = () => {
o.value && (o.value.destroy(), o.value = void 0);
};
return watch(i, (u) => {
const d = unref(o);
d && d.setOptions(u);
}, {
deep: true
}), watch([t10, e], ([u, d]) => {
a(), !(!u || !d) && (o.value = x2t(u, d, unref(i)));
}), onBeforeUnmount(() => {
a();
}), {
state: computed(() => {
var u;
return { ...((u = unref(o)) == null ? void 0 : u.state) || {} };
}),
styles: computed(() => unref(s).styles),
attributes: computed(() => unref(s).attributes),
update: () => {
var u;
return (u = unref(o)) == null ? void 0 : u.update();
},
forceUpdate: () => {
var u;
return (u = unref(o)) == null ? void 0 : u.forceUpdate();
},
instanceRef: computed(() => unref(o))
};
};
function M2t(t10) {
const e = Object.keys(t10.elements), r = dx(e.map((i) => [i, t10.styles[i] || {}])), n = dx(e.map((i) => [i, t10.attributes[i]]));
return {
styles: r,
attributes: n
};
}
var zz = (t10) => {
if (!t10)
return { onClick: C5, onMousedown: C5, onMouseup: C5 };
let e = false, r = false;
return { onClick: (s) => {
e && r && t10(s), e = r = false;
}, onMousedown: (s) => {
e = s.target === s.currentTarget;
}, onMouseup: (s) => {
r = s.target === s.currentTarget;
} };
};
function nI() {
let t10;
const e = (n, i) => {
r(), t10 = window.setTimeout(n, i);
}, r = () => window.clearTimeout(t10);
return ud(() => r()), {
registerTimeout: e,
cancelTimeout: r
};
}
var Qx = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
};
var S2t = Symbol("elIdInjection");
var Uz = () => getCurrentInstance() ? inject(S2t, Qx) : Qx;
var U5 = (t10) => {
const e = Uz();
!s1 && e === Qx && 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 = hS();
return computed(() => unref(t10) || `${r.value}-id-${e.prefix}-${e.current++}`);
};
var w7 = [];
var iI = (t10) => {
const e = t10;
e.key === Nh.esc && w7.forEach((r) => r(e));
};
var H2t = (t10) => {
onMounted(() => {
w7.length === 0 && document.addEventListener("keydown", iI), s1 && w7.push(t10);
}), onBeforeUnmount(() => {
w7 = w7.filter((e) => e !== t10), w7.length === 0 && s1 && document.removeEventListener("keydown", iI);
});
};
var oI;
var Gz = () => {
const t10 = hS(), e = Uz(), r = computed(() => `${t10.value}-popper-container-${e.prefix}`), n = computed(() => `#${r.value}`);
return {
id: r,
selector: n
};
};
var A2t = (t10) => {
const e = document.createElement("div");
return e.id = t10, document.body.appendChild(e), e;
};
var O2t = () => {
const { id: t10, selector: e } = Gz();
return onBeforeMount(() => {
s1 && (!oI || !document.body.querySelector(e.value)) && (oI = A2t(t10.value));
}), {
id: t10,
selector: e
};
};
var C2t = Sn({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
});
var k2t = ({
showAfter: t10,
hideAfter: e,
autoClose: r,
open: n,
close: i
}) => {
const { registerTimeout: o } = nI(), {
registerTimeout: s,
cancelTimeout: a
} = nI();
return {
onOpen: (T) => {
o(() => {
n(T);
const f = unref(r);
ro(f) && f > 0 && s(() => {
i(T);
}, f);
}, unref(t10));
},
onClose: (T) => {
a(), o(() => {
i(T);
}, unref(e));
}
};
};
var $z = Symbol("elForwardRef");
var I2t = (t10) => {
provide($z, {
setForwardRef: (r) => {
t10.value = r;
}
});
};
var P2t = (t10) => ({
mounted(e) {
t10(e);
},
updated(e) {
t10(e);
},
unmounted() {
t10(null);
}
});
var sI = {
current: 0
};
var aI = ref(0);
var Wz = 2e3;
var lI = Symbol("elZIndexContextKey");
var Zz = Symbol("zIndexContextKey");
var vS = (t10) => {
const e = getCurrentInstance() ? inject(lI, sI) : sI, r = t10 || (getCurrentInstance() ? inject(Zz, void 0) : void 0), n = computed(() => {
const s = unref(r);
return ro(s) ? s : Wz;
}), i = computed(() => n.value + aI.value), o = () => (e.current++, aI.value = e.current, i.value);
return !s1 && !inject(lI) && 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
};
};
var J8 = _g({
type: String,
values: Sz,
required: false
});
var qz = Symbol("size");
var V2t = () => {
const t10 = inject(qz, {});
return computed(() => unref(t10.size) || "");
};
function R2t(t10, {
beforeFocus: e,
afterFocus: r,
beforeBlur: n,
afterBlur: i
} = {}) {
const o = getCurrentInstance(), { emit: s } = o, a = shallowRef(), u = ref(false), d = (Q) => {
Zo(e) && e(Q) || u.value || (u.value = true, 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 = false, s("blur", Q), i == null || i());
}, f = () => {
var Q, y;
(Q = a.value) != null && Q.contains(document.activeElement) && a.value !== document.activeElement || (y = t10.value) == null || y.focus();
};
return watch(a, (Q) => {
Q && Q.setAttribute("tabindex", "-1");
}), ea(a, "focus", d, true), ea(a, "blur", T, true), ea(a, "click", f, true), false, {
isFocused: u,
wrapperRef: a,
handleFocus: d,
handleBlur: T
};
}
function N2t({
afterComposition: t10,
emit: e
}) {
const r = ref(false), n = (a) => {
e == null || e("compositionstart", a), r.value = true;
}, 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 = !pot(T);
}, o = (a) => {
e == null || e("compositionend", a), r.value && (r.value = false, nextTick(() => t10(a)));
};
return {
isComposing: r,
handleComposition: (a) => {
a.type === "compositionend" ? o(a) : i(a);
},
handleCompositionStart: n,
handleCompositionUpdate: i,
handleCompositionEnd: o
};
}
var Xz = Symbol("emptyValuesContextKey");
var D2t = "use-empty-values";
var F2t = ["", void 0, null];
var B2t = void 0;
var j2t = Sn({
emptyValues: Array,
valueOnClear: {
type: [String, Number, Boolean, Function],
default: void 0,
validator: (t10) => Zo(t10) ? !t10() : !t10
}
});
var z2t = (t10, e) => {
const r = getCurrentInstance() ? inject(Xz, ref({})) : ref({}), n = computed(() => t10.emptyValues || r.value.emptyValues || F2t), i = computed(() => Zo(t10.valueOnClear) ? t10.valueOnClear() : t10.valueOnClear !== void 0 ? t10.valueOnClear : Zo(r.value.valueOnClear) ? r.value.valueOnClear() : r.value.valueOnClear !== void 0 ? r.value.valueOnClear : B2t), o = (s) => n.value.includes(s);
return n.value.includes(i.value) || y2(D2t, "value-on-clear should be a value of empty-values"), {
emptyValues: n,
valueOnClear: i,
isEmptyValue: o
};
};
var U2t = Sn({
ariaLabel: String,
ariaOrientation: {
type: String,
values: ["horizontal", "vertical", "undefined"]
},
ariaControls: String
});
var sl = (t10) => gz(U2t, t10);
var Kz = Symbol();
var FQ = ref();
function wg(t10, e = void 0) {
const r = getCurrentInstance() ? inject(Kz, FQ) : FQ;
return t10 ? computed(() => {
var n, i;
return (i = (n = r.value) == null ? void 0 : n[t10]) != null ? i : e;
}) : r;
}
function G2t(t10, e) {
const r = wg(), n = Bn(t10, computed(() => {
var a;
return ((a = r.value) == null ? void 0 : a.namespace) || eh;
})), i = uS(computed(() => {
var a;
return (a = r.value) == null ? void 0 : a.locale;
})), o = vS(computed(() => {
var a;
return ((a = r.value) == null ? void 0 : a.zIndex) || Wz;
})), s = computed(() => {
var a;
return unref(e) || ((a = r.value) == null ? void 0 : a.size) || "";
});
return $2t(computed(() => unref(r) || {})), {
ns: n,
locale: i,
zIndex: o,
size: s
};
}
var $2t = (t10, e, r = false) => {
var n;
const i = !!getCurrentInstance(), o = i ? wg() : void 0, s = (n = void 0) != null ? n : i ? provide : void 0;
if (!s) {
y2("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
return;
}
const a = computed(() => {
const u = unref(t10);
return o != null && o.value ? W2t(o.value, u) : u;
});
return s(Kz, a), s(Hz, computed(() => a.value.locale)), s(Az, computed(() => a.value.namespace)), s(Zz, computed(() => a.value.zIndex)), s(qz, {
size: computed(() => a.value.size || "")
}), s(Xz, computed(() => ({
emptyValues: a.value.emptyValues,
valueOnClear: a.value.valueOnClear
}))), (r || !FQ.value) && (FQ.value = a.value), a;
};
var W2t = (t10, e) => {
const r = [.../* @__PURE__ */ new Set([...$k(t10), ...$k(e)])], n = {};
for (const i of r)
n[i] = e[i] !== void 0 ? e[i] : t10[i];
return n;
};
var Hn = (t10, e) => {
const r = t10.__vccOpts || t10;
for (const [n, i] of e)
r[n] = i;
return r;
};
var Z2t = Sn({
size: {
type: Gr([Number, String])
},
color: {
type: String
}
});
var q2t = defineComponent({
name: "ElIcon",
inheritAttrs: false
});
var X2t = defineComponent({
...q2t,
props: Z2t,
setup(t10) {
const e = t10, r = Bn("icon"), n = computed(() => {
const { size: i, color: o } = e;
return !i && !o ? {} : {
fontSize: q6(i) ? void 0 : z5(i),
"--color": o
};
});
return (i, o) => (openBlock(), createElementBlock("i", mergeProps({
class: unref(r).b(),
style: unref(n)
}, i.$attrs), [
renderSlot(i.$slots, "default")
], 16));
}
});
var K2t = Hn(X2t, [["__file", "icon.vue"]]);
var p3 = v2(K2t);
var _S = Symbol("formContextKey");
var BQ = Symbol("formItemContextKey");
var S8 = (t10, e = {}) => {
const r = ref(void 0), n = e.prop ? r : Oz("size"), i = e.global ? r : V2t(), o = e.form ? { size: void 0 } : inject(_S, void 0), s = e.formItem ? { size: void 0 } : inject(BQ, void 0);
return computed(() => n.value || unref(t10) || (s == null ? void 0 : s.size) || (o == null ? void 0 : o.size) || i.value || "");
};
var xg = (t10) => {
const e = Oz("disabled"), r = inject(_S, void 0);
return computed(() => e.value || unref(t10) || (r == null ? void 0 : r.disabled) || false);
};
var tc = () => {
const t10 = inject(_S, void 0), e = inject(BQ, void 0);
return {
form: t10,
formItem: e
};
};
var Eg = (t10, {
formItemContext: e,
disableIdGeneration: r,
disableIdManagement: n
}) => {
r || (r = ref(false)), n || (n = ref(false));
const i = ref();
let o;
const s = computed(() => {
var a;
return !!(!(t10.label || t10.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1);
});
return onMounted(() => {
o = watch([toRef(t10, "id"), r], ([a, u]) => {
const d = a ?? (u ? void 0 : U5().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: true });
}), onUnmounted(() => {
o && o(), e != null && e.removeInputId && i.value && e.removeInputId(i.value);
}), {
isLabeledByFormItem: s,
inputId: i
};
};
var Xl = 4;
var Y2t = {
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"
}
};
var J2t = ({
move: t10,
size: e,
bar: r
}) => ({
[r.size]: e,
transform: `translate${r.axis}(${t10}%)`
});
var bS = Symbol("scrollbarContextKey");
var tst = Sn({
vertical: Boolean,
size: String,
move: Number,
ratio: {
type: Number,
required: true
},
always: Boolean
});
var est = "Thumb";
var rst = defineComponent({
__name: "thumb",
props: tst,
setup(t10) {
const e = t10, r = inject(bS), n = Bn("scrollbar");
r || vz(est, "can not inject scrollbar context");
const i = ref(), o = ref(), s = ref({}), a = ref(false);
let u = false, d = false, T = s1 ? document.onselectstart : null;
const f = computed(() => Y2t[e.vertical ? "vertical" : "horizontal"]), Q = computed(() => J2t({
size: e.size,
move: e.move,
bar: f.value
})), y = computed(() => 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 = true, document.addEventListener("mousemove", x), document.addEventListener("mouseup", O), T = document.onselectstart, document.onselectstart = () => false;
}, x = (U) => {
if (!i.value || !o.value || u === false)
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 = false, s.value[f.value.axis] = 0, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", O), F(), d && (a.value = false);
}, k = () => {
d = false, a.value = !!e.size;
}, R = () => {
d = true, a.value = u;
};
onBeforeUnmount(() => {
F(), document.removeEventListener("mouseup", O);
});
const F = () => {
document.onselectstart !== T && (document.onselectstart = T);
};
return ea(toRef(r, "scrollbarElement"), "mousemove", k), ea(toRef(r, "scrollbarElement"), "mouseleave", R), (U, $) => (openBlock(), createBlock(Transition, {
name: unref(n).b("fade"),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createBaseVNode("div", {
ref_key: "instance",
ref: i,
class: normalizeClass([unref(n).e("bar"), unref(n).is(unref(f).key)]),
onMousedown: L
}, [
createBaseVNode("div", {
ref_key: "thumb",
ref: o,
class: normalizeClass(unref(n).e("thumb")),
style: normalizeStyle(unref(Q)),
onMousedown: _
}, null, 38)
], 34), [
[vShow, U.always || a.value]
])
]),
_: 1
}, 8, ["name"]));
}
});
var cI = Hn(rst, [["__file", "thumb.vue"]]);
var nst = Sn({
always: {
type: Boolean,
default: true
},
minSize: {
type: Number,
required: true
}
});
var ist = defineComponent({
__name: "bar",
props: nst,
setup(t10, { expose: e }) {
const r = t10, n = inject(bS), i = ref(0), o = ref(0), s = ref(""), a = ref(""), u = ref(1), d = ref(1);
return e({
handleScroll: (Q) => {
if (Q) {
const y = Q.offsetHeight - Xl, _ = Q.offsetWidth - Xl;
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 - Xl, _ = Q.offsetWidth - Xl, 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 + Xl < y ? `${x}px` : "", s.value = O + Xl < _ ? `${O}px` : "";
}
}), (Q, y) => (openBlock(), createElementBlock(Fragment, null, [
createVNode(cI, {
move: i.value,
ratio: d.value,
size: s.value,
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"]),
createVNode(cI, {
move: o.value,
ratio: u.value,
size: a.value,
vertical: "",
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"])
], 64));
}
});
var ost = Hn(ist, [["__file", "bar.vue"]]);
var sst = Sn({
height: {
type: [String, Number],
default: ""
},
maxHeight: {
type: [String, Number],
default: ""
},
native: {
type: Boolean,
default: false
},
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,
...sl(["ariaLabel", "ariaOrientation"])
});
var ast = {
scroll: ({
scrollTop: t10,
scrollLeft: e
}) => [t10, e].every(ro)
};
var mx = "ElScrollbar";
var lst = defineComponent({
name: mx
});
var cst = defineComponent({
...lst,
props: sst,
emits: ast,
setup(t10, { expose: e, emit: r }) {
const n = t10, i = Bn("scrollbar");
let o, s, a = 0, u = 0;
const d = ref(), T = ref(), f = ref(), Q = ref(), y = computed(() => {
const F = {};
return n.height && (F.height = z5(n.height)), n.maxHeight && (F.maxHeight = z5(n.maxHeight)), [n.wrapStyle, F];
}), _ = computed(() => [
n.wrapClass,
i.e("wrap"),
{ [i.em("wrap", "hidden-default")]: !n.native }
]), L = computed(() => [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(mx, "value must be a number");
return;
}
T.value.scrollTop = F;
}, k = (F) => {
if (!ro(F)) {
y2(mx, "value must be a number");
return;
}
T.value.scrollLeft = F;
}, R = () => {
var F;
(F = Q.value) == null || F.update();
};
return watch(() => n.noresize, (F) => {
F ? (o == null || o(), s == null || s()) : ({ stop: o } = B6(f, R), s = ea("resize", R));
}, { immediate: true }), watch(() => [n.maxHeight, n.height], () => {
n.native || nextTick(() => {
var F;
R(), T.value && ((F = Q.value) == null || F.handleScroll(T.value));
});
}), provide(bS, reactive({
scrollbarElement: d,
wrapElement: T
})), onActivated(() => {
T.value && (T.value.scrollTop = a, T.value.scrollLeft = u);
}), onMounted(() => {
n.native || nextTick(() => {
R();
});
}), onUpdated(() => R()), e({
wrapRef: T,
update: R,
scrollTo: x,
setScrollTop: O,
setScrollLeft: k,
handleScroll: E
}), (F, U) => (openBlock(), createElementBlock("div", {
ref_key: "scrollbarRef",
ref: d,
class: normalizeClass(unref(i).b())
}, [
createBaseVNode("div", {
ref_key: "wrapRef",
ref: T,
class: normalizeClass(unref(_)),
style: normalizeStyle(unref(y)),
tabindex: F.tabindex,
onScroll: E
}, [
(openBlock(), createBlock(resolveDynamicComponent(F.tag), {
id: F.id,
ref_key: "resizeRef",
ref: f,
class: normalizeClass(unref(L)),
style: normalizeStyle(F.viewStyle),
role: F.role,
"aria-label": F.ariaLabel,
"aria-orientation": F.ariaOrientation
}, {
default: withCtx(() => [
renderSlot(F.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
], 46, ["tabindex"]),
F.native ? createCommentVNode("v-if", true) : (openBlock(), createBlock(ost, {
key: 0,
ref_key: "barRef",
ref: Q,
always: F.always,
"min-size": F.minSize
}, null, 8, ["always", "min-size"]))
], 2));
}
});
var ust = Hn(cst, [["__file", "scrollbar.vue"]]);
var hst = v2(ust);
var LS = Symbol("popper");
var Yz = Symbol("popperContent");
var dst = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
];
var Jz = Sn({
role: {
type: String,
values: dst,
default: "tooltip"
}
});
var pst = defineComponent({
name: "ElPopper",
inheritAttrs: false
});
var Tst = defineComponent({
...pst,
props: Jz,
setup(t10, { expose: e }) {
const r = t10, n = ref(), i = ref(), o = ref(), s = ref(), a = computed(() => r.role), u = {
triggerRef: n,
popperInstanceRef: i,
contentRef: o,
referenceRef: s,
role: a
};
return e(u), provide(LS, u), (d, T) => renderSlot(d.$slots, "default");
}
});
var fst = Hn(Tst, [["__file", "popper.vue"]]);
var tU = Sn({
arrowOffset: {
type: Number,
default: 5
}
});
var Qst = defineComponent({
name: "ElPopperArrow",
inheritAttrs: false
});
var mst = defineComponent({
...Qst,
props: tU,
setup(t10, { expose: e }) {
const r = t10, n = Bn("popper"), { arrowOffset: i, arrowRef: o, arrowStyle: s } = inject(Yz, void 0);
return watch(() => r.arrowOffset, (a) => {
i.value = a;
}), onBeforeUnmount(() => {
o.value = void 0;
}), e({
arrowRef: o
}), (a, u) => (openBlock(), createElementBlock("span", {
ref_key: "arrowRef",
ref: o,
class: normalizeClass(unref(n).e("arrow")),
style: normalizeStyle(unref(s)),
"data-popper-arrow": ""
}, null, 6));
}
});
var gst = Hn(mst, [["__file", "arrow.vue"]]);
var Qb = "ElOnlyChild";
var yst = defineComponent({
name: Qb,
setup(t10, {
slots: e,
attrs: r
}) {
var n;
const i = inject($z), o = P2t((n = i == null ? void 0 : i.setForwardRef) != null ? n : C5);
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(Qb, "requires exact only one valid child."), null;
const u = eU(a);
return u ? withDirectives(cloneVNode(u, r), [[o]]) : (y2(Qb, "no valid child node found"), null);
};
}
});
function eU(t10) {
if (!t10)
return null;
const e = t10;
for (const r of e) {
if (T2(r))
switch (r.type) {
case Comment:
continue;
case Text:
case "svg":
return uI(r);
case Fragment:
return eU(r.children);
default:
return r;
}
return uI(r);
}
return null;
}
function uI(t10) {
const e = Bn("only-child");
return createVNode("span", {
class: e.e("content")
}, [t10]);
}
var rU = 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
});
var vst = defineComponent({
name: "ElPopperTrigger",
inheritAttrs: false
});
var _st = defineComponent({
...vst,
props: rU,
setup(t10, { expose: e }) {
const r = t10, { role: n, triggerRef: i } = inject(LS, void 0);
I2t(i);
const o = computed(() => a.value ? r.id : void 0), s = computed(() => {
if (n && n.value === "tooltip")
return r.open && r.id ? r.id : void 0;
}), a = computed(() => {
if (n && n.value !== "tooltip")
return n.value;
}), u = computed(() => a.value ? `${r.open}` : void 0);
let d;
const T = [
"onMouseenter",
"onMouseleave",
"onClick",
"onKeydown",
"onFocus",
"onBlur",
"onContextmenu"
];
return onMounted(() => {
watch(() => r.virtualRef, (f) => {
f && (i.value = f4(f));
}, {
immediate: true
}), watch(i, (f, Q) => {
d == null || d(), d = void 0, k5(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 = watch([o, s, a, u], (y) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((_, L) => {
vg(y[L]) ? f.removeAttribute(_) : f.setAttribute(_, y[L]);
});
}, { immediate: true })), k5(Q) && [
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((y) => Q.removeAttribute(y));
}, {
immediate: true
});
}), onBeforeUnmount(() => {
if (d == null || d(), d = void 0, i.value && k5(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 ? createCommentVNode("v-if", true) : (openBlock(), createBlock(unref(yst), mergeProps({ key: 0 }, f.$attrs, {
"aria-controls": unref(o),
"aria-describedby": unref(s),
"aria-expanded": unref(u),
"aria-haspopup": unref(a)
}), {
default: withCtx(() => [
renderSlot(f.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
}
});
var bst = Hn(_st, [["__file", "trigger.vue"]]);
var mb = "focus-trap.focus-after-trapped";
var gb = "focus-trap.focus-after-released";
var Lst = "focus-trap.focusout-prevented";
var hI = {
cancelable: true,
bubbles: false
};
var wst = {
cancelable: true,
bubbles: false
};
var dI = "focusAfterTrapped";
var pI = "focusAfterReleased";
var nU = Symbol("elFocusTrap");
var wS = ref();
var Mg = ref(0);
var xS = ref(0);
var qp = 0;
var iU = (t10) => {
const e = [], r = document.createTreeWalker(t10, 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;
};
var TI = (t10, e) => {
for (const r of t10)
if (!xst(r, e))
return r;
};
var xst = (t10, e) => {
if (false)
return false;
if (getComputedStyle(t10).visibility === "hidden")
return true;
for (; t10; ) {
if (e && t10 === e)
return false;
if (getComputedStyle(t10).display === "none")
return true;
t10 = t10.parentElement;
}
return false;
};
var Est = (t10) => {
const e = iU(t10), r = TI(e, t10), n = TI(e.reverse(), t10);
return [r, n];
};
var Mst = (t10) => t10 instanceof HTMLInputElement && "select" in t10;
var H6 = (t10, e) => {
if (t10 && t10.focus) {
const r = document.activeElement;
t10.focus({ preventScroll: true }), xS.value = window.performance.now(), t10 !== r && Mst(t10) && e && t10.select();
}
};
function fI(t10, e) {
const r = [...t10], n = t10.indexOf(e);
return n !== -1 && r.splice(n, 1), r;
}
var Sst = () => {
let t10 = [];
return {
push: (n) => {
const i = t10[0];
i && n !== i && i.pause(), t10 = fI(t10, n), t10.unshift(n);
},
remove: (n) => {
var i, o;
t10 = fI(t10, n), (o = (i = t10[0]) == null ? void 0 : i.resume) == null || o.call(i);
}
};
};
var Hst = (t10, e = false) => {
const r = document.activeElement;
for (const n of t10)
if (H6(n, e), document.activeElement !== r)
return;
};
var QI = Sst();
var Ast = () => Mg.value > xS.value;
var Xp = () => {
wS.value = "pointer", Mg.value = window.performance.now();
};
var mI = () => {
wS.value = "keyboard", Mg.value = window.performance.now();
};
var Ost = () => (onMounted(() => {
qp === 0 && (document.addEventListener("mousedown", Xp), document.addEventListener("touchstart", Xp), document.addEventListener("keydown", mI)), qp++;
}), onBeforeUnmount(() => {
qp--, qp <= 0 && (document.removeEventListener("mousedown", Xp), document.removeEventListener("touchstart", Xp), document.removeEventListener("keydown", mI));
}), {
focusReason: wS,
lastUserFocusTimestamp: Mg,
lastAutomatedFocusTimestamp: xS
});
var Kp = (t10) => new CustomEvent(Lst, {
...wst,
detail: t10
});
var Cst = defineComponent({
name: "ElFocusTrap",
inheritAttrs: false,
props: {
loop: Boolean,
trapped: Boolean,
focusTrapEl: Object,
focusStartEl: {
type: [Object, String],
default: "first"
}
},
emits: [
dI,
pI,
"focusin",
"focusout",
"focusout-prevented",
"release-requested"
],
setup(t10, { emit: e }) {
const r = ref();
let n, i;
const { focusReason: o } = Ost();
H2t((_) => {
t10.trapped && !s.paused && e("release-requested", _);
});
const s = {
paused: false,
pause() {
this.paused = true;
},
resume() {
this.paused = false;
}
}, a = (_) => {
if (!t10.loop && !t10.trapped || s.paused)
return;
const { key: L, altKey: E, ctrlKey: x, metaKey: O, currentTarget: k, shiftKey: R } = _, { loop: F } = t10, U = L === Nh.tab && !E && !x && !O, $ = document.activeElement;
if (U && $) {
const et = k, [nt, ct] = Est(et);
if (nt && ct) {
if (!R && $ === ct) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && H6(nt, true));
} else if (R && [nt, et].includes($)) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && H6(ct, true));
}
} else if ($ === et) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || _.preventDefault();
}
}
};
provide(nU, {
focusTrapRef: r,
onKeydown: a
}), watch(() => t10.focusTrapEl, (_) => {
_ && (r.value = _);
}, { immediate: true }), watch([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(dI, _);
}, d = (_) => e(pI, _), T = (_) => {
const L = unref(r);
if (!L)
return;
const E = _.target, x = _.relatedTarget, O = E && L.contains(E);
t10.trapped || x && L.contains(x) || (n = x), O && e("focusin", _), !s.paused && t10.trapped && (O ? i = E : H6(i, true));
}, f = (_) => {
const L = unref(r);
if (!(s.paused || !L))
if (t10.trapped) {
const E = _.relatedTarget;
!vg(E) && !L.contains(E) && setTimeout(() => {
if (!s.paused && t10.trapped) {
const x = Kp({
focusReason: o.value
});
e("focusout-prevented", x), x.defaultPrevented || H6(i, true);
}
}, 0);
} else {
const E = _.target;
E && L.contains(E) || e("focusout", _);
}
};
async function Q() {
await nextTick();
const _ = unref(r);
if (_) {
QI.push(s);
const L = _.contains(document.activeElement) ? n : document.activeElement;
if (n = L, !_.contains(L)) {
const x = new Event(mb, hI);
_.addEventListener(mb, u), _.dispatchEvent(x), x.defaultPrevented || nextTick(() => {
let O = t10.focusStartEl;
sa(O) || (H6(O), document.activeElement !== O && (O = "first")), O === "first" && Hst(iU(_), true), (document.activeElement === L || O === "container") && H6(_);
});
}
}
}
function y() {
const _ = unref(r);
if (_) {
_.removeEventListener(mb, u);
const L = new CustomEvent(gb, {
...hI,
detail: {
focusReason: o.value
}
});
_.addEventListener(gb, d), _.dispatchEvent(L), !L.defaultPrevented && (o.value == "keyboard" || !Ast() || _.contains(document.activeElement)) && H6(n ?? document.body), _.removeEventListener(gb, d), QI.remove(s);
}
}
return onMounted(() => {
t10.trapped && Q(), watch(() => t10.trapped, (_) => {
_ ? Q() : y();
});
}), onBeforeUnmount(() => {
t10.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 kst(t10, e, r, n, i, o) {
return renderSlot(t10.$slots, "default", { handleKeydown: t10.onKeydown });
}
var oU = Hn(Cst, [["render", kst], ["__file", "focus-trap.vue"]]);
var Ist = ["fixed", "absolute"];
var Pst = Sn({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: Gr(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: true
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: bg,
default: "bottom"
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
strategy: {
type: String,
values: Ist,
default: "absolute"
}
});
var sU = Sn({
...Pst,
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: true
},
pure: Boolean,
focusOnShow: {
type: Boolean,
default: false
},
trapping: {
type: Boolean,
default: false
},
popperClass: {
type: Gr([String, Array, Object])
},
popperStyle: {
type: Gr([String, Array, Object])
},
referenceEl: {
type: Gr(Object)
},
triggerTargetEl: {
type: Gr(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: true
},
virtualTriggering: Boolean,
zIndex: Number,
...sl(["ariaLabel"])
});
var Vst = {
mouseenter: (t10) => t10 instanceof MouseEvent,
mouseleave: (t10) => t10 instanceof MouseEvent,
focus: () => true,
blur: () => true,
close: () => true
};
var Rst = (t10, e = []) => {
const { placement: r, strategy: n, popperOptions: i } = t10, o = {
placement: r,
strategy: n,
...i,
modifiers: [...Dst(t10), ...e]
};
return Fst(o, i == null ? void 0 : i.modifiers), o;
};
var Nst = (t10) => {
if (s1)
return f4(t10);
};
function Dst(t10) {
const { offset: e, gpuAcceleration: r, fallbackPlacements: n } = t10;
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 Fst(t10, e) {
e && (t10.modifiers = [...t10.modifiers, ...e ?? []]);
}
var Bst = 0;
var jst = (t10) => {
const { popperInstanceRef: e, contentRef: r, triggerRef: n, role: i } = inject(LS, void 0), o = ref(), s = ref(), a = computed(() => ({
name: "eventListeners",
enabled: !!t10.visible
})), u = computed(() => {
var x;
const O = unref(o), k = (x = unref(s)) != null ? x : Bst;
return {
name: "arrow",
enabled: !mz(O),
options: {
element: O,
padding: k
}
};
}), d = computed(() => ({
onFirstUpdate: () => {
_();
},
...Rst(t10, [
unref(u),
unref(a)
])
})), T = computed(() => Nst(t10.referenceEl) || unref(n)), { attributes: f, state: Q, styles: y, update: _, forceUpdate: L, instanceRef: E } = E2t(T, r, d);
return watch(E, (x) => e.value = x), onMounted(() => {
watch(() => {
var x;
return (x = unref(T)) == null ? void 0 : x.getBoundingClientRect();
}, () => {
_();
});
}), {
attributes: f,
arrowRef: o,
contentRef: r,
instanceRef: E,
state: Q,
styles: y,
role: i,
forceUpdate: L,
update: _
};
};
var zst = (t10, {
attributes: e,
styles: r,
role: n
}) => {
const { nextZIndex: i } = vS(), o = Bn("popper"), s = computed(() => unref(e).popper), a = ref(ro(t10.zIndex) ? t10.zIndex : i()), u = computed(() => [
o.b(),
o.is("pure", t10.pure),
o.is(t10.effect),
t10.popperClass
]), d = computed(() => [
{ zIndex: unref(a) },
unref(r).popper,
t10.popperStyle || {}
]), T = computed(() => n.value === "dialog" ? "false" : void 0), f = computed(() => unref(r).arrow || {});
return {
ariaModal: T,
arrowStyle: f,
contentAttrs: s,
contentClass: u,
contentStyle: d,
contentZIndex: a,
updateZIndex: () => {
a.value = ro(t10.zIndex) ? t10.zIndex : i();
}
};
};
var Ust = (t10, e) => {
const r = ref(false), n = ref();
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) => {
t10.visible && !r.value && (d.target && (n.value = d.target), r.value = true);
},
onFocusoutPrevented: (d) => {
t10.trapping || (d.detail.focusReason === "pointer" && d.preventDefault(), r.value = false);
},
onReleaseRequested: () => {
r.value = false, e("close");
}
};
};
var Gst = defineComponent({
name: "ElPopperContent"
});
var $st = defineComponent({
...Gst,
props: sU,
emits: Vst,
setup(t10, { expose: e, emit: r }) {
const n = t10, {
focusStartRef: i,
trapped: o,
onFocusAfterReleased: s,
onFocusAfterTrapped: a,
onFocusInTrap: u,
onFocusoutPrevented: d,
onReleaseRequested: T
} = Ust(n, r), { attributes: f, arrowRef: Q, contentRef: y, styles: _, instanceRef: L, role: E, update: x } = jst(n), {
ariaModal: O,
arrowStyle: k,
contentAttrs: R,
contentClass: F,
contentStyle: U,
updateZIndex: $
} = zst(n, {
styles: _,
attributes: f,
role: E
}), et = inject(BQ, void 0), nt = ref();
provide(Yz, {
arrowStyle: k,
arrowRef: Q,
arrowOffset: nt
}), et && provide(BQ, {
...et,
addInputId: C5,
removeInputId: C5
});
let ct;
const rt = (It = true) => {
x(), It && $();
}, gt = () => {
rt(false), n.visible && n.focusOnShow ? o.value = true : n.visible === false && (o.value = false);
};
return onMounted(() => {
watch(() => n.triggerTargetEl, (It, Zt) => {
ct == null || ct(), ct = void 0;
const oe = unref(It || y.value), re = unref(Zt || y.value);
k5(oe) && (ct = watch([E, () => n.ariaLabel, O, () => n.id], (Ve) => {
["role", "aria-label", "aria-modal", "id"].forEach((yr, qr) => {
vg(Ve[qr]) ? oe.removeAttribute(yr) : oe.setAttribute(yr, Ve[qr]);
});
}, { immediate: true })), re !== oe && k5(re) && ["role", "aria-label", "aria-modal", "id"].forEach((Ve) => {
re.removeAttribute(Ve);
});
}, { immediate: true }), watch(() => n.visible, gt, { immediate: true });
}), onBeforeUnmount(() => {
ct == null || ct(), ct = void 0;
}), e({
popperContentRef: y,
popperInstanceRef: L,
updatePopper: rt,
contentStyle: U
}), (It, Zt) => (openBlock(), createElementBlock("div", mergeProps({
ref_key: "contentRef",
ref: y
}, unref(R), {
style: unref(U),
class: unref(F),
tabindex: "-1",
onMouseenter: (oe) => It.$emit("mouseenter", oe),
onMouseleave: (oe) => It.$emit("mouseleave", oe)
}), [
createVNode(unref(oU), {
trapped: unref(o),
"trap-on-focus-in": true,
"focus-trap-el": unref(y),
"focus-start-el": unref(i),
onFocusAfterTrapped: unref(a),
onFocusAfterReleased: unref(s),
onFocusin: unref(u),
onFocusoutPrevented: unref(d),
onReleaseRequested: unref(T)
}, {
default: withCtx(() => [
renderSlot(It.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16, ["onMouseenter", "onMouseleave"]));
}
});
var Wst = Hn($st, [["__file", "content.vue"]]);
var Zst = v2(fst);
var ES = Symbol("elTooltip");
var Z2 = Sn({
...C2t,
...sU,
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: true
},
disabled: Boolean,
...sl(["ariaLabel"])
});
var Bh = Sn({
...rU,
disabled: Boolean,
trigger: {
type: Gr([String, Array]),
default: "hover"
},
triggerKeys: {
type: Gr(Array),
default: () => [Nh.enter, Nh.space]
}
});
var {
useModelToggleProps: qst,
useModelToggleEmits: Xst,
useModelToggle: Kst
} = Lot("visible");
var Yst = Sn({
...Jz,
...qst,
...Z2,
...Bh,
...tU,
showArrow: {
type: Boolean,
default: true
}
});
var Jst = [
...Xst,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
];
var tat = (t10, e) => p2(t10) ? t10.includes(e) : t10 === e;
var Kl = (t10, e, r) => (n) => {
tat(unref(t10), e) && r(n);
};
var eat = defineComponent({
name: "ElTooltipTrigger"
});
var rat = defineComponent({
...eat,
props: Bh,
setup(t10, { expose: e }) {
const r = t10, n = Bn("tooltip"), { controlled: i, id: o, open: s, onOpen: a, onClose: u, onToggle: d } = inject(ES, void 0), T = ref(null), f = () => {
if (unref(i) || r.disabled)
return true;
}, Q = toRef(r, "trigger"), y = s4(f, Kl(Q, "hover", a)), _ = s4(f, Kl(Q, "hover", u)), L = s4(f, Kl(Q, "click", (R) => {
R.button === 0 && d(R);
})), E = s4(f, Kl(Q, "focus", a)), x = s4(f, Kl(Q, "focus", u)), O = s4(f, Kl(Q, "contextmenu", (R) => {
R.preventDefault(), d(R);
})), k = s4(f, (R) => {
const { code: F } = R;
r.triggerKeys.includes(F) && (R.preventDefault(), d(R));
});
return e({
triggerRef: T
}), (R, F) => (openBlock(), createBlock(unref(bst), {
id: unref(o),
"virtual-ref": R.virtualRef,
open: unref(s),
"virtual-triggering": R.virtualTriggering,
class: normalizeClass(unref(n).e("trigger")),
onBlur: unref(x),
onClick: unref(L),
onContextmenu: unref(O),
onFocus: unref(E),
onMouseenter: unref(y),
onMouseleave: unref(_),
onKeydown: unref(k)
}, {
default: withCtx(() => [
renderSlot(R.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
}
});
var nat = Hn(rat, [["__file", "trigger.vue"]]);
var iat = Sn({
to: {
type: Gr([String, Object]),
required: true
},
disabled: Boolean
});
var oat = defineComponent({
__name: "teleport",
props: iat,
setup(t10) {
return (e, r) => e.disabled ? renderSlot(e.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport, {
key: 1,
to: e.to
}, [
renderSlot(e.$slots, "default")
], 8, ["to"]));
}
});
var sat = Hn(oat, [["__file", "teleport.vue"]]);
var aU = v2(sat);
var aat = defineComponent({
name: "ElTooltipContent",
inheritAttrs: false
});
var lat = defineComponent({
...aat,
props: Z2,
setup(t10, { expose: e }) {
const r = t10, { selector: n } = Gz(), i = Bn("tooltip"), o = ref(null);
let s;
const {
controlled: a,
id: u,
open: d,
trigger: T,
onClose: f,
onOpen: Q,
onShow: y,
onHide: _,
onBeforeShow: L,
onBeforeHide: E
} = inject(ES, void 0), x = computed(() => r.transition || `${i.namespace.value}-fade-in-linear`), O = computed(() => false ? true : r.persistent);
onBeforeUnmount(() => {
s == null || s();
});
const k = computed(() => unref(O) ? true : unref(d)), R = computed(() => r.disabled ? false : unref(d)), F = computed(() => r.appendTo || n.value), U = computed(() => {
var re;
return (re = r.style) != null ? re : {};
}), $ = ref(true), et = () => {
_(), $.value = true;
}, nt = () => {
if (unref(a))
return true;
}, ct = s4(nt, () => {
r.enterable && unref(T) === "hover" && Q();
}), rt = s4(nt, () => {
unref(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 = Net(computed(() => {
var re;
return (re = o.value) == null ? void 0 : re.popperContentRef;
}), () => {
if (unref(a))
return;
unref(T) !== "hover" && f();
});
}, oe = () => {
r.virtualTriggering || f();
};
return watch(() => unref(d), (re) => {
re ? $.value = false : s == null || s();
}, {
flush: "post"
}), watch(() => r.content, () => {
var re, Ve;
(Ve = (re = o.value) == null ? void 0 : re.updatePopper) == null || Ve.call(re);
}), e({
contentRef: o
}), (re, Ve) => (openBlock(), createBlock(unref(aU), {
disabled: !re.teleported,
to: unref(F)
}, {
default: withCtx(() => [
createVNode(Transition, {
name: unref(x),
onAfterLeave: et,
onBeforeEnter: gt,
onAfterEnter: Zt,
onBeforeLeave: It
}, {
default: withCtx(() => [
unref(k) ? withDirectives((openBlock(), createBlock(unref(Wst), mergeProps({
key: 0,
id: unref(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, unref(U)],
"reference-el": re.referenceEl,
"trigger-target-el": re.triggerTargetEl,
visible: unref(R),
"z-index": re.zIndex,
onMouseenter: unref(ct),
onMouseleave: unref(rt),
onBlur: oe,
onClose: unref(f)
}), {
default: withCtx(() => [
renderSlot(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"])), [
[vShow, unref(R)]
]) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["name"])
]),
_: 3
}, 8, ["disabled", "to"]));
}
});
var cat = Hn(lat, [["__file", "content.vue"]]);
var uat = defineComponent({
name: "ElTooltip"
});
var hat = defineComponent({
...uat,
props: Yst,
emits: Jst,
setup(t10, { expose: e, emit: r }) {
const n = t10;
O2t();
const i = U5(), o = ref(), s = ref(), a = () => {
var x;
const O = unref(o);
O && ((x = O.popperInstanceRef) == null || x.update());
}, u = ref(false), d = ref(), { show: T, hide: f, hasUpdateHandler: Q } = Kst({
indicator: u,
toggleReason: d
}), { onOpen: y, onClose: _ } = k2t({
showAfter: toRef(n, "showAfter"),
hideAfter: toRef(n, "hideAfter"),
autoClose: toRef(n, "autoClose"),
open: T,
close: f
}), L = computed(() => S4(n.visible) && !Q.value);
provide(ES, {
controlled: L,
id: i,
open: readonly(u),
trigger: toRef(n, "trigger"),
onOpen: (x) => {
y(x);
},
onClose: (x) => {
_(x);
},
onToggle: (x) => {
unref(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
}), watch(() => n.disabled, (x) => {
x && u.value && (u.value = false);
});
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 onDeactivated(() => u.value && f()), e({
popperRef: o,
contentRef: s,
isFocusInsideContent: E,
updatePopper: a,
onOpen: y,
onClose: _,
hide: f
}), (x, O) => (openBlock(), createBlock(unref(Zst), {
ref_key: "popperRef",
ref: o,
role: x.role
}, {
default: withCtx(() => [
createVNode(nat, {
disabled: x.disabled,
trigger: x.trigger,
"trigger-keys": x.triggerKeys,
"virtual-ref": x.virtualRef,
"virtual-triggering": x.virtualTriggering
}, {
default: withCtx(() => [
x.$slots.default ? renderSlot(x.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
createVNode(cat, {
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: withCtx(() => [
renderSlot(x.$slots, "content", {}, () => [
x.rawContent ? (openBlock(), createElementBlock("span", {
key: 0,
innerHTML: x.content
}, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(x.content), 1))
]),
x.showArrow ? (openBlock(), createBlock(unref(gst), {
key: 0,
"arrow-offset": x.arrowOffset
}, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
]),
_: 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 dat = Hn(hat, [["__file", "tooltip.vue"]]);
var lU = v2(dat);
var cU = Symbol("buttonGroupContextKey");
var pat = (t10, e) => {
h8({
from: "type.text",
replacement: "link",
version: "3.0.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
}, computed(() => t10.type === "text"));
const r = inject(cU, void 0), n = wg("button"), { form: i } = tc(), o = S8(computed(() => r == null ? void 0 : r.size)), s = xg(), a = ref(), u = useSlots(), d = computed(() => t10.type || (r == null ? void 0 : r.type) || ""), T = computed(() => {
var _, L, E;
return (E = (L = t10.autoInsertSpace) != null ? L : (_ = n.value) == null ? void 0 : _.autoInsertSpace) != null ? E : false;
}), f = computed(() => t10.tag === "button" ? {
ariaDisabled: s.value || t10.loading,
disabled: s.value || t10.loading,
autofocus: t10.autofocus,
type: t10.nativeType
} : {}), Q = computed(() => {
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) === Text) {
const x = E.children;
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(x.trim());
}
}
return false;
});
return {
_disabled: s,
_size: o,
_type: d,
_ref: a,
_props: f,
shouldAddSpace: Q,
handleClick: (_) => {
if (s.value || t10.loading) {
_.stopPropagation();
return;
}
t10.nativeType === "reset" && (i == null || i.resetFields()), e("click", _);
}
};
};
var Tat = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
];
var fat = ["button", "submit", "reset"];
var gx = Sn({
size: J8,
disabled: Boolean,
type: {
type: String,
values: Tat,
default: ""
},
icon: {
type: b8
},
nativeType: {
type: String,
values: fat,
default: "button"
},
loading: Boolean,
loadingIcon: {
type: b8,
default: () => wz
},
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"
}
});
var Qat = {
click: (t10) => t10 instanceof MouseEvent
};
function io(t10, e) {
mat(t10) && (t10 = "100%");
var r = gat(t10);
return t10 = e === 360 ? t10 : Math.min(e, Math.max(0, parseFloat(t10))), r && (t10 = parseInt(String(t10 * e), 10) / 100), Math.abs(t10 - e) < 1e-6 ? 1 : (e === 360 ? t10 = (t10 < 0 ? t10 % e + e : t10 % e) / parseFloat(String(e)) : t10 = t10 % e / parseFloat(String(e)), t10);
}
function Yp(t10) {
return Math.min(1, Math.max(0, t10));
}
function mat(t10) {
return typeof t10 == "string" && t10.indexOf(".") !== -1 && parseFloat(t10) === 1;
}
function gat(t10) {
return typeof t10 == "string" && t10.indexOf("%") !== -1;
}
function uU(t10) {
return t10 = parseFloat(t10), (isNaN(t10) || t10 < 0 || t10 > 1) && (t10 = 1), t10;
}
function Jp(t10) {
return t10 <= 1 ? "".concat(Number(t10) * 100, "%") : t10;
}
function M5(t10) {
return t10.length === 1 ? "0" + t10 : String(t10);
}
function yat(t10, e, r) {
return {
r: io(t10, 255) * 255,
g: io(e, 255) * 255,
b: io(r, 255) * 255
};
}
function gI(t10, e, r) {
t10 = io(t10, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t10, e, r), i = Math.min(t10, 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 t10:
o = (e - r) / u + (e < r ? 6 : 0);
break;
case e:
o = (r - t10) / u + 2;
break;
case r:
o = (t10 - e) / u + 4;
break;
}
o /= 6;
}
return { h: o, s, l: a };
}
function yb(t10, e, r) {
return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t10 + (e - t10) * (6 * r) : r < 1 / 2 ? e : r < 2 / 3 ? t10 + (e - t10) * (2 / 3 - r) * 6 : t10;
}
function vat(t10, e, r) {
var n, i, o;
if (t10 = io(t10, 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 = yb(a, s, t10 + 1 / 3), i = yb(a, s, t10), o = yb(a, s, t10 - 1 / 3);
}
return { r: n * 255, g: i * 255, b: o * 255 };
}
function yI(t10, e, r) {
t10 = io(t10, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t10, e, r), i = Math.min(t10, e, r), o = 0, s = n, a = n - i, u = n === 0 ? 0 : a / n;
if (n === i)
o = 0;
else {
switch (n) {
case t10:
o = (e - r) / a + (e < r ? 6 : 0);
break;
case e:
o = (r - t10) / a + 2;
break;
case r:
o = (t10 - e) / a + 4;
break;
}
o /= 6;
}
return { h: o, s: u, v: s };
}
function _at(t10, e, r) {
t10 = io(t10, 360) * 6, e = io(e, 100), r = io(r, 100);
var n = Math.floor(t10), i = t10 - 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 vI(t10, e, r, n) {
var i = [
M5(Math.round(t10).toString(16)),
M5(Math.round(e).toString(16)),
M5(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 bat(t10, e, r, n, i) {
var o = [
M5(Math.round(t10).toString(16)),
M5(Math.round(e).toString(16)),
M5(Math.round(r).toString(16)),
M5(Lat(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 Lat(t10) {
return Math.round(parseFloat(t10) * 255).toString(16);
}
function _I(t10) {
return U2(t10) / 255;
}
function U2(t10) {
return parseInt(t10, 16);
}
function wat(t10) {
return {
r: t10 >> 16,
g: (t10 & 65280) >> 8,
b: t10 & 255
};
}
var yx = {
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 xat(t10) {
var e = { r: 0, g: 0, b: 0 }, r = 1, n = null, i = null, o = null, s = false, a = false;
return typeof t10 == "string" && (t10 = Sat(t10)), typeof t10 == "object" && ($3(t10.r) && $3(t10.g) && $3(t10.b) ? (e = yat(t10.r, t10.g, t10.b), s = true, a = String(t10.r).substr(-1) === "%" ? "prgb" : "rgb") : $3(t10.h) && $3(t10.s) && $3(t10.v) ? (n = Jp(t10.s), i = Jp(t10.v), e = _at(t10.h, n, i), s = true, a = "hsv") : $3(t10.h) && $3(t10.s) && $3(t10.l) && (n = Jp(t10.s), o = Jp(t10.l), e = vat(t10.h, n, o), s = true, a = "hsl"), Object.prototype.hasOwnProperty.call(t10, "a") && (r = t10.a)), r = uU(r), {
ok: s,
format: t10.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 Eat = "[-\\+]?\\d+%?";
var Mat = "[-\\+]?\\d*\\.\\d+%?";
var X6 = "(?:".concat(Mat, ")|(?:").concat(Eat, ")");
var vb = "[\\s|\\(]+(".concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")\\s*\\)?");
var _b = "[\\s|\\(]+(".concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")\\s*\\)?");
var Js = {
CSS_UNIT: new RegExp(X6),
rgb: new RegExp("rgb" + vb),
rgba: new RegExp("rgba" + _b),
hsl: new RegExp("hsl" + vb),
hsla: new RegExp("hsla" + _b),
hsv: new RegExp("hsv" + vb),
hsva: new RegExp("hsva" + _b),
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 Sat(t10) {
if (t10 = t10.trim().toLowerCase(), t10.length === 0)
return false;
var e = false;
if (yx[t10])
t10 = yx[t10], e = true;
else if (t10 === "transparent")
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
var r = Js.rgb.exec(t10);
return r ? { r: r[1], g: r[2], b: r[3] } : (r = Js.rgba.exec(t10), r ? { r: r[1], g: r[2], b: r[3], a: r[4] } : (r = Js.hsl.exec(t10), r ? { h: r[1], s: r[2], l: r[3] } : (r = Js.hsla.exec(t10), r ? { h: r[1], s: r[2], l: r[3], a: r[4] } : (r = Js.hsv.exec(t10), r ? { h: r[1], s: r[2], v: r[3] } : (r = Js.hsva.exec(t10), r ? { h: r[1], s: r[2], v: r[3], a: r[4] } : (r = Js.hex8.exec(t10), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
a: _I(r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex6.exec(t10), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
format: e ? "name" : "hex"
} : (r = Js.hex4.exec(t10), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
a: _I(r[4] + r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex3.exec(t10), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
format: e ? "name" : "hex"
} : false)))))))));
}
function $3(t10) {
return !!Js.CSS_UNIT.exec(String(t10));
}
var Hat = (
/** @class */
function() {
function t10(e, r) {
e === void 0 && (e = ""), r === void 0 && (r = {});
var n;
if (e instanceof t10)
return e;
typeof e == "number" && (e = wat(e)), this.originalInput = e;
var i = xat(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 t10.prototype.isDark = function() {
return this.getBrightness() < 128;
}, t10.prototype.isLight = function() {
return !this.isDark();
}, t10.prototype.getBrightness = function() {
var e = this.toRgb();
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
}, t10.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;
}, t10.prototype.getAlpha = function() {
return this.a;
}, t10.prototype.setAlpha = function(e) {
return this.a = uU(e), this.roundA = Math.round(100 * this.a) / 100, this;
}, t10.prototype.isMonochrome = function() {
var e = this.toHsl().s;
return e === 0;
}, t10.prototype.toHsv = function() {
var e = yI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
}, t10.prototype.toHsvString = function() {
var e = yI(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, ")");
}, t10.prototype.toHsl = function() {
var e = gI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
}, t10.prototype.toHslString = function() {
var e = gI(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, ")");
}, t10.prototype.toHex = function(e) {
return e === void 0 && (e = false), vI(this.r, this.g, this.b, e);
}, t10.prototype.toHexString = function(e) {
return e === void 0 && (e = false), "#" + this.toHex(e);
}, t10.prototype.toHex8 = function(e) {
return e === void 0 && (e = false), bat(this.r, this.g, this.b, this.a, e);
}, t10.prototype.toHex8String = function(e) {
return e === void 0 && (e = false), "#" + this.toHex8(e);
}, t10.prototype.toHexShortString = function(e) {
return e === void 0 && (e = false), this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
}, t10.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
}, t10.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, ")");
}, t10.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
};
}, t10.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, ")");
}, t10.prototype.toName = function() {
if (this.a === 0)
return "transparent";
if (this.a < 1)
return false;
for (var e = "#" + vI(this.r, this.g, this.b, false), r = 0, n = Object.entries(yx); r < n.length; r++) {
var i = n[r], o = i[0], s = i[1];
if (e === s)
return o;
}
return false;
}, t10.prototype.toString = function(e) {
var r = !!e;
e = e ?? this.format;
var n = false, 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(true)), e === "hex4" && (n = this.toHex8String(true)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), n || this.toHexString());
}, t10.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
}, t10.prototype.clone = function() {
return new t10(this.toString());
}, t10.prototype.lighten = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l += e / 100, r.l = Yp(r.l), new t10(r);
}, t10.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 t10(r);
}, t10.prototype.darken = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l -= e / 100, r.l = Yp(r.l), new t10(r);
}, t10.prototype.tint = function(e) {
return e === void 0 && (e = 10), this.mix("white", e);
}, t10.prototype.shade = function(e) {
return e === void 0 && (e = 10), this.mix("black", e);
}, t10.prototype.desaturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s -= e / 100, r.s = Yp(r.s), new t10(r);
}, t10.prototype.saturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s += e / 100, r.s = Yp(r.s), new t10(r);
}, t10.prototype.greyscale = function() {
return this.desaturate(100);
}, t10.prototype.spin = function(e) {
var r = this.toHsl(), n = (r.h + e) % 360;
return r.h = n < 0 ? 360 + n : n, new t10(r);
}, t10.prototype.mix = function(e, r) {
r === void 0 && (r = 50);
var n = this.toRgb(), i = new t10(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 t10(s);
}, t10.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 t10(n));
return o;
}, t10.prototype.complement = function() {
var e = this.toHsl();
return e.h = (e.h + 180) % 360, new t10(e);
}, t10.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 t10({ h: n, s: i, v: o })), o = (o + a) % 1;
return s;
}, t10.prototype.splitcomplement = function() {
var e = this.toHsl(), r = e.h;
return [
this,
new t10({ h: (r + 72) % 360, s: e.s, l: e.l }),
new t10({ h: (r + 216) % 360, s: e.s, l: e.l })
];
}, t10.prototype.onBackground = function(e) {
var r = this.toRgb(), n = new t10(e).toRgb(), i = r.a + n.a * (1 - r.a);
return new t10({
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
});
}, t10.prototype.triad = function() {
return this.polyad(3);
}, t10.prototype.tetrad = function() {
return this.polyad(4);
}, t10.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 t10({ h: (n + s * o) % 360, s: r.s, l: r.l }));
return i;
}, t10.prototype.equals = function(e) {
return this.toRgbString() === new t10(e).toRgbString();
}, t10;
}()
);
function g6(t10, e = 20) {
return t10.mix("#141414", e).toString();
}
function Aat(t10) {
const e = xg(), r = Bn("button");
return computed(() => {
let n = {}, i = t10.color;
if (i) {
const o = i.match(/var\((.*?)\)/);
o && (i = window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1]));
const s = new Hat(i), a = t10.dark ? s.tint(20).toString() : g6(s, 20);
if (t10.plain)
n = r.cssVarBlock({
"bg-color": t10.dark ? g6(s, 90) : s.tint(90).toString(),
"text-color": i,
"border-color": t10.dark ? g6(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")] = t10.dark ? g6(s, 90) : s.tint(90).toString(), n[r.cssVarBlockName("disabled-text-color")] = t10.dark ? g6(s, 50) : s.tint(50).toString(), n[r.cssVarBlockName("disabled-border-color")] = t10.dark ? g6(s, 80) : s.tint(80).toString());
else {
const u = t10.dark ? g6(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 = t10.dark ? g6(s, 50) : s.tint(50).toString();
n[r.cssVarBlockName("disabled-bg-color")] = T, n[r.cssVarBlockName("disabled-text-color")] = t10.dark ? "rgba(255, 255, 255, 0.5)" : `var(${r.cssVarName("color-white")})`, n[r.cssVarBlockName("disabled-border-color")] = T;
}
}
}
return n;
});
}
var Oat = defineComponent({
name: "ElButton"
});
var Cat = defineComponent({
...Oat,
props: gx,
emits: Qat,
setup(t10, { expose: e, emit: r }) {
const n = t10, i = Aat(n), o = Bn("button"), { _ref: s, _size: a, _type: u, _disabled: d, _props: T, shouldAddSpace: f, handleClick: Q } = pat(n, r), y = computed(() => [
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) => (openBlock(), createBlock(resolveDynamicComponent(_.tag), mergeProps({
ref_key: "_ref",
ref: s
}, unref(T), {
class: unref(y),
style: unref(i),
onClick: unref(Q)
}), {
default: withCtx(() => [
_.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
_.$slots.loading ? renderSlot(_.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(p3), {
key: 1,
class: normalizeClass(unref(o).is("loading"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : _.icon || _.$slots.icon ? (openBlock(), createBlock(unref(p3), { key: 1 }, {
default: withCtx(() => [
_.icon ? (openBlock(), createBlock(resolveDynamicComponent(_.icon), { key: 0 })) : renderSlot(_.$slots, "icon", { key: 1 })
]),
_: 3
})) : createCommentVNode("v-if", true),
_.$slots.default ? (openBlock(), createElementBlock("span", {
key: 2,
class: normalizeClass({ [unref(o).em("text", "expand")]: unref(f) })
}, [
renderSlot(_.$slots, "default")
], 2)) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["class", "style", "onClick"]));
}
});
var kat = Hn(Cat, [["__file", "button.vue"]]);
var Iat = {
size: gx.size,
type: gx.type
};
var Pat = defineComponent({
name: "ElButtonGroup"
});
var Vat = defineComponent({
...Pat,
props: Iat,
setup(t10) {
const e = t10;
provide(cU, reactive({
size: toRef(e, "size"),
type: toRef(e, "type")
}));
const r = Bn("button");
return (n, i) => (openBlock(), createElementBlock("div", {
class: normalizeClass(unref(r).b("group"))
}, [
renderSlot(n.$slots, "default")
], 2));
}
});
var hU = Hn(Vat, [["__file", "button-group.vue"]]);
var dU = v2(kat, {
ButtonGroup: hU
});
ol(hU);
var Rat = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Nat(t10) {
return t10 && t10.__esModule && Object.prototype.hasOwnProperty.call(t10, "default") ? t10.default : t10;
}
var A6 = /* @__PURE__ */ new Map();
if (s1) {
let t10;
document.addEventListener("mousedown", (e) => t10 = e), document.addEventListener("mouseup", (e) => {
if (t10) {
for (const r of A6.values())
for (const { documentHandler: n } of r)
n(e, t10);
t10 = void 0;
}
});
}
function bI(t10, e) {
let r = [];
return Array.isArray(e.arg) ? r = e.arg : k5(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 = t10.contains(s) || t10.contains(a), f = t10 === 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);
};
}
var Dat = {
beforeMount(t10, e) {
A6.has(t10) || A6.set(t10, []), A6.get(t10).push({
documentHandler: bI(t10, e),
bindingFn: e.value
});
},
updated(t10, e) {
A6.has(t10) || A6.set(t10, []);
const r = A6.get(t10), n = r.findIndex((o) => o.bindingFn === e.oldValue), i = {
documentHandler: bI(t10, e),
bindingFn: e.value
};
n >= 0 ? r.splice(n, 1, i) : r.push(i);
},
unmounted(t10) {
A6.delete(t10);
}
};
var pU = {
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: J8,
tabindex: [String, Number],
validateEvent: {
type: Boolean,
default: true
},
...sl(["ariaControls"])
};
var TU = {
[Wo]: (t10) => sa(t10) || ro(t10) || S4(t10),
change: (t10) => sa(t10) || ro(t10) || S4(t10)
};
var ec = Symbol("checkboxGroupContextKey");
var Fat = ({
model: t10,
isChecked: e
}) => {
const r = inject(ec, void 0), n = computed(() => {
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 !q6(a) && t10.value.length >= a && !e.value || !q6(u) && t10.value.length <= u && e.value;
});
return {
isDisabled: xg(computed(() => (r == null ? void 0 : r.disabled.value) || n.value)),
isLimitDisabled: n
};
};
var Bat = (t10, {
model: e,
isLimitExceeded: r,
hasOwnLabel: n,
isDisabled: i,
isLabeledByFormItem: o
}) => {
const s = inject(ec, void 0), { formItem: a } = tc(), { emit: u } = getCurrentInstance();
function d(_) {
var L, E, x, O;
return [true, t10.trueValue, t10.trueLabel].includes(_) ? (E = (L = t10.trueValue) != null ? L : t10.trueLabel) != null ? E : true : (O = (x = t10.falseValue) != null ? x : t10.falseLabel) != null ? O : false;
}
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([false, t10.falseValue, t10.falseLabel].includes(e.value)), await nextTick(), T(e.value, _)));
}
const y = computed(() => (s == null ? void 0 : s.validateEvent) || t10.validateEvent);
return watch(() => t10.modelValue, () => {
y.value && (a == null || a.validate("change").catch((_) => y2(_)));
}), {
handleChange: f,
onClickRoot: Q
};
};
var jat = (t10) => {
const e = ref(false), { emit: r } = getCurrentInstance(), n = inject(ec, void 0), i = computed(() => q6(n) === false), o = ref(false), s = computed({
get() {
var a, u;
return i.value ? (a = n == null ? void 0 : n.modelValue) == null ? void 0 : a.value : (u = t10.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 === false && ((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
};
};
var zat = (t10, e, { model: r }) => {
const n = inject(ec, void 0), i = ref(false), o = computed(() => Vh(t10.value) ? t10.label : t10.value), s = computed(() => {
const T = r.value;
return S4(T) ? T : p2(T) ? T2(o.value) ? T.map(toRaw).some((f) => NQ(f, o.value)) : T.map(toRaw).includes(o.value) : T != null ? T === t10.trueValue || T === t10.trueLabel : !!T;
}), a = S8(computed(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
}), {
prop: true
}), u = S8(computed(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
})), d = computed(() => !!e.default || !Vh(o.value));
return {
checkboxButtonSize: a,
isChecked: s,
isFocused: i,
checkboxSize: u,
hasOwnLabel: d,
actualValue: o
};
};
var fU = (t10, e) => {
const { formItem: r } = tc(), { model: n, isGroup: i, isLimitExceeded: o } = jat(t10), {
isFocused: s,
isChecked: a,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
actualValue: f
} = zat(t10, e, { model: n }), { isDisabled: Q } = Fat({ model: n, isChecked: a }), { inputId: y, isLabeledByFormItem: _ } = Eg(t10, {
formItemContext: r,
disableIdGeneration: T,
disableIdManagement: i
}), { handleChange: L, onClickRoot: E } = Bat(t10, {
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 = t10.trueValue) != null ? k : t10.trueLabel) != null ? R : true;
}
t10.checked && O();
})(), h8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => i.value && Vh(t10.value))), h8({
from: "true-label",
replacement: "true-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => !!t10.trueLabel)), h8({
from: "false-label",
replacement: "false-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, computed(() => !!t10.falseLabel)), {
inputId: y,
isLabeledByFormItem: _,
isChecked: a,
isDisabled: Q,
isFocused: s,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
model: n,
actualValue: f,
handleChange: L,
onClickRoot: E
};
};
var Uat = defineComponent({
name: "ElCheckbox"
});
var Gat = defineComponent({
...Uat,
props: pU,
emits: TU,
setup(t10) {
const e = t10, r = useSlots(), {
inputId: n,
isLabeledByFormItem: i,
isChecked: o,
isDisabled: s,
isFocused: a,
checkboxSize: u,
hasOwnLabel: d,
model: T,
actualValue: f,
handleChange: Q,
onClickRoot: y
} = fU(e, r), _ = Bn("checkbox"), L = computed(() => [
_.b(),
_.m(u.value),
_.is("disabled", s.value),
_.is("bordered", e.border),
_.is("checked", o.value)
]), E = computed(() => [
_.e("input"),
_.is("disabled", s.value),
_.is("checked", o.value),
_.is("indeterminate", e.indeterminate),
_.is("focus", a.value)
]);
return (x, O) => (openBlock(), createBlock(resolveDynamicComponent(!unref(d) && unref(i) ? "span" : "label"), {
class: normalizeClass(unref(L)),
"aria-controls": x.indeterminate ? x.ariaControls : null,
onClick: unref(y)
}, {
default: withCtx(() => {
var k, R, F, U;
return [
createBaseVNode("span", {
class: normalizeClass(unref(E))
}, [
x.trueValue || x.falseValue || x.trueLabel || x.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
key: 0,
id: unref(n),
"onUpdate:modelValue": ($) => isRef(T) ? T.value = $ : null,
class: normalizeClass(unref(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
name: x.name,
tabindex: x.tabindex,
disabled: unref(s),
"true-value": (R = (k = x.trueValue) != null ? k : x.trueLabel) != null ? R : true,
"false-value": (U = (F = x.falseValue) != null ? F : x.falseLabel) != null ? U : false,
onChange: unref(Q),
onFocus: ($) => a.value = true,
onBlur: ($) => a.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[vModelCheckbox, unref(T)]
]) : withDirectives((openBlock(), createElementBlock("input", {
key: 1,
id: unref(n),
"onUpdate:modelValue": ($) => isRef(T) ? T.value = $ : null,
class: normalizeClass(unref(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
disabled: unref(s),
value: unref(f),
name: x.name,
tabindex: x.tabindex,
onChange: unref(Q),
onFocus: ($) => a.value = true,
onBlur: ($) => a.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
[vModelCheckbox, unref(T)]
]),
createBaseVNode("span", {
class: normalizeClass(unref(_).e("inner"))
}, null, 2)
], 2),
unref(d) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(_).e("label"))
}, [
renderSlot(x.$slots, "default"),
x.$slots.default ? createCommentVNode("v-if", true) : (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createTextVNode(toDisplayString(x.label), 1)
], 64))
], 2)) : createCommentVNode("v-if", true)
];
}),
_: 3
}, 8, ["class", "aria-controls", "onClick"]));
}
});
var $at = Hn(Gat, [["__file", "checkbox.vue"]]);
var Wat = defineComponent({
name: "ElCheckboxButton"
});
var Zat = defineComponent({
...Wat,
props: pU,
emits: TU,
setup(t10) {
const e = t10, r = useSlots(), {
isFocused: n,
isChecked: i,
isDisabled: o,
checkboxButtonSize: s,
model: a,
actualValue: u,
handleChange: d
} = fU(e, r), T = inject(ec, void 0), f = Bn("checkbox"), Q = computed(() => {
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 = computed(() => [
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 openBlock(), createElementBlock("label", {
class: normalizeClass(unref(y))
}, [
_.trueValue || _.falseValue || _.trueLabel || _.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
key: 0,
"onUpdate:modelValue": (R) => isRef(a) ? a.value = R : null,
class: normalizeClass(unref(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: unref(o),
"true-value": (x = (E = _.trueValue) != null ? E : _.trueLabel) != null ? x : true,
"false-value": (k = (O = _.falseValue) != null ? O : _.falseLabel) != null ? k : false,
onChange: unref(d),
onFocus: (R) => n.value = true,
onBlur: (R) => n.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[vModelCheckbox, unref(a)]
]) : withDirectives((openBlock(), createElementBlock("input", {
key: 1,
"onUpdate:modelValue": (R) => isRef(a) ? a.value = R : null,
class: normalizeClass(unref(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: unref(o),
value: unref(u),
onChange: unref(d),
onFocus: (R) => n.value = true,
onBlur: (R) => n.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
[vModelCheckbox, unref(a)]
]),
_.$slots.default || _.label ? (openBlock(), createElementBlock("span", {
key: 2,
class: normalizeClass(unref(f).be("button", "inner")),
style: normalizeStyle(unref(i) ? unref(Q) : void 0)
}, [
renderSlot(_.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_.label), 1)
])
], 6)) : createCommentVNode("v-if", true)
], 2);
};
}
});
var QU = Hn(Zat, [["__file", "checkbox-button.vue"]]);
var qat = Sn({
modelValue: {
type: Gr(Array),
default: () => []
},
disabled: Boolean,
min: Number,
max: Number,
size: J8,
fill: String,
textColor: String,
tag: {
type: String,
default: "div"
},
validateEvent: {
type: Boolean,
default: true
},
...sl(["ariaLabel"])
});
var Xat = {
[Wo]: (t10) => p2(t10),
change: (t10) => p2(t10)
};
var Kat = defineComponent({
name: "ElCheckboxGroup"
});
var Yat = defineComponent({
...Kat,
props: qat,
emits: Xat,
setup(t10, { emit: e }) {
const r = t10, n = Bn("checkbox"), { formItem: i } = tc(), { inputId: o, isLabeledByFormItem: s } = Eg(r, {
formItemContext: i
}), a = async (d) => {
e(Wo, d), await nextTick(), e("change", d);
}, u = computed({
get() {
return r.modelValue;
},
set(d) {
a(d);
}
});
return provide(ec, {
...gz(toRefs(r), [
"size",
"min",
"max",
"disabled",
"validateEvent",
"fill",
"textColor"
]),
modelValue: u,
changeEvent: a
}), watch(() => r.modelValue, () => {
r.validateEvent && (i == null || i.validate("change").catch((d) => y2(d)));
}), (d, T) => {
var f;
return openBlock(), createBlock(resolveDynamicComponent(d.tag), {
id: unref(o),
class: normalizeClass(unref(n).b("group")),
role: "group",
"aria-label": unref(s) ? void 0 : d.ariaLabel || "checkbox-group",
"aria-labelledby": unref(s) ? (f = unref(i)) == null ? void 0 : f.labelId : void 0
}, {
default: withCtx(() => [
renderSlot(d.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
};
}
});
var mU = Hn(Yat, [["__file", "checkbox-group.vue"]]);
var gU = v2($at, {
CheckboxButton: QU,
CheckboxGroup: mU
});
ol(QU);
var yU = ol(mU);
var vU = Sn({
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
size: J8,
disabled: Boolean,
label: {
type: [String, Number, Boolean],
default: void 0
},
value: {
type: [String, Number, Boolean],
default: void 0
},
name: {
type: String,
default: void 0
}
});
var Jat = Sn({
...vU,
border: Boolean
});
var _U = {
[Wo]: (t10) => sa(t10) || ro(t10) || S4(t10),
[cS]: (t10) => sa(t10) || ro(t10) || S4(t10)
};
var bU = Symbol("radioGroupKey");
var LU = (t10, e) => {
const r = ref(), n = inject(bU, void 0), i = computed(() => !!n), o = computed(() => Vh(t10.value) ? t10.label : t10.value), s = computed({
get() {
return i.value ? n.modelValue : t10.modelValue;
},
set(f) {
i.value ? n.changeEvent(f) : e && e(Wo, f), r.value.checked = t10.modelValue === o.value;
}
}), a = S8(computed(() => n == null ? void 0 : n.size)), u = xg(computed(() => n == null ? void 0 : n.disabled)), d = ref(false), T = computed(() => u.value || i.value && s.value !== o.value ? -1 : 0);
return h8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-radio",
ref: "https://element-plus.org/en-US/component/radio.html"
}, computed(() => i.value && Vh(t10.value))), {
radioRef: r,
isGroup: i,
radioGroup: n,
focus: d,
size: a,
disabled: u,
tabIndex: T,
modelValue: s,
actualValue: o
};
};
var t3t = defineComponent({
name: "ElRadio"
});
var e3t = defineComponent({
...t3t,
props: Jat,
emits: _U,
setup(t10, { emit: e }) {
const r = t10, n = Bn("radio"), { radioRef: i, radioGroup: o, focus: s, size: a, disabled: u, modelValue: d, actualValue: T } = LU(r, e);
function f() {
nextTick(() => e("change", d.value));
}
return (Q, y) => {
var _;
return openBlock(), createElementBlock("label", {
class: normalizeClass([
unref(n).b(),
unref(n).is("disabled", unref(u)),
unref(n).is("focus", unref(s)),
unref(n).is("bordered", Q.border),
unref(n).is("checked", unref(d) === unref(T)),
unref(n).m(unref(a))
])
}, [
createBaseVNode("span", {
class: normalizeClass([
unref(n).e("input"),
unref(n).is("disabled", unref(u)),
unref(n).is("checked", unref(d) === unref(T))
])
}, [
withDirectives(createBaseVNode("input", {
ref_key: "radioRef",
ref: i,
"onUpdate:modelValue": (L) => isRef(d) ? d.value = L : null,
class: normalizeClass(unref(n).e("original")),
value: unref(T),
name: Q.name || ((_ = unref(o)) == null ? void 0 : _.name),
disabled: unref(u),
checked: unref(d) === unref(T),
type: "radio",
onFocus: (L) => s.value = true,
onBlur: (L) => s.value = false,
onChange: f,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
[vModelRadio, unref(d)]
]),
createBaseVNode("span", {
class: normalizeClass(unref(n).e("inner"))
}, null, 2)
], 2),
createBaseVNode("span", {
class: normalizeClass(unref(n).e("label")),
onKeydown: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(Q.$slots, "default", {}, () => [
createTextVNode(toDisplayString(Q.label), 1)
])
], 42, ["onKeydown"])
], 2);
};
}
});
var r3t = Hn(e3t, [["__file", "radio.vue"]]);
var n3t = Sn({
...vU
});
var i3t = defineComponent({
name: "ElRadioButton"
});
var o3t = defineComponent({
...i3t,
props: n3t,
setup(t10) {
const e = t10, r = Bn("radio"), { radioRef: n, focus: i, size: o, disabled: s, modelValue: a, radioGroup: u, actualValue: d } = LU(e), T = computed(() => ({
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 openBlock(), createElementBlock("label", {
class: normalizeClass([
unref(r).b("button"),
unref(r).is("active", unref(a) === unref(d)),
unref(r).is("disabled", unref(s)),
unref(r).is("focus", unref(i)),
unref(r).bm("button", unref(o))
])
}, [
withDirectives(createBaseVNode("input", {
ref_key: "radioRef",
ref: n,
"onUpdate:modelValue": (_) => isRef(a) ? a.value = _ : null,
class: normalizeClass(unref(r).be("button", "original-radio")),
value: unref(d),
type: "radio",
name: f.name || ((y = unref(u)) == null ? void 0 : y.name),
disabled: unref(s),
onFocus: (_) => i.value = true,
onBlur: (_) => i.value = false,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
[vModelRadio, unref(a)]
]),
createBaseVNode("span", {
class: normalizeClass(unref(r).be("button", "inner")),
style: normalizeStyle(unref(a) === unref(d) ? unref(T) : {}),
onKeydown: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(f.$slots, "default", {}, () => [
createTextVNode(toDisplayString(f.label), 1)
])
], 46, ["onKeydown"])
], 2);
};
}
});
var wU = Hn(o3t, [["__file", "radio-button.vue"]]);
var s3t = Sn({
id: {
type: String,
default: void 0
},
size: J8,
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: true
},
...sl(["ariaLabel"])
});
var a3t = _U;
var l3t = defineComponent({
name: "ElRadioGroup"
});
var c3t = defineComponent({
...l3t,
props: s3t,
emits: a3t,
setup(t10, { emit: e }) {
const r = t10, n = Bn("radio"), i = U5(), o = ref(), { formItem: s } = tc(), { inputId: a, isLabeledByFormItem: u } = Eg(r, {
formItemContext: s
}), d = (f) => {
e(Wo, f), nextTick(() => e("change", f));
};
onMounted(() => {
const f = o.value.querySelectorAll("[type=radio]"), Q = f[0];
!Array.from(f).some((y) => y.checked) && Q && (Q.tabIndex = 0);
});
const T = computed(() => r.name || i.value);
return provide(bU, reactive({
...toRefs(r),
changeEvent: d,
name: T
})), watch(() => r.modelValue, () => {
r.validateEvent && (s == null || s.validate("change").catch((f) => y2(f)));
}), (f, Q) => (openBlock(), createElementBlock("div", {
id: unref(a),
ref_key: "radioGroupRef",
ref: o,
class: normalizeClass(unref(n).b("group")),
role: "radiogroup",
"aria-label": unref(u) ? void 0 : f.ariaLabel || "radio-group",
"aria-labelledby": unref(u) ? unref(s).labelId : void 0
}, [
renderSlot(f.$slots, "default")
], 10, ["id", "aria-label", "aria-labelledby"]));
}
});
var xU = Hn(c3t, [["__file", "radio-group.vue"]]);
var EU = v2(r3t, {
RadioButton: wU,
RadioGroup: xU
});
var MU = ol(xU);
ol(wU);
var vx = Sn({
type: {
type: String,
values: ["primary", "success", "info", "warning", "danger"],
default: "primary"
},
closable: Boolean,
disableTransitions: Boolean,
hit: Boolean,
color: String,
size: {
type: String,
values: Sz
},
effect: {
type: String,
values: ["dark", "light", "plain"],
default: "light"
},
round: Boolean
});
var u3t = {
close: (t10) => t10 instanceof MouseEvent,
click: (t10) => t10 instanceof MouseEvent
};
var h3t = defineComponent({
name: "ElTag"
});
var d3t = defineComponent({
...h3t,
props: vx,
emits: u3t,
setup(t10, { emit: e }) {
const r = t10, n = S8(), i = Bn("tag"), o = computed(() => {
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 ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(o)),
style: normalizeStyle({ backgroundColor: d.color }),
onClick: a
}, [
createBaseVNode("span", {
class: normalizeClass(unref(i).e("content"))
}, [
renderSlot(d.$slots, "default")
], 2),
d.closable ? (openBlock(), createBlock(unref(p3), {
key: 0,
class: normalizeClass(unref(i).e("close")),
onClick: withModifiers(s, ["stop"])
}, {
default: withCtx(() => [
createVNode(unref(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
], 6)) : (openBlock(), createBlock(Transition, {
key: 1,
name: `${unref(i).namespace.value}-zoom-in-center`,
appear: "",
onVnodeMounted: u
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(unref(o)),
style: normalizeStyle({ backgroundColor: d.color }),
onClick: a
}, [
createBaseVNode("span", {
class: normalizeClass(unref(i).e("content"))
}, [
renderSlot(d.$slots, "default")
], 2),
d.closable ? (openBlock(), createBlock(unref(p3), {
key: 0,
class: normalizeClass(unref(i).e("close")),
onClick: withModifiers(s, ["stop"])
}, {
default: withCtx(() => [
createVNode(unref(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
], 6)
]),
_: 3
}, 8, ["name"]));
}
});
var p3t = Hn(d3t, [["__file", "tag.vue"]]);
var T3t = v2(p3t);
var SU = Symbol("rowContextKey");
var f3t = [
"start",
"center",
"end",
"space-around",
"space-between",
"space-evenly"
];
var Q3t = ["top", "middle", "bottom"];
var m3t = Sn({
tag: {
type: String,
default: "div"
},
gutter: {
type: Number,
default: 0
},
justify: {
type: String,
values: f3t,
default: "start"
},
align: {
type: String,
values: Q3t
}
});
var g3t = defineComponent({
name: "ElRow"
});
var y3t = defineComponent({
...g3t,
props: m3t,
setup(t10) {
const e = t10, r = Bn("row"), n = computed(() => e.gutter);
provide(SU, {
gutter: n
});
const i = computed(() => {
const s = {};
return e.gutter && (s.marginRight = s.marginLeft = `-${e.gutter / 2}px`), s;
}), o = computed(() => [
r.b(),
r.is(`justify-${e.justify}`, e.justify !== "start"),
r.is(`align-${e.align}`, !!e.align)
]);
return (s, a) => (openBlock(), createBlock(resolveDynamicComponent(s.tag), {
class: normalizeClass(unref(o)),
style: normalizeStyle(unref(i))
}, {
default: withCtx(() => [
renderSlot(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var v3t = Hn(y3t, [["__file", "row.vue"]]);
var Td = v2(v3t);
var _3t = 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: () => cu({})
},
sm: {
type: Gr([Number, Object]),
default: () => cu({})
},
md: {
type: Gr([Number, Object]),
default: () => cu({})
},
lg: {
type: Gr([Number, Object]),
default: () => cu({})
},
xl: {
type: Gr([Number, Object]),
default: () => cu({})
}
});
var b3t = defineComponent({
name: "ElCol"
});
var L3t = defineComponent({
...b3t,
props: _3t,
setup(t10) {
const e = t10, { gutter: r } = inject(SU, { gutter: computed(() => 0) }), n = Bn("col"), i = computed(() => {
const s = {};
return r.value && (s.paddingLeft = s.paddingRight = `${r.value / 2}px`), s;
}), o = computed(() => {
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) => (openBlock(), createBlock(resolveDynamicComponent(s.tag), {
class: normalizeClass(unref(o)),
style: normalizeStyle(unref(i))
}, {
default: withCtx(() => [
renderSlot(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var w3t = Hn(L3t, [["__file", "col.vue"]]);
var fd = v2(w3t);
var x3t = Sn({
mask: {
type: Boolean,
default: true
},
customMaskEvent: Boolean,
overlayClass: {
type: Gr([
String,
Array,
Object
])
},
zIndex: {
type: Gr([String, Number])
}
});
var E3t = {
click: (t10) => t10 instanceof MouseEvent
};
var M3t = "overlay";
var S3t = defineComponent({
name: "ElOverlay",
props: x3t,
emits: E3t,
setup(t10, { slots: e, emit: r }) {
const n = Bn(M3t), i = (u) => {
r("click", u);
}, { onClick: o, onMousedown: s, onMouseup: a } = zz(t10.customMaskEvent ? void 0 : i);
return () => t10.mask ? createVNode("div", {
class: [n.b(), t10.overlayClass],
style: {
zIndex: t10.zIndex
},
onClick: o,
onMousedown: s,
onMouseup: a
}, [renderSlot(e, "default")], ff.STYLE | ff.CLASS | ff.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", {
class: t10.overlayClass,
style: {
zIndex: t10.zIndex,
position: "fixed",
top: "0px",
right: "0px",
bottom: "0px",
left: "0px"
}
}, [renderSlot(e, "default")]);
}
});
var H3t = S3t;
var HU = Symbol("dialogInjectionKey");
var AU = Sn({
center: Boolean,
alignCenter: Boolean,
closeIcon: {
type: b8
},
draggable: Boolean,
overflow: Boolean,
fullscreen: Boolean,
showClose: {
type: Boolean,
default: true
},
title: {
type: String,
default: ""
},
ariaLevel: {
type: String,
default: "2"
}
});
var A3t = {
close: () => true
};
var O3t = defineComponent({ name: "ElDialogContent" });
var C3t = defineComponent({
...O3t,
props: AU,
emits: A3t,
setup(t10, { expose: e }) {
const r = t10, { t: n } = uS(), { Close: i } = cot, { dialogRef: o, headerRef: s, bodyId: a, ns: u, style: d } = inject(HU), { focusTrapRef: T } = inject(nU), f = computed(() => [
u.b(),
u.is("fullscreen", r.fullscreen),
u.is("draggable", r.draggable),
u.is("align-center", r.alignCenter),
{ [u.m("center")]: r.center }
]), Q = dot(T, o), y = computed(() => r.draggable), _ = computed(() => r.overflow), { resetPosition: L } = Tot(o, s, y, _);
return e({
resetPosition: L
}), (E, x) => (openBlock(), createElementBlock("div", {
ref: unref(Q),
class: normalizeClass(unref(f)),
style: normalizeStyle(unref(d)),
tabindex: "-1"
}, [
createBaseVNode("header", {
ref_key: "headerRef",
ref: s,
class: normalizeClass([unref(u).e("header"), { "show-close": E.showClose }])
}, [
renderSlot(E.$slots, "header", {}, () => [
createBaseVNode("span", {
role: "heading",
"aria-level": E.ariaLevel,
class: normalizeClass(unref(u).e("title"))
}, toDisplayString(E.title), 11, ["aria-level"])
]),
E.showClose ? (openBlock(), createElementBlock("button", {
key: 0,
"aria-label": unref(n)("el.dialog.close"),
class: normalizeClass(unref(u).e("headerbtn")),
type: "button",
onClick: (O) => E.$emit("close")
}, [
createVNode(unref(p3), {
class: normalizeClass(unref(u).e("close"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(E.closeIcon || unref(i))))
]),
_: 1
}, 8, ["class"])
], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
], 2),
createBaseVNode("div", {
id: unref(a),
class: normalizeClass(unref(u).e("body"))
}, [
renderSlot(E.$slots, "default")
], 10, ["id"]),
E.$slots.footer ? (openBlock(), createElementBlock("footer", {
key: 0,
class: normalizeClass(unref(u).e("footer"))
}, [
renderSlot(E.$slots, "footer")
], 2)) : createCommentVNode("v-if", true)
], 6));
}
});
var k3t = Hn(C3t, [["__file", "dialog-content.vue"]]);
var I3t = Sn({
...AU,
appendToBody: Boolean,
appendTo: {
type: Gr([String, Object]),
default: "body"
},
beforeClose: {
type: Gr(Function)
},
destroyOnClose: Boolean,
closeOnClickModal: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: true
},
lockScroll: {
type: Boolean,
default: true
},
modal: {
type: Boolean,
default: true
},
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"
}
});
var P3t = {
open: () => true,
opened: () => true,
close: () => true,
closed: () => true,
[Wo]: (t10) => S4(t10),
openAutoFocus: () => true,
closeAutoFocus: () => true
};
var V3t = (t10, e) => {
var r;
const i = getCurrentInstance().emit, { nextZIndex: o } = vS();
let s = "";
const a = U5(), u = U5(), d = ref(false), T = ref(false), f = ref(false), Q = ref((r = t10.zIndex) != null ? r : o());
let y, _;
const L = wg("namespace", eh), E = computed(() => {
const oe = {}, re = `--${L.value}-dialog`;
return t10.fullscreen || (t10.top && (oe[`${re}-margin-top`] = t10.top), t10.width && (oe[`${re}-width`] = z5(t10.width))), oe;
}), x = computed(() => t10.alignCenter ? { display: "flex" } : {});
function O() {
i("opened");
}
function k() {
i("closed"), i(Wo, false), t10.destroyOnClose && (f.value = false);
}
function R() {
i("close");
}
function F() {
_ == null || _(), y == null || y(), t10.openDelay && t10.openDelay > 0 ? { stop: y } = hk(() => nt(), t10.openDelay) : nt();
}
function U() {
y == null || y(), _ == null || _(), t10.closeDelay && t10.closeDelay > 0 ? { stop: _ } = hk(() => ct(), t10.closeDelay) : ct();
}
function $() {
function oe(re) {
re || (T.value = true, d.value = false);
}
t10.beforeClose ? t10.beforeClose(oe) : U();
}
function et() {
t10.closeOnClickModal && $();
}
function nt() {
s1 && (d.value = true);
}
function ct() {
d.value = false;
}
function rt() {
i("openAutoFocus");
}
function gt() {
i("closeAutoFocus");
}
function It(oe) {
var re;
((re = oe.detail) == null ? void 0 : re.focusReason) === "pointer" && oe.preventDefault();
}
t10.lockScroll && vot(d);
function Zt() {
t10.closeOnPressEscape && $();
}
return watch(() => t10.modelValue, (oe) => {
oe ? (T.value = false, F(), f.value = true, Q.value = mz(t10.zIndex) ? o() : Q.value++, nextTick(() => {
i("open"), e.value && (e.value.scrollTop = 0);
})) : d.value && U();
}), watch(() => t10.fullscreen, (oe) => {
e.value && (oe ? (s = e.value.style.transform, e.value.style.transform = "") : e.value.style.transform = s);
}), onMounted(() => {
t10.modelValue && (d.value = true, f.value = true, 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
};
};
var R3t = defineComponent({
name: "ElDialog",
inheritAttrs: false
});
var N3t = defineComponent({
...R3t,
props: I3t,
emits: P3t,
setup(t10, { expose: e }) {
const r = t10, n = useSlots();
h8({
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"
}, computed(() => !!n.title));
const i = Bn("dialog"), o = ref(), s = ref(), a = ref(), {
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: $
} = V3t(r, o);
provide(HU, {
dialogRef: o,
headerRef: s,
bodyId: T,
ns: i,
rendered: y,
style: f
});
const et = zz(k), nt = computed(() => r.draggable && !r.fullscreen);
return e({
visible: u,
dialogContentRef: a,
resetPosition: () => {
var rt;
(rt = a.value) == null || rt.resetPosition();
}
}), (rt, gt) => (openBlock(), createBlock(unref(aU), {
to: rt.appendTo,
disabled: rt.appendTo !== "body" ? false : !rt.appendToBody
}, {
default: withCtx(() => [
createVNode(Transition, {
name: "dialog-fade",
onAfterEnter: unref(L),
onAfterLeave: unref(E),
onBeforeLeave: unref(x),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createVNode(unref(H3t), {
"custom-mask-event": "",
mask: rt.modal,
"overlay-class": rt.modalClass,
"z-index": unref(_)
}, {
default: withCtx(() => [
createBaseVNode("div", {
role: "dialog",
"aria-modal": "true",
"aria-label": rt.title || void 0,
"aria-labelledby": rt.title ? void 0 : unref(d),
"aria-describedby": unref(T),
class: normalizeClass(`${unref(i).namespace.value}-overlay-dialog`),
style: normalizeStyle(unref(Q)),
onClick: unref(et).onClick,
onMousedown: unref(et).onMousedown,
onMouseup: unref(et).onMouseup
}, [
createVNode(unref(oU), {
loop: "",
trapped: unref(u),
"focus-start-el": "container",
onFocusAfterTrapped: unref(R),
onFocusAfterReleased: unref(F),
onFocusoutPrevented: unref($),
onReleaseRequested: unref(U)
}, {
default: withCtx(() => [
unref(y) ? (openBlock(), createBlock(k3t, mergeProps({
key: 0,
ref_key: "dialogContentRef",
ref: a
}, rt.$attrs, {
center: rt.center,
"align-center": rt.alignCenter,
"close-icon": rt.closeIcon,
draggable: unref(nt),
overflow: rt.overflow,
fullscreen: rt.fullscreen,
"show-close": rt.showClose,
title: rt.title,
"aria-level": rt.headerAriaLevel,
onClose: unref(O)
}), createSlots({
header: withCtx(() => [
rt.$slots.title ? renderSlot(rt.$slots, "title", { key: 1 }) : renderSlot(rt.$slots, "header", {
key: 0,
close: unref(O),
titleId: unref(d),
titleClass: unref(i).e("title")
})
]),
default: withCtx(() => [
renderSlot(rt.$slots, "default")
]),
_: 2
}, [
rt.$slots.footer ? {
name: "footer",
fn: withCtx(() => [
renderSlot(rt.$slots, "footer")
])
} : void 0
]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
]),
_: 3
}, 8, ["mask", "overlay-class", "z-index"]), [
[vShow, unref(u)]
])
]),
_: 3
}, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
]),
_: 3
}, 8, ["to", "disabled"]));
}
});
var D3t = Hn(N3t, [["__file", "dialog.vue"]]);
var F3t = v2(D3t);
var B3t = defineComponent({
inheritAttrs: false
});
function j3t(t10, e, r, n, i, o) {
return renderSlot(t10.$slots, "default");
}
var z3t = Hn(B3t, [["render", j3t], ["__file", "collection.vue"]]);
var U3t = defineComponent({
name: "ElCollectionItem",
inheritAttrs: false
});
function G3t(t10, e, r, n, i, o) {
return renderSlot(t10.$slots, "default");
}
var $3t = Hn(U3t, [["render", G3t], ["__file", "collection-item.vue"]]);
var W3t = "data-el-collection-item";
var Z3t = (t10) => {
const e = `El${t10}Collection`, r = `${e}Item`, n = Symbol(e), i = Symbol(r), o = {
...z3t,
name: e,
setup() {
const a = ref(null), u = /* @__PURE__ */ new Map();
provide(n, {
itemMap: u,
getItems: () => {
const T = unref(a);
if (!T)
return [];
const f = Array.from(T.querySelectorAll(`[${W3t}]`));
return [...u.values()].sort((y, _) => f.indexOf(y.ref) - f.indexOf(_.ref));
},
collectionRef: a
});
}
}, s = {
...$3t,
name: r,
setup(a, { attrs: u }) {
const d = ref(null), T = inject(n, void 0);
provide(i, {
collectionItemRef: d
}), onMounted(() => {
const f = unref(d);
f && T.itemMap.set(f, {
ref: f,
...u
});
}), onBeforeUnmount(() => {
const f = unref(d);
T.itemMap.delete(f);
});
}
};
return {
COLLECTION_INJECTION_KEY: n,
COLLECTION_ITEM_INJECTION_KEY: i,
ElCollection: o,
ElCollectionItem: s
};
};
var bb = Sn({
trigger: Bh.trigger,
effect: {
...Z2.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: true
},
loop: {
type: Boolean,
default: true
},
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: Z2.teleported
});
Sn({
command: {
type: [Object, String, Number],
default: () => ({})
},
disabled: Boolean,
divided: Boolean,
textValue: String,
icon: {
type: b8
}
});
Sn({
onKeydown: { type: Gr(Function) }
});
Z3t("Dropdown");
var OU = Symbol("ElSelectGroup");
var Sg = Symbol("ElSelect");
function q3t(t10, e) {
const r = inject(Sg), n = inject(OU, { disabled: false }), i = computed(() => T(W6(r.props.modelValue), t10.value)), o = computed(() => {
var y;
if (r.props.multiple) {
const _ = W6((y = r.props.modelValue) != null ? y : []);
return !i.value && _.length >= r.props.multipleLimit && r.props.multipleLimit > 0;
} else
return false;
}), s = computed(() => t10.label || (T2(t10.value) ? "" : t10.value)), a = computed(() => t10.value || t10.label || ""), u = computed(() => t10.disabled || e.groupDisabled || o.value), d = getCurrentInstance(), T = (y = [], _) => {
if (T2(t10.value)) {
const L = r.props.valueKey;
return y && y.some((E) => toRaw(T4(E, L)) === T4(_, L));
} else
return y && y.includes(_);
}, f = () => {
!t10.disabled && !n.disabled && (r.states.hoveringIndex = r.optionsArray.indexOf(d.proxy));
}, Q = (y) => {
const _ = new RegExp(q1t(y), "i");
e.visible = _.test(s.value) || t10.created;
};
return watch(() => s.value, () => {
!t10.created && !r.props.remote && r.setSelected();
}), watch(() => t10.value, (y, _) => {
const { remote: L, valueKey: E } = r.props;
if (y !== _ && (r.onOptionDestroy(_, d.proxy), r.onOptionCreate(d.proxy)), !t10.created && !L) {
if (E && T2(y) && T2(_) && y[E] === _[E])
return;
r.setSelected();
}
}), watch(() => n.disabled, () => {
e.groupDisabled = n.disabled;
}, { immediate: true }), {
select: r,
currentLabel: s,
currentValue: a,
itemSelected: i,
isDisabled: u,
hoverItem: f,
updateOption: Q
};
}
var X3t = defineComponent({
name: "ElOption",
componentName: "ElOption",
props: {
value: {
required: true,
type: [String, Number, Boolean, Object]
},
label: [String, Number],
created: Boolean,
disabled: Boolean
},
setup(t10) {
const e = Bn("select"), r = U5(), n = computed(() => [
e.be("dropdown", "item"),
e.is("disabled", unref(a)),
e.is("selected", unref(s)),
e.is("hovering", unref(Q))
]), i = reactive({
index: -1,
groupDisabled: false,
visible: true,
hover: false
}), {
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T
} = q3t(t10, i), { visible: f, hover: Q } = toRefs(i), y = getCurrentInstance().proxy;
u.onOptionCreate(y), onBeforeUnmount(() => {
const L = y.value, { selected: E } = u.states, O = (u.props.multiple ? E : [E]).some((k) => k.value === y.value);
nextTick(() => {
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 K3t(t10, e, r, n, i, o) {
return withDirectives((openBlock(), createElementBlock("li", {
id: t10.id,
class: normalizeClass(t10.containerKls),
role: "option",
"aria-disabled": t10.isDisabled || void 0,
"aria-selected": t10.itemSelected,
onMouseenter: t10.hoverItem,
onClick: withModifiers(t10.selectOptionClick, ["stop"])
}, [
renderSlot(t10.$slots, "default", {}, () => [
createBaseVNode("span", null, toDisplayString(t10.currentLabel), 1)
])
], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
[vShow, t10.visible]
]);
}
var MS = Hn(X3t, [["render", K3t], ["__file", "option.vue"]]);
var Y3t = defineComponent({
name: "ElSelectDropdown",
componentName: "ElSelectDropdown",
setup() {
const t10 = inject(Sg), e = Bn("select"), r = computed(() => t10.props.popperClass), n = computed(() => t10.props.multiple), i = computed(() => t10.props.fitInputWidth), o = ref("");
function s() {
var a;
o.value = `${(a = t10.selectRef) == null ? void 0 : a.offsetWidth}px`;
}
return onMounted(() => {
s(), B6(t10.selectRef, s);
}), {
ns: e,
minWidth: o,
popperClass: r,
isMultiple: n,
isFitInputWidth: i
};
}
});
function J3t(t10, e, r, n, i, o) {
return openBlock(), createElementBlock("div", {
class: normalizeClass([t10.ns.b("dropdown"), t10.ns.is("multiple", t10.isMultiple), t10.popperClass]),
style: normalizeStyle({ [t10.isFitInputWidth ? "width" : "minWidth"]: t10.minWidth })
}, [
t10.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(t10.ns.be("dropdown", "header"))
}, [
renderSlot(t10.$slots, "header")
], 2)) : createCommentVNode("v-if", true),
renderSlot(t10.$slots, "default"),
t10.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(t10.ns.be("dropdown", "footer"))
}, [
renderSlot(t10.$slots, "footer")
], 2)) : createCommentVNode("v-if", true)
], 6);
}
var t4t = Hn(Y3t, [["render", J3t], ["__file", "select-dropdown.vue"]]);
var e4t = 11;
var r4t = (t10, e) => {
const { t: r } = uS(), n = U5(), i = Bn("select"), o = Bn("input"), s = reactive({
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: false,
menuVisibleOnFocus: false,
isBeforeHide: false
}), a = ref(null), u = ref(null), d = ref(null), T = ref(null), f = ref(null), Q = ref(null), y = ref(null), _ = ref(null), L = ref(null), E = ref(null), x = ref(null), O = ref(null), {
isComposing: k,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U
} = N2t({
afterComposition: (Rt) => c1(Rt)
}), { wrapperRef: $, isFocused: et } = R2t(f, {
beforeFocus() {
return re.value;
},
afterFocus() {
t10.automaticDropdown && !nt.value && (nt.value = true, s.menuVisibleOnFocus = true);
},
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 = false, s.menuVisibleOnFocus = false;
}
}), nt = ref(false), ct = ref(), { form: rt, formItem: gt } = tc(), { inputId: It } = Eg(t10, {
formItemContext: gt
}), { valueOnClear: Zt, isEmptyValue: oe } = z2t(t10), re = computed(() => t10.disabled || (rt == null ? void 0 : rt.disabled)), Ve = computed(() => p2(t10.modelValue) ? t10.modelValue.length > 0 : !oe(t10.modelValue)), yr = computed(() => t10.clearable && !re.value && s.inputHovering && Ve.value), qr = computed(() => t10.remote && t10.filterable && !t10.remoteShowSuffix ? "" : t10.suffixIcon), ie = computed(() => i.is("reverse", qr.value && nt.value)), Qe = computed(() => (gt == null ? void 0 : gt.validateState) || ""), Ke = computed(() => uot[Qe.value]), He = computed(() => t10.remote ? 300 : 0), er = computed(() => t10.loading ? t10.loadingText || r("el.select.loading") : t10.remote && !s.inputValue && s.options.size === 0 ? false : t10.filterable && s.inputValue && s.options.size > 0 && Je.value === 0 ? t10.noMatchText || r("el.select.noMatch") : s.options.size === 0 ? t10.noDataText || r("el.select.noData") : null), Je = computed(() => Ne.value.filter((Rt) => Rt.visible).length), Ne = computed(() => {
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 = computed(() => Array.from(s.cachedOptions.values())), te = computed(() => {
const Rt = Ne.value.filter((Te) => !Te.created).some((Te) => Te.currentLabel === s.inputValue);
return t10.filterable && t10.allowCreate && s.inputValue !== "" && !Rt;
}), me = () => {
t10.filterable && Zo(t10.filterMethod) || t10.filterable && t10.remote && Zo(t10.remoteMethod) || Ne.value.forEach((Rt) => {
var Te;
(Te = Rt.updateOption) == null || Te.call(Rt, s.inputValue);
});
}, de = S8(), Ge = computed(() => ["small"].includes(de.value) ? "small" : "default"), Tr = computed({
get() {
return nt.value && er.value !== false;
},
set(Rt) {
nt.value = Rt;
}
}), qe = computed(() => {
if (t10.multiple && !q6(t10.modelValue))
return W6(t10.modelValue).length === 0 && !s.inputValue;
const Rt = p2(t10.modelValue) ? t10.modelValue[0] : t10.modelValue;
return t10.filterable || q6(Rt) ? !s.inputValue : true;
}), $e = computed(() => {
var Rt;
const Te = (Rt = t10.placeholder) != null ? Rt : r("el.select.placeholder");
return t10.multiple || !Ve.value ? Te : s.selectedLabel;
}), ar = computed(() => sx ? null : "mouseenter");
watch(() => t10.modelValue, (Rt, Te) => {
t10.multiple && t10.filterable && !t10.reserveKeyword && (s.inputValue = "", Ct("")), Jr(), !NQ(Rt, Te) && t10.validateEvent && (gt == null || gt.validate("change").catch((Se) => y2(Se)));
}, {
flush: "post",
deep: true
}), watch(() => nt.value, (Rt) => {
Rt ? Ct(s.inputValue) : (s.inputValue = "", s.previousQuery = null, s.isBeforeHide = true), e("visible-change", Rt);
}), watch(() => s.options.entries(), () => {
var Rt;
if (!s1)
return;
const Te = ((Rt = a.value) == null ? void 0 : Rt.querySelectorAll("input")) || [];
(!t10.filterable && !t10.defaultFirstOption && !q6(t10.modelValue) || !Array.from(Te).includes(document.activeElement)) && Jr(), t10.defaultFirstOption && (t10.filterable || t10.remote) && Je.value && en();
}, {
flush: "post"
}), watch(() => s.hoveringIndex, (Rt) => {
ro(Rt) && Rt > -1 ? ct.value = Ne.value[Rt] || {} : ct.value = {}, Ne.value.forEach((Te) => {
Te.hover = ct.value === Te;
});
}), watchEffect(() => {
s.isBeforeHide || me();
});
const Ct = (Rt) => {
s.previousQuery === Rt || k.value || (s.previousQuery = Rt, t10.filterable && Zo(t10.filterMethod) ? t10.filterMethod(Rt) : t10.filterable && t10.remote && Zo(t10.remoteMethod) && t10.remoteMethod(Rt), t10.defaultFirstOption && (t10.filterable || t10.remote) && Je.value ? nextTick(en) : nextTick(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 (t10.multiple)
s.selectedLabel = "";
else {
const Te = p2(t10.modelValue) ? t10.modelValue[0] : t10.modelValue, Se = Hr(Te);
s.selectedLabel = Se.currentLabel, s.selected = [Se];
return;
}
const Rt = [];
q6(t10.modelValue) || W6(t10.modelValue).forEach((Te) => {
Rt.push(Hr(Te));
}), s.selected = Rt;
}, Hr = (Rt) => {
let Te;
const Se = hb(Rt).toLowerCase() === "object", lr = hb(Rt).toLowerCase() === "null", Ar = hb(Rt).toLowerCase() === "undefined";
for (let br = s.cachedOptions.size - 1; br >= 0; br--) {
const Br = Gt.value[br];
if (Se ? T4(Br.value, t10.valueKey) === T4(Rt, t10.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 = true), Ct(s.inputValue);
}, c1 = (Rt) => {
if (s.inputValue = Rt.target.value, t10.remote)
ye();
else
return Ii();
}, ye = z1t(() => {
Ii();
}, He.value), bi = (Rt) => {
NQ(t10.modelValue, Rt) || e(cS, Rt);
}, Xn = (Rt) => U1t(Rt, (Te) => !s.disabledOptions.has(Te)), Hi = (Rt) => {
if (t10.multiple && Rt.code !== Nh.delete && Rt.target.value.length <= 0) {
const Te = W6(t10.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 = W6(t10.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 = t10.multiple ? [] : Zt.value;
if (t10.multiple)
for (const Se of s.selected)
Se.isDisabled && Te.push(Se.value);
e(Wo, Te), bi(Te), s.hoveringIndex = -1, nt.value = false, e("clear"), Vi();
}, Dr = (Rt) => {
var Te;
if (t10.multiple) {
const Se = W6((Te = t10.modelValue) != null ? Te : []).slice(), lr = _r(Se, Rt.value);
lr > -1 ? Se.splice(lr, 1) : (t10.multipleLimit <= 0 || Se.length < t10.multipleLimit) && Se.push(Rt.value), e(Wo, Se), bi(Se), Rt.created && Ct(""), t10.filterable && !t10.reserveKeyword && (s.inputValue = "");
} else
e(Wo, Rt.value), bi(Rt.value), nt.value = false;
Vi(), !nt.value && nextTick(() => {
Vn(Rt);
});
}, _r = (Rt = [], Te) => {
if (!T2(Te))
return Rt.indexOf(Te);
const Se = t10.valueKey;
let lr = -1;
return Rt.some((Ar, vn) => toRaw(T4(Ar, Se)) === T4(Te, Se) ? (lr = vn, true) : false), 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 && Y1t(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 = computed(() => {
var Rt, Te;
return (Te = (Rt = d.value) == null ? void 0 : Rt.popperRef) == null ? void 0 : Te.contentRef;
}), H1 = () => {
s.isBeforeHide = false, nextTick(() => 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 = false, et.value && Rn();
}, st = () => {
s.inputValue.length > 0 ? s.inputValue = "" : nt.value = false;
}, pt = () => {
re.value || (sx && (s.inputHovering = true), s.menuVisibleOnFocus ? s.menuVisibleOnFocus = false : nt.value = !nt.value);
}, yt = () => {
nt.value ? Ne.value[s.hoveringIndex] && Dr(Ne.value[s.hoveringIndex]) : pt();
}, At = (Rt) => T2(Rt.value) ? T4(Rt.value, t10.valueKey) : Rt.value, Vt = computed(() => Ne.value.filter((Rt) => Rt.visible).every((Rt) => Rt.disabled)), jt = computed(() => t10.multiple ? t10.collapseTags ? s.selected.slice(0, t10.maxCollapseTags) : s.selected : []), St = computed(() => t10.multiple ? t10.collapseTags ? s.selected.slice(t10.maxCollapseTags) : [] : []), Jt = (Rt) => {
if (!nt.value) {
nt.value = true;
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 === true || Te.states.groupDisabled === true || !Te.visible) && Jt(Rt), nextTick(() => Vn(ct.value));
}
}, ae = () => {
if (!u.value)
return 0;
const Rt = window.getComputedStyle(u.value);
return Number.parseFloat(Rt.gap || "6px");
}, Xt = computed(() => {
const Rt = ae();
return { maxWidth: `${x.value && t10.maxCollapseTags === 1 ? s.selectionWidth - s.collapseItemWidth - Rt : s.selectionWidth}px` };
}), Le = computed(() => ({ maxWidth: `${s.selectionWidth}px` })), or = computed(() => ({
width: `${Math.max(s.calculatorWidth, e4t)}px`
}));
return B6(u, dn), B6(Q, ji), B6(L, ki), B6($, ki), B6(E, _i), B6(x, Ji), onMounted(() => {
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: Jt,
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 n4t = defineComponent({
name: "ElOptions",
setup(t10, { slots: e }) {
const r = inject(Sg);
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), NQ(a, n) || (n = a, r && (r.states.optionValues = a)), s;
};
}
});
var i4t = Sn({
name: String,
id: String,
modelValue: {
type: [Array, String, Number, Boolean, Object],
default: void 0
},
autocomplete: {
type: String,
default: "off"
},
automaticDropdown: Boolean,
size: J8,
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: true
},
valueKey: {
type: String,
default: "value"
},
collapseTags: Boolean,
collapseTagsTooltip: Boolean,
maxCollapseTags: {
type: Number,
default: 1
},
teleported: Z2.teleported,
persistent: {
type: Boolean,
default: true
},
clearIcon: {
type: b8,
default: Lz
},
fitInputWidth: Boolean,
suffixIcon: {
type: b8,
default: lS
},
tagType: { ...vx.type, default: "info" },
tagEffect: { ...vx.effect, default: "light" },
validateEvent: {
type: Boolean,
default: true
},
remoteShowSuffix: Boolean,
placement: {
type: Gr(String),
values: bg,
default: "bottom-start"
},
fallbackPlacements: {
type: Gr(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
appendTo: String,
...j2t,
...sl(["ariaLabel"])
});
var LI = "ElSelect";
var o4t = defineComponent({
name: LI,
componentName: LI,
components: {
ElSelectMenu: t4t,
ElOption: MS,
ElOptions: n4t,
ElTag: T3t,
ElScrollbar: hst,
ElTooltip: lU,
ElIcon: p3
},
directives: { ClickOutside: Dat },
props: i4t,
emits: [
Wo,
cS,
"remove-tag",
"clear",
"visible-change",
"focus",
"blur"
],
setup(t10, { emit: e }) {
const r = computed(() => {
const { modelValue: o, multiple: s } = t10, a = s ? [] : void 0;
return p2(o) ? s ? o : a : s ? a : o;
}), n = reactive({
...toRefs(t10),
modelValue: r
}), i = r4t(n, e);
return provide(Sg, reactive({
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 s4t(t10, e, r, n, i, o) {
const s = resolveComponent("el-tag"), a = resolveComponent("el-tooltip"), u = resolveComponent("el-icon"), d = resolveComponent("el-option"), T = resolveComponent("el-options"), f = resolveComponent("el-scrollbar"), Q = resolveComponent("el-select-menu"), y = resolveDirective("click-outside");
return withDirectives((openBlock(), createElementBlock("div", {
ref: "selectRef",
class: normalizeClass([t10.nsSelect.b(), t10.nsSelect.m(t10.selectSize)]),
[toHandlerKey(t10.mouseEnterEventName)]: (_) => t10.states.inputHovering = true,
onMouseleave: (_) => t10.states.inputHovering = false
}, [
createVNode(a, {
ref: "tooltipRef",
visible: t10.dropdownMenuVisible,
placement: t10.placement,
teleported: t10.teleported,
"popper-class": [t10.nsSelect.e("popper"), t10.popperClass],
"popper-options": t10.popperOptions,
"fallback-placements": t10.fallbackPlacements,
effect: t10.effect,
pure: "",
trigger: "click",
transition: `${t10.nsSelect.namespace.value}-zoom-in-top`,
"stop-popper-mouse-event": false,
"gpu-acceleration": false,
persistent: t10.persistent,
"append-to": t10.appendTo,
onBeforeShow: t10.handleMenuEnter,
onHide: (_) => t10.states.isBeforeHide = false
}, {
default: withCtx(() => {
var _;
return [
createBaseVNode("div", {
ref: "wrapperRef",
class: normalizeClass([
t10.nsSelect.e("wrapper"),
t10.nsSelect.is("focused", t10.isFocused),
t10.nsSelect.is("hovering", t10.states.inputHovering),
t10.nsSelect.is("filterable", t10.filterable),
t10.nsSelect.is("disabled", t10.selectDisabled)
]),
onClick: withModifiers(t10.toggleMenu, ["prevent"])
}, [
t10.$slots.prefix ? (openBlock(), createElementBlock("div", {
key: 0,
ref: "prefixRef",
class: normalizeClass(t10.nsSelect.e("prefix"))
}, [
renderSlot(t10.$slots, "prefix")
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("div", {
ref: "selectionRef",
class: normalizeClass([
t10.nsSelect.e("selection"),
t10.nsSelect.is("near", t10.multiple && !t10.$slots.prefix && !!t10.states.selected.length)
])
}, [
t10.multiple ? renderSlot(t10.$slots, "tag", { key: 0 }, () => [
(openBlock(true), createElementBlock(Fragment, null, renderList(t10.showTagList, (L) => (openBlock(), createElementBlock("div", {
key: t10.getValueKey(L),
class: normalizeClass(t10.nsSelect.e("selected-item"))
}, [
createVNode(s, {
closable: !t10.selectDisabled && !L.isDisabled,
size: t10.collapseTagSize,
type: t10.tagType,
effect: t10.tagEffect,
"disable-transitions": "",
style: normalizeStyle(t10.tagStyle),
onClose: (E) => t10.deleteTag(E, L)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(t10.nsSelect.e("tags-text"))
}, [
renderSlot(t10.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
createTextVNode(toDisplayString(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
], 2))), 128)),
t10.collapseTags && t10.states.selected.length > t10.maxCollapseTags ? (openBlock(), createBlock(a, {
key: 0,
ref: "tagTooltipRef",
disabled: t10.dropdownMenuVisible || !t10.collapseTagsTooltip,
"fallback-placements": ["bottom", "top", "right", "left"],
effect: t10.effect,
placement: "bottom",
teleported: t10.teleported
}, {
default: withCtx(() => [
createBaseVNode("div", {
ref: "collapseItemRef",
class: normalizeClass(t10.nsSelect.e("selected-item"))
}, [
createVNode(s, {
closable: false,
size: t10.collapseTagSize,
type: t10.tagType,
effect: t10.tagEffect,
"disable-transitions": "",
style: normalizeStyle(t10.collapseTagStyle)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(t10.nsSelect.e("tags-text"))
}, " + " + toDisplayString(t10.states.selected.length - t10.maxCollapseTags), 3)
]),
_: 1
}, 8, ["size", "type", "effect", "style"])
], 2)
]),
content: withCtx(() => [
createBaseVNode("div", {
ref: "tagMenuRef",
class: normalizeClass(t10.nsSelect.e("selection"))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(t10.collapseTagList, (L) => (openBlock(), createElementBlock("div", {
key: t10.getValueKey(L),
class: normalizeClass(t10.nsSelect.e("selected-item"))
}, [
createVNode(s, {
class: "in-tooltip",
closable: !t10.selectDisabled && !L.isDisabled,
size: t10.collapseTagSize,
type: t10.tagType,
effect: t10.tagEffect,
"disable-transitions": "",
onClose: (E) => t10.deleteTag(E, L)
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(t10.nsSelect.e("tags-text"))
}, [
renderSlot(t10.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
createTextVNode(toDisplayString(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "onClose"])
], 2))), 128))
], 2)
]),
_: 3
}, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
]) : createCommentVNode("v-if", true),
t10.selectDisabled ? createCommentVNode("v-if", true) : (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([
t10.nsSelect.e("selected-item"),
t10.nsSelect.e("input-wrapper"),
t10.nsSelect.is("hidden", !t10.filterable)
])
}, [
withDirectives(createBaseVNode("input", {
id: t10.inputId,
ref: "inputRef",
"onUpdate:modelValue": (L) => t10.states.inputValue = L,
type: "text",
name: t10.name,
class: normalizeClass([t10.nsSelect.e("input"), t10.nsSelect.is(t10.selectSize)]),
disabled: t10.selectDisabled,
autocomplete: t10.autocomplete,
style: normalizeStyle(t10.inputStyle),
role: "combobox",
readonly: !t10.filterable,
spellcheck: "false",
"aria-activedescendant": ((_ = t10.hoverOption) == null ? void 0 : _.id) || "",
"aria-controls": t10.contentId,
"aria-expanded": t10.dropdownMenuVisible,
"aria-label": t10.ariaLabel,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
onKeydown: [
withKeys(withModifiers((L) => t10.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
withKeys(withModifiers((L) => t10.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
withKeys(withModifiers(t10.handleEsc, ["stop", "prevent"]), ["esc"]),
withKeys(withModifiers(t10.selectOption, ["stop", "prevent"]), ["enter"]),
withKeys(withModifiers(t10.deletePrevTag, ["stop"]), ["delete"])
],
onCompositionstart: t10.handleCompositionStart,
onCompositionupdate: t10.handleCompositionUpdate,
onCompositionend: t10.handleCompositionEnd,
onInput: t10.onInput,
onClick: withModifiers(t10.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"]), [
[vModelText, t10.states.inputValue]
]),
t10.filterable ? (openBlock(), createElementBlock("span", {
key: 0,
ref: "calculatorRef",
"aria-hidden": "true",
class: normalizeClass(t10.nsSelect.e("input-calculator")),
textContent: toDisplayString(t10.states.inputValue)
}, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
], 2)),
t10.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass([
t10.nsSelect.e("selected-item"),
t10.nsSelect.e("placeholder"),
t10.nsSelect.is("transparent", !t10.hasModelValue || t10.expanded && !t10.states.inputValue)
])
}, [
t10.hasModelValue ? renderSlot(t10.$slots, "label", {
key: 0,
label: t10.currentPlaceholder,
value: t10.modelValue
}, () => [
createBaseVNode("span", null, toDisplayString(t10.currentPlaceholder), 1)
]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(t10.currentPlaceholder), 1))
], 2)) : createCommentVNode("v-if", true)
], 2),
createBaseVNode("div", {
ref: "suffixRef",
class: normalizeClass(t10.nsSelect.e("suffix"))
}, [
t10.iconComponent && !t10.showClose ? (openBlock(), createBlock(u, {
key: 0,
class: normalizeClass([t10.nsSelect.e("caret"), t10.nsSelect.e("icon"), t10.iconReverse])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(t10.iconComponent)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
t10.showClose && t10.clearIcon ? (openBlock(), createBlock(u, {
key: 1,
class: normalizeClass([
t10.nsSelect.e("caret"),
t10.nsSelect.e("icon"),
t10.nsSelect.e("clear")
]),
onClick: t10.handleClearClick
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(t10.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
t10.validateState && t10.validateIcon ? (openBlock(), createBlock(u, {
key: 2,
class: normalizeClass([t10.nsInput.e("icon"), t10.nsInput.e("validateIcon")])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(t10.validateIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 10, ["onClick"])
];
}),
content: withCtx(() => [
createVNode(Q, { ref: "menuRef" }, {
default: withCtx(() => [
t10.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(t10.nsSelect.be("dropdown", "header")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(t10.$slots, "header")
], 10, ["onClick"])) : createCommentVNode("v-if", true),
withDirectives(createVNode(f, {
id: t10.contentId,
ref: "scrollbarRef",
tag: "ul",
"wrap-class": t10.nsSelect.be("dropdown", "wrap"),
"view-class": t10.nsSelect.be("dropdown", "list"),
class: normalizeClass([t10.nsSelect.is("empty", t10.filteredOptionsCount === 0)]),
role: "listbox",
"aria-label": t10.ariaLabel,
"aria-orientation": "vertical"
}, {
default: withCtx(() => [
t10.showNewOption ? (openBlock(), createBlock(d, {
key: 0,
value: t10.states.inputValue,
created: true
}, null, 8, ["value"])) : createCommentVNode("v-if", true),
createVNode(T, null, {
default: withCtx(() => [
renderSlot(t10.$slots, "default")
]),
_: 3
})
]),
_: 3
}, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
[vShow, t10.states.options.size > 0 && !t10.loading]
]),
t10.$slots.loading && t10.loading ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(t10.nsSelect.be("dropdown", "loading"))
}, [
renderSlot(t10.$slots, "loading")
], 2)) : t10.loading || t10.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass(t10.nsSelect.be("dropdown", "empty"))
}, [
renderSlot(t10.$slots, "empty", {}, () => [
createBaseVNode("span", null, toDisplayString(t10.emptyText), 1)
])
], 2)) : createCommentVNode("v-if", true),
t10.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 3,
class: normalizeClass(t10.nsSelect.be("dropdown", "footer")),
onClick: withModifiers(() => {
}, ["stop"])
}, [
renderSlot(t10.$slots, "footer")
], 10, ["onClick"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 512)
]),
_: 3
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"])
], 16, ["onMouseleave"])), [
[y, t10.handleClickOutside, t10.popperRef]
]);
}
var a4t = Hn(o4t, [["render", s4t], ["__file", "select.vue"]]);
var l4t = defineComponent({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: Boolean
},
setup(t10) {
const e = Bn("select"), r = ref(null), n = getCurrentInstance(), i = ref([]);
provide(OU, reactive({
...toRefs(t10)
}));
const o = computed(() => i.value.some((d) => d.visible === true)), 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 = W6(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 onMounted(() => {
u();
}), Get(r, u, {
attributes: true,
subtree: true,
childList: true
}), {
groupRef: r,
visible: o,
ns: e
};
}
});
function c4t(t10, e, r, n, i, o) {
return withDirectives((openBlock(), createElementBlock("ul", {
ref: "groupRef",
class: normalizeClass(t10.ns.be("group", "wrap"))
}, [
createBaseVNode("li", {
class: normalizeClass(t10.ns.be("group", "title"))
}, toDisplayString(t10.label), 3),
createBaseVNode("li", null, [
createBaseVNode("ul", {
class: normalizeClass(t10.ns.b("group"))
}, [
renderSlot(t10.$slots, "default")
], 2)
])
], 2)), [
[vShow, t10.visible]
]);
}
var CU = Hn(l4t, [["render", c4t], ["__file", "option-group.vue"]]);
var Hg = v2(a4t, {
Option: MS,
OptionGroup: CU
});
var SS = ol(MS);
ol(CU);
var u4t = Sn({
trigger: Bh.trigger,
placement: bb.placement,
disabled: Bh.disabled,
visible: Z2.visible,
transition: Z2.transition,
popperOptions: bb.popperOptions,
tabindex: bb.tabindex,
content: Z2.content,
popperStyle: Z2.popperStyle,
popperClass: Z2.popperClass,
enterable: {
...Z2.enterable,
default: true
},
effect: {
...Z2.effect,
default: "light"
},
teleported: Z2.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: true
},
persistent: {
type: Boolean,
default: true
},
"onUpdate:visible": {
type: Function
}
});
var h4t = {
"update:visible": (t10) => S4(t10),
"before-enter": () => true,
"before-leave": () => true,
"after-enter": () => true,
"after-leave": () => true
};
var d4t = "onUpdate:visible";
var p4t = defineComponent({
name: "ElPopover"
});
var T4t = defineComponent({
...p4t,
props: u4t,
emits: h4t,
setup(t10, { expose: e, emit: r }) {
const n = t10, i = computed(() => n[d4t]), o = Bn("popover"), s = ref(), a = computed(() => {
var E;
return (E = unref(s)) == null ? void 0 : E.popperRef;
}), u = computed(() => [
{
width: z5(n.width)
},
n.popperStyle
]), d = computed(() => [o.b(), n.popperClass, { [o.m("plain")]: !!n.content }]), T = computed(() => 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", false), r("after-leave");
};
return e({
popperRef: a,
hide: f
}), (E, x) => (openBlock(), createBlock(unref(lU), mergeProps({
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": unref(d),
"popper-style": unref(u),
teleported: E.teleported,
persistent: E.persistent,
"gpu-acceleration": unref(T),
"onUpdate:visible": unref(i),
onBeforeShow: Q,
onBeforeHide: y,
onShow: _,
onHide: L
}), {
content: withCtx(() => [
E.title ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(o).e("title")),
role: "title"
}, toDisplayString(E.title), 3)) : createCommentVNode("v-if", true),
renderSlot(E.$slots, "default", {}, () => [
createTextVNode(toDisplayString(E.content), 1)
])
]),
default: withCtx(() => [
E.$slots.reference ? renderSlot(E.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 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 f4t = Hn(T4t, [["__file", "popover.vue"]]);
var wI = (t10, e) => {
const r = e.arg || e.value, n = r == null ? void 0 : r.popperRef;
n && (n.triggerRef = t10);
};
var Q4t = {
mounted(t10, e) {
wI(t10, e);
},
updated(t10, e) {
wI(t10, e);
}
};
var m4t = "popover";
var kU = hot(Q4t, m4t);
var Ag = v2(f4t, {
directive: kU
});
function g4t(t10) {
let e;
const r = ref(false), n = reactive({
...t10,
originalPosition: "",
originalOverflow: "",
visible: false
});
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()) : (Rh(Q, y.bm("parent", "relative")), Q.removeAttribute("loading-number")), Rh(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;
t10.beforeClose && !t10.beforeClose() || (r.value = true, clearTimeout(e), e = setTimeout(u, 400), n.visible = false, (Q = t10.closed) == null || Q.call(t10));
}
function u() {
if (!r.value)
return;
const Q = n.parent;
r.value = false, Q.vLoadingAddClassList = void 0, o();
}
const d = defineComponent({
name: "ElLoading",
setup(Q, { expose: y }) {
const { ns: _, zIndex: L } = G2t("loading");
return y({
ns: _,
zIndex: L
}), () => {
const E = n.spinner || n.svg, x = h("svg", {
class: "circular",
viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50",
...E ? { innerHTML: E } : {}
}, [
h("circle", {
class: "path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
]), O = n.text ? h("p", { class: _.b("text") }, [n.text]) : void 0;
return h(Transition, {
name: _.b("fade"),
onAfterLeave: u
}, {
default: withCtx(() => [
withDirectives(createVNode("div", {
style: {
backgroundColor: n.background || ""
},
class: [
_.b("mask"),
n.customClass,
n.fullscreen ? "is-fullscreen" : ""
]
}, [
h("div", {
class: _.b("spinner")
}, [x, O])
]), [[vShow, n.visible]])
])
});
};
}
}), T = createApp(d), f = T.mount(document.createElement("div"));
return {
...toRefs(n),
setText: i,
removeElLoadingChild: s,
close: a,
handleAfterLeave: u,
vm: f,
get $el() {
return f.$el;
}
};
}
var tT;
var _x = function(t10 = {}) {
if (!s1)
return;
const e = y4t(t10);
if (e.fullscreen && tT)
return tT;
const r = g4t({
...e,
closed: () => {
var i;
(i = e.closed) == null || i.call(e), e.fullscreen && (tT = void 0);
}
});
v4t(e, e.parent, r), xI(e, e.parent, r), e.parent.vLoadingAddClassList = () => xI(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), nextTick(() => r.visible.value = e.visible), e.fullscreen && (tT = r), r;
};
var y4t = (t10) => {
var e, r, n, i;
let o;
return sa(t10.target) ? o = (e = document.querySelector(t10.target)) != null ? e : document.body : o = t10.target || document.body, {
parent: o === document.body || t10.body ? document.body : o,
background: t10.background || "",
svg: t10.svg || "",
svgViewBox: t10.svgViewBox || "",
spinner: t10.spinner || false,
text: t10.text || "",
fullscreen: o === document.body && ((r = t10.fullscreen) != null ? r : true),
lock: (n = t10.lock) != null ? n : false,
customClass: t10.customClass || "",
visible: (i = t10.visible) != null ? i : true,
beforeClose: t10.beforeClose,
closed: t10.closed,
target: o
};
};
var v4t = async (t10, e, r) => {
const { nextZIndex: n } = r.vm.zIndex || r.vm._.exposed.zIndex, i = {};
if (t10.fullscreen)
r.originalPosition.value = L7(document.body, "position"), r.originalOverflow.value = L7(document.body, "overflow"), i.zIndex = n();
else if (t10.parent === document.body) {
r.originalPosition.value = L7(document.body, "position"), await nextTick();
for (const o of ["top", "left"]) {
const s = o === "top" ? "scrollTop" : "scrollLeft";
i[o] = `${t10.target.getBoundingClientRect()[o] + document.body[s] + document.documentElement[s] - Number.parseInt(L7(document.body, `margin-${o}`), 10)}px`;
}
for (const o of ["height", "width"])
i[o] = `${t10.target.getBoundingClientRect()[o]}px`;
} else
r.originalPosition.value = L7(e, "position");
for (const [o, s] of Object.entries(i))
r.$el.style[o] = s;
};
var xI = (t10, e, r) => {
const n = r.vm.ns || r.vm._.exposed.ns;
["absolute", "fixed", "sticky"].includes(r.originalPosition.value) ? Rh(e, n.bm("parent", "relative")) : px(e, n.bm("parent", "relative")), t10.fullscreen && t10.lock ? px(e, n.bm("parent", "hidden")) : Rh(e, n.bm("parent", "hidden"));
};
var mf = Symbol("ElLoading");
var EI = (t10, 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 && ref(y);
}, d = (Q) => u(a(Q) || t10.getAttribute(`element-loading-${nrt(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 : t10,
body: (i = a("body")) != null ? i : e.modifiers.body,
lock: (o = a("lock")) != null ? o : e.modifiers.lock
};
t10[mf] = {
options: f,
instance: _x(f)
};
};
var _4t = (t10, e) => {
for (const r of Object.keys(e))
isRef(e[r]) && (e[r].value = t10[r]);
};
var bx = {
mounted(t10, e) {
e.value && EI(t10, e);
},
updated(t10, e) {
const r = t10[mf];
e.oldValue !== e.value && (e.value && !e.oldValue ? EI(t10, e) : e.value && e.oldValue ? T2(e.value) && _4t(e.value, r.options) : r == null || r.instance.close());
},
unmounted(t10) {
var e;
(e = t10[mf]) == null || e.instance.close(), t10[mf] = null;
}
};
var b4t = {
install(t10) {
t10.directive("loading", bx), t10.config.globalProperties.$loading = _x;
},
directive: bx,
service: _x
};
var Og = (t10, e) => {
const r = t10.__vccOpts || t10;
for (const [n, i] of e)
r[n] = i;
return r;
};
var L4t = {
name: "SelectionsGroup",
components: {
Checkbox: gU,
CheckboxGroup: yU,
Col: fd,
Icon: p3,
Row: Td,
ElIconWarning: Ez
},
methods: {
/**
* Function to toggle paths to default.
* Also called when the associated button is pressed.
*/
reset: function() {
this.checkAll = true, this.checkedItems = [], this.selections.forEach((t10) => {
!("enabled" in t10) || t10.enabled === true ? this.checkedItems.push(t10[this.identifierKey]) : this.checkAll = false;
});
},
setCheckboxActionData: function(t10, e) {
if (t10) {
const r = t10.querySelector('input[type="checkbox"]'), n = t10.querySelector(".el-checkbox__label"), o = t10.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(t10) {
const e = t10.target.closest(".checkbox-container");
this.setCheckboxActionData(e, "individual");
},
onAllCheckboxNativeChange: function(t10) {
const e = t10.target.closest(".all-checkbox");
this.setCheckboxActionData(e, "all");
},
visibilityToggle: function(t10, e) {
this.$emit("changed", { key: t10, value: e }), t10 === this.checkboxActionData.property && (this.checkboxActionData.checked = e ? "checked" : "unchecked"), this.$emit("selections-data-changed", this.checkboxActionData);
},
checkboxMouseEnterEmit: function(t10, e) {
this.$emit("checkboxMouseEnter", { key: t10, value: e, selections: this.selections, checked: this.checkedItems });
},
handleCheckedItemsChange: function(t10) {
let e = t10.length;
this.checkAll = e === this.selections.length;
},
handleCheckAllChange: function(t10) {
this.checkedItems = t10 ? this.selections.map((e) => e[this.identifierKey]) : [], this.$emit("checkAll", {
keys: this.selections.map((e) => e[this.identifierKey]),
value: t10
}), this.checkboxActionData.property = this.identifierKey, this.checkboxActionData.checked = t10 ? "checked" : "unchecked", this.$emit("selections-data-changed", this.checkboxActionData);
},
getBackgroundStyles: function(t10) {
return "colour" in t10 && this.colourStyle === "background" ? { background: t10.colour } : {};
},
getState: function() {
const e = this.checkedItems.length === this.selections.length;
return {
checkAll: e,
checked: e ? [] : this.checkedItems
};
},
setState: function(t10) {
var e;
if (this.checkAll = t10.checkAll, this.checkedItems.length = 0, (e = t10.checked) != null && e.length)
this.checkedItems.push(...t10.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 = false;
this.checkAll && (n = true, this.checkedItems.push(...r)), this.$emit("checkAll", { keys: r, value: n });
}
},
hasLineStyles: function(t10) {
return "colour" in t10 && this.colourStyle === "line";
},
getLineStyles: function(t10) {
return "colour" in t10 && this.colourStyle === "line" ? "dashed" in t10 && t10.dashed === true ? { background: `repeating-linear-gradient(90deg,${t10.colour},${t10.colour} 6px,transparent 0,transparent 9px)` } : { background: t10.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: true,
checkboxActionData: {
selectionsTitle: "",
property: "",
label: "",
checked: ""
}
};
},
mounted: function() {
this.reset();
}
};
var w4t = { class: "selections-container" };
var x4t = { class: "checkall-display-text" };
var E4t = { style: { "word-break": "keep-all" } };
var M4t = { class: "checkbox-group-inner" };
var S4t = ["onMouseenter", "onMouseleave"];
function H4t(t10, e, r, n, i, o) {
const s = Ez, a = p3, u = Ag, d = fd, T = gU, f = Td, Q = yU;
return openBlock(), createElementBlock("div", w4t, [
createVNode(f, null, {
default: withCtx(() => [
createVNode(d, { span: 12 }, {
default: withCtx(() => [
createBaseVNode("span", x4t, toDisplayString(r.title), 1),
r.helpMessage ? (openBlock(), createBlock(u, {
key: 0,
width: "250",
trigger: "hover",
teleported: false,
"popper-class": "popover-origin-help"
}, createSlots({
default: withCtx(() => [
createBaseVNode("span", E4t, toDisplayString(r.helpMessage), 1)
]),
_: 2
}, [
r.helpMessage ? {
name: "reference",
fn: withCtx(() => [
createVNode(a, { class: "info" }, {
default: withCtx(() => [
createVNode(s)
]),
_: 1
})
]),
key: "0"
} : void 0
]), 1024)) : createCommentVNode("", true)
]),
_: 1
}),
createVNode(d, { span: 12 }, {
default: withCtx(() => [
r.selections && r.selections.length > 1 ? (openBlock(), createBlock(T, {
key: 0,
class: "all-checkbox",
indeterminate: o.isIndeterminate,
modelValue: t10.checkAll,
"onUpdate:modelValue": e[0] || (e[0] = (y) => t10.checkAll = y),
onChange: o.handleCheckAllChange,
onClick: o.onAllCheckboxNativeChange
}, {
default: withCtx(() => [
createTextVNode("Display all")
]),
_: 1
}, 8, ["indeterminate", "modelValue", "onChange", "onClick"])) : createCommentVNode("", true)
]),
_: 1
})
]),
_: 1
}),
createVNode(Q, {
modelValue: t10.checkedItems,
"onUpdate:modelValue": e[1] || (e[1] = (y) => t10.checkedItems = y),
size: "small",
class: "checkbox-group",
onChange: o.handleCheckedItemsChange
}, {
default: withCtx(() => [
createBaseVNode("div", M4t, [
(openBlock(true), createElementBlock(Fragment, null, renderList(r.selections, (y) => (openBlock(), createBlock(f, {
key: y[r.identifierKey],
label: y[r.identifierKey]
}, {
default: withCtx(() => [
createBaseVNode("div", {
class: "checkbox-container",
onMouseenter: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], true),
onMouseleave: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], false)
}, [
createVNode(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 === true
}, {
default: withCtx(() => [
createVNode(f, { class: "checkbox-row" }, {
default: withCtx(() => [
o.hasLineStyles(y) ? (openBlock(), createBlock(d, {
key: 0,
span: 4
}, {
default: withCtx(() => [
createBaseVNode("div", {
class: "path-visual",
style: normalizeStyle(o.getLineStyles(y))
}, null, 4)
]),
_: 2
}, 1024)) : createCommentVNode("", true),
createVNode(d, { span: 20 }, {
default: withCtx(() => [
createBaseVNode("div", {
style: normalizeStyle(o.getBackgroundStyles(y))
}, toDisplayString(y[r.labelKey]), 5)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["label", "value", "onChange", "onClick", "checked"])
], 40, S4t)
]),
_: 2
}, 1032, ["label"]))), 128))
])
]),
_: 1
}, 8, ["modelValue", "onChange"])
]);
}
var IU = Og(L4t, [["render", H4t], ["__scopeId", "data-v-fb8c9eee"]]);
var A4t = {
name: "SvgLegends"
};
var O4t = (t10) => (pushScopeId("data-v-88079d87"), t10 = t10(), popScopeId(), t10);
var C4t = { class: "legends-container" };
var k4t = {
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"
};
var I4t = createStaticVNode(' Tissue region Brain nuclei Ganglia Ganglionated nerve plexus ', 9);
var P4t = [
I4t
];
var V4t = O4t(() => createBaseVNode("svg", {
width: "72px",
height: "72px",
viewBox: "0 0 24 24",
fill: "yellow"
}, null, -1));
function R4t(t10, e, r, n, i, o) {
return openBlock(), createElementBlock("div", C4t, [
(openBlock(), createElementBlock("svg", k4t, P4t)),
V4t
]);
}
var PU = Og(A4t, [["render", R4t], ["__scopeId", "data-v-88079d87"]]);
var N4t = `
`;
var Lb = function(t10) {
return t10 ? [...new Set(t10.map((e) => JSON.stringify(e)))].map(
(e) => JSON.parse(e)
) : [];
};
var wb = [];
var Lx = async function(t10, e) {
const r = e.filter(
(o) => wb.some((s) => s.taxon === o)
), n = wb.filter(
(o) => r.includes(o.taxon)
), i = e.filter(
(o) => !r.includes(o)
);
if (i.length) {
const o = await t10.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), wb.push(d);
}), n;
} else
return n;
};
var xb = function(t10, e) {
if (!t10 || !e) return false;
let r = JSON.stringify(t10), n = JSON.stringify(e);
return r.indexOf(n) !== -1;
};
var D4t = function() {
this.initialise = function(t10) {
this.flatmapApi = t10, this.destinations = [], this.origins = [], this.components = [], this.urls = [], this.controller = void 0, this.uberons = [], this.lookUp = [];
}, this.createTooltipData = async function(t10, 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 Lx(t10, 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(t10, e) {
let r = [];
return t10.forEach((n) => {
r.push(this.createLabelFromNeuralNode(n[0]), e), n.length === 2 && r.push(this.createLabelFromNeuralNode(n[1]), e);
}), r;
}, this.createLabelLookup = function(t10, e) {
return new Promise(async (r) => {
let n = {};
this.uberons = [];
const i = await Lx(t10, 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(t10) {
let e = "select knowledge from knowledge where entity in (";
if (t10.length === 1)
e += `'${t10[0]}')`;
else if (t10.length > 1)
for (let r in t10)
e += `'${t10[r]}'${r >= t10.length - 1 ? ")" : ","} `;
return e;
}, this.buildLabelSqlStatement = function(t10) {
let e = "select entity, label from labels where entity in (";
if (t10.length === 1)
e += `'${t10[0]}')`;
else if (t10.length > 1)
for (let r in t10)
e += `'${t10[r]}'${r >= t10.length - 1 ? ")" : ","} `;
return e;
}, this.findAllIdsFromConnectivity = function(t10) {
let e = t10.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(t10) {
let e = t10.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(t10) {
let e = t10.connectivity.flat(), r = Lb(e), n = [], i = false;
return r.forEach((o) => {
i = false, xb(t10.axons, o) && (i = true), t10.somas && xb(t10.somas, o) && (i = true), xb(t10.dendrites, o) && (i = true), i || n.push(o);
}), n;
}, this.retrieveFlatmapKnowledgeForEvent = async function(t10, 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(t10, n, r);
return await Promise.all([i]);
}, this.queryForConnectivityNew = function(t10, e, r, n = true) {
return new Promise((i) => {
t10.queryKnowledge(e[0]).then((o) => {
if (this.checkConnectivityExists(o)) {
let s = o;
n ? this.processConnectivity(t10, s).then((a) => {
o.references ? this.getURLsForPubMed(o.references).then((u) => {
this.urls = u, i(a);
}) : i(a);
}) : i(s);
} else
i(false);
}).catch((o) => {
o.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${e[0]}.`), i(false);
});
});
}, this.queryForConnectivity = function(t10, e, r, n = true) {
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(t10, u).then((d) => {
s(d);
}) : s(u);
} else
s(false);
}).catch((a) => {
a.name === "AbortError" || console.error("Error:", a), s(false);
});
});
}, this.checkConnectivityExists = function(t10) {
var e;
return t10 && ((e = t10.connectivity) == null ? void 0 : e.length);
}, this.connectivityExists = function(t10) {
return !!(t10.values && t10.values.length > 0 && JSON.parse(t10.values[0][0]).connectivity && JSON.parse(t10.values[0][0]).connectivity.length > 0);
}, this.findIfNodeIsSingle = function(t10) {
return t10.length === 1 ? (console.error("Server returns a single node", t10), t10[0]) : t10.length === 2 && t10[1].length === 0 ? t10[0] : false;
}, this.createLabelFromNeuralNode = function(t10, e) {
let r = this.findIfNodeIsSingle(t10);
if (r)
return e[r];
let n = e[t10[0]];
return t10.length === 2 && t10[1].length > 0 && t10[1].forEach((i) => {
e[i] == null ? n += `, ${i}` : n += `, ${e[i]}`;
}), n;
}, this.flattenAndFindDatasets = function(t10, e, r) {
let n = this.flattenConntectivity(t10), 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(t10, e) {
return new Promise((r) => {
let n = this.findComponents(e), i = Lb(e.axons), o = [];
e.somas && e.somas.length > 0 && o.push(...e.somas), e.dendrites && e.dendrites.length > 0 && o.push(...e.dendrites), o = Lb(o);
let s = this.findAllIdsFromConnectivity(e);
this.createLabelLookup(t10, 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(t10) {
let e = t10.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(t10) {
return t10.split(":")[1];
}, this.getPMID = function(t10) {
return new Promise((e) => {
if (t10.length > 0) {
const r = [], n = [];
t10.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(t10) {
return new Promise((e) => {
const r = [], n = [];
t10.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(t10) {
if (!t10) return;
const e = decodeURIComponent(t10);
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 === "" && (t10.includes("doi:") ? (r.id = this.stripPMIDPrefix(t10), r.type = "doi") : t10.includes("PMID:") && (r.id = this.stripPMIDPrefix(t10), r.type = "pmid")), r.id.endsWith("/") && (r.id = r.id.slice(0, -1)), r;
}, this.getURLsForPubMed = function(t10) {
return new Promise((e) => {
const r = t10.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(t10) {
let e = "select distinct publication from publications where entity in (";
if (t10.length === 1)
e += `'${t10[0]}')`;
else if (t10.length > 1)
for (let r in t10)
e += `'${t10[r]}'${r >= t10.length - 1 ? ")" : ","} `;
return e;
}, this.buildPubmedSqlStatementForModels = function(t10) {
return `select distinct publication from publications where entity = '${t10}'`;
}, this.flatmapQuery = function(t10) {
const e = { sql: t10 };
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(t10) {
return new Promise((e) => {
const r = t10.resource, n = t10.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(true) : e(false);
}).catch(() => {
this.urls = [], e(false);
}) : this.pubmedQueryOnModels(n).then((s) => {
e(s);
});
});
});
}, this.pubmedQueryOnModels = function(t10) {
return this.flatmapQuery(
this.buildPubmedSqlStatementForModels(t10)
).then((e) => (Array.isArray(e.values) && e.values.length > 0 ? this.getURLsForPubMed(e.values).then((r) => (this.urls = r, true)).catch(() => (this.urls = [], false)) : this.urls = [], false));
}, this.pubmedSearchUrl = function(t10) {
let e = "https://pubmed.ncbi.nlm.nih.gov/?", r = new URLSearchParams();
return r.append("term", t10), e + r.toString();
};
};
var F4t = (t10) => t10 && t10.charAt(0).toUpperCase() + t10.slice(1);
var B4t = '';
var VU = { exports: {} };
(function(t10, e) {
(function(r, n) {
t10.exports = n();
})(typeof window < "u" ? window : Rat, 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 = false, ct = 0, rt = s(L), gt = 0, It = 0, Zt = true;
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 = false;
}
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: true,
subtree: true
});
});
}
return u;
});
})(VU);
var j4t = VU.exports;
var z4t = Nat(j4t);
var U4t = Object.defineProperty;
var G4t = (t10, e, r) => e in t10 ? U4t(t10, e, { enumerable: true, configurable: true, writable: true, value: r }) : t10[e] = r;
var dt = (t10, e, r) => (G4t(t10, typeof e != "symbol" ? e + "" : e, r), r);
var HS = (t10, e, r) => {
if (!e.has(t10))
throw TypeError("Cannot " + r);
};
var K = (t10, e, r) => (HS(t10, e, "read from private field"), r ? r.call(t10) : e.get(t10));
var Ft = (t10, e, r) => {
if (e.has(t10))
throw TypeError("Cannot add the same private member more than once");
e instanceof WeakSet ? e.add(t10) : e.set(t10, r);
};
var Yt = (t10, e, r, n) => (HS(t10, e, "write to private field"), e.set(t10, r), r);
var se = (t10, e, r) => (HS(t10, e, "access private method"), r);
function $4t(t10, 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 t10)) {
const o = Object.getOwnPropertyDescriptor(n, i);
o && Object.defineProperty(t10, i, o.get ? o : {
enumerable: true,
get: () => n[i]
});
}
}
}
return Object.freeze(Object.defineProperty(t10, Symbol.toStringTag, { value: "Module" }));
}
var P = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function p0(t10) {
return t10 && t10.__esModule && Object.prototype.hasOwnProperty.call(t10, "default") ? t10.default : t10;
}
function W4t(t10) {
if (t10.__esModule)
return t10;
var e = t10.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: true }), Object.keys(t10).forEach(function(n) {
var i = Object.getOwnPropertyDescriptor(t10, n);
Object.defineProperty(r, n, i.get ? i : {
enumerable: true,
get: function() {
return t10[n];
}
});
}), r;
}
var qo = function(t10) {
try {
return !!t10();
} catch {
return true;
}
};
var Z4t = qo;
var AS = !Z4t(function() {
var t10 = (function() {
}).bind();
return typeof t10 != "function" || t10.hasOwnProperty("prototype");
});
var RU = AS;
var NU = Function.prototype;
var wx = NU.call;
var q4t = RU && NU.bind.bind(wx, wx);
var oo = RU ? q4t : function(t10) {
return function() {
return wx.apply(t10, arguments);
};
};
var DU = oo;
var X4t = DU({}.toString);
var K4t = DU("".slice);
var Qd = function(t10) {
return K4t(X4t(t10), 8, -1);
};
var Y4t = oo;
var J4t = qo;
var t6t = Qd;
var Eb = Object;
var e6t = Y4t("".split);
var r6t = J4t(function() {
return !Eb("z").propertyIsEnumerable(0);
}) ? function(t10) {
return t6t(t10) === "String" ? e6t(t10, "") : Eb(t10);
} : Eb;
var md = function(t10) {
return t10 == null;
};
var n6t = md;
var i6t = TypeError;
var Cg = function(t10) {
if (n6t(t10))
throw new i6t("Can't call method on " + t10);
return t10;
};
var o6t = r6t;
var s6t = Cg;
var rc = function(t10) {
return o6t(s6t(t10));
};
var hu = function(t10) {
return t10 && t10.Math === Math && t10;
};
var J2 = (
// eslint-disable-next-line es/no-global-this -- safe
hu(typeof globalThis == "object" && globalThis) || hu(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe
hu(typeof self == "object" && self) || hu(typeof P == "object" && P) || hu(typeof P == "object" && P) || // eslint-disable-next-line no-new-func -- fallback
/* @__PURE__ */ function() {
return this;
}() || Function("return this")()
);
var FU = { exports: {} };
var MI = J2;
var a6t = Object.defineProperty;
var OS = function(t10, e) {
try {
a6t(MI, t10, { value: e, configurable: true, writable: true });
} catch {
MI[t10] = e;
}
return e;
};
var l6t = J2;
var c6t = OS;
var SI = "__core-js_shared__";
var HI = FU.exports = l6t[SI] || c6t(SI, {});
(HI.versions || (HI.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 CS = FU.exports;
var AI = CS;
var BU = function(t10, e) {
return AI[t10] || (AI[t10] = e || {});
};
var u6t = Cg;
var h6t = Object;
var jU = function(t10) {
return h6t(u6t(t10));
};
var d6t = oo;
var p6t = jU;
var T6t = d6t({}.hasOwnProperty);
var _3 = Object.hasOwn || function(t10, e) {
return T6t(p6t(t10), e);
};
var f6t = oo;
var Q6t = 0;
var m6t = Math.random();
var g6t = f6t(1 .toString);
var kS = function(t10) {
return "Symbol(" + (t10 === void 0 ? "" : t10) + ")_" + g6t(++Q6t + m6t, 36);
};
var y6t = typeof navigator < "u" && String(navigator.userAgent) || "";
var zU = J2;
var Mb = y6t;
var OI = zU.process;
var CI = zU.Deno;
var kI = OI && OI.versions || CI && CI.version;
var II = kI && kI.v8;
var ta;
var jQ;
II && (ta = II.split("."), jQ = ta[0] > 0 && ta[0] < 4 ? 1 : +(ta[0] + ta[1]));
!jQ && Mb && (ta = Mb.match(/Edge\/(\d+)/), (!ta || ta[1] >= 74) && (ta = Mb.match(/Chrome\/(\d+)/), ta && (jQ = +ta[1])));
var v6t = jQ;
var PI = v6t;
var _6t = qo;
var b6t = J2;
var L6t = b6t.String;
var UU = !!Object.getOwnPropertySymbols && !_6t(function() {
var t10 = Symbol("symbol detection");
return !L6t(t10) || !(Object(t10) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && PI && PI < 41;
});
var w6t = UU;
var GU = w6t && !Symbol.sham && typeof Symbol.iterator == "symbol";
var x6t = J2;
var E6t = BU;
var VI = _3;
var M6t = kS;
var S6t = UU;
var H6t = GU;
var K7 = x6t.Symbol;
var Sb = E6t("wks");
var A6t = H6t ? K7.for || K7 : K7 && K7.withoutSetter || M6t;
var Ns = function(t10) {
return VI(Sb, t10) || (Sb[t10] = S6t && VI(K7, t10) ? K7[t10] : A6t("Symbol." + t10)), Sb[t10];
};
var Hb = typeof document == "object" && document.all;
var Mo = typeof Hb > "u" && Hb !== void 0 ? function(t10) {
return typeof t10 == "function" || t10 === Hb;
} : function(t10) {
return typeof t10 == "function";
};
var O6t = Mo;
var Ds = function(t10) {
return typeof t10 == "object" ? t10 !== null : O6t(t10);
};
var C6t = Ds;
var k6t = String;
var I6t = TypeError;
var T0 = function(t10) {
if (C6t(t10))
return t10;
throw new I6t(k6t(t10) + " is not an object");
};
var $U = {};
var P6t = qo;
var da = !P6t(function() {
return Object.defineProperty({}, 1, { get: function() {
return 7;
} })[1] !== 7;
});
var V6t = da;
var R6t = qo;
var WU = V6t && R6t(function() {
return Object.defineProperty(function() {
}, "prototype", {
value: 42,
writable: false
}).prototype !== 42;
});
var b3 = {};
var N6t = J2;
var RI = Ds;
var xx = N6t.document;
var D6t = RI(xx) && RI(xx.createElement);
var IS = function(t10) {
return D6t ? xx.createElement(t10) : {};
};
var F6t = da;
var B6t = qo;
var j6t = IS;
var ZU = !F6t && !B6t(function() {
return Object.defineProperty(j6t("div"), "a", {
get: function() {
return 7;
}
}).a !== 7;
});
var z6t = AS;
var eT = Function.prototype.call;
var I4 = z6t ? eT.bind(eT) : function() {
return eT.apply(eT, arguments);
};
var Ab = J2;
var U6t = Mo;
var G6t = function(t10) {
return U6t(t10) ? t10 : void 0;
};
var gd = function(t10, e) {
return arguments.length < 2 ? G6t(Ab[t10]) : Ab[t10] && Ab[t10][e];
};
var $6t = oo;
var PS = $6t({}.isPrototypeOf);
var W6t = gd;
var Z6t = Mo;
var q6t = PS;
var X6t = GU;
var K6t = Object;
var qU = X6t ? function(t10) {
return typeof t10 == "symbol";
} : function(t10) {
var e = W6t("Symbol");
return Z6t(e) && q6t(e.prototype, K6t(t10));
};
var Y6t = String;
var VS = function(t10) {
try {
return Y6t(t10);
} catch {
return "Object";
}
};
var J6t = Mo;
var t0t = VS;
var e0t = TypeError;
var yd = function(t10) {
if (J6t(t10))
return t10;
throw new e0t(t0t(t10) + " is not a function");
};
var r0t = yd;
var n0t = md;
var RS = function(t10, e) {
var r = t10[e];
return n0t(r) ? void 0 : r0t(r);
};
var Ob = I4;
var Cb = Mo;
var kb = Ds;
var i0t = TypeError;
var o0t = function(t10, e) {
var r, n;
if (e === "string" && Cb(r = t10.toString) && !kb(n = Ob(r, t10)) || Cb(r = t10.valueOf) && !kb(n = Ob(r, t10)) || e !== "string" && Cb(r = t10.toString) && !kb(n = Ob(r, t10)))
return n;
throw new i0t("Can't convert object to primitive value");
};
var s0t = I4;
var NI = Ds;
var DI = qU;
var a0t = RS;
var l0t = o0t;
var c0t = Ns;
var u0t = TypeError;
var h0t = c0t("toPrimitive");
var d0t = function(t10, e) {
if (!NI(t10) || DI(t10))
return t10;
var r = a0t(t10, h0t), n;
if (r) {
if (e === void 0 && (e = "default"), n = s0t(r, t10, e), !NI(n) || DI(n))
return n;
throw new u0t("Can't convert object to primitive value");
}
return e === void 0 && (e = "number"), l0t(t10, e);
};
var p0t = d0t;
var T0t = qU;
var XU = function(t10) {
var e = p0t(t10, "string");
return T0t(e) ? e : e + "";
};
var f0t = da;
var Q0t = ZU;
var m0t = WU;
var rT = T0;
var FI = XU;
var g0t = TypeError;
var Ib = Object.defineProperty;
var y0t = Object.getOwnPropertyDescriptor;
var Pb = "enumerable";
var Vb = "configurable";
var Rb = "writable";
b3.f = f0t ? m0t ? function(t10, e, r) {
if (rT(t10), e = FI(e), rT(r), typeof t10 == "function" && e === "prototype" && "value" in r && Rb in r && !r[Rb]) {
var n = y0t(t10, e);
n && n[Rb] && (t10[e] = r.value, r = {
configurable: Vb in r ? r[Vb] : n[Vb],
enumerable: Pb in r ? r[Pb] : n[Pb],
writable: false
});
}
return Ib(t10, e, r);
} : Ib : function(t10, e, r) {
if (rT(t10), e = FI(e), rT(r), Q0t)
try {
return Ib(t10, e, r);
} catch {
}
if ("get" in r || "set" in r)
throw new g0t("Accessors not supported");
return "value" in r && (t10[e] = r.value), t10;
};
var v0t = Math.ceil;
var _0t = Math.floor;
var b0t = Math.trunc || function(t10) {
var e = +t10;
return (e > 0 ? _0t : v0t)(e);
};
var L0t = b0t;
var kg = function(t10) {
var e = +t10;
return e !== e || e === 0 ? 0 : L0t(e);
};
var w0t = kg;
var x0t = Math.max;
var E0t = Math.min;
var M0t = function(t10, e) {
var r = w0t(t10);
return r < 0 ? x0t(r + e, 0) : E0t(r, e);
};
var S0t = kg;
var H0t = Math.min;
var A0t = function(t10) {
var e = S0t(t10);
return e > 0 ? H0t(e, 9007199254740991) : 0;
};
var O0t = A0t;
var KU = function(t10) {
return O0t(t10.length);
};
var C0t = rc;
var k0t = M0t;
var I0t = KU;
var BI = function(t10) {
return function(e, r, n) {
var i = C0t(e), o = I0t(i);
if (o === 0)
return !t10 && -1;
var s = k0t(n, o), a;
if (t10 && r !== r) {
for (; o > s; )
if (a = i[s++], a !== a)
return true;
} else
for (; o > s; s++)
if ((t10 || s in i) && i[s] === r)
return t10 || s || 0;
return !t10 && -1;
};
};
var P0t = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: BI(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: BI(false)
};
var Ig = {};
var V0t = oo;
var Nb = _3;
var R0t = rc;
var N0t = P0t.indexOf;
var D0t = Ig;
var jI = V0t([].push);
var YU = function(t10, e) {
var r = R0t(t10), n = 0, i = [], o;
for (o in r)
!Nb(D0t, o) && Nb(r, o) && jI(i, o);
for (; e.length > n; )
Nb(r, o = e[n++]) && (~N0t(i, o) || jI(i, o));
return i;
};
var NS = [
"constructor",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"toString",
"valueOf"
];
var F0t = YU;
var B0t = NS;
var j0t = Object.keys || function(t10) {
return F0t(t10, B0t);
};
var z0t = da;
var U0t = WU;
var G0t = b3;
var $0t = T0;
var W0t = rc;
var Z0t = j0t;
$U.f = z0t && !U0t ? Object.defineProperties : function(t10, e) {
$0t(t10);
for (var r = W0t(e), n = Z0t(e), i = n.length, o = 0, s; i > o; )
G0t.f(t10, s = n[o++], r[s]);
return t10;
};
var q0t = gd;
var X0t = q0t("document", "documentElement");
var K0t = BU;
var Y0t = kS;
var zI = K0t("keys");
var DS = function(t10) {
return zI[t10] || (zI[t10] = Y0t(t10));
};
var J0t = T0;
var t5t = $U;
var UI2 = NS;
var e5t = Ig;
var r5t = X0t;
var n5t = IS;
var i5t = DS;
var GI2 = ">";
var $I = "<";
var Ex = "prototype";
var Mx = "script";
var JU = i5t("IE_PROTO");
var Db = function() {
};
var tG = function(t10) {
return $I + Mx + GI2 + t10 + $I + "/" + Mx + GI2;
};
var WI = function(t10) {
t10.write(tG("")), t10.close();
var e = t10.parentWindow.Object;
return t10 = null, e;
};
var o5t = function() {
var t10 = n5t("iframe"), e = "java" + Mx + ":", r;
return t10.style.display = "none", r5t.appendChild(t10), t10.src = String(e), r = t10.contentWindow.document, r.open(), r.write(tG("document.F=Object")), r.close(), r.F;
};
var nT;
var gf = function() {
try {
nT = new ActiveXObject("htmlfile");
} catch {
}
gf = typeof document < "u" ? document.domain && nT ? WI(nT) : o5t() : WI(nT);
for (var t10 = UI2.length; t10--; )
delete gf[Ex][UI2[t10]];
return gf();
};
e5t[JU] = true;
var FS = Object.create || function(t10, e) {
var r;
return t10 !== null ? (Db[Ex] = J0t(t10), r = new Db(), Db[Ex] = null, r[JU] = t10) : r = gf(), e === void 0 ? r : t5t.f(r, e);
};
var s5t = Ns;
var a5t = FS;
var l5t = b3.f;
var Sx = s5t("unscopables");
var Hx = Array.prototype;
Hx[Sx] === void 0 && l5t(Hx, Sx, {
configurable: true,
value: a5t(null)
});
var c5t = function(t10) {
Hx[Sx][t10] = true;
};
var vd = {};
var u5t = J2;
var h5t = Mo;
var ZI = u5t.WeakMap;
var d5t = h5t(ZI) && /native code/.test(String(ZI));
var BS = function(t10, e) {
return {
enumerable: !(t10 & 1),
configurable: !(t10 & 2),
writable: !(t10 & 4),
value: e
};
};
var p5t = da;
var T5t = b3;
var f5t = BS;
var Pg = p5t ? function(t10, e, r) {
return T5t.f(t10, e, f5t(1, r));
} : function(t10, e, r) {
return t10[e] = r, t10;
};
var Q5t = d5t;
var eG = J2;
var m5t = Ds;
var g5t = Pg;
var Fb = _3;
var Bb = CS;
var y5t = DS;
var v5t = Ig;
var qI2 = "Object already initialized";
var Ax = eG.TypeError;
var _5t = eG.WeakMap;
var zQ;
var jh;
var UQ;
var b5t = function(t10) {
return UQ(t10) ? jh(t10) : zQ(t10, {});
};
var L5t = function(t10) {
return function(e) {
var r;
if (!m5t(e) || (r = jh(e)).type !== t10)
throw new Ax("Incompatible receiver, " + t10 + " required");
return r;
};
};
if (Q5t || Bb.state) {
Ca = Bb.state || (Bb.state = new _5t());
Ca.get = Ca.get, Ca.has = Ca.has, Ca.set = Ca.set, zQ = function(t10, e) {
if (Ca.has(t10))
throw new Ax(qI2);
return e.facade = t10, Ca.set(t10, e), e;
}, jh = function(t10) {
return Ca.get(t10) || {};
}, UQ = function(t10) {
return Ca.has(t10);
};
} else {
Yl = y5t("state");
v5t[Yl] = true, zQ = function(t10, e) {
if (Fb(t10, Yl))
throw new Ax(qI2);
return e.facade = t10, g5t(t10, Yl, e), e;
}, jh = function(t10) {
return Fb(t10, Yl) ? t10[Yl] : {};
}, UQ = function(t10) {
return Fb(t10, Yl);
};
}
var Ca;
var Yl;
var Vg = {
set: zQ,
get: jh,
has: UQ,
enforce: b5t,
getterFor: L5t
};
var jS = {};
var rG = {};
var nG = {}.propertyIsEnumerable;
var iG = Object.getOwnPropertyDescriptor;
var w5t = iG && !nG.call({ 1: 2 }, 1);
rG.f = w5t ? function(t10) {
var e = iG(this, t10);
return !!e && e.enumerable;
} : nG;
var x5t = da;
var E5t = I4;
var M5t = rG;
var S5t = BS;
var H5t = rc;
var A5t = XU;
var O5t = _3;
var C5t = ZU;
var XI = Object.getOwnPropertyDescriptor;
jS.f = x5t ? XI : function(t10, e) {
if (t10 = H5t(t10), e = A5t(e), C5t)
try {
return XI(t10, e);
} catch {
}
if (O5t(t10, e))
return S5t(!E5t(M5t.f, t10, e), t10[e]);
};
var oG = { exports: {} };
var Ox = da;
var k5t = _3;
var sG = Function.prototype;
var I5t = Ox && Object.getOwnPropertyDescriptor;
var zS = k5t(sG, "name");
var P5t = zS && (function() {
}).name === "something";
var V5t = zS && (!Ox || Ox && I5t(sG, "name").configurable);
var aG = {
EXISTS: zS,
PROPER: P5t,
CONFIGURABLE: V5t
};
var R5t = oo;
var N5t = Mo;
var Cx = CS;
var D5t = R5t(Function.toString);
N5t(Cx.inspectSource) || (Cx.inspectSource = function(t10) {
return D5t(t10);
});
var F5t = Cx.inspectSource;
var US = oo;
var B5t = qo;
var j5t = Mo;
var iT = _3;
var kx = da;
var z5t = aG.CONFIGURABLE;
var U5t = F5t;
var lG = Vg;
var G5t = lG.enforce;
var $5t = lG.get;
var KI = String;
var yf = Object.defineProperty;
var W5t = US("".slice);
var Z5t = US("".replace);
var q5t = US([].join);
var X5t = kx && !B5t(function() {
return yf(function() {
}, "length", { value: 8 }).length !== 8;
});
var K5t = String(String).split("String");
var Y5t = oG.exports = function(t10, e, r) {
W5t(KI(e), 0, 7) === "Symbol(" && (e = "[" + Z5t(KI(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), r && r.getter && (e = "get " + e), r && r.setter && (e = "set " + e), (!iT(t10, "name") || z5t && t10.name !== e) && (kx ? yf(t10, "name", { value: e, configurable: true }) : t10.name = e), X5t && r && iT(r, "arity") && t10.length !== r.arity && yf(t10, "length", { value: r.arity });
try {
r && iT(r, "constructor") && r.constructor ? kx && yf(t10, "prototype", { writable: false }) : t10.prototype && (t10.prototype = void 0);
} catch {
}
var n = G5t(t10);
return iT(n, "source") || (n.source = q5t(K5t, typeof e == "string" ? e : "")), t10;
};
Function.prototype.toString = Y5t(function() {
return j5t(this) && $5t(this).source || U5t(this);
}, "toString");
var cG = oG.exports;
var J5t = Mo;
var tlt = b3;
var elt = cG;
var rlt = OS;
var nc = function(t10, e, r, n) {
n || (n = {});
var i = n.enumerable, o = n.name !== void 0 ? n.name : e;
if (J5t(r) && elt(r, o, n), n.global)
i ? t10[e] = r : rlt(e, r);
else {
try {
n.unsafe ? t10[e] && (i = true) : delete t10[e];
} catch {
}
i ? t10[e] = r : tlt.f(t10, e, {
value: r,
enumerable: false,
configurable: !n.nonConfigurable,
writable: !n.nonWritable
});
}
return t10;
};
var Rg = {};
var nlt = YU;
var ilt = NS;
var olt = ilt.concat("length", "prototype");
Rg.f = Object.getOwnPropertyNames || function(t10) {
return nlt(t10, olt);
};
var uG = {};
uG.f = Object.getOwnPropertySymbols;
var slt = gd;
var alt = oo;
var llt = Rg;
var clt = uG;
var ult = T0;
var hlt = alt([].concat);
var dlt = slt("Reflect", "ownKeys") || function(t10) {
var e = llt.f(ult(t10)), r = clt.f;
return r ? hlt(e, r(t10)) : e;
};
var YI = _3;
var plt = dlt;
var Tlt = jS;
var flt = b3;
var Qlt = function(t10, e, r) {
for (var n = plt(e), i = flt.f, o = Tlt.f, s = 0; s < n.length; s++) {
var a = n[s];
!YI(t10, a) && !(r && YI(r, a)) && i(t10, a, o(e, a));
}
};
var mlt = qo;
var glt = Mo;
var ylt = /#|\.prototype\./;
var _d = function(t10, e) {
var r = _lt[vlt(t10)];
return r === Llt ? true : r === blt ? false : glt(e) ? mlt(e) : !!e;
};
var vlt = _d.normalize = function(t10) {
return String(t10).replace(ylt, ".").toLowerCase();
};
var _lt = _d.data = {};
var blt = _d.NATIVE = "N";
var Llt = _d.POLYFILL = "P";
var hG = _d;
var oT = J2;
var wlt = jS.f;
var xlt = Pg;
var Elt = nc;
var Mlt = OS;
var Slt = Qlt;
var Hlt = hG;
var L3 = function(t10, e) {
var r = t10.target, n = t10.global, i = t10.stat, o, s, a, u, d, T;
if (n ? s = oT : i ? s = oT[r] || Mlt(r, {}) : s = oT[r] && oT[r].prototype, s)
for (a in e) {
if (d = e[a], t10.dontCallGetSet ? (T = wlt(s, a), u = T && T.value) : u = s[a], o = Hlt(n ? a : r + (i ? "." : "#") + a, t10.forced), !o && u !== void 0) {
if (typeof d == typeof u)
continue;
Slt(d, u);
}
(t10.sham || u && u.sham) && xlt(d, "sham", true), Elt(s, a, d, t10);
}
};
var Alt = qo;
var Olt = !Alt(function() {
function t10() {
}
return t10.prototype.constructor = null, Object.getPrototypeOf(new t10()) !== t10.prototype;
});
var Clt = _3;
var klt = Mo;
var Ilt = jU;
var Plt = DS;
var Vlt = Olt;
var JI = Plt("IE_PROTO");
var Ix = Object;
var Rlt = Ix.prototype;
var dG = Vlt ? Ix.getPrototypeOf : function(t10) {
var e = Ilt(t10);
if (Clt(e, JI))
return e[JI];
var r = e.constructor;
return klt(r) && e instanceof r ? r.prototype : e instanceof Ix ? Rlt : null;
};
var Nlt = qo;
var Dlt = Mo;
var Flt = Ds;
var tP = dG;
var Blt = nc;
var jlt = Ns;
var Px = jlt("iterator");
var pG = false;
var G5;
var jb;
var zb;
[].keys && (zb = [].keys(), "next" in zb ? (jb = tP(tP(zb)), jb !== Object.prototype && (G5 = jb)) : pG = true);
var zlt = !Flt(G5) || Nlt(function() {
var t10 = {};
return G5[Px].call(t10) !== t10;
});
zlt && (G5 = {});
Dlt(G5[Px]) || Blt(G5, Px, function() {
return this;
});
var TG = {
IteratorPrototype: G5,
BUGGY_SAFARI_ITERATORS: pG
};
var Ult = b3.f;
var Glt = _3;
var $lt = Ns;
var eP = $lt("toStringTag");
var Ng = function(t10, e, r) {
t10 && !r && (t10 = t10.prototype), t10 && !Glt(t10, eP) && Ult(t10, eP, { configurable: true, value: e });
};
var Wlt = TG.IteratorPrototype;
var Zlt = FS;
var qlt = BS;
var Xlt = Ng;
var Klt = vd;
var Ylt = function() {
return this;
};
var Jlt = function(t10, e, r, n) {
var i = e + " Iterator";
return t10.prototype = Zlt(Wlt, { next: qlt(+!n, r) }), Xlt(t10, i, false), Klt[i] = Ylt, t10;
};
var t7t = oo;
var e7t = yd;
var fG = function(t10, e, r) {
try {
return t7t(e7t(Object.getOwnPropertyDescriptor(t10, e)[r]));
} catch {
}
};
var r7t = Ds;
var n7t = function(t10) {
return r7t(t10) || t10 === null;
};
var i7t = n7t;
var o7t = String;
var s7t = TypeError;
var a7t = function(t10) {
if (i7t(t10))
return t10;
throw new s7t("Can't set " + o7t(t10) + " as a prototype");
};
var l7t = fG;
var c7t = Ds;
var u7t = Cg;
var h7t = a7t;
var QG = Object.setPrototypeOf || ("__proto__" in {} ? function() {
var t10 = false, e = {}, r;
try {
r = l7t(Object.prototype, "__proto__", "set"), r(e, []), t10 = e instanceof Array;
} catch {
}
return function(n, i) {
return u7t(n), h7t(i), c7t(n) && (t10 ? r(n, i) : n.__proto__ = i), n;
};
}() : void 0);
var d7t = L3;
var p7t = I4;
var mG = aG;
var T7t = Mo;
var f7t = Jlt;
var rP = dG;
var nP = QG;
var Q7t = Ng;
var m7t = Pg;
var Ub = nc;
var g7t = Ns;
var y7t = vd;
var gG = TG;
var v7t = mG.PROPER;
var _7t = mG.CONFIGURABLE;
var iP = gG.IteratorPrototype;
var sT = gG.BUGGY_SAFARI_ITERATORS;
var du = g7t("iterator");
var oP = "keys";
var pu = "values";
var sP = "entries";
var b7t = function() {
return this;
};
var GS = function(t10, e, r, n, i, o, s) {
f7t(r, e, n);
var a = function(x) {
if (x === i && Q)
return Q;
if (!sT && x && x in T)
return T[x];
switch (x) {
case oP:
return function() {
return new r(this, x);
};
case pu:
return function() {
return new r(this, x);
};
case sP:
return function() {
return new r(this, x);
};
}
return function() {
return new r(this);
};
}, u = e + " Iterator", d = false, T = t10.prototype, f = T[du] || T["@@iterator"] || i && T[i], Q = !sT && f || a(i), y = e === "Array" && T.entries || f, _, L, E;
if (y && (_ = rP(y.call(new t10())), _ !== Object.prototype && _.next && (rP(_) !== iP && (nP ? nP(_, iP) : T7t(_[du]) || Ub(_, du, b7t)), Q7t(_, u, true))), v7t && i === pu && f && f.name !== pu && (_7t ? m7t(T, "name", pu) : (d = true, Q = function() {
return p7t(f, this);
})), i)
if (L = {
values: a(pu),
keys: o ? Q : a(oP),
entries: a(sP)
}, s)
for (E in L)
(sT || d || !(E in T)) && Ub(T, E, L[E]);
else
d7t({ target: e, proto: true, forced: sT || d }, L);
return T[du] !== Q && Ub(T, du, Q, { name: i }), y7t[e] = Q, L;
};
var $S = function(t10, e) {
return { value: t10, done: e };
};
var L7t = rc;
var WS = c5t;
var aP = vd;
var yG = Vg;
var w7t = b3.f;
var x7t = GS;
var aT = $S;
var E7t = da;
var vG = "Array Iterator";
var M7t = yG.set;
var S7t = yG.getterFor(vG);
var H7t = x7t(Array, "Array", function(t10, e) {
M7t(this, {
type: vG,
target: L7t(t10),
// target
index: 0,
// next index
kind: e
// kind
});
}, function() {
var t10 = S7t(this), e = t10.target, r = t10.index++;
if (!e || r >= e.length)
return t10.target = void 0, aT(void 0, true);
switch (t10.kind) {
case "keys":
return aT(r, false);
case "values":
return aT(e[r], false);
}
return aT([r, e[r]], false);
}, "values");
var lP = aP.Arguments = aP.Array;
WS("keys");
WS("values");
WS("entries");
if (E7t && lP.name !== "values")
try {
w7t(lP, "name", { value: "values" });
} catch {
}
var A7t = Ns;
var O7t = A7t("toStringTag");
var _G = {};
_G[O7t] = "z";
var ZS = String(_G) === "[object z]";
var C7t = ZS;
var k7t = Mo;
var vf = Qd;
var I7t = Ns;
var P7t = I7t("toStringTag");
var V7t = Object;
var R7t = vf(/* @__PURE__ */ function() {
return arguments;
}()) === "Arguments";
var N7t = function(t10, e) {
try {
return t10[e];
} catch {
}
};
var qS = C7t ? vf : function(t10) {
var e, r, n;
return t10 === void 0 ? "Undefined" : t10 === null ? "Null" : typeof (r = N7t(e = V7t(t10), P7t)) == "string" ? r : R7t ? vf(e) : (n = vf(e)) === "Object" && k7t(e.callee) ? "Arguments" : n;
};
var D7t = ZS;
var F7t = qS;
var B7t = D7t ? {}.toString : function() {
return "[object " + F7t(this) + "]";
};
var j7t = ZS;
var z7t = nc;
var U7t = B7t;
j7t || z7t(Object.prototype, "toString", U7t, { unsafe: true });
var bG = { exports: {} };
var LG = {};
var G7t = oo;
var $7t = G7t([].slice);
var W7t = Qd;
var Z7t = rc;
var wG = Rg.f;
var q7t = $7t;
var xG = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
var X7t = function(t10) {
try {
return wG(t10);
} catch {
return q7t(xG);
}
};
LG.f = function(t10) {
return xG && W7t(t10) === "Window" ? X7t(t10) : wG(Z7t(t10));
};
var K7t = qo;
var Y7t = K7t(function() {
if (typeof ArrayBuffer == "function") {
var t10 = new ArrayBuffer(8);
Object.isExtensible(t10) && Object.defineProperty(t10, "a", { value: 8 });
}
});
var J7t = qo;
var t8t = Ds;
var e8t = Qd;
var cP = Y7t;
var _f = Object.isExtensible;
var r8t = J7t(function() {
_f(1);
});
var n8t = r8t || cP ? function(t10) {
return !t8t(t10) || cP && e8t(t10) === "ArrayBuffer" ? false : _f ? _f(t10) : true;
} : _f;
var i8t = qo;
var o8t = !i8t(function() {
return Object.isExtensible(Object.preventExtensions({}));
});
var s8t = L3;
var a8t = oo;
var l8t = Ig;
var c8t = Ds;
var XS = _3;
var u8t = b3.f;
var uP = Rg;
var h8t = LG;
var KS = n8t;
var d8t = kS;
var p8t = o8t;
var EG = false;
var A4 = d8t("meta");
var T8t = 0;
var YS = function(t10) {
u8t(t10, A4, { value: {
objectID: "O" + T8t++,
// object ID
weakData: {}
// weak collections IDs
} });
};
var f8t = function(t10, e) {
if (!c8t(t10))
return typeof t10 == "symbol" ? t10 : (typeof t10 == "string" ? "S" : "P") + t10;
if (!XS(t10, A4)) {
if (!KS(t10))
return "F";
if (!e)
return "E";
YS(t10);
}
return t10[A4].objectID;
};
var Q8t = function(t10, e) {
if (!XS(t10, A4)) {
if (!KS(t10))
return true;
if (!e)
return false;
YS(t10);
}
return t10[A4].weakData;
};
var m8t = function(t10) {
return p8t && EG && KS(t10) && !XS(t10, A4) && YS(t10), t10;
};
var g8t = function() {
y8t.enable = function() {
}, EG = true;
var t10 = uP.f, e = a8t([].splice), r = {};
r[A4] = 1, t10(r).length && (uP.f = function(n) {
for (var i = t10(n), o = 0, s = i.length; o < s; o++)
if (i[o] === A4) {
e(i, o, 1);
break;
}
return i;
}, s8t({ target: "Object", stat: true, forced: true }, {
getOwnPropertyNames: h8t.f
}));
};
var y8t = bG.exports = {
enable: g8t,
fastKey: f8t,
getWeakData: Q8t,
onFreeze: m8t
};
l8t[A4] = true;
var MG = bG.exports;
var v8t = Qd;
var _8t = oo;
var b8t = function(t10) {
if (v8t(t10) === "Function")
return _8t(t10);
};
var hP = b8t;
var L8t = yd;
var w8t = AS;
var x8t = hP(hP.bind);
var SG = function(t10, e) {
return L8t(t10), e === void 0 ? t10 : w8t ? x8t(t10, e) : function() {
return t10.apply(e, arguments);
};
};
var E8t = Ns;
var M8t = vd;
var S8t = E8t("iterator");
var H8t = Array.prototype;
var A8t = function(t10) {
return t10 !== void 0 && (M8t.Array === t10 || H8t[S8t] === t10);
};
var O8t = qS;
var dP = RS;
var C8t = md;
var k8t = vd;
var I8t = Ns;
var P8t = I8t("iterator");
var HG = function(t10) {
if (!C8t(t10))
return dP(t10, P8t) || dP(t10, "@@iterator") || k8t[O8t(t10)];
};
var V8t = I4;
var R8t = yd;
var N8t = T0;
var D8t = VS;
var F8t = HG;
var B8t = TypeError;
var j8t = function(t10, e) {
var r = arguments.length < 2 ? F8t(t10) : e;
if (R8t(r))
return N8t(V8t(r, t10));
throw new B8t(D8t(t10) + " is not iterable");
};
var z8t = I4;
var pP = T0;
var U8t = RS;
var JS = function(t10, e, r) {
var n, i;
pP(t10);
try {
if (n = U8t(t10, "return"), !n) {
if (e === "throw")
throw r;
return r;
}
n = z8t(n, t10);
} catch (o) {
i = true, n = o;
}
if (e === "throw")
throw r;
if (i)
throw n;
return pP(n), r;
};
var G8t = SG;
var $8t = I4;
var W8t = T0;
var Z8t = VS;
var q8t = A8t;
var X8t = KU;
var TP = PS;
var K8t = j8t;
var Y8t = HG;
var fP = JS;
var J8t = TypeError;
var bf = function(t10, e) {
this.stopped = t10, this.result = e;
};
var QP = bf.prototype;
var AG = function(t10, 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 = G8t(e, n), d, T, f, Q, y, _, L, E = function(O) {
return d && fP(d, "normal", O), new bf(true, O);
}, x = function(O) {
return i ? (W8t(O), a ? u(O[0], O[1], E) : u(O[0], O[1])) : a ? u(O, E) : u(O);
};
if (o)
d = t10.iterator;
else if (s)
d = t10;
else {
if (T = Y8t(t10), !T)
throw new J8t(Z8t(t10) + " is not iterable");
if (q8t(T)) {
for (f = 0, Q = X8t(t10); Q > f; f++)
if (y = x(t10[f]), y && TP(QP, y))
return y;
return new bf(false);
}
d = K8t(t10, T);
}
for (_ = o ? t10.next : d.next; !(L = $8t(_, d)).done; ) {
try {
y = x(L.value);
} catch (O) {
fP(d, "throw", O);
}
if (typeof y == "object" && y && TP(QP, y))
return y;
}
return new bf(false);
};
var tct = PS;
var ect = TypeError;
var OG = function(t10, e) {
if (tct(e, t10))
return t10;
throw new ect("Incorrect invocation");
};
var rct = Ns;
var CG = rct("iterator");
var kG = false;
try {
nct = 0, mP = {
next: function() {
return { done: !!nct++ };
},
return: function() {
kG = true;
}
};
mP[CG] = function() {
return this;
}, Array.from(mP, function() {
throw 2;
});
} catch {
}
var nct;
var mP;
var ict = function(t10, e) {
try {
if (!e && !kG)
return false;
} catch {
return false;
}
var r = false;
try {
var n = {};
n[CG] = function() {
return {
next: function() {
return { done: r = true };
}
};
}, t10(n);
} catch {
}
return r;
};
var oct = Mo;
var sct = Ds;
var gP = QG;
var act = function(t10, e, r) {
var n, i;
return (
// it can work only with native `setPrototypeOf`
gP && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
oct(n = e.constructor) && n !== r && sct(i = n.prototype) && i !== r.prototype && gP(t10, i), t10
);
};
var lct = L3;
var cct = J2;
var uct = oo;
var yP = hG;
var hct = nc;
var dct = MG;
var pct = AG;
var Tct = OG;
var fct = Mo;
var Qct = md;
var Gb = Ds;
var $b = qo;
var mct = ict;
var gct = Ng;
var yct = act;
var vct = function(t10, e, r) {
var n = t10.indexOf("Map") !== -1, i = t10.indexOf("Weak") !== -1, o = n ? "set" : "add", s = cct[t10], a = s && s.prototype, u = s, d = {}, T = function(x) {
var O = uct(a[x]);
hct(
a,
x,
x === "add" ? function(k) {
return O(this, k === 0 ? 0 : k), this;
} : x === "delete" ? function(k) {
return i && !Gb(k) ? false : O(this, k === 0 ? 0 : k);
} : x === "get" ? function(k) {
return i && !Gb(k) ? void 0 : O(this, k === 0 ? 0 : k);
} : x === "has" ? function(k) {
return i && !Gb(k) ? false : O(this, k === 0 ? 0 : k);
} : function(k, R) {
return O(this, k === 0 ? 0 : k, R), this;
}
);
}, f = yP(
t10,
!fct(s) || !(i || a.forEach && !$b(function() {
new s().entries().next();
}))
);
if (f)
u = r.getConstructor(e, t10, n, o), dct.enable();
else if (yP(t10, true)) {
var Q = new u(), y = Q[o](i ? {} : -0, 1) !== Q, _ = $b(function() {
Q.has(1);
}), L = mct(function(x) {
new s(x);
}), E = !i && $b(function() {
for (var x = new s(), O = 5; O--; )
x[o](O, O);
return !x.has(-0);
});
L || (u = e(function(x, O) {
Tct(x, a);
var k = yct(new s(), x, u);
return Qct(O) || pct(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[t10] = u, lct({ global: true, constructor: true, forced: u !== s }, d), gct(u, t10), i || r.setStrong(u, t10, n), u;
};
var vP = cG;
var _ct = b3;
var IG = function(t10, e, r) {
return r.get && vP(r.get, e, { getter: true }), r.set && vP(r.set, e, { setter: true }), _ct.f(t10, e, r);
};
var bct = nc;
var Lct = function(t10, e, r) {
for (var n in e)
bct(t10, n, e[n], r);
return t10;
};
var wct = gd;
var xct = IG;
var Ect = Ns;
var Mct = da;
var _P = Ect("species");
var Sct = function(t10) {
var e = wct(t10);
Mct && e && !e[_P] && xct(e, _P, {
configurable: true,
get: function() {
return this;
}
});
};
var bP = FS;
var Hct = IG;
var LP = Lct;
var Act = SG;
var Oct = OG;
var Cct = md;
var kct = AG;
var Ict = GS;
var wP = $S;
var Pct = Sct;
var Tu = da;
var xP = MG.fastKey;
var PG = Vg;
var EP = PG.set;
var Wb = PG.getterFor;
var Vct = {
getConstructor: function(t10, e, r, n) {
var i = t10(function(d, T) {
Oct(d, o), EP(d, {
type: e,
index: bP(null),
first: void 0,
last: void 0,
size: 0
}), Tu || (d.size = 0), Cct(T) || kct(T, d[n], { that: d, AS_ENTRIES: r });
}), o = i.prototype, s = Wb(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 = xP(T, true),
key: T,
value: f,
previous: _ = Q.last,
next: void 0,
removed: false
}, Q.first || (Q.first = y), _ && (_.next = y), Tu ? Q.size++ : d.size++, L !== "F" && (Q.index[L] = y)), d;
}, u = function(d, T) {
var f = s(d), Q = xP(T), y;
if (Q !== "F")
return f.index[Q];
for (y = f.first; y; y = y.next)
if (y.key === T)
return y;
};
return LP(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 = true, f.previous && (f.previous = f.previous.next = void 0), f = f.next;
T.first = T.last = void 0, T.index = bP(null), Tu ? 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 = true, _ && (_.next = y), y && (y.previous = _), f.first === Q && (f.first = y), f.last === Q && (f.last = _), Tu ? 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 = Act(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);
}
}), LP(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);
}
}), Tu && Hct(o, "size", {
configurable: true,
get: function() {
return s(this).size;
}
}), i;
},
setStrong: function(t10, e, r) {
var n = e + " Iterator", i = Wb(e), o = Wb(n);
Ict(t10, e, function(s, a) {
EP(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, wP(void 0, true)) : wP(a === "keys" ? u.key : a === "values" ? u.value : [u.key, u.value], false);
}, r ? "entries" : "values", !r, true), Pct(e);
}
};
var Rct = vct;
var Nct = Vct;
Rct("Set", function(t10) {
return function() {
return t10(this, arguments.length ? arguments[0] : void 0);
};
}, Nct);
var Zb = oo;
var lT = Set.prototype;
var w3 = {
// eslint-disable-next-line es/no-set -- safe
Set,
add: Zb(lT.add),
has: Zb(lT.has),
remove: Zb(lT.delete),
proto: lT
};
var Dct = w3.has;
var al = function(t10) {
return Dct(t10), t10;
};
var Fct = I4;
var ll = function(t10, e, r) {
for (var n = r ? t10 : t10.iterator, i = t10.next, o, s; !(o = Fct(i, n)).done; )
if (s = e(o.value), s !== void 0)
return s;
};
var VG = oo;
var Bct = ll;
var RG = w3;
var jct = RG.Set;
var NG = RG.proto;
var zct = VG(NG.forEach);
var DG = VG(NG.keys);
var Uct = DG(new jct()).next;
var bd = function(t10, e, r) {
return r ? Bct({ iterator: DG(t10), next: Uct }, e) : zct(t10, e);
};
var FG = w3;
var Gct = bd;
var $ct = FG.Set;
var Wct = FG.add;
var tH = function(t10) {
var e = new $ct();
return Gct(t10, function(r) {
Wct(e, r);
}), e;
};
var Zct = fG;
var qct = w3;
var Ld = Zct(qct.proto, "size", "get") || function(t10) {
return t10.size;
};
var Xct = function(t10) {
return {
iterator: t10,
next: t10.next,
done: false
};
};
var MP = yd;
var BG = T0;
var SP = I4;
var Kct = kg;
var Yct = Xct;
var HP = "Invalid size";
var Jct = RangeError;
var tut = TypeError;
var eut = Math.max;
var jG = function(t10, e) {
this.set = t10, this.size = eut(e, 0), this.has = MP(t10.has), this.keys = MP(t10.keys);
};
jG.prototype = {
getIterator: function() {
return Yct(BG(SP(this.keys, this.set)));
},
includes: function(t10) {
return SP(this.has, this.set, t10);
}
};
var cl = function(t10) {
BG(t10);
var e = +t10.size;
if (e !== e)
throw new tut(HP);
var r = Kct(e);
if (r < 0)
throw new Jct(HP);
return new jG(t10, r);
};
var rut = al;
var zG = w3;
var nut = tH;
var iut = Ld;
var out = cl;
var sut = bd;
var aut = ll;
var lut = zG.has;
var AP = zG.remove;
var cut = function(t10) {
var e = rut(this), r = out(t10), n = nut(e);
return iut(e) <= r.size ? sut(e, function(i) {
r.includes(i) && AP(n, i);
}) : aut(r.getIterator(), function(i) {
lut(e, i) && AP(n, i);
}), n;
};
var uut = gd;
var OP = function(t10) {
return {
size: t10,
has: function() {
return false;
},
keys: function() {
return {
next: function() {
return { done: true };
}
};
}
};
};
var ul = function(t10) {
var e = uut("Set");
try {
new e()[t10](OP(0));
try {
return new e()[t10](OP(-1)), false;
} catch {
return true;
}
} catch {
return false;
}
};
var hut = L3;
var dut = cut;
var put = ul;
hut({ target: "Set", proto: true, real: true, forced: !put("difference") }, {
difference: dut
});
var Tut = al;
var eH = w3;
var fut = Ld;
var Qut = cl;
var mut = bd;
var gut = ll;
var yut = eH.Set;
var CP = eH.add;
var vut = eH.has;
var _ut = function(t10) {
var e = Tut(this), r = Qut(t10), n = new yut();
return fut(e) > r.size ? gut(r.getIterator(), function(i) {
vut(e, i) && CP(n, i);
}) : mut(e, function(i) {
r.includes(i) && CP(n, i);
}), n;
};
var but = L3;
var Lut = qo;
var wut = _ut;
var xut = ul;
var Eut = !xut("intersection") || Lut(function() {
return String(Array.from((/* @__PURE__ */ new Set([1, 2, 3])).intersection(/* @__PURE__ */ new Set([3, 2])))) !== "3,2";
});
but({ target: "Set", proto: true, real: true, forced: Eut }, {
intersection: wut
});
var Mut = al;
var Sut = w3.has;
var Hut = Ld;
var Aut = cl;
var Out = bd;
var Cut = ll;
var kut = JS;
var Iut = function(t10) {
var e = Mut(this), r = Aut(t10);
if (Hut(e) <= r.size)
return Out(e, function(i) {
if (r.includes(i))
return false;
}, true) !== false;
var n = r.getIterator();
return Cut(n, function(i) {
if (Sut(e, i))
return kut(n, "normal", false);
}) !== false;
};
var Put = L3;
var Vut = Iut;
var Rut = ul;
Put({ target: "Set", proto: true, real: true, forced: !Rut("isDisjointFrom") }, {
isDisjointFrom: Vut
});
var Nut = al;
var Dut = Ld;
var Fut = bd;
var But = cl;
var jut = function(t10) {
var e = Nut(this), r = But(t10);
return Dut(e) > r.size ? false : Fut(e, function(n) {
if (!r.includes(n))
return false;
}, true) !== false;
};
var zut = L3;
var Uut = jut;
var Gut = ul;
zut({ target: "Set", proto: true, real: true, forced: !Gut("isSubsetOf") }, {
isSubsetOf: Uut
});
var $ut = al;
var Wut = w3.has;
var Zut = Ld;
var qut = cl;
var Xut = ll;
var Kut = JS;
var Yut = function(t10) {
var e = $ut(this), r = qut(t10);
if (Zut(e) < r.size)
return false;
var n = r.getIterator();
return Xut(n, function(i) {
if (!Wut(e, i))
return Kut(n, "normal", false);
}) !== false;
};
var Jut = L3;
var t9t = Yut;
var e9t = ul;
Jut({ target: "Set", proto: true, real: true, forced: !e9t("isSupersetOf") }, {
isSupersetOf: t9t
});
var r9t = al;
var rH = w3;
var n9t = tH;
var i9t = cl;
var o9t = ll;
var s9t = rH.add;
var a9t = rH.has;
var l9t = rH.remove;
var c9t = function(t10) {
var e = r9t(this), r = i9t(t10).getIterator(), n = n9t(e);
return o9t(r, function(i) {
a9t(e, i) ? l9t(n, i) : s9t(n, i);
}), n;
};
var u9t = L3;
var h9t = c9t;
var d9t = ul;
u9t({ target: "Set", proto: true, real: true, forced: !d9t("symmetricDifference") }, {
symmetricDifference: h9t
});
var p9t = al;
var T9t = w3.add;
var f9t = tH;
var Q9t = cl;
var m9t = ll;
var g9t = function(t10) {
var e = p9t(this), r = Q9t(t10).getIterator(), n = f9t(e);
return m9t(r, function(i) {
T9t(n, i);
}), n;
};
var y9t = L3;
var v9t = g9t;
var _9t = ul;
y9t({ target: "Set", proto: true, real: true, forced: !_9t("union") }, {
union: v9t
});
var b9t = qS;
var L9t = String;
var UG = function(t10) {
if (b9t(t10) === "Symbol")
throw new TypeError("Cannot convert a Symbol value to a string");
return L9t(t10);
};
var nH = oo;
var w9t = kg;
var x9t = UG;
var E9t = Cg;
var M9t = nH("".charAt);
var kP = nH("".charCodeAt);
var S9t = nH("".slice);
var IP = function(t10) {
return function(e, r) {
var n = x9t(E9t(e)), i = w9t(r), o = n.length, s, a;
return i < 0 || i >= o ? t10 ? "" : void 0 : (s = kP(n, i), s < 55296 || s > 56319 || i + 1 === o || (a = kP(n, i + 1)) < 56320 || a > 57343 ? t10 ? M9t(n, i) : s : t10 ? S9t(n, i, i + 2) : (s - 55296 << 10) + (a - 56320) + 65536);
};
};
var H9t = {
// `String.prototype.codePointAt` method
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
codeAt: IP(false),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: IP(true)
};
var A9t = H9t.charAt;
var O9t = UG;
var GG = Vg;
var C9t = GS;
var PP = $S;
var $G = "String Iterator";
var k9t = GG.set;
var I9t = GG.getterFor($G);
C9t(String, "String", function(t10) {
k9t(this, {
type: $G,
string: O9t(t10),
index: 0
});
}, function() {
var t10 = I9t(this), e = t10.string, r = t10.index, n;
return r >= e.length ? PP(void 0, true) : (n = A9t(e, r), t10.index += n.length, PP(n, false));
});
var P9t = J2;
var V9t = P9t;
var R9t = V9t;
var N9t = R9t.Set;
var D9t = {
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
};
var F9t = IS;
var qb = F9t("span").classList;
var VP = qb && qb.constructor && qb.constructor.prototype;
var B9t = VP === Object.prototype ? void 0 : VP;
var RP = J2;
var WG = D9t;
var j9t = B9t;
var l9 = H7t;
var NP = Pg;
var z9t = Ng;
var U9t = Ns;
var Xb = U9t("iterator");
var Kb = l9.values;
var ZG = function(t10, e) {
if (t10) {
if (t10[Xb] !== Kb)
try {
NP(t10, Xb, Kb);
} catch {
t10[Xb] = Kb;
}
if (z9t(t10, e, true), WG[e]) {
for (var r in l9)
if (t10[r] !== l9[r])
try {
NP(t10, r, l9[r]);
} catch {
t10[r] = l9[r];
}
}
}
};
for (Yb in WG)
ZG(RP[Yb] && RP[Yb].prototype, Yb);
var Yb;
ZG(j9t, "DOMTokenList");
var G9t = N9t;
var $9t = G9t;
var W9t = $9t;
var Z9t = W9t;
var z6 = p0(Z9t);
var qG = { exports: {} };
(function(t10, e) {
(function(r, n) {
t10.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(h10, 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(h10, c || [])).next());
});
}
function u(h10) {
return h10 && h10.__esModule && Object.prototype.hasOwnProperty.call(h10, "default") ? h10.default : h10;
}
typeof SuppressedError == "function" && SuppressedError;
var d = T;
function T(h10, c) {
this.x = h10, this.y = c;
}
T.prototype = { clone: function() {
return new T(this.x, this.y);
}, add: function(h10) {
return this.clone()._add(h10);
}, sub: function(h10) {
return this.clone()._sub(h10);
}, multByPoint: function(h10) {
return this.clone()._multByPoint(h10);
}, divByPoint: function(h10) {
return this.clone()._divByPoint(h10);
}, mult: function(h10) {
return this.clone()._mult(h10);
}, div: function(h10) {
return this.clone()._div(h10);
}, rotate: function(h10) {
return this.clone()._rotate(h10);
}, rotateAround: function(h10, c) {
return this.clone()._rotateAround(h10, c);
}, matMult: function(h10) {
return this.clone()._matMult(h10);
}, 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(h10) {
return this.x === h10.x && this.y === h10.y;
}, dist: function(h10) {
return Math.sqrt(this.distSqr(h10));
}, distSqr: function(h10) {
var c = h10.x - this.x, p = h10.y - this.y;
return c * c + p * p;
}, angle: function() {
return Math.atan2(this.y, this.x);
}, angleTo: function(h10) {
return Math.atan2(this.y - h10.y, this.x - h10.x);
}, angleWith: function(h10) {
return this.angleWithSep(h10.x, h10.y);
}, angleWithSep: function(h10, c) {
return Math.atan2(this.x * c - this.y * h10, this.x * h10 + this.y * c);
}, _matMult: function(h10) {
var c = h10[2] * this.x + h10[3] * this.y;
return this.x = h10[0] * this.x + h10[1] * this.y, this.y = c, this;
}, _add: function(h10) {
return this.x += h10.x, this.y += h10.y, this;
}, _sub: function(h10) {
return this.x -= h10.x, this.y -= h10.y, this;
}, _mult: function(h10) {
return this.x *= h10, this.y *= h10, this;
}, _div: function(h10) {
return this.x /= h10, this.y /= h10, this;
}, _multByPoint: function(h10) {
return this.x *= h10.x, this.y *= h10.y, this;
}, _divByPoint: function(h10) {
return this.x /= h10.x, this.y /= h10.y, this;
}, _unit: function() {
return this._div(this.mag()), this;
}, _perp: function() {
var h10 = this.y;
return this.y = this.x, this.x = -h10, this;
}, _rotate: function(h10) {
var c = Math.cos(h10), p = Math.sin(h10), g = p * this.x + c * this.y;
return this.x = c * this.x - p * this.y, this.y = g, this;
}, _rotateAround: function(h10, c) {
var p = Math.cos(h10), g = Math.sin(h10), 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(h10) {
return h10 instanceof T ? h10 : Array.isArray(h10) ? new T(h10[0], h10[1]) : h10;
};
var f = u(d), Q = y;
function y(h10, c, p, g) {
this.cx = 3 * h10, this.bx = 3 * (p - h10) - 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 = h10, this.p1y = c, this.p2x = p, this.p2y = g;
}
y.prototype = { sampleCurveX: function(h10) {
return ((this.ax * h10 + this.bx) * h10 + this.cx) * h10;
}, sampleCurveY: function(h10) {
return ((this.ay * h10 + this.by) * h10 + this.cy) * h10;
}, sampleCurveDerivativeX: function(h10) {
return (3 * this.ax * h10 + 2 * this.bx) * h10 + this.cx;
}, solveCurveX: function(h10, c) {
if (c === void 0 && (c = 1e-6), h10 < 0)
return 0;
if (h10 > 1)
return 1;
for (var p = h10, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h10;
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 = h10, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h10) < c)); g++)
h10 > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h10, c) {
return this.sampleCurveY(this.solveCurveX(h10, 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 = false, x())) {
const h10 = new OffscreenCanvas(5, 5).getContext("2d", { willReadFrequently: true });
if (h10) {
for (let p = 0; p < 5 * 5; p++) {
const g = 4 * p;
h10.fillStyle = `rgb(${g},${g + 1},${g + 2})`, h10.fillRect(p % 5, Math.floor(p / 5), 1, 1);
}
const c = h10.getImageData(0, 0, 5, 5).data;
for (let p = 0; p < 5 * 5 * 4; p++)
if (p % 4 != 3 && c[p] !== p) {
E = true;
break;
}
}
}
return E || false;
}
function k(h10, c, p, g) {
const w = new _(h10, c, p, g);
return (H) => w.solve(H);
}
const R = k(0.25, 0.1, 0.25, 1);
function F(h10, c, p) {
return Math.min(p, Math.max(c, h10));
}
function U(h10, c, p) {
const g = p - c, w = ((h10 - c) % g + g) % g + c;
return w === c ? p : w;
}
function $(h10, ...c) {
for (const p of c)
for (const g in p)
h10[g] = p[g];
return h10;
}
let et = 1;
function nt(h10, c, p) {
const g = {};
for (const w in h10)
g[w] = c.call(this, h10[w], w, h10);
return g;
}
function ct(h10, c, p) {
const g = {};
for (const w in h10)
c.call(this, h10[w], w, h10) && (g[w] = h10[w]);
return g;
}
function rt(h10) {
return Array.isArray(h10) ? h10.map(rt) : typeof h10 == "object" && h10 ? nt(h10, rt) : h10;
}
const gt = {};
function It(h10) {
gt[h10] || (typeof console < "u" && console.warn(h10), gt[h10] = true);
}
function Zt(h10, c, p) {
return (p.y - h10.y) * (c.x - h10.x) > (c.y - h10.y) * (p.x - h10.x);
}
function oe(h10) {
return typeof WorkerGlobalScope < "u" && h10 !== void 0 && h10 instanceof WorkerGlobalScope;
}
let re = null;
function Ve(h10) {
return typeof ImageBitmap < "u" && h10 instanceof ImageBitmap;
}
const yr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
function qr(h10, 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(h10, { 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 }] };
}(h10, 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(h10) {
return er.REGISTERED_PROTOCOLS[h10.substring(0, h10.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(h10, c) {
if (/:\/\//.test(h10.url) && !/^https?:|^file:/.test(h10.url)) {
const g = Je(h10.url);
if (g)
return g(h10, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h10, targetMapId: Ne }, c);
}
if (!(/^file:/.test(p = h10.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") };
});
}(h10, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h10, mustQueue: true, 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, true), 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);
});
}(h10, c);
};
function de(h10) {
if (!h10 || h10.indexOf("://") <= 0 || h10.indexOf("data:image/") === 0 || h10.indexOf("blob:") === 0)
return true;
const c = new URL(h10), p = window.location;
return c.protocol === p.protocol && c.host === p.host;
}
function Ge(h10, c, p) {
p[h10] && p[h10].indexOf(c) !== -1 || (p[h10] = p[h10] || [], p[h10].push(c));
}
function Tr(h10, c, p) {
if (p && p[h10]) {
const g = p[h10].indexOf(c);
g !== -1 && p[h10].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: true, type: "enum", values: [8] }, name: { type: "string" }, metadata: { type: "*" }, center: { type: "array", value: "number" }, zoom: { type: "number" }, bearing: { type: "number", default: 0, period: 360, units: "degrees" }, pitch: { type: "number", default: 0, units: "degrees" }, light: { type: "light" }, sky: { type: "sky" }, projection: { type: "projection" }, terrain: { type: "terrain" }, sources: { required: true, type: "sources" }, sprite: { type: "sprite" }, glyphs: { type: "string" }, transition: { type: "transition" }, layers: { required: true, type: "array", value: "layer" } }, sources: { "*": { type: "source" } }, source: ["source_vector", "source_raster", "source_raster_dem", "source_geojson", "source_video", "source_image"], source_vector: { type: { required: true, type: "enum", values: { vector: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, attribution: { type: "string" }, promoteId: { type: "promoteId" }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_raster: { type: { required: true, type: "enum", values: { raster: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, attribution: { type: "string" }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_raster_dem: { type: { required: true, type: "enum", values: { "raster-dem": {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, attribution: { type: "string" }, encoding: { type: "enum", values: { terrarium: {}, mapbox: {}, custom: {} }, default: "mapbox" }, redFactor: { type: "number", default: 1 }, blueFactor: { type: "number", default: 1 }, greenFactor: { type: "number", default: 1 }, baseShift: { type: "number", default: 0 }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_geojson: { type: { required: true, type: "enum", values: { geojson: {} } }, data: { required: true, type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, filter: { type: "*" }, tolerance: { type: "number", default: 0.375 }, cluster: { type: "boolean", default: false }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterMinPoints: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: false }, generateId: { type: "boolean", default: false }, promoteId: { type: "promoteId" } }, source_video: { type: { required: true, type: "enum", values: { video: {} } }, urls: { required: true, type: "array", value: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: true, type: "enum", values: { image: {} } }, url: { required: true, type: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: true }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, background: {} }, required: true }, metadata: { type: "*" }, source: { type: "string" }, "source-layer": { type: "string" }, minzoom: { type: "number", minimum: 0, maximum: 24 }, maxzoom: { type: "number", minimum: 0, maximum: 24 }, filter: { type: "filter" }, layout: { type: "layout" }, paint: { type: "paint" } }, layout: ["layout_fill", "layout_line", "layout_circle", "layout_heatmap", "layout_fill-extrusion", "layout_symbol", "layout_raster", "layout_hillshade", "layout_background"], layout_background: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_fill: { "fill-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_circle: { "circle-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_heatmap: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, "layout_fill-extrusion": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_line: { "line-cap": { type: "enum", values: { butt: {}, round: {}, square: {} }, default: "butt", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_symbol: { "symbol-placement": { type: "enum", values: { point: {}, line: {}, "line-center": {} }, default: "point", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: false, requires: ["icon-image", { "!": "icon-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: false, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: false, requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-size": { type: "number", default: 1, minimum: 0, units: "factor of the original icon size", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-text-fit": { type: "enum", values: { none: {}, width: {}, height: {}, both: {} }, default: "none", requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-text-fit-padding": { type: "array", value: "number", length: 4, default: [0, 0, 0, 0], units: "pixels", requires: ["icon-image", "text-field", { "icon-text-fit": ["both", "width", "height"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "padding", default: [2], units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-keep-upright": { type: "boolean", default: false, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, "viewport-glyph": {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"], requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-radial-offset": { type: "number", units: "ems", default: 0, requires: ["text-field"], "property-type": "data-driven", expression: { interpolated: true, parameters: ["zoom", "feature"] } }, "text-variable-anchor": { type: "array", value: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-variable-anchor-offset": { type: "variableAnchorOffsetCollection", requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["text-field", { "!": "text-variable-anchor" }], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-angle": { type: "number", default: 45, units: "degrees", requires: ["text-field", { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: true, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-offset": { type: "array", value: "number", units: "ems", length: 2, default: [0, 0], requires: ["text-field", { "!": "text-radial-offset" }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: false, requires: ["text-field", { "!": "text-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: false, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: false, requires: ["text-field", "icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_raster: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_hillshade: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, filter: { type: "array", value: "*" }, filter_operator: { type: "enum", values: { "==": {}, "!=": {}, ">": {}, ">=": {}, "<": {}, "<=": {}, in: {}, "!in": {}, all: {}, any: {}, none: {}, has: {}, "!has": {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: false } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "*", minimum: 1 }, light: { anchor: { type: "enum", default: "viewport", values: { map: {}, viewport: {} }, "property-type": "data-constant", transition: false, expression: { interpolated: false, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: true, expression: { interpolated: true, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, intensity: { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true } }, sky: { "sky-color": { type: "color", "property-type": "data-constant", default: "#88C6FC", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "horizon-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "fog-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "fog-ground-blend": { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "horizon-fog-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "sky-horizon-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "atmosphere-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true } }, terrain: { source: { type: "string", required: true }, 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: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: true, requires: [{ "!": "fill-pattern" }, { "fill-antialias": true }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, requires: ["fill-extrusion-height"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: true, transition: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "line-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: true, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "cross-faded" }, "line-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: false, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: true } }], expression: { interpolated: true, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: false, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "heatmap-color": { type: "color", default: ["interpolate", ["linear"], ["heatmap-density"], 0, "rgba(0, 0, 255, 0)", 0.1, "royalblue", 0.3, "cyan", 0.5, "lime", 0.7, "yellow", 1, "red"], transition: false, expression: { interpolated: true, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: true, overridable: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: true, units: "degrees", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: false, units: "milliseconds", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "number", default: 335, minimum: 0, maximum: 359, transition: false, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: 0.5, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "color", default: "#FFFFFF", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "background-pattern" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, transition: { duration: { type: "number", default: 300, minimum: 0, units: "milliseconds" }, delay: { type: "number", default: 0, minimum: 0, units: "milliseconds" } }, "property-type": { "data-driven": { type: "property-type" }, "cross-faded": { type: "property-type" }, "cross-faded-data-driven": { type: "property-type" }, "color-ramp": { type: "property-type" }, "data-constant": { type: "property-type" }, constant: { type: "property-type" } }, promoteId: { "*": { type: "string" } } };
const en = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
function Jr(h10, c) {
const p = {};
for (const g in h10)
g !== "ref" && (p[g] = h10[g]);
return en.forEach((g) => {
g in c && (p[g] = c[g]);
}), p;
}
function Hr(h10, c) {
if (Array.isArray(h10)) {
if (!Array.isArray(c) || h10.length !== c.length)
return false;
for (let p = 0; p < h10.length; p++)
if (!Hr(h10[p], c[p]))
return false;
return true;
}
if (typeof h10 == "object" && h10 !== null && c !== null) {
if (typeof c != "object" || Object.keys(h10).length !== Object.keys(c).length)
return false;
for (const p in h10)
if (!Hr(h10[p], c[p]))
return false;
return true;
}
return h10 === c;
}
function Rr(h10, c) {
h10.push(c);
}
function dn(h10, c, p) {
Rr(p, { command: "addSource", args: [h10, c[h10]] });
}
function ji(h10, c, p) {
Rr(c, { command: "removeSource", args: [h10] }), p[h10] = true;
}
function Ji(h10, c, p, g) {
ji(h10, p, g), dn(h10, c, p);
}
function ki(h10, c, p) {
let g;
for (g in h10[p])
if (Object.prototype.hasOwnProperty.call(h10[p], g) && g !== "data" && !Hr(h10[p][g], c[p][g]))
return false;
for (g in c[p])
if (Object.prototype.hasOwnProperty.call(c[p], g) && g !== "data" && !Hr(h10[p][g], c[p][g]))
return false;
return true;
}
function _i(h10, c, p, g, w, H) {
h10 = h10 || {}, c = c || {};
for (const A in h10)
Object.prototype.hasOwnProperty.call(h10, A) && (Hr(h10[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(h10, A) && (Hr(h10[A], c[A]) || p.push({ command: H, args: [g, A, c[A], w] }));
}
function Ii(h10) {
return h10.id;
}
function c1(h10, c) {
return h10[c.id] = c, h10;
}
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(h10, ...c) {
for (const p of c)
for (const g in p)
h10[g] = p[g];
return h10;
}
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(h10, c) {
return { kind: "array", itemType: h10, N: c };
}
function st(h10) {
if (h10.kind === "array") {
const c = st(h10.itemType);
return typeof h10.N == "number" ? `array<${c}, ${h10.N}>` : h10.itemType.kind === "value" ? "array" : `array<${c}>`;
}
return h10.kind;
}
const pt = [t1, xe, Dr, _r, Vn, H1, y1, ot(wr), Vi, Rn, xt];
function yt(h10, c) {
if (c.kind === "error")
return null;
if (h10.kind === "array") {
if (c.kind === "array" && (c.N === 0 && c.itemType.kind === "value" || !yt(h10.itemType, c.itemType)) && (typeof h10.N != "number" || h10.N === c.N))
return null;
} else {
if (h10.kind === c.kind)
return null;
if (h10.kind === "value") {
for (const p of pt)
if (!yt(p, c))
return null;
}
}
return `Expected ${st(h10)} but found ${st(c)} instead.`;
}
function At(h10, c) {
return c.some((p) => p.kind === h10.kind);
}
function Vt(h10, c) {
return c.some((p) => p === "null" ? h10 === null : p === "array" ? Array.isArray(h10) : p === "object" ? h10 && !Array.isArray(h10) && typeof h10 == "object" : p === typeof h10);
}
function jt(h10, c) {
return h10.kind === "array" && c.kind === "array" ? h10.itemType.kind === c.itemType.kind && typeof h10.N == "number" : h10.kind === c.kind;
}
const St = 0.96422, Jt = 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(h10) {
return (h10 %= 360) < 0 && (h10 += 360), h10;
}
function lr([h10, c, p, g]) {
let w, H;
const A = vn((0.2225045 * (h10 = Ar(h10)) + 0.7168786 * (c = Ar(c)) + 0.0606169 * (p = Ar(p))) / 1);
h10 === c && c === p ? w = H = A : (w = vn((0.4360747 * h10 + 0.3850649 * c + 0.1430804 * p) / St), H = vn((0.0139322 * h10 + 0.0971045 * c + 0.7141733 * p) / Jt));
const C = 116 * A - 16;
return [C < 0 ? 0 : C, 500 * (w - A), 200 * (A - H), g];
}
function Ar(h10) {
return h10 <= 0.04045 ? h10 / 12.92 : Math.pow((h10 + 0.055) / 1.055, 2.4);
}
function vn(h10) {
return h10 > or ? Math.pow(h10, 1 / 3) : h10 / Le + ae;
}
function zr([h10, c, p, g]) {
let w = (h10 + 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 = Jt * 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(h10) {
return (h10 = h10 <= 304e-5 ? 12.92 * h10 : 1.055 * Math.pow(h10, 1 / 2.4) - 0.055) < 0 ? 0 : h10 > 1 ? 1 : h10;
}
function Br(h10) {
return h10 > Xt ? h10 * h10 * h10 : Le * (h10 - ae);
}
function cn(h10) {
return parseInt(h10.padEnd(2, h10), 16) / 255;
}
function Kn(h10, c) {
return Li(c ? h10 / 100 : h10, 0, 1);
}
function Li(h10, c, p) {
return Math.min(Math.max(c, h10), p);
}
function Ri(h10) {
return !h10.some(Number.isNaN);
}
const rs = { 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 = true) {
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 = rs[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, false) : 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 ns = /* @__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" || !ns.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: false }) : null;
}
}
function uo(h10, c, p, g) {
return typeof h10 == "number" && h10 >= 0 && h10 <= 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 [${[h10, c, p, g].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${(typeof g == "number" ? [h10, c, p, g] : [h10, c, p]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`;
}
function u1(h10) {
if (h10 === null || typeof h10 == "string" || typeof h10 == "boolean" || typeof h10 == "number" || h10 instanceof tn || h10 instanceof zi || h10 instanceof Xr || h10 instanceof Yn || h10 instanceof _n || h10 instanceof pn)
return true;
if (Array.isArray(h10)) {
for (const c of h10)
if (!u1(c))
return false;
return true;
}
if (typeof h10 == "object") {
for (const c in h10)
if (!u1(h10[c]))
return false;
return true;
}
return false;
}
function Qn(h10) {
if (h10 === null)
return t1;
if (typeof h10 == "string")
return Dr;
if (typeof h10 == "boolean")
return _r;
if (typeof h10 == "number")
return xe;
if (h10 instanceof tn)
return Vn;
if (h10 instanceof zi)
return Pi;
if (h10 instanceof Xr)
return H1;
if (h10 instanceof Yn)
return Vi;
if (h10 instanceof _n)
return xt;
if (h10 instanceof pn)
return Rn;
if (Array.isArray(h10)) {
const c = h10.length;
let p;
for (const g of h10) {
const w = Qn(g);
if (p) {
if (p === w)
continue;
p = wr;
break;
}
p = w;
}
return ot(p || wr, c);
}
return y1;
}
function Ui(h10) {
const c = typeof h10;
return h10 === null ? "" : c === "string" || c === "number" || c === "boolean" ? String(h10) : h10 instanceof tn || h10 instanceof Xr || h10 instanceof Yn || h10 instanceof _n || h10 instanceof pn ? h10.toString() : JSON.stringify(h10);
}
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 true;
}
}
class jn {
constructor(c) {
this.name = "ExpressionEvaluationError", this.message = c;
}
toJSON() {
return this.message;
}
}
const is = { 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 is) || z === "object")
return p.error('The item type argument of "array" must be one of string, number, boolean', 1);
C = is[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 (!is[H])
throw new Error(`Types doesn't contain name = ${H}`);
g = is[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 false;
}
}
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 false;
}
}
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 false;
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 true;
}
}
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 false;
}
}
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 false;
}
}
function mt(h10, c) {
const p = h10.length - 1;
let g, w, H = 0, A = p, C = 0;
for (; H <= A; )
if (C = Math.floor((H + A) / 2), g = h10[C], w = h10[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(h10) {
return h10 && h10.__esModule && Object.prototype.hasOwnProperty.call(h10, "default") ? h10.default : h10;
}
var ve = Me;
function Me(h10, c, p, g) {
this.cx = 3 * h10, this.bx = 3 * (p - h10) - 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 = h10, this.p1y = c, this.p2x = p, this.p2y = g;
}
Me.prototype = { sampleCurveX: function(h10) {
return ((this.ax * h10 + this.bx) * h10 + this.cx) * h10;
}, sampleCurveY: function(h10) {
return ((this.ay * h10 + this.by) * h10 + this.cy) * h10;
}, sampleCurveDerivativeX: function(h10) {
return (3 * this.ax * h10 + 2 * this.bx) * h10 + this.cx;
}, solveCurveX: function(h10, c) {
if (c === void 0 && (c = 1e-6), h10 < 0)
return 0;
if (h10 > 1)
return 1;
for (var p = h10, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h10;
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 = h10, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h10) < c)); g++)
h10 > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h10, c) {
return this.sampleCurveY(this.solveCurveX(h10, c));
} };
var be = le(ve);
function fr(h10, c, p) {
return h10 + p * (c - h10);
}
function kn(h10, c, p) {
return h10.map((g, w) => fr(g, c[w], p));
}
const xr = { number: fr, color: function(h10, c, p, g = "rgb") {
switch (g) {
case "rgb": {
const [w, H, A, C] = kn(h10.rgb, c.rgb, p);
return new tn(w, H, A, C, false);
}
case "hcl": {
const [w, H, A, C] = h10.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, false);
}
case "lab": {
const [w, H, A, C] = zr(kn(h10.lab, c.lab, p));
return new tn(w, H, A, C, false);
}
}
}, array: kn, padding: function(h10, c, p) {
return new Yn(kn(h10.values, c.values, p));
}, variableAnchorOffsetCollection: function(h10, c, p) {
const g = h10.values, w = c.values;
if (g.length !== w.length)
throw new jn(`Cannot interpolate values of different length. from: ${h10.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(h10, c, p, g) {
const w = g - p, H = h10 - 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(h10, c) {
return h10 === "==" || h10 === "!=" ? 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(h10, c, p, g) {
return g.compare(c, p) === 0;
}
function zn(h10, c, p) {
const g = h10 !== "==" && h10 !== "!=";
return class XG {
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 XG(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 "${h10}" 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 true;
}
};
}
const b0 = zn("==", function(h10, c, p) {
return c === p;
}, Ni), _l = zn("!=", function(h10, c, p) {
return c !== p;
}, function(h10, c, p, g) {
return !Ni(0, c, p, g);
}), Nn = zn("<", function(h10, c, p) {
return c < p;
}, function(h10, c, p, g) {
return g.compare(c, p) < 0;
}), bl = zn(">", function(h10, c, p) {
return c > p;
}, function(h10, c, p, g) {
return g.compare(c, p) > 0;
}), vc = zn("<=", function(h10, c, p) {
return c <= p;
}, function(h10, c, p, g) {
return g.compare(c, p) <= 0;
}), Ko = zn(">=", function(h10, c, p) {
return c >= p;
}, function(h10, 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 false;
}
}
class D4 {
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 D4(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 false;
}
}
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 = false;
for (let A = 1; A <= c.length - 1; ++A) {
const C = c[A];
if (H && typeof C == "object" && !Array.isArray(C)) {
H = false;
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 = true, 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 false;
}
}
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 false;
}
}
class F4 {
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 F4(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 false;
}
}
const Ao = 8192;
function _c(h10, c) {
const p = (180 + h10[0]) / 360, g = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h10[1] * Math.PI / 360))) / 360, w = Math.pow(2, c.z);
return [Math.round(p * w * Ao), Math.round(g * w * Ao)];
}
function L0(h10, c) {
const p = Math.pow(2, c.z);
return [(w = (h10[0] / Ao + c.x) / p, 360 * w - 180), (g = (h10[1] / Ao + c.y) / p, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * g) * Math.PI / 180)) - 90)];
var g, w;
}
function Bs(h10, c) {
h10[0] = Math.min(h10[0], c[0]), h10[1] = Math.min(h10[1], c[1]), h10[2] = Math.max(h10[2], c[0]), h10[3] = Math.max(h10[3], c[1]);
}
function L2(h10, c) {
return !(h10[0] <= c[0] || h10[2] >= c[2] || h10[1] <= c[1] || h10[3] >= c[3]);
}
function hn2(h10, c, p) {
const g = h10[0] - c[0], w = h10[1] - c[1], H = h10[0] - p[0], A = h10[1] - p[1];
return g * A - H * w == 0 && g * H <= 0 && w * A <= 0;
}
function C3(h10, c, p, g) {
return (w = [g[0] - p[0], g[1] - p[1]])[0] * (H = [c[0] - h10[0], c[1] - h10[1]])[1] - w[1] * H[0] != 0 && !(!Oo(h10, c, p, g) || !Oo(p, g, h10, c));
var w, H;
}
function bc(h10, c, p) {
for (const g of p)
for (let w = 0; w < g.length - 1; ++w)
if (C3(h10, c, g[w], g[w + 1]))
return true;
return false;
}
function ya(h10, c, p = false) {
let g = false;
for (const C of c)
for (let N = 0; N < C.length - 1; N++) {
if (hn2(h10, C[N], C[N + 1]))
return p;
(H = C[N])[1] > (w = h10)[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 B4(h10, c) {
for (const p of c)
if (ya(h10, p))
return true;
return false;
}
function j4(h10, c) {
for (const p of h10)
if (!ya(p, c))
return false;
for (let p = 0; p < h10.length - 1; ++p)
if (bc(h10[p], h10[p + 1], c))
return false;
return true;
}
function Ll(h10, c) {
for (const p of c)
if (j4(h10, p))
return true;
return false;
}
function Oo(h10, c, p, g) {
const w = g[0] - p[0], H = g[1] - p[1], A = (h10[0] - p[0]) * H - w * (h10[1] - p[1]), C = (c[0] - p[0]) * H - w * (c[1] - p[1]);
return A > 0 && C < 0 || A < 0 && C > 0;
}
function z4(h10, c, p) {
const g = [];
for (let w = 0; w < h10.length; w++) {
const H = [];
for (let A = 0; A < h10[w].length; A++) {
const C = _c(h10[w][A], p);
Bs(c, C), H.push(C);
}
g.push(H);
}
return g;
}
function w0(h10, c, p) {
const g = [];
for (let w = 0; w < h10.length; w++) {
const H = z4(h10[w], c, p);
g.push(H);
}
return g;
}
function wl(h10, c, p, g) {
if (h10[0] < p[0] || h10[0] > p[2]) {
const w = 0.5 * g;
let H = h10[0] - p[0] > w ? -g : p[0] - h10[0] > w ? g : 0;
H === 0 && (H = h10[0] - p[2] > w ? -g : p[2] - h10[0] > w ? g : 0), h10[0] += H;
}
Bs(c, h10);
}
function x0(h10, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const C of h10)
for (const N of C) {
const z = [N.x + H[0], N.y + H[1]];
wl(z, c, p, w), A.push(z);
}
return A;
}
function k3(h10, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const N of h10) {
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)
wl(z, c, p, w);
}
var C;
return A;
}
class os {
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 os(g, { type: "MultiPolygon", coordinates: w });
} else if (g.type === "Feature") {
const w = g.geometry.type;
if (w === "Polygon" || w === "MultiPolygon")
return new os(g, g.geometry);
} else if (g.type === "Polygon" || g.type === "MultiPolygon")
return new os(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 = z4(g.coordinates, H, A), N = x0(p.geometry(), w, H, A);
if (!L2(w, H))
return false;
for (const z of N)
if (!ya(z, C))
return false;
}
if (g.type === "MultiPolygon") {
const C = w0(g.coordinates, H, A), N = x0(p.geometry(), w, H, A);
if (!L2(w, H))
return false;
for (const z of N)
if (!B4(z, C))
return false;
}
return true;
}(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 = z4(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return false;
for (const z of N)
if (!j4(z, C))
return false;
}
if (g.type === "MultiPolygon") {
const C = w0(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return false;
for (const z of N)
if (!Ll(z, C))
return false;
}
return true;
}(c, this.geometries);
}
return false;
}
eachChild() {
}
outputDefined() {
return true;
}
}
let E0 = class {
constructor(h10 = [], c = (p, g) => p < g ? -1 : p > g ? 1 : 0) {
if (this.data = h10, 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(h10) {
this.data.push(h10), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const h10 = this.data[0], c = this.data.pop();
return --this.length > 0 && (this.data[0] = c, this._down(0)), h10;
}
peek() {
return this.data[0];
}
_up(h10) {
const { data: c, compare: p } = this, g = c[h10];
for (; h10 > 0; ) {
const w = h10 - 1 >> 1, H = c[w];
if (p(g, H) >= 0)
break;
c[h10] = H, h10 = w;
}
c[h10] = g;
}
_down(h10) {
const { data: c, compare: p } = this, g = this.length >> 1, w = c[h10];
for (; h10 < g; ) {
let H = 1 + (h10 << 1);
const A = H + 1;
if (A < this.length && p(c[A], c[H]) < 0 && (H = A), p(c[H], w) >= 0)
break;
c[h10] = c[H], h10 = H;
}
c[h10] = w;
}
};
function Lc(h10, c, p, g, w) {
ss(h10, c, p, g || h10.length - 1, w || wc);
}
function ss(h10, 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);
ss(h10, 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 = h10[c], X = p, tt = g;
for (va(h10, p, c), w(h10[g], W) > 0 && va(h10, p, g); X < tt; ) {
for (va(h10, X, tt), X++, tt--; w(h10[X], W) < 0; )
X++;
for (; w(h10[tt], W) > 0; )
tt--;
}
w(h10[p], W) === 0 ? va(h10, p, tt) : va(h10, ++tt, g), tt <= c && (p = tt + 1), c <= tt && (g = tt - 1);
}
}
function va(h10, c, p) {
var g = h10[c];
h10[c] = h10[p], h10[p] = g;
}
function wc(h10, c) {
return h10 < c ? -1 : h10 > c ? 1 : 0;
}
function U4(h10, c) {
if (h10.length <= 1)
return [h10];
const p = [];
let g, w;
for (const H of h10) {
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 || (Lc(p[H], c, 1, p[H].length - 1, M0), p[H] = p[H].slice(0, c));
return p;
}
function M0(h10, c) {
return c.area - h10.area;
}
function I3(h10) {
let c = 0;
for (let p, g, w = 0, H = h10.length, A = H - 1; w < H; A = w++)
p = h10[w], g = h10[A], c += (g.x - p.x) * (p.y + g.y);
return c;
}
const G4 = 1 / 298.257223563, $4 = G4 * (2 - G4), W4 = Math.PI / 180;
class js {
constructor(c) {
const p = 6378.137 * W4 * 1e3, g = Math.cos(c * W4), w = 1 / (1 - $4 * (1 - g * g)), H = Math.sqrt(w);
this.kx = p * H * g, this.ky = p * H * w * (1 - $4);
}
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 xl(h10, c) {
return c[0] - h10[0];
}
function Z4(h10) {
return h10[1] - h10[0] + 1;
}
function w2(h10, c) {
return h10[1] >= h10[0] && h10[1] < c;
}
function S0(h10, c) {
if (h10[0] > h10[1])
return [null, null];
const p = Z4(h10);
if (c) {
if (p === 2)
return [h10, null];
const w = Math.floor(p / 2);
return [[h10[0], h10[0] + w], [h10[0] + w, h10[1]]];
}
if (p === 1)
return [h10, null];
const g = Math.floor(p / 2) - 1;
return [[h10[0], h10[0] + g], [h10[0] + g + 1, h10[1]]];
}
function H0(h10, c) {
if (!w2(c, h10.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, h10[g]);
return p;
}
function q4(h10) {
const c = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (const p of h10)
for (const g of p)
Bs(c, g);
return c;
}
function _a(h10) {
return h10[0] !== -1 / 0 && h10[1] !== -1 / 0 && h10[2] !== 1 / 0 && h10[3] !== 1 / 0;
}
function x2(h10, c, p) {
if (!_a(h10) || !_a(c))
return NaN;
let g = 0, w = 0;
return h10[2] < c[0] && (g = c[0] - h10[2]), h10[0] > c[2] && (g = h10[0] - c[2]), h10[1] > c[3] && (w = h10[1] - c[3]), h10[3] < c[1] && (w = c[1] - h10[3]), p.distance([0, 0], [g, w]);
}
function v1(h10, c, p) {
const g = p.pointOnLine(c, h10);
return p.distance(h10, g.point);
}
function E2(h10, c, p, g, w) {
const H = Math.min(v1(h10, [p, g], w), v1(c, [p, g], w)), A = Math.min(v1(p, [h10, c], w), v1(g, [h10, c], w));
return Math.min(H, A);
}
function X4(h10, c, p, g, w) {
if (!w2(c, h10.length) || !w2(g, p.length))
return 1 / 0;
let H = 1 / 0;
for (let A = c[0]; A < c[1]; ++A) {
const C = h10[A], N = h10[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(h10, c, p, g, w) {
if (!w2(c, h10.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(h10[A], p[C])), H === 0)
return H;
return H;
}
function xc(h10, c, p) {
if (ya(h10, c, true))
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(h10, [A, H], p)), g === 0))
return g;
const C = p.pointOnLine(w, h10);
if (g = Math.min(g, p.distance(h10, C.point)), g === 0)
return g;
}
return g;
}
function $r(h10, c, p, g) {
if (!w2(c, h10.length))
return NaN;
for (let H = c[0]; H <= c[1]; ++H)
if (ya(h10[H], p, true))
return 0;
let w = 1 / 0;
for (let H = c[0]; H < c[1]; ++H) {
const A = h10[H], C = h10[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 as(h10, c) {
for (const p of h10)
for (const g of p)
if (ya(g, c, true))
return true;
return false;
}
function An(h10, c, p, g = 1 / 0) {
const w = q4(h10), H = q4(c);
if (g !== 1 / 0 && x2(w, H, p) >= g)
return g;
if (L2(w, H)) {
if (as(h10, c))
return 0;
} else if (as(c, h10))
return 0;
let A = 1 / 0;
for (const C of h10)
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(h10, c, p, g, w, H) {
if (!H)
return;
const A = x2(H0(g, H), w, p);
A < c && h10.push([A, H, [0, 0]]);
}
function zs(h10, c, p, g, w, H, A) {
if (!H || !A)
return;
const C = x2(H0(g, H), H0(w, A), p);
C < c && h10.push([C, H, A]);
}
function P3(h10, c, p, g, w = 1 / 0) {
let H = Math.min(g.distance(h10[0], p[0][0]), w);
if (H === 0)
return H;
const A = new E0([[0, [0, h10.length - 1], [0, 0]]], xl), C = q4(p);
for (; A.length > 0; ) {
const N = A.pop();
if (N[0] >= H)
continue;
const z = N[1], W = c ? 50 : 100;
if (Z4(z) <= W) {
if (!w2(z, h10.length))
return NaN;
if (c) {
const X = $r(h10, 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 = xc(h10[X], p, g);
if (H = Math.min(H, tt), H === 0)
return 0;
}
} else {
const X = S0(z, c);
bn(A, H, g, h10, C, X[0]), bn(A, H, g, h10, C, X[1]);
}
}
return H;
}
function ba(h10, c, p, g, w, H = 1 / 0) {
let A = Math.min(H, w.distance(h10[0], p[0]));
if (A === 0)
return A;
const C = new E0([[0, [0, h10.length - 1], [0, p.length - 1]]], xl);
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 (Z4(z) <= X && Z4(W) <= tt) {
if (!w2(z, h10.length) && w2(W, p.length))
return NaN;
let at;
if (c && g)
at = X4(h10, z, p, W, w), A = Math.min(A, at);
else if (c && !g) {
const ut = h10.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(h10[Tt], ut, w), A = Math.min(A, at), A === 0)
return A;
} else
at = Mn(h10, z, p, W, w), A = Math.min(A, at);
} else {
const at = S0(z, c), ut = S0(W, g);
zs(C, A, w, h10, p, at[0], ut[0]), zs(C, A, w, h10, p, at[0], ut[1]), zs(C, A, w, h10, p, at[1], ut[0]), zs(C, A, w, h10, p, at[1], ut[1]);
}
}
return A;
}
function K4(h10) {
return h10.type === "MultiPolygon" ? h10.coordinates.map((c) => ({ type: "Polygon", coordinates: c })) : h10.type === "MultiLineString" ? h10.coordinates.map((c) => ({ type: "LineString", coordinates: c })) : h10.type === "MultiPoint" ? h10.coordinates.map((c) => ({ type: "Point", coordinates: c })) : [h10];
}
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) => K4(w.geometry)).flat());
if (g.type === "Feature")
return new Yo(g, K4(g.geometry));
if ("type" in g && "coordinates" in g)
return new Yo(g, K4(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) => L0([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, false, [N.coordinates], false, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, false, N.coordinates, true, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, false, 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) => L0([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, true, [N.coordinates], false, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, true, N.coordinates, true, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, true, 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 = U4(w, 0).map((N) => N.map((z) => z.map((W) => L0([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], false, z, A, C));
break;
case "LineString":
C = Math.min(C, P3(N.coordinates, true, 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 true;
}
}
const Co = { "==": b0, "!=": _l, ">": bl, "<": Nn, ">=": Ko, "<=": vc, 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: F4, let: ho, literal: h1, match: q, number: d1, "number-format": D4, object: d1, slice: ht, step: qt, string: d1, "to-boolean": e1, "to-color": e1, "to-number": e1, "to-string": e1, var: Yr, within: os, 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 false;
}
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 = false;
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 = true;
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(h10, [c, p, g, w]) {
c = c.evaluate(h10), p = p.evaluate(h10), g = g.evaluate(h10);
const H = w ? w.evaluate(h10) : 1, A = uo(c, p, g, H);
if (A)
throw new jn(A);
return new tn(c / 255, p / 255, g / 255, H, false);
}
function A0(h10, c) {
return h10 in c;
}
function M2(h10, c) {
const p = c[h10];
return p === void 0 ? null : p;
}
function ls(h10) {
return { type: h10 };
}
function V3(h10) {
if (h10 instanceof Yr)
return V3(h10.boundExpression);
if (h10 instanceof po && h10.name === "error" || h10 instanceof ga || h10 instanceof os || h10 instanceof Yo)
return false;
const c = h10 instanceof e1 || h10 instanceof d1;
let p = true;
return h10.eachChild((g) => {
p = c ? p && V3(g) : p && g instanceof h1;
}), !!p && cs(h10) && La(h10, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]);
}
function cs(h10) {
if (h10 instanceof po && (h10.name === "get" && h10.args.length === 1 || h10.name === "feature-state" || h10.name === "has" && h10.args.length === 1 || h10.name === "properties" || h10.name === "geometry-type" || h10.name === "id" || /^filter-/.test(h10.name)) || h10 instanceof os || h10 instanceof Yo)
return false;
let c = true;
return h10.eachChild((p) => {
c && !cs(p) && (c = false);
}), c;
}
function us(h10) {
if (h10 instanceof po && h10.name === "feature-state")
return false;
let c = true;
return h10.eachChild((p) => {
c && !us(p) && (c = false);
}), c;
}
function La(h10, c) {
if (h10 instanceof po && c.indexOf(h10.name) >= 0)
return false;
let p = true;
return h10.eachChild((g) => {
p && !La(g, c) && (p = false);
}), p;
}
function R3(h10) {
return { result: "success", value: h10 };
}
function Us(h10) {
return { result: "error", value: h10 };
}
function t22(h10) {
return h10["property-type"] === "data-driven" || h10["property-type"] === "cross-faded-data-driven";
}
function O0(h10) {
return !!h10.expression && h10.expression.parameters.indexOf("zoom") > -1;
}
function C0(h10) {
return !!h10.expression && h10.expression.interpolated;
}
function kt(h10) {
return h10 instanceof Number ? "number" : h10 instanceof String ? "string" : h10 instanceof Boolean ? "boolean" : Array.isArray(h10) ? "array" : h10 === null ? "null" : typeof h10;
}
function ne(h10) {
return typeof h10 == "object" && h10 !== null && !Array.isArray(h10);
}
function Fe(h10) {
return h10;
}
function Lr(h10, c) {
const p = c.type === "color", g = h10.stops && typeof h10.stops[0][0] == "object", w = g || !(g || h10.property !== void 0), H = h10.type || (C0(c) ? "exponential" : "interval");
if (p || c.type === "padding") {
const W = p ? tn.parse : Yn.parse;
(h10 = bi({}, h10)).stops && (h10.stops = h10.stops.map((X) => [X[0], W(X[1])])), h10.default = W(h10.default ? h10.default : c.default);
}
if (h10.colorSpace && (A = h10.colorSpace) !== "rgb" && A !== "hcl" && A !== "lab")
throw new Error(`Unknown color space: "${h10.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 h10.stops)
N[W[0]] = W[1];
z = typeof h10.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 < h10.stops.length; ut++) {
const Tt = h10.stops[ut], Lt = Tt[0].zoom;
W[Lt] === void 0 && (W[Lt] = { zoom: Lt, type: h10.type, property: h10.property, default: h10.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: h10.base }, c, ut).evaluate(ut, Tt) };
}
if (w) {
const W = H === "exponential" ? { name: "exponential", base: h10.base !== void 0 ? h10.base : 1 } : null;
return { kind: "camera", interpolationType: W, interpolationFactor: un.interpolationFactor.bind(void 0, W), zoomStops: h10.stops.map((X) => X[0]), evaluate: ({ zoom: X }) => C(h10, c, X, N, z) };
}
return { kind: "source", evaluate(W, X) {
const tt = X && X.properties ? X.properties[h10.property] : void 0;
return tt === void 0 ? Ln(h10.default, c.default) : C(h10, c, tt, N, z);
} };
}
function Ln(h10, c, p) {
return h10 !== void 0 ? h10 : c !== void 0 ? c : p !== void 0 ? p : void 0;
}
function rn(h10, c, p, g, w) {
return Ln(typeof p === w ? g[p] : void 0, h10.default, c.default);
}
function Jn(h10, c, p) {
if (kt(p) !== "number")
return Ln(h10.default, c.default);
const g = h10.stops.length;
if (g === 1 || p <= h10.stops[0][0])
return h10.stops[0][1];
if (p >= h10.stops[g - 1][0])
return h10.stops[g - 1][1];
const w = mt(h10.stops.map((H) => H[0]), p);
return h10.stops[w][1];
}
function wi(h10, c, p) {
const g = h10.base !== void 0 ? h10.base : 1;
if (kt(p) !== "number")
return Ln(h10.default, c.default);
const w = h10.stops.length;
if (w === 1 || p <= h10.stops[0][0])
return h10.stops[0][1];
if (p >= h10.stops[w - 1][0])
return h10.stops[w - 1][1];
const H = mt(h10.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, h10.stops[H][0], h10.stops[H + 1][0]), C = h10.stops[H][1], N = h10.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, h10.colorSpace);
} } : z(C, N, A, h10.colorSpace);
}
function To(h10, 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, h10.default, c.default);
}
po.register(Co, { error: [{ kind: "error" }, [Dr], (h10, [c]) => {
throw new jn(c.evaluate(h10));
}], typeof: [Dr, [wr], (h10, [c]) => st(Qn(c.evaluate(h10)))], "to-rgba": [ot(xe, 4), [Vn], (h10, [c]) => {
const [p, g, w, H] = c.evaluate(h10).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], (h10, [c]) => A0(c.evaluate(h10), h10.properties())], [[Dr, y1], (h10, [c, p]) => A0(c.evaluate(h10), p.evaluate(h10))]] }, get: { type: wr, overloads: [[[Dr], (h10, [c]) => M2(c.evaluate(h10), h10.properties())], [[Dr, y1], (h10, [c, p]) => M2(c.evaluate(h10), p.evaluate(h10))]] }, "feature-state": [wr, [Dr], (h10, [c]) => M2(c.evaluate(h10), h10.featureState || {})], properties: [y1, [], (h10) => h10.properties()], "geometry-type": [Dr, [], (h10) => h10.geometryType()], id: [wr, [], (h10) => h10.id()], zoom: [xe, [], (h10) => h10.globals.zoom], "heatmap-density": [xe, [], (h10) => h10.globals.heatmapDensity || 0], "line-progress": [xe, [], (h10) => h10.globals.lineProgress || 0], accumulated: [wr, [], (h10) => h10.globals.accumulated === void 0 ? null : h10.globals.accumulated], "+": [xe, ls(xe), (h10, c) => {
let p = 0;
for (const g of c)
p += g.evaluate(h10);
return p;
}], "*": [xe, ls(xe), (h10, c) => {
let p = 1;
for (const g of c)
p *= g.evaluate(h10);
return p;
}], "-": { type: xe, overloads: [[[xe, xe], (h10, [c, p]) => c.evaluate(h10) - p.evaluate(h10)], [[xe], (h10, [c]) => -c.evaluate(h10)]] }, "/": [xe, [xe, xe], (h10, [c, p]) => c.evaluate(h10) / p.evaluate(h10)], "%": [xe, [xe, xe], (h10, [c, p]) => c.evaluate(h10) % p.evaluate(h10)], ln2: [xe, [], () => Math.LN2], pi: [xe, [], () => Math.PI], e: [xe, [], () => Math.E], "^": [xe, [xe, xe], (h10, [c, p]) => Math.pow(c.evaluate(h10), p.evaluate(h10))], sqrt: [xe, [xe], (h10, [c]) => Math.sqrt(c.evaluate(h10))], log10: [xe, [xe], (h10, [c]) => Math.log(c.evaluate(h10)) / Math.LN10], ln: [xe, [xe], (h10, [c]) => Math.log(c.evaluate(h10))], log2: [xe, [xe], (h10, [c]) => Math.log(c.evaluate(h10)) / Math.LN2], sin: [xe, [xe], (h10, [c]) => Math.sin(c.evaluate(h10))], cos: [xe, [xe], (h10, [c]) => Math.cos(c.evaluate(h10))], tan: [xe, [xe], (h10, [c]) => Math.tan(c.evaluate(h10))], asin: [xe, [xe], (h10, [c]) => Math.asin(c.evaluate(h10))], acos: [xe, [xe], (h10, [c]) => Math.acos(c.evaluate(h10))], atan: [xe, [xe], (h10, [c]) => Math.atan(c.evaluate(h10))], min: [xe, ls(xe), (h10, c) => Math.min(...c.map((p) => p.evaluate(h10)))], max: [xe, ls(xe), (h10, c) => Math.max(...c.map((p) => p.evaluate(h10)))], abs: [xe, [xe], (h10, [c]) => Math.abs(c.evaluate(h10))], round: [xe, [xe], (h10, [c]) => {
const p = c.evaluate(h10);
return p < 0 ? -Math.round(-p) : Math.round(p);
}], floor: [xe, [xe], (h10, [c]) => Math.floor(c.evaluate(h10))], ceil: [xe, [xe], (h10, [c]) => Math.ceil(c.evaluate(h10))], "filter-==": [_r, [Dr, wr], (h10, [c, p]) => h10.properties()[c.value] === p.value], "filter-id-==": [_r, [wr], (h10, [c]) => h10.id() === c.value], "filter-type-==": [_r, [Dr], (h10, [c]) => h10.geometryType() === c.value], "filter-<": [_r, [Dr, wr], (h10, [c, p]) => {
const g = h10.properties()[c.value], w = p.value;
return typeof g == typeof w && g < w;
}], "filter-id-<": [_r, [wr], (h10, [c]) => {
const p = h10.id(), g = c.value;
return typeof p == typeof g && p < g;
}], "filter->": [_r, [Dr, wr], (h10, [c, p]) => {
const g = h10.properties()[c.value], w = p.value;
return typeof g == typeof w && g > w;
}], "filter-id->": [_r, [wr], (h10, [c]) => {
const p = h10.id(), g = c.value;
return typeof p == typeof g && p > g;
}], "filter-<=": [_r, [Dr, wr], (h10, [c, p]) => {
const g = h10.properties()[c.value], w = p.value;
return typeof g == typeof w && g <= w;
}], "filter-id-<=": [_r, [wr], (h10, [c]) => {
const p = h10.id(), g = c.value;
return typeof p == typeof g && p <= g;
}], "filter->=": [_r, [Dr, wr], (h10, [c, p]) => {
const g = h10.properties()[c.value], w = p.value;
return typeof g == typeof w && g >= w;
}], "filter-id->=": [_r, [wr], (h10, [c]) => {
const p = h10.id(), g = c.value;
return typeof p == typeof g && p >= g;
}], "filter-has": [_r, [wr], (h10, [c]) => c.value in h10.properties()], "filter-has-id": [_r, [], (h10) => h10.id() !== null && h10.id() !== void 0], "filter-type-in": [_r, [ot(Dr)], (h10, [c]) => c.value.indexOf(h10.geometryType()) >= 0], "filter-id-in": [_r, [ot(wr)], (h10, [c]) => c.value.indexOf(h10.id()) >= 0], "filter-in-small": [_r, [Dr, ot(wr)], (h10, [c, p]) => p.value.indexOf(h10.properties()[c.value]) >= 0], "filter-in-large": [_r, [Dr, ot(wr)], (h10, [c, p]) => function(g, w, H, A) {
for (; H <= A; ) {
const C = H + A >> 1;
if (w[C] === g)
return true;
w[C] > g ? A = C - 1 : H = C + 1;
}
return false;
}(h10.properties()[c.value], p.value, 0, p.value.length - 1)], all: { type: _r, overloads: [[[_r, _r], (h10, [c, p]) => c.evaluate(h10) && p.evaluate(h10)], [ls(_r), (h10, c) => {
for (const p of c)
if (!p.evaluate(h10))
return false;
return true;
}]] }, any: { type: _r, overloads: [[[_r, _r], (h10, [c, p]) => c.evaluate(h10) || p.evaluate(h10)], [ls(_r), (h10, c) => {
for (const p of c)
if (p.evaluate(h10))
return true;
return false;
}]] }, "!": [_r, [_r], (h10, [c]) => !c.evaluate(h10)], "is-supported-script": [_r, [Dr], (h10, [c]) => {
const p = h10.globals && h10.globals.isSupportedScript;
return !p || p(c.evaluate(h10));
}], upcase: [Dr, [Dr], (h10, [c]) => c.evaluate(h10).toUpperCase()], downcase: [Dr, [Dr], (h10, [c]) => c.evaluate(h10).toLowerCase()], concat: [Dr, ls(wr), (h10, c) => c.map((p) => Ui(p.evaluate(h10))).join("")], "resolved-locale": [Dr, [Pi], (h10, [c]) => c.evaluate(h10).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] = true, typeof console < "u" && console.warn(C.message)), this._defaultValue;
}
}
}
function yi(h10) {
return Array.isArray(h10) && h10.length > 0 && typeof h10[0] == "string" && h10[0] in Co;
}
function _1(h10, 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(h10, 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" && !us(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" && !us(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(h10, c) {
const p = _1(h10, c);
if (p.result === "error")
return p;
const g = p.value.expression, w = cs(g);
if (!w && !t22(c))
return Us([new Xn("", "data expressions not supported")]);
const H = La(g, ["zoom"]);
if (!H && !O0(c))
return Us([new Xn("", "zoom expressions not supported")]);
const A = hs(g);
return A || H ? A instanceof Xn ? Us([A]) : A instanceof un && !C0(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 hs(h10) {
let c = null;
if (h10 instanceof ho)
c = hs(h10.result);
else if (h10 instanceof dr) {
for (const p of h10.args)
if (c = hs(p), c)
break;
} else
(h10 instanceof qt || h10 instanceof un) && h10.input instanceof po && h10.input.name === "zoom" && (c = h10);
return c instanceof Xn || h10.eachChild((p) => {
const g = hs(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(h10) {
if (h10 === true || h10 === false)
return true;
if (!Array.isArray(h10) || h10.length === 0)
return false;
switch (h10[0]) {
case "has":
return h10.length >= 2 && h10[1] !== "$id" && h10[1] !== "$type";
case "in":
return h10.length >= 3 && (typeof h10[1] != "string" || Array.isArray(h10[2]));
case "!in":
case "!has":
case "none":
return false;
case "==":
case "!=":
case ">":
case ">=":
case "<":
case "<=":
return h10.length !== 3 || Array.isArray(h10[1]) || Array.isArray(h10[2]);
case "any":
case "all":
for (const c of h10.slice(1))
if (!S2(c) && typeof c != "boolean")
return false;
return true;
default:
return true;
}
}
const ds = { type: "boolean", default: false, transition: false, "property-type": "data-driven", expression: { interpolated: false, parameters: ["zoom", "feature"] } };
function Y4(h10) {
if (h10 == null)
return { filter: () => true, needGeometry: false };
S2(h10) || (h10 = wn2(h10));
const c = _1(h10, ds);
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: El(h10) };
}
function Ec(h10, c) {
return h10 < c ? -1 : h10 > c ? 1 : 0;
}
function El(h10) {
if (!Array.isArray(h10))
return false;
if (h10[0] === "within" || h10[0] === "distance")
return true;
for (let c = 1; c < h10.length; c++)
if (El(h10[c]))
return true;
return false;
}
function wn2(h10) {
if (!h10)
return true;
const c = h10[0];
return h10.length <= 1 ? c !== "any" : c === "==" ? mn(h10[1], h10[2], "==") : c === "!=" ? Gi(mn(h10[1], h10[2], "==")) : c === "<" || c === ">" || c === "<=" || c === ">=" ? mn(h10[1], h10[2], c) : c === "any" ? (p = h10.slice(1), ["any"].concat(p.map(wn2))) : c === "all" ? ["all"].concat(h10.slice(1).map(wn2)) : c === "none" ? ["all"].concat(h10.slice(1).map(wn2).map(Gi)) : c === "in" ? ps(h10[1], h10.slice(2)) : c === "!in" ? Gi(ps(h10[1], h10.slice(2))) : c === "has" ? fo(h10[1]) : c !== "!has" || Gi(fo(h10[1]));
var p;
}
function mn(h10, c, p) {
switch (h10) {
case "$type":
return [`filter-type-${p}`, c];
case "$id":
return [`filter-id-${p}`, c];
default:
return [`filter-${p}`, h10, c];
}
}
function ps(h10, c) {
if (c.length === 0)
return false;
switch (h10) {
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", h10, ["literal", c.sort(Ec)]] : ["filter-in-small", h10, ["literal", c]];
}
}
function fo(h10) {
switch (h10) {
case "$type":
return true;
case "$id":
return ["filter-has-id"];
default:
return ["filter-has", h10];
}
}
function Gi(h10) {
return ["!", h10];
}
function $i(h10) {
const c = typeof h10;
if (c === "number" || c === "boolean" || c === "string" || h10 == null)
return JSON.stringify(h10);
if (Array.isArray(h10)) {
let w = "[";
for (const H of h10)
w += `${$i(H)},`;
return `${w}]`;
}
const p = Object.keys(h10).sort();
let g = "{";
for (let w = 0; w < p.length; w++)
g += `${JSON.stringify(p[w])}:${$i(h10[p[w]])},`;
return `${g}}`;
}
function e2(h10) {
let c = "";
for (const p of en)
c += `/${$i(h10[p])}`;
return c;
}
function H2(h10) {
const c = h10.value;
return c ? [new ye(h10.key, c, "constants have been deprecated as of v8")] : [];
}
function Dn(h10) {
return h10 instanceof Number || h10 instanceof String || h10 instanceof Boolean ? h10.valueOf() : h10;
}
function O1(h10) {
if (Array.isArray(h10))
return h10.map(O1);
if (h10 instanceof Object && !(h10 instanceof Number || h10 instanceof String || h10 instanceof Boolean)) {
const c = {};
for (const p in h10)
c[p] = O1(h10[p]);
return c;
}
return Dn(h10);
}
function Wi(h10) {
const c = h10.key, p = h10.value, g = h10.valueSpec || {}, w = h10.objectElementValidators || {}, H = h10.style, A = h10.styleSpec, C = h10.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(h10) {
const c = h10.value, p = h10.valueSpec, g = h10.style, w = h10.styleSpec, H = h10.key, A = h10.arrayElementValidator || h10.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: h10.validateSpec, style: g, styleSpec: w, key: `${H}[${z}]` }));
return N;
}
function J4(h10) {
const c = h10.key, p = h10.value, g = h10.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(h10) {
const c = h10.valueSpec, p = Dn(h10.value.type);
let g, w, H, A = {};
const C = p !== "categorical" && h10.value.property === void 0, N = !C, z = kt(h10.value.stops) === "array" && kt(h10.value.stops[0]) === "array" && kt(h10.value.stops[0][0]) === "object", W = Wi({ key: h10.key, value: h10.value, valueSpec: h10.styleSpec.function, validateSpec: h10.validateSpec, style: h10.style, styleSpec: h10.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(h10.key, h10.value, 'missing required property "property"')), p === "identity" || h10.value.stops || W.push(new ye(h10.key, h10.value, 'missing required property "stops"')), p === "exponential" && h10.valueSpec.expression && !C0(h10.valueSpec) && W.push(new ye(h10.key, h10.value, "exponential functions not supported")), h10.styleSpec.$version >= 8 && (N && !t22(h10.valueSpec) ? W.push(new ye(h10.key, h10.value, "property functions not supported")) : C && !O0(h10.valueSpec) && W.push(new ye(h10.key, h10.value, "zoom functions not supported"))), p !== "categorical" && !z || h10.value.property !== void 0 || W.push(new ye(h10.key, h10.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: J4, 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 t22(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] = true, [])) : [new ye(at.key, Et, `integer expected, found ${Lt}`)];
}
}
function Ts(h10) {
const c = (h10.expressionContext === "property" ? ko : _1)(O1(h10.value), h10.valueSpec);
if (c.result === "error")
return c.value.map((g) => new ye(`${h10.key}${g.key}`, h10.value, g.message));
const p = c.value.expression || c.value._styleExpression.expression;
if (h10.expressionContext === "property" && h10.propertyKey === "text-font" && !p.outputDefined())
return [new ye(h10.key, h10.value, `Invalid data expression for "${h10.propertyKey}". Output values must be contained as literals within the expression.`)];
if (h10.expressionContext === "property" && h10.propertyType === "layout" && !us(p))
return [new ye(h10.key, h10.value, '"feature-state" data expressions are not supported with layout properties.')];
if (h10.expressionContext === "filter" && !us(p))
return [new ye(h10.key, h10.value, '"feature-state" data expressions are not supported with filters.')];
if (h10.expressionContext && h10.expressionContext.indexOf("cluster") === 0) {
if (!La(p, ["zoom", "feature-state"]))
return [new ye(h10.key, h10.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
if (h10.expressionContext === "cluster-initial" && !cs(p))
return [new ye(h10.key, h10.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
}
return [];
}
function Qo(h10) {
const c = h10.key, p = h10.value, g = h10.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(h10) {
return S2(O1(h10.value)) ? Ts(bi({}, h10, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : N3(h10);
}
function N3(h10) {
const c = h10.value, p = h10.key;
if (kt(c) !== "array")
return [new ye(p, c, `array expected, ${kt(c)} found`)];
const g = h10.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: h10.style, styleSpec: h10.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: h10.style, styleSpec: h10.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: h10.style, styleSpec: h10.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(h10, c) {
const p = h10.key, g = h10.validateSpec, w = h10.style, H = h10.styleSpec, A = h10.value, C = h10.objectKey, N = H[`${c}_${h10.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 = h10.valueSpec || N[C];
if (!W)
return [new ye(p, A, `unknown property "${C}"`)];
let X;
if (kt(A) === "string" && t22(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 h10.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: h10.key, value: A, valueSpec: W, style: w, styleSpec: H, expressionContext: "property", propertyType: c, propertyKey: C }));
}
function $s(h10) {
return xa(h10, "paint");
}
function Mc(h10) {
return xa(h10, "layout");
}
function Sc(h10) {
let c = [];
const p = h10.value, g = h10.key, w = h10.style, H = h10.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 < h10.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: h10.style, styleSpec: h10.styleSpec, validateSpec: h10.validateSpec, objectElementValidators: { "*": () => [], type: () => h10.validateSpec({ key: `${g}.type`, value: p.type, valueSpec: H.layer.type, style: h10.style, styleSpec: h10.styleSpec, validateSpec: h10.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) => Mc(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(h10) {
const c = h10.value, p = h10.key, g = kt(c);
return g !== "string" ? [new ye(p, c, `string expected, ${g} found`)] : [];
}
const Ml = { promoteId: function({ key: h10, value: c }) {
if (kt(c) === "string")
return D3({ key: h10, value: c });
{
const p = [];
for (const g in c)
p.push(...D3({ key: `${h10}.${g}`, value: c[g] }));
return p;
}
} };
function k0(h10) {
const c = h10.value, p = h10.key, g = h10.styleSpec, w = h10.style, H = h10.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: h10.style, styleSpec: g, objectElementValidators: Ml, 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: h10.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: Ml }), 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(...Ts({ key: `${p}.${N}.map`, value: W, validateSpec: H, expressionContext: "cluster-map" })), C.push(...Ts({ 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 Hc(h10) {
const c = h10.value, p = h10.styleSpec, g = p.light, w = h10.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 ? h10.validateSpec({ key: C, value: c[C], valueSpec: p.transition, validateSpec: h10.validateSpec, style: w, styleSpec: p }) : g[C] ? h10.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h10.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
}
return H;
}
function Ac(h10) {
const c = h10.value, p = h10.styleSpec, g = p.sky, w = h10.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] ? h10.validateSpec({ key: C, value: c[C], valueSpec: g[C], style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return A;
}
function Oc(h10) {
const c = h10.value, p = h10.styleSpec, g = p.terrain, w = h10.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] ? h10.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h10.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return H;
}
function Cc(h10) {
let c = [];
const p = h10.value, g = h10.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: true }, url: { type: "string", required: true } }, validateSpec: h10.validateSpec }));
return c;
}
return D3({ key: g, value: p });
}
const Sl = { "*": () => [], array: Po, boolean: function(h10) {
const c = h10.value, p = h10.key, g = kt(c);
return g !== "boolean" ? [new ye(p, c, `boolean expected, ${g} found`)] : [];
}, number: J4, color: function(h10) {
const c = h10.key, p = h10.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: Sc, object: Wi, source: k0, light: Hc, sky: Ac, terrain: Oc, projection: function(h10) {
const c = h10.value, p = h10.styleSpec, g = p.projection, w = h10.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] ? h10.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(h10) {
return D3(h10).length === 0 ? [] : Ts(h10);
}, resolvedImage: function(h10) {
return D3(h10).length === 0 ? [] : Ts(h10);
}, padding: function(h10) {
const c = h10.key, p = h10.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(h10.validateSpec({ key: `${c}[${H}]`, value: p[H], validateSpec: h10.validateSpec, valueSpec: g }));
return w;
}
return J4({ key: c, value: p, valueSpec: {} });
}, variableAnchorOffsetCollection: function(h10) {
const c = h10.key, p = h10.value, g = kt(p), w = h10.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: h10.validateSpec, style: h10.style, styleSpec: w }));
return H;
}, sprite: Cc };
function t62(h10) {
const c = h10.value, p = h10.valueSpec, g = h10.styleSpec;
return h10.validateSpec = t62, p.expression && ne(Dn(c)) ? Gs(h10) : p.expression && yi(O1(c)) ? Ts(h10) : p.type && Sl[p.type] ? Sl[p.type](h10) : Wi(bi({}, h10, { valueSpec: p.type ? g[p.type] : p }));
}
function Qp(h10) {
const c = h10.value, p = h10.key, g = D3(h10);
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(h10, c = Ct) {
let p = [];
return p = p.concat(t62({ key: "", value: h10, valueSpec: c.$root, styleSpec: c, style: h10, validateSpec: t62, objectElementValidators: { glyphs: Qp, "*": () => [] } })), h10.constants && (p = p.concat(H2({ key: "constants", value: h10.constants, style: h10, styleSpec: c, validateSpec: t62 }))), kc(p);
}
function fs(h10) {
return function(c) {
return h10({ ...c, validateSpec: t62 });
};
}
function kc(h10) {
return [].concat(h10).sort((c, p) => c.line - p.line);
}
function A2(h10) {
return function(...c) {
return kc(h10.apply(this, c));
};
}
r2.source = A2(fs(k0)), r2.sprite = A2(fs(Cc)), r2.glyphs = A2(fs(Qp)), r2.light = A2(fs(Hc)), r2.sky = A2(fs(Ac)), r2.terrain = A2(fs(Oc)), r2.layer = A2(fs(Sc)), r2.filter = A2(fs(wa)), r2.paintProperty = A2(fs($s)), r2.layoutProperty = A2(fs(Mc));
const F3 = r2, f_ = F3.light, Q_ = F3.sky, mp = F3.paintProperty, gp = F3.layoutProperty;
function Ic(h10, c) {
let p = false;
if (c && c.length)
for (const g of c)
h10.fire(new $e(new Error(g.message))), p = true;
return p;
}
class e6 {
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] = true, A.push(W[at])) : C[at] = false;
}
}
}
}
_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 e6(c.buffer);
}
}
const n2 = {};
function nr(h10, c, p = {}) {
if (n2[h10])
throw new Error(`${h10} is already registered.`);
Object.defineProperty(c, "_classRegistryKey", { value: h10, writeable: false }), n2[h10] = { klass: c, omit: p.omit || [], shallow: p.shallow || [] };
}
nr("Object", Object), nr("TransferableGridIndex", e6), 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 h10 in Co)
Co[h10]._classRegistryKey || nr(`Expression_${h10}`, Co[h10]);
function Hl(h10) {
return h10 && typeof ArrayBuffer < "u" && (h10 instanceof ArrayBuffer || h10.constructor && h10.constructor.name === "ArrayBuffer");
}
function Pc(h10) {
return h10.$name || h10.constructor._classRegistryKey;
}
function yp(h10) {
return !function(c) {
if (c === null || typeof c != "object")
return false;
const p = Pc(c);
return !(!p || p === "Object");
}(h10) && (h10 == null || typeof h10 == "boolean" || typeof h10 == "number" || typeof h10 == "string" || h10 instanceof Boolean || h10 instanceof Number || h10 instanceof String || h10 instanceof Date || h10 instanceof RegExp || h10 instanceof Blob || h10 instanceof Error || Hl(h10) || Ve(h10) || ArrayBuffer.isView(h10) || h10 instanceof ImageData);
}
function r6(h10, c) {
if (yp(h10))
return (Hl(h10) || Ve(h10)) && c && c.push(h10), ArrayBuffer.isView(h10) && c && c.push(h10.buffer), h10 instanceof ImageData && c && c.push(h10.data.buffer), h10;
if (Array.isArray(h10)) {
const H = [];
for (const A of h10)
H.push(r6(A, c));
return H;
}
if (typeof h10 != "object")
throw new Error("can't serialize object of type " + typeof h10);
const p = Pc(h10);
if (!p)
throw new Error(`can't serialize object of unregistered class ${h10.constructor.name}`);
if (!n2[p])
throw new Error(`${p} is not registered.`);
const { klass: g } = n2[p], w = g.serialize ? g.serialize(h10, 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 h10) {
if (!h10.hasOwnProperty(H) || n2[p].omit.indexOf(H) >= 0)
continue;
const A = h10[H];
w[H] = n2[p].shallow.indexOf(H) >= 0 ? A : r6(A, c);
}
h10 instanceof Error && (w.message = h10.message);
}
if (w.$name)
throw new Error("$name property is reserved for worker serialization logic.");
return p !== "Object" && (w.$name = p), w;
}
function n6(h10) {
if (yp(h10))
return h10;
if (Array.isArray(h10))
return h10.map(n6);
if (typeof h10 != "object")
throw new Error("can't deserialize object of type " + typeof h10);
const c = Pc(h10) || "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(h10);
const g = Object.create(p.prototype);
for (const w of Object.keys(h10)) {
if (w === "$name")
continue;
const H = h10[w];
g[w] = n2[c].shallow.indexOf(w) >= 0 ? H : n6(H);
}
return g;
}
class Vc {
constructor() {
this.first = true;
}
update(c, p) {
const g = Math.floor(c);
return this.first ? (this.first = false, this.lastIntegerZoom = g, this.lastIntegerZoomTime = 0, this.lastZoom = c, this.lastFloorZoom = g, true) : (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, true));
}
}
const sn = { "Latin-1 Supplement": (h10) => h10 >= 128 && h10 <= 255, "Hangul Jamo": (h10) => h10 >= 4352 && h10 <= 4607, Khmer: (h10) => h10 >= 6016 && h10 <= 6143, "General Punctuation": (h10) => h10 >= 8192 && h10 <= 8303, "Letterlike Symbols": (h10) => h10 >= 8448 && h10 <= 8527, "Number Forms": (h10) => h10 >= 8528 && h10 <= 8591, "Miscellaneous Technical": (h10) => h10 >= 8960 && h10 <= 9215, "Control Pictures": (h10) => h10 >= 9216 && h10 <= 9279, "Optical Character Recognition": (h10) => h10 >= 9280 && h10 <= 9311, "Enclosed Alphanumerics": (h10) => h10 >= 9312 && h10 <= 9471, "Geometric Shapes": (h10) => h10 >= 9632 && h10 <= 9727, "Miscellaneous Symbols": (h10) => h10 >= 9728 && h10 <= 9983, "Miscellaneous Symbols and Arrows": (h10) => h10 >= 11008 && h10 <= 11263, "Ideographic Description Characters": (h10) => h10 >= 12272 && h10 <= 12287, "CJK Symbols and Punctuation": (h10) => h10 >= 12288 && h10 <= 12351, Katakana: (h10) => h10 >= 12448 && h10 <= 12543, Kanbun: (h10) => h10 >= 12688 && h10 <= 12703, "CJK Strokes": (h10) => h10 >= 12736 && h10 <= 12783, "Enclosed CJK Letters and Months": (h10) => h10 >= 12800 && h10 <= 13055, "CJK Compatibility": (h10) => h10 >= 13056 && h10 <= 13311, "Yijing Hexagram Symbols": (h10) => h10 >= 19904 && h10 <= 19967, "Private Use Area": (h10) => h10 >= 57344 && h10 <= 63743, "Vertical Forms": (h10) => h10 >= 65040 && h10 <= 65055, "CJK Compatibility Forms": (h10) => h10 >= 65072 && h10 <= 65103, "Small Form Variants": (h10) => h10 >= 65104 && h10 <= 65135, "Halfwidth and Fullwidth Forms": (h10) => h10 >= 65280 && h10 <= 65519 };
function Rc(h10) {
for (const c of h10)
if (Dc(c.charCodeAt(0)))
return true;
return false;
}
function m_(h10) {
for (const c of h10)
if (!i6(c.charCodeAt(0)))
return false;
return true;
}
function Nc(h10) {
const c = h10.map((p) => {
try {
return new RegExp(`\\p{sc=${p}}`, "u").source;
} catch {
return null;
}
}).filter((p) => p);
return new RegExp(c.join("|"), "u");
}
const g_ = Nc(["Arab", "Dupl", "Mong", "Ougr", "Syrc"]);
function i6(h10) {
return !g_.test(String.fromCodePoint(h10));
}
const vp = Nc(["Bopo", "Hani", "Hira", "Kana", "Kits", "Nshu", "Tang", "Yiii"]);
function Dc(h10) {
return !(h10 !== 746 && h10 !== 747 && (h10 < 4352 || !(sn["CJK Compatibility Forms"](h10) && !(h10 >= 65097 && h10 <= 65103) || sn["CJK Compatibility"](h10) || sn["CJK Strokes"](h10) || !(!sn["CJK Symbols and Punctuation"](h10) || h10 >= 12296 && h10 <= 12305 || h10 >= 12308 && h10 <= 12319 || h10 === 12336) || sn["Enclosed CJK Letters and Months"](h10) || sn["Ideographic Description Characters"](h10) || sn.Kanbun(h10) || sn.Katakana(h10) && h10 !== 12540 || !(!sn["Halfwidth and Fullwidth Forms"](h10) || h10 === 65288 || h10 === 65289 || h10 === 65293 || h10 >= 65306 && h10 <= 65310 || h10 === 65339 || h10 === 65341 || h10 === 65343 || h10 >= 65371 && h10 <= 65503 || h10 === 65507 || h10 >= 65512 && h10 <= 65519) || !(!sn["Small Form Variants"](h10) || h10 >= 65112 && h10 <= 65118 || h10 >= 65123 && h10 <= 65126) || sn["Vertical Forms"](h10) || sn["Yijing Hexagram Symbols"](h10) || new RegExp("\\p{sc=Cans}", "u").test(String.fromCodePoint(h10)) || new RegExp("\\p{sc=Hang}", "u").test(String.fromCodePoint(h10)) || vp.test(String.fromCodePoint(h10)))));
}
function _p(h10) {
return !(Dc(h10) || 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);
}(h10));
}
const y_ = Nc(["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 Fc(h10) {
return y_.test(String.fromCodePoint(h10));
}
function v_(h10, c) {
return !(!c && Fc(h10) || h10 >= 2304 && h10 <= 3583 || h10 >= 3840 && h10 <= 4255 || sn.Khmer(h10));
}
function __(h10) {
for (const c of h10)
if (Fc(c.charCodeAt(0)))
return true;
return false;
}
const Vo = new class {
constructor() {
this.applyArabicShaping = null, this.processBidirectionalText = null, this.processStyledBidirectionalText = null, this.pluginStatus = "unavailable", this.pluginURL = null;
}
setState(h10) {
this.pluginStatus = h10.pluginStatus, this.pluginURL = h10.pluginURL;
}
getState() {
return { pluginStatus: this.pluginStatus, pluginURL: this.pluginURL };
}
setMethods(h10) {
this.applyArabicShaping = h10.applyArabicShaping, this.processBidirectionalText = h10.processBidirectionalText, this.processStyledBidirectionalText = h10.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 Vc(), this.transition = {});
}
isSupportedScript(c) {
return function(p, g) {
for (const w of p)
if (!v_(w.charCodeAt(0), g))
return false;
return true;
}(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 o6 {
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 Al {
constructor(c) {
this.property = c, this.value = new o6(c, void 0);
}
transitioned(c, p) {
return new bp(this.property, this.value, p, $({}, c.transition, this.transition), c.now);
}
untransitioned() {
return new bp(this.property, this.value, null, {}, 0);
}
}
class Ol {
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 Al(this._values[c].property)), this._values[c].value = new o6(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 Al(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 I0(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 I0(this._properties);
for (const p of Object.keys(this._values))
c._values[p] = this._values[p].untransitioned();
return c;
}
}
class bp {
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 I0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitioningPropertyValues);
}
possiblyEvaluate(c, p, g) {
const w = new V0(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 true;
return false;
}
}
class P0 {
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 o6(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 V0(this._properties);
for (const H of Object.keys(this._values))
w._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return w;
}
}
class Qs {
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 V0 {
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 Qs(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 Qs(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 Qs(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 Cl extends Mr {
possiblyEvaluate(c, p, g, w) {
if (c.value === void 0)
return new Qs(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 Qs(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 Qs(this, { kind: "constant", value: H }, p);
}
return new Qs(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 kl {
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 Bc {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, w) {
return !!c.expression.evaluate(p, null, {}, g, w);
}
interpolate() {
return false;
}
}
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 o6(g, void 0), H = this.defaultTransitionablePropertyValues[p] = new Al(g);
this.defaultTransitioningPropertyValues[p] = H.untransitioned(), this.defaultPossiblyEvaluatedValues[p] = w.possiblyEvaluate({});
}
}
}
nr("DataDrivenProperty", Mr), nr("DataConstantProperty", cr), nr("CrossFadedDataDrivenProperty", Cl), nr("CrossFadedProperty", kl), nr("ColorRampProperty", Bc);
const l = "-transition";
class m extends ar {
constructor(c, p) {
if (super(), this.id = c.id, this.type = c.type, this._featureFilter = { filter: () => true, needGeometry: false }, 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 P0(p.layout)), p.paint)) {
this._transitionablePaint = new Ol(p.paint);
for (const g in c.paint)
this.setPaintProperty(g, c.paint[g], { validate: false });
for (const g in c.layout)
this.setLayoutProperty(g, c.layout[g], { validate: false });
this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new V0(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(gp, `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(mp, `layers.${this.id}.paint.${c}`, c, p, g))
return false;
if (c.endsWith(l))
return this._transitionablePaint.setTransition(c.slice(0, -11), p || void 0), false;
{
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 false;
}
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 !== false) && Ic(this, c.call(F3, { key: p, layerType: this.type, objectKey: g, value: w, styleSpec: Ct, style: { glyphs: true, sprite: true } }));
}
is3D() {
return false;
}
isTileClipped() {
return false;
}
hasOffscreenPass() {
return false;
}
resize() {
}
isStateDependent() {
for (const c in this.paint._values) {
const p = this.paint.get(c);
if (p instanceof Qs && t22(p.property.specification) && (p.value.kind === "source" || p.value.kind === "composite") && p.value.isStateDependent)
return true;
}
return false;
}
}
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 = false, this.capacity = -1, this.resize(0);
}
static serialize(c, p) {
return c._trim(), p && (c.isTransferred = true, 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(h10, c = 1) {
let p = 0, g = 0;
return { members: h10.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(h10, c) {
return Math.ceil(h10 / 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 ms extends j {
}
class s6 extends J {
}
class Il extends lt {
}
class a6 extends ft {
}
class i2 extends Qt {
}
class Pl extends wt {
}
class jc 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(h10, c) {
return 256 * (h10 = F(Math.floor(h10), 0, 255)) + F(Math.floor(c), 0, 255);
}
an.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, nr("SegmentVector", an);
const l6 = 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 c6 = { exports: {} }, Lp = { exports: {} };
Lp.exports = function(h10, c) {
var p, g, w, H, A, C, N, z;
for (g = h10.length - (p = 3 & h10.length), w = c, A = 3432918353, C = 461845907, z = 0; z < g; )
N = 255 & h10.charCodeAt(z) | (255 & h10.charCodeAt(++z)) << 8 | (255 & h10.charCodeAt(++z)) << 16 | (255 & h10.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 & h10.charCodeAt(z + 2)) << 16;
case 2:
N ^= (255 & h10.charCodeAt(z + 1)) << 8;
case 1:
w ^= N = (65535 & (N = (N = (65535 & (N ^= 255 & h10.charCodeAt(z))) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * C + (((N >>> 16) * C & 65535) << 16) & 4294967295;
}
return w ^= h10.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 b_ = Lp.exports, wp = { exports: {} };
wp.exports = function(h10, c) {
for (var p, g = h10.length, w = c ^ g, H = 0; g >= 4; )
p = 1540483477 * (65535 & (p = 255 & h10.charCodeAt(H) | (255 & h10.charCodeAt(++H)) << 8 | (255 & h10.charCodeAt(++H)) << 16 | (255 & h10.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 & h10.charCodeAt(H + 2)) << 16;
case 2:
w ^= (255 & h10.charCodeAt(H + 1)) << 8;
case 1:
w = 1540483477 * (65535 & (w ^= 255 & h10.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 = b_, xp = wp.exports;
c6.exports = Ma, c6.exports.murmur3 = Ma, c6.exports.murmur2 = xp;
var Vl = u(c6.exports);
class R0 {
constructor() {
this.ids = [], this.positions = [], this.indexed = false;
}
add(c, p, g, w) {
this.ids.push(Rl(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 = Rl(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 Nl(g, w, 0, g.length - 1), p && p.push(g.buffer, w.buffer), { ids: g, positions: w };
}
static deserialize(c) {
const p = new R0();
return p.ids = c.ids, p.positions = c.positions, p.indexed = true, p;
}
}
function Rl(h10) {
const c = +h10;
return !isNaN(c) && c <= Number.MAX_SAFE_INTEGER ? c : Vl(String(h10));
}
function Nl(h10, c, p, g) {
for (; p < g; ) {
const w = h10[p + g >> 1];
let H = p - 1, A = g + 1;
for (; ; ) {
do
H++;
while (h10[H] < w);
do
A--;
while (h10[A] > w);
if (H >= A)
break;
u6(h10, H, A), u6(c, 3 * H, 3 * A), u6(c, 3 * H + 1, 3 * A + 1), u6(c, 3 * H + 2, 3 * A + 2);
}
A - p < g - A ? (Nl(h10, c, p, A), p = A + 1) : (Nl(h10, c, A + 1, g), g = A);
}
}
function u6(h10, c, p) {
const g = h10[c];
h10[c] = h10[p], h10[p] = g;
}
nr("FeaturePositionMap", R0);
class N0 {
constructor(c, p) {
this.gl = c.gl, this.location = p;
}
}
class Ep extends N0 {
constructor(c, p) {
super(c, p), this.current = 0;
}
set(c) {
this.current !== c && (this.current = c, this.gl.uniform1f(this.location, c));
}
}
class MO extends N0 {
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 SO extends N0 {
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 yJ = new Float32Array(16);
function L_(h10) {
return [B3(255 * h10.r, 255 * h10.g), B3(255 * h10.b, 255 * h10.a)];
}
class zc {
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 SO(c, p) : new Ep(c, p);
}
}
class Dl {
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 MO(c, p) : new Ep(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 = L_(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 = L_(g), A = L_(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 Ep(c, p);
}
}
class h6 {
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, l6.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = c.createVertexBuffer(this.zoomOutPaintVertexArray, l6.members, this.expression.isStateDependent));
}
destroy() {
this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
}
}
class HO {
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 Qs && t22(A.property.specification)))
continue;
const C = vJ(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 Dl(N.value, C) : new zc(N.value, C, z), w.push(`/u_${H}`);
else if (N.kind === "source" || tt) {
const at = AO(H, z, "source");
this.binders[H] = tt ? new h6(N, z, W, p, at, c.id) : new j3(N, C, z, at), w.push(`/a_${H}`);
} else {
const at = AO(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 h6) && C.populatePaintArray(c, p, g, w, H);
}
}
setConstantPatternPositions(c, p) {
for (const g in this.binders) {
const w = this.binders[g];
w instanceof Dl && w.setConstantPatternPositions(c, p);
}
}
updatePaintArrays(c, p, g, w, H) {
let A = false;
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 h6) && tt.expression.isStateDependent === true) {
const at = w.paint.get(X);
tt.expression = at.value, tt.updatePaintArray(z.start, z.end, W, c[C], H), A = true;
}
}
}
}
return A;
}
defines() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
(g instanceof zc || g instanceof Dl) && 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 h6)
for (let w = 0; w < l6.members.length; w++)
c.push(l6.members[w].name);
}
return c;
}
getBinderUniforms() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof zc || g instanceof Dl || 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 zc || H instanceof Dl || 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 h6) {
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 h6) && 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 h6) && p.destroy();
}
}
}
class D0 {
constructor(c, p, g = () => true) {
this.programConfigurations = {};
for (const w of c)
this.programConfigurations[w.id] = new HO(w, p, g);
this.needsUpload = false, this._featureMap = new R0(), 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 = true;
}
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 = false;
}
}
destroy() {
for (const c in this.programConfigurations)
this.programConfigurations[c].destroy();
}
}
function vJ(h10, 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"] }[h10] || [h10.replace(`${c}-`, "").replace(/-/g, "_")];
}
function AO(h10, 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];
}(h10);
return w && w[p] || g[c][p];
}
nr("ConstantBinder", zc), nr("CrossFadedConstantBinder", Dl), nr("SourceExpressionBinder", j3), nr("CrossFadedCompositeBinder", h6), nr("CompositeExpressionBinder", Ws), nr("ProgramConfiguration", HO, { omit: ["_buffers"] }), nr("ProgramConfigurationSet", D0);
const Zi = 8192, w_ = Math.pow(2, 14) - 1, OO = -w_ - 1;
function F0(h10) {
const c = Zi / h10.extent, p = h10.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, OO, w_), A.y = F(N, OO, w_), (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 B0(h10, c) {
return { type: h10.type, id: h10.id, properties: h10.properties, geometry: c ? F0(h10) : [] };
}
function Mp(h10, c, p, g, w) {
h10.emplaceBack(2 * c + (g + 1) / 2, 2 * p + (w + 1) / 2);
}
class x_ {
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 = false, this.layoutVertexArray = new X1(), this.indexArray = new C2(), this.segments = new an(), this.programConfigurations = new D0(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 = false;
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 = B0(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 : F0(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 = true;
}
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;
Mp(this.layoutVertexArray, C, N, -1, -1), Mp(this.layoutVertexArray, C, N, 1, -1), Mp(this.layoutVertexArray, C, N, 1, 1), Mp(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 CO(h10, c) {
for (let p = 0; p < h10.length; p++)
if (Fl(c, h10[p]))
return true;
for (let p = 0; p < c.length; p++)
if (Fl(h10, c[p]))
return true;
return !!E_(h10, c);
}
function _J(h10, c, p) {
return !!Fl(h10, c) || !!M_(c, h10, p);
}
function kO(h10, c) {
if (h10.length === 1)
return PO(c, h10[0]);
for (let p = 0; p < c.length; p++) {
const g = c[p];
for (let w = 0; w < g.length; w++)
if (Fl(h10, g[w]))
return true;
}
for (let p = 0; p < h10.length; p++)
if (PO(c, h10[p]))
return true;
for (let p = 0; p < c.length; p++)
if (E_(h10, c[p]))
return true;
return false;
}
function bJ(h10, c, p) {
if (h10.length > 1) {
if (E_(h10, c))
return true;
for (let g = 0; g < c.length; g++)
if (M_(c[g], h10, p))
return true;
}
for (let g = 0; g < h10.length; g++)
if (M_(h10[g], c, p))
return true;
return false;
}
function E_(h10, c) {
if (h10.length === 0 || c.length === 0)
return false;
for (let p = 0; p < h10.length - 1; p++) {
const g = h10[p], w = h10[p + 1];
for (let H = 0; H < c.length - 1; H++)
if (LJ(g, w, c[H], c[H + 1]))
return true;
}
return false;
}
function LJ(h10, c, p, g) {
return Zt(h10, p, g) !== Zt(c, p, g) && Zt(h10, c, p) !== Zt(h10, c, g);
}
function M_(h10, c, p) {
const g = p * p;
if (c.length === 1)
return h10.distSqr(c[0]) < g;
for (let w = 1; w < c.length; w++)
if (IO(h10, c[w - 1], c[w]) < g)
return true;
return false;
}
function IO(h10, c, p) {
const g = c.distSqr(p);
if (g === 0)
return h10.distSqr(c);
const w = ((h10.x - c.x) * (p.x - c.x) + (h10.y - c.y) * (p.y - c.y)) / g;
return h10.distSqr(w < 0 ? c : w > 1 ? p : p.sub(c)._mult(w)._add(c));
}
function PO(h10, c) {
let p, g, w, H = false;
for (let A = 0; A < h10.length; A++) {
p = h10[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 Fl(h10, c) {
let p = false;
for (let g = 0, w = h10.length - 1; g < h10.length; w = g++) {
const H = h10[g], A = h10[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 wJ(h10, c, p) {
const g = p[0], w = p[2];
if (h10.x < g.x && c.x < g.x || h10.x > w.x && c.x > w.x || h10.y < g.y && c.y < g.y || h10.y > w.y && c.y > w.y)
return false;
const H = Zt(h10, c, p[0]);
return H !== Zt(h10, c, p[1]) || H !== Zt(h10, c, p[2]) || H !== Zt(h10, c, p[3]);
}
function Uc(h10, c, p) {
const g = c.paint.get(h10).value;
return g.kind === "constant" ? g.value : p.programConfigurations.get(c.id).getMaxValue(h10);
}
function Sp(h10) {
return Math.sqrt(h10[0] * h10[0] + h10[1] * h10[1]);
}
function Hp(h10, c, p, g, w) {
if (!c[0] && !c[1])
return h10;
const H = f.convert(c)._mult(w);
p === "viewport" && H._rotate(-g);
const A = [];
for (let C = 0; C < h10.length; C++)
A.push(h10[C].sub(H));
return A;
}
let VO, RO;
nr("CircleBucket", x_, { omit: ["layers"] });
var xJ = { get paint() {
return RO = RO || 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 VO = VO || new S({ "circle-sort-key": new Mr(Ct.layout_circle["circle-sort-key"]) });
} }, go = 1e-6, Bl = typeof Float32Array < "u" ? Float32Array : Array;
function S_(h10) {
return h10[0] = 1, h10[1] = 0, h10[2] = 0, h10[3] = 0, h10[4] = 0, h10[5] = 1, h10[6] = 0, h10[7] = 0, h10[8] = 0, h10[9] = 0, h10[10] = 1, h10[11] = 0, h10[12] = 0, h10[13] = 0, h10[14] = 0, h10[15] = 1, h10;
}
function NO(h10, 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 h10[0] = Pt * g + Bt * C + ee * X + _e * Tt, h10[1] = Pt * w + Bt * N + ee * tt + _e * Lt, h10[2] = Pt * H + Bt * z + ee * at + _e * Et, h10[3] = Pt * A + Bt * W + ee * ut + _e * $t, h10[4] = (Pt = p[4]) * g + (Bt = p[5]) * C + (ee = p[6]) * X + (_e = p[7]) * Tt, h10[5] = Pt * w + Bt * N + ee * tt + _e * Lt, h10[6] = Pt * H + Bt * z + ee * at + _e * Et, h10[7] = Pt * A + Bt * W + ee * ut + _e * $t, h10[8] = (Pt = p[8]) * g + (Bt = p[9]) * C + (ee = p[10]) * X + (_e = p[11]) * Tt, h10[9] = Pt * w + Bt * N + ee * tt + _e * Lt, h10[10] = Pt * H + Bt * z + ee * at + _e * Et, h10[11] = Pt * A + Bt * W + ee * ut + _e * $t, h10[12] = (Pt = p[12]) * g + (Bt = p[13]) * C + (ee = p[14]) * X + (_e = p[15]) * Tt, h10[13] = Pt * w + Bt * N + ee * tt + _e * Lt, h10[14] = Pt * H + Bt * z + ee * at + _e * Et, h10[15] = Pt * A + Bt * W + ee * ut + _e * $t, h10;
}
Math.hypot || (Math.hypot = function() {
for (var h10 = 0, c = arguments.length; c--; )
h10 += arguments[c] * arguments[c];
return Math.sqrt(h10);
});
var Gc, EJ = NO;
function Ap(h10, c, p) {
var g = c[0], w = c[1], H = c[2], A = c[3];
return h10[0] = p[0] * g + p[4] * w + p[8] * H + p[12] * A, h10[1] = p[1] * g + p[5] * w + p[9] * H + p[13] * A, h10[2] = p[2] * g + p[6] * w + p[10] * H + p[14] * A, h10[3] = p[3] * g + p[7] * w + p[11] * H + p[15] * A, h10;
}
Gc = new Bl(4), Bl != Float32Array && (Gc[0] = 0, Gc[1] = 0, Gc[2] = 0, Gc[3] = 0);
class MJ extends m {
constructor(c) {
super(c, xJ);
}
createBucket(c) {
return new x_(c);
}
queryRadius(c) {
const p = c;
return Uc("circle-radius", this, p) + Uc("circle-stroke-width", this, p) + Sp(this.paint.get("circle-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Hp(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) => DO(Lt, Tt));
}(z, N), at = X ? W * C : W;
for (const ut of w)
for (const Tt of ut) {
const Lt = X ? Tt : DO(Tt, N);
let Et = at;
const $t = Ap([], [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]), _J(tt, Lt, Et))
return true;
}
return false;
}
}
function DO(h10, c) {
const p = Ap([], [h10.x, h10.y, 0, 1], c);
return new f(p[0] / p[3], p[1] / p[3]);
}
class FO extends x_ {
}
let BO;
nr("HeatmapBucket", FO, { omit: ["layers"] });
var SJ = { get paint() {
return BO = BO || 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 Bc(Ct.paint_heatmap["heatmap-color"]), "heatmap-opacity": new cr(Ct.paint_heatmap["heatmap-opacity"]) });
} };
function H_(h10, { 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 h10.width = c, h10.height = p, h10.data = w, h10;
}
function jO(h10, { width: c, height: p }, g) {
if (c === h10.width && p === h10.height)
return;
const w = H_({}, { width: c, height: p }, g);
A_(h10, w, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(h10.width, c), height: Math.min(h10.height, p) }, g), h10.width = c, h10.height = p, h10.data = w.data;
}
function A_(h10, c, p, g, w, H) {
if (w.width === 0 || w.height === 0)
return c;
if (w.width > h10.width || w.height > h10.height || p.x > h10.width - w.width || p.y > h10.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 = h10.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) * h10.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 $c {
constructor(c, p) {
H_(this, c, 1, p);
}
resize(c) {
jO(this, c, 1);
}
clone() {
return new $c({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, w, H) {
A_(c, p, g, w, H, 1);
}
}
class k2 {
constructor(c, p) {
H_(this, c, 4, p);
}
resize(c) {
jO(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) {
A_(c, p, g, w, H, 4);
}
}
function zO(h10) {
const c = {}, p = h10.resolution || 256, g = h10.clips ? h10.clips.length : 1, w = h10.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[h10.evaluationKey] = N;
const z = h10.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 (h10.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 } = h10.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", $c), nr("RGBAImage", k2);
const O_ = "big-fb";
class HJ extends m {
createBucket(c) {
return new FO(c);
}
constructor(c) {
super(c, SJ), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();
}
_handleSpecialPaintPropertyUpdate(c) {
c === "heatmap-color" && this._updateColorRamp();
}
_updateColorRamp() {
this.colorRamp = zO({ expression: this._transitionablePaint._values["heatmap-color"].value.expression, evaluationKey: "heatmapDensity", image: this.colorRamp }), this.colorRampTexture = null;
}
resize() {
this.heatmapFbos.has(O_) && this.heatmapFbos.delete(O_);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
return false;
}
hasOffscreenPass() {
return this.paint.get("heatmap-opacity") !== 0 && this.visibility !== "none";
}
}
let UO;
var AJ = { get paint() {
return UO = UO || 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 OJ extends m {
constructor(c) {
super(c, AJ);
}
hasOffscreenPass() {
return this.paint.get("hillshade-exaggeration") !== 0 && this.visibility !== "none";
}
}
const CJ = V([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: kJ } = CJ;
function GO(h10, c, p = 2) {
const g = c && c.length, w = g ? c[0] * p : h10.length;
let H = $O(h10, 0, w, p, true);
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 = $O(W, X[Tt] * at, Tt < Lt - 1 ? X[Tt + 1] * at : W.length, at, false);
Et === Et.next && (Et.steiner = true), ut.push(BJ(Et));
}
ut.sort(NJ);
for (let Tt = 0; Tt < ut.length; Tt++)
tt = DJ(ut[Tt], tt);
return tt;
}(h10, c, H, p)), h10.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 = h10[tt], ut = h10[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 Wc(H, A, p, C, N, z, 0), A;
}
function $O(h10, 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;
}(h10, c, p, g) > 0)
for (let A = c; A < p; A += g)
H = qO(A / g | 0, h10[A], h10[A + 1], H);
else
for (let A = p - g; A >= c; A -= g)
H = qO(A / g | 0, h10[A], h10[A + 1], H);
return H && Op(H, H.next) && (qc(H), H = H.next), H;
}
function j0(h10, c) {
if (!h10)
return h10;
c || (c = h10);
let p, g = h10;
do
if (p = false, g.steiner || !Op(g, g.next) && Di(g.prev, g, g.next) !== 0)
g = g.next;
else {
if (qc(g), g = c = g.prev, g === g.next)
break;
p = true;
}
while (p || g !== c);
return c;
}
function Wc(h10, c, p, g, w, H, A) {
if (!h10)
return;
!A && H && function(N, z, W, X) {
let tt = N;
do
tt.z === 0 && (tt.z = C_(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);
}(h10, g, w, H);
let C = h10;
for (; h10.prev !== h10.next; ) {
const N = h10.prev, z = h10.next;
if (H ? PJ(h10, g, w, H) : IJ(h10))
c.push(N.i, h10.i, z.i), qc(h10), h10 = z.next, C = z.next;
else if ((h10 = z) === C) {
A ? A === 1 ? Wc(h10 = VJ(j0(h10), c), c, p, g, w, H, 2) : A === 2 && RJ(h10, c, p, g, w, H) : Wc(j0(h10), c, p, g, w, H, 1);
break;
}
}
}
function IJ(h10) {
const c = h10.prev, p = h10, g = h10.next;
if (Di(c, p, g) >= 0)
return false;
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 && jl(w, C, H, N, A, z, ut.x, ut.y) && Di(ut.prev, ut, ut.next) >= 0)
return false;
ut = ut.next;
}
return true;
}
function PJ(h10, c, p, g) {
const w = h10.prev, H = h10, A = h10.next;
if (Di(w, H, A) >= 0)
return false;
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 = C_(at, ut, c, p, g), $t = C_(Tt, Lt, c, p, g);
let Pt = h10.prevZ, Bt = h10.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 && jl(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 && jl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0))
return false;
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 && jl(C, W, N, X, z, tt, Pt.x, Pt.y) && Di(Pt.prev, Pt, Pt.next) >= 0)
return false;
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 && jl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0)
return false;
Bt = Bt.nextZ;
}
return true;
}
function VJ(h10, c) {
let p = h10;
do {
const g = p.prev, w = p.next.next;
!Op(g, w) && WO(g, p, p.next, w) && Zc(g, w) && Zc(w, g) && (c.push(g.i, p.i, w.i), qc(p), qc(p.next), p = h10 = w), p = p.next;
} while (p !== h10);
return j0(p);
}
function RJ(h10, c, p, g, w, H) {
let A = h10;
do {
let C = A.next.next;
for (; C !== A.prev; ) {
if (A.i !== C.i && jJ(A, C)) {
let N = ZO(A, C);
return A = j0(A, A.next), N = j0(N, N.next), Wc(A, c, p, g, w, H, 0), void Wc(N, c, p, g, w, H, 0);
}
C = C.next;
}
A = A.next;
} while (A !== h10);
}
function NJ(h10, c) {
return h10.x - c.x;
}
function DJ(h10, 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 && jl(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);
Zc(A, w) && (Tt < ut || Tt === ut && (A.x > z.x || A.x === z.x && FJ(z, A))) && (z = A, ut = Tt);
}
A = A.next;
} while (A !== X);
return z;
}(h10, c);
if (!p)
return c;
const g = ZO(p, h10);
return j0(g, g.next), j0(p, p.next);
}
function FJ(h10, c) {
return Di(h10.prev, h10, c.prev) < 0 && Di(c.next, h10, h10.next) < 0;
}
function C_(h10, c, p, g, w) {
return (h10 = 1431655765 & ((h10 = 858993459 & ((h10 = 252645135 & ((h10 = 16711935 & ((h10 = (h10 - p) * w | 0) | h10 << 8)) | h10 << 4)) | h10 << 2)) | h10 << 1)) | (c = 1431655765 & ((c = 858993459 & ((c = 252645135 & ((c = 16711935 & ((c = (c - g) * w | 0) | c << 8)) | c << 4)) | c << 2)) | c << 1)) << 1;
}
function BJ(h10) {
let c = h10, p = h10;
do
(c.x < p.x || c.x === p.x && c.y < p.y) && (p = c), c = c.next;
while (c !== h10);
return p;
}
function jl(h10, c, p, g, w, H, A, C) {
return (w - A) * (c - C) >= (h10 - A) * (H - C) && (h10 - A) * (g - C) >= (p - A) * (c - C) && (p - A) * (H - C) >= (w - A) * (g - C);
}
function jJ(h10, c) {
return h10.next.i !== c.i && h10.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 && WO(w, w.next, p, g))
return true;
w = w.next;
} while (w !== p);
return false;
}(h10, c) && (Zc(h10, c) && Zc(c, h10) && function(p, g) {
let w = p, H = false;
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;
}(h10, c) && (Di(h10.prev, h10, c.prev) || Di(h10, c.prev, c)) || Op(h10, c) && Di(h10.prev, h10, h10.next) > 0 && Di(c.prev, c, c.next) > 0);
}
function Di(h10, c, p) {
return (c.y - h10.y) * (p.x - c.x) - (c.x - h10.x) * (p.y - c.y);
}
function Op(h10, c) {
return h10.x === c.x && h10.y === c.y;
}
function WO(h10, c, p, g) {
const w = kp(Di(h10, c, p)), H = kp(Di(h10, c, g)), A = kp(Di(p, g, h10)), C = kp(Di(p, g, c));
return w !== H && A !== C || !(w !== 0 || !Cp(h10, p, c)) || !(H !== 0 || !Cp(h10, g, c)) || !(A !== 0 || !Cp(p, h10, g)) || !(C !== 0 || !Cp(p, c, g));
}
function Cp(h10, c, p) {
return c.x <= Math.max(h10.x, p.x) && c.x >= Math.min(h10.x, p.x) && c.y <= Math.max(h10.y, p.y) && c.y >= Math.min(h10.y, p.y);
}
function kp(h10) {
return h10 > 0 ? 1 : h10 < 0 ? -1 : 0;
}
function Zc(h10, c) {
return Di(h10.prev, h10, h10.next) < 0 ? Di(h10, c, h10.next) >= 0 && Di(h10, h10.prev, c) >= 0 : Di(h10, c, h10.prev) < 0 || Di(h10, h10.next, c) < 0;
}
function ZO(h10, c) {
const p = k_(h10.i, h10.x, h10.y), g = k_(c.i, c.x, c.y), w = h10.next, H = c.prev;
return h10.next = c, c.prev = h10, p.next = w, w.prev = p, g.next = p, p.prev = g, H.next = g, g.prev = H, g;
}
function qO(h10, c, p, g) {
const w = k_(h10, 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 qc(h10) {
h10.next.prev = h10.prev, h10.prev.next = h10.next, h10.prevZ && (h10.prevZ.nextZ = h10.nextZ), h10.nextZ && (h10.nextZ.prevZ = h10.prevZ);
}
function k_(h10, c, p) {
return { i: h10, x: c, y: p, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: false };
}
function I_(h10, c, p) {
const g = p.patternDependencies;
let w = false;
for (const H of c) {
const A = H.paint.get(`${h10}-pattern`);
A.isConstant() || (w = true);
const C = A.constantOr(null);
C && (w = true, g[C.to] = true, g[C.from] = true);
}
return w;
}
function P_(h10, c, p, g, w) {
const H = w.patternDependencies;
for (const A of c) {
const C = A.paint.get(`${h10}-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] = true, H[z] = true, H[W] = true, p.patterns[A.id] = { min: N, mid: z, max: W };
}
}
return p;
}
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 = false, this.patternFeatures = [], this.layoutVertexArray = new ms(), this.indexArray = new C2(), this.indexArray2 = new b1(), this.programConfigurations = new D0(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 = I_("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 = B0(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 : F0(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 = P_("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, kJ), this.indexBuffer = c.createIndexBuffer(this.indexArray), this.indexBuffer2 = c.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(c), this.uploaded = true;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
}
addFeature(c, p, g, w, H) {
for (const A of U4(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 = GO(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 XO, KO;
nr("FillBucket", V_, { omit: ["layers", "patternFeatures"] });
var zJ = { get paint() {
return KO = KO || 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 Cl(Ct.paint_fill["fill-pattern"]) });
}, get layout() {
return XO = XO || new S({ "fill-sort-key": new Mr(Ct.layout_fill["fill-sort-key"]) });
} };
class UJ extends m {
constructor(c) {
super(c, zJ);
}
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 V_(c);
}
queryRadius() {
return Sp(this.paint.get("fill-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
return kO(Hp(c, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), A.angle, C), w);
}
isTileClipped() {
return true;
}
}
const GJ = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), $J = V([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: WJ } = GJ;
var d6 = {}, ZJ = d, YO = zl;
function zl(h10, c, p, g, w) {
this.properties = {}, this.extent = p, this.type = 0, this._pbf = h10, this._geometry = -1, this._keys = g, this._values = w, h10.readFields(qJ, this, c);
}
function qJ(h10, c, p) {
h10 == 1 ? c.id = p.readVarint() : h10 == 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) : h10 == 3 ? c.type = p.readVarint() : h10 == 4 && (c._geometry = p.pos);
}
function XJ(h10) {
for (var c, p, g = 0, w = 0, H = h10.length, A = H - 1; w < H; A = w++)
g += ((p = h10[A]).x - (c = h10[w]).x) * (c.y + p.y);
return g;
}
zl.types = ["Unknown", "Point", "LineString", "Polygon"], zl.prototype.loadGeometry = function() {
var h10 = this._pbf;
h10.pos = this._geometry;
for (var c, p = h10.readVarint() + h10.pos, g = 1, w = 0, H = 0, A = 0, C = []; h10.pos < p; ) {
if (w <= 0) {
var N = h10.readVarint();
g = 7 & N, w = N >> 3;
}
if (w--, g === 1 || g === 2)
H += h10.readSVarint(), A += h10.readSVarint(), g === 1 && (c && C.push(c), c = []), c.push(new ZJ(H, A));
else {
if (g !== 7)
throw new Error("unknown command " + g);
c && c.push(c[0].clone());
}
}
return c && C.push(c), C;
}, zl.prototype.bbox = function() {
var h10 = this._pbf;
h10.pos = this._geometry;
for (var c = h10.readVarint() + h10.pos, p = 1, g = 0, w = 0, H = 0, A = 1 / 0, C = -1 / 0, N = 1 / 0, z = -1 / 0; h10.pos < c; ) {
if (g <= 0) {
var W = h10.readVarint();
p = 7 & W, g = W >> 3;
}
if (g--, p === 1 || p === 2)
(w += h10.readSVarint()) < A && (A = w), w > C && (C = w), (H += h10.readSVarint()) < N && (N = H), H > z && (z = H);
else if (p !== 7)
throw new Error("unknown command " + p);
}
return [A, N, C, z];
}, zl.prototype.toGeoJSON = function(h10, c, p) {
var g, w, H = this.extent * Math.pow(2, p), A = this.extent * h10, C = this.extent * c, N = this.loadGeometry(), z = zl.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 = XJ(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 KJ = YO, JO = tC;
function tC(h10, c) {
this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = h10, this._keys = [], this._values = [], this._features = [], h10.readFields(YJ, this, c), this.length = this._features.length;
}
function YJ(h10, c, p) {
h10 === 15 ? c.version = p.readVarint() : h10 === 1 ? c.name = p.readString() : h10 === 5 ? c.extent = p.readVarint() : h10 === 2 ? c._features.push(p.pos) : h10 === 3 ? c._keys.push(p.readString()) : h10 === 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));
}
tC.prototype.feature = function(h10) {
if (h10 < 0 || h10 >= this._features.length)
throw new Error("feature index out of bounds");
this._pbf.pos = this._features[h10];
var c = this._pbf.readVarint() + this._pbf.pos;
return new KJ(this._pbf, c, this.extent, this._keys, this._values);
};
var JJ = JO;
function ttt(h10, c, p) {
if (h10 === 3) {
var g = new JJ(p, p.readVarint() + p.pos);
g.length && (c[g.name] = g);
}
}
d6.VectorTile = function(h10, c) {
this.layers = h10.readFields(ttt, {}, c);
}, d6.VectorTileFeature = YO, d6.VectorTileLayer = JO;
const ett = d6.VectorTileFeature.types, R_ = Math.pow(2, 13);
function Xc(h10, c, p, g, w, H, A, C) {
h10.emplaceBack(c, p, 2 * Math.floor(g * R_) + A, w * R_ * 2, H * R_ * 2, Math.round(C));
}
class N_ {
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 = false, this.layoutVertexArray = new s6(), this.centroidVertexArray = new k1(), this.indexArray = new C2(), this.programConfigurations = new D0(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 = I_("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 = B0(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 : F0(w), properties: w.properties, type: w.type, patterns: {} };
this.hasPattern ? this.features.push(P_("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, true);
}
}
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, WJ), this.centroidVertexBuffer = c.createVertexBuffer(this.centroidVertexArray, $J.members, true), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = true;
}
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 U4(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 || ntt(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 (!rtt(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), Xc(this.layoutVertexArray, Et.x, Et.y, Pt.x, Pt.y, 0, 0, Tt), Xc(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, Xc(this.layoutVertexArray, $t.x, $t.y, Pt.x, Pt.y, 0, 0, Tt), Xc(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)), ett[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];
Xc(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 = GO(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 rtt(h10, c) {
return h10.x === c.x && (h10.x < 0 || h10.x > Zi) || h10.y === c.y && (h10.y < 0 || h10.y > Zi);
}
function ntt(h10) {
return h10.every((c) => c.x < 0) || h10.every((c) => c.x > Zi) || h10.every((c) => c.y < 0) || h10.every((c) => c.y > Zi);
}
let eC;
nr("FillExtrusionBucket", N_, { omit: ["layers", "features"] });
var itt = { get paint() {
return eC = eC || 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 Cl(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 ott extends m {
constructor(c) {
super(c, itt);
}
createBucket(c) {
return new N_(c);
}
queryRadius() {
return Sp(this.paint.get("fill-extrusion-translate"));
}
is3D() {
return true;
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Hp(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];
Ap(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], gs = Et[3] * pr + Et[7] * Ir + Et[15], V1 = p1 + _e, T1 = gs + Xe, yo = Fn + Er, vo = Pn + ze, _o = p1 + Re, Oi = gs + 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;
kO(Lt, Tt) && (Et = rC(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];
CO(Lt, Xe) && (Et = Math.min(Et, rC(Lt, Xe)));
}
}
return Et !== 1 / 0 && Et;
}(at[0], at[1], tt);
}
}
function Kc(h10, c) {
return h10.x * c.x + h10.y * c.y;
}
function rC(h10, c) {
if (h10.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 = h10[0], C = w.sub(g), N = H.sub(g), z = A.sub(g), W = Kc(C, C), X = Kc(C, N), tt = Kc(N, N), at = Kc(z, C), ut = Kc(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 stt = V([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: att } = stt, ltt = V([{ name: "a_uv_x", components: 1, type: "Float32" }, { name: "a_split_index", components: 1, type: "Float32" }]), { members: ctt } = ltt, utt = d6.VectorTileFeature.types, htt = Math.cos(Math.PI / 180 * 37.5), nC = Math.pow(2, 14) / 0.5;
class D_ {
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 = false, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach((p) => {
this.gradients[p.id] = {};
}), this.layoutVertexArray = new Il(), this.layoutVertexArray2 = new a6(), this.indexArray = new C2(), this.programConfigurations = new D0(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 = I_("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 = B0(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 : F0(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 = P_("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, ctt)), this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, att), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = true;
}
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 = utt[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 < htt && 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, false, 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, true)), ut && (this.addCurrentVertex(tt, Lt, -1, -1, X, true), 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 = false) {
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, false, g, H), this.addHalfVertex(c, C, N, A, true, -w, H), this.distance > nC / 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 * (nC - 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 iC, oC;
nr("LineBucket", D_, { omit: ["layers", "patternFeatures"] });
var sC = { get paint() {
return oC = oC || 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 kl(Ct.paint_line["line-dasharray"]), "line-pattern": new Cl(Ct.paint_line["line-pattern"]), "line-gradient": new Bc(Ct.paint_line["line-gradient"]) });
}, get layout() {
return iC = iC || 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 dtt 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 Ip;
class ptt extends m {
constructor(c) {
super(c, sC), this.gradientVersion = 0, Ip || (Ip = new dtt(sC.paint.properties["line-width"].specification), Ip.useIntegerZoom = true);
}
_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"] = Ip.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, c);
}
createBucket(c) {
return new D_(c);
}
queryRadius(c) {
const p = c, g = aC(Uc("line-width", this, p), Uc("line-gap-width", this, p)), w = Uc("line-offset", this, p);
return g / 2 + Math.abs(w) + Sp(this.paint.get("line-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
const N = Hp(c, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), A.angle, C), z = C / 2 * aC(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 (Fl(X, Tt[Lt]))
return true;
}
if (bJ(X, Tt, at))
return true;
}
return false;
}(N, w, z);
}
isTileClipped() {
return true;
}
}
function aC(h10, c) {
return c > 0 ? c + 2 * h10 : h10;
}
const Ttt = V([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), ftt = V([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
V([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
const Qtt = 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 lC = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), mtt = V([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
function gtt(h10, c, p) {
return h10.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);
}), h10;
}
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 Yc = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" };
var r1 = 24, cC = In, uC = function(h10, 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 = h10[c + X];
for (X += tt, H = at & (1 << -W) - 1, at >>= -W, W += C; W > 0; H = 256 * H + h10[c + X], X += tt, W -= 8)
;
for (A = H & (1 << -W) - 1, H >>= -W, W += g; W > 0; A = 256 * A + h10[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);
}, hC = function(h10, 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; h10[p + at] = 255 & C, at += ut, C /= 256, w -= 8)
;
for (A = A << w | C, z += w; z > 0; h10[p + at] = 255 & A, at += ut, A /= 256, z -= 8)
;
h10[p + at - ut] |= 128 * Tt;
};
function In(h10) {
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(h10) ? h10 : new Uint8Array(h10 || 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 F_ = 4294967296, dC = 1 / F_, pC = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
function z3(h10) {
return h10.type === In.Bytes ? h10.readVarint() + h10.pos : h10.pos + 1;
}
function ytt(h10, c, p) {
return p ? 4294967296 * c + (h10 >>> 0) : 4294967296 * (c >>> 0) + (h10 >>> 0);
}
function TC(h10, 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 >= h10; w--)
p.buf[w + g] = p.buf[w];
}
function vtt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeVarint(h10[p]);
}
function _tt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeSVarint(h10[p]);
}
function btt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeFloat(h10[p]);
}
function Ltt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeDouble(h10[p]);
}
function wtt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeBoolean(h10[p]);
}
function xtt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeFixed32(h10[p]);
}
function Ett(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeSFixed32(h10[p]);
}
function Mtt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeFixed64(h10[p]);
}
function Stt(h10, c) {
for (var p = 0; p < h10.length; p++)
c.writeSFixed64(h10[p]);
}
function Pp(h10, c) {
return (h10[c] | h10[c + 1] << 8 | h10[c + 2] << 16) + 16777216 * h10[c + 3];
}
function Ul(h10, c, p) {
h10[p] = c, h10[p + 1] = c >>> 8, h10[p + 2] = c >>> 16, h10[p + 3] = c >>> 24;
}
function fC(h10, c) {
return (h10[c] | h10[c + 1] << 8 | h10[c + 2] << 16) + (h10[c + 3] << 24);
}
In.prototype = { destroy: function() {
this.buf = null;
}, readFields: function(h10, c, p) {
for (p = p || this.length; this.pos < p; ) {
var g = this.readVarint(), w = g >> 3, H = this.pos;
this.type = 7 & g, h10(w, c, this), this.pos === H && this.skip(g);
}
return c;
}, readMessage: function(h10, c) {
return this.readFields(h10, c, this.readVarint() + this.pos);
}, readFixed32: function() {
var h10 = Pp(this.buf, this.pos);
return this.pos += 4, h10;
}, readSFixed32: function() {
var h10 = fC(this.buf, this.pos);
return this.pos += 4, h10;
}, readFixed64: function() {
var h10 = Pp(this.buf, this.pos) + Pp(this.buf, this.pos + 4) * F_;
return this.pos += 8, h10;
}, readSFixed64: function() {
var h10 = Pp(this.buf, this.pos) + fC(this.buf, this.pos + 4) * F_;
return this.pos += 8, h10;
}, readFloat: function() {
var h10 = uC(this.buf, this.pos, true, 23, 4);
return this.pos += 4, h10;
}, readDouble: function() {
var h10 = uC(this.buf, this.pos, true, 52, 8);
return this.pos += 8, h10;
}, readVarint: function(h10) {
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 ytt(w, C, H);
throw new Error("Expected varint not more than 10 bytes");
}(c |= (15 & (p = g[this.pos])) << 28, h10, this))));
}, readVarint64: function() {
return this.readVarint(true);
}, readSVarint: function() {
var h10 = this.readVarint();
return h10 % 2 == 1 ? (h10 + 1) / -2 : h10 / 2;
}, readBoolean: function() {
return !!this.readVarint();
}, readString: function() {
var h10 = this.readVarint() + this.pos, c = this.pos;
return this.pos = h10, h10 - c >= 12 && pC ? function(p, g, w) {
return pC.decode(p.subarray(g, w));
}(this.buf, c, h10) : 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, h10);
}, readBytes: function() {
var h10 = this.readVarint() + this.pos, c = this.buf.subarray(this.pos, h10);
return this.pos = h10, c;
}, readPackedVarint: function(h10, c) {
if (this.type !== In.Bytes)
return h10.push(this.readVarint(c));
var p = z3(this);
for (h10 = h10 || []; this.pos < p; )
h10.push(this.readVarint(c));
return h10;
}, readPackedSVarint: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readSVarint());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readSVarint());
return h10;
}, readPackedBoolean: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readBoolean());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readBoolean());
return h10;
}, readPackedFloat: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readFloat());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readFloat());
return h10;
}, readPackedDouble: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readDouble());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readDouble());
return h10;
}, readPackedFixed32: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readFixed32());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readFixed32());
return h10;
}, readPackedSFixed32: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readSFixed32());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readSFixed32());
return h10;
}, readPackedFixed64: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readFixed64());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readFixed64());
return h10;
}, readPackedSFixed64: function(h10) {
if (this.type !== In.Bytes)
return h10.push(this.readSFixed64());
var c = z3(this);
for (h10 = h10 || []; this.pos < c; )
h10.push(this.readSFixed64());
return h10;
}, skip: function(h10) {
var c = 7 & h10;
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(h10, c) {
this.writeVarint(h10 << 3 | c);
}, realloc: function(h10) {
for (var c = this.length || 16; c < this.pos + h10; )
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(h10) {
this.realloc(4), Ul(this.buf, h10, this.pos), this.pos += 4;
}, writeSFixed32: function(h10) {
this.realloc(4), Ul(this.buf, h10, this.pos), this.pos += 4;
}, writeFixed64: function(h10) {
this.realloc(8), Ul(this.buf, -1 & h10, this.pos), Ul(this.buf, Math.floor(h10 * dC), this.pos + 4), this.pos += 8;
}, writeSFixed64: function(h10) {
this.realloc(8), Ul(this.buf, -1 & h10, this.pos), Ul(this.buf, Math.floor(h10 * dC), this.pos + 4), this.pos += 8;
}, writeVarint: function(h10) {
(h10 = +h10 || 0) > 268435455 || h10 < 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);
}(h10, this) : (this.realloc(4), this.buf[this.pos++] = 127 & h10 | (h10 > 127 ? 128 : 0), h10 <= 127 || (this.buf[this.pos++] = 127 & (h10 >>>= 7) | (h10 > 127 ? 128 : 0), h10 <= 127 || (this.buf[this.pos++] = 127 & (h10 >>>= 7) | (h10 > 127 ? 128 : 0), h10 <= 127 || (this.buf[this.pos++] = h10 >>> 7 & 127))));
}, writeSVarint: function(h10) {
this.writeVarint(h10 < 0 ? 2 * -h10 - 1 : 2 * h10);
}, writeBoolean: function(h10) {
this.writeVarint(!!h10);
}, writeString: function(h10) {
h10 = String(h10), this.realloc(4 * h10.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, h10, this.pos);
var p = this.pos - c;
p >= 128 && TC(c, p, this), this.pos = c - 1, this.writeVarint(p), this.pos += p;
}, writeFloat: function(h10) {
this.realloc(4), hC(this.buf, h10, this.pos, true, 23, 4), this.pos += 4;
}, writeDouble: function(h10) {
this.realloc(8), hC(this.buf, h10, this.pos, true, 52, 8), this.pos += 8;
}, writeBytes: function(h10) {
var c = h10.length;
this.writeVarint(c), this.realloc(c);
for (var p = 0; p < c; p++)
this.buf[this.pos++] = h10[p];
}, writeRawMessage: function(h10, c) {
this.pos++;
var p = this.pos;
h10(c, this);
var g = this.pos - p;
g >= 128 && TC(p, g, this), this.pos = p - 1, this.writeVarint(g), this.pos += g;
}, writeMessage: function(h10, c, p) {
this.writeTag(h10, In.Bytes), this.writeRawMessage(c, p);
}, writePackedVarint: function(h10, c) {
c.length && this.writeMessage(h10, vtt, c);
}, writePackedSVarint: function(h10, c) {
c.length && this.writeMessage(h10, _tt, c);
}, writePackedBoolean: function(h10, c) {
c.length && this.writeMessage(h10, wtt, c);
}, writePackedFloat: function(h10, c) {
c.length && this.writeMessage(h10, btt, c);
}, writePackedDouble: function(h10, c) {
c.length && this.writeMessage(h10, Ltt, c);
}, writePackedFixed32: function(h10, c) {
c.length && this.writeMessage(h10, xtt, c);
}, writePackedSFixed32: function(h10, c) {
c.length && this.writeMessage(h10, Ett, c);
}, writePackedFixed64: function(h10, c) {
c.length && this.writeMessage(h10, Mtt, c);
}, writePackedSFixed64: function(h10, c) {
c.length && this.writeMessage(h10, Stt, c);
}, writeBytesField: function(h10, c) {
this.writeTag(h10, In.Bytes), this.writeBytes(c);
}, writeFixed32Field: function(h10, c) {
this.writeTag(h10, In.Fixed32), this.writeFixed32(c);
}, writeSFixed32Field: function(h10, c) {
this.writeTag(h10, In.Fixed32), this.writeSFixed32(c);
}, writeFixed64Field: function(h10, c) {
this.writeTag(h10, In.Fixed64), this.writeFixed64(c);
}, writeSFixed64Field: function(h10, c) {
this.writeTag(h10, In.Fixed64), this.writeSFixed64(c);
}, writeVarintField: function(h10, c) {
this.writeTag(h10, In.Varint), this.writeVarint(c);
}, writeSVarintField: function(h10, c) {
this.writeTag(h10, In.Varint), this.writeSVarint(c);
}, writeStringField: function(h10, c) {
this.writeTag(h10, In.Bytes), this.writeString(c);
}, writeFloatField: function(h10, c) {
this.writeTag(h10, In.Fixed32), this.writeFloat(c);
}, writeDoubleField: function(h10, c) {
this.writeTag(h10, In.Fixed64), this.writeDouble(c);
}, writeBooleanField: function(h10, c) {
this.writeVarintField(h10, !!c);
} };
var B_ = u(cC);
const j_ = 3;
function Htt(h10, c, p) {
h10 === 1 && p.readMessage(Att, c);
}
function Att(h10, c, p) {
if (h10 === 3) {
const { id: g, bitmap: w, width: H, height: A, left: C, top: N, advance: z } = p.readMessage(Ott, {});
c.push({ id: g, bitmap: new $c({ width: H + 2 * j_, height: A + 2 * j_ }, w), metrics: { width: H, height: A, left: C, top: N, advance: z } });
}
}
function Ott(h10, c, p) {
h10 === 1 ? c.id = p.readVarint() : h10 === 2 ? c.bitmap = p.readBytes() : h10 === 3 ? c.width = p.readVarint() : h10 === 4 ? c.height = p.readVarint() : h10 === 5 ? c.left = p.readSVarint() : h10 === 6 ? c.top = p.readSVarint() : h10 === 7 && (c.advance = p.readVarint());
}
const QC = j_;
function mC(h10) {
let c = 0, p = 0;
for (const A of h10)
c += A.w * A.h, p = Math.max(p, A.w);
h10.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 h10)
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 z_ {
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 gC {
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 } = mC(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 z_(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 p6;
nr("ImagePosition", z_), nr("ImageAtlas", gC), s.ah = void 0, (p6 = s.ah || (s.ah = {}))[p6.none = 0] = "none", p6[p6.horizontal = 1] = "horizontal", p6[p6.vertical = 2] = "vertical", p6[p6.horizontalOnly = 3] = "horizontalOnly";
const Jc = -17;
class tu {
constructor() {
this.scale = 1, this.fontStack = "", this.imageName = null;
}
static forText(c, p) {
const g = new tu();
return g.scale = c || 1, g.fontStack = p, g;
}
static forImage(c) {
const p = new tu();
return p.imageName = c, p;
}
}
class Gl {
constructor() {
this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;
}
static fromFeature(c, p) {
const g = new Gl();
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 && _p(w) && !Yc[c[g + 1]] || H && _p(H) && !Yc[c[g - 1]] || !Yc[c[g]] ? c[g] : Yc[c[g]];
}
return p;
}(this.text);
}
trim() {
let c = 0;
for (let g = 0; g < this.text.length && Rp[this.text.charCodeAt(g)]; g++)
c++;
let p = this.text.length;
for (let g = this.text.length - 1; g >= 0 && g >= c && Rp[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 Gl();
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(tu.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(tu.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 Vp(h10, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut) {
const Tt = Gl.fromFeature(h10, 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(), U_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Gl();
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, U_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Gl();
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, U_(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: false, verticalizable: false };
return function(ee, _e, Xe, Er, ze, Re, Qr, sr, rr, ue, gr, pr) {
let Ir = 0, Fn = Jc, Pn = 0, p1 = 0;
const gs = 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, ql = null, Ha = null, Aa = r1;
const ys = !(rr === s.ah.horizontal || !gr && !Dc(ii) || gr && (Rp[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 || true, ql = V2.paddedRect;
const L1 = V2.displaySize;
fn.scale = fn.scale * r1 / pr, xi = { width: L1[0], height: L1[1], left: No, top: -QC, advance: ys ? L1[1] : L1[0] }, a2 = K1 + (r1 - L1[1] * fn.scale), Aa = xi.advance;
const U3 = ys ? 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)
ql = L1.rect, xi = L1.metrics;
else {
const U3 = _e[fn.fontStack], su = U3 && U3[ii];
if (!su)
continue;
xi = su.metrics;
}
a2 = (f1 - fn.scale) * r1;
}
ys ? (ee.verticalizable = true, bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Ir += Aa * fn.scale + ue) : (bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Ir += xi.advance * fn.scale + ue);
}
bo.length !== 0 && (Pn = Math.max(Ir - ue, Pn), Ptt(bo, 0, bo.length - 1, gs, 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 - Jc, { horizontalAlign: vo, verticalAlign: _o } = G_(Qr);
(function(Oi, f1, K1, R1, bo, N1, P2, Do, fn) {
const Un = (f1 - K1) * bo;
let ii = 0;
ii = N1 !== P2 ? -Do * R1 - Jc : (-R1 * fn + 0.5) * P2;
for (const a2 of Oi)
for (const xi of a2.positionedGlyphs)
xi.x += Un, xi.y += ii;
})(ee.positionedLines, gs, 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 false;
return true;
}(Pt) && Bt;
}
const Rp = { 9: true, 10: true, 11: true, 12: true, 13: true, 32: true }, Ctt = { 10: true, 32: true, 38: true, 41: true, 43: true, 45: true, 47: true, 173: true, 183: true, 8203: true, 8208: true, 8211: true, 8231: true }, ktt = { 40: true };
function yC(h10, 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[h10];
return C ? C.metrics.advance * c.scale + w : 0;
}
}
function vC(h10, c, p, g) {
const w = Math.pow(h10 - c, 2);
return g ? h10 < c ? w / 2 : 2 * w : w + Math.abs(p) * p;
}
function Itt(h10, c, p) {
let g = 0;
return h10 === 10 && (g -= 1e4), p && (g += 150), h10 !== 40 && h10 !== 65288 || (g += 50), c !== 41 && c !== 65289 || (g += 50), g;
}
function _C(h10, c, p, g, w, H) {
let A = null, C = vC(c, p, w, H);
for (const N of g) {
const z = vC(c - N.x, p, w, H) + N.badness;
z <= C && (A = N, C = z);
}
return { index: h10, x: c, priorBreak: A, badness: C };
}
function bC(h10) {
return h10 ? bC(h10.priorBreak).concat(h10.index) : [];
}
function U_(h10, c, p, g, w, H) {
if (!h10)
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 += yC(X.getCharCode($t), Pt, ut, Tt, tt, Lt);
}
return Et / Math.max(1, Math.ceil(Et / at));
}(h10, c, p, g, w, H), N = h10.text.indexOf("") >= 0;
let z = 0;
for (let X = 0; X < h10.length(); X++) {
const tt = h10.getSection(X), at = h10.getCharCode(X);
if (Rp[at] || (z += yC(at, tt, g, w, c, H)), X < h10.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) || vp.test(String.fromCodePoint(W)));
(Ctt[at] || ut || tt.imageName || X !== h10.length() - 2 && ktt[h10.getCharCode(X + 1)]) && A.push(_C(X + 1, z, C, A, Itt(at, h10.getCharCode(X + 1), ut && N), false));
}
}
var W;
return bC(_C(h10.length(), z, C, A, 0, true));
}
function G_(h10) {
let c = 0.5, p = 0.5;
switch (h10) {
case "right":
case "top-right":
case "bottom-right":
c = 1;
break;
case "left":
case "top-left":
case "bottom-left":
c = 0;
}
switch (h10) {
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 Ptt(h10, c, p, g, w) {
if (!g && !w)
return;
const H = h10[p], A = (h10[p].x + H.metrics.advance * H.scale) * g;
for (let C = c; C <= p; C++)
h10[C].x -= A, h10[C].y += w;
}
function Vtt(h10, c, p) {
const { horizontalAlign: g, verticalAlign: w } = G_(p), H = c[0] - h10.displaySize[0] * g, A = c[1] - h10.displaySize[1] * w;
return { image: h10, top: A, bottom: A + h10.displaySize[1], left: H, right: H + h10.displaySize[0] };
}
function LC(h10) {
var c, p;
let g = h10.left, w = h10.top, H = h10.right - g, A = h10.bottom - w;
const C = (c = h10.image.textFitWidth) !== null && c !== void 0 ? c : "stretchOrShrink", N = (p = h10.image.textFitHeight) !== null && p !== void 0 ? p : "stretchOrShrink", z = (h10.image.content[2] - h10.image.content[0]) / (h10.image.content[3] - h10.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 wC(h10, c, p, g, w, H) {
const A = h10.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 eu = 255, Sa = 128, T6 = eu * Sa;
function xC(h10, c) {
const { expression: p } = c;
if (p.kind === "constant")
return { kind: "constant", layoutSize: p.evaluate(new ti(h10 + 1)) };
if (p.kind === "source")
return { kind: "source" };
{
const { zoomStops: g, interpolationType: w } = p;
let H = 0;
for (; H < g.length && g[H] <= h10; )
H++;
H = Math.max(0, H - 1);
let A = H;
for (; A < g.length && g[A] < h10 + 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 $_(h10, c, p) {
let g = "never";
const w = h10.get(c);
return w ? g = w : h10.get(p) && (g = "always"), g;
}
const Rtt = d6.VectorTileFeature.types, Ntt = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
function Np(h10, c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = C ? Math.min(T6, Math.round(C[0])) : 0, ut = C ? Math.min(T6, Math.round(C[1])) : 0;
h10.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 W_(h10, c, p) {
h10.emplaceBack(c.x, c.y, p), h10.emplaceBack(c.x, c.y, p), h10.emplaceBack(c.x, c.y, p), h10.emplaceBack(c.x, c.y, p);
}
function Dtt(h10) {
for (const c of h10.sections)
if (__(c.text))
return true;
return false;
}
class Z_ {
constructor(c) {
this.layoutVertexArray = new Pl(), this.indexArray = new C2(), this.programConfigurations = c, this.segments = new an(), this.dynamicLayoutVertexArray = new jc(), this.opacityVertexArray = new o2(), this.hasVisibleVertices = false, 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, Ttt.members), this.indexBuffer = c.createIndexBuffer(this.indexArray, p), this.dynamicLayoutVertexBuffer = c.createVertexBuffer(this.dynamicLayoutVertexArray, ftt.members, true), this.opacityVertexBuffer = c.createVertexBuffer(this.opacityVertexArray, Ntt, true), 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", Z_);
class q_ {
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, Qtt.members, true);
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
}
}
nr("CollisionBuffers", q_);
class $l {
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 = false, this.hasRTLText = false, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = S_([]), this.placementViewportMatrix = S_([]);
const p = this.layers[0]._unevaluatedLayout._values;
this.textSizeData = xC(this.zoom, p["text-size"]), this.iconSizeData = xC(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 = $_(g, "text-overlap", "text-allow-overlap") !== "never" || $_(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 Z_(new D0(this.layers, this.zoom, (c) => /^text/.test(c))), this.icon = new Z_(new D0(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)] = true, (g || w) && H) {
const C = Yc[c.charAt(A)];
C && (p[C.charCodeAt(0)] = true);
}
}
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 = B0(Lt, Bt);
if (!w._featureFilter.filter(Tt, ee, g))
continue;
let _e, Xe;
if (Bt || (ee.geometry = F0(Lt)), z) {
const ze = w.getValueAndResolveTokens("text-field", ee, g, ut), Re = Xr.factory(ze), Qr = this.hasRTLText = this.hasRTLText || Dtt(Re);
(!Qr || Vo.getRTLTextPluginStatus() === "unavailable" || Qr && Vo.isParsed()) && (_e = gtt(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: Rtt[Lt.type], sortKey: Er }), Xe && (tt[Xe.name] = true), _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] = true;
else {
const sr = Rc(_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, true);
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, true)] = 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 = true;
}
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];
Np(ut, N.x, N.y, ee.x, Fn + ee.y, ze.x, ze.y, g, gr, Re.x, Re.y, sr, rr), Np(ut, N.x, N.y, _e.x, Fn + _e.y, ze.x + ze.w, ze.y, g, gr, Qr.x, Re.y, sr, rr), Np(ut, N.x, N.y, Xe.x, Fn + Xe.y, ze.x, ze.y + ze.h, g, gr, Re.x, Qr.y, sr, rr), Np(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), W_(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, false, 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 q_(s2, lC.members, b1), this.iconCollisionBox = new q_(s2, lC.members, b1);
for (let c = 0; c < this.symbolInstances.length; c++) {
const p = this.symbolInstances.get(c);
this.addDebugCollisionBoxes(p.textBoxStartIndex, p.textBoxEndIndex, p, true), this.addDebugCollisionBoxes(p.verticalTextBoxStartIndex, p.verticalTextBoxEndIndex, p, true), this.addDebugCollisionBoxes(p.iconBoxStartIndex, p.iconBoxEndIndex, p, false), this.addDebugCollisionBoxes(p.verticalIconBoxStartIndex, p.verticalIconBoxEndIndex, p, false);
}
}
_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 EC, MC;
nr("SymbolBucket", $l, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), $l.MAX_GLYPHS = 65535, $l.addDynamicAttributes = W_;
var X_ = { get paint() {
return MC = MC || 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: (h10) => h10.textColor, hasOverride: (h10) => !!h10.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 EC = EC || 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 SC {
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 false;
}
serialize() {
return null;
}
}
nr("FormatSectionOverride", SC, { omit: ["defaultValue"] });
class Dp extends m {
constructor(c) {
super(c, X_);
}
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 $l(c);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
throw new Error("Should take a different path in FeatureIndex");
}
_setPaintOverrides() {
for (const c of X_.paint.overridableProperties) {
if (!Dp.hasPaintOverride(this.layout, c))
continue;
const p = this.paint.get(c), g = new SC(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 Qs(p.property, H, p.parameters);
}
}
_handleOverridablePaintPropertyUpdate(c, p, g) {
return !(!this.layout || p.isDataDriven() || g.isDataDriven()) && Dp.hasPaintOverride(this.layout, c);
}
static hasPaintOverride(c, p) {
const g = c.get("text-field"), w = X_.paint.properties[p];
let H = false;
const A = (C) => {
for (const N of C)
if (w.overrides && w.overrides.hasOverride(N))
return void (H = true);
};
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 HC;
var Ftt = { get paint() {
return HC = HC || new S({ "background-color": new cr(Ct.paint_background["background-color"]), "background-pattern": new kl(Ct.paint_background["background-pattern"]), "background-opacity": new cr(Ct.paint_background["background-opacity"]) });
} };
class Btt extends m {
constructor(c) {
super(c, Ftt);
}
}
let AC;
var jtt = { get paint() {
return AC = AC || 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 ztt extends m {
constructor(c) {
super(c, jtt);
}
}
class Utt 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 false;
}
serialize() {
throw new Error("Custom layers cannot be serialized");
}
}
class Gtt {
constructor(c) {
this._methodToThrottle = c, this._triggered = false, typeof MessageChannel < "u" && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {
this._triggered = false, this._methodToThrottle();
});
}
trigger() {
this._triggered || (this._triggered = true, this._channel ? this._channel.port1.postMessage(true) : setTimeout(() => {
this._triggered = false, this._methodToThrottle();
}, 0));
}
remove() {
delete this._channel, this._methodToThrottle = () => {
};
}
}
const K_ = 63710088e-1;
class f6 {
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 f6(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 K_ * Math.acos(Math.min(H, 1));
}
static convert(c) {
if (c instanceof f6)
return c;
if (Array.isArray(c) && (c.length === 2 || c.length === 3))
return new f6(Number(c[0]), Number(c[1]));
if (!Array.isArray(c) && typeof c == "object" && c !== null)
return new f6(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 OC = 2 * Math.PI * K_;
function CC(h10) {
return OC * Math.cos(h10 * Math.PI / 180);
}
function kC(h10) {
return (180 + h10) / 360;
}
function IC(h10) {
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h10 * Math.PI / 360))) / 360;
}
function PC(h10, c) {
return h10 / CC(c);
}
function Y_(h10) {
return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * h10) * Math.PI / 180)) - 90;
}
class ru {
constructor(c, p, g = 0) {
this.x = +c, this.y = +p, this.z = +g;
}
static fromLngLat(c, p = 0) {
const g = f6.convert(c);
return new ru(kC(g.lng), IC(g.lat), PC(p, g.lat));
}
toLngLat() {
return new f6(360 * this.x - 180, Y_(this.y));
}
toAltitude() {
return this.z * CC(Y_(this.y));
}
meterInMercatorCoordinateUnits() {
return 1 / OC * (c = Y_(this.y), 1 / Math.cos(c * Math.PI / 180));
var c;
}
}
function VC(h10, c, p) {
var g = 2 * Math.PI * 6378137 / 256 / Math.pow(2, p);
return [h10 * g - 2 * Math.PI * 6378137 / 2, c * g - 2 * Math.PI * 6378137 / 2];
}
class J_ {
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 = nu(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 = VC(256 * (H = this.x), 256 * (A = Math.pow(2, C) - A - 1), C), z = VC(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 RC {
constructor(c, p) {
this.wrap = c, this.canonical = p, this.key = nu(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 J_(g, +w, +H), this.key = nu(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 ? nu(this.wrap * +p, c, this.canonical.z, this.canonical.x, this.canonical.y) : nu(this.wrap * +p, c, c, this.canonical.x >> g, this.canonical.y >> g);
}
isChildOf(c) {
if (c.wrap !== this.wrap)
return false;
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 RC(this.wrap, this.canonical);
}
toString() {
return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;
}
getTilePoint(c) {
return this.canonical.getTilePoint(new ru(c.x - this.wrap, c.y));
}
}
function nu(h10, c, p, g, w) {
(h10 *= 2) < 0 && (h10 = -1 * h10 - 1);
const H = 1 << p;
return (H * H * h10 + H * w + g).toString(36) + p.toString(36) + c.toString(36);
}
nr("CanonicalTileID", J_), nr("OverscaledTileID", I2, { omit: ["posMatrix"] });
class NC {
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", NC);
class DC {
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 FC {
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 BC {
constructor(c, p) {
this.tileID = c, this.x = c.canonical.x, this.y = c.canonical.y, this.z = c.canonical.z, this.grid = new e6(Zi, 16, 0), this.grid3D = new e6(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 d6.VectorTile(new B_(this.rawTileData)).layers, this.sourceLayerCoder = new DC(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 = Y4(H.filter), N = c.queryGeometry, z = c.queryPadding * A, W = zC(N), X = this.grid.query(W.minX - z, W.minY - z, W.maxX + z, W.maxY + z), tt = zC(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 true;
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 (Fl(Bt, Re))
return true;
}
for (let Re = 0; Re < Bt.length - 1; Re++)
if (wJ(Bt[Re], Bt[Re + 1], ze))
return true;
return false;
}(c.cameraQueryGeometry, Lt - z, Et - z, $t + z, Pt + z));
for (const Lt of at)
X.push(Lt);
X.sort($tt);
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 = F0(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 true;
return false;
}(A, tt))
return;
const at = this.sourceLayerCoder.decode(g), ut = this.vtLayers[at].feature(w);
if (H.needGeometry) {
const Lt = B0(ut, true);
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 = jC(Bt.paint, $t.paint, ut, Pt, C), Bt.layout = jC(Bt.layout, $t.layout, ut, Pt, C);
const ee = !X || X(ut, $t, Pt);
if (!ee)
continue;
const _e = new FC(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 = Y4(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 true;
return false;
}
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 jC(h10, c, p, g, w) {
return nt(h10, (H, A) => {
const C = c instanceof V0 ? c.get(A) : null;
return C && C.evaluate ? C.evaluate(p, g, w) : C;
});
}
function zC(h10) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h10)
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 $tt(h10, c) {
return c - h10;
}
function UC(h10, c, p, g, w) {
const H = [];
for (let A = 0; A < h10.length; A++) {
const C = h10[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", BC, { omit: ["rawTileData", "sourceLayerCoder"] });
class Q6 extends f {
constructor(c, p, g, w) {
super(c, p), this.angle = g, w !== void 0 && (this.segment = w);
}
clone() {
return new Q6(this.x, this.y, this.angle, this.segment);
}
}
function GC(h10, c, p, g, w) {
if (c.segment === void 0 || p === 0)
return true;
let H = c, A = c.segment + 1, C = 0;
for (; C > -p / 2; ) {
if (A--, A < 0)
return false;
C -= h10[A].dist(H), H = h10[A];
}
C += h10[A].dist(h10[A + 1]), A++;
const N = [];
let z = 0;
for (; C < p / 2; ) {
const W = h10[A], X = h10[A + 1];
if (!X)
return false;
let tt = h10[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 false;
A++, C += W.dist(X);
}
return true;
}
function $C(h10) {
let c = 0;
for (let p = 0; p < h10.length - 1; p++)
c += h10[p].dist(h10[p + 1]);
return c;
}
function WC(h10, c, p) {
return h10 ? 0.6 * c * p : 0;
}
function ZC(h10, c) {
return Math.max(h10 ? h10.right - h10.left : 0, c ? c.right - c.left : 0);
}
function Wtt(h10, c, p, g, w, H) {
const A = WC(p, w, H), C = ZC(p, g) * H;
let N = 0;
const z = $C(h10) / 2;
for (let W = 0; W < h10.length - 1; W++) {
const X = h10[W], tt = h10[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 Q6(Tt, Lt, tt.angleTo(X), W);
return Et._round(), !A || GC(h10, Et, C, A, c) ? Et : void 0;
}
N += at;
}
}
function Ztt(h10, c, p, g, w, H, A, C, N) {
const z = WC(g, H, A), W = ZC(g, w), X = W * A, tt = h10[0].x === 0 || h10[0].x === N || h10[0].y === 0 || h10[0].y === N;
return c - X < c / 4 && (c = X + c / 4), qC(h10, tt ? c / 2 * C % c : (W / 2 + 2 * H) * A * C % c, c, z, p, X, tt, false, N);
}
function qC(h10, c, p, g, w, H, A, C, N) {
const z = H / 2, W = $C(h10);
let X = 0, tt = c - p, at = [];
for (let ut = 0; ut < h10.length - 1; ut++) {
const Tt = h10[ut], Lt = h10[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 Q6(Bt, ee, $t, ut);
_e._round(), g && !GC(h10, _e, H, g, w) || at.push(_e);
}
}
X += Et;
}
return C || at.length || A || (at = qC(h10, X / 2, p, g, w, H, A, true, N)), at;
}
nr("Anchor", Q6);
const Wl = No;
function XC(h10, c, p, g) {
const w = [], H = h10.image, A = H.pixelRatio, C = H.paddedRect.w - 2 * Wl, N = H.paddedRect.h - 2 * Wl;
let z = { x1: h10.left, y1: h10.top, x2: h10.right, y2: h10.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 = LC(h10)), Et = Fp(W, 0, ue[0]), Pt = Fp(X, 0, ue[1]), $t = Fp(W, ue[0], ue[2]), Bt = Fp(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 = Bp(ue.stretch - Et, $t, Qr, ze), Pn = jp(ue.fixed - ee, _e, ue.stretch, at), p1 = Bp(gr.stretch - Pt, Bt, sr, Re), gs = jp(gr.fixed - Xe, Er, gr.stretch, ut), V1 = Bp(pr.stretch - Et, $t, Qr, ze), T1 = jp(pr.fixed - ee, _e, pr.stretch, at), yo = Bp(Ir.stretch - Pt, Bt, sr, Re), vo = jp(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, gs / 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 + Wl + P2, y: H.paddedRect.y + Wl + 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 = KC(W, Tt, at), gr = KC(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 Fp(h10, c, p) {
let g = 0;
for (const w of h10)
g += Math.max(c, Math.min(p, w[1])) - Math.max(c, Math.min(p, w[0]));
return g;
}
function KC(h10, c, p) {
const g = [{ fixed: -Wl, stretch: 0 }];
for (const [w, H] of h10) {
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 + Wl, stretch: p }), g;
}
function Bp(h10, c, p, g) {
return h10 / c * p + g;
}
function jp(h10, c, p, g) {
return h10 - c * p / g;
}
class zp {
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) ? LC(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 qtt {
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 Xtt(h10, c = 1, p = false) {
let g = 1 / 0, w = 1 / 0, H = -1 / 0, A = -1 / 0;
const C = h10[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 qtt([], Ktt);
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 Zl(at + z, ut + z, z, h10));
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 Zl(Tt / ut, Lt / ut, 0, at);
}(h10), 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 Zl(at.p.x - z, at.p.y - z, z, h10)), W.push(new Zl(at.p.x + z, at.p.y - z, z, h10)), W.push(new Zl(at.p.x - z, at.p.y + z, z, h10)), W.push(new Zl(at.p.x + z, at.p.y + z, z, h10)), tt += 4);
}
return p && (console.log(`num probes: ${tt}`), console.log(`best distance: ${X.d}`)), X.p;
}
function Ktt(h10, c) {
return c.max - h10.max;
}
function Zl(h10, c, p, g) {
this.p = new f(h10, c), this.h = p, this.d = function(w, H) {
let A = false, 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, IO(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 m6 = 7, tb = Number.POSITIVE_INFINITY;
function YC(h10, c) {
return c[1] !== tb ? 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 - m6;
break;
case "bottom-right":
case "bottom-left":
case "bottom":
A = -w + m6;
}
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];
}(h10, 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 - m6;
break;
case "bottom-right":
case "bottom-left":
H = -A + m6;
break;
case "bottom":
H = -g + m6;
break;
case "top":
H = g - m6;
}
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];
}(h10, c[0]);
}
function JC(h10, c, p) {
var g;
const w = h10.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] -= m6 : W.startsWith("bottom") && (X[1] += m6), N[z + 1] = X;
}
return new _n(N);
}
const A = w.get("text-variable-anchor");
if (A) {
let C;
C = h10._unevaluatedLayout.getValue("text-radial-offset") !== void 0 ? [w.get("text-radial-offset").evaluate(c, {}, p) * r1, tb] : w.get("text-offset").evaluate(c, {}, p).map((z) => z * r1);
const N = [];
for (const z of A)
N.push(z, YC(z, C));
return new _n(N);
}
return null;
}
function eb(h10) {
switch (h10) {
case "right":
case "top-right":
case "bottom-right":
return "right";
case "left":
case "top-left":
case "bottom-left":
return "left";
}
return "center";
}
function Ytt(h10, c, p, g, w, H, A, C, N, z, W) {
let X = H.textMaxSize.evaluate(c, {});
X === void 0 && (X = A);
const tt = h10.layers[0].layout, at = tt.get("icon-offset").evaluate(c, {}, W), ut = ek(p.horizontal), Tt = A / 24, Lt = h10.tilePixelRatio * Tt, Et = h10.tilePixelRatio * X / 24, $t = h10.tilePixelRatio * C, Pt = h10.tilePixelRatio * tt.get("symbol-spacing"), Bt = tt.get("text-padding") * h10.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, h10.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" && (h10.allowVerticalPlacement && p.vertical && (sr = wC(g, p.vertical, Qr, tt.get("icon-text-fit-padding"), at, Tt)), ut && (g = wC(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, gs, V1, T1, yo, vo, _o, Oi, f1, K1, R1, bo, N1, P2, Do, fn, Un, ii, a2, xi, ql) {
const Ha = pr.addToLineVertexArray(Ir, Fn);
let Aa, ys, V2, L1, U3 = 0, su = 0, ok = 0, sk = 0, cb = -1, ub = -1;
const G3 = {};
let ak = Vl("");
if (pr.allowVerticalPlacement && Pn.vertical) {
const Y1 = T1.layout.get("text-rotate").evaluate(Un, {}, xi) + 90;
V2 = new zp(yo, Ir, vo, _o, Oi, Pn.vertical, f1, K1, R1, Y1), V1 && (L1 = new zp(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", z0 = XC(p1, Y1, a2, R2), qs = V1 ? XC(V1, Y1, a2, R2) : void 0;
ys = new zp(yo, Ir, vo, _o, Oi, p1, N1, P2, false, Y1), U3 = 4 * z0.length;
const U0 = pr.iconSizeData;
let Oa = null;
U0.kind === "source" ? (Oa = [Sa * T1.layout.get("icon-size").evaluate(Un, {})], Oa[0] > T6 && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)) : U0.kind === "composite" && (Oa = [Sa * ii.compositeIconSizes[0].evaluate(Un, {}, xi), Sa * ii.compositeIconSizes[1].evaluate(Un, {}, xi)], (Oa[0] > T6 || Oa[1] > T6) && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)), pr.addSymbols(pr.icon, z0, Oa, fn, Do, Un, s.ah.none, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), cb = pr.icon.placedSymbolArray.length - 1, qs && (su = 4 * qs.length, pr.addSymbols(pr.icon, qs, Oa, fn, Do, Un, s.ah.vertical, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), ub = pr.icon.placedSymbolArray.length - 1);
}
const lk = Object.keys(Pn.horizontal);
for (const Y1 of lk) {
const R2 = Pn.horizontal[Y1];
if (!Aa) {
ak = Vl(R2.text);
const qs = T1.layout.get("text-rotate").evaluate(Un, {}, xi);
Aa = new zp(yo, Ir, vo, _o, Oi, R2, f1, K1, R1, qs);
}
const z0 = R2.positionedLines.length === 1;
if (ok += tk(pr, Ir, R2, gs, T1, R1, Un, bo, Ha, Pn.vertical ? s.ah.horizontal : s.ah.horizontalOnly, z0 ? lk : [Y1], G3, cb, ii, xi), z0)
break;
}
Pn.vertical && (sk += tk(pr, Ir, Pn.vertical, gs, T1, R1, Un, bo, Ha, s.ah.vertical, ["vertical"], G3, ub, ii, xi));
const eet = Aa ? Aa.boxStartIndex : pr.collisionBoxArray.length, ret = Aa ? Aa.boxEndIndex : pr.collisionBoxArray.length, net = V2 ? V2.boxStartIndex : pr.collisionBoxArray.length, iet = V2 ? V2.boxEndIndex : pr.collisionBoxArray.length, oet = ys ? ys.boxStartIndex : pr.collisionBoxArray.length, set = ys ? ys.boxEndIndex : pr.collisionBoxArray.length, aet = L1 ? L1.boxStartIndex : pr.collisionBoxArray.length, cet = L1 ? L1.boxEndIndex : pr.collisionBoxArray.length;
let Zs = -1;
const Gp = (Y1, R2) => Y1 && Y1.circleDiameter ? Math.max(Y1.circleDiameter, R2) : R2;
Zs = Gp(Aa, Zs), Zs = Gp(V2, Zs), Zs = Gp(ys, Zs), Zs = Gp(L1, Zs);
const ck = Zs > -1 ? 1 : 0;
ck && (Zs *= ql / r1), pr.glyphOffsetArray.length >= $l.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 uet = JC(T1, Un, xi), [het, det] = function(Y1, R2) {
const z0 = Y1.length, qs = R2 == null ? void 0 : R2.values;
if ((qs == null ? void 0 : qs.length) > 0)
for (let U0 = 0; U0 < qs.length; U0 += 2) {
const Oa = qs[U0 + 1];
Y1.emplaceBack(s.aq[qs[U0]], Oa[0], Oa[1]);
}
return [z0, Y1.length];
}(pr.textAnchorOffsets, uet);
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, cb, ub, ak, eet, ret, net, iet, oet, set, aet, cet, vo, ok, sk, U3, su, ck, 0, f1, Zs, het, det);
}(h10, gr, ue, p, g, w, sr, h10.layers[0], h10.collisionBoxArray, c.index, c.sourceLayerIndex, h10.index, Lt, [Bt, Bt, Bt, Bt], Xe, N, $t, ee, Er, at, c, H, z, W, A);
};
if (ze === "line")
for (const ue of UC(c.geometry, 0, 0, Zi, Zi)) {
const gr = Ztt(ue, Pt, _e, p.vertical || ut, g, 24, Et, h10.overscaling, Zi);
for (const pr of gr)
ut && Jtt(h10, ut.text, Re, pr) || rr(ue, pr);
}
else if (ze === "line-center") {
for (const ue of c.geometry)
if (ue.length > 1) {
const gr = Wtt(ue, _e, p.vertical || ut, g, 24, Et);
gr && rr(ue, gr);
}
} else if (c.type === "Polygon")
for (const ue of U4(c.geometry, 0)) {
const gr = Xtt(ue, 16);
rr(ue[0], new Q6(gr.x, gr.y, 0));
}
else if (c.type === "LineString")
for (const ue of c.geometry)
rr(ue, new Q6(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 Q6(gr.x, gr.y, 0));
}
function tk(h10, 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 = QC + 1, pr = true, 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 gs = _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 - Jc), Un = -Math.PI / 2, ii = r1 / 2 - p1, a2 = new f(5 - Jc - 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: gs, sectionIndex: rr.sectionIndex, isSDF: pr, pixelOffsetTL: P2, pixelOffsetBR: Do, minFontScaleX: 0, minFontScaleY: 0 });
}
return Qr;
}(0, p, C, w, H, A, g, h10.allowVerticalPlacement), Lt = h10.textSizeData;
let Et = null;
Lt.kind === "source" ? (Et = [Sa * w.layout.get("text-size").evaluate(A, {})], Et[0] > T6 && It(`${h10.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)) : Lt.kind === "composite" && (Et = [Sa * at.compositeTextSizes[0].evaluate(A, {}, ut), Sa * at.compositeTextSizes[1].evaluate(A, {}, ut)], (Et[0] > T6 || Et[1] > T6) && It(`${h10.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)), h10.addSymbols(h10.text, Tt, Et, C, H, A, z, c, N.lineStartIndex, N.lineLength, tt, ut);
for (const $t of W)
X[$t] = h10.text.placedSymbolArray.length - 1;
return 4 * Tt.length;
}
function ek(h10) {
for (const c in h10)
return h10[c];
return null;
}
function Jtt(h10, c, p, g) {
const w = h10.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 true;
} else
w[c] = [];
return w[c].push(g), false;
}
const rk = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
class rb {
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 = rk[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 rb(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 = rk.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 = true) : (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 = false, 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 nb(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, 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++)
ik(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];
ik(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 nb(h10, c, p, g, w, H) {
if (w - g <= p)
return;
const A = g + w >> 1;
nk(h10, c, A, g, w, H), nb(h10, c, p, g, A - 1, 1 - H), nb(h10, c, p, A + 1, w, 1 - H);
}
function nk(h10, 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);
nk(h10, 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 (iu(h10, c, g, p), c[2 * w + H] > A && iu(h10, c, g, w); C < N; ) {
for (iu(h10, c, C, N), C++, N--; c[2 * C + H] < A; )
C++;
for (; c[2 * N + H] > A; )
N--;
}
c[2 * g + H] === A ? iu(h10, c, g, N) : (N++, iu(h10, c, N, w)), N <= p && (g = N + 1), p <= N && (w = N - 1);
}
}
function iu(h10, c, p, g) {
ib(h10, p, g), ib(c, 2 * p, 2 * g), ib(c, 2 * p + 1, 2 * g + 1);
}
function ib(h10, c, p) {
const g = h10[c];
h10[c] = h10[p], h10[p] = g;
}
function ik(h10, c, p, g) {
const w = h10 - p, H = c - g;
return w * w + H * H;
}
var ob;
s.bg = void 0, (ob = s.bg || (s.bg = {})).create = "create", ob.load = "load", ob.fullLoad = "fullLoad";
let Up = null, ou = [];
const sb = 1e3 / 60, ab = "loadTime", lb = "fullLoadTime", tet = { mark(h10) {
performance.mark(h10);
}, frame(h10) {
const c = h10;
Up != null && ou.push(c - Up), Up = c;
}, clearMetrics() {
Up = null, ou = [], performance.clearMeasures(ab), performance.clearMeasures(lb);
for (const h10 in s.bg)
performance.clearMarks(s.bg[h10]);
}, getPerformanceMetrics() {
performance.measure(ab, s.bg.create, s.bg.load), performance.measure(lb, s.bg.create, s.bg.fullLoad);
const h10 = performance.getEntriesByName(ab)[0].duration, c = performance.getEntriesByName(lb)[0].duration, p = ou.length, g = 1 / (ou.reduce((H, A) => H + A, 0) / p / 1e3), w = ou.filter((H) => H > sb).reduce((H, A) => H + (A - sb) / sb, 0);
return { loadTime: h10, fullLoadTime: c, fps: g, percentDroppedFrames: w / (p + w) * 100, totalFrames: p };
} };
s.$ = class extends Y {
}, s.A = Bl, s.B = Q_, s.C = function(h10) {
if (re == null) {
const c = h10.navigator ? h10.navigator.userAgent : null;
re = !!h10.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(h10, c) {
this.target = h10, this.mapId = c, this.resolveRejects = {}, this.tasks = {}, this.taskQueue = [], this.abortControllers = {}, this.messageHandlers = {}, this.invoker = new Gtt(() => this.process()), this.subscription = function(p, g, w, H) {
return p.addEventListener(g, w, false), { unsubscribe: () => {
p.removeEventListener(g, w, false);
} };
}(this.target, "message", (p) => this.receive(p)), this.globalScope = oe(self) ? h10 : window;
}
registerMessageHandler(h10, c) {
this.messageHandlers[h10] = c;
}
sendAsync(h10, 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: h10.targetMapId, sourceMapId: this.mapId };
this.target.postMessage(C);
}, { once: true });
const H = [], A = Object.assign(Object.assign({}, h10), { id: w, sourceMapId: this.mapId, origin: location.origin, data: r6(h10.data, H) });
this.target.postMessage(A, { transfer: H });
});
}
receive(h10) {
const c = h10.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 h10 = this.taskQueue.shift(), c = this.tasks[h10];
delete this.tasks[h10], this.taskQueue.length > 0 && this.invoker.trigger(), c && this.processTask(h10, c);
}
processTask(h10, c) {
return a(this, void 0, void 0, function* () {
if (c.type === "") {
const w = this.resolveRejects[h10];
return delete this.resolveRejects[h10], w ? void (c.error ? w.reject(n6(c.error)) : w.resolve(n6(c.data))) : void 0;
}
if (!this.messageHandlers[c.type])
return void this.completeTask(h10, new Error(`Could not find a registered handler for ${c.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));
const p = n6(c.data), g = new AbortController();
this.abortControllers[h10] = g;
try {
const w = yield this.messageHandlers[c.type](c.sourceMapId, p, g);
this.completeTask(h10, null, w);
} catch (w) {
this.completeTask(h10, w);
}
});
}
completeTask(h10, c, p) {
const g = [];
delete this.abortControllers[h10];
const w = { id: h10, type: "", sourceMapId: this.mapId, origin: location.origin, error: c ? r6(c) : null, data: r6(p, g) };
this.target.postMessage(w, { transfer: g });
}
remove() {
this.invoker.remove(), this.subscription.unsubscribe();
}
}, s.G = Ne, s.H = function() {
var h10 = new Bl(16);
return Bl != Float32Array && (h10[1] = 0, h10[2] = 0, h10[3] = 0, h10[4] = 0, h10[6] = 0, h10[7] = 0, h10[8] = 0, h10[9] = 0, h10[11] = 0, h10[12] = 0, h10[13] = 0, h10[14] = 0), h10[0] = 1, h10[5] = 1, h10[10] = 1, h10[15] = 1, h10;
}, s.I = z_, s.J = function(h10, 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 === h10 ? (h10[12] = c[0] * Tt + c[4] * Lt + c[8] * Et + c[12], h10[13] = c[1] * Tt + c[5] * Lt + c[9] * Et + c[13], h10[14] = c[2] * Tt + c[6] * Lt + c[10] * Et + c[14], h10[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], h10[0] = g = c[0], h10[1] = w, h10[2] = H, h10[3] = A, h10[4] = C, h10[5] = N, h10[6] = z, h10[7] = W, h10[8] = X, h10[9] = tt, h10[10] = at, h10[11] = ut, h10[12] = g * Tt + C * Lt + X * Et + c[12], h10[13] = w * Tt + N * Lt + tt * Et + c[13], h10[14] = H * Tt + z * Lt + at * Et + c[14], h10[15] = A * Tt + W * Lt + ut * Et + c[15]), h10;
}, s.K = function(h10, c, p) {
var g = p[0], w = p[1], H = p[2];
return h10[0] = c[0] * g, h10[1] = c[1] * g, h10[2] = c[2] * g, h10[3] = c[3] * g, h10[4] = c[4] * w, h10[5] = c[5] * w, h10[6] = c[6] * w, h10[7] = c[7] * w, h10[8] = c[8] * H, h10[9] = c[9] * H, h10[10] = c[10] * H, h10[11] = c[11] * H, h10[12] = c[12], h10[13] = c[13], h10[14] = c[14], h10[15] = c[15], h10;
}, s.L = NO, s.M = function(h10, c) {
const p = {};
for (let g = 0; g < c.length; g++) {
const w = c[g];
w in h10 && (p[w] = h10[w]);
}
return p;
}, s.N = f6, s.O = kC, s.P = f, s.Q = IC, s.R = k2, s.S = I2, s.T = Ol, s.U = x, s.V = O, s.W = qr, s.X = Zi, s.Y = V, s.Z = ru, s._ = a, s.a = er, s.a$ = function(h10, c) {
var p = h10[0], g = h10[1], w = h10[2], H = h10[3], A = h10[4], C = h10[5], N = h10[6], z = h10[7], W = h10[8], X = h10[9], tt = h10[10], at = h10[11], ut = h10[12], Tt = h10[13], Lt = h10[14], Et = h10[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 = J_, s.a2 = ye, s.a3 = (h10) => {
const c = window.document.createElement("video");
return c.muted = true, new Promise((p) => {
c.onloadstart = () => {
p(c);
};
for (const g of h10) {
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 = $l, s.a7 = Y4, s.a8 = B0, s.a9 = FC, s.aA = function(h10) {
if (h10.type === "custom")
return new Utt(h10);
switch (h10.type) {
case "background":
return new Btt(h10);
case "circle":
return new MJ(h10);
case "fill":
return new UJ(h10);
case "fill-extrusion":
return new ott(h10);
case "heatmap":
return new HJ(h10);
case "hillshade":
return new OJ(h10);
case "line":
return new ptt(h10);
case "raster":
return new ztt(h10);
case "symbol":
return new Dp(h10);
}
}, s.aB = rt, s.aC = function(h10, c) {
if (!h10)
return [{ command: "setStyle", args: [c] }];
let p = [];
try {
if (!Hr(h10.version, c.version))
return [{ command: "setStyle", args: [c] }];
Hr(h10.center, c.center) || p.push({ command: "setCenter", args: [c.center] }), Hr(h10.zoom, c.zoom) || p.push({ command: "setZoom", args: [c.zoom] }), Hr(h10.bearing, c.bearing) || p.push({ command: "setBearing", args: [c.bearing] }), Hr(h10.pitch, c.pitch) || p.push({ command: "setPitch", args: [c.pitch] }), Hr(h10.sprite, c.sprite) || p.push({ command: "setSprite", args: [c.sprite] }), Hr(h10.glyphs, c.glyphs) || p.push({ command: "setGlyphs", args: [c.glyphs] }), Hr(h10.transition, c.transition) || p.push({ command: "setTransition", args: [c.transition] }), Hr(h10.light, c.light) || p.push({ command: "setLight", args: [c.light] }), Hr(h10.terrain, c.terrain) || p.push({ command: "setTerrain", args: [c.terrain] }), Hr(h10.sky, c.sky) || p.push({ command: "setSky", args: [c.sky] }), Hr(h10.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));
})(h10.sources, c.sources, w, g);
const H = [];
h10.layers && h10.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] = true);
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(h10) {
const c = [], p = h10.id;
return p === void 0 && c.push({ message: `layers.${p}: missing required property "id"` }), h10.render === void 0 && c.push({ message: `layers.${p}: missing required method "render"` }), h10.renderingMode && h10.renderingMode !== "2d" && h10.renderingMode !== "3d" && c.push({ message: `layers.${p}: property "renderingMode" must be either "2d" or "3d"` }), c;
}, s.aE = function h10(c, p) {
if (Array.isArray(c)) {
if (!Array.isArray(p) || c.length !== p.length)
return false;
for (let g = 0; g < c.length; g++)
if (!h10(c[g], p[g]))
return false;
return true;
}
if (typeof c == "object" && c !== null && p !== null) {
if (typeof p != "object" || Object.keys(c).length !== Object.keys(p).length)
return false;
for (const g in c)
if (!h10(c[g], p[g]))
return false;
return true;
}
return c === p;
}, s.aF = nt, s.aG = ct, s.aH = class extends N0 {
constructor(h10, c) {
super(h10, c), this.current = 0;
}
set(h10) {
this.current !== h10 && (this.current = h10, this.gl.uniform1i(this.location, h10));
}
}, s.aI = Ep, s.aJ = class extends N0 {
constructor(h10, c) {
super(h10, c), this.current = yJ;
}
set(h10) {
if (h10[12] !== this.current[12] || h10[0] !== this.current[0])
return this.current = h10, void this.gl.uniformMatrix4fv(this.location, false, h10);
for (let c = 1; c < 16; c++)
if (h10[c] !== this.current[c]) {
this.current = h10, this.gl.uniformMatrix4fv(this.location, false, h10);
break;
}
}
}, s.aK = MO, s.aL = SO, s.aM = tn, s.aN = class extends N0 {
constructor(h10, c) {
super(h10, c), this.current = [0, 0, 0];
}
set(h10) {
h10[0] === this.current[0] && h10[1] === this.current[1] && h10[2] === this.current[2] || (this.current = h10, this.gl.uniform3f(this.location, h10[0], h10[1], h10[2]));
}
}, s.aO = class extends N0 {
constructor(h10, c) {
super(h10, c), this.current = [0, 0];
}
set(h10) {
h10[0] === this.current[0] && h10[1] === this.current[1] || (this.current = h10, this.gl.uniform2f(this.location, h10[0], h10[1]));
}
}, s.aP = function(h10, c, p, g, w, H, A) {
var C = 1 / (c - p), N = 1 / (g - w), z = 1 / (H - A);
return h10[0] = -2 * C, h10[1] = 0, h10[2] = 0, h10[3] = 0, h10[4] = 0, h10[5] = -2 * N, h10[6] = 0, h10[7] = 0, h10[8] = 0, h10[9] = 0, h10[10] = 2 * z, h10[11] = 0, h10[12] = (c + p) * C, h10[13] = (w + g) * N, h10[14] = (A + H) * z, h10[15] = 1, h10;
}, s.aQ = EJ, s.aR = class extends Nt {
}, s.aS = mtt, s.aT = class extends Wt {
}, s.aU = O_, s.aV = function(h10) {
return h10 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(h10) / Math.LN2));
}, s.aW = zO, s.aX = k1, s.aY = C2, s.aZ = class extends ur {
}, s.a_ = function(h10, c) {
return h10[0] === c[0] && h10[1] === c[1] && h10[2] === c[2] && h10[3] === c[3] && h10[4] === c[4] && h10[5] === c[5] && h10[6] === c[6] && h10[7] === c[7] && h10[8] === c[8] && h10[9] === c[9] && h10[10] === c[10] && h10[11] === c[11] && h10[12] === c[12] && h10[13] === c[13] && h10[14] === c[14] && h10[15] === c[15];
}, s.aa = function(h10) {
const c = {};
if (h10.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(h10, c) {
const p = [];
for (const g in h10)
g in c || p.push(g);
return p;
}, s.ac = F, s.ad = function(h10, 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 !== h10 && (h10[8] = c[8], h10[9] = c[9], h10[10] = c[10], h10[11] = c[11], h10[12] = c[12], h10[13] = c[13], h10[14] = c[14], h10[15] = c[15]), h10[0] = H * w + z * g, h10[1] = A * w + W * g, h10[2] = C * w + X * g, h10[3] = N * w + tt * g, h10[4] = z * w - H * g, h10[5] = W * w - A * g, h10[6] = X * w - C * g, h10[7] = tt * w - N * g, h10;
}, s.ae = function(h10) {
var c = new Bl(16);
return c[0] = h10[0], c[1] = h10[1], c[2] = h10[2], c[3] = h10[3], c[4] = h10[4], c[5] = h10[5], c[6] = h10[6], c[7] = h10[7], c[8] = h10[8], c[9] = h10[9], c[10] = h10[10], c[11] = h10[11], c[12] = h10[12], c[13] = h10[13], c[14] = h10[14], c[15] = h10[15], c;
}, s.af = Ap, s.ag = function(h10, c) {
let p = 0, g = 0;
if (h10.kind === "constant")
g = h10.layoutSize;
else if (h10.kind !== "source") {
const { interpolationType: w, minZoom: H, maxZoom: A } = h10, C = w ? F(un.interpolationFactor(w, c, H, A), 0, 1) : 0;
h10.kind === "camera" ? g = xr.number(h10.minSize, h10.maxSize, C) : p = C;
}
return { uSizeT: p, uSize: g };
}, s.ai = function(h10, { uSize: c, uSizeT: p }, { lowerSize: g, upperSize: w }) {
return h10.kind === "source" ? g / Sa : h10.kind === "composite" ? xr.number(g / Sa, w / Sa, p) : c;
}, s.aj = W_, s.ak = function(h10, c, p, g) {
const w = c.y - h10.y, H = c.x - h10.x, A = g.y - p.y, C = g.x - p.x, N = A * H - C * w;
if (N === 0)
return null;
const z = (C * (h10.y - p.y) - A * (h10.x - p.x)) / N;
return new f(h10.x + z * H, h10.y + z * w);
}, s.al = UC, s.am = CO, s.an = S_, s.ao = function(h10) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h10)
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 = $_, s.as = function(h10, 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 ? (h10[0] = (C * rr - N * sr + z * Qr) * (ue = 1 / ue), h10[1] = (w * sr - g * rr - H * Qr) * ue, h10[2] = (Tt * Xe - Lt * _e + Et * ee) * ue, h10[3] = (tt * _e - X * Xe - at * ee) * ue, h10[4] = (N * Re - A * rr - z * ze) * ue, h10[5] = (p * rr - w * Re + H * ze) * ue, h10[6] = (Lt * Bt - ut * Xe - Et * Pt) * ue, h10[7] = (W * Xe - tt * Bt + at * Pt) * ue, h10[8] = (A * sr - C * Re + z * Er) * ue, h10[9] = (g * Re - p * sr - H * Er) * ue, h10[10] = (ut * _e - Tt * Bt + Et * $t) * ue, h10[11] = (X * Bt - W * _e - at * $t) * ue, h10[12] = (C * ze - A * Qr - N * Er) * ue, h10[13] = (p * Qr - g * ze + w * Er) * ue, h10[14] = (Tt * Pt - ut * ee - Lt * $t) * ue, h10[15] = (W * ee - X * Pt + tt * $t) * ue, h10) : null;
}, s.at = eb, s.au = G_, s.av = rb, s.aw = function() {
const h10 = {}, 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 && (h10[p] = w);
}
}
return h10;
}, s.ax = Vc, s.ay = te, s.az = function(h10) {
h10 = h10.slice();
const c = /* @__PURE__ */ Object.create(null);
for (let p = 0; p < h10.length; p++)
c[h10[p].id] = h10[p];
for (let p = 0; p < h10.length; p++)
"ref" in h10[p] && (h10[p] = Jr(h10[p], c[h10[p].ref]));
return h10;
}, s.b = Ve, s.b0 = function(h10, c) {
return h10[0] = c[0], h10[1] = c[1], h10[2] = c[2], h10[3] = c[3], h10[4] = c[4], h10[5] = c[5], h10[6] = c[6], h10[7] = c[7], h10[8] = c[8], h10[9] = c[9], h10[10] = c[10], h10[11] = c[11], h10[12] = c[12], h10[13] = c[13], h10[14] = c[14], h10[15] = c[15], h10;
}, s.b1 = function(h10, c, p) {
return h10[0] = c[0] * p[0], h10[1] = c[1] * p[1], h10[2] = c[2] * p[2], h10[3] = c[3] * p[3], h10;
}, s.b2 = function(h10, c) {
return h10[0] * c[0] + h10[1] * c[1] + h10[2] * c[2] + h10[3] * c[3];
}, s.b3 = U, s.b4 = RC, s.b5 = PC, s.b6 = function(h10, c, p, g, w) {
var H, A = 1 / Math.tan(c / 2);
return h10[0] = A / p, h10[1] = 0, h10[2] = 0, h10[3] = 0, h10[4] = 0, h10[5] = A, h10[6] = 0, h10[7] = 0, h10[8] = 0, h10[9] = 0, h10[11] = -1, h10[12] = 0, h10[13] = 0, h10[15] = 0, w != null && w !== 1 / 0 ? (h10[10] = (w + g) * (H = 1 / (g - w)), h10[14] = 2 * w * g * H) : (h10[10] = -1, h10[14] = -2 * g), h10;
}, s.b7 = function(h10, 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 !== h10 && (h10[0] = c[0], h10[1] = c[1], h10[2] = c[2], h10[3] = c[3], h10[12] = c[12], h10[13] = c[13], h10[14] = c[14], h10[15] = c[15]), h10[4] = H * w + z * g, h10[5] = A * w + W * g, h10[6] = C * w + X * g, h10[7] = N * w + tt * g, h10[8] = z * w - H * g, h10[9] = W * w - A * g, h10[10] = X * w - C * g, h10[11] = tt * w - N * g, h10;
}, s.b8 = k, s.b9 = R, s.bA = cC, s.bB = function(h10) {
return h10.message === Ke;
}, s.bC = _1, s.bD = Vo, s.ba = function(h10) {
return h10 * Math.PI / 180;
}, s.bb = function(h10, c) {
const { x: p, y: g } = ru.fromLngLat(c);
return !(h10 < 0 || h10 > 25 || g < 0 || g >= 1 || p < 0 || p >= 1);
}, s.bc = function(h10, c) {
return h10[0] = c[0], h10[1] = 0, h10[2] = 0, h10[3] = 0, h10[4] = 0, h10[5] = c[1], h10[6] = 0, h10[7] = 0, h10[8] = 0, h10[9] = 0, h10[10] = c[2], h10[11] = 0, h10[12] = 0, h10[13] = 0, h10[14] = 0, h10[15] = 1, h10;
}, s.bd = class extends Z {
}, s.be = K_, s.bf = tet, s.bh = Gt, s.bi = function(h10, c) {
er.REGISTERED_PROTOCOLS[h10] = c;
}, s.bj = function(h10) {
delete er.REGISTERED_PROTOCOLS[h10];
}, s.bk = function(h10, c) {
const p = {};
for (let w = 0; w < h10.length; w++) {
const H = c && c[h10[w].id] || e2(h10[w]);
c && (c[h10[w].id] = H);
let A = p[H];
A || (A = p[H] = []), A.push(h10[w]);
}
const g = [];
for (const w in p)
g.push(p[w]);
return g;
}, s.bl = nr, s.bm = DC, s.bn = BC, s.bo = gC, s.bp = function(h10) {
h10.bucket.createArrays(), h10.bucket.tilePixelRatio = Zi / (512 * h10.bucket.overscaling), h10.bucket.compareText = {}, h10.bucket.iconsNeedLinear = false;
const c = h10.bucket.layers[0], p = c.layout, g = c._unevaluatedLayout._values, w = { layoutIconSize: g["icon-size"].possiblyEvaluate(new ti(h10.bucket.zoom + 1), h10.canonical), layoutTextSize: g["text-size"].possiblyEvaluate(new ti(h10.bucket.zoom + 1), h10.canonical), textMaxSize: g["text-size"].possiblyEvaluate(new ti(18)) };
if (h10.bucket.textSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h10.bucket.textSizeData;
w.compositeTextSizes = [g["text-size"].possiblyEvaluate(new ti(z), h10.canonical), g["text-size"].possiblyEvaluate(new ti(W), h10.canonical)];
}
if (h10.bucket.iconSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h10.bucket.iconSizeData;
w.compositeIconSizes = [g["icon-size"].possiblyEvaluate(new ti(z), h10.canonical), g["icon-size"].possiblyEvaluate(new ti(W), h10.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 h10.bucket.features) {
const W = p.get("text-font").evaluate(z, {}, h10.canonical).join(","), X = N.evaluate(z, {}, h10.canonical), tt = w.layoutTextSize.evaluate(z, {}, h10.canonical), at = w.layoutIconSize.evaluate(z, {}, h10.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, {}, h10.canonical) * r1, _e = m_(Bt) ? ee : 0, Xe = p.get("text-anchor").evaluate(z, {}, h10.canonical), Er = JC(c, z, h10.canonical);
if (!Er) {
const sr = p.get("text-radial-offset").evaluate(z, {}, h10.canonical);
Et = sr ? YC(Xe, [sr * r1, tb]) : p.get("text-offset").evaluate(z, {}, h10.canonical).map((rr) => rr * r1);
}
let ze = A ? "center" : p.get("text-justify").evaluate(z, {}, h10.canonical);
const Re = p.get("symbol-placement") === "point" ? p.get("text-max-width").evaluate(z, {}, h10.canonical) * r1 : 1 / 0, Qr = () => {
h10.bucket.allowVerticalPlacement && Rc(Bt) && (ut.vertical = Vp(Tt, h10.glyphMap, h10.glyphPositions, h10.imagePositions, W, Re, H, Xe, "left", _e, Et, s.ah.vertical, true, 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(eb(Er.values[ue]));
else
sr.add(ze);
let rr = false;
for (const ue of sr)
if (!ut.horizontal[ue])
if (rr)
ut.horizontal[ue] = ut.horizontal[0];
else {
const gr = Vp(Tt, h10.glyphMap, h10.glyphPositions, h10.imagePositions, W, Re, H, "center", ue, _e, Et, s.ah.horizontal, false, tt, X);
gr && (ut.horizontal[ue] = gr, rr = gr.positionedLines.length === 1);
}
Qr();
} else {
ze === "auto" && (ze = eb(Xe));
const sr = Vp(Tt, h10.glyphMap, h10.glyphPositions, h10.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.horizontal, false, tt, X);
sr && (ut.horizontal[ze] = sr), Qr(), Rc(Bt) && A && C && (ut.vertical = Vp(Tt, h10.glyphMap, h10.glyphPositions, h10.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.vertical, false, tt, X));
}
}
let $t = false;
if (z.icon && z.icon.name) {
const Bt = h10.imageMap[z.icon.name];
Bt && (Lt = Vtt(h10.imagePositions[z.icon.name], p.get("icon-offset").evaluate(z, {}, h10.canonical), p.get("icon-anchor").evaluate(z, {}, h10.canonical)), $t = !!Bt.sdf, h10.bucket.sdfIcons === void 0 ? h10.bucket.sdfIcons = $t : h10.bucket.sdfIcons !== $t && It("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (Bt.pixelRatio !== h10.bucket.pixelRatio || p.get("icon-rotate").constantOr(1) !== 0) && (h10.bucket.iconsNeedLinear = true));
}
const Pt = ek(ut.horizontal) || ut.vertical;
h10.bucket.iconsInText = !!Pt && Pt.iconsInText, (Pt || Lt) && Ytt(h10.bucket, z, ut, Lt, h10.imageMap, w, tt, at, Et, $t, h10.canonical);
}
h10.showCollisionBoxes && h10.bucket.generateCollisionDebugBuffers();
}, s.bq = D_, s.br = V_, s.bs = N_, s.bt = d6, s.bu = B_, s.bv = class {
constructor(h10) {
this._marks = { start: [h10.url, "start"].join("#"), end: [h10.url, "end"].join("#"), measure: h10.url.toString() }, performance.mark(this._marks.start);
}
finish() {
performance.mark(this._marks.end);
let h10 = performance.getEntriesByName(this._marks.measure);
return h10.length === 0 && (performance.measure(this._marks.measure, this._marks.start, this._marks.end), h10 = performance.getEntriesByName(this._marks.measure), performance.clearMarks(this._marks.start), performance.clearMarks(this._marks.end), performance.clearMeasures(this._marks.measure)), h10;
}
}, s.bw = function(h10, c, p, g, w) {
return a(this, void 0, void 0, function* () {
if (O())
try {
return yield qr(h10, 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: true })), 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;
}(h10, c, p, g, w);
});
}, s.bx = NC, s.by = u, s.bz = d, s.c = He, s.d = (h10) => a(void 0, void 0, void 0, function* () {
if (h10.byteLength === 0)
return createImageBitmap(new ImageData(1, 1));
const c = new Blob([new Uint8Array(h10)], { 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 = (h10) => 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(h10)], { type: "image/png" });
g.src = h10.byteLength ? URL.createObjectURL(w) : yr;
}), s.g = Je, s.h = (h10, c) => me($(h10, { type: "json" }), c), s.i = oe, s.j = $e, s.k = qe, s.l = (h10, c) => me($(h10, { type: "arrayBuffer" }), c), s.m = me, s.n = function(h10) {
return new B_(h10).readFields(Htt, []);
}, s.o = $c, s.p = mC, s.q = S, s.r = f_, s.s = de, s.t = Ic, s.u = F3, s.v = Ct, s.w = It, s.x = function([h10, c, p]) {
return c += 90, c *= Math.PI / 180, p *= Math.PI / 180, { x: h10 * Math.cos(c) * Math.sin(p), y: h10 * Math.sin(c) * Math.sin(p), z: h10 * 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 Jt = Vt.sourceLayer || "_geojsonTileLayer";
let ae = St[Jt];
ae || (ae = St[Jt] = []), ae.push(At);
}
}
}
class u {
constructor(ot) {
const st = {}, pt = [];
for (const jt in ot) {
const St = ot[jt], Jt = 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), Jt[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 Jt in St) {
const ae = St[+Jt];
if (!ae || ae.bitmap.width === 0 || ae.bitmap.height === 0)
continue;
const Xt = st[jt][Jt].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 }, Jt = st.familiesBySource[this.source];
for (const br in Jt) {
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), rs = Vt.getId(Ri, br);
Kn.push({ feature: Ri, id: rs, index: Li, sourceLayerIndex: cn });
}
for (const Li of Jt[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((rs) => rs.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 Jt = {};
if (pt) {
const Xt = pt.finish();
Xt && (Jt.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: Jt };
try {
const Xt = yield ae;
return s.e({ rawTileData: jt.slice(0) }, Xt, St, Jt);
} 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, Jt = yt.width + 2, ae = yt.height + 2, Xt = s.b(yt) ? new s.R({ width: Jt, height: ae }, yield s.bw(yt, -1, -1, Jt, 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], Jt = At[jt];
if (St !== null) {
Jt === void 0 && (pt.push(jt), At[jt] = Jt = pt.length - 1), ot.writeVarint(Jt);
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], Jt = 1;
pt === 1 && (Jt = St.length), ot.writeVarint(It(1, Jt));
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: false, generateId: false, 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 Jt = ot[St];
if (!Jt.geometry)
continue;
const [ae, Xt] = Jt.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 Jt = +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() - Jt);
}
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)), Jt = jt.data, ae = [];
for (const Xt of St) {
const Le = this.stride * Xt;
ae.push(Jt[Le + Ke] > 1 ? Je(Jt, Le, this.clusterProps) : this.points[Jt[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), Jt = [];
for (const ae of St) {
const Xt = ae * this.stride;
Vt[Xt + 4] === ot && Jt.push(Vt[Xt + Ke] > 1 ? Je(Vt, Xt, this.clusterProps) : this.points[Vt[Xt + Qe]]);
}
if (Jt.length === 0)
throw new Error(yt);
return Jt;
}
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, Jt = (pt - St) / At, ae = (pt + 1 + St) / At, Xt = { features: [] };
return this._addTileFeatures(yt.range((st - St) / At, Jt, (st + 1 + St) / At, ae), yt.data, st, pt, At, Xt), st === 0 && this._addTileFeatures(yt.range(1 - St / At, Jt, 1, ae), yt.data, At, pt, At, Xt), st === At - 1 && this._addTileFeatures(yt.range(0, Jt, 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, Jt = st[St + Ke] > 1;
let ae, Xt, Le;
if (Jt)
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 = Jt || 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, Jt = [], 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, true), zr = this.clusterProps.length, this.clusterProps.push(lr)), At(lr, this._map(St, cn)));
}
St[Xt + 4] = br, Jt.push(Ar / Se, vn / Se, 1 / 0, br, -1, Se), At && Jt.push(zr);
} else {
for (let lr = 0; lr < ae; lr++)
Jt.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++)
Jt.push(St[Ar + vn]);
}
}
}
}
return Jt;
}
_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: true, 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], Jt = 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, Jt, 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 Jt of yt)
ar(Jt, jt);
else if (At === "LineString")
Ct(yt, jt, Vt, false);
else if (At === "MultiLineString") {
if (st.lineMetrics) {
for (const Jt of yt)
jt = [], Ct(Jt, jt, Vt, false), xt.push(Tr(St, "LineString", jt, ot.properties));
return;
}
en(yt, jt, Vt, false);
} else if (At === "Polygon")
en(yt, jt, Vt, true);
else {
if (At !== "MultiPolygon") {
if (At === "GeometryCollection") {
for (const Jt of ot.geometry.geometries)
$e(xt, { id: St, geometry: Jt, properties: ot.properties }, st, pt);
return;
}
throw new Error("Input data is not a valid GeoJSON object.");
}
for (const Jt of yt) {
const ae = [];
en(Jt, ae, Vt, true), 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 Jt = Jr(xt[St][0]), ae = Hr(xt[St][1]);
ot.push(Jt, ae, 0), St > 0 && (Vt += pt ? (yt * ae - Jt * At) / 2 : Math.sqrt(Math.pow(Jt - yt, 2) + Math.pow(ae - At, 2))), yt = Jt, 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 Jt of xt) {
const ae = Jt.geometry;
let Xt = Jt.type;
const Le = yt === 0 ? Jt.minX : Jt.minY, or = yt === 0 ? Jt.maxX : Jt.maxY;
if (Le >= st && or < pt) {
St.push(Jt);
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, false, jt.lineMetrics);
else if (Xt === "MultiLineString")
ki(ae, Rt, st, pt, yt, false);
else if (Xt === "Polygon")
ki(ae, Rt, st, pt, yt, true);
else if (Xt === "MultiPolygon")
for (const Te of ae) {
const Se = [];
ki(Te, Se, st, pt, yt, true), Se.length && Rt.push(Se);
}
if (Rt.length) {
if (jt.lineMetrics && Xt === "LineString") {
for (const Te of Rt)
St.push(Tr(Jt.id, Xt, Te, Jt.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(Jt.id, Xt, Rt, Jt.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 Jt, 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 = false;
Vt && (Jt = 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 + Jt * ae)) : Br > pt ? cn < pt && (ae = St(jt, lr, Ar, zr, br, pt), Vt && (jt.start = Xt + Jt * ae)) : _i(jt, lr, Ar, vn), cn < st && Br >= st && (ae = St(jt, lr, Ar, zr, br, st), Kn = true), cn > pt && Br <= pt && (ae = St(jt, lr, Ar, zr, br, pt), Kn = true), !At && Kn && (Vt && (jt.end = Xt + Jt * ae), ot.push(jt), jt = Ji(xt)), Vt && (Xt += Jt);
}
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, false);
}
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 Jt of jt)
St.push(bi(Jt, 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 Jt = [];
for (let ae = 0; ae < Vt[St].length; ae += 2)
Jt.push(Hi(Vt[St][ae], Vt[St][ae + 1], ot, st, pt, yt));
At.geometry.push(Jt);
}
}
return xt.transformed = true, 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: false, 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, false, false);
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 Jt = 0; Jt < St.length; Jt++)
Dr(Vt, St[Jt], xt, st, true, Jt === 0);
}
if (Vt.length) {
let jt = ot.tags || null;
if (At === "LineString" && pt.lineMetrics) {
jt = {};
for (const Jt in ot.tags)
jt[Jt] = ot.tags[Jt];
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, Jt) {
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 === Jt)
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: false, promoteId: null, generateId: false, 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 Jt = Rr(At, 1, -1 - jt, jt, 0, -1, 2, Vt), ae = Rr(At, 1, 1 - jt, 2 + jt, 0, -1, 2, Vt);
return (Jt || ae) && (St = Rr(At, 1, -jt, 1 + jt, 0, -1, 2, Vt) || [], Jt && (St = ye(Jt, 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], Jt = this.options, ae = Jt.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, Jt), 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 === Jt.indexMaxZoom || or.numPoints <= Jt.indexMaxPoints)
continue;
} else {
if (st === Jt.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 * Jt.buffer / Jt.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, Jt), cn = Rr(ot, Xt, pt + Te, pt + lr, 0, or.minX, or.maxX, Jt);
ot = null, Br && (Ar = Rr(Br, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Jt), vn = Rr(Br, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Jt), Br = null), cn && (zr = Rr(cn, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Jt), br = Rr(cn, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Jt), 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 Jt, ae = ot, Xt = st, Le = pt;
for (; !Jt && ae > 0; )
ae--, Xt >>= 1, Le >>= 1, Jt = this.tiles[y1(ae, Xt, Le)];
return Jt && Jt.source ? (Vt > 1 && (console.log("found parent tile z%d-%d-%d", ae, Xt, Le), console.time("drilling down")), this.splitTile(Jt.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 true;
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 false;
st.add(yt);
}
return true;
}
return false;
}
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 Jt of this._feature.geometry)
St.push([new s.P(Jt[0], Jt[1])]);
return St;
}
{
const St = [];
for (const Jt of this._feature.geometry) {
const ae = [];
for (const Xt of Jt)
ae.push(new s.P(Xt[0], Xt[1]));
St.push(ae);
}
return St;
}
}
toGeoJSON(St, Jt, ae) {
return E.call(this, St, Jt, 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 = {}, Jt = {}, 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, Jt[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] = Jt[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: true };
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, true), ot.filter) {
const yt = s.bC(ot.filter, { type: "boolean", "property-type": "data-driven", overridable: false, transition: false });
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, Jt, 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 (((Jt = Xt.removeProperties) === null || Jt === void 0 ? void 0 : Jt.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.1";
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: true });
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, true);
}
static suppressClick() {
window.addEventListener("click", Q.suppressClickInternal, true), window.setTimeout(() => {
window.removeEventListener("click", Q.suppressClickInternal, true);
}, 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: false, testSupport: function(S) {
!E && L && (x ? O(S) : _ = S);
} };
let _, L, E = false, x = false;
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 = true;
} catch {
}
S.deleteTexture(l), E = true;
}
var k;
typeof document < "u" && (L = document.createElement("img"), L.onload = () => {
_ && O(_), _ = null, x = true;
}, L.onerror = () => {
E = true, _ = 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 = true) => 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 === false && !a.i(self) && !a.g(Z.url) && (!Z.headers || Object.keys(Z.headers).reduce((Ht, Ot) => Ht && Ot === "accept", true));
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 true;
return false;
})() ? 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(false), D.pixelStoreUnpack.set(1), D.pixelStoreUnpackPremultiplyAlpha.set(this.format === j.RGBA && (!m || m.premultiply !== false)), 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)), true);
}
class It extends a.E {
constructor() {
super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = false, this.requestors = [], this.patterns = {}, this.atlasImage = new a.R({ width: 1, height: 1 }), this.dirty = true;
}
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 = true;
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 = false), this._validateStretch(m.stretchY, b && b.height) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchY" value`))), v = false), this._validateContent(m.content, m) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "content" value`))), v = false), v;
}
_validateStretch(l, m) {
if (!l)
return true;
let v = 0;
for (const b of l) {
if (b[0] < v || b[1] < b[0] || m < b[1])
return false;
v = b[1];
}
return true;
}
_validateContent(l, m) {
if (!l)
return true;
if (l.length !== 4)
return false;
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 = true) {
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] = true;
}
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 = true;
if (!this.isLoaded())
for (const M of l)
this.images[M] || (b = false);
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 = false) : 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 = true;
}
beginFrame() {
this.callbackDispatchedThisFrame = {};
}
dispatchRenderCallbacks(l) {
for (const m of l) {
if (this.callbackDispatchedThisFrame[m])
continue;
this.callbackDispatchedThisFrame[m] = true;
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] = true, { 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: true } };
}
}
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: true });
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 !== false) && a.t(this, l.call(a.u, { value: m, style: { glyphs: true, sprite: true }, 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) !== false && a.t(this, l.call(a.u, a.e({ value: m, style: { glyphs: true, sprite: true }, 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 = true;
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 = true, V;
}
bind(l) {
const m = l.gl;
this.texture ? (m.bindTexture(m.TEXTURE_2D, this.texture), this.dirty && (this.dirty = false, 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] = true, 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 = true) {
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 true;
}
else
for (const Qt in lt) {
const wt = lt[Qt];
if (wt.source === ft && wt.type === "fill-extrusion")
return true;
}
return false;
}(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] = true, 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 = true, this.isTileClipped = true, this._loaded = false, 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 = false, 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 = true, 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 false;
}
}
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 = true, this.scheme = "xyz", this.tileSize = 512, this._loaded = false, 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 = false, 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 = true, 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: true }) : (l.texture = new rt(b, V, M.RGBA, { useMipmap: true }), 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 false;
}
}
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 = true, l.needsTerrainPrepare = true, 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: false }, j[new a.S(l.overscaledZ, D, m.z, V, m.y).key] = { backfilled: false }, m.y > 0 && (j[new a.S(l.overscaledZ, M, m.z, b, m.y - 1).key] = { backfilled: false }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y - 1).key] = { backfilled: false }, j[new a.S(l.overscaledZ, D, m.z, V, m.y - 1).key] = { backfilled: false }), m.y + 1 < v && (j[new a.S(l.overscaledZ, M, m.z, b, m.y + 1).key] = { backfilled: false }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y + 1).key] = { backfilled: false }, j[new a.S(l.overscaledZ, D, m.z, V, m.y + 1).key] = { backfilled: false }), 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 = true, this.reparseOverscaled = true, this._removed = false, 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 || false, 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 || false, generateId: m.generateId || false }, 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: false, generateId: m.generateId || false }, 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 = true;
});
}
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 = true, 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 false;
}
}
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 = false, this.setEventedParent(b), this.options = m;
}
load(l) {
return a._(this, void 0, void 0, function* () {
this._loaded = false, 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 = true, m && m.data && (this.image = m.data, l && (this.coordinates = l), this._finishLoading());
} catch (m) {
this._request = null, this._loaded = true, 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 = false;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = true);
}
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 false;
}
}
class ki extends Ji {
constructor(l, m, v, b) {
super(l, m, v, b), this.roundZoom = true, this.type = "video", this.options = m;
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = false;
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 = true, !m)
return;
this.video = m, this.video.loop = true, 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 = false;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = true);
}
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 = true, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new a.j(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
this._playing = true, this.map.triggerRepaint();
}, this.pause = function() {
this._playing && (this.prepare(), this._playing = false);
}, this._finishLoading());
});
}
getCanvas() {
return this.canvas;
}
onAdd(l) {
this.map = l, this.load(), this.canvas && this.animate && this.play();
}
onRemove() {
this.pause();
}
prepare() {
let l = false;
if (this.canvas.width !== this.width && (this.width = this.canvas.width, l = true), this.canvas.height !== this.height && (this.height = this.canvas.height, l = true), 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: true }) : this.texture = new rt(m, this.canvas, v.RGBA, { premultiply: true });
let b = false;
for (const M in this.tiles) {
const V = this.tiles[M];
V.state !== "loaded" && (V.state = "loaded", V.texture = this.texture, b = true);
}
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 true;
return false;
}
}
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 = false) {
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 = false, this.hasRTLText = false, 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 = false;
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6) {
if (this.hasSymbolBuckets = true, !v)
break;
M.justReloaded = true;
}
}
if (this.hasRTLText = false, this.hasSymbolBuckets)
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6 && M.hasRTLText) {
this.hasRTLText = true, 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 = true), 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, true);
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 = false;
if (this.expirationTime > v)
b = false;
else if (m)
if (this.expirationTime < m)
b = true;
else {
const M = this.expirationTime - m;
M ? this.expirationTime = v + Math.max(M, 3e4) : b = true;
}
else
b = true;
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] = true;
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 true;
}
}
return false;
}
}
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 = false;
}), 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 = false, this._updated = false;
}
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 true;
if (!this._sourceLoaded || !this._source.loaded())
return false;
if (!(this.used === void 0 && this.usedForTerrain === void 0 || this.used || this.usedForTerrain))
return true;
if (!this._updated)
return false;
for (const l in this._tiles) {
const m = this._tiles[l];
if (m.state !== "loaded" && m.state !== "errored")
return false;
}
return true;
}
getSource() {
return this._source;
}
pause() {
this._paused = true;
}
resume() {
if (!this._paused)
return;
const l = this._shouldReloadOnResume;
this._paused = false, this._shouldReloadOnResume = false, 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 = true;
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 = true), 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 = true, b.needsTerrainPrepare = true;
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 = true)));
}
}
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] = true, 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] = true);
}
}
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 = true, 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] = true, 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 = true, this._abortTile(m), this._unloadTile(m))));
}
_dataHandler(l) {
const m = l.sourceDataType;
l.dataType === "source" && m === "metadata" && (this._sourceLoaded = true), this._sourceLoaded && !this._paused && l.dataType === "source" && m === "content" && (this.reload(), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = true);
}
clearTiles() {
this._shouldReloadOnResume = false, this._paused = false;
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 true;
if (y1(this._source.type)) {
const l = f.now();
for (const m in this._tiles)
if (this._tiles[m].fadeEndTime >= l)
return true;
}
return false;
}
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 = true;
return S === "always" || S !== "never" && l !== "never" || (m = false), 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, false, null);
}
hitTest(l, m, v, b, M, V) {
return this._query(l, m, v, b, true, 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 false;
const Y = [];
return this._forEachCell(V, j, D, Z, this._queryCellCircle, Y, { hitTest: true, 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] = true;
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 true;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Z.circle[wt]) {
Z.circle[wt] = true;
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 true;
}
}
}
return false;
}
_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] = true;
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(true), true;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Y.circle[wt]) {
Y.circle[wt] = true;
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(true), true;
}
}
}
_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 false;
const Y = (D - M) / 2, J = Math.abs(m - (M + Y));
if (J > Y + v)
return false;
if (Z <= j || J <= Y)
return true;
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: false };
}
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 = false;
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 = false;
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: false }, projection: Z, tileAnchorPoint: new a.P(we.anchorX, we.anchorY), unwrappedTileID: Y, width: J, height: lt, translation: ft }, Nr = Vt(ur, we, Ae, false, D, l, M, S.glyphOffsetArray, Ot, Dt, j);
Wt = Nr.useVertical, (Nr.notEnoughRoom || Wt || Nr.needsFlipping && Vt(ur, we, Ae, true, 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: true } : (S === a.ah.vertical ? l.y < m.y : l.x > m.x) ? { needsFlipping: true } : 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: true };
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: true };
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 : Jt(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 = Jt(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 Jt(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 = false), 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 = Jt(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: false, 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: false, offscreen: false } : { box: [Ht, Ot, bt, Nt], placeable: true, 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: false }, 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, false, m, false, Dt);
let he = false, we = false, De = true;
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, ms = mo + tr;
if (De = De && this.isOffscreen(q1, k1, X1, ms), we = we || this.isInsideGrid(q1, k1, X1, ms), l !== "always" && this.grid.hitTestCircle(ni, mo, tr, l, lt) && (he = true, !Y))
return { circles: [], offscreen: false, 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] = true, 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: false, 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 = false;
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 = true;
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 = false, 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(false, false, false));
let nn = false, ri = false, C1 = true, O2 = null, ni = { box: null, placeable: false, offscreen: null }, mo = { box: null, placeable: false, offscreen: null }, q1 = null, k1 = null, X1 = null, ms = 0, s6 = 0, Il = 0;
We.textFeatureIndex ? ms = We.textFeatureIndex : Pe.useRuntimeCollisionCircles && (ms = Pe.featureIndex), We.verticalTextFeatureIndex && (s6 = We.verticalTextFeatureIndex);
const a6 = We.textBox;
if (a6) {
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(a6, 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, l6) => {
const c6 = an.x2 - an.x1, Lp = an.y2 - an.y1, b_ = Pe.textBoxScale, wp = De && Dt === "never" ? B3 : null;
let Ma = null, xp = bt === "never" ? 1 : 2, Vl = "never";
b1 && xp++;
for (let R0 = 0; R0 < xp; R0++) {
for (let Rl = Ea; Rl < C2; Rl++) {
const Nl = b.textAnchorOffsets.get(Rl);
if (b1 && Nl.textAnchor !== b1)
continue;
const u6 = this.attemptAnchorPlacement(Nl, an, c6, Lp, b_, he, we, lt, j, Z, Mt, Vl, Pe, b, l6, V, D, wp, ur);
if (u6 && (Ma = u6.placedGlyphBoxes, Ma && Ma.placeable))
return nn = true, O2 = u6.shift, Ma;
}
b1 ? b1 = null : Vl = bt;
}
return v && !Ma && (Ma = { box: this.collisionIndex.placeCollisionBox(a6, "always", lt, j, Z, we, he, V, Mt.predicate, ur, new a.P(0, 0)).box, offscreen: false, placeable: false }), Ma;
};
s2(() => I1(a6, 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: true, 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 && (Il = 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, Pl = Ot || Pe.numIconVertices === 0;
i2 || Pl ? Pl ? i2 || (ri = ri && nn) : nn = ri && nn : ri = nn = ri && nn;
const jc = ri && X1.placeable;
if (nn && q1.placeable && this.collisionIndex.insertCollisionBox(q1.box, bt, M.get("text-ignore-placement"), b.bucketInstanceId, mo && mo.placeable && s6 ? s6 : ms, Mt.ID), jc && this.collisionIndex.insertCollisionBox(X1.box, Dt, M.get("icon-ignore-placement"), b.bucketInstanceId, Il, Mt.ID), k1 && nn && this.collisionIndex.insertCollisionCircles(k1.circles, bt, M.get("text-ignore-placement"), b.bucketInstanceId, ms, 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] = true;
};
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 = false;
}
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 = false;
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, false, false);
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 = false), l.hasIconData() && (l.icon.opacityVertexArray.clear(), l.icon.hasVisibleVertices = false), 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, false, false, true), 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")), true);
!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] = true;
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 = true;
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 = false;
}
if (Ae.textBox || Ae.verticalTextBox) {
let Pe;
Ae.textBox && (Pe = De), Ae.verticalTextBox && (Pe = tr), rs(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), rs(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 = true;
}
}
function rs(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), ns = 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 * ns + m * _n + l;
}
const uo = 0;
function u1() {
return { isOccluded: (S, l, m) => false, getPitchedTextCorrection: (S, l, m) => 1, get useSpecialProjectionForSymbols() {
return false;
}, projectTileCoordinates(S, l, m, v) {
throw new Error("Not implemented.");
}, translatePosition: (S, l, m, v) => function(b, M, V, D, j = false) {
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 true;
for (this._sortAcrossTiles && (this._sortAcrossTiles = false, 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 true;
return false;
}
}
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 = false;
}
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 = true;
}
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] = true, 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] = true, V.crossTileID = J;
break;
}
}
}
}
getCrossTileIDsLists() {
return Object.values(this._symbolsByKey).map(({ crossTileIDs: l }) => l);
}
}
class is {
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 false;
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] = true);
}
return this.indexes[l.overscaledZ] === void 0 && (this.indexes[l.overscaledZ] = {}), this.indexes[l.overscaledZ][l.key] = new jn(l, m.symbolInstances, m.bucketInstanceId), true;
}
removeBucketCrossTileIDs(l, m) {
for (const v of m.getCrossTileIDsLists())
for (const b of v)
delete this.usedCrossTileIDs[l][b];
}
removeStaleBuckets(l) {
let m = false;
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 = true);
}
return m;
}
}
class b2 {
constructor() {
this.layerIndexes = {}, this.crossTileIDs = new is(), 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 = false;
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 = true), V[j.bucketInstanceId] = true);
}
return b.removeStaleBuckets(V) && (M = true), M;
}
pruneUnusedLayers(l) {
const m = {};
l.forEach((v) => {
m[v] = true;
});
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 = false, 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 !== false, this._load(l, m, v);
}).catch(() => {
});
}
loadEmpty() {
this.fire(new a.k("dataloading", { dataType: "style" })), this._load(Ho, { validate: false });
}
_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 = true, this.stylesheet = M;
for (const V in M.sources)
this.addSource(V, M.sources[V], { validate: false });
M.sprite ? this._loadSprite(M.sprite) : this.imageManager.setLoaded(true), 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 = false, v = void 0) {
let b;
this.imageManager.setLoaded(false), 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] = true;
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], false) : this.imageManager.addImage(Z, M[V][j]), m && (this._changedImages[Z] = true);
}
}
}).catch((M) => {
this._spriteRequest = null, b = M, this.fire(new a.j(b));
}).finally(() => {
this.imageManager.setLoaded(true), this._availableImages = this.imageManager.listImages(), m && (this._changed = true), 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] = true;
this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = true, 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 false;
for (const l in this.sourceCaches)
if (!this.sourceCaches[l].loaded())
return false;
return !!this.imageManager.isLoaded();
}
_serializeByIds(l, m = false) {
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 true;
for (const l in this.sourceCaches)
if (this.sourceCaches[l].hasTransition())
return true;
for (const l in this._layers)
if (this._layers[l].hasTransition())
return true;
return false;
}
_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 = false;
}
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 = true);
}
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 = false;
}
}
_updateWorkerLayers(l, m) {
this.dispatcher.broadcast("UL", { layers: this._serializeByIds(l, false), removedIds: m });
}
_resetUpdates() {
this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = false;
}
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 false;
(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 false;
for (const D of V.operations)
D();
return this.stylesheet = l, this._serializedLayers = null, true;
}
_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] = true, this._changed = true, 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 = true);
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 = true;
}
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 = true;
}
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 = true;
}
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 = true, 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 = true, !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 = true);
}
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 = true, this._changed = true, 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 = true, this._updatedPaintProps[l] = true, 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, true), 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] = true, 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 = true;
}
_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] = true;
}
}
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] = true, 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 = false;
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = true;
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 = false;
if (!l && !v)
return;
if (l && !v)
b = true;
else if (!l && v)
b = true;
else
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = true;
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 !== false) && e1(this, l.call(a.u, a.e({ key: m, style: this.serialize(), value: v, styleSpec: a.v }, b)));
}
_remove(l = true) {
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 = false) {
let V = false, D = false;
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(true).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 = false), 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 = true), 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 = true, 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, true, 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] = true;
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 = true, 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, true, 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);float antialiased_blur=v_data.z;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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);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] = true, 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 = true);
!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 = true);
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 = true);
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 = true, V = [D, D];
} else
M = false, 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 = _l(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]] };
}, b0 = (S, l, m, v, b, M) => {
const V = S.lineAtlas, D = _l(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 _l(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 bl = (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: vc(b.paint.get("raster-hue-rotate")) };
var M, V;
};
function vc(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 });
}, D4 = (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, true, J, true, 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 }), F4 = { 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 _c = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" };
class L0 {
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[_c[M.type]], false, 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 hn2 {
constructor(l) {
this.gl = l.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false;
}
get() {
return this.current;
}
set(l) {
}
getDefault() {
return this.default;
}
setDefault() {
this.set(this.default);
}
}
class C3 extends hn2 {
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 = false);
}
}
class bc extends hn2 {
getDefault() {
return 1;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearDepth(l), this.current = l, this.dirty = false);
}
}
class ya extends hn2 {
getDefault() {
return 0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearStencil(l), this.current = l, this.dirty = false);
}
}
class B4 extends hn2 {
getDefault() {
return [true, true, true, true];
}
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 = false);
}
}
class j4 extends hn2 {
getDefault() {
return true;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthMask(l), this.current = l, this.dirty = false);
}
}
class Ll extends hn2 {
getDefault() {
return 255;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.stencilMask(l), this.current = l, this.dirty = false);
}
}
class Oo extends hn2 {
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 = false);
}
}
class z4 extends hn2 {
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 = false);
}
}
class w0 extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class wl extends hn2 {
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 = false);
}
}
class x0 extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class k3 extends hn2 {
getDefault() {
return this.gl.LESS;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthFunc(l), this.current = l, this.dirty = false);
}
}
class os extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class E0 extends hn2 {
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 = false);
}
}
class Lc extends hn2 {
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 = false);
}
}
class ss extends hn2 {
getDefault() {
return this.gl.FUNC_ADD;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.blendEquation(l), this.current = l, this.dirty = false);
}
}
class va extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class wc extends hn2 {
getDefault() {
return this.gl.BACK;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.cullFace(l), this.current = l, this.dirty = false);
}
}
class U4 extends hn2 {
getDefault() {
return this.gl.CCW;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.frontFace(l), this.current = l, this.dirty = false);
}
}
class M0 extends hn2 {
getDefault() {
return null;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.useProgram(l), this.current = l, this.dirty = false);
}
}
class I3 extends hn2 {
getDefault() {
return this.gl.TEXTURE0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.activeTexture(l), this.current = l, this.dirty = false);
}
}
class G4 extends hn2 {
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 = false);
}
}
class $4 extends hn2 {
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 = false;
}
}
class W4 extends hn2 {
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 = false;
}
}
class js extends hn2 {
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 = false;
}
}
class xl extends hn2 {
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 = false;
}
}
class Z4 extends hn2 {
getDefault() {
return null;
}
set(l) {
const m = this.gl;
m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, l), this.current = l, this.dirty = false;
}
}
class w2 extends hn2 {
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 = false;
}
}
class S0 extends hn2 {
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 = false;
}
}
class H0 extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class q4 extends hn2 {
getDefault() {
return false;
}
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 = false;
}
}
class _a extends hn2 {
constructor(l, m) {
super(l), this.context = l, this.parent = m;
}
getDefault() {
return null;
}
}
class x2 extends _a {
setDirty() {
this.dirty = true;
}
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 = false;
}
}
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 = false;
}
}
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 = false;
}
}
class X4 {
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, [false, false, false, false]), Mn.unblended = new Mn(Mn.Replace, a.aM.transparent, [true, true, true, true]), Mn.alphaBlended = new Mn([1, 771], a.aM.transparent, [true, true, true, true]);
class xc {
constructor(l) {
var m, v;
if (this.gl = l, this.clearColor = new C3(this), this.clearDepth = new bc(this), this.clearStencil = new ya(this), this.colorMask = new B4(this), this.depthMask = new j4(this), this.stencilMask = new Ll(this), this.stencilFunc = new Oo(this), this.stencilOp = new z4(this), this.stencilTest = new w0(this), this.depthRange = new wl(this), this.depthTest = new x0(this), this.depthFunc = new k3(this), this.blend = new os(this), this.blendFunc = new E0(this), this.blendColor = new Lc(this), this.blendEquation = new ss(this), this.cullFace = new va(this), this.cullFaceSide = new wc(this), this.frontFace = new U4(this), this.program = new M0(this), this.activeTexture = new I3(this), this.viewport = new G4(this), this.bindFramebuffer = new $4(this), this.bindRenderbuffer = new W4(this), this.bindTexture = new js(this), this.bindVertexBuffer = new xl(this), this.bindElementBuffer = new Z4(this), this.bindVertexArray = new w2(this), this.pixelStoreUnpack = new S0(this), this.pixelStoreUnpackPremultiplyAlpha = new H0(this), this.pixelStoreUnpackFlipY = new q4(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 = true, this.clearDepth.dirty = true, this.clearStencil.dirty = true, this.colorMask.dirty = true, this.depthMask.dirty = true, this.stencilMask.dirty = true, this.stencilFunc.dirty = true, this.stencilOp.dirty = true, this.stencilTest.dirty = true, this.depthRange.dirty = true, this.depthTest.dirty = true, this.depthFunc.dirty = true, this.blend.dirty = true, this.blendFunc.dirty = true, this.blendColor.dirty = true, this.blendEquation.dirty = true, this.cullFace.dirty = true, this.cullFaceSide.dirty = true, this.frontFace.dirty = true, this.program.dirty = true, this.activeTexture.dirty = true, this.viewport.dirty = true, this.bindFramebuffer.dirty = true, this.bindRenderbuffer.dirty = true, this.bindTexture.dirty = true, this.bindVertexBuffer.dirty = true, this.bindElementBuffer.dirty = true, this.bindVertexArray.dirty = true, this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true;
}
createIndexBuffer(l, m) {
return new Ao(this, l, m);
}
createVertexBuffer(l, m, v) {
return new L0(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 X4(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([true, true, true, true])), m !== void 0 && (M |= b.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(m), this.depthMask.set(true)), v !== void 0 && (M |= b.STENCIL_BUFFER_BIT, this.clearStencil.set(v), this.stencilMask.set(255)), b.clear(M);
}
setCullFace(l) {
l.enable === false ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(l.mode), this.frontFace.set(l.frontFace));
}
setDepthMode(l) {
l.func !== this.gl.ALWAYS || l.mask ? (this.depthTest.set(true), this.depthFunc.set(l.func), this.depthMask.set(l.mask), this.depthRange.set(l.range)) : this.depthTest.set(false);
}
setStencilMode(l) {
l.test.func !== this.gl.ALWAYS || l.mask ? (this.stencilTest.set(true), 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(false);
}
setColorMode(l) {
a.aE(l.blendFunction, Mn.Replace) ? this.blend.set(false) : (this.blend.set(true), 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 = false, $r.ReadWrite = true, $r.disabled = new $r(519, $r.ReadOnly, [0, 1]);
const as = 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, as, as, as);
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, true), Mt = M.createVertexBuffer(ft, a.aS.members, true);
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(false, 1029, 2305), bn.backCCW = new bn(true, 1029, 2305);
const ba = a.an(new Float32Array(16));
function K4(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 = Jt(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) : Jt(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 = K4(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 = false;
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), ms = Nt ? Oe.posMatrix : ba, s6 = Vi(ms, Ht, Mt, S.transform, X1), Il = Rn(ms, Ht, Mt, S.transform, X1), a6 = Rn(Oe.posMatrix, Ht, Mt, S.transform, X1), i2 = wt.translatePosition(S.transform, Ae, M, V), Pl = we && ur.hasTextData(), jc = m.layout.get("icon-text-fit") !== "none" && Pl && ur.hasIconData();
if (Ot) {
const an = S.style.map.terrain ? (l6, c6) => S.style.map.terrain.getElevation(Oe, l6, c6) : null, B3 = m.layout.get("text-rotation-alignment") === "map";
pt(ur, Oe.posMatrix, S, b, s6, a6, Ht, Z, B3, wt, Oe.toUnwrapped(), Qt.width, Qt.height, i2, an);
}
const o2 = Oe.posMatrix, s2 = b && we || jc, Ea = Ot || s2 ? ba : s6, C2 = Il, b1 = We && m.paint.get(b ? "text-halo-width" : "icon-halo-width").constantOr(1) !== 0;
let I1;
I1 = We ? ur.iconsInText ? D4(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, true, 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 = true;
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, A0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, ur, Oe.terrainData)), ur.u_is_halo = 0;
}
A0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, Ae.uniformValues, Oe.terrainData);
}
}
function A0(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, [true, true, true, true]), 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 ls(S, l, m) {
const v = S.context, b = v.gl;
v.setColorMode(S.colorModeForRenderPass());
const M = cs(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, false, false);
return Z.colorAttachment.set(V), Z;
}
function cs(S, l) {
return l.colorRampTexture || (l.colorRampTexture = new rt(S, l.colorRamp, S.gl.RGBA)), l.colorRampTexture;
}
function us(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)), us(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)), us(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 t22(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(false), l.demTexture = l.demTexture || S.getTileTexture(Y), l.demTexture) {
const ft = l.demTexture;
ft.update(J, { premultiply: false }), ft.bind(D.NEAREST, D.CLAMP_TO_EDGE);
} else
l.demTexture = new rt(V, J, D.RGBA, { premultiply: false }), 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, true, false), 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 = false;
}
}
function O0(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 = false), l ? { opacity: 1, mix: 1 - ft } : { opacity: ft, mix: 0 };
}
return { opacity: 1, mix: 0 };
}
const C0 = 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 xc(l), this.transform = m, this._tileTextures = {}, this.terrainFacilitator = { dirty: true, 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), [true, true, true, true]) : 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(true).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(false), 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, C0), 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 = false, 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, false, 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, true, 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, true), P3(M, V, D, j, false));
})(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" && ls(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, [true, true, true, true]);
(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), cs(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 = true;
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 ? b0(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 = false;
}
})(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, false);
}
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, true);
}
})(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" ? t22(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 = O0(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 = bl(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 false;
if (!l.from || !l.to)
return true;
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, F4[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(false), 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 = true;
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 = false);
}
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 = true, 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 = true : l === null && (l = false), 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 = false, 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 = false, 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 = false, 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 = false, 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 = false, 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 = false, 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 = false, 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: false }), 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 = false) {
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 = true;
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 = false;
}
_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 hs(S, l) {
let m, v = false, b = null, M = null;
const V = () => {
b = null, v && (S.apply(M, m), b = setTimeout(V, l), v = false);
};
return (...D) => (v = true, 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) }), true;
}
return false;
}, 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 = hs(this._updateHashUnthrottled, 300), this._hashName = l && encodeURIComponent(l);
}
addTo(l) {
return this._map = l, addEventListener("hashchange", this._onHashChange, false), this._map.on("moveend", this._updateHash), this;
}
remove() {
return removeEventListener("hashchange", this._onHashChange, false), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), 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 = false;
const ft = window.location.hash.slice(1).split("&").map((Qt) => {
const wt = Qt.split("=")[0];
return wt === J ? (lt = true, `${wt}=${Y}`) : Qt;
}).filter((Qt) => Qt);
return lt || ft.push(`${J}=${Y}`), `#${ft.join("&")}`;
}
return `#${Y}`;
}
}
const ds = { linearity: 0.3, easing: a.b8(0, 0, 0.3, 1) }, Y4 = a.e({ deceleration: 2500, maxSpeed: 1400 }, ds), Ec = a.e({ deceleration: 20, maxSpeed: 1400 }, ds), El = a.e({ deceleration: 1e3, maxSpeed: 360 }, ds), wn2 = a.e({ deceleration: 1e3, maxSpeed: 90 }, ds);
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({}, Y4, l || {}));
b.offset = m.pan.mult(M.amount / m.pan.mag()), b.center = this._map.transform.center, ps(b, M);
}
if (m.zoom) {
const M = fo(m.zoom, v, Ec);
b.zoom = this._map.transform.zoom + M.amount, ps(b, M);
}
if (m.bearing) {
const M = fo(m.bearing, v, El);
b.bearing = this._map.transform.bearing + a.ac(M.amount, -179, 179), ps(b, M);
}
if (m.pitch) {
const M = fo(m.pitch, v, wn2);
b.pitch = this._map.transform.pitch + M.amount, ps(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: true });
}
}
function ps(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 = true;
}
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 = false, this.target = m;
}
}
class $i extends a.k {
preventDefault() {
this._defaultPrevented = true;
}
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 = false;
}
}
class e2 extends a.k {
preventDefault() {
this._defaultPrevented = true;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v) {
super(l, { originalEvent: v }), this._defaultPrevented = false;
}
}
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 true;
}
isActive() {
return false;
}
enable() {
}
disable() {
}
}
class Dn {
constructor(l) {
this._map = l;
}
reset() {
this._delayContextMenu = false, this._ignoreContextMenu = true, delete this._contextMenuEvent;
}
mousemove(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
mousedown() {
this._delayContextMenu = true, this._ignoreContextMenu = false;
}
mouseup() {
this._delayContextMenu = false, 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 true;
}
isActive() {
return false;
}
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 = true);
}
disable() {
this.isEnabled() && (this._enabled = false);
}
mousedown(l, m) {
this.isEnabled() && l.shiftKey && l.button === 0 && (Q.disableDrag(), this._startPos = this._lastPos = m, this._active = true);
}
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: true }) };
this._fireEvent("boxzoomcancel", l);
}
keydown(l) {
this._active && l.keyCode === 27 && (this.reset(), this._fireEvent("boxzoomcancel", l));
}
reset() {
this._active = false, 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 J4 {
constructor(l) {
this.reset(), this.numTouches = l.numTouches;
}
reset() {
delete this.centroid, delete this.startTime, delete this.touches, this.aborted = false;
}
touchstart(l, m, v) {
(this.centroid || v.length > this.numTouches) && (this.aborted = true), 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 = true);
}
}
touchend(l, m, v) {
if ((!this.centroid || l.timeStamp - this.startTime > 500) && (this.aborted = true), v.length === 0) {
const b = !this.aborted && this.centroid;
if (this.reset(), b)
return b;
}
}
}
class Gs {
constructor(l) {
this.singleTap = new J4(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 Ts {
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 = false, 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 = true, 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 = true, 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 = true;
}
disable() {
this._enabled = false, 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 = false, this._moved = false, 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 = true, 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 = true));
}
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 = true, 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 = true;
}
disable() {
this._enabled = false, 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();
};
}, Mc = ({ 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 });
}, Sc = ({ 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 = false, 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 = true);
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 = true;
}
disable() {
this._enabled = false, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Ml {
constructor() {
this.reset();
}
reset() {
this._active = false, 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 = k0(v, m, b), D = k0(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 = k0(v, m, b), D = k0(v, m, M);
V && D || (this._active && Q.suppressClick(), this.reset());
}
touchcancel() {
this.reset();
}
enable(l) {
this._enabled = true, this._aroundCenter = !!l && l.around === "center";
}
disable() {
this._enabled = false, this.reset();
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active;
}
}
function k0(S, l, m) {
for (let v = 0; v < S.length; v++)
if (S[v].identifier === m)
return l[v];
}
function Hc(S, l) {
return Math.log(S / l) / Math.LN2;
}
class Ac extends Ml {
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(Hc(this._distance, this._startDistance)) < 0.1))
return this._active = true, { zoomDelta: Hc(this._distance, v), pinchAround: m };
}
}
function Oc(S, l) {
return 180 * S.angleWith(l) / Math.PI;
}
class Cc extends Ml {
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 = true, { bearingDelta: Oc(this._vector, b), pinchAround: m };
}
_isBelowThreshold(l) {
this._minDiameter = Math.min(this._minDiameter, l.mag());
const m = 25 / (Math.PI * this._minDiameter) * 360, v = Oc(l, this._startVector);
return Math.abs(v) < m;
}
}
function Sl(S) {
return Math.abs(S.y) > Math.abs(S.x);
}
class t62 extends Ml {
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, Sl(l[0].sub(l[1])) && (this._valid = false);
}
_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 = true, { 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 Sl(l) && Sl(m) && V;
}
}
const Qp = { panStep: 100, bearingStep: 15, pitchStep: 10 };
class r2 {
constructor(l) {
this._tr = new O1(l);
const m = Qp;
this._panStep = m.panStep, this._bearingStep = m.bearingStep, this._pitchStep = m.pitchStep, this._rotationDisabled = false;
}
reset() {
this._active = false;
}
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: fs, 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 = true;
}
disable() {
this._enabled = false, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
disableRotation() {
this._rotationDisabled = true;
}
enableRotation() {
this._rotationDisabled = false;
}
}
function fs(S) {
return S * (2 - S);
}
const kc = 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 = true, this._aroundCenter = !!l && l.around === "center");
}
disable() {
this.isEnabled() && (this._enabled = false);
}
_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 % kc == 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 = true, this.isZooming() || (this._zooming = true), 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 = true, 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) > kc ? 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 = false;
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 = true) : V = true;
} else
M = m, V = true;
return this._active = true, V && (this._active = false, this._finishTimeout = setTimeout(() => {
this._zooming = false, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;
}, 200)), { noInertia: true, 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 = false, this._zooming = false, 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 f_ {
constructor(l) {
this._tr = new O1(l), this.reset();
}
reset() {
this._active = false;
}
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 = true;
}
disable() {
this._enabled = false, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Q_ {
constructor() {
this._tap = new Gs({ numTouches: 1, numTaps: 1 }), this.reset();
}
reset() {
this._active = false, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();
}
touchstart(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 = true, { 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 = true;
}
disable() {
this._enabled = false, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class mp {
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 gp {
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 Ic {
constructor(l, m, v, b) {
this._el = l, this._touchZoom = m, this._touchRotate = v, this._tapDragZoom = b, this._rotationDisabled = false, this._enabled = true;
}
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 = true, this._touchRotate.disable();
}
enableRotation() {
this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable();
}
}
class e6 {
constructor(l, m) {
this._bypassKey = navigator.userAgent.indexOf("Mac") !== -1 ? "metaKey" : "ctrlKey", this._map = l, this._options = m, this._enabled = false;
}
isActive() {
return false;
}
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 = true;
}
disable() {
this._enabled = false, 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 Hl(S) {
return S.panDelta && S.panDelta.mag() || S.zoomDelta || S.bearingDelta || S.pitchDelta;
}
class Pc {
constructor(l, m) {
this.handleWindowEvent = (b) => {
this.handleEvent(b, `${b.type}Window`);
}, this.handleEvent = (b, M) => {
if (b.type === "blur")
return void this.stop(true);
this._updatingCamera = true;
const V = b.type === "renderFrame" ? void 0 : b, D = { needsRenderFrame: false }, 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 || Hl(D)) && (this._changes.push([D, j, ft]), this._triggerRenderFrame()), (Object.keys(Z).length || Hl(D)) && this._map._stop(true), this._updatingCamera = false;
const { cameraAnimation: Qt } = D;
Qt && (this._inertia.clear(), this._fireEvents({}, {}, true), 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: true }], [v, "touchmove", { passive: false }], [v, "touchend", void 0], [v, "touchcancel", void 0], [v, "mousedown", void 0], [v, "mousemove", void 0], [v, "mouseup", void 0], [document, "mousemove", { capture: true }], [document, "mouseup", void 0], [v, "mouseover", void 0], [v, "mouseout", void 0], [v, "dblclick", void 0], [v, "click", void 0], [v, "keydown", { capture: false }], [v, "keyup", void 0], [v, "wheel", { passive: false }], [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 e6(m, l.cooperativeGestures);
this._add("cooperativeGestures", M), l.cooperativeGestures && M.enable();
const V = new Ts(m), D = new f_(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 Q_();
this._add("tapDragZoom", j);
const Z = m.touchPitch = new t62(m);
this._add("touchPitch", Z), l.interactive && l.touchPitch && m.touchPitch.enable(l.touchPitch);
const Y = Mc(l), J = Sc(l);
m.dragRotate = new gp(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: true, moveStateManager: Nt, enable: Ot, assignEvents: $s });
})(l), ft = new D3(l, m);
m.dragPan = new mp(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 Cc(), wt = new Ac();
m.touchZoomRotate = new Ic(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 true;
return false;
}
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 true;
return false;
}
_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 (!(Hl(l) || V && this._terrainMovement))
return this._fireEvents(m, v, true);
let { panDelta: D, zoomDelta: j, bearingDelta: Z, pitchDelta: Y, around: J, pinchAround: lt } = l;
lt !== void 0 && (J = lt), b._stop(true), 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 = true, this._map._elevationFreeze = true, M.setLocationAtPoint(ft, J)) : M.setLocationAtPoint(ft, J), b._applyUpdatedTransform(M), this._map._update(), l.noInertia || this._inertia.record(l), this._fireEvents(m, v, true);
}
_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 = false, this._terrainMovement = false;
const J = this._map._getTransformForUpdate();
J.recalculateZoom(this._map.terrain), this._map._applyUpdatedTransform(J);
}
if (v && Y) {
this._updatingCamera = true;
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 = true, this._map.easeTo(J, { originalEvent: j })), this._updatingCamera = false;
}
}
_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 yp 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 = false, this._zooming = false, 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 = false, M = false, V = false;
return "zoom" in l && v.zoom !== +l.zoom && (b = true, v.zoom = +l.zoom), l.center !== void 0 && (v.center = a.N.convert(l.center)), "bearing" in l && v.bearing !== +l.bearing && (M = true, v.bearing = +l.bearing), "pitch" in l && v.pitch !== +l.pitch && (V = true, 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(false, l.easeId), ((l = a.e({ offset: [0, 0], duration: 500, easing: a.b9 }, l)).animate === false || !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 = true, 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 = true;
}
_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 = false, 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 = false, this._zooming = false, this._rotating = false, this._pitching = false, this._padding = false, 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(false);
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(true) - 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 = true, this._rotating = V !== Z, this._pitching = Y !== D, this._padding = !b.isPaddingEqual(J), this._prepareEase(m, false), 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(false), this;
}
_ease(l, m, v) {
v.animate === false || 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 r6 = { compact: true, customAttribution: 'MapLibre' };
class n6 {
constructor(l = r6) {
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 === false ? 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 false;
return true;
});
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 Vc {
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 !== false && 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 = false, this._currentlyRunning = false;
}
add(l) {
const m = ++this._id;
return this._queue.push({ callback: l, id: m, cancelled: false }), 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 = true);
}
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 = false, this._currentlyRunning = false;
}
clear() {
this._currentlyRunning && (this._cleared = true), this._queue = [];
}
}
var Rc = a.Y([{ name: "a_pos3d", type: "Int16", components: 3 }]);
class m_ 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 = true, l.tileSize = this.tileSize * 2 ** this.deltaZoom;
}
destruct() {
this.sourceCache.usedForTerrain = false, 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: false, terrain: m }))
v[b.key] = true, 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 Nc {
constructor(l, m, v) {
this.painter = l, this.sourceCache = new m_(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: false }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new rt(b, new a.R({ width: 1, height: 1 }), b.gl.RGBA, { premultiply: false }), this._emptyDemTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = a.an([]);
}
const m = this.sourceCache.getSourceTile(l, true);
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: false }) : m.demTexture = new rt(b, m.dem.getPixels(), b.gl.RGBA, { premultiply: false }), m.demTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), m.needsTerrainPrepare = false;
}
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: false }), 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: false }), this._fboDepthTexture.bind(m.context.gl.NEAREST, m.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = m.context.createFramebuffer(v, b, true, false), 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: false });
return b.bind(l.gl.NEAREST, l.gl.CLAMP_TO_EDGE), this._coordsTexture = b, b;
}
pointCoordinate(l) {
this.painter.maybeDrawDepthAndCoords(true);
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, Rc.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 g_ {
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, true, true), 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: false };
}
getObjectForId(l) {
return this._objects[l];
}
useObject(l) {
l.inUse = true, 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 = false;
}
freeAllObjects() {
for (const l of this._objects)
this.freeObject(l);
}
isFull() {
return !(this._objects.length < this._size) && this._objects.some((l) => !l.inUse) === false;
}
}
const i6 = { background: true, fill: true, line: true, raster: true, hillshade: true };
class vp {
constructor(l, m) {
this.painter = l, this.terrain = m, this.pool = new g_(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 (i6[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 false;
const m = l.type, v = this.painter, b = this._renderableLayerIds[this._renderableLayerIds.length - 1] === l.id;
if (i6[m] && (this._prevType && i6[this._prevType] || this._stacks.push([]), this._prevType = m, this._stacks[this._stacks.length - 1].push(l.id), !b))
return true;
if (i6[this._prevType] || i6[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(), i6[m];
}
return false;
}
}
const Dc = { "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" }, _p = u, y_ = { hash: false, interactive: true, bearingSnap: 7, attributionControl: r6, maplibreLogo: false, failIfMajorPerformanceCaveat: false, preserveDrawingBuffer: false, refreshExpiredTiles: true, scrollZoom: true, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, cooperativeGestures: false, trackResize: true, center: [0, 0], zoom: 0, bearing: 0, pitch: 0, renderWorldCopies: true, maxTileCacheSize: null, maxTileCacheZoomLevels: a.a.MAX_TILE_CACHE_ZOOM_LEVELS, transformRequest: null, transformCameraUpdate: null, fadeDuration: 300, crossSourceCollisions: true, clickTolerance: 3, localIdeographFontFamily: "sans-serif", pitchWithRotate: true, validateStyle: true, maxCanvasSize: [4096, 4096], cancelPendingTileRequestsWhileZooming: true }, Fc = (S) => {
S.touchstart = S.dragStart, S.touchmoveWindow = S.dragMove, S.touchend = S.dragEnd;
}, v_ = { showCompass: true, showZoom: true, visualizePitch: false };
class __ {
constructor(l, m, v = false) {
this.mousedown = (V) => {
this.startMouse(a.e({}, V, { ctrlKey: true, 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: false }), 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 = Mc({ clickTolerance: b, enable: true }), 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: Fc });
})({ clickTolerance: b, enable: true }), this.map = l, v && (this.mousePitch = Sc({ clickTolerance: M, enable: true }), 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: Fc });
})({ clickTolerance: M, enable: true })), Q.addEventListener(m, "mousedown", this.mousedown), Q.addEventListener(m, "touchstart", this.touchstart, { passive: false }), 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: false }), Q.removeEventListener(window, "touchmove", this.touchmove, { passive: false }), 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: false }), 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 o6 = { 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 Al(S, l, m) {
const v = S.classList;
for (const b in o6)
v.remove(`maplibregl-${m}-anchor-${b}`);
v.add(`maplibregl-${m}-anchor-${l}`);
}
class Ol 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, `${o6[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 = false, 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 || false, this._clickTolerance = l && l.clickTolerance || 0, this._subpixelPositioning = l && l.subpixelPositioning || false, this._isDragging = false, 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 = true, 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();
}), Al(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 = false) {
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(true), this;
}
}
const bp = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true };
let I0 = 0, P0 = false;
const Qs = { maxWidth: 100, unit: "metric" };
function V0(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: true, closeOnClick: true, focusAfterOpen: true, className: "", maxWidth: "240px", subpixelPositioning: false }, Cl = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
function kl(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 kl(new a.P(0, 0));
}
const Bc = 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 = n6, s.BoxZoomHandler = Wi, s.CanvasSource = _i, s.CooperativeGesturesHandler = e6, s.DoubleClickZoomHandler = F3, s.DragPanHandler = mp, s.DragRotateHandler = gp, 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 = false, 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: true });
}, 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 = true;
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 && P0)
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 = true);
}, this._finishSetupUI = (l) => {
if (this._map) {
if (l === false) {
a.w("Geolocation support is not available so the GeolocateControl will be disabled.");
const m = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.disabled = true, this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m);
} else {
const m = this._map._getUIString("GeolocateControl.FindMyLocation");
this._geolocateButton.disabled = false, 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 Ol({ element: this._dotElement }), this._circleElement = Q.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Ol({ 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 = true, 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({}, bp, 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 = false) {
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, I0 = 0, P0 = false;
}
_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"), false;
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":
I0--, P0 = false, this._watchState = "OFF", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this.fire(new 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"), I0++, I0 > 1 ? (S = { maximumAge: 6e5, timeout: 0 }, P0 = true) : (S = this.options.positionOptions, P0 = false), 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 true;
}
_clearWatch() {
window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null);
}
}, s.Hash = S2, s.ImageSource = Ji, s.KeyboardHandler = r2, s.LngLatBounds = Ct, s.LogoControl = Vc, s.Map = class extends yp {
constructor(S) {
a.bf.mark(a.bg.create);
const l = Object.assign(Object.assign({}, y_), 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 = false, 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, false;
}, this._onWindowOnline = () => {
this._update();
}, this._interactive = l.interactive, this._maxTileCacheSize = l.maxTileCacheSize, this._maxTileCacheZoomLevels = l.maxTileCacheZoomLevels, this._failIfMajorPerformanceCaveat = l.failIfMajorPerformanceCaveat === true, this._preserveDrawingBuffer = l.preserveDrawingBuffer === true, this._antialias = l.antialias === true, this._trackResize = l.trackResize === true, this._bearingSnap = l.bearingSnap, this._refreshExpiredTiles = l.refreshExpiredTiles === true, this._fadeDuration = l.fadeDuration, this._crossSourceCollisions = l.crossSourceCollisions === true, this._collectResourceTiming = l.collectResourceTiming === true, this._locale = Object.assign(Object.assign({}, Dc), l.locale), this._clickTolerance = l.clickTolerance, this._overridePixelRatio = l.pixelRatio, this._maxCanvasSize = l.maxCanvasSize, this.transformCameraUpdate = l.transformCameraUpdate, this.cancelPendingTileRequestsWhileZooming = l.cancelPendingTileRequestsWhileZooming === true, 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(false)).on("moveend", () => this._update(false)).on("zoom", () => this._update(true)).on("terrain", () => {
this.painter.terrainFacilitator.dirty = true, this._update(true);
}).once("idle", () => {
this._idleTriggered = true;
}), typeof window < "u") {
addEventListener("online", this._onWindowOnline, false);
let m = false;
const v = hs((b) => {
this._trackResize && !this._removed && (this.resize(b), this.redraw());
}, 50);
this._resizeObserver = new ResizeObserver((b) => {
m ? v(b) : m = true;
}), this._resizeObserver.observe(this._container);
}
this.handlers = new Pc(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 n6(typeof l.attributionControl == "boolean" ? void 0 : l.attributionControl)), l.maplibreLogo && this.addControl(new Vc(), 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 = false;
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 = true, m.call(this, new Gi(S, this, b.originalEvent, { features: V }))) : v = false;
}, mouseout: () => {
v = false;
} } };
}
if (S === "mouseleave" || S === "mouseout") {
let v = false;
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 = true : v && (v = false, m.call(this, new Gi(S, this, b.originalEvent)));
}, mouseout: (b) => {
v && (v = false, 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 !== false && 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(true);
} 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(true);
}
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 Nc(this.painter, l, S), this.painter.renderToTexture = new vp(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 false;
}
}
return true;
}
removeSource(S) {
return this.style.removeSource(S), this._update(true);
}
getSource(S) {
return this.style.getSource(S);
}
addImage(S, l, m = {}) {
const { pixelRatio: v = 1, sdf: b = false, 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"))), false);
}
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(true);
}
moveLayer(S, l) {
return this.style.moveLayer(S, l), this._update(true);
}
removeLayer(S) {
return this.style.removeLayer(S), this._update(true);
}
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(true);
}
setFilter(S, l, m = {}) {
return this.style.setFilter(S, l, m), this._update(true);
}
getFilter(S) {
return this.style.getFilter(S);
}
setPaintProperty(S, l, m, v = {}) {
return this.style.setPaintProperty(S, l, m, v), this._update(true);
}
getPaintProperty(S, l) {
return this.style.getPaintProperty(S, l);
}
setLayoutProperty(S, l, m, v = {}) {
return this.style.setLayoutProperty(S, l, m, v), this._update(true);
}
getLayoutProperty(S, l) {
return this.style.getLayoutProperty(S, l);
}
setGlyphs(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setGlyphs(S, l), this._update(true);
}
getGlyphs() {
return this.style.getGlyphsUrl();
}
addSprite(S, l, m = {}) {
return this._lazyInitEmptyStyle(), this.style.addSprite(S, l, m, (v) => {
v || this._update(true);
}), this;
}
removeSprite(S) {
return this._lazyInitEmptyStyle(), this.style.removeSprite(S), this._update(true);
}
getSprite() {
return this.style.getSprite();
}
setSprite(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setSprite(S, l, (m) => {
m || this._update(true);
}), this;
}
setLight(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setLight(S, l), this._update(true);
}
getLight() {
return this.style.getLight();
}
setSky(S) {
return this._lazyInitEmptyStyle(), this.style.setSky(S), this._update(true);
}
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, false), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, false), 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, false);
}
_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: true, stencil: true, depth: true, failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || false };
let l = null;
this._canvas.addEventListener("webglcontextcreationerror", (v) => {
l = { requestedAttributes: S }, v && (l.statusMessage = v.statusMessage, l.type = v.type);
}, { once: true });
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 = true, 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 = false;
if (this.style && this._styleDirty) {
this._styleDirty = false;
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 = true, this._crossFadingFactor = D), this.style.update(V);
}
this.style && this._sourcesDirty && (this._sourcesDirty = false, 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 = true, a.bf.mark(a.bg.load), this.fire(new a.k("load"))), this.style && (this.style.hasTransitions() || m) && (this._styleDirty = true), 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 = true, 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, false), 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, false), this._canvas.removeEventListener("webglcontextlost", this._contextLost, false), Q.remove(this._canvasContainer), Q.remove(this._controlContainer), this._container.classList.remove("maplibregl-map"), a.bf.clearMetrics(), this._removed = true, 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 _p;
}
getCameraTargetElevation() {
return this.transform.elevation;
}
}, s.MapMouseEvent = Gi, s.MapTouchEvent = $i, s.MapWheelEvent = e2, s.Marker = Ol, 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({}, v_, 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 __(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 = kl(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, `${o6[b]} translate(${V.x}px,${V.y}px)`), Al(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 = false, this._update(), this._map && (this._map.on("move", this._update), this._map.off("mousemove", this._onMouseMove), this._container && this._container.classList.remove("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.remove("maplibregl-track-pointer")), this;
}
trackPointer() {
return this._trackPointer = true, this._pos = null, this._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(Cl);
S && S.focus();
}
}, s.RasterDEMTileSource = Rr, s.RasterTileSource = Hr, s.ScaleControl = class {
constructor(S) {
this._onMove = () => {
V0(this._map, this._container, this.options);
}, this.setUnit = (l) => {
this.options.unit = l, V0(this._map, this._container, this.options);
}, this.options = Object.assign(Object.assign({}, Qs), 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 = t62, s.TwoFingersTouchRotateHandler = Cc, s.TwoFingersTouchZoomHandler = Ac, s.TwoFingersTouchZoomRotateHandler = Ic, 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 Bc;
}, 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;
});
})(qG);
var q9t = qG.exports;
var Uo = p0(q9t);
function ic(t10, 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 = t10, n;
}
function KG(t10, e, r) {
switch (t10) {
case "Point":
return iH(e).geometry;
case "LineString":
return YG(e).geometry;
case "Polygon":
return X9t(e).geometry;
case "MultiPoint":
return Y9t(e).geometry;
case "MultiLineString":
return K9t(e).geometry;
case "MultiPolygon":
return J9t(e).geometry;
default:
throw new Error(t10 + " is invalid");
}
}
function iH(t10, e, r) {
if (r === void 0 && (r = {}), !t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!Vx(t10[0]) || !Vx(t10[1]))
throw new Error("coordinates must contain numbers");
var n = {
type: "Point",
coordinates: t10
};
return ic(n, e, r);
}
function X9t(t10, e, r) {
r === void 0 && (r = {});
for (var n = 0, i = t10; 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: t10
};
return ic(a, e, r);
}
function YG(t10, e, r) {
if (r === void 0 && (r = {}), t10.length < 2)
throw new Error("coordinates must be an array of two or more positions");
var n = {
type: "LineString",
coordinates: t10
};
return ic(n, e, r);
}
function K9t(t10, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiLineString",
coordinates: t10
};
return ic(n, e, r);
}
function Y9t(t10, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPoint",
coordinates: t10
};
return ic(n, e, r);
}
function J9t(t10, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPolygon",
coordinates: t10
};
return ic(n, e, r);
}
function Vx(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
var N2 = 63710088e-1;
var tht = {
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 eht(t10, e = "kilometers") {
const r = tht[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 * r;
}
function cT(t10) {
return t10 % 360 * Math.PI / 180;
}
function DP(t10) {
if (!t10)
throw new Error("coord is required");
if (!Array.isArray(t10)) {
if (t10.type === "Feature" && t10.geometry !== null && t10.geometry.type === "Point")
return [...t10.geometry.coordinates];
if (t10.type === "Point")
return [...t10.coordinates];
}
if (Array.isArray(t10) && t10.length >= 2 && !Array.isArray(t10[0]) && !Array.isArray(t10[1]))
return [...t10];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function g5(t10, e, r = {}) {
var n = DP(t10), i = DP(e), o = cT(i[1] - n[1]), s = cT(i[0] - n[0]), a = cT(n[1]), u = cT(i[1]), d = Math.pow(Math.sin(o / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(u);
return eht(
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
r.units
);
}
var FP = Object.prototype.toString;
var JG = function(t10) {
var e = FP.call(t10), r = e === "[object Arguments]";
return r || (r = e !== "[object Array]" && t10 !== null && typeof t10 == "object" && typeof t10.length == "number" && t10.length >= 0 && FP.call(t10.callee) === "[object Function]"), r;
};
var Jb;
var BP;
function rht() {
if (BP)
return Jb;
BP = 1;
var t10;
if (!Object.keys) {
var e = Object.prototype.hasOwnProperty, r = Object.prototype.toString, n = JG, 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: true,
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$innerHeight: true,
$innerWidth: true,
$onmozfullscreenchange: true,
$onmozfullscreenerror: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
$pageYOffset: true,
$parent: true,
$scrollLeft: true,
$scrollTop: true,
$scrollX: true,
$scrollY: true,
$self: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
}, T = function() {
if (typeof window > "u")
return false;
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 true;
}
} catch {
return true;
}
return false;
}(), f = function(Q) {
if (typeof window > "u" || !T)
return u(Q);
try {
return u(Q);
} catch {
return false;
}
};
t10 = 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 Jb = t10, Jb;
}
var nht = Array.prototype.slice;
var iht = JG;
var jP = Object.keys;
var Lf = jP ? function(t10) {
return jP(t10);
} : rht();
var zP = Object.keys;
Lf.shim = function() {
if (Object.keys) {
var t10 = function() {
var e = Object.keys(arguments);
return e && e.length === arguments.length;
}(1, 2);
t10 || (Object.keys = function(e) {
return iht(e) ? zP(nht.call(e)) : zP(e);
});
} else
Object.keys = Lf;
return Object.keys || Lf;
};
var oH = Lf;
var oht = Error;
var sht = EvalError;
var aht = RangeError;
var lht = ReferenceError;
var t$ = SyntaxError;
var f0 = TypeError;
var cht = URIError;
var Dg = function() {
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
return false;
if (typeof Symbol.iterator == "symbol")
return true;
var t10 = {}, 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 false;
var n = 42;
t10[e] = n;
for (e in t10)
return false;
if (typeof Object.keys == "function" && Object.keys(t10).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(t10).length !== 0)
return false;
var i = Object.getOwnPropertySymbols(t10);
if (i.length !== 1 || i[0] !== e || !Object.prototype.propertyIsEnumerable.call(t10, e))
return false;
if (typeof Object.getOwnPropertyDescriptor == "function") {
var o = Object.getOwnPropertyDescriptor(t10, e);
if (o.value !== n || o.enumerable !== true)
return false;
}
return true;
};
var UP = typeof Symbol < "u" && Symbol;
var uht = Dg;
var sH = function() {
return typeof UP != "function" || typeof Symbol != "function" || typeof UP("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? false : uht();
};
var tL = {
__proto__: null,
foo: {}
};
var hht = Object;
var dht = function() {
return { __proto__: tL }.foo === tL.foo && !(tL instanceof hht);
};
var pht = "Function.prototype.bind called on incompatible ";
var Tht = Object.prototype.toString;
var fht = Math.max;
var Qht = "[object Function]";
var GP = function(t10, e) {
for (var r = [], n = 0; n < t10.length; n += 1)
r[n] = t10[n];
for (var i = 0; i < e.length; i += 1)
r[i + t10.length] = e[i];
return r;
};
var mht = function(t10, e) {
for (var r = [], n = e, i = 0; n < t10.length; n += 1, i += 1)
r[i] = t10[n];
return r;
};
var ght = function(t10, e) {
for (var r = "", n = 0; n < t10.length; n += 1)
r += t10[n], n + 1 < t10.length && (r += e);
return r;
};
var yht = function(t10) {
var e = this;
if (typeof e != "function" || Tht.apply(e) !== Qht)
throw new TypeError(pht + e);
for (var r = mht(arguments, 1), n, i = function() {
if (this instanceof n) {
var d = e.apply(
this,
GP(r, arguments)
);
return Object(d) === d ? d : this;
}
return e.apply(
t10,
GP(r, arguments)
);
}, o = fht(0, e.length - r.length), s = [], a = 0; a < o; a++)
s[a] = "$" + a;
if (n = Function("binder", "return function (" + ght(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;
};
var vht = yht;
var aH = Function.prototype.bind || vht;
var _ht = Function.prototype.call;
var bht = Object.prototype.hasOwnProperty;
var Lht = aH;
var e$ = Lht.call(_ht, bht);
var gn;
var wht = oht;
var xht = sht;
var Eht = aht;
var Mht = lht;
var H8 = t$;
var d8 = f0;
var Sht = cht;
var r$ = Function;
var eL = function(t10) {
try {
return r$('"use strict"; return (' + t10 + ").constructor;")();
} catch {
}
};
var P5 = Object.getOwnPropertyDescriptor;
if (P5)
try {
P5({}, "");
} catch {
P5 = null;
}
var rL = function() {
throw new d8();
};
var Hht = P5 ? function() {
try {
return arguments.callee, rL;
} catch {
try {
return P5(arguments, "callee").get;
} catch {
return rL;
}
}
}() : rL;
var Jl = sH();
var Aht = dht();
var B1 = Object.getPrototypeOf || (Aht ? function(t10) {
return t10.__proto__;
} : null);
var x7 = {};
var Oht = typeof Uint8Array > "u" || !B1 ? gn : B1(Uint8Array);
var V5 = {
__proto__: null,
"%AggregateError%": typeof AggregateError > "u" ? gn : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer > "u" ? gn : ArrayBuffer,
"%ArrayIteratorPrototype%": Jl && B1 ? B1([][Symbol.iterator]()) : gn,
"%AsyncFromSyncIteratorPrototype%": gn,
"%AsyncFunction%": x7,
"%AsyncGenerator%": x7,
"%AsyncGeneratorFunction%": x7,
"%AsyncIteratorPrototype%": x7,
"%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%": wht,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": xht,
"%Float32Array%": typeof Float32Array > "u" ? gn : Float32Array,
"%Float64Array%": typeof Float64Array > "u" ? gn : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? gn : FinalizationRegistry,
"%Function%": r$,
"%GeneratorFunction%": x7,
"%Int8Array%": typeof Int8Array > "u" ? gn : Int8Array,
"%Int16Array%": typeof Int16Array > "u" ? gn : Int16Array,
"%Int32Array%": typeof Int32Array > "u" ? gn : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": Jl && B1 ? B1(B1([][Symbol.iterator]())) : gn,
"%JSON%": typeof JSON == "object" ? JSON : gn,
"%Map%": typeof Map > "u" ? gn : Map,
"%MapIteratorPrototype%": typeof Map > "u" || !Jl || !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%": Eht,
"%ReferenceError%": Mht,
"%Reflect%": typeof Reflect > "u" ? gn : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set > "u" ? gn : Set,
"%SetIteratorPrototype%": typeof Set > "u" || !Jl || !B1 ? gn : B1((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? gn : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": Jl && B1 ? B1(""[Symbol.iterator]()) : gn,
"%Symbol%": Jl ? Symbol : gn,
"%SyntaxError%": H8,
"%ThrowTypeError%": Hht,
"%TypedArray%": Oht,
"%TypeError%": d8,
"%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%": Sht,
"%WeakMap%": typeof WeakMap > "u" ? gn : WeakMap,
"%WeakRef%": typeof WeakRef > "u" ? gn : WeakRef,
"%WeakSet%": typeof WeakSet > "u" ? gn : WeakSet
};
if (B1)
try {
null.error;
} catch (t10) {
Cht = B1(B1(t10));
V5["%Error.prototype%"] = Cht;
}
var Cht;
var kht = function t(e) {
var r;
if (e === "%AsyncFunction%")
r = eL("async function () {}");
else if (e === "%GeneratorFunction%")
r = eL("function* () {}");
else if (e === "%AsyncGeneratorFunction%")
r = eL("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 V5[e] = r, r;
};
var $P = {
__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"]
};
var wd = aH;
var GQ = e$;
var Iht = wd.call(Function.call, Array.prototype.concat);
var Pht = wd.call(Function.apply, Array.prototype.splice);
var WP = wd.call(Function.call, String.prototype.replace);
var $Q = wd.call(Function.call, String.prototype.slice);
var Vht = wd.call(Function.call, RegExp.prototype.exec);
var Rht = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var Nht = /\\(\\)?/g;
var Dht = function(t10) {
var e = $Q(t10, 0, 1), r = $Q(t10, -1);
if (e === "%" && r !== "%")
throw new H8("invalid intrinsic syntax, expected closing `%`");
if (r === "%" && e !== "%")
throw new H8("invalid intrinsic syntax, expected opening `%`");
var n = [];
return WP(t10, Rht, function(i, o, s, a) {
n[n.length] = s ? WP(a, Nht, "$1") : o || i;
}), n;
};
var Fht = function(t10, e) {
var r = t10, n;
if (GQ($P, r) && (n = $P[r], r = "%" + n[0] + "%"), GQ(V5, r)) {
var i = V5[r];
if (i === x7 && (i = kht(r)), typeof i > "u" && !e)
throw new d8("intrinsic " + t10 + " exists, but is not available. Please file an issue!");
return {
alias: n,
name: r,
value: i
};
}
throw new H8("intrinsic " + t10 + " does not exist!");
};
var x3 = function(t10, e) {
if (typeof t10 != "string" || t10.length === 0)
throw new d8("intrinsic name must be a non-empty string");
if (arguments.length > 1 && typeof e != "boolean")
throw new d8('"allowMissing" argument must be a boolean');
if (Vht(/^%?[^%]*%?$/, t10) === null)
throw new H8("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
var r = Dht(t10), n = r.length > 0 ? r[0] : "", i = Fht("%" + n + "%", e), o = i.name, s = i.value, a = false, u = i.alias;
u && (n = u[0], Pht(r, Iht([0, 1], u)));
for (var d = 1, T = true; d < r.length; d += 1) {
var f = r[d], Q = $Q(f, 0, 1), y = $Q(f, -1);
if ((Q === '"' || Q === "'" || Q === "`" || y === '"' || y === "'" || y === "`") && Q !== y)
throw new H8("property names with quotes must have matching quotes");
if ((f === "constructor" || !T) && (a = true), n += "." + f, o = "%" + n + "%", GQ(V5, o))
s = V5[o];
else if (s != null) {
if (!(f in s)) {
if (!e)
throw new d8("base intrinsic for " + t10 + " exists, but the property is not available.");
return;
}
if (P5 && d + 1 >= r.length) {
var _ = P5(s, f);
T = !!_, T && "get" in _ && !("originalValue" in _.get) ? s = _.get : s = s[f];
} else
T = GQ(s, f), s = s[f];
T && !a && (V5[o] = s);
}
}
return s;
};
var Bht = x3;
var wf = Bht("%Object.defineProperty%", true) || false;
if (wf)
try {
wf({}, "a", { value: 1 });
} catch {
wf = false;
}
var lH = wf;
var jht = x3;
var xf = jht("%Object.getOwnPropertyDescriptor%", true);
if (xf)
try {
xf([], "length");
} catch {
xf = null;
}
var cH = xf;
var ZP = lH;
var zht = t$;
var t7 = f0;
var qP = cH;
var uH = function(t10, e, r) {
if (!t10 || typeof t10 != "object" && typeof t10 != "function")
throw new t7("`obj` must be an object or a function`");
if (typeof e != "string" && typeof e != "symbol")
throw new t7("`property` must be a string or a symbol`");
if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
throw new t7("`nonEnumerable`, if provided, must be a boolean or null");
if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
throw new t7("`nonWritable`, if provided, must be a boolean or null");
if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
throw new t7("`nonConfigurable`, if provided, must be a boolean or null");
if (arguments.length > 6 && typeof arguments[6] != "boolean")
throw new t7("`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] : false, a = !!qP && qP(t10, e);
if (ZP)
ZP(t10, 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)
t10[e] = r;
else
throw new zht("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
};
var Rx = lH;
var n$ = function() {
return !!Rx;
};
n$.hasArrayLengthDefineBug = function() {
if (!Rx)
return null;
try {
return Rx([], "length", { value: 1 }).length !== 1;
} catch {
return true;
}
};
var hH = n$;
var Uht = oH;
var Ght = typeof Symbol == "function" && typeof Symbol("foo") == "symbol";
var $ht = Object.prototype.toString;
var Wht = Array.prototype.concat;
var XP = uH;
var Zht = function(t10) {
return typeof t10 == "function" && $ht.call(t10) === "[object Function]";
};
var i$ = hH();
var qht = function(t10, e, r, n) {
if (e in t10) {
if (n === true) {
if (t10[e] === r)
return;
} else if (!Zht(n) || !n())
return;
}
i$ ? XP(t10, e, r, true) : XP(t10, e, r);
};
var o$ = function(t10, e) {
var r = arguments.length > 2 ? arguments[2] : {}, n = Uht(e);
Ght && (n = Wht.call(n, Object.getOwnPropertySymbols(e)));
for (var i = 0; i < n.length; i += 1)
qht(t10, n[i], e[n[i]], r[n[i]]);
};
o$.supportsDescriptors = !!i$;
var hl = o$;
var s$ = { exports: {} };
var Xht = x3;
var KP = uH;
var Kht = hH();
var YP = cH;
var JP = f0;
var Yht = Xht("%Math.floor%");
var Jht = function(t10, e) {
if (typeof t10 != "function")
throw new JP("`fn` is not a function");
if (typeof e != "number" || e < 0 || e > 4294967295 || Yht(e) !== e)
throw new JP("`length` must be a positive 32-bit integer");
var r = arguments.length > 2 && !!arguments[2], n = true, i = true;
if ("length" in t10 && YP) {
var o = YP(t10, "length");
o && !o.configurable && (n = false), o && !o.writable && (i = false);
}
return (n || i || !r) && (Kht ? KP(
/** @type {Parameters[0]} */
t10,
"length",
e,
true,
true
) : KP(
/** @type {Parameters[0]} */
t10,
"length",
e
)), t10;
};
(function(t10) {
var e = aH, r = x3, n = Jht, i = f0, o = r("%Function.prototype.apply%"), s = r("%Function.prototype.call%"), a = r("%Reflect.apply%", true) || e.call(s, o), u = lH, d = r("%Math.max%");
t10.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)),
true
);
};
var T = function() {
return a(e, o, arguments);
};
u ? u(t10.exports, "apply", { value: T }) : t10.exports.apply = T;
})(s$);
var oc = s$.exports;
var a$ = x3;
var l$ = oc;
var tdt = l$(a$("String.prototype.indexOf"));
var Fs = function(t10, e) {
var r = a$(t10, !!e);
return typeof r == "function" && tdt(t10, ".prototype.") > -1 ? l$(r) : r;
};
var edt = oH;
var c$ = Dg();
var u$ = Fs;
var tV = Object;
var rdt = u$("Array.prototype.push");
var eV = u$("Object.prototype.propertyIsEnumerable");
var ndt = c$ ? Object.getOwnPropertySymbols : null;
var h$ = function(t10, e) {
if (t10 == null)
throw new TypeError("target must be an object");
var r = tV(t10);
if (arguments.length === 1)
return r;
for (var n = 1; n < arguments.length; ++n) {
var i = tV(arguments[n]), o = edt(i), s = c$ && (Object.getOwnPropertySymbols || ndt);
if (s)
for (var a = s(i), u = 0; u < a.length; ++u) {
var d = a[u];
eV(i, d) && rdt(o, d);
}
for (var T = 0; T < o.length; ++T) {
var f = o[T];
if (eV(i, f)) {
var Q = i[f];
r[f] = Q;
}
}
}
return r;
};
var idt = h$;
var odt = function() {
if (!Object.assign)
return false;
for (var t10 = "abcdefghijklmnopqrst", e = t10.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 t10 !== o;
};
var sdt = function() {
if (!Object.assign || !Object.preventExtensions)
return false;
var t10 = Object.preventExtensions({ 1: 2 });
try {
Object.assign(t10, "xy");
} catch {
return t10[1] === "y";
}
return false;
};
var d$ = function() {
return !Object.assign || odt() || sdt() ? idt : Object.assign;
};
var adt = hl;
var ldt = d$;
var cdt = function() {
var t10 = ldt();
return adt(
Object,
{ assign: t10 },
{ assign: function() {
return Object.assign !== t10;
} }
), t10;
};
var udt = hl;
var hdt = oc;
var ddt = h$;
var p$ = d$;
var pdt = cdt;
var Tdt = hdt.apply(p$());
var T$ = function(t10, e) {
return Tdt(Object, arguments);
};
udt(T$, {
getPolyfill: p$,
implementation: ddt,
shim: pdt
});
var fdt = T$;
var zh = function() {
return typeof (function() {
}).name == "string";
};
var ih = Object.getOwnPropertyDescriptor;
if (ih)
try {
ih([], "length");
} catch {
ih = null;
}
zh.functionsHaveConfigurableNames = function() {
if (!zh() || !ih)
return false;
var t10 = ih(function() {
}, "name");
return !!t10 && !!t10.configurable;
};
var Qdt = Function.prototype.bind;
zh.boundFunctionsHaveNames = function() {
return zh() && typeof Qdt == "function" && (function() {
}).bind().name !== "";
};
var mdt = zh;
var rV = uH;
var gdt = hH();
var ydt = mdt.functionsHaveConfigurableNames();
var vdt = f0;
var _dt = function(t10, e) {
if (typeof t10 != "function")
throw new vdt("`fn` is not a function");
var r = arguments.length > 2 && !!arguments[2];
return (!r || ydt) && (gdt ? rV(
/** @type {Parameters[0]} */
t10,
"name",
e,
true,
true
) : rV(
/** @type {Parameters[0]} */
t10,
"name",
e
)), t10;
};
var bdt = _dt;
var Ldt = f0;
var wdt = Object;
var f$ = bdt(function() {
if (this == null || this !== wdt(this))
throw new Ldt("RegExp.prototype.flags getter called on non-object");
var t10 = "";
return this.hasIndices && (t10 += "d"), this.global && (t10 += "g"), this.ignoreCase && (t10 += "i"), this.multiline && (t10 += "m"), this.dotAll && (t10 += "s"), this.unicode && (t10 += "u"), this.unicodeSets && (t10 += "v"), this.sticky && (t10 += "y"), t10;
}, "get flags", true);
var xdt = f$;
var Edt = hl.supportsDescriptors;
var Mdt = Object.getOwnPropertyDescriptor;
var Q$ = function() {
if (Edt && /a/mig.flags === "gim") {
var t10 = Mdt(RegExp.prototype, "flags");
if (t10 && typeof t10.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 t10.get;
}
}
return xdt;
};
var Sdt = hl.supportsDescriptors;
var Hdt = Q$;
var Adt = Object.getOwnPropertyDescriptor;
var Odt = Object.defineProperty;
var Cdt = TypeError;
var nV = Object.getPrototypeOf;
var kdt = /a/;
var Idt = function() {
if (!Sdt || !nV)
throw new Cdt("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");
var t10 = Hdt(), e = nV(kdt), r = Adt(e, "flags");
return (!r || r.get !== t10) && Odt(e, "flags", {
configurable: true,
enumerable: false,
get: t10
}), t10;
};
var Pdt = hl;
var Vdt = oc;
var Rdt = f$;
var m$ = Q$;
var Ndt = Idt;
var g$ = Vdt(m$());
Pdt(g$, {
getPolyfill: m$,
implementation: Rdt,
shim: Ndt
});
var Ddt = g$;
var Ef = { exports: {} };
var Fdt = Dg;
var dl = function() {
return Fdt() && !!Symbol.toStringTag;
};
var Bdt = dl();
var jdt = Fs;
var Nx = jdt("Object.prototype.toString");
var Fg = function(t10) {
return Bdt && t10 && typeof t10 == "object" && Symbol.toStringTag in t10 ? false : Nx(t10) === "[object Arguments]";
};
var y$ = function(t10) {
return Fg(t10) ? true : t10 !== null && typeof t10 == "object" && typeof t10.length == "number" && t10.length >= 0 && Nx(t10) !== "[object Array]" && Nx(t10.callee) === "[object Function]";
};
var zdt = function() {
return Fg(arguments);
}();
Fg.isLegacyArguments = y$;
var v$ = zdt ? Fg : y$;
var Udt = {};
var Gdt = Object.freeze(Object.defineProperty({
__proto__: null,
default: Udt
}, Symbol.toStringTag, { value: "Module" }));
var $dt = W4t(Gdt);
var dH = typeof Map == "function" && Map.prototype;
var nL = Object.getOwnPropertyDescriptor && dH ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null;
var WQ = dH && nL && typeof nL.get == "function" ? nL.get : null;
var iV = dH && Map.prototype.forEach;
var pH = typeof Set == "function" && Set.prototype;
var iL = Object.getOwnPropertyDescriptor && pH ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
var ZQ = pH && iL && typeof iL.get == "function" ? iL.get : null;
var oV = pH && Set.prototype.forEach;
var Wdt = typeof WeakMap == "function" && WeakMap.prototype;
var oh = Wdt ? WeakMap.prototype.has : null;
var Zdt = typeof WeakSet == "function" && WeakSet.prototype;
var sh = Zdt ? WeakSet.prototype.has : null;
var qdt = typeof WeakRef == "function" && WeakRef.prototype;
var sV = qdt ? WeakRef.prototype.deref : null;
var Xdt = Boolean.prototype.valueOf;
var Kdt = Object.prototype.toString;
var Ydt = Function.prototype.toString;
var Jdt = String.prototype.match;
var TH = String.prototype.slice;
var K6 = String.prototype.replace;
var tpt = String.prototype.toUpperCase;
var aV = String.prototype.toLowerCase;
var _$ = RegExp.prototype.test;
var lV = Array.prototype.concat;
var Ja = Array.prototype.join;
var ept = Array.prototype.slice;
var cV = Math.floor;
var Dx = typeof BigInt == "function" ? BigInt.prototype.valueOf : null;
var oL = Object.getOwnPropertySymbols;
var Fx = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null;
var A8 = typeof Symbol == "function" && typeof Symbol.iterator == "object";
var Eo = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === A8 || true) ? Symbol.toStringTag : null;
var b$ = Object.prototype.propertyIsEnumerable;
var uV = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t10) {
return t10.__proto__;
} : null);
function hV(t10, e) {
if (t10 === 1 / 0 || t10 === -1 / 0 || t10 !== t10 || t10 && t10 > -1e3 && t10 < 1e3 || _$.call(/e/, e))
return e;
var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof t10 == "number") {
var n = t10 < 0 ? -cV(-t10) : cV(t10);
if (n !== t10) {
var i = String(n), o = TH.call(e, i.length + 1);
return K6.call(i, r, "$&_") + "." + K6.call(K6.call(o, /([0-9]{3})/g, "$&_"), /_$/, "");
}
}
return K6.call(e, r, "$&_");
}
var Bx = $dt;
var dV = Bx.custom;
var pV = w$(dV) ? dV : null;
var rpt = function t2(e, r, n, i) {
var o = r || {};
if (U6(o, "quoteStyle") && o.quoteStyle !== "single" && o.quoteStyle !== "double")
throw new TypeError('option "quoteStyle" must be "single" or "double"');
if (U6(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 = U6(o, "customInspect") ? o.customInspect : true;
if (typeof s != "boolean" && s !== "symbol")
throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
if (U6(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 (U6(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 E$(e, o);
if (typeof e == "number") {
if (e === 0)
return 1 / 0 / e > 0 ? "0" : "-0";
var u = String(e);
return a ? hV(e, u) : u;
}
if (typeof e == "bigint") {
var d = String(e) + "n";
return a ? hV(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 jx(e) ? "[Array]" : "[Object]";
var f = vpt(o, n);
if (typeof i > "u")
i = [];
else if (x$(i, e) >= 0)
return "[Circular]";
function Q(It, Zt, oe) {
if (Zt && (i = ept.call(i), i.push(Zt)), oe) {
var re = {
depth: o.depth
};
return U6(o, "quoteStyle") && (re.quoteStyle = o.quoteStyle), t2(It, re, n + 1, i);
}
return t2(It, o, n + 1, i);
}
if (typeof e == "function" && !TV(e)) {
var y = hpt(e), _ = uT(e, Q);
return "[Function" + (y ? ": " + y : " (anonymous)") + "]" + (_.length > 0 ? " { " + Ja.call(_, ", ") + " }" : "");
}
if (w$(e)) {
var L = A8 ? K6.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Fx.call(e);
return typeof e == "object" && !A8 ? fu(L) : L;
}
if (mpt(e)) {
for (var E = "<" + aV.call(String(e.nodeName)), x = e.attributes || [], O = 0; O < x.length; O++)
E += " " + x[O].name + "=" + L$(npt(x[O].value), "double", o);
return E += ">", e.childNodes && e.childNodes.length && (E += "..."), E += "" + aV.call(String(e.nodeName)) + ">", E;
}
if (jx(e)) {
if (e.length === 0)
return "[]";
var k = uT(e, Q);
return f && !ypt(k) ? "[" + zx(k, f) + "]" : "[ " + Ja.call(k, ", ") + " ]";
}
if (opt(e)) {
var R = uT(e, Q);
return !("cause" in Error.prototype) && "cause" in e && !b$.call(e, "cause") ? "{ [" + String(e) + "] " + Ja.call(lV.call("[cause]: " + Q(e.cause), R), ", ") + " }" : R.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + Ja.call(R, ", ") + " }";
}
if (typeof e == "object" && s) {
if (pV && typeof e[pV] == "function" && Bx)
return Bx(e, { depth: T - n });
if (s !== "symbol" && typeof e.inspect == "function")
return e.inspect();
}
if (dpt(e)) {
var F = [];
return iV && iV.call(e, function(It, Zt) {
F.push(Q(Zt, e, true) + " => " + Q(It, e));
}), fV("Map", WQ.call(e), F, f);
}
if (fpt(e)) {
var U = [];
return oV && oV.call(e, function(It) {
U.push(Q(It, e));
}), fV("Set", ZQ.call(e), U, f);
}
if (ppt(e))
return sL("WeakMap");
if (Qpt(e))
return sL("WeakSet");
if (Tpt(e))
return sL("WeakRef");
if (apt(e))
return fu(Q(Number(e)));
if (cpt(e))
return fu(Q(Dx.call(e)));
if (lpt(e))
return fu(Xdt.call(e));
if (spt(e))
return fu(Q(String(e)));
if (typeof window < "u" && e === window)
return "{ [object Window] }";
if (e === P)
return "{ [object globalThis] }";
if (!ipt(e) && !TV(e)) {
var $ = uT(e, Q), et = uV ? uV(e) === Object.prototype : e instanceof Object || e.constructor === Object, nt = e instanceof Object ? "" : "null prototype", ct = !et && Eo && Object(e) === e && Eo in e ? TH.call(Q0(e), 8, -1) : nt ? "Object" : "", rt = et || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", gt = rt + (ct || nt ? "[" + Ja.call(lV.call([], ct || [], nt || []), ": ") + "] " : "");
return $.length === 0 ? gt + "{}" : f ? gt + "{" + zx($, f) + "}" : gt + "{ " + Ja.call($, ", ") + " }";
}
return String(e);
};
function L$(t10, e, r) {
var n = (r.quoteStyle || e) === "double" ? '"' : "'";
return n + t10 + n;
}
function npt(t10) {
return K6.call(String(t10), /"/g, """);
}
function jx(t10) {
return Q0(t10) === "[object Array]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function ipt(t10) {
return Q0(t10) === "[object Date]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function TV(t10) {
return Q0(t10) === "[object RegExp]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function opt(t10) {
return Q0(t10) === "[object Error]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function spt(t10) {
return Q0(t10) === "[object String]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function apt(t10) {
return Q0(t10) === "[object Number]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function lpt(t10) {
return Q0(t10) === "[object Boolean]" && (!Eo || !(typeof t10 == "object" && Eo in t10));
}
function w$(t10) {
if (A8)
return t10 && typeof t10 == "object" && t10 instanceof Symbol;
if (typeof t10 == "symbol")
return true;
if (!t10 || typeof t10 != "object" || !Fx)
return false;
try {
return Fx.call(t10), true;
} catch {
}
return false;
}
function cpt(t10) {
if (!t10 || typeof t10 != "object" || !Dx)
return false;
try {
return Dx.call(t10), true;
} catch {
}
return false;
}
var upt = Object.prototype.hasOwnProperty || function(t10) {
return t10 in this;
};
function U6(t10, e) {
return upt.call(t10, e);
}
function Q0(t10) {
return Kdt.call(t10);
}
function hpt(t10) {
if (t10.name)
return t10.name;
var e = Jdt.call(Ydt.call(t10), /^function\s*([\w$]+)/);
return e ? e[1] : null;
}
function x$(t10, e) {
if (t10.indexOf)
return t10.indexOf(e);
for (var r = 0, n = t10.length; r < n; r++)
if (t10[r] === e)
return r;
return -1;
}
function dpt(t10) {
if (!WQ || !t10 || typeof t10 != "object")
return false;
try {
WQ.call(t10);
try {
ZQ.call(t10);
} catch {
return true;
}
return t10 instanceof Map;
} catch {
}
return false;
}
function ppt(t10) {
if (!oh || !t10 || typeof t10 != "object")
return false;
try {
oh.call(t10, oh);
try {
sh.call(t10, sh);
} catch {
return true;
}
return t10 instanceof WeakMap;
} catch {
}
return false;
}
function Tpt(t10) {
if (!sV || !t10 || typeof t10 != "object")
return false;
try {
return sV.call(t10), true;
} catch {
}
return false;
}
function fpt(t10) {
if (!ZQ || !t10 || typeof t10 != "object")
return false;
try {
ZQ.call(t10);
try {
WQ.call(t10);
} catch {
return true;
}
return t10 instanceof Set;
} catch {
}
return false;
}
function Qpt(t10) {
if (!sh || !t10 || typeof t10 != "object")
return false;
try {
sh.call(t10, sh);
try {
oh.call(t10, oh);
} catch {
return true;
}
return t10 instanceof WeakSet;
} catch {
}
return false;
}
function mpt(t10) {
return !t10 || typeof t10 != "object" ? false : typeof HTMLElement < "u" && t10 instanceof HTMLElement ? true : typeof t10.nodeName == "string" && typeof t10.getAttribute == "function";
}
function E$(t10, e) {
if (t10.length > e.maxStringLength) {
var r = t10.length - e.maxStringLength, n = "... " + r + " more character" + (r > 1 ? "s" : "");
return E$(TH.call(t10, 0, e.maxStringLength), e) + n;
}
var i = K6.call(K6.call(t10, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, gpt);
return L$(i, "single", e);
}
function gpt(t10) {
var e = t10.charCodeAt(0), r = {
8: "b",
9: "t",
10: "n",
12: "f",
13: "r"
}[e];
return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + tpt.call(e.toString(16));
}
function fu(t10) {
return "Object(" + t10 + ")";
}
function sL(t10) {
return t10 + " { ? }";
}
function fV(t10, e, r, n) {
var i = n ? zx(r, n) : Ja.call(r, ", ");
return t10 + " (" + e + ") {" + i + "}";
}
function ypt(t10) {
for (var e = 0; e < t10.length; e++)
if (x$(t10[e], `
`) >= 0)
return false;
return true;
}
function vpt(t10, e) {
var r;
if (t10.indent === " ")
r = " ";
else if (typeof t10.indent == "number" && t10.indent > 0)
r = Ja.call(Array(t10.indent + 1), " ");
else
return null;
return {
base: r,
prev: Ja.call(Array(e + 1), r)
};
}
function zx(t10, e) {
if (t10.length === 0)
return "";
var r = `
` + e.prev + e.base;
return r + Ja.call(t10, "," + r) + `
` + e.prev;
}
function uT(t10, e) {
var r = jx(t10), n = [];
if (r) {
n.length = t10.length;
for (var i = 0; i < t10.length; i++)
n[i] = U6(t10, i) ? e(t10[i], t10) : "";
}
var o = typeof oL == "function" ? oL(t10) : [], s;
if (A8) {
s = {};
for (var a = 0; a < o.length; a++)
s["$" + o[a]] = o[a];
}
for (var u in t10)
U6(t10, u) && (r && String(Number(u)) === u && u < t10.length || A8 && s["$" + u] instanceof Symbol || (_$.call(/[^\w$]/, u) ? n.push(e(u, t10) + ": " + e(t10[u], t10)) : n.push(u + ": " + e(t10[u], t10))));
if (typeof oL == "function")
for (var d = 0; d < o.length; d++)
b$.call(t10, o[d]) && n.push("[" + e(o[d]) + "]: " + e(t10[o[d]], t10));
return n;
}
var M$ = x3;
var sc = Fs;
var _pt = rpt;
var bpt = f0;
var hT = M$("%WeakMap%", true);
var dT = M$("%Map%", true);
var Lpt = sc("WeakMap.prototype.get", true);
var wpt = sc("WeakMap.prototype.set", true);
var xpt = sc("WeakMap.prototype.has", true);
var Ept = sc("Map.prototype.get", true);
var Mpt = sc("Map.prototype.set", true);
var Spt = sc("Map.prototype.has", true);
var fH = function(t10, e) {
for (var r = t10, n; (n = r.next) !== null; r = n)
if (n.key === e)
return r.next = n.next, n.next = /** @type {NonNullable} */
t10.next, t10.next = n, n;
};
var Hpt = function(t10, e) {
var r = fH(t10, e);
return r && r.value;
};
var Apt = function(t10, e, r) {
var n = fH(t10, e);
n ? n.value = r : t10.next = /** @type {import('.').ListNode} */
{
// eslint-disable-line no-param-reassign, no-extra-parens
key: e,
next: t10.next,
value: r
};
};
var Opt = function(t10, e) {
return !!fH(t10, e);
};
var S$ = function() {
var t10, e, r, n = {
assert: function(i) {
if (!n.has(i))
throw new bpt("Side channel does not contain " + _pt(i));
},
get: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t10)
return Lpt(t10, i);
} else if (dT) {
if (e)
return Ept(e, i);
} else if (r)
return Hpt(r, i);
},
has: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t10)
return xpt(t10, i);
} else if (dT) {
if (e)
return Spt(e, i);
} else if (r)
return Opt(r, i);
return false;
},
set: function(i, o) {
hT && i && (typeof i == "object" || typeof i == "function") ? (t10 || (t10 = new hT()), wpt(t10, i, o)) : dT ? (e || (e = new dT()), Mpt(e, i, o)) : (r || (r = { key: {}, next: null }), Apt(r, i, o));
}
};
return n;
};
var Cpt = e$;
var Qu = S$();
var W3 = f0;
var QH = {
assert: function(t10, e) {
if (!t10 || typeof t10 != "object" && typeof t10 != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
if (Qu.assert(t10), !QH.has(t10, e))
throw new W3("`" + e + "` is not present on `O`");
},
get: function(t10, e) {
if (!t10 || typeof t10 != "object" && typeof t10 != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = Qu.get(t10);
return r && r["$" + e];
},
has: function(t10, e) {
if (!t10 || typeof t10 != "object" && typeof t10 != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = Qu.get(t10);
return !!r && Cpt(r, "$" + e);
},
set: function(t10, e, r) {
if (!t10 || typeof t10 != "object" && typeof t10 != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var n = Qu.get(t10);
n || (n = {}, Qu.set(t10, n)), n["$" + e] = r;
}
};
Object.freeze && Object.freeze(QH);
var kpt = QH;
var mu = kpt;
var Ipt = SyntaxError;
var QV = typeof StopIteration == "object" ? StopIteration : null;
var Ppt = function(t10) {
if (!QV)
throw new Ipt("this environment lacks StopIteration");
mu.set(t10, "[[Done]]", false);
var e = {
next: function() {
var r = mu.get(this, "[[Iterator]]"), n = mu.get(r, "[[Done]]");
try {
return {
done: n,
value: n ? void 0 : r.next()
};
} catch (i) {
if (mu.set(r, "[[Done]]", true), i !== QV)
throw i;
return {
done: true,
value: void 0
};
}
}
};
return mu.set(e, "[[Iterator]]", t10), e;
};
var Vpt = {}.toString;
var H$ = Array.isArray || function(t10) {
return Vpt.call(t10) == "[object Array]";
};
var Rpt = String.prototype.valueOf;
var Npt = function(t10) {
try {
return Rpt.call(t10), true;
} catch {
return false;
}
};
var Dpt = Object.prototype.toString;
var Fpt = "[object String]";
var Bpt = dl();
var A$ = function(t10) {
return typeof t10 == "string" ? true : typeof t10 != "object" ? false : Bpt ? Npt(t10) : Dpt.call(t10) === Fpt;
};
var mH = typeof Map == "function" && Map.prototype ? Map : null;
var jpt = typeof Set == "function" && Set.prototype ? Set : null;
var qQ;
mH || (qQ = function(t10) {
return false;
});
var O$ = mH ? Map.prototype.has : null;
var mV = jpt ? Set.prototype.has : null;
!qQ && !O$ && (qQ = function(t10) {
return false;
});
var C$ = qQ || function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
if (O$.call(t10), mV)
try {
mV.call(t10);
} catch {
return true;
}
return t10 instanceof mH;
} catch {
}
return false;
};
var zpt = typeof Map == "function" && Map.prototype ? Map : null;
var gH = typeof Set == "function" && Set.prototype ? Set : null;
var XQ;
gH || (XQ = function(t10) {
return false;
});
var gV = zpt ? Map.prototype.has : null;
var k$ = gH ? Set.prototype.has : null;
!XQ && !k$ && (XQ = function(t10) {
return false;
});
var I$ = XQ || function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
if (k$.call(t10), gV)
try {
gV.call(t10);
} catch {
return true;
}
return t10 instanceof gH;
} catch {
}
return false;
};
var yV = v$;
var vV = Ppt;
if (sH() || Dg()) {
aL = Symbol.iterator;
Ef.exports = function(t10) {
if (t10 != null && typeof t10[aL] < "u")
return t10[aL]();
if (yV(t10))
return Array.prototype[aL].call(t10);
};
} else {
Upt = H$, Gpt = A$, _V = x3, $pt = _V("%Map%", true), Wpt = _V("%Set%", true), Xs = Fs, bV = Xs("Array.prototype.push"), LV = Xs("String.prototype.charCodeAt"), Zpt = Xs("String.prototype.slice"), qpt = function(t10, e) {
var r = t10.length;
if (e + 1 >= r)
return e + 1;
var n = LV(t10, e);
if (n < 55296 || n > 56319)
return e + 1;
var i = LV(t10, e + 1);
return i < 56320 || i > 57343 ? e + 1 : e + 2;
}, lL = function(t10) {
var e = 0;
return {
next: function() {
var r = e >= t10.length, n;
return r || (n = t10[e], e += 1), {
done: r,
value: n
};
}
};
}, wV = function(t10, e) {
if (Upt(t10) || yV(t10))
return lL(t10);
if (Gpt(t10)) {
var r = 0;
return {
next: function() {
var n = qpt(t10, r), i = Zpt(t10, r, n);
return r = n, {
done: n > t10.length,
value: i
};
}
};
}
if (e && typeof t10["_es6-shim iterator_"] < "u")
return t10["_es6-shim iterator_"]();
};
if (!$pt && !Wpt)
Ef.exports = function(t10) {
if (t10 != null)
return wV(t10, true);
};
else {
Xpt = C$, Kpt = I$, xV = Xs("Map.prototype.forEach", true), EV = Xs("Set.prototype.forEach", true);
if (typeof process > "u" || !process.versions || !process.versions.node)
MV = Xs("Map.prototype.iterator", true), SV = Xs("Set.prototype.iterator", true);
HV = Xs("Map.prototype.@@iterator", true) || Xs("Map.prototype._es6-shim iterator_", true), AV = Xs("Set.prototype.@@iterator", true) || Xs("Set.prototype._es6-shim iterator_", true), Ypt = function(t10) {
if (Xpt(t10)) {
if (MV)
return vV(MV(t10));
if (HV)
return HV(t10);
if (xV) {
var e = [];
return xV(t10, function(n, i) {
bV(e, [i, n]);
}), lL(e);
}
}
if (Kpt(t10)) {
if (SV)
return vV(SV(t10));
if (AV)
return AV(t10);
if (EV) {
var r = [];
return EV(t10, function(n) {
bV(r, n);
}), lL(r);
}
}
};
Ef.exports = function(t10) {
return Ypt(t10) || wV(t10);
};
}
}
var aL;
var Upt;
var Gpt;
var _V;
var $pt;
var Wpt;
var Xs;
var bV;
var LV;
var Zpt;
var qpt;
var lL;
var wV;
var Xpt;
var Kpt;
var xV;
var EV;
var MV;
var SV;
var HV;
var AV;
var Ypt;
var Jpt = Ef.exports;
var OV = function(t10) {
return t10 !== t10;
};
var P$ = function(t10, e) {
return t10 === 0 && e === 0 ? 1 / t10 === 1 / e : !!(t10 === e || OV(t10) && OV(e));
};
var tTt = P$;
var V$ = function() {
return typeof Object.is == "function" ? Object.is : tTt;
};
var eTt = V$;
var rTt = hl;
var nTt = function() {
var t10 = eTt();
return rTt(Object, { is: t10 }, {
is: function() {
return Object.is !== t10;
}
}), t10;
};
var iTt = hl;
var oTt = oc;
var sTt = P$;
var R$ = V$;
var aTt = nTt;
var N$ = oTt(R$(), Object);
iTt(N$, {
getPolyfill: R$,
implementation: sTt,
shim: aTt
});
var lTt = N$;
var cTt = oc;
var D$ = Fs;
var uTt = x3;
var Ux = uTt("%ArrayBuffer%", true);
var Mf = D$("ArrayBuffer.prototype.byteLength", true);
var hTt = D$("Object.prototype.toString");
var CV = !!Ux && !Mf && new Ux(0).slice;
var kV = !!CV && cTt(CV);
var F$ = Mf || kV ? function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
return Mf ? Mf(t10) : kV(t10, 0), true;
} catch {
return false;
}
} : Ux ? function(t10) {
return hTt(t10) === "[object ArrayBuffer]";
} : function(t10) {
return false;
};
var dTt = Date.prototype.getDay;
var pTt = function(t10) {
try {
return dTt.call(t10), true;
} catch {
return false;
}
};
var TTt = Object.prototype.toString;
var fTt = "[object Date]";
var QTt = dl();
var mTt = function(t10) {
return typeof t10 != "object" || t10 === null ? false : QTt ? pTt(t10) : TTt.call(t10) === fTt;
};
var Gx = Fs;
var B$ = dl();
var j$;
var z$;
var $x;
var Wx;
if (B$) {
j$ = Gx("Object.prototype.hasOwnProperty"), z$ = Gx("RegExp.prototype.exec"), $x = {};
cL = function() {
throw $x;
};
Wx = {
toString: cL,
valueOf: cL
}, typeof Symbol.toPrimitive == "symbol" && (Wx[Symbol.toPrimitive] = cL);
}
var cL;
var gTt = Gx("Object.prototype.toString");
var yTt = Object.getOwnPropertyDescriptor;
var vTt = "[object RegExp]";
var _Tt = B$ ? function(t10) {
if (!t10 || typeof t10 != "object")
return false;
var e = yTt(t10, "lastIndex"), r = e && j$(e, "value");
if (!r)
return false;
try {
z$(t10, Wx);
} catch (n) {
return n === $x;
}
} : function(t10) {
return !t10 || typeof t10 != "object" && typeof t10 != "function" ? false : gTt(t10) === vTt;
};
var bTt = Fs;
var IV = bTt("SharedArrayBuffer.prototype.byteLength", true);
var LTt = IV ? function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
return IV(t10), true;
} catch {
return false;
}
} : function(t10) {
return false;
};
var wTt = Number.prototype.toString;
var xTt = function(t10) {
try {
return wTt.call(t10), true;
} catch {
return false;
}
};
var ETt = Object.prototype.toString;
var MTt = "[object Number]";
var STt = dl();
var HTt = function(t10) {
return typeof t10 == "number" ? true : typeof t10 != "object" ? false : STt ? xTt(t10) : ETt.call(t10) === MTt;
};
var U$ = Fs;
var ATt = U$("Boolean.prototype.toString");
var OTt = U$("Object.prototype.toString");
var CTt = function(t10) {
try {
return ATt(t10), true;
} catch {
return false;
}
};
var kTt = "[object Boolean]";
var ITt = dl();
var PTt = function(t10) {
return typeof t10 == "boolean" ? true : t10 === null || typeof t10 != "object" ? false : ITt && Symbol.toStringTag in t10 ? CTt(t10) : OTt(t10) === kTt;
};
var Zx = { exports: {} };
var VTt = Object.prototype.toString;
var RTt = sH();
if (RTt) {
NTt = Symbol.prototype.toString, DTt = /^Symbol\(.*\)$/, FTt = function(t10) {
return typeof t10.valueOf() != "symbol" ? false : DTt.test(NTt.call(t10));
};
Zx.exports = function(t10) {
if (typeof t10 == "symbol")
return true;
if (VTt.call(t10) !== "[object Symbol]")
return false;
try {
return FTt(t10);
} catch {
return false;
}
};
} else
Zx.exports = function(t10) {
return false;
};
var NTt;
var DTt;
var FTt;
var BTt = Zx.exports;
var qx = { exports: {} };
var PV = typeof BigInt < "u" && BigInt;
var jTt = function() {
return typeof PV == "function" && typeof BigInt == "function" && typeof PV(42) == "bigint" && typeof BigInt(42) == "bigint";
};
var zTt = jTt();
if (zTt) {
UTt = BigInt.prototype.valueOf, GTt = function(t10) {
try {
return UTt.call(t10), true;
} catch {
}
return false;
};
qx.exports = function(t10) {
return t10 === null || typeof t10 > "u" || typeof t10 == "boolean" || typeof t10 == "string" || typeof t10 == "number" || typeof t10 == "symbol" || typeof t10 == "function" ? false : typeof t10 == "bigint" ? true : GTt(t10);
};
} else
qx.exports = function(t10) {
return false;
};
var UTt;
var GTt;
var $Tt = qx.exports;
var WTt = A$;
var ZTt = HTt;
var qTt = PTt;
var XTt = BTt;
var KTt = $Tt;
var YTt = function(t10) {
if (t10 == null || typeof t10 != "object" && typeof t10 != "function")
return null;
if (WTt(t10))
return "String";
if (ZTt(t10))
return "Number";
if (qTt(t10))
return "Boolean";
if (XTt(t10))
return "Symbol";
if (KTt(t10))
return "BigInt";
};
var KQ = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap : null;
var VV = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet : null;
var YQ;
KQ || (YQ = function(t10) {
return false;
});
var Xx = KQ ? KQ.prototype.has : null;
var uL = VV ? VV.prototype.has : null;
!YQ && !Xx && (YQ = function(t10) {
return false;
});
var JTt = YQ || function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
if (Xx.call(t10, Xx), uL)
try {
uL.call(t10, uL);
} catch {
return true;
}
return t10 instanceof KQ;
} catch {
}
return false;
};
var Kx = { exports: {} };
var tft = x3;
var G$ = Fs;
var eft = tft("%WeakSet%", true);
var hL = G$("WeakSet.prototype.has", true);
if (hL) {
dL = G$("WeakMap.prototype.has", true);
Kx.exports = function(t10) {
if (!t10 || typeof t10 != "object")
return false;
try {
if (hL(t10, hL), dL)
try {
dL(t10, dL);
} catch {
return true;
}
return t10 instanceof eft;
} catch {
}
return false;
};
} else
Kx.exports = function(t10) {
return false;
};
var dL;
var rft = Kx.exports;
var nft = C$;
var ift = I$;
var oft = JTt;
var sft = rft;
var aft = function(t10) {
if (t10 && typeof t10 == "object") {
if (nft(t10))
return "Map";
if (ift(t10))
return "Set";
if (oft(t10))
return "WeakMap";
if (sft(t10))
return "WeakSet";
}
return false;
};
var $$ = Function.prototype.toString;
var Y7 = typeof Reflect == "object" && Reflect !== null && Reflect.apply;
var Yx;
var Sf;
if (typeof Y7 == "function" && typeof Object.defineProperty == "function")
try {
Yx = Object.defineProperty({}, "length", {
get: function() {
throw Sf;
}
}), Sf = {}, Y7(function() {
throw 42;
}, null, Yx);
} catch (t10) {
t10 !== Sf && (Y7 = null);
}
else
Y7 = null;
var lft = /^\s*class\b/;
var Jx = function(t10) {
try {
var e = $$.call(t10);
return lft.test(e);
} catch {
return false;
}
};
var pL = function(t10) {
try {
return Jx(t10) ? false : ($$.call(t10), true);
} catch {
return false;
}
};
var Hf = Object.prototype.toString;
var cft = "[object Object]";
var uft = "[object Function]";
var hft = "[object GeneratorFunction]";
var dft = "[object HTMLAllCollection]";
var pft = "[object HTML document.all class]";
var Tft = "[object HTMLCollection]";
var fft = typeof Symbol == "function" && !!Symbol.toStringTag;
var Qft = !(0 in [,]);
var tE = function() {
return false;
};
if (typeof document == "object") {
mft = document.all;
Hf.call(mft) === Hf.call(document.all) && (tE = function(t10) {
if ((Qft || !t10) && (typeof t10 > "u" || typeof t10 == "object"))
try {
var e = Hf.call(t10);
return (e === dft || e === pft || e === Tft || e === cft) && t10("") == null;
} catch {
}
return false;
});
}
var mft;
var gft = Y7 ? function(t10) {
if (tE(t10))
return true;
if (!t10 || typeof t10 != "function" && typeof t10 != "object")
return false;
try {
Y7(t10, null, Yx);
} catch (e) {
if (e !== Sf)
return false;
}
return !Jx(t10) && pL(t10);
} : function(t10) {
if (tE(t10))
return true;
if (!t10 || typeof t10 != "function" && typeof t10 != "object")
return false;
if (fft)
return pL(t10);
if (Jx(t10))
return false;
var e = Hf.call(t10);
return e !== uft && e !== hft && !/^\[object HTML/.test(e) ? false : pL(t10);
};
var yft = gft;
var vft = Object.prototype.toString;
var W$ = Object.prototype.hasOwnProperty;
var _ft = function(t10, e, r) {
for (var n = 0, i = t10.length; n < i; n++)
W$.call(t10, n) && (r == null ? e(t10[n], n, t10) : e.call(r, t10[n], n, t10));
};
var bft = function(t10, e, r) {
for (var n = 0, i = t10.length; n < i; n++)
r == null ? e(t10.charAt(n), n, t10) : e.call(r, t10.charAt(n), n, t10);
};
var Lft = function(t10, e, r) {
for (var n in t10)
W$.call(t10, n) && (r == null ? e(t10[n], n, t10) : e.call(r, t10[n], n, t10));
};
var wft = function(t10, e, r) {
if (!yft(e))
throw new TypeError("iterator must be a function");
var n;
arguments.length >= 3 && (n = r), vft.call(t10) === "[object Array]" ? _ft(t10, e, n) : typeof t10 == "string" ? bft(t10, e, n) : Lft(t10, e, n);
};
var xft = wft;
var Eft = [
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
];
var TL = Eft;
var Mft = typeof globalThis > "u" ? P : globalThis;
var Sft = function() {
for (var t10 = [], e = 0; e < TL.length; e++)
typeof Mft[TL[e]] == "function" && (t10[t10.length] = TL[e]);
return t10;
};
var JQ = xft;
var Hft = Sft;
var RV = oc;
var yH = Fs;
var Af = cH;
var Aft = yH("Object.prototype.toString");
var Z$ = dl();
var NV = typeof globalThis > "u" ? P : globalThis;
var eE = Hft();
var vH = yH("String.prototype.slice");
var fL = Object.getPrototypeOf;
var Oft = yH("Array.prototype.indexOf", true) || function(t10, e) {
for (var r = 0; r < t10.length; r += 1)
if (t10[r] === e)
return r;
return -1;
};
var tm = { __proto__: null };
Z$ && Af && fL ? JQ(eE, function(t10) {
var e = new NV[t10]();
if (Symbol.toStringTag in e) {
var r = fL(e), n = Af(r, Symbol.toStringTag);
if (!n) {
var i = fL(r);
n = Af(i, Symbol.toStringTag);
}
tm["$" + t10] = RV(n.get);
}
}) : JQ(eE, function(t10) {
var e = new NV[t10](), r = e.slice || e.set;
r && (tm["$" + t10] = RV(r));
});
var Cft = function(t10) {
var e = false;
return JQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
tm,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
"$" + r(t10) === n && (e = vH(n, 1));
} catch {
}
}
), e;
};
var kft = function(t10) {
var e = false;
return JQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
tm,
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
r(t10), e = vH(n, 1);
} catch {
}
}
), e;
};
var Ift = function(t10) {
if (!t10 || typeof t10 != "object")
return false;
if (!Z$) {
var e = vH(Aft(t10), 8, -1);
return Oft(eE, e) > -1 ? e : e !== "Object" ? false : kft(t10);
}
return Af ? Cft(t10) : null;
};
var Pft = Fs;
var DV = Pft("ArrayBuffer.prototype.byteLength", true);
var Vft = F$;
var Rft = function(t10) {
return Vft(t10) ? DV ? DV(t10) : t10.byteLength : NaN;
};
var q$ = fdt;
var E3 = Fs;
var FV = Ddt;
var Nft = x3;
var O8 = Jpt;
var Dft = S$;
var BV = lTt;
var jV = v$;
var zV = H$;
var UV = F$;
var GV = mTt;
var $V = _Tt;
var WV = LTt;
var ZV = oH;
var qV = YTt;
var XV = aft;
var KV = Ift;
var YV = Rft;
var JV = E3("SharedArrayBuffer.prototype.byteLength", true);
var tR = E3("Date.prototype.getTime");
var QL = Object.getPrototypeOf;
var eR = E3("Object.prototype.toString");
var em = Nft("%Set%", true);
var rE = E3("Map.prototype.has", true);
var rm = E3("Map.prototype.get", true);
var rR = E3("Map.prototype.size", true);
var nm = E3("Set.prototype.add", true);
var X$ = E3("Set.prototype.delete", true);
var im = E3("Set.prototype.has", true);
var Of = E3("Set.prototype.size", true);
function nR(t10, e, r, n) {
for (var i = O8(t10), o; (o = i.next()) && !o.done; )
if (oa(e, o.value, r, n))
return X$(t10, o.value), true;
return false;
}
function K$(t10) {
if (typeof t10 > "u")
return null;
if (typeof t10 != "object")
return typeof t10 == "symbol" ? false : typeof t10 == "string" || typeof t10 == "number" ? +t10 == +t10 : true;
}
function Fft(t10, e, r, n, i, o) {
var s = K$(r);
if (s != null)
return s;
var a = rm(e, s), u = q$({}, i, { strict: false });
return typeof a > "u" && !rE(e, s) || !oa(n, a, u, o) ? false : !rE(t10, s) && oa(n, a, u, o);
}
function Bft(t10, e, r) {
var n = K$(r);
return n ?? (im(e, n) && !im(t10, n));
}
function iR(t10, e, r, n, i, o) {
for (var s = O8(t10), 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, rm(e, u), i, o))
return X$(t10, u), true;
return false;
}
function oa(t10, e, r, n) {
var i = r || {};
if (i.strict ? BV(t10, e) : t10 === e)
return true;
var o = qV(t10), s = qV(e);
if (o !== s)
return false;
if (!t10 || !e || typeof t10 != "object" && typeof e != "object")
return i.strict ? BV(t10, e) : t10 == e;
var a = n.has(t10), u = n.has(e), d;
if (a && u) {
if (n.get(t10) === n.get(e))
return true;
} else
d = {};
return a || n.set(t10, d), u || n.set(e, d), Uft(t10, e, i, n);
}
function oR(t10) {
return !t10 || typeof t10 != "object" || typeof t10.length != "number" || typeof t10.copy != "function" || typeof t10.slice != "function" || t10.length > 0 && typeof t10[0] != "number" ? false : !!(t10.constructor && t10.constructor.isBuffer && t10.constructor.isBuffer(t10));
}
function jft(t10, e, r, n) {
if (Of(t10) !== Of(e))
return false;
for (var i = O8(t10), o = O8(e), s, a, u; (s = i.next()) && !s.done; )
if (s.value && typeof s.value == "object")
u || (u = new em()), nm(u, s.value);
else if (!im(e, s.value)) {
if (r.strict || !Bft(t10, e, s.value))
return false;
u || (u = new em()), nm(u, s.value);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (a.value && typeof a.value == "object") {
if (!nR(u, a.value, r.strict, n))
return false;
} else if (!r.strict && !im(t10, a.value) && !nR(u, a.value, r.strict, n))
return false;
return Of(u) === 0;
}
return true;
}
function zft(t10, e, r, n) {
if (rR(t10) !== rR(e))
return false;
for (var i = O8(t10), o = O8(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 em()), nm(u, d);
else if (f = rm(e, d), typeof f > "u" && !rE(e, d) || !oa(T, f, r, n)) {
if (r.strict || !Fft(t10, e, d, T, r, n))
return false;
u || (u = new em()), nm(u, d);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (d = a.value[0], f = a.value[1], d && typeof d == "object") {
if (!iR(u, t10, d, f, r, n))
return false;
} else if (!r.strict && (!t10.has(d) || !oa(rm(t10, d), f, r, n)) && !iR(u, t10, d, f, q$({}, r, { strict: false }), n))
return false;
return Of(u) === 0;
}
return true;
}
function Uft(t10, e, r, n) {
var i, o;
if (typeof t10 != typeof e || t10 == null || e == null || eR(t10) !== eR(e) || jV(t10) !== jV(e))
return false;
var s = zV(t10), a = zV(e);
if (s !== a)
return false;
var u = t10 instanceof Error, d = e instanceof Error;
if (u !== d || (u || d) && (t10.name !== e.name || t10.message !== e.message))
return false;
var T = $V(t10), f = $V(e);
if (T !== f || (T || f) && (t10.source !== e.source || FV(t10) !== FV(e)))
return false;
var Q = GV(t10), y = GV(e);
if (Q !== y || (Q || y) && tR(t10) !== tR(e) || r.strict && QL && QL(t10) !== QL(e))
return false;
var _ = KV(t10), L = KV(e);
if (_ !== L)
return false;
if (_ || L) {
if (t10.length !== e.length)
return false;
for (i = 0; i < t10.length; i++)
if (t10[i] !== e[i])
return false;
return true;
}
var E = oR(t10), x = oR(e);
if (E !== x)
return false;
if (E || x) {
if (t10.length !== e.length)
return false;
for (i = 0; i < t10.length; i++)
if (t10[i] !== e[i])
return false;
return true;
}
var O = UV(t10), k = UV(e);
if (O !== k)
return false;
if (O || k)
return YV(t10) !== YV(e) ? false : typeof Uint8Array == "function" && oa(new Uint8Array(t10), new Uint8Array(e), r, n);
var R = WV(t10), F = WV(e);
if (R !== F)
return false;
if (R || F)
return JV(t10) !== JV(e) ? false : typeof Uint8Array == "function" && oa(new Uint8Array(t10), new Uint8Array(e), r, n);
if (typeof t10 != typeof e)
return false;
var U = ZV(t10), $ = ZV(e);
if (U.length !== $.length)
return false;
for (U.sort(), $.sort(), i = U.length - 1; i >= 0; i--)
if (U[i] != $[i])
return false;
for (i = U.length - 1; i >= 0; i--)
if (o = U[i], !oa(t10[o], e[o], r, n))
return false;
var et = XV(t10), nt = XV(e);
return et !== nt ? false : et === "Set" || nt === "Set" ? jft(t10, e, r, n) : et === "Map" ? zft(t10, e, r, n) : true;
}
var Gft = function(t10, e, r) {
return oa(t10, e, r, Dft());
};
var _H = p0(Gft);
var $ft = Object.defineProperty;
var $n = (t10, e) => $ft(t10, "name", { value: e, configurable: true });
var Wft = class {
constructor(t10) {
this.direction = false, this.compareProperties = true;
var e, r, n;
this.precision = 10 ** -((e = t10 == null ? void 0 : t10.precision) != null ? e : 17), this.direction = (r = t10 == null ? void 0 : t10.direction) != null ? r : false, this.compareProperties = (n = t10 == null ? void 0 : t10.compareProperties) != null ? n : true;
}
compare(t10, e) {
if (t10.type !== e.type || !c9(t10, e))
return false;
switch (t10.type) {
case "Point":
return this.compareCoord(t10.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t10.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t10, e);
case "GeometryCollection":
return this.compareGeometryCollection(t10, e);
case "Feature":
return this.compareFeature(t10, e);
case "FeatureCollection":
return this.compareFeatureCollection(t10, e);
default:
if (t10.type.startsWith("Multi")) {
const r = nE(t10), n = nE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return false;
}
compareCoord(t10, e) {
return t10.length === e.length && t10.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t10, e, r = 0, n = false) {
if (!c9(t10, e))
return false;
const i = t10;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return false;
}
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) : false;
}
fixStartIndex(t10, e) {
let r, n = -1;
for (let i = 0; i < t10.length; i++)
if (this.compareCoord(t10[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t10.slice(n, t10.length),
t10.slice(1, n + 1)
)), r;
}
comparePath(t10, e) {
return t10.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t10, e) {
if (this.compareLine(t10.coordinates[0], e.coordinates[0], 1, true)) {
const r = t10.coordinates.slice(1, t10.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, true))
);
}
return false;
}
compareGeometryCollection(t10, e) {
return c9(t10.geometries, e.geometries) && this.compareBBox(t10, e) && t10.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t10, e) {
return t10.id === e.id && (this.compareProperties ? _H(t10.properties, e.properties) : true) && this.compareBBox(t10, e) && this.compare(t10.geometry, e.geometry);
}
compareFeatureCollection(t10, e) {
return c9(t10.features, e.features) && this.compareBBox(t10, e) && t10.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t10, e) {
return !t10.bbox && !e.bbox || (t10.bbox && e.bbox ? this.compareCoord(t10.bbox, e.bbox) : false);
}
};
$n(Wft, "GeojsonEquality");
function c9(t10, e) {
return t10.coordinates ? t10.coordinates.length === e.coordinates.length : t10.length === e.length;
}
$n(c9, "sameLength");
function nE(t10) {
return t10.coordinates.map((e) => ({
type: t10.type.replace("Multi", ""),
coordinates: e
}));
}
$n(nE, "explode");
var D2 = 63710088e-1;
var Y$ = {
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
};
var sR = {
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(t10, 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 = t10, n;
}
$n(T3, "feature");
function Zft(t10, e, r = {}) {
switch (t10) {
case "Point":
return c4(e).geometry;
case "LineString":
return Q4(e).geometry;
case "Polygon":
return bH(e).geometry;
case "MultiPoint":
return tW(e).geometry;
case "MultiLineString":
return J$(e).geometry;
case "MultiPolygon":
return eW(e).geometry;
default:
throw new Error(t10 + " is invalid");
}
}
$n(Zft, "geometry");
function c4(t10, e, r = {}) {
if (!t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!om(t10[0]) || !om(t10[1]))
throw new Error("coordinates must contain numbers");
return T3({
type: "Point",
coordinates: t10
}, e, r);
}
$n(c4, "point");
function qft(t10, e, r = {}) {
return Bg(
t10.map((n) => c4(n, e)),
r
);
}
$n(qft, "points");
function bH(t10, e, r = {}) {
for (const n of t10) {
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: t10
}, e, r);
}
$n(bH, "polygon");
function Xft(t10, e, r = {}) {
return Bg(
t10.map((n) => bH(n, e)),
r
);
}
$n(Xft, "polygons");
function Q4(t10, e, r = {}) {
if (t10.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return T3({
type: "LineString",
coordinates: t10
}, e, r);
}
$n(Q4, "lineString");
function Kft(t10, e, r = {}) {
return Bg(
t10.map((n) => Q4(n, e)),
r
);
}
$n(Kft, "lineStrings");
function Bg(t10, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t10, r;
}
$n(Bg, "featureCollection");
function J$(t10, e, r = {}) {
return T3({
type: "MultiLineString",
coordinates: t10
}, e, r);
}
$n(J$, "multiLineString");
function tW(t10, e, r = {}) {
return T3({
type: "MultiPoint",
coordinates: t10
}, e, r);
}
$n(tW, "multiPoint");
function eW(t10, e, r = {}) {
return T3({
type: "MultiPolygon",
coordinates: t10
}, e, r);
}
$n(eW, "multiPolygon");
function Yft(t10, e, r = {}) {
return T3({
type: "GeometryCollection",
geometries: t10
}, e, r);
}
$n(Yft, "geometryCollection");
function Jft(t10, 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(t10 * r) / r;
}
$n(Jft, "round");
function rW(t10, e = "kilometers") {
const r = Y$[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 * r;
}
$n(rW, "radiansToLength");
function LH(t10, e = "kilometers") {
const r = Y$[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 / r;
}
$n(LH, "lengthToRadians");
function tQt(t10, e) {
return nW(LH(t10, e));
}
$n(tQt, "lengthToDegrees");
function eQt(t10) {
let e = t10 % 360;
return e < 0 && (e += 360), e;
}
$n(eQt, "bearingToAzimuth");
function nW(t10) {
return t10 % (2 * Math.PI) * 180 / Math.PI;
}
$n(nW, "radiansToDegrees");
function rQt(t10) {
return t10 % 360 * Math.PI / 180;
}
$n(rQt, "degreesToRadians");
function nQt(t10, e = "kilometers", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("length must be a positive number");
return rW(LH(t10, e), r);
}
$n(nQt, "convertLength");
function iQt(t10, e = "meters", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("area must be a positive number");
const n = sR[e];
if (!n)
throw new Error("invalid original units");
const i = sR[r];
if (!i)
throw new Error("invalid final units");
return t10 / n * i;
}
$n(iQt, "convertArea");
function om(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
$n(om, "isNumber");
function wH(t10) {
return t10 !== null && typeof t10 == "object" && !Array.isArray(t10);
}
$n(wH, "isObject");
function oQt(t10) {
if (!t10)
throw new Error("bbox is required");
if (!Array.isArray(t10))
throw new Error("bbox must be an Array");
if (t10.length !== 4 && t10.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t10.forEach((e) => {
if (!om(e))
throw new Error("bbox must only contain numbers");
});
}
$n(oQt, "validateBBox");
function sQt(t10) {
if (!t10)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t10) === -1)
throw new Error("id must be a number or a string");
}
$n(sQt, "validateId");
var aQt = Object.defineProperty;
var so = (t10, e) => aQt(t10, "name", { value: e, configurable: true });
function xd(t10, e, r) {
if (t10 !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t10.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t10.features.length : 1, x = 0; x < E; x++) {
d = _ ? t10.features[x].geometry : L ? t10.geometry : t10, Q = d ? d.type === "GeometryCollection" : false, 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
) === false)
return false;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === false)
return false;
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
) === false)
return false;
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
) === false)
return false;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (xd(s.geometries[n], e, r) === false)
return false;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
so(xd, "coordEach");
function lQt(t10, e, r, n) {
var i = r;
return xd(
t10,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
so(lQt, "coordReduce");
function iW(t10, e) {
var r;
switch (t10.type) {
case "FeatureCollection":
for (r = 0; r < t10.features.length && e(t10.features[r].properties, r) !== false; r++)
;
break;
case "Feature":
e(t10.properties, 0);
break;
}
}
so(iW, "propEach");
function cQt(t10, e, r) {
var n = r;
return iW(t10, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(cQt, "propReduce");
function oW(t10, e) {
if (t10.type === "Feature")
e(t10, 0);
else if (t10.type === "FeatureCollection")
for (var r = 0; r < t10.features.length && e(t10.features[r], r) !== false; r++)
;
}
so(oW, "featureEach");
function uQt(t10, e, r) {
var n = r;
return oW(t10, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(uQt, "featureReduce");
function hQt(t10) {
var e = [];
return xd(t10, function(r) {
e.push(r);
}), e;
}
so(hQt, "coordAll");
function xH(t10, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t10.type === "FeatureCollection", _ = t10.type === "Feature", L = y ? t10.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t10.features[r].geometry : _ ? t10.geometry : t10, d = y ? t10.features[r].properties : _ ? t10.properties : {}, T = y ? t10.features[r].bbox : _ ? t10.bbox : void 0, f = y ? t10.features[r].id : _ ? t10.id : void 0, u = a ? a.type === "GeometryCollection" : false, 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
) === false)
return false;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === false)
return false;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === false)
return false;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
so(xH, "geomEach");
function dQt(t10, e, r) {
var n = r;
return xH(
t10,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
so(dQt, "geomReduce");
function jg(t10, e) {
xH(t10, 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
) === false ? false : 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) === false)
return false;
}
});
}
so(jg, "flattenEach");
function pQt(t10, e, r) {
var n = r;
return jg(
t10,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
so(pQt, "flattenReduce");
function sW(t10, e) {
jg(t10, 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 (xd(
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 = Q4(
[a, f],
r.properties
);
if (e(
E,
n,
i,
L,
o
) === false)
return false;
o++, a = f;
}
) === false)
return false;
}
}
});
}
so(sW, "segmentEach");
function aW(t10, e, r) {
var n = r, i = false;
return sW(
t10,
function(o, s, a, u, d) {
i === false && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = true;
}
), n;
}
so(aW, "segmentReduce");
function lW(t10, e) {
if (!t10)
throw new Error("geojson is required");
jg(t10, 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) === false)
return false;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
Q4(s[a], r.properties),
n,
i,
a
) === false)
return false;
break;
}
}
});
}
so(lW, "lineEach");
function TQt(t10, e, r) {
var n = r;
return lW(
t10,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
so(TQt, "lineReduce");
function fQt(t10, e) {
if (e = e || {}, !wH(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 (t10.type) {
case "FeatureCollection":
r < 0 && (r = t10.features.length + r), s = s || t10.features[r].properties, a = t10.features[r].geometry;
break;
case "Feature":
s = s || t10.properties, a = t10.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t10;
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), Q4(
[u[o], u[o + 1]],
s,
e
);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o - 1), Q4(
[
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), Q4(
[
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), Q4(
[
u[n][i][o],
u[n][i][o + 1]
],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(fQt, "findSegment");
function QQt(t10, e) {
if (e = e || {}, !wH(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 (t10.type) {
case "FeatureCollection":
r < 0 && (r = t10.features.length + r), s = s || t10.features[r].properties, a = t10.features[r].geometry;
break;
case "Feature":
s = s || t10.properties, a = t10.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t10;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
return c4(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), c4(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), c4(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), c4(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), c4(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), c4(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(QQt, "findPoint");
var mQt = Object.defineProperty;
var gQt = (t10, e) => mQt(t10, "name", { value: e, configurable: true });
function cW(t10, e = {}) {
return aW(
t10,
(r, n) => {
const i = n.geometry.coordinates;
return r + g5(i[0], i[1], e);
},
0
);
}
gQt(cW, "length");
var mL = 1.3;
var Cf;
var kf;
var If;
var u9;
var yQt = class {
constructor(e) {
Ft(this, Cf, void 0), Ft(this, kf, ""), Ft(this, If, 0), Ft(this, u9, []), Yt(this, Cf, e);
}
get latestSource() {
return K(this, kf);
}
get knowledgeSchema() {
return K(this, If);
}
async initialise() {
try {
const e = await this.loadJSON("knowledge/schema-version");
if (e === void 0)
return;
"version" in e && Yt(this, If, +e.version);
const r = await this.loadJSON("knowledge/sources");
r && "sources" in r && (Yt(this, u9, r.sources), K(this, u9).length && Yt(this, kf, K(this, u9)[0]));
} catch {
}
}
url(e = "") {
return new URL(e, K(this, Cf)).href;
}
async loadJSON(e, r = false) {
const n = this.url(e);
try {
const i = await fetch(n, {
method: "GET",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store"
}
});
if (!i.ok) {
if (r)
return null;
throw new Error(`Cannot access ${n}`);
}
return await i.json();
} catch (i) {
throw i;
}
}
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;
}
}
};
Cf = /* @__PURE__ */ new WeakMap(), kf = /* @__PURE__ */ new WeakMap(), If = /* @__PURE__ */ new WeakMap(), u9 = /* @__PURE__ */ new WeakMap();
function vQt(t10, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
n.enumerable = n.enumerable || false, n.configurable = true, "value" in n && (n.writable = true), Object.defineProperty(t10, n.key, n);
}
}
function uW(t10, e, r) {
return e && vQt(t10.prototype, e), t10;
}
function _Qt(t10, e, r) {
return e in t10 ? Object.defineProperty(t10, e, {
value: r,
enumerable: true,
configurable: true,
writable: true
}) : t10[e] = r, t10;
}
function aR(t10, e) {
var r = Object.keys(t10);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t10);
e && (n = n.filter(function(i) {
return Object.getOwnPropertyDescriptor(t10, i).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function F1(t10) {
for (var e = 1; e < arguments.length; e++) {
var r = arguments[e] != null ? arguments[e] : {};
e % 2 ? aR(Object(r), true).forEach(function(n) {
_Qt(t10, n, r[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t10, Object.getOwnPropertyDescriptors(r)) : aR(Object(r)).forEach(function(n) {
Object.defineProperty(t10, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return t10;
}
function bQt(t10, e) {
if (t10) {
if (typeof t10 == "string")
return lR(t10, e);
var r = Object.prototype.toString.call(t10).slice(8, -1);
if (r === "Object" && t10.constructor && (r = t10.constructor.name), r === "Map" || r === "Set")
return Array.from(t10);
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
return lR(t10, e);
}
}
function lR(t10, e) {
(e == null || e > t10.length) && (e = t10.length);
for (var r = 0, n = new Array(e); r < e; r++)
n[r] = t10[r];
return n;
}
function hW(t10, e) {
var r;
if (typeof Symbol > "u" || t10[Symbol.iterator] == null) {
if (Array.isArray(t10) || (r = bQt(t10)) || e) {
r && (t10 = r);
var n = 0;
return function() {
return n >= t10.length ? {
done: true
} : {
done: false,
value: t10[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 = t10[Symbol.iterator](), r.next.bind(r);
}
var gL = function() {
function t10(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 = t10.prototype;
return e.next = function() {
var r = this.dive();
return this.backtrack(), r;
}, e.dive = function() {
if (this.path.length === 0)
return {
done: true
};
var r = y6(this.path), n = r.node, i = r.keys;
return y6(i) === $o ? {
done: false,
value: this.result()
} : (this.path.push({
node: n[y6(i)],
keys: Object.keys(n[y6(i)])
}), this.dive());
}, e.backtrack = function() {
this.path.length !== 0 && (y6(this.path).keys.pop(), !(y6(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 y6(n);
}).filter(function(r) {
return r !== $o;
}).join("");
}, e.value = function() {
return y6(this.path).node[$o];
}, e.result = function() {
return this.type === pW ? this.value() : this.type === dW ? this.key() : [this.key(), this.value()];
}, e[Symbol.iterator] = function() {
return this;
}, t10;
}();
var LQt = "ENTRIES";
var dW = "KEYS";
var pW = "VALUES";
var $o = "";
var y6 = function(t10) {
return t10[t10.length - 1];
};
var wQt = function(t10, e, r) {
for (var n = [{
distance: 0,
i: 0,
key: "",
node: t10
}], 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
xQt(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;
};
var xQt = function(t10, 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 (t10[d] === e[T])
o.push({
distance: u,
ia: d + 1,
ib: T + 1,
edit: EQt
});
else {
if (u >= r)
continue;
f !== yL && o.push({
distance: u + 1,
ia: d,
ib: T + 1,
edit: vL
}), d < t10.length && (f !== vL && o.push({
distance: u + 1,
ia: d + 1,
ib: T,
edit: yL
}), f !== vL && f !== yL && o.push({
distance: u + 1,
ia: d + 1,
ib: T + 1,
edit: MQt
}));
}
}
return s;
};
var EQt = 0;
var MQt = 1;
var yL = 2;
var vL = 3;
var n0 = function() {
function t10(r, n) {
r === void 0 && (r = {}), n === void 0 && (n = ""), this._tree = r, this._prefix = n;
}
var e = t10.prototype;
return e.atPrefix = function(r) {
if (!r.startsWith(this._prefix))
throw new Error("Mismatched prefix");
var n = TW(this._tree, r.slice(this._prefix.length)), i = n[0], o = n[1];
if (i === void 0) {
var s = EH(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 t10((T = {}, T[d.slice(u.length)] = a[d], T), r);
}
}
return new t10(i || {}, r);
}, e.clear = function() {
delete this._size, this._tree = {};
}, e.delete = function(r) {
return delete this._size, HQt(this._tree, r);
}, e.entries = function() {
return new gL(this, LQt);
}, e.forEach = function(r) {
for (var n = hW(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 wQt(this._tree, r, n);
}, e.get = function(r) {
var n = cR(this._tree, r);
return n !== void 0 ? n[$o] : void 0;
}, e.has = function(r) {
var n = cR(this._tree, r);
return n !== void 0 && n.hasOwnProperty($o);
}, e.keys = function() {
return new gL(this, dW);
}, e.set = function(r, n) {
if (typeof r != "string")
throw new Error("key must be a string");
delete this._size;
var i = uR(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 = uR(this._tree, r);
return i[$o] = n(i[$o]), this;
}, e.values = function() {
return new gL(this, pW);
}, e[Symbol.iterator] = function() {
return this.entries();
}, uW(t10, [{
key: "size",
get: function() {
var r = this;
return this._size ? this._size : (this._size = 0, this.forEach(function() {
r._size += 1;
}), this._size);
}
}]), t10;
}();
n0.from = function(t10) {
for (var e = new n0(), r = hW(t10), n; !(n = r()).done; ) {
var i = n.value, o = i[0], s = i[1];
e.set(o, s);
}
return e;
};
n0.fromObject = function(t10) {
return n0.from(Object.entries(t10));
};
var TW = function t3(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 ? t3(void 0, "", [].concat(n, [[e, r]])) : t3(e[i], r.slice(i.length), [].concat(n, [[e, i]]));
};
var cR = function t4(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 t4(e[n], r.slice(n.length));
};
var uR = function t5(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 = SQt(r, i);
return e[s] = (o = {}, o[i.slice(s.length)] = e[i], o), delete e[i], t5(e[s], r.slice(s.length));
}
return e[r];
}
return t5(e[n], r.slice(n.length));
};
var SQt = function t6(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 : t6(e, r, n + 1, i, o + e[n]);
};
var HQt = function(t10, e) {
var r = TW(t10, e), n = r[0], i = r[1];
if (n !== void 0) {
delete n[$o];
var o = Object.keys(n);
o.length === 0 && AQt(i), o.length === 1 && OQt(i, o[0], n[o[0]]);
}
};
var AQt = function t8(e) {
if (e.length !== 0) {
var r = EH(e), n = r[0], i = r[1];
delete n[i], Object.keys(n).length === 0 && t8(e.slice(0, -1));
}
};
var OQt = function(t10, e, r) {
if (t10.length !== 0) {
var n = EH(t10), i = n[0], o = n[1];
i[o + e] = r, delete i[o];
}
};
var EH = function(t10) {
return t10[t10.length - 1];
};
var pT;
var sm = "or";
var CQt = "and";
var fW = function() {
function t10(r) {
r === void 0 && (r = {}), this._options = F1(F1({}, LL), r), this._options.searchOptions = F1(F1({}, zQt), this._options.searchOptions || {});
var n = this._options.fields;
if (n == null)
throw new Error('MiniSearch: option "fields" must be provided');
this._index = new n0(), this._documentCount = 0, this._documentIds = {}, this._fieldIds = {}, this._fieldLength = {}, this._averageFieldLength = {}, this._nextId = 0, this._storedFields = {}, VQt(this, n);
}
var e = t10.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 = PQt(this, T);
NQt(this, f, r), u.forEach(function(Q) {
var y = o(r, Q);
if (y != null) {
var _ = s(y.toString(), Q);
RQt(n, f, n._fieldIds[Q], n.documentCount - 1, _.length), _.forEach(function(L) {
var E = a(L, Q);
bL(E) && kQt(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);
bL(x) && IQt(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 n0(), 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(bL).map(BQt(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: jQt(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({}, UQt), 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;
});
}, t10.loadJSON = function(r, n) {
if (n == null)
throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
return t10.loadJS(JSON.parse(r), n);
}, t10.getDefault = function(r) {
if (LL.hasOwnProperty(r))
return LL[r];
throw new Error('MiniSearch: unknown option "' + r + '"');
}, t10.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 t10(n);
return Q._index = new n0(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] = QW(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 = _L(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(_L(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(_L(i, x, o, a, k, T, F));
});
}
return _.reduce(dR[sm], {});
}, e.combineResults = function(r, n) {
if (n === void 0 && (n = sm), r.length === 0)
return {};
var i = n.toLowerCase();
return r.reduce(dR[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
};
}, uW(t10, [{
key: "documentCount",
get: function() {
return this._documentCount;
}
}]), t10;
}();
fW.SearchableMap = n0;
var kQt = function(t10, e, r, n) {
t10._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));
});
};
var IQt = function(t10, e, r, n) {
if (!t10._index.has(n)) {
hR(t10, r, e, n);
return;
}
t10._index.update(n, function(i) {
var o, s = i[e];
if (s == null || s.ds[r] == null)
return hR(t10, 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(t10._index.get(n)).length === 0 && t10._index.delete(n);
};
var hR = function(t10, e, r, n) {
if (!(console == null || console.warn == null)) {
var i = Object.entries(t10._fieldIds).find(function(o) {
o[0];
var s = o[1];
return s === r;
})[0];
console.warn("MiniSearch: document with ID " + t10._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!');
}
};
var PQt = function(t10, e) {
var r = t10._nextId.toString(36);
return t10._documentIds[r] = e, t10._documentCount += 1, t10._nextId += 1, r;
};
var VQt = function(t10, e) {
e.forEach(function(r, n) {
t10._fieldIds[r] = n;
});
};
var _L = function(t10, 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 = t10._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(t10._documentIds[E], e) : 1;
if (O) {
var k = t10._fieldLength[E][f] / t10._averageFieldLength[f];
a[E] = a[E] || {
score: 0,
match: {},
terms: []
}, a[E].terms.push(e), a[E].match[e] = QW(a[E].match, e) || [], a[E].score += O * FQt(x, y, t10._documentCount, k, T, s), a[E].match[e].push(d);
}
}), a;
}, {});
};
var QW = function(t10, e) {
return Object.prototype.hasOwnProperty.call(t10, e) ? t10[e] : void 0;
};
var RQt = function(t10, e, r, n, i) {
t10._averageFieldLength[r] = t10._averageFieldLength[r] || 0;
var o = t10._averageFieldLength[r] * n + i;
t10._fieldLength[e] = t10._fieldLength[e] || {}, t10._fieldLength[e][r] = i, t10._averageFieldLength[r] = o / (n + 1);
};
var NQt = function(t10, e, r) {
var n = t10._options, i = n.storeFields, o = n.extractField;
i == null || i.length === 0 || (t10._storedFields[e] = t10._storedFields[e] || {}, i.forEach(function(s) {
var a = o(r, s);
a !== void 0 && (t10._storedFields[e][s] = a);
}));
};
var dR = (pT = {}, pT[sm] = function(t10, 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;
}, t10 || {});
}, pT[CQt] = function(t10, e) {
return t10 == 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 t10[i] === void 0 || (r[i] = r[i] || {}, r[i].score = t10[i].score + s, r[i].match = F1(F1({}, t10[i].match), a), r[i].terms = [].concat(t10[i].terms, u)), r;
}, {});
}, pT);
var DQt = function(t10, e, r) {
return t10 * Math.log(r / e);
};
var FQt = function(t10, e, r, n, i, o) {
var s = i / (1 + 0.333 * i * o);
return s * DQt(t10, e, r) / n;
};
var BQt = function(t10) {
return function(e, r, n) {
var i = typeof t10.fuzzy == "function" ? t10.fuzzy(e, r, n) : t10.fuzzy, o = typeof t10.prefix == "function" ? t10.prefix(e, r, n) : t10.prefix;
return {
term: e,
fuzzy: i,
prefix: o
};
};
};
var jQt = function(t10) {
return t10.filter(function(e, r, n) {
return n.indexOf(e) === r;
});
};
var bL = function(t10) {
return !!t10;
};
var LL = {
idField: "id",
extractField: function(t10, e) {
return t10[e];
},
tokenize: function(t10, e) {
return t10.split(GQt);
},
processTerm: function(t10, e) {
return t10.toLowerCase();
},
fields: void 0,
searchOptions: void 0,
storeFields: []
};
var zQt = {
combineWith: sm,
prefix: false,
fuzzy: false,
weights: {}
};
var UQt = {
prefix: function(t10, e, r) {
return e === r.length - 1;
}
};
var GQt = /[\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]+/;
var mW = [
"id",
"label",
"models",
"source"
];
var h9;
var o5;
var $Qt = class {
constructor() {
Ft(this, h9, []), Ft(this, o5, void 0), Yt(this, o5, new fW({
fields: ["text"],
storeFields: ["text"],
tokenize: (e, r) => e.split(" ")
}));
}
indexMetadata(e, r) {
const n = [];
for (const i of mW)
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, o5).add({
id: K(this, h9).length,
text: r
}), K(this, h9).push(e));
}
auto_suggest(e) {
return K(this, o5).autoSuggest(e, { prefix: true });
}
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, o5).search(e, { prefix: true, combineWith: "AND" })) : e.length > 1 && (r = K(this, o5).search(e, { prefix: true }));
const n = r.map((i) => ({
featureId: K(this, h9)[i.id],
score: i.score,
terms: i.terms,
text: i.text
}));
return new WQt(n);
}
};
h9 = /* @__PURE__ */ new WeakMap(), o5 = /* @__PURE__ */ new WeakMap();
var Pf;
var Vf;
var WQt = class {
constructor(e) {
Ft(this, Pf, void 0), Ft(this, Vf, void 0), Yt(this, Vf, e.sort((r, n) => n.score - r.score)), Yt(this, Pf, e.map((r) => r.featureId));
}
get featureIds() {
return K(this, Pf);
}
get results() {
return K(this, Vf);
}
};
Pf = /* @__PURE__ */ new WeakMap(), Vf = /* @__PURE__ */ new WeakMap();
function MH(t10, e, r) {
if (t10 !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t10.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t10.features.length : 1, x = 0; x < E; x++) {
d = _ ? t10.features[x].geometry : L ? t10.geometry : t10, Q = d ? d.type === "GeometryCollection" : false, 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
) === false)
return false;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === false)
return false;
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
) === false)
return false;
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
) === false)
return false;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (MH(s.geometries[n], e) === false)
return false;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
function ZQt(t10, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t10.type === "FeatureCollection", _ = t10.type === "Feature", L = y ? t10.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t10.features[r].geometry : _ ? t10.geometry : t10, d = y ? t10.features[r].properties : _ ? t10.properties : {}, T = y ? t10.features[r].bbox : _ ? t10.bbox : void 0, f = y ? t10.features[r].id : _ ? t10.id : void 0, u = a ? a.type === "GeometryCollection" : false, 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
) === false)
return false;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === false)
return false;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === false)
return false;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
function qQt(t10, e, r) {
var n = r;
return ZQt(
t10,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
var pR = 6378137;
function XQt(t10) {
return qQt(t10, function(e, r) {
return e + KQt(r);
}, 0);
}
function KQt(t10) {
var e = 0, r;
switch (t10.type) {
case "Polygon":
return TR(t10.coordinates);
case "MultiPolygon":
for (r = 0; r < t10.coordinates.length; r++)
e += TR(t10.coordinates[r]);
return e;
case "Point":
case "MultiPoint":
case "LineString":
case "MultiLineString":
return 0;
}
return 0;
}
function TR(t10) {
var e = 0;
if (t10 && t10.length > 0) {
e += Math.abs(fR(t10[0]));
for (var r = 1; r < t10.length; r++)
e -= Math.abs(fR(t10[r]));
}
return e;
}
function fR(t10) {
var e, r, n, i, o, s, a, u = 0, d = t10.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 = t10[i], r = t10[o], n = t10[s], u += (wL(n[0]) - wL(e[0])) * Math.sin(wL(r[1]));
u = u * pR * pR / 2;
}
return u;
}
function wL(t10) {
return t10 * Math.PI / 180;
}
function YQt(t10) {
return t10 % (2 * Math.PI) * 180 / Math.PI;
}
function TT(t10) {
return t10 % 360 * Math.PI / 180;
}
function QR(t10) {
if (!t10)
throw new Error("coord is required");
if (!Array.isArray(t10)) {
if (t10.type === "Feature" && t10.geometry !== null && t10.geometry.type === "Point")
return [...t10.geometry.coordinates];
if (t10.type === "Point")
return [...t10.coordinates];
}
if (Array.isArray(t10) && t10.length >= 2 && !Array.isArray(t10[0]) && !Array.isArray(t10[1]))
return [...t10];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function SH(t10, e, r = {}) {
if (r.final === true)
return JQt(t10, e);
const n = QR(t10), i = QR(e), o = TT(n[0]), s = TT(i[0]), a = TT(n[1]), u = TT(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 YQt(Math.atan2(d, T));
}
function JQt(t10, e) {
let r = SH(e, t10);
return r = (r + 180) % 360, r;
}
var F2 = 63710088e-1;
var tmt = {
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 emt(t10, 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 = t10, n;
}
function rmt(t10, e, r = {}) {
if (!t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!gR(t10[0]) || !gR(t10[1]))
throw new Error("coordinates must contain numbers");
return emt({
type: "Point",
coordinates: t10
}, e, r);
}
function nmt(t10, e = "kilometers") {
const r = tmt[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 / r;
}
function mR(t10) {
return t10 % (2 * Math.PI) * 180 / Math.PI;
}
function xL(t10) {
return t10 % 360 * Math.PI / 180;
}
function gR(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
function imt(t10) {
if (!t10)
throw new Error("coord is required");
if (!Array.isArray(t10)) {
if (t10.type === "Feature" && t10.geometry !== null && t10.geometry.type === "Point")
return [...t10.geometry.coordinates];
if (t10.type === "Point")
return [...t10.coordinates];
}
if (Array.isArray(t10) && t10.length >= 2 && !Array.isArray(t10[0]) && !Array.isArray(t10[1]))
return [...t10];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function iE(t10, e, r, n = {}) {
const i = imt(t10), o = xL(i[0]), s = xL(i[1]), a = xL(r), u = nmt(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 = mR(T), Q = mR(d);
return rmt([f, Q], n.properties);
}
function omt(t10, 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 = t10, n;
}
function yR(t10, e, r = {}) {
if (!t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!vR(t10[0]) || !vR(t10[1]))
throw new Error("coordinates must contain numbers");
return omt({
type: "Point",
coordinates: t10
}, e, r);
}
function vR(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
function smt(t10) {
return t10.type === "Feature" ? t10.geometry : t10;
}
function amt(t10, e, r = {}) {
const n = smt(t10).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 = SH(n[o], n[o - 1]) - 180;
return iE(
n[o],
s,
a,
r
);
} else
return yR(n[o]);
} else
i += g5(n[o], n[o + 1], r);
return yR(n[n.length - 1]);
}
var lmt = amt;
function oE(t10) {
var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
return MH(t10, function(r) {
e[0] > r[0] && (e[0] = r[0]), e[1] > r[1] && (e[1] = r[1]), e[2] < r[0] && (e[2] = r[0]), e[3] < r[1] && (e[3] = r[1]);
}), e;
}
oE.default = oE;
var cmt = Object.defineProperty;
var Wn = (t10, e) => cmt(t10, "name", { value: e, configurable: true });
var umt = class {
constructor(t10) {
this.direction = false, this.compareProperties = true;
var e, r, n;
this.precision = 10 ** -((e = t10 == null ? void 0 : t10.precision) != null ? e : 17), this.direction = (r = t10 == null ? void 0 : t10.direction) != null ? r : false, this.compareProperties = (n = t10 == null ? void 0 : t10.compareProperties) != null ? n : true;
}
compare(t10, e) {
if (t10.type !== e.type || !d9(t10, e))
return false;
switch (t10.type) {
case "Point":
return this.compareCoord(t10.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t10.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t10, e);
case "GeometryCollection":
return this.compareGeometryCollection(t10, e);
case "Feature":
return this.compareFeature(t10, e);
case "FeatureCollection":
return this.compareFeatureCollection(t10, e);
default:
if (t10.type.startsWith("Multi")) {
const r = sE(t10), n = sE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return false;
}
compareCoord(t10, e) {
return t10.length === e.length && t10.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t10, e, r = 0, n = false) {
if (!d9(t10, e))
return false;
const i = t10;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return false;
}
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) : false;
}
fixStartIndex(t10, e) {
let r, n = -1;
for (let i = 0; i < t10.length; i++)
if (this.compareCoord(t10[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t10.slice(n, t10.length),
t10.slice(1, n + 1)
)), r;
}
comparePath(t10, e) {
return t10.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t10, e) {
if (this.compareLine(t10.coordinates[0], e.coordinates[0], 1, true)) {
const r = t10.coordinates.slice(1, t10.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, true))
);
}
return false;
}
compareGeometryCollection(t10, e) {
return d9(t10.geometries, e.geometries) && this.compareBBox(t10, e) && t10.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t10, e) {
return t10.id === e.id && (this.compareProperties ? _H(t10.properties, e.properties) : true) && this.compareBBox(t10, e) && this.compare(t10.geometry, e.geometry);
}
compareFeatureCollection(t10, e) {
return d9(t10.features, e.features) && this.compareBBox(t10, e) && t10.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t10, e) {
return !t10.bbox && !e.bbox || (t10.bbox && e.bbox ? this.compareCoord(t10.bbox, e.bbox) : false);
}
};
Wn(umt, "GeojsonEquality");
function d9(t10, e) {
return t10.coordinates ? t10.coordinates.length === e.coordinates.length : t10.length === e.length;
}
Wn(d9, "sameLength");
function sE(t10) {
return t10.coordinates.map((e) => ({
type: t10.type.replace("Multi", ""),
coordinates: e
}));
}
Wn(sE, "explode");
var B2 = 63710088e-1;
var gW = {
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
};
var _R = {
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(t10, 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 = t10, n;
}
Wn(f3, "feature");
function hmt(t10, e, r = {}) {
switch (t10) {
case "Point":
return zg(e).geometry;
case "LineString":
return AH(e).geometry;
case "Polygon":
return HH(e).geometry;
case "MultiPoint":
return vW(e).geometry;
case "MultiLineString":
return yW(e).geometry;
case "MultiPolygon":
return _W(e).geometry;
default:
throw new Error(t10 + " is invalid");
}
}
Wn(hmt, "geometry");
function zg(t10, e, r = {}) {
if (!t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!am(t10[0]) || !am(t10[1]))
throw new Error("coordinates must contain numbers");
return f3({
type: "Point",
coordinates: t10
}, e, r);
}
Wn(zg, "point");
function dmt(t10, e, r = {}) {
return C8(
t10.map((n) => zg(n, e)),
r
);
}
Wn(dmt, "points");
function HH(t10, e, r = {}) {
for (const n of t10) {
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: t10
}, e, r);
}
Wn(HH, "polygon");
function pmt(t10, e, r = {}) {
return C8(
t10.map((n) => HH(n, e)),
r
);
}
Wn(pmt, "polygons");
function AH(t10, e, r = {}) {
if (t10.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return f3({
type: "LineString",
coordinates: t10
}, e, r);
}
Wn(AH, "lineString");
function Tmt(t10, e, r = {}) {
return C8(
t10.map((n) => AH(n, e)),
r
);
}
Wn(Tmt, "lineStrings");
function C8(t10, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t10, r;
}
Wn(C8, "featureCollection");
function yW(t10, e, r = {}) {
return f3({
type: "MultiLineString",
coordinates: t10
}, e, r);
}
Wn(yW, "multiLineString");
function vW(t10, e, r = {}) {
return f3({
type: "MultiPoint",
coordinates: t10
}, e, r);
}
Wn(vW, "multiPoint");
function _W(t10, e, r = {}) {
return f3({
type: "MultiPolygon",
coordinates: t10
}, e, r);
}
Wn(_W, "multiPolygon");
function fmt(t10, e, r = {}) {
return f3({
type: "GeometryCollection",
geometries: t10
}, e, r);
}
Wn(fmt, "geometryCollection");
function Qmt(t10, 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(t10 * r) / r;
}
Wn(Qmt, "round");
function bW(t10, e = "kilometers") {
const r = gW[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 * r;
}
Wn(bW, "radiansToLength");
function OH(t10, e = "kilometers") {
const r = gW[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 / r;
}
Wn(OH, "lengthToRadians");
function mmt(t10, e) {
return LW(OH(t10, e));
}
Wn(mmt, "lengthToDegrees");
function gmt(t10) {
let e = t10 % 360;
return e < 0 && (e += 360), e;
}
Wn(gmt, "bearingToAzimuth");
function LW(t10) {
return t10 % (2 * Math.PI) * 180 / Math.PI;
}
Wn(LW, "radiansToDegrees");
function ymt(t10) {
return t10 % 360 * Math.PI / 180;
}
Wn(ymt, "degreesToRadians");
function vmt(t10, e = "kilometers", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("length must be a positive number");
return bW(OH(t10, e), r);
}
Wn(vmt, "convertLength");
function _mt(t10, e = "meters", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("area must be a positive number");
const n = _R[e];
if (!n)
throw new Error("invalid original units");
const i = _R[r];
if (!i)
throw new Error("invalid final units");
return t10 / n * i;
}
Wn(_mt, "convertArea");
function am(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
Wn(am, "isNumber");
function bmt(t10) {
return t10 !== null && typeof t10 == "object" && !Array.isArray(t10);
}
Wn(bmt, "isObject");
function Lmt(t10) {
if (!t10)
throw new Error("bbox is required");
if (!Array.isArray(t10))
throw new Error("bbox must be an Array");
if (t10.length !== 4 && t10.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t10.forEach((e) => {
if (!am(e))
throw new Error("bbox must only contain numbers");
});
}
Wn(Lmt, "validateBBox");
function wmt(t10) {
if (!t10)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t10) === -1)
throw new Error("id must be a number or a string");
}
Wn(wmt, "validateId");
var wW = class {
constructor(t10 = [], e = xmt) {
if (this.data = t10, 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(t10) {
this.data.push(t10), this.length++, this._up(this.length - 1);
}
pop() {
if (this.length === 0)
return;
const t10 = this.data[0], e = this.data.pop();
return this.length--, this.length > 0 && (this.data[0] = e, this._down(0)), t10;
}
peek() {
return this.data[0];
}
_up(t10) {
const { data: e, compare: r } = this, n = e[t10];
for (; t10 > 0; ) {
const i = t10 - 1 >> 1, o = e[i];
if (r(n, o) >= 0)
break;
e[t10] = o, t10 = i;
}
e[t10] = n;
}
_down(t10) {
const { data: e, compare: r } = this, n = this.length >> 1, i = e[t10];
for (; t10 < n; ) {
let o = (t10 << 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[t10] = s, t10 = o;
}
e[t10] = i;
}
};
function xmt(t10, e) {
return t10 < e ? -1 : t10 > e ? 1 : 0;
}
function xW(t10, e) {
return t10.p.x > e.p.x ? 1 : t10.p.x < e.p.x ? -1 : t10.p.y !== e.p.y ? t10.p.y > e.p.y ? 1 : -1 : 1;
}
function Emt(t10, e) {
return t10.rightSweepEvent.p.x > e.rightSweepEvent.p.x ? 1 : t10.rightSweepEvent.p.x < e.rightSweepEvent.p.x ? -1 : t10.rightSweepEvent.p.y !== e.rightSweepEvent.p.y ? t10.rightSweepEvent.p.y < e.rightSweepEvent.p.y ? 1 : -1 : 1;
}
var bR = class {
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 Mmt(t10, e) {
if (t10.type === "FeatureCollection") {
const r = t10.features;
for (let n = 0; n < r.length; n++)
LR(r[n], e);
} else
LR(t10, e);
}
var fT = 0;
var QT = 0;
var mT = 0;
function LR(t10, e) {
const r = t10.type === "Feature" ? t10.geometry : t10;
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;
QT = QT + 1;
for (let u = 0; u < n[i][o].length - 1; u++) {
a = n[i][o][u + 1];
const d = new bR(s, fT, QT, mT), T = new bR(a, fT, QT, mT + 1);
d.otherEvent = T, T.otherEvent = d, xW(d, T) > 0 ? (T.isLeftEndpoint = true, d.isLeftEndpoint = false) : (d.isLeftEndpoint = true, T.isLeftEndpoint = false), e.push(d), e.push(T), s = a, mT = mT + 1;
}
}
fT = fT + 1;
}
var Smt = class {
constructor(e) {
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
}
};
function Hmt(t10, e) {
if (t10 === null || e === null || t10.leftSweepEvent.ringId === e.leftSweepEvent.ringId && (t10.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t10.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t10.rightSweepEvent.isSamePoint(e.rightSweepEvent) || t10.leftSweepEvent.isSamePoint(e.leftSweepEvent) || t10.leftSweepEvent.isSamePoint(e.rightSweepEvent)))
return false;
const r = t10.leftSweepEvent.p.x, n = t10.leftSweepEvent.p.y, i = t10.rightSweepEvent.p.x, o = t10.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 false;
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 false;
}
function Amt(t10, e) {
e = e || false;
const r = [], n = new wW([], Emt);
for (; t10.length; ) {
const i = t10.pop();
if (i.isLeftEndpoint) {
const o = new Smt(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 = Hmt(o, a);
u !== false && r.push(u);
}
n.push(o);
} else
i.isLeftEndpoint === false && n.pop();
}
return r;
}
function Omt(t10, e) {
const r = new wW([], xW);
return Mmt(t10, r), Amt(r, e);
}
var Cmt = Object.defineProperty;
var kmt = (t10, e) => Cmt(t10, "name", { value: e, configurable: true });
var Imt = Omt;
function EW(t10, e, r = {}) {
const { removeDuplicates: n = true, ignoreSelfIntersections: i = false } = r;
let o = [];
t10.type === "FeatureCollection" ? o = o.concat(t10.features) : t10.type === "Feature" ? o.push(t10) : (t10.type === "LineString" || t10.type === "Polygon" || t10.type === "MultiLineString" || t10.type === "MultiPolygon") && o.push(f3(t10)), 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 = Imt(
C8(o),
i
);
let a = [];
if (n) {
const u = {};
s.forEach((d) => {
const T = d.join(",");
u[T] || (u[T] = true, a.push(d));
});
} else
a = s;
return C8(a.map((u) => zg(u)));
}
kmt(EW, "lineIntersect");
var Pmt = Object.defineProperty;
var Zn = (t10, e) => Pmt(t10, "name", { value: e, configurable: true });
var Vmt = class {
constructor(t10) {
this.direction = false, this.compareProperties = true;
var e, r, n;
this.precision = 10 ** -((e = t10 == null ? void 0 : t10.precision) != null ? e : 17), this.direction = (r = t10 == null ? void 0 : t10.direction) != null ? r : false, this.compareProperties = (n = t10 == null ? void 0 : t10.compareProperties) != null ? n : true;
}
compare(t10, e) {
if (t10.type !== e.type || !p9(t10, e))
return false;
switch (t10.type) {
case "Point":
return this.compareCoord(t10.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t10.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t10, e);
case "GeometryCollection":
return this.compareGeometryCollection(t10, e);
case "Feature":
return this.compareFeature(t10, e);
case "FeatureCollection":
return this.compareFeatureCollection(t10, e);
default:
if (t10.type.startsWith("Multi")) {
const r = aE(t10), n = aE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return false;
}
compareCoord(t10, e) {
return t10.length === e.length && t10.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t10, e, r = 0, n = false) {
if (!p9(t10, e))
return false;
const i = t10;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return false;
}
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) : false;
}
fixStartIndex(t10, e) {
let r, n = -1;
for (let i = 0; i < t10.length; i++)
if (this.compareCoord(t10[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t10.slice(n, t10.length),
t10.slice(1, n + 1)
)), r;
}
comparePath(t10, e) {
return t10.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t10, e) {
if (this.compareLine(t10.coordinates[0], e.coordinates[0], 1, true)) {
const r = t10.coordinates.slice(1, t10.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, true))
);
}
return false;
}
compareGeometryCollection(t10, e) {
return p9(t10.geometries, e.geometries) && this.compareBBox(t10, e) && t10.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t10, e) {
return t10.id === e.id && (this.compareProperties ? _H(t10.properties, e.properties) : true) && this.compareBBox(t10, e) && this.compare(t10.geometry, e.geometry);
}
compareFeatureCollection(t10, e) {
return p9(t10.features, e.features) && this.compareBBox(t10, e) && t10.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t10, e) {
return !t10.bbox && !e.bbox || (t10.bbox && e.bbox ? this.compareCoord(t10.bbox, e.bbox) : false);
}
};
Zn(Vmt, "GeojsonEquality");
function p9(t10, e) {
return t10.coordinates ? t10.coordinates.length === e.coordinates.length : t10.length === e.length;
}
Zn(p9, "sameLength");
function aE(t10) {
return t10.coordinates.map((e) => ({
type: t10.type.replace("Multi", ""),
coordinates: e
}));
}
Zn(aE, "explode");
var j2 = 63710088e-1;
var MW = {
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
};
var wR = {
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(t10, 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 = t10, n;
}
Zn(Q3, "feature");
function Rmt(t10, e, r = {}) {
switch (t10) {
case "Point":
return Es(e).geometry;
case "LineString":
return ra(e).geometry;
case "Polygon":
return CH(e).geometry;
case "MultiPoint":
return HW(e).geometry;
case "MultiLineString":
return SW(e).geometry;
case "MultiPolygon":
return AW(e).geometry;
default:
throw new Error(t10 + " is invalid");
}
}
Zn(Rmt, "geometry");
function Es(t10, e, r = {}) {
if (!t10)
throw new Error("coordinates is required");
if (!Array.isArray(t10))
throw new Error("coordinates must be an Array");
if (t10.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!k8(t10[0]) || !k8(t10[1]))
throw new Error("coordinates must contain numbers");
return Q3({
type: "Point",
coordinates: t10
}, e, r);
}
Zn(Es, "point");
function Nmt(t10, e, r = {}) {
return Ug(
t10.map((n) => Es(n, e)),
r
);
}
Zn(Nmt, "points");
function CH(t10, e, r = {}) {
for (const n of t10) {
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: t10
}, e, r);
}
Zn(CH, "polygon");
function Dmt(t10, e, r = {}) {
return Ug(
t10.map((n) => CH(n, e)),
r
);
}
Zn(Dmt, "polygons");
function ra(t10, e, r = {}) {
if (t10.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return Q3({
type: "LineString",
coordinates: t10
}, e, r);
}
Zn(ra, "lineString");
function Fmt(t10, e, r = {}) {
return Ug(
t10.map((n) => ra(n, e)),
r
);
}
Zn(Fmt, "lineStrings");
function Ug(t10, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t10, r;
}
Zn(Ug, "featureCollection");
function SW(t10, e, r = {}) {
return Q3({
type: "MultiLineString",
coordinates: t10
}, e, r);
}
Zn(SW, "multiLineString");
function HW(t10, e, r = {}) {
return Q3({
type: "MultiPoint",
coordinates: t10
}, e, r);
}
Zn(HW, "multiPoint");
function AW(t10, e, r = {}) {
return Q3({
type: "MultiPolygon",
coordinates: t10
}, e, r);
}
Zn(AW, "multiPolygon");
function Bmt(t10, e, r = {}) {
return Q3({
type: "GeometryCollection",
geometries: t10
}, e, r);
}
Zn(Bmt, "geometryCollection");
function jmt(t10, 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(t10 * r) / r;
}
Zn(jmt, "round");
function OW(t10, e = "kilometers") {
const r = MW[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 * r;
}
Zn(OW, "radiansToLength");
function kH(t10, e = "kilometers") {
const r = MW[e];
if (!r)
throw new Error(e + " units is invalid");
return t10 / r;
}
Zn(kH, "lengthToRadians");
function zmt(t10, e) {
return CW(kH(t10, e));
}
Zn(zmt, "lengthToDegrees");
function Umt(t10) {
let e = t10 % 360;
return e < 0 && (e += 360), e;
}
Zn(Umt, "bearingToAzimuth");
function CW(t10) {
return t10 % (2 * Math.PI) * 180 / Math.PI;
}
Zn(CW, "radiansToDegrees");
function Gmt(t10) {
return t10 % 360 * Math.PI / 180;
}
Zn(Gmt, "degreesToRadians");
function $mt(t10, e = "kilometers", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("length must be a positive number");
return OW(kH(t10, e), r);
}
Zn($mt, "convertLength");
function Wmt(t10, e = "meters", r = "kilometers") {
if (!(t10 >= 0))
throw new Error("area must be a positive number");
const n = wR[e];
if (!n)
throw new Error("invalid original units");
const i = wR[r];
if (!i)
throw new Error("invalid final units");
return t10 / n * i;
}
Zn(Wmt, "convertArea");
function k8(t10) {
return !isNaN(t10) && t10 !== null && !Array.isArray(t10);
}
Zn(k8, "isNumber");
function IH(t10) {
return t10 !== null && typeof t10 == "object" && !Array.isArray(t10);
}
Zn(IH, "isObject");
function Zmt(t10) {
if (!t10)
throw new Error("bbox is required");
if (!Array.isArray(t10))
throw new Error("bbox must be an Array");
if (t10.length !== 4 && t10.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t10.forEach((e) => {
if (!k8(e))
throw new Error("bbox must only contain numbers");
});
}
Zn(Zmt, "validateBBox");
function qmt(t10) {
if (!t10)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t10) === -1)
throw new Error("id must be a number or a string");
}
Zn(qmt, "validateId");
var Xmt = Object.defineProperty;
var ao = (t10, e) => Xmt(t10, "name", { value: e, configurable: true });
function Ed(t10, e, r) {
if (t10 !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t10.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t10.features.length : 1, x = 0; x < E; x++) {
d = _ ? t10.features[x].geometry : L ? t10.geometry : t10, Q = d ? d.type === "GeometryCollection" : false, 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
) === false)
return false;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === false)
return false;
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
) === false)
return false;
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
) === false)
return false;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (Ed(s.geometries[n], e, r) === false)
return false;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
ao(Ed, "coordEach");
function Kmt(t10, e, r, n) {
var i = r;
return Ed(
t10,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
ao(Kmt, "coordReduce");
function kW(t10, e) {
var r;
switch (t10.type) {
case "FeatureCollection":
for (r = 0; r < t10.features.length && e(t10.features[r].properties, r) !== false; r++)
;
break;
case "Feature":
e(t10.properties, 0);
break;
}
}
ao(kW, "propEach");
function Ymt(t10, e, r) {
var n = r;
return kW(t10, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Ymt, "propReduce");
function IW(t10, e) {
if (t10.type === "Feature")
e(t10, 0);
else if (t10.type === "FeatureCollection")
for (var r = 0; r < t10.features.length && e(t10.features[r], r) !== false; r++)
;
}
ao(IW, "featureEach");
function Jmt(t10, e, r) {
var n = r;
return IW(t10, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Jmt, "featureReduce");
function tgt(t10) {
var e = [];
return Ed(t10, function(r) {
e.push(r);
}), e;
}
ao(tgt, "coordAll");
function PH(t10, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t10.type === "FeatureCollection", _ = t10.type === "Feature", L = y ? t10.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t10.features[r].geometry : _ ? t10.geometry : t10, d = y ? t10.features[r].properties : _ ? t10.properties : {}, T = y ? t10.features[r].bbox : _ ? t10.bbox : void 0, f = y ? t10.features[r].id : _ ? t10.id : void 0, u = a ? a.type === "GeometryCollection" : false, 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
) === false)
return false;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === false)
return false;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === false)
return false;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
ao(PH, "geomEach");
function egt(t10, e, r) {
var n = r;
return PH(
t10,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
ao(egt, "geomReduce");
function Md(t10, e) {
PH(t10, 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
) === false ? false : 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) === false)
return false;
}
});
}
ao(Md, "flattenEach");
function rgt(t10, e, r) {
var n = r;
return Md(
t10,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
ao(rgt, "flattenReduce");
function PW(t10, e) {
Md(t10, 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 (Ed(
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
) === false)
return false;
o++, a = f;
}
) === false)
return false;
}
}
});
}
ao(PW, "segmentEach");
function ngt(t10, e, r) {
var n = r, i = false;
return PW(
t10,
function(o, s, a, u, d) {
i === false && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = true;
}
), n;
}
ao(ngt, "segmentReduce");
function VW(t10, e) {
if (!t10)
throw new Error("geojson is required");
Md(t10, 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) === false)
return false;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
ra(s[a], r.properties),
n,
i,
a
) === false)
return false;
break;
}
}
});
}
ao(VW, "lineEach");
function igt(t10, e, r) {
var n = r;
return VW(
t10,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
ao(igt, "lineReduce");
function ogt(t10, e) {
if (e = e || {}, !IH(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 (t10.type) {
case "FeatureCollection":
r < 0 && (r = t10.features.length + r), s = s || t10.features[r].properties, a = t10.features[r].geometry;
break;
case "Feature":
s = s || t10.properties, a = t10.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t10;
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(ogt, "findSegment");
function sgt(t10, e) {
if (e = e || {}, !IH(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 (t10.type) {
case "FeatureCollection":
r < 0 && (r = t10.features.length + r), s = s || t10.features[r].properties, a = t10.features[r].geometry;
break;
case "Feature":
s = s || t10.properties, a = t10.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t10;
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(sgt, "findPoint");
var agt = Object.defineProperty;
var m0 = (t10, e) => agt(t10, "name", { value: e, configurable: true });
function lgt(t10) {
if (!t10)
throw new Error("coord is required");
if (!Array.isArray(t10)) {
if (t10.type === "Feature" && t10.geometry !== null && t10.geometry.type === "Point")
return [...t10.geometry.coordinates];
if (t10.type === "Point")
return [...t10.coordinates];
}
if (Array.isArray(t10) && t10.length >= 2 && !Array.isArray(t10[0]) && !Array.isArray(t10[1]))
return [...t10];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
m0(lgt, "getCoord");
function RW(t10) {
if (Array.isArray(t10))
return t10;
if (t10.type === "Feature") {
if (t10.geometry !== null)
return t10.geometry.coordinates;
} else if (t10.coordinates)
return t10.coordinates;
throw new Error(
"coords must be GeoJSON Feature, Geometry Object or an Array"
);
}
m0(RW, "getCoords");
function NW(t10) {
if (t10.length > 1 && k8(t10[0]) && k8(t10[1]))
return true;
if (Array.isArray(t10[0]) && t10[0].length)
return NW(t10[0]);
throw new Error("coordinates must only contain numbers");
}
m0(NW, "containsNumber");
function cgt(t10, e, r) {
if (!e || !r)
throw new Error("type and name required");
if (!t10 || t10.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t10.type
);
}
m0(cgt, "geojsonType");
function ugt(t10, e, r) {
if (!t10)
throw new Error("No feature passed");
if (!r)
throw new Error(".featureOf() requires a name");
if (!t10 || t10.type !== "Feature" || !t10.geometry)
throw new Error(
"Invalid input to " + r + ", Feature with geometry required"
);
if (!t10.geometry || t10.geometry.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t10.geometry.type
);
}
m0(ugt, "featureOf");
function hgt(t10, e, r) {
if (!t10)
throw new Error("No featureCollection passed");
if (!r)
throw new Error(".collectionOf() requires a name");
if (!t10 || t10.type !== "FeatureCollection")
throw new Error(
"Invalid input to " + r + ", FeatureCollection required"
);
for (const n of t10.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
);
}
}
m0(hgt, "collectionOf");
function dgt(t10) {
return t10.type === "Feature" ? t10.geometry : t10;
}
m0(dgt, "getGeom");
function pgt(t10, e) {
return t10.type === "FeatureCollection" ? "FeatureCollection" : t10.type === "GeometryCollection" ? "GeometryCollection" : t10.type === "Feature" && t10.geometry !== null ? t10.geometry.type : t10.type;
}
m0(pgt, "getType");
var DW = Object.defineProperty;
var Tgt = Object.defineProperties;
var fgt = Object.getOwnPropertyDescriptors;
var xR = Object.getOwnPropertySymbols;
var Qgt = Object.prototype.hasOwnProperty;
var mgt = Object.prototype.propertyIsEnumerable;
var ER = (t10, e, r) => e in t10 ? DW(t10, e, { enumerable: true, configurable: true, writable: true, value: r }) : t10[e] = r;
var $0 = (t10, e) => {
for (var r in e || (e = {}))
Qgt.call(e, r) && ER(t10, r, e[r]);
if (xR)
for (var r of xR(e))
mgt.call(e, r) && ER(t10, r, e[r]);
return t10;
};
var W0 = (t10, e) => Tgt(t10, fgt(e));
var ggt = (t10, e) => DW(t10, "name", { value: e, configurable: true });
function FW(t10, e, r = {}) {
if (!t10 || !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 Md(t10, function(o) {
const s = RW(o);
for (let a = 0; a < s.length - 1; a++) {
const u = Es(s[a]);
u.properties.dist = g5(e, u, r);
const d = Es(s[a + 1]);
d.properties.dist = g5(e, d, r);
const T = g5(u, d, r), f = Math.max(
u.properties.dist,
d.properties.dist
), Q = SH(u, d), y = iE(
e,
f,
Q + 90,
r
), _ = iE(
e,
f,
Q - 90,
r
), L = EW(
ra([
y.geometry.coordinates,
_.geometry.coordinates
]),
ra([u.geometry.coordinates, d.geometry.coordinates])
);
let E;
L.features.length > 0 && L.features[0] && (E = W0($0({}, L.features[0]), {
properties: {
dist: g5(e, L.features[0], r),
location: i + g5(u, L.features[0], r)
}
})), u.properties.dist < n.properties.dist && (n = W0($0({}, u), {
properties: W0($0({}, u.properties), { index: a, location: i })
})), d.properties.dist < n.properties.dist && (n = W0($0({}, d), {
properties: W0($0({}, d.properties), {
index: a + 1,
location: i + T
})
})), E && E.properties.dist < n.properties.dist && (n = W0($0({}, E), {
properties: W0($0({}, E.properties), { index: a })
})), i += T;
}
}), n;
}
ggt(FW, "nearestPointOnLine");
function ygt(t10) {
if (!t10)
throw new Error("geojson is required");
switch (t10.type) {
case "Feature":
return BW(t10);
case "FeatureCollection":
return vgt(t10);
case "Point":
case "LineString":
case "Polygon":
case "MultiPoint":
case "MultiLineString":
case "MultiPolygon":
case "GeometryCollection":
return VH(t10);
default:
throw new Error("unknown GeoJSON type");
}
}
function BW(t10) {
var e = { type: "Feature" };
return Object.keys(t10).forEach(function(r) {
switch (r) {
case "type":
case "properties":
case "geometry":
return;
default:
e[r] = t10[r];
}
}), e.properties = jW(t10.properties), e.geometry = VH(t10.geometry), e;
}
function jW(t10) {
var e = {};
return t10 && Object.keys(t10).forEach(function(r) {
var n = t10[r];
typeof n == "object" ? n === null ? e[r] = null : Array.isArray(n) ? e[r] = n.map(function(i) {
return i;
}) : e[r] = jW(n) : e[r] = n;
}), e;
}
function vgt(t10) {
var e = { type: "FeatureCollection" };
return Object.keys(t10).forEach(function(r) {
switch (r) {
case "type":
case "features":
return;
default:
e[r] = t10[r];
}
}), e.features = t10.features.map(function(r) {
return BW(r);
}), e;
}
function VH(t10) {
var e = { type: t10.type };
return t10.bbox && (e.bbox = t10.bbox), t10.type === "GeometryCollection" ? (e.geometries = t10.geometries.map(function(r) {
return VH(r);
}), e) : (e.coordinates = zW(t10.coordinates), e);
}
function zW(t10) {
var e = t10;
return typeof e[0] != "object" ? e.slice() : e.map(function(r) {
return zW(r);
});
}
function _gt(t10, e) {
return e === void 0 && (e = {}), bgt(t10, "mercator", e);
}
function bgt(t10, e, r) {
r === void 0 && (r = {}), r = r || {};
var n = r.mutate;
if (!t10)
throw new Error("geojson is required");
return Array.isArray(t10) && Vx(t10[0]) ? t10 = MR(t10) : (n !== true && (t10 = ygt(t10)), MH(t10, function(i) {
var o = MR(i);
i[0] = o[0], i[1] = o[1];
})), t10;
}
function MR(t10) {
var e = Math.PI / 180, r = 6378137, n = 20037508342789244e-9, i = Math.abs(t10[0]) <= 180 ? t10[0] : t10[0] - Lgt(t10[0]) * 360, o = [
r * i * e,
r * Math.log(Math.tan(Math.PI * 0.25 + 0.5 * t10[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 Lgt(t10) {
return t10 < 0 ? -1 : t10 > 0 ? 1 : 0;
}
var wgt = class {
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 xgt(t10, e = 1, r = false) {
let n = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
for (const [x, O] of t10[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 wgt([], (x, O) => O.max - x.max);
let f = Mgt(t10);
const Q = new lm(n + a / 2, i + u / 2, 0, t10);
Q.d > f.d && (f = Q);
let y = 2;
function _(x, O, k) {
const R = new lm(x, O, k, t10);
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 lm(t10, e, r, n) {
this.x = t10, this.y = e, this.h = r, this.d = Egt(t10, e, n), this.max = this.d + this.h * Math.SQRT2;
}
function Egt(t10, e, r) {
let n = false, 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 && t10 < (T[0] - d[0]) * (e - d[1]) / (T[1] - d[1]) + d[0] && (n = !n), i = Math.min(i, Sgt(t10, e, d, T));
}
return i === 0 ? 0 : (n ? 1 : -1) * Math.sqrt(i);
}
function Mgt(t10) {
let e = 0, r = 0, n = 0;
const i = t10[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 lm(r / e, n / e, 0, t10);
return e === 0 || o.d < 0 ? new lm(i[0][0], i[0][1], 0, t10) : o;
}
function Sgt(t10, 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 = ((t10 - 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 = t10 - i, a = e - o, s * s + a * a;
}
var di;
var ah;
var Rf;
var lh;
var Nf;
var _4 = class {
constructor(e = true) {
Ft(this, ah), Ft(this, lh), Ft(this, di, void 0), e.constructor !== Object ? Yt(this, di, e) : Yt(this, di, Object.assign({}, e));
}
get filter() {
return K(this, di);
}
clear() {
K(this, di) !== true && Yt(this, di, true);
}
expand(e) {
if (K(this, di) === false)
Yt(this, di, e);
else if (K(this, di) !== true) {
const r = Object.assign({}, e);
Yt(this, di, { OR: [K(this, di), r] });
}
}
invert() {
if (K(this, di) === false)
Yt(this, di, true);
else if (K(this, di) === true)
Yt(this, di, false);
else {
const e = Object.assign({}, K(this, di));
Yt(this, di, { NOT: e });
}
}
getStyleFilter() {
return se(this, ah, Rf).call(this, K(this, di));
}
match(e) {
return se(this, lh, Nf).call(this, e, K(this, di));
}
narrow(e) {
if (K(this, di) === true)
Yt(this, di, e);
else if (K(this, di) !== false) {
const r = Object.assign({}, e);
Yt(this, di, { AND: [K(this, di), r] });
}
}
setFilter(e) {
e.constructor !== Object ? Yt(this, di, e) : Yt(this, di, Object.assign({}, e));
}
};
di = /* @__PURE__ */ new WeakMap(), ah = /* @__PURE__ */ new WeakSet(), Rf = function(t10) {
if (t10.constructor !== Object)
return ["boolean", !!t10];
const e = [];
for (const [r, n] of Object.entries(t10))
if (r === "AND" || r === "OR")
Array.isArray(n) && n.length >= 1 ? e.push(
r === "AND" ? "all" : "any",
...n.map((i) => se(this, ah, Rf).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, ah, Rf).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;
}, lh = /* @__PURE__ */ new WeakSet(), Nf = function(t10, e) {
if (e.constructor !== Object)
return !!e;
for (const [r, n] of Object.entries(e)) {
let i = true;
if (r === "AND" || r === "OR")
if (Array.isArray(n) && n.length >= 1) {
const o = n.map((s) => se(this, lh, Nf).call(this, t10, s));
i = r === "AND" ? o.reduce((s, a) => s && a, true) : o.reduce((s, a) => s || a, false);
} else
console.warn(`makeFilter: Invalid ${r} operands: ${n}`);
else if (r === "EMPTY") {
const o = t10[n] || void 0;
i = !Array.isArray(o) || o.length === 0;
} else if (r === "HAS")
i = n in t10;
else if (r === "IN") {
const o = t10[n[1]] || void 0;
i = !Array.isArray(o) || o.includes(n[0]);
} else if (r === "NOT")
i = !se(this, lh, Nf).call(this, t10, n);
else if (r in t10) {
const o = t10[r];
Array.isArray(o) ? Array.isArray(n) ? i = !new z6(o).isDisjointFrom(new z6(n)) : i = o.includes(n) : Array.isArray(n) ? i = n.includes(o) : i = o === n;
}
if (!i)
return false;
}
return true;
};
var Hgt = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
var Z3 = function(t10) {
return typeof t10 == "string" ? t10.length > 0 : typeof t10 == "number";
};
var z1 = function(t10, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = Math.pow(10, e)), Math.round(r * t10) / r + 0;
};
var Ms = function(t10, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = 1), t10 > r ? r : t10 > e ? t10 : e;
};
var UW = function(t10) {
return (t10 = isFinite(t10) ? t10 % 360 : 0) > 0 ? t10 : t10 + 360;
};
var SR = function(t10) {
return { r: Ms(t10.r, 0, 255), g: Ms(t10.g, 0, 255), b: Ms(t10.b, 0, 255), a: Ms(t10.a) };
};
var EL = function(t10) {
return { r: z1(t10.r), g: z1(t10.g), b: z1(t10.b), a: z1(t10.a, 3) };
};
var Agt = /^#([0-9a-f]{3,8})$/i;
var gT = function(t10) {
var e = t10.toString(16);
return e.length < 2 ? "0" + e : e;
};
var GW = function(t10) {
var e = t10.r, r = t10.g, n = t10.b, i = t10.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 };
};
var $W = function(t10) {
var e = t10.h, r = t10.s, n = t10.v, i = t10.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 };
};
var HR = function(t10) {
return { h: UW(t10.h), s: Ms(t10.s, 0, 100), l: Ms(t10.l, 0, 100), a: Ms(t10.a) };
};
var AR = function(t10) {
return { h: z1(t10.h), s: z1(t10.s), l: z1(t10.l), a: z1(t10.a, 3) };
};
var OR = function(t10) {
return $W((r = (e = t10).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;
};
var ch = function(t10) {
return { h: (e = GW(t10)).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;
};
var Ogt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
var Cgt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
var kgt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
var Igt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
var CR = { string: [[function(t10) {
var e = Agt.exec(t10);
return e ? (t10 = e[1]).length <= 4 ? { r: parseInt(t10[0] + t10[0], 16), g: parseInt(t10[1] + t10[1], 16), b: parseInt(t10[2] + t10[2], 16), a: t10.length === 4 ? z1(parseInt(t10[3] + t10[3], 16) / 255, 2) : 1 } : t10.length === 6 || t10.length === 8 ? { r: parseInt(t10.substr(0, 2), 16), g: parseInt(t10.substr(2, 2), 16), b: parseInt(t10.substr(4, 2), 16), a: t10.length === 8 ? z1(parseInt(t10.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
}, "hex"], [function(t10) {
var e = kgt.exec(t10) || Igt.exec(t10);
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : SR({ 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(t10) {
var e = Ogt.exec(t10) || Cgt.exec(t10);
if (!e)
return null;
var r, n, i = HR({ h: (r = e[1], n = e[2], n === void 0 && (n = "deg"), Number(r) * (Hgt[n] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
return OR(i);
}, "hsl"]], object: [[function(t10) {
var e = t10.r, r = t10.g, n = t10.b, i = t10.a, o = i === void 0 ? 1 : i;
return Z3(e) && Z3(r) && Z3(n) ? SR({ r: Number(e), g: Number(r), b: Number(n), a: Number(o) }) : null;
}, "rgb"], [function(t10) {
var e = t10.h, r = t10.s, n = t10.l, i = t10.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = HR({ h: Number(e), s: Number(r), l: Number(n), a: Number(o) });
return OR(s);
}, "hsl"], [function(t10) {
var e = t10.h, r = t10.s, n = t10.v, i = t10.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = function(a) {
return { h: UW(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 $W(s);
}, "hsv"]] };
var kR = function(t10, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r][0](t10);
if (n)
return [n, e[r][1]];
}
return [null, void 0];
};
var Pgt = function(t10) {
return typeof t10 == "string" ? kR(t10.trim(), CR.string) : typeof t10 == "object" && t10 !== null ? kR(t10, CR.object) : [null, void 0];
};
var ML = function(t10, e) {
var r = ch(t10);
return { h: r.h, s: Ms(r.s + 100 * e, 0, 100), l: r.l, a: r.a };
};
var SL = function(t10) {
return (299 * t10.r + 587 * t10.g + 114 * t10.b) / 1e3 / 255;
};
var IR = function(t10, e) {
var r = ch(t10);
return { h: r.h, s: r.s, l: Ms(r.l + 100 * e, 0, 100), a: r.a };
};
var PR = function() {
function t10(e) {
this.parsed = Pgt(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
}
return t10.prototype.isValid = function() {
return this.parsed !== null;
}, t10.prototype.brightness = function() {
return z1(SL(this.rgba), 2);
}, t10.prototype.isDark = function() {
return SL(this.rgba) < 0.5;
}, t10.prototype.isLight = function() {
return SL(this.rgba) >= 0.5;
}, t10.prototype.toHex = function() {
return e = EL(this.rgba), r = e.r, n = e.g, i = e.b, s = (o = e.a) < 1 ? gT(z1(255 * o)) : "", "#" + gT(r) + gT(n) + gT(i) + s;
var e, r, n, i, o, s;
}, t10.prototype.toRgb = function() {
return EL(this.rgba);
}, t10.prototype.toRgbString = function() {
return e = EL(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;
}, t10.prototype.toHsl = function() {
return AR(ch(this.rgba));
}, t10.prototype.toHslString = function() {
return e = AR(ch(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;
}, t10.prototype.toHsv = function() {
return e = GW(this.rgba), { h: z1(e.h), s: z1(e.s), v: z1(e.v), a: z1(e.a, 3) };
var e;
}, t10.prototype.invert = function() {
return ja({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
var e;
}, t10.prototype.saturate = function(e) {
return e === void 0 && (e = 0.1), ja(ML(this.rgba, e));
}, t10.prototype.desaturate = function(e) {
return e === void 0 && (e = 0.1), ja(ML(this.rgba, -e));
}, t10.prototype.grayscale = function() {
return ja(ML(this.rgba, -1));
}, t10.prototype.lighten = function(e) {
return e === void 0 && (e = 0.1), ja(IR(this.rgba, e));
}, t10.prototype.darken = function(e) {
return e === void 0 && (e = 0.1), ja(IR(this.rgba, -e));
}, t10.prototype.rotate = function(e) {
return e === void 0 && (e = 15), this.hue(this.hue() + e);
}, t10.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;
}, t10.prototype.hue = function(e) {
var r = ch(this.rgba);
return typeof e == "number" ? ja({ h: e, s: r.s, l: r.l, a: r.a }) : z1(r.h);
}, t10.prototype.isEqual = function(e) {
return this.toHex() === ja(e).toHex();
}, t10;
}();
var ja = function(t10) {
return t10 instanceof PR ? t10 : new PR(t10);
};
var VR = {
ILX: 7,
UBERON: 7
};
var Gg = class _Gg 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 _Gg(Array(...this).slice(e, r));
}
};
var T9;
var Vgt = class {
constructor() {
Ft(this, T9, void 0), Yt(this, T9, Promise.resolve());
}
lock() {
let e = (r) => {
};
return Yt(this, T9, K(this, T9).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();
}
}
};
T9 = /* @__PURE__ */ new WeakMap();
function yT(t10) {
if (!t10.includes(":"))
return t10;
const e = t10.split(":"), r = e[e.length - 1];
return e[0].toUpperCase() in VR && "0123456789".includes(r[0]) ? (e[e.length - 1] = r.padStart(VR[e[0].toUpperCase()], "0"), e.join(":")) : t10;
}
function p8(t10, e) {
if (t10 == null)
return e;
for (const [r, n] of Object.entries(e))
r in t10 || (t10[r] = n);
return t10;
}
function RR(t10) {
const e = /* @__PURE__ */ new Map();
for (const [r, n] of t10.entries())
for (const i of n)
e.has(i) ? e.get(i).add(r) : e.set(i, /* @__PURE__ */ new Set([r]));
return e;
}
function Rgt(t10, e = 0) {
let r;
return function(...n) {
clearTimeout(r), r = setTimeout(() => t10.apply(this, n), e);
};
}
var W2 = "pathways";
var Ngt = "ilxtr:";
var cm = [
{ 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: true },
{ 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: true },
{ type: "other", label: "Other neuron type", colour: "#888" },
{ type: "arterial", label: "Arterial blood vessel", colour: "#F00", enabled: false },
{ type: "venous", label: "Venous blood vessel", colour: "#2F6EBA", enabled: false },
{ type: "centreline", label: "Nerve centrelines", colour: "#CCC", enabled: false },
{ type: "error", label: "Paths with errors or warnings", colour: "#FF0", enabled: false }
];
var Df = new Map(cm.map((t10) => [t10.type, t10]));
var WW = cm.flatMap((t10) => [["==", ["get", "kind"], t10.type], t10.colour]);
function Dgt(t10, e = 255) {
const r = ja(Df.has(t10) ? Df.get(t10).colour : Df.get("other").colour).toRgb();
return [r.r, r.g, r.b, e];
}
var Fgt = ["NO-NERVES", "No associated nerves"];
var Ff;
var f9;
var E7;
var Q9;
var Bf;
var m9;
var J3;
var O6;
var a4;
var M7;
var za;
var u4;
var C6;
var g9;
var S7;
var k6;
var t42;
var s5;
var lE;
var ZW;
var Ua;
var e4;
var qW;
var H7;
var uh;
var jf;
var cE;
var Bgt = class {
constructor(e, r) {
if (Ft(this, lE), Ft(this, Ua), Ft(this, qW), Ft(this, jf), Ft(this, Ff, void 0), Ft(this, f9, /* @__PURE__ */ new Map()), Ft(this, E7, void 0), Ft(this, Q9, false), Ft(this, Bf, void 0), Ft(this, m9, true), Ft(this, J3, void 0), Ft(this, O6, /* @__PURE__ */ new Map()), Ft(this, a4, void 0), Ft(this, M7, /* @__PURE__ */ new Map()), Ft(this, za, void 0), Ft(this, u4, void 0), Ft(this, C6, void 0), Ft(this, g9, void 0), Ft(this, S7, void 0), Ft(this, k6, void 0), Ft(this, t42, void 0), Ft(this, s5, void 0), Ft(this, H7, 0), Ft(this, uh, /* @__PURE__ */ new Map()), Yt(this, Bf, e), Yt(this, s5, r), Yt(this, E7, {}), Yt(this, S7, {}), "models" in e.pathways)
for (const a of e.pathways.models) {
K(this, E7)[a.id] = a.paths;
for (const u of a.paths)
K(this, S7)[u] = a.id;
}
Yt(this, za, {}), Yt(this, k6, {}), Yt(this, u4, {});
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, M7).set(a, u.lines), n.set(a, u.nerves), K(this, u4)[a] = u, K(this, u4)[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, k6)[a] = d;
}
for (const d of u.centrelines || [])
K(this, O6).has(d) || K(this, O6).set(d, /* @__PURE__ */ new Set()), K(this, O6).get(d).add(a);
}
Yt(this, C6, RR(K(this, M7))), Yt(this, g9, RR(n));
const i = e.pathways["node-paths"];
Yt(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);
Yt(this, Ff, o);
const s = {};
Yt(this, t42, {});
for (const a of cm)
s[a.type] = a, K(this, t42)[a.type] = !("enabled" in a) || a.enabled;
Yt(this, a4, {}), K(this, a4).other = [];
for (const [a, u] of Object.entries(e.pathways["type-paths"]))
if (a in s ? K(this, a4)[a] = u : (K(this, a4).other.push(...u), K(this, t42)[a] = false), a === "centreline")
for (const d of u) {
const T = e.annotationById(d);
(e.options.style === no.CENTRELINE || K(this, O6).has(d)) && T && "models" in T && K(this, f9).set(T.models, T.label || T.models);
}
se(this, lE, ZW).call(this), e.options.style === no.CENTRELINE ? Yt(this, Q9, true) : Yt(this, m9, K(this, f9).size > 0);
}
get nerveCentrelineDetails() {
return [Fgt, ...K(this, f9).entries()].map((e) => {
const r = e[1];
return {
models: e[0],
label: r.charAt(0).toUpperCase() + r.slice(1)
};
});
}
get haveCentrelines() {
return K(this, m9);
}
get enabledCentrelines() {
return K(this, Q9);
}
pathStyles() {
const e = [];
for (const r of this.pathTypes()) {
const n = Df.get(r.type);
e.push({
type: n.type,
colour: n.colour,
dashed: n.dashed || false
});
}
return e;
}
pathTypes() {
const e = [];
for (const r of cm)
r.type in K(this, a4) && K(this, a4)[r.type].length > 0 && (r.type === "centreline" ? K(this, Bf).options.style !== no.CENTRELINE && (Yt(this, m9, true), Yt(this, Q9, K(this, t42)[r.type])) : e.push({
...r,
enabled: K(this, t42)[r.type]
}));
return e;
}
allFeatureIds() {
return K(this, Ff);
}
lineFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
for (const n of e)
K(this, C6).has(n) && se(this, Ua, e4).call(this, K(this, C6).get(n), r);
return r;
}
nerveFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return K(this, g9).has(e) && se(this, Ua, e4).call(this, K(this, g9).get(e), r), r;
}
pathProperties(e) {
const r = Object.assign({}, e.properties);
if (K(this, C6).has(e.id))
for (const n of K(this, C6).get(e.id))
n in K(this, S7) && (r.connectivity = K(this, S7)[n]), n in K(this, k6) && (r.models = K(this, k6)[n]);
return r;
}
connectivityModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, E7) && se(this, Ua, e4).call(this, K(this, E7)[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 = false) {
for (const n of K(this, C6).keys())
K(this, s5).enableFeature(n, e, r);
}
enablePathsByCentreline(e, r, n = false) {
if (K(this, O6).has(e)) {
if (K(this, M7).has(e))
for (const o of K(this, M7).get(e))
K(this, s5).enableFeature(o, r, n);
const i = /* @__PURE__ */ new Set();
se(this, Ua, e4).call(this, K(this, O6).get(e), i);
for (const o of i)
K(this, s5).enableFeature(o, r, n);
se(this, jf, cE).call(this);
}
}
enablePathsBySystem(e, r, n = false) {
let i = false;
for (const o of e.pathIds) {
const s = K(this, u4)[o];
if (K(this, t42)[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, s5).enableFeature(u, r, n);
i = true;
}
s.systemCount += r ? 1 : -1, s.systemCount < 0 && (s.systemCount = 0);
}
i && se(this, jf, cE).call(this);
}
pathTypeEnabled(e) {
return K(this, t42)[e] || false;
}
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, k6) && r.add(K(this, k6)[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, u4)[n].nodes)
r.add(i);
return r;
}
addWatcher(e) {
return Yt(this, H7, K(this, H7) + 1), K(this, uh).set(K(this, H7), e), K(this, H7);
}
removeWatcher(e) {
K(this, uh).delete(e);
}
};
Ff = /* @__PURE__ */ new WeakMap(), f9 = /* @__PURE__ */ new WeakMap(), E7 = /* @__PURE__ */ new WeakMap(), Q9 = /* @__PURE__ */ new WeakMap(), Bf = /* @__PURE__ */ new WeakMap(), m9 = /* @__PURE__ */ new WeakMap(), J3 = /* @__PURE__ */ new WeakMap(), O6 = /* @__PURE__ */ new WeakMap(), a4 = /* @__PURE__ */ new WeakMap(), M7 = /* @__PURE__ */ new WeakMap(), za = /* @__PURE__ */ new WeakMap(), u4 = /* @__PURE__ */ new WeakMap(), C6 = /* @__PURE__ */ new WeakMap(), g9 = /* @__PURE__ */ new WeakMap(), S7 = /* @__PURE__ */ new WeakMap(), k6 = /* @__PURE__ */ new WeakMap(), t42 = /* @__PURE__ */ new WeakMap(), s5 = /* @__PURE__ */ new WeakMap(), lE = /* @__PURE__ */ new WeakSet(), ZW = function() {
for (const [t10, e] of Object.entries(K(this, a4)))
for (const r of e)
K(this, u4)[r].pathType = t10;
}, Ua = /* @__PURE__ */ new WeakSet(), e4 = function(t10, e) {
for (const r of t10) {
const n = K(this, u4)[r];
n.lines.forEach((i) => e.add(i)), n.nerves.forEach((i) => e.add(i)), n.nodes.forEach((i) => e.add(i));
}
}, qW = /* @__PURE__ */ new WeakSet(), H7 = /* @__PURE__ */ new WeakMap(), uh = /* @__PURE__ */ new WeakMap(), jf = /* @__PURE__ */ new WeakSet(), cE = function(t10 = {}) {
for (const e of K(this, uh).values())
e(t10);
};
var XW = class A7 {
/************************
* 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 = A7._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 = A7._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 = A7._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(A7._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 = A7.getTemplate(e, o);
return s = s.replace(/{color}/g, n).replace(/{secondaryColor}/g, i).replace(/{text}/g, r || ""), s;
}
};
XW._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: ''
};
var uE = XW;
var jgt = class {
/************************
* 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;
/